diff --git a/.bower.json b/.bower.json
index 7f90513f16..8d11dcc4cb 100644
--- a/.bower.json
+++ b/.bower.json
@@ -1,7 +1,7 @@
{
"name": "alasql",
"description":"AlaSQL.js - JavaScript SQL database library for relational and graph data manipulation with support of localStorage, IndexedDB, and Excel",
- "version": "0.1.8",
+ "version": "0.1.9",
"license": "MIT",
"keywords": [
"sql",
@@ -31,7 +31,7 @@
},
"dependencies": {
"js-xls": "~0.7.5",
- "js-xlsx":"0.8.0",
+ "xlsx":"0.8.0",
"es6-promise":"2.1.0"
},
"devDependencies": {
@@ -54,4 +54,4 @@
"bin",
"lib"
]
-}
\ No newline at end of file
+}
diff --git a/CHANGELOG.md b/CHANGELOG.md
index dce1b9c2f0..621ba203d6 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,12 @@
# Changelog
+### 0.1.9 "Torino" (29.05.2015 - 31.05.2015)
+* SERIAL data type added
+* Changed package.json
+* Sample application AlaSQL Codex (alasql.org/codex)
+* Changed type conversion procedure for INTEGER, JSON and other types
+* TypeScript definition file: alasql.d.ts
+
### 0.1.8 "Pisa" (22.05.2015 - 28.05.2015)
* SELECT FROM syntax
* Export to multiple sheets workbook
@@ -9,7 +16,6 @@
* VALUE OF SELECT operator
* bitHound file
-
### 0.1.7 "Parma" (17.05.2015 - 22.05.2015)
* Fixed BETWEEN AND and AND parsing priority bug (KPI1:95%)
* Fixed SUM() with NULL(undefined) values
diff --git a/README.md b/README.md
index c1e57369b7..c5b56538ce 100644
--- a/README.md
+++ b/README.md
@@ -21,8 +21,8 @@ AlaSQL - ([à la] (http://en.wiktionary.org/wiki/%C3%A0_la) [SQL](http://en.wiki
### This release:
-- Version: 0.1.8 "Pisa"
-- Updated: May 28, 2015,
+- Version: 0.1.9 "Torino"
+- Updated: May 31, 2015,
- Test cover: [SQLLOGICTEST=62%, NIST=24%](TESTLOG.md)
- [Change log](CHANGELOG.md)
- [Release plan](RELEASES.md).
@@ -96,12 +96,12 @@ and require the alasql.js file
## Why we are proud of AlaSQL?
-* AlaSQL ♥ d3.js [see why](#d3js--alasql)
-* AlaSQL ♥ Meteor [see why](#alasql-and-meteor)
-* AlaSQL ♥ Angular.js [see why](#angularjs-and-alasqljs)
-* AlaSQL ♥ Google Maps [see why](#google-maps--alasql)
-* AlaSQL ♥ your JSON data [see why](#javascript-sugar)
-* AlaSQL ♥ Google Spreadsheets [see why](#google-maps--alasql)
+* AlaSQL ♥ d3.js [see why](https://github.com/agershun/alasql/wiki/readme#d3js--alasql)
+* AlaSQL ♥ Meteor [see why](https://github.com/agershun/alasql/wiki/readme#alasql-and-meteor)
+* AlaSQL ♥ Angular.js [see why](https://github.com/agershun/alasql/wiki/readme#angularjs-and-alasqljs)
+* AlaSQL ♥ Google Maps [see why](https://github.com/agershun/alasql/wiki/readme#google-maps--alasql)
+* AlaSQL ♥ your JSON data [see why](https://github.com/agershun/alasql/wiki/readme#javascript-sugar)
+* AlaSQL ♥ Google Spreadsheets [see why](https://github.com/agershun/alasql/wiki/readme#google-maps--alasql)
* Search paths in graph data
* Read and write Excel, CSV, TAB, JSON, and text files to/from the database
* Got some CPU intensive SQL? AlaSQL plays nice as a WebWorker
diff --git a/console/alasql-worker.min.js b/console/alasql-worker.min.js
new file mode 100644
index 0000000000..0b7e8cb9f8
--- /dev/null
+++ b/console/alasql-worker.min.js
@@ -0,0 +1 @@
+(function(root,factory){if(typeof define==="function"&&define.amd){define([],factory)}else if(typeof exports==="object"){module.exports=factory()}else{root.alasql=factory()}})(this,function(){function alasql(sql,params,cb){var id=alasql.lastid++;alasql.buffer[id]=cb;alasql.webworker.postMessage({id:id,sql:sql,params:params})}if(typeof importScripts==="function"){}else if(typeof exports!="object"){alasql.worker=function(path,paths,cb){if(path===true)path=undefined;if(typeof path=="undefined"){var sc=document.getElementsByTagName("script");for(var i=0;i1){var sql="REQUIRE "+paths.map(function(p){return'"'+p+'"'}).join(",");alasql(sql,[],cb)}}else if(path===false){delete alasql.webworker;return}}}alasql.lastid=0;alasql.buffer={};alasql.worker();return alasql});
\ No newline at end of file
diff --git a/console/alasql.min.js b/console/alasql.min.js
new file mode 100644
index 0000000000..a1cc1d1dcb
--- /dev/null
+++ b/console/alasql.min.js
@@ -0,0 +1,10 @@
+(function(root,factory){if(typeof define==="function"&&define.amd){define([],factory)}else if(typeof exports==="object"){module.exports=factory()}else{root.alasql=factory()}})(this,function(){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){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){var select=new yy.Select({columns:[new yy.Column({columnid:"*"})],from:[new yy.ParamValue({param:0})]});select.preparams=[sql];return select}else{if(typeof sql=="string"&&sql[0]=="#"&&typeof document=="object"){sql=document.querySelector(sql).textContent}else if(typeof sql=="object"&&sql instanceof HTMElement){sql=sql.textContent}else if(typeof sql=="function"){sql=sql.toString().slice(14,-3)}return alasql.exec(sql,params,cb,scope)}}};alasql.version="0.1.9";alasql.debug=undefined;getAlaSQLPath();function getAlaSQLPath(){alasql.path="";if(typeof importScripts==="function"){alasql.path=""}else if(typeof exports!="undefined"){alasql.path=__dirname}else if(typeof Meteor=="object"&&Meteor.isClient){alasql.path="/packages/dist/"}else if(typeof Meteor=="object"&&Meteor.isServer){alasql.path="assets/packages/dist/"}else if(typeof document!="undefined"){var sc=document.getElementsByTagName("script");for(var i=0;i1&&($$[$0-4].toUpperCase()=="MAX"||$$[$0-4].toUpperCase()=="MIN")){this.$=new yy.FuncValue({funcid:$$[$0-4],args:$$[$0-2]})}else{this.$=new yy.AggrValue({aggregatorid:$$[$0-4].toUpperCase(),expression:$$[$0-2].pop(),over:$$[$0]})}break;case 299:this.$=new yy.AggrValue({aggregatorid:$$[$0-5].toUpperCase(),expression:$$[$0-2],distinct:true,over:$$[$0]});break;case 300:this.$=new yy.AggrValue({aggregatorid:$$[$0-5].toUpperCase(),expression:$$[$0-2],over:$$[$0]});break;case 302:case 303:this.$=new yy.Over;yy.extend(this.$,$$[$0-1]);break;case 304:this.$=new yy.Over;yy.extend(this.$,$$[$0-2]);yy.extend(this.$,$$[$0-1]);break;case 305:this.$={partition:$$[$0]};break;case 306:this.$={order:$$[$0]};break;case 307:this.$="SUM";break;case 308:this.$="COUNT";break;case 309:this.$="MIN";break;case 310:case 486:this.$="MAX";break;case 311:this.$="AVG";break;case 312:this.$="FIRST";break;case 313:this.$="LAST";break;case 314:this.$="AGGR";break;case 315:this.$="ARRAY";break;case 316:var funcid=$$[$0-4];var exprlist=$$[$0-1];if(exprlist.length>1&&(funcid.toUpperCase()=="MIN"||funcid.toUpperCase()=="MAX")){this.$=new yy.FuncValue({funcid:funcid,args:exprlist})}else if(alasql.aggr[$$[$0-4]]){this.$=new yy.AggrValue({aggregatorid:"REDUCE",funcid:funcid,expression:exprlist.pop(),distinct:$$[$0-2]=="DISTINCT"})}else{this.$=new yy.FuncValue({funcid:funcid,args:exprlist})};break;case 317:this.$=new yy.FuncValue({funcid:$$[$0-2]});break;case 319:$$[$0-2].push($$[$0]);this.$=$$[$0-2];break;case 320:this.$=new yy.NumValue({value:+$$[$0]});break;case 321:this.$=new yy.LogicValue({value:true});break;case 322:this.$=new yy.LogicValue({value:false});break;case 323:this.$=new yy.StringValue({value:$$[$0].substr(1,$$[$0].length-2).replace(/(\\\')/g,"'").replace(/(\'\')/g,"'")});break;case 324:this.$=new yy.StringValue({value:$$[$0].substr(2,$$[$0].length-3).replace(/(\\\')/g,"'").replace(/(\'\')/g,"'")});break;case 325:this.$=new yy.NullValue({value:undefined});break;case 326:this.$=new yy.VarValue({variable:$$[$0]});break;case 327:if(!yy.exists)yy.exists=[];this.$=new yy.ExistsValue({value:$$[$0-1],existsidx:yy.exists.length});yy.exists.push($$[$0-1]);break;case 328:case 329:this.$=new yy.ParamValue({param:$$[$0]});break;case 330:if(typeof yy.question=="undefined")yy.question=0;this.$=new yy.ParamValue({param:yy.question++});break;case 331:if(typeof yy.question=="undefined")yy.question=0;this.$=new yy.ParamValue({param:yy.question++,array:true});break;case 332:this.$=new yy.CaseValue({expression:$$[$0-3],whens:$$[$0-2],elses:$$[$0-1]});break;case 333:this.$=new yy.CaseValue({whens:$$[$0-2],elses:$$[$0-1]});break;case 334:case 635:case 636:this.$=$$[$0-1];this.$.push($$[$0]);break;case 336:this.$={when:$$[$0-2],then:$$[$0]};break;case 339:this.$=new yy.Op({left:$$[$0-2],op:"LIKE",right:$$[$0]});break;case 340:this.$=new yy.Op({left:$$[$0-2],op:"NOT LIKE",right:$$[$0]});break;case 341:this.$=new yy.Op({left:$$[$0-2],op:"+",right:$$[$0]});break;case 342:this.$=new yy.Op({left:$$[$0-2],op:"-",right:$$[$0]});break;case 343:this.$=new yy.Op({left:$$[$0-2],op:"*",right:$$[$0]});break;case 344:this.$=new yy.Op({left:$$[$0-2],op:"/",right:$$[$0]});break;case 345:this.$=new yy.Op({left:$$[$0-2],op:"%",right:$$[$0]});break;case 346:this.$=new yy.Op({left:$$[$0-2],op:"^",right:$$[$0]});break;case 347:case 348:case 350:this.$=new yy.Op({left:$$[$0-2],op:"->",right:$$[$0]});break;case 349:this.$=new yy.Op({left:$$[$0-4],op:"->",right:$$[$0-1]});break;case 351:case 352:case 354:this.$=new yy.Op({left:$$[$0-2],op:"!",right:$$[$0]});break;case 353:this.$=new yy.Op({left:$$[$0-4],op:"!",right:$$[$0-1]});break;case 355:this.$=new yy.Op({left:$$[$0-2],op:">",right:$$[$0]});break;case 356:this.$=new yy.Op({left:$$[$0-2],op:">=",right:$$[$0]});break;case 357:this.$=new yy.Op({left:$$[$0-2],op:"<",right:$$[$0]});break;case 358:this.$=new yy.Op({left:$$[$0-2],op:"<=",right:$$[$0]});break;case 359:this.$=new yy.Op({left:$$[$0-2],op:"=",right:$$[$0]});break;case 360:this.$=new yy.Op({left:$$[$0-2],op:"==",right:$$[$0]});break;case 361:this.$=new yy.Op({left:$$[$0-2],op:"===",right:$$[$0]});break;case 362:this.$=new yy.Op({left:$$[$0-2],op:"!=",right:$$[$0]});break;case 363:this.$=new yy.Op({left:$$[$0-2],op:"!==",right:$$[$0]});break;case 364:this.$=new yy.Op({left:$$[$0-2],op:"!===",right:$$[$0]});break;case 365:if(!yy.queries)yy.queries=[];this.$=new yy.Op({left:$$[$0-5],op:$$[$0-4],allsome:$$[$0-3],right:$$[$0-1],queriesidx:yy.queries.length});yy.queries.push($$[$0-1]);break;case 366:this.$=new yy.Op({left:$$[$0-5],op:$$[$0-4],allsome:$$[$0-3],right:$$[$0-1]});break;case 367:if($$[$0-2].op=="BETWEEN1"){if($$[$0-2].left.op=="AND"){this.$=new yy.Op({left:$$[$0-2].left.left,op:"AND",right:new yy.Op({left:$$[$0-2].left.right,op:"BETWEEN",right1:$$[$0-2].right,right2:$$[$0]})})}else{this.$=new yy.Op({left:$$[$0-2].left,op:"BETWEEN",right1:$$[$0-2].right,right2:$$[$0]})}}else if($$[$0-2].op=="NOT BETWEEN1"){if($$[$0-2].left.op=="AND"){this.$=new yy.Op({left:$$[$0-2].left.left,op:"AND",right:new yy.Op({left:$$[$0-2].left.right,op:"NOT BETWEEN",right1:$$[$0-2].right,right2:$$[$0]})})}else{this.$=new yy.Op({left:$$[$0-2].left,op:"NOT BETWEEN",right1:$$[$0-2].right,right2:$$[$0]})}}else{this.$=new yy.Op({left:$$[$0-2],op:"AND",right:$$[$0]})}break;case 368:this.$=new yy.Op({left:$$[$0-2],op:"OR",right:$$[$0]});break;case 369:this.$=new yy.UniOp({op:"NOT",right:$$[$0]});break;case 370:this.$=new yy.UniOp({op:"-",right:$$[$0]});break;case 371:this.$=new yy.UniOp({op:"+",right:$$[$0]});break;case 372:this.$=new yy.UniOp({op:"#",right:$$[$0]});break;case 373:this.$=new yy.UniOp({right:$$[$0-1]});break;case 374:if(!yy.queries)yy.queries=[];this.$=new yy.Op({left:$$[$0-4],op:"IN",right:$$[$0-1],queriesidx:yy.queries.length});yy.queries.push($$[$0-1]);break;case 375:if(!yy.queries)yy.queries=[];this.$=new yy.Op({left:$$[$0-5],op:"NOT IN",right:$$[$0-1],queriesidx:yy.queries.length});yy.queries.push($$[$0-1]);break;case 376:this.$=new yy.Op({left:$$[$0-4],op:"IN",right:$$[$0-1]});break;case 377:this.$=new yy.Op({left:$$[$0-5],op:"NOT IN",right:$$[$0-1]});break;case 378:this.$=new yy.Op({left:$$[$0-3],op:"IN",right:[]});break;case 379:this.$=new yy.Op({left:$$[$0-4],op:"NOT IN",right:[]});break;case 380:case 382:this.$=new yy.Op({left:$$[$0-2],op:"IN",right:$$[$0]});break;case 381:case 383:this.$=new yy.Op({left:$$[$0-3],op:"NOT IN",right:$$[$0]});break;case 384:this.$=new yy.Op({left:$$[$0-2],op:"BETWEEN1",right:$$[$0]});break;case 385:this.$=new yy.Op({left:$$[$0-2],op:"NOT BETWEEN1",right:$$[$0]});break;case 386:this.$=new yy.Op({op:"IS",left:$$[$0-2],right:$$[$0]});break;case 387:this.$=new yy.Convert({expression:$$[$0-2]});yy.extend(this.$,$$[$0]);break;case 388:case 389:this.$=$$[$0];break;case 390:this.$=$$[$0-1];break;case 397:this.$="ALL";break;case 398:this.$="SOME";break;case 399:this.$="ANY";break;case 400:this.$=new yy.Update({table:$$[$0-4],columns:$$[$0-2],where:$$[$0]});break;case 401:this.$=new yy.Update({table:$$[$0-2],columns:$$[$0]});break;case 404:this.$=new yy.SetColumn({column:$$[$0-2],expression:$$[$0]});break;case 405:this.$=new yy.SetColumn({variable:$$[$0-2],expression:$$[$0],method:$$[$0-3]});break;case 406:this.$=new yy.Delete({table:$$[$0-2],where:$$[$0]});break;case 407:this.$=new yy.Delete({table:$$[$0]});break;case 408:this.$=new yy.Insert({into:$$[$0-2],values:$$[$0]});break;case 409:this.$=new yy.Insert({into:$$[$0-2],"default":true});break;case 410:this.$=new yy.Insert({into:$$[$0-5],columns:$$[$0-3],values:$$[$0]});break;case 411:this.$=new yy.Insert({into:$$[$0-1],select:$$[$0]});break;case 412:this.$=new yy.Insert({into:$$[$0-4],columns:$$[$0-2],select:$$[$0]});break;case 415:this.$=[$$[$0-1]];break;case 418:this.$=$$[$0-4];$$[$0-4].push($$[$0-1]);break;case 419:case 420:case 422:case 430:this.$=$$[$0-2];$$[$0-2].push($$[$0]);break;case 431:this.$=new yy.CreateTable({table:$$[$0-4]});yy.extend(this.$,$$[$0-7]);yy.extend(this.$,$$[$0-6]);yy.extend(this.$,$$[$0-5]);yy.extend(this.$,$$[$0-2]);yy.extend(this.$,$$[$0]);break;case 432:this.$=new yy.CreateTable({table:$$[$0]});yy.extend(this.$,$$[$0-3]);yy.extend(this.$,$$[$0-2]);yy.extend(this.$,$$[$0-1]);break;case 434:this.$={"class":true};break;case 443:this.$={temporary:true};break;case 445:this.$={ifnotexists:true};break;case 446:this.$={columns:$$[$0-2],constraints:$$[$0]};break;case 447:this.$={columns:$$[$0]};break;case 448:this.$={as:$$[$0]};break;case 449:case 473:this.$=[$$[$0]];break;case 451:case 452:case 453:case 454:case 455:$$[$0].constraintid=$$[$0-1];this.$=$$[$0];break;case 458:this.$={type:"CHECK",expression:$$[$0-1]};break;case 459:this.$={type:"PRIMARY KEY",columns:$$[$0-1],clustered:($$[$0-3]+"").toUpperCase()};break;case 460:this.$={type:"FOREIGN KEY",columns:$$[$0-5],fktable:$$[$0-2],fkcolumns:$$[$0-1]};break;case 461:case 491:case 522:case 558:case 576:case 579:case 598:this.$=$$[$0-1];break;case 466:this.$={type:"UNIQUE",columns:$$[$0-1],clustered:($$[$0-3]+"").toUpperCase()};break;case 475:this.$=new yy.ColumnDef({columnid:$$[$0-2]});yy.extend(this.$,$$[$0-1]);yy.extend(this.$,$$[$0]);break;case 476:this.$=new yy.ColumnDef({columnid:$$[$0-1]});yy.extend(this.$,$$[$0]);break;case 477:this.$=new yy.ColumnDef({columnid:$$[$0],dbtypeid:""});break;case 478:this.$={dbtypeid:$$[$0-5],dbsize:$$[$0-3],dbprecision:+$$[$0-1]};break;case 479:this.$={dbtypeid:$$[$0-6]+($$[$0-5]?" "+$$[$0-5]:""),dbsize:$$[$0-3],dbprecision:+$$[$0-1]};break;case 480:this.$={dbtypeid:$$[$0-3],dbsize:$$[$0-1]};break;case 481:this.$={dbtypeid:$$[$0-4]+($$[$0-3]?" "+$$[$0-3]:""),dbsize:$$[$0-1]};break;case 482:this.$={dbtypeid:$$[$0]};break;case 483:this.$={dbtypeid:$$[$0-1]+($$[$0]?" "+$$[$0]:"")};break;case 484:this.$={dbtypeid:"ENUM",enumvalues:$$[$0-1]};break;case 485:case 678:this.$=+$$[$0];break;case 487:this.$=undefined;break;case 489:yy.extend($$[$0-1],$$[$0]);this.$=$$[$0-1];break;case 492:this.$={primarykey:true};break;case 493:case 494:this.$={foreignkey:{table:$$[$0-1],columnid:$$[$0]}};break;case 495:this.$={identity:{value:$$[$0-3],step:$$[$0-1]}};break;case 496:this.$={identity:{value:1,step:1}};break;case 497:this.$={"default":$$[$0]};break;case 498:this.$={"default":$$[$0-1]};break;case 499:this.$={"null":true};break;case 500:this.$={notnull:true};break;case 501:this.$={check:$$[$0]};break;case 502:this.$={unique:true};break;case 503:this.$=new yy.DropTable({table:$$[$0],type:$$[$0-2]});yy.extend(this.$,$$[$0-1]);break;case 505:this.$={ifexists:true};break;case 506:this.$=new yy.AlterTable({table:$$[$0-3],renameto:$$[$0]});break;case 507:this.$=new yy.AlterTable({table:$$[$0-3],addcolumn:$$[$0]});break;case 508:this.$=new yy.AlterTable({table:$$[$0-3],modifycolumn:$$[$0]});break;case 509:this.$=new yy.AlterTable({table:$$[$0-5],renamecolumn:$$[$0-2],to:$$[$0]});break;case 510:this.$=new yy.AlterTable({table:$$[$0-3],dropcolumn:$$[$0]});break;case 511:this.$=new yy.AlterTable({table:$$[$0-2],renameto:$$[$0]});break;case 512:this.$=new yy.AttachDatabase({databaseid:$$[$0],engineid:$$[$0-2].toUpperCase()});break;case 513:this.$=new yy.AttachDatabase({databaseid:$$[$0-3],engineid:$$[$0-5].toUpperCase(),args:$$[$0-1]});break;case 514:this.$=new yy.AttachDatabase({databaseid:$$[$0-2],engineid:$$[$0-4].toUpperCase(),as:$$[$0]});break;case 515:this.$=new yy.AttachDatabase({databaseid:$$[$0-5],engineid:$$[$0-7].toUpperCase(),as:$$[$0],args:$$[$0-3]});break;case 516:this.$=new yy.DetachDatabase({databaseid:$$[$0]});break;case 517:this.$=new yy.CreateDatabase({databaseid:$$[$0]});yy.extend(this.$,$$[$0]);break;case 518:this.$=new yy.CreateDatabase({engineid:$$[$0-4].toUpperCase(),databaseid:$$[$0-1],as:$$[$0]});yy.extend(this.$,$$[$0-2]);break;case 519:this.$=new yy.CreateDatabase({engineid:$$[$0-7].toUpperCase(),databaseid:$$[$0-4],args:$$[$0-2],as:$$[$0]});yy.extend(this.$,$$[$0-5]);break;case 520:this.$=new yy.CreateDatabase({engineid:$$[$0-4].toUpperCase(),as:$$[$0],args:[$$[$0-1]]});yy.extend(this.$,$$[$0-2]);break;case 521:this.$=undefined;break;case 523:case 524:this.$=new yy.UseDatabase({databaseid:$$[$0]});break;case 525:this.$=new yy.DropDatabase({databaseid:$$[$0]});yy.extend(this.$,$$[$0-1]);break;case 526:case 527:this.$=new yy.DropDatabase({databaseid:$$[$0],engineid:$$[$0-3].toUpperCase()});yy.extend(this.$,$$[$0-1]);break;case 528:this.$=new yy.CreateIndex({indexid:$$[$0-5],table:$$[$0-3],columns:$$[$0-1]});break;case 529:this.$=new yy.CreateIndex({indexid:$$[$0-5],table:$$[$0-3],columns:$$[$0-1],unique:true});break;case 530:this.$=new yy.DropIndex({indexid:$$[$0]});break;case 531:this.$=new yy.ShowDatabases;break;case 532:this.$=new yy.ShowDatabases({like:$$[$0]});break;case 533:this.$=new yy.ShowDatabases({engineid:$$[$0-1].toUpperCase()});break;case 534:this.$=new yy.ShowDatabases({engineid:$$[$0-3].toUpperCase(),like:$$[$0]});break;case 535:this.$=new yy.ShowTables;break;case 536:this.$=new yy.ShowTables({like:$$[$0]});break;case 537:this.$=new yy.ShowTables({databaseid:$$[$0]});break;case 538:this.$=new yy.ShowTables({like:$$[$0],databaseid:$$[$0-2]});break;case 539:this.$=new yy.ShowColumns({table:$$[$0]});break;case 540:this.$=new yy.ShowColumns({table:$$[$0-2],databaseid:$$[$0]});break;case 541:this.$=new yy.ShowIndex({table:$$[$0]});break;case 542:this.$=new yy.ShowIndex({table:$$[$0-2],databaseid:$$[$0]});break;case 543:this.$=new yy.ShowCreateTable({table:$$[$0]});break;case 544:this.$=new yy.ShowCreateTable({table:$$[$0-2],databaseid:$$[$0]});break;case 545:this.$=new yy.CreateTable({table:$$[$0-6],view:true,select:$$[$0-1],viewcolumns:$$[$0-4]});yy.extend(this.$,$$[$0-9]);yy.extend(this.$,$$[$0-7]);break;case 546:this.$=new yy.CreateTable({table:$$[$0-3],view:true,select:$$[$0-1]});yy.extend(this.$,$$[$0-6]);yy.extend(this.$,$$[$0-4]);break;case 550:this.$=new yy.DropTable({table:$$[$0],view:true});yy.extend(this.$,$$[$0-1]);break;case 551:this.$=new yy.Help({subject:$$[$0].value.toUpperCase()});break;case 552:this.$=new yy.Help;break;case 553:this.$=new yy.ExpressionStatement({expression:$$[$0]});break;case 554:this.$=new yy.Source({url:$$[$0].value});break;case 555:this.$=new yy.Assert({value:$$[$0]});break;case 556:this.$=new yy.Assert({value:$$[$0].value});break;case 557:this.$=new yy.Assert({value:$$[$0],message:$$[$0-2]});break;case 559:case 570:case 572:this.$=$$[$0].value;break;case 560:case 568:this.$=+$$[$0].value;break;case 561:this.$=!!$$[$0].value;break;case 569:this.$=""+$$[$0].value;break;case 575:this.$=$$[$0-1];break;case 577:case 580:this.$=$$[$0-2];break;case 578:this.$={};break;case 581:this.$=[];break;case 582:yy.extend($$[$0-2],$$[$0]);this.$=$$[$0-2];break;case 584:this.$={};this.$[$$[$0-2].substr(1,$$[$0-2].length-2)]=$$[$0];break;case 585:case 586:this.$={};this.$[$$[$0-2]]=$$[$0];break;case 589:this.$=new yy.SetVariable({variable:$$[$0-1].toLowerCase(),value:$$[$0]});break;case 590:this.$=new yy.SetVariable({variable:$$[$0-2],expression:$$[$0],method:$$[$0-3]});break;case 591:this.$=new yy.SetVariable({variable:$$[$0-3],props:$$[$0-2],expression:$$[$0],method:$$[$0-4]});break;case 592:this.$="@";break;case 593:this.$="$";break;case 599:this.$=true;break;case 600:this.$=false;break;case 601:this.$=new yy.CommitTransaction;break;case 602:this.$=new yy.RollbackTransaction;break;case 603:this.$=new yy.BeginTransaction;break;case 604:this.$=new yy.If({expression:$$[$0-2],thenstat:$$[$0-1],elsestat:$$[$0]});if($$[$0-1].exists)this.$.exists=$$[$0-1].exists;if($$[$0-1].queries)this.$.queries=$$[$0-1].queries;break;case 605:this.$=new yy.If({expression:$$[$0-1],thenstat:$$[$0]});if($$[$0].exists)this.$.exists=$$[$0].exists;if($$[$0].queries)this.$.queries=$$[$0].queries;break;case 606:this.$=$$[$0];break;case 607:this.$=new yy.While({expression:$$[$0-1],loopstat:$$[$0]});if($$[$0].exists)this.$.exists=$$[$0].exists;if($$[$0].queries)this.$.queries=$$[$0].queries;break;case 608:this.$=new yy.Continue;break;case 609:this.$=new yy.Break;break;case 610:this.$=new yy.BeginEnd({statements:$$[$0-1]});break;case 611:this.$=new yy.Print({exprs:$$[$0]});break;case 612:this.$=new yy.Print({select:$$[$0]});break;case 613:this.$=new yy.Require({paths:$$[$0]});break;case 614:this.$=new yy.Require({plugins:$$[$0]});break;case 615:case 616:this.$=$$[$0].toUpperCase();break;case 617:this.$=new yy.Echo({expr:$$[$0]});break;case 622:this.$=new yy.Declare({declares:$$[$0]});break;case 625:this.$={variable:$$[$0-1]};yy.extend(this.$,$$[$0]);break;case 626:this.$={variable:$$[$0-2]};yy.extend(this.$,$$[$0]);break;case 627:this.$={variable:$$[$0-3],expression:$$[$0]};yy.extend(this.$,$$[$0-2]);break;case 628:this.$={variable:$$[$0-4],expression:$$[$0]};yy.extend(this.$,$$[$0-2]);break;case 629:this.$=new yy.TruncateTable({table:$$[$0]});break;case 630:this.$=new yy.Merge;yy.extend(this.$,$$[$0-4]);yy.extend(this.$,$$[$0-3]);yy.extend(this.$,$$[$0-2]);yy.extend(this.$,{matches:$$[$0-1]});yy.extend(this.$,$$[$0]);break;case 631:case 632:this.$={into:$$[$0]};break;case 634:this.$={on:$$[$0]};break;case 639:this.$={matched:true,action:$$[$0]};break;case 640:this.$={matched:true,expr:$$[$0-2],action:$$[$0]};break;case 641:this.$={"delete":true};break;case 642:this.$={update:$$[$0]};break;case 643:case 644:this.$={matched:false,bytarget:true,action:$$[$0]};break;case 645:case 646:this.$={matched:false,bytarget:true,expr:$$[$0-2],action:$$[$0]};break;case 647:this.$={matched:false,bysource:true,action:$$[$0]};break;case 648:this.$={matched:false,bysource:true,expr:$$[$0-2],action:$$[$0]};break;case 649:this.$={insert:true,values:$$[$0]};break;case 650:this.$={insert:true,values:$$[$0],columns:$$[$0-3]};break;case 651:this.$={insert:true,defaultvalues:true};break;case 652:this.$={insert:true,defaultvalues:true,columns:$$[$0-3]};break;case 654:this.$={output:{columns:$$[$0]}};break;case 655:this.$={output:{columns:$$[$0-3],intovar:$$[$0],method:$$[$0-1]}};break;case 656:this.$={output:{columns:$$[$0-2],intotable:$$[$0]}};break;case 657:this.$={output:{columns:$$[$0-5],intotable:$$[$0-3],intocolumns:$$[$0-1]}};break;case 658:this.$=new yy.CreateVertex({"class":$$[$0-3],sharp:$$[$0-2],name:$$[$0-1]});yy.extend(this.$,$$[$0]);break;case 661:this.$={sets:$$[$0]};break;case 662:this.$={content:$$[$0]};break;case 663:this.$={select:$$[$0]};break;case 664:this.$=new yy.CreateEdge({from:$$[$0-3],to:$$[$0-1],name:$$[$0-5]});yy.extend(this.$,$$[$0]);break;case 665:this.$=new yy.CreateGraph({graph:$$[$0]});break;case 666:this.$=new yy.CreateGraph({from:$$[$0]});break;case 669:this.$=$$[$0-2];if($$[$0-1])this.$.json=new yy.Json({value:$$[$0-1]});if($$[$0])this.$.as=$$[$0];break;case 670:this.$={source:$$[$0-6],target:$$[$0]};if($$[$0-3])this.$.json=new yy.Json({value:$$[$0-3]});if($$[$0-2])this.$.as=$$[$0-2];yy.extend(this.$,$$[$0-4]);break;case 672:this.$={vars:$$[$0],method:$$[$0-1]};break;case 675:var s3=$$[$0-1];this.$={prop:$$[$0-3],sharp:$$[$0-2],name:typeof s3=="undefined"?undefined:s3.substr(1,s3.length-2),"class":$$[$0]};break;case 681:this.$=new yy.AddRule({left:$$[$0-2],right:$$[$0]});break;case 682:this.$=new yy.AddRule({right:$$[$0]});break;case 685:this.$=new yy.Term({termid:$$[$0]});break;case 686:this.$=new yy.Term({termid:$$[$0-3],args:$$[$0-1]});break;case 692:case 706:case 708:case 710:case 714:case 716:case 718:case 720:case 722:case 724:this.$=[];break;case 693:case 701:case 703:case 707:case 709:case 711:case 715:case 717:case 719:case 721:case 723:case 725:$$[$0-1].push($$[$0]);break;case 700:case 702:this.$=[$$[$0]];break}},table:[o([8,450,451],$V0,{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,48:39,49:40,50:41,51:42,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,72:67,446:88,158:92,3:93,4:$V1,5:$V2,12:$V3,47:$V4,65:$V5,81:$V6,99:$V7,120:$V8,130:$V9,163:$Va,233:$Vb,287:$Vc,290:$Vd,291:$Ve,298:$Vf,344:$Vg,347:$Vh,348:$Vi,351:$Vj,353:$Vk,355:$Vl,356:$Vm,364:$Vn,365:$Vo,366:$Vp,383:$Vq,385:$Vr,386:$Vs,388:$Vt,389:$Vu,390:$Vv,391:$Vw,392:$Vx,396:$Vy,397:$Vz,400:$VA,401:$VB,447:$VC,449:$VD}),{1:[3]},{8:[1,97],9:98,450:$VE,451:$VF},o($VG,[2,5]),o($VG,[2,6]),o($VH,[2,9]),o($VG,$V0,{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,48:39,49:40,50:41,51:42,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,72:67,446:88,158:92,3:93,10:101,4:$V1,5:$V2,13:[1,102],47:$V4,65:$V5,81:$V6,99:$V7,120:$V8,130:$V9,163:$Va,233:$Vb,287:$Vc,290:$Vd,291:$Ve,298:$Vf,344:$Vg,347:$Vh,348:$Vi,351:$Vj,353:$Vk,355:$Vl,356:$Vm,364:$Vn,365:$Vo,366:$Vp,383:$Vq,385:$Vr,386:$Vs,388:$Vt,389:$Vu,390:$Vv,391:$Vw,392:$Vx,396:$Vy,397:$Vz,400:$VA,401:$VB,447:$VC,449:$VD}),o($VH,[2,11]),o($VH,[2,12]),o($VH,[2,13]),o($VH,[2,14]),o($VH,[2,15]),o($VH,[2,16]),o($VH,[2,17]),o($VH,[2,18]),o($VH,[2,19]),o($VH,[2,20]),o($VH,[2,21]),o($VH,[2,22]),o($VH,[2,23]),o($VH,[2,24]),o($VH,[2,25]),o($VH,[2,26]),o($VH,[2,27]),o($VH,[2,28]),o($VH,[2,29]),o($VH,[2,30]),o($VH,[2,31]),o($VH,[2,32]),o($VH,[2,33]),o($VH,[2,34]),o($VH,[2,35]),o($VH,[2,36]),o($VH,[2,37]),o($VH,[2,38]),o($VH,[2,39]),o($VH,[2,40]),o($VH,[2,41]),o($VH,[2,42]),o($VH,[2,43]),o($VH,[2,44]),o($VH,[2,45]),o($VH,[2,46]),o($VH,[2,47]),o($VH,[2,48]),o($VH,[2,49]),o($VH,[2,50]),o($VH,[2,51]),o($VH,[2,52]),o($VH,[2,53]),o($VH,[2,54]),o($VH,[2,55]),o($VH,[2,56]),o($VH,[2,57]),o($VH,[2,58]),o($VH,[2,59]),{304:[1,103]},{3:104,4:$V1,5:$V2},o($VI,[2,442],{3:106,299:110,4:$V1,5:$V2,109:$VJ,110:$VK,161:[1,108],167:[1,107],308:[1,113],352:[1,105],421:[1,109]}),{119:$VL,398:114,399:115},{157:[1,117]},{352:[1,118]},{3:120,4:$V1,5:$V2,105:[1,125],167:[1,121],304:[1,124],345:122,352:[1,119],357:[1,123]},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:126,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},o($Vi1,[2,413],{292:181,172:[1,182]}),{3:193,4:$V1,5:$V2,70:$Vj1,107:$Vk1,116:$VQ,118:187,119:$VR,126:$VS,155:$VW,172:[1,185],173:188,174:190,175:189,176:191,183:184,186:192,260:$Vd1,367:168,368:$Vg1,372:$Vh1,402:183},{304:[1,195]},o($Vl1,[2,690],{73:196,84:197,85:[1,198]}),o($Vm1,[2,692],{82:199}),{3:203,4:$V1,5:$V2,164:[1,201],167:[1,204],298:[1,200],304:[1,205],352:[1,202]},{304:[1,206]},{3:209,4:$V1,5:$V2,66:207,68:208},o([264,450,451],$V0,{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,48:39,49:40,50:41,51:42,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,72:67,446:88,158:92,3:93,7:211,4:$V1,5:$V2,12:$V3,47:$V4,65:$V5,81:$V6,99:$V7,120:$V8,130:$V9,163:$Va,233:$Vb,287:$Vc,290:$Vd,291:$Ve,298:$Vf,344:$Vg,347:$Vh,348:$Vi,351:$Vj,353:$Vk,355:$Vl,356:$Vm,364:$Vn,365:$Vo,366:$Vp,383:$Vq,384:[1,210],385:$Vr,386:$Vs,388:$Vt,389:$Vu,390:$Vv,391:$Vw,392:$Vx,396:$Vy,397:$Vz,400:$VA,401:$VB,447:$VC,449:$VD}),{384:[1,212]},{384:[1,213]},{3:215,4:$V1,5:$V2,352:[1,214]},{3:217,4:$V1,5:$V2,173:216},o($VH,[2,552],{91:218,107:$VO,256:$Va1}),o($Vn1,[2,284]),{91:219,107:$VO,256:$Va1},{3:231,4:$V1,5:$V2,91:225,106:$VN,107:[1,222],116:$VQ,118:220,119:$Vo1,126:$VS,155:$VW,170:224,174:229,175:228,225:226,226:227,232:$Vp1,238:221,254:$V81,255:$V91,256:$Va1,257:$Vb1,260:$Vd1,367:168,368:$Vg1,372:$Vh1},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:232,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},o($VH,[2,608]),o($VH,[2,609]),{3:147,4:$V1,5:$V2,36:234,51:144,70:$VM,72:67,81:$V6,89:130,91:134,100:235,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,125:233,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,158:92,163:$Va,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{3:241,4:$V1,5:$V2,91:238,107:$VO,256:$Va1,393:236,394:237,395:239,396:$Vq1},{3:242,4:$V1,5:$V2,116:$Vr1,119:$Vs1,379:243},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:246,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{447:[1,247]},{3:93,4:$V1,5:$V2,446:249,448:248},{3:231,4:$V1,5:$V2,174:250},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:251,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},o($Vt1,$Vu1,{160:255,138:[1,254],159:[1,252],161:[1,253],169:$Vv1}),o($Vw1,[2,685],{70:[1,257]}),o($Vx1,[2,130],{123:[1,258],124:[1,259],164:[1,260],165:[1,261],166:[1,262],167:[1,263],168:[1,264]}),o($Vy1,[2,1]),o($Vy1,[2,2]),{1:[2,3]},o($VG,$V0,{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,48:39,49:40,50:41,51:42,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,72:67,446:88,158:92,3:93,10:265,4:$V1,5:$V2,47:$V4,65:$V5,81:$V6,99:$V7,120:$V8,130:$V9,163:$Va,233:$Vb,287:$Vc,290:$Vd,291:$Ve,298:$Vf,344:$Vg,347:$Vh,348:$Vi,351:$Vj,353:$Vk,355:$Vl,356:$Vm,364:$Vn,365:$Vo,366:$Vp,383:$Vq,385:$Vr,386:$Vs,388:$Vt,389:$Vu,390:$Vv,391:$Vw,392:$Vx,396:$Vy,397:$Vz,400:$VA,401:$VB,447:$VC,449:$VD}),o($Vz1,[2,688]),o($Vz1,[2,689]),o($VG,[2,7]),{14:[1,266]},{3:217,4:$V1,5:$V2,173:267},{352:[1,268]},o($Vi1,$VA1,{301:269,130:$VB1}),{352:[1,271]},{3:272,4:$V1,5:$V2},{167:[1,273]},o([8,67,69,107,112,114,126,264,268,368,372,450,451],$VC1,{422:274,423:276,424:277,427:278,3:279,434:280,431:281,379:282,4:$V1,5:$V2,116:$Vr1,119:$Vs1,157:[1,275]}),{105:[1,286],300:283,304:[1,285],357:[1,284]},{91:288,107:$VO,157:[2,770],256:$Va1,420:287},o($VD1,[2,764],{414:289,3:290,4:$V1,5:$V2}),o($VI,[2,443]),o($VH,[2,622],{67:[1,291]}),o($VE1,[2,623]),{3:292,4:$V1,5:$V2},{3:217,4:$V1,5:$V2,173:293},{3:294,4:$V1,5:$V2},o($Vi1,$VF1,{346:295,130:$VG1}),{352:[1,297]},{3:298,4:$V1,5:$V2},o($Vi1,$VF1,{346:299,130:$VG1}),o($Vi1,$VF1,{346:300,130:$VG1}),o($VH1,[2,758]),o($VH1,[2,759]),o($VH,$V0,{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,48:39,49:40,50:41,51:42,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,72:67,446:88,158:92,3:93,10:301,278:322,4:$V1,5:$V2,47:$V4,65:$V5,81:$V6,90:$VI1,97:$VJ1,98:$VK1,99:$VL1,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,120:$V8,128:$VR1,130:$V9,144:$VS1,145:$VT1,153:$VU1,154:$VV1,163:$Va,233:$Vb,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72,287:$Vc,290:$Vd,291:$Ve,298:$Vf,344:$Vg,347:$Vh,348:$Vi,351:$Vj,353:$Vk,355:$Vl,356:$Vm,364:$Vn,365:$Vo,366:$Vp,383:$Vq,385:$Vr,386:$Vs,388:$Vt,389:$Vu,390:$Vv,391:$Vw,392:$Vx,396:$Vy,397:$Vz,400:$VA,401:$VB,447:$VC,449:$VD}),o($Vn1,[2,263]),o($Vn1,[2,264]),o($Vn1,[2,265]),o($Vn1,[2,266]),o($Vn1,[2,267]),o($Vn1,[2,268]),o($Vn1,[2,269]),o($Vn1,[2,270]),o($Vn1,[2,271]),o($Vn1,[2,272]),o($Vn1,[2,273]),o($Vn1,[2,274]),o($Vn1,[2,275]),o($Vn1,[2,276]),o($Vn1,[2,277]),o($Vn1,[2,278]),{3:147,4:$V1,5:$V2,23:336,24:335,33:332,36:331,51:144,70:$VM,72:67,81:$V6,89:130,91:134,100:334,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,158:92,163:$Va,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,231:333,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,291:$Ve,298:[1,337],367:168,368:$Vg1,372:$Vh1},o($Vn1,[2,282]),o($Vn1,[2,283]),{70:[1,338]},o([4,5,8,47,65,67,69,71,81,85,90,93,97,98,99,104,105,106,107,108,109,110,111,112,113,114,115,116,119,120,122,123,124,126,128,130,136,138,140,142,143,144,145,146,147,149,153,154,155,157,159,161,163,172,180,182,194,195,196,197,198,199,200,201,205,212,215,216,218,233,244,245,246,247,248,249,250,251,252,256,264,266,267,268,269,270,271,272,273,274,275,276,277,280,282,283,284,285,287,290,291,298,344,347,348,351,353,355,356,364,365,366,368,372,383,385,386,388,389,390,391,392,396,397,400,401,413,419,447,449,450,451],$V82,{70:$V92,117:[1,340]}),{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:341,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:342,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:343,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:344,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},o($Vn1,[2,258]),o([4,5,8,47,65,67,69,70,71,81,85,90,93,97,98,99,104,105,106,107,108,109,110,111,112,113,114,115,116,117,119,120,122,123,124,126,128,130,136,138,140,142,143,144,145,146,147,149,153,154,155,157,159,161,163,172,180,182,194,195,196,197,198,199,200,201,202,203,205,212,215,216,218,220,232,233,234,235,237,244,245,246,247,248,249,250,251,252,254,255,256,257,258,260,261,264,266,267,268,269,270,271,272,273,274,275,276,277,280,282,283,284,285,287,290,291,294,298,307,319,320,324,325,344,347,348,351,353,355,356,364,365,366,368,372,374,376,383,385,386,388,389,390,391,392,396,397,400,401,413,419,447,449,450,451,452],[2,320]),o($Va2,[2,321]),o($Va2,[2,322]),o($Va2,$Vb2),o($Va2,[2,324]),o([4,5,8,47,65,67,69,70,71,81,85,90,93,97,98,99,104,105,106,107,108,109,110,111,112,113,114,115,116,117,119,120,122,123,124,126,128,130,136,138,140,142,143,144,145,146,147,149,153,154,155,157,159,161,163,172,180,182,194,195,196,197,198,199,200,201,205,212,215,216,218,233,244,245,246,247,248,249,250,251,252,256,257,264,266,267,268,269,270,271,272,273,274,275,276,277,280,282,283,284,285,287,290,291,294,298,307,319,320,324,325,344,347,348,351,353,355,356,364,365,366,368,372,374,376,383,385,386,388,389,390,391,392,396,397,400,401,413,419,447,449,450,451],[2,325]),{3:346,4:$V1,5:$V2,106:[1,347],259:345},{3:348,4:$V1,5:$V2},o($Va2,[2,330]),o($Va2,[2,331]),{3:349,4:$V1,5:$V2,70:$Vc2,91:351,106:$VN,107:$VO,116:$VQ,126:$VS,155:$VW,170:352,175:354,225:353,254:$V81,255:$V91,256:$Va1,260:$Vd1,367:355,372:$Vh1},{70:[1,356]},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:357,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,262:358,265:359,266:$Vd2,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{70:[1,361]},{70:[1,362]},o($Ve2,[2,563]),{3:377,4:$V1,5:$V2,70:$Vf2,89:372,91:370,106:$VN,107:$VO,116:$VQ,118:367,119:$Vo1,126:$VS,155:$VW,170:369,174:375,175:374,225:371,226:373,254:$V81,255:$V91,256:$Va1,257:$Vb1,260:$Vd1,367:168,368:$Vg1,369:363,370:366,371:368,372:$Vh1,375:364,376:[1,365]},{3:378,4:$V1,5:$V2,174:379},{70:[2,307]},{70:[2,308]},{70:[2,309]},{70:[2,310]},{70:[2,311]},{70:[2,312]},{70:[2,313]},{70:[2,314]},{70:[2,315]},{3:385,4:$V1,5:$V2,106:$Vg2,107:$Vh2,373:380,374:[1,381],377:382},{3:217,4:$V1,5:$V2,173:386},o($Vi1,[2,414]),{203:[1,388],403:387},{203:[2,631]},{3:193,4:$V1,5:$V2,70:$Vj1,107:$Vk1,116:$VQ,118:187,119:$VR,126:$VS,155:$VW,173:188,174:190,175:189,176:191,183:389,186:192,260:$Vd1,367:168,368:$Vg1,372:$Vh1},{36:390,72:67,81:$V6,158:92,163:$Va},o($Vi2,[2,730],{184:391,69:[1,392]}),o($Vj2,[2,163],{3:393,4:$V1,5:$V2,69:[1,394]}),o($Vj2,[2,166],{3:395,4:$V1,5:$V2,69:[1,396]}),o($Vj2,[2,167],{3:397,4:$V1,5:$V2,69:[1,398]}),o($Vj2,[2,170],{3:399,4:$V1,5:$V2,69:[1,400]}),o($Vj2,[2,173],{3:401,4:$V1,5:$V2,69:[1,402]}),o([4,5,8,65,67,69,71,93,104,136,142,143,157,180,182,194,195,196,197,198,199,200,201,202,203,205,218,264,268,450,451],$Vk2,{70:$V92,117:$Vl2}),o([4,5,8,65,67,69,71,93,104,136,142,143,180,182,194,195,196,197,198,199,200,201,202,203,205,218,264,268,450,451],[2,176]),{3:217,4:$V1,5:$V2,173:404},o($Vm2,$Vn2,{74:405,172:$Vo2}),o($Vl1,[2,691]),o($Vp2,[2,696],{86:407,164:[1,408]}),o([8,71,157,264,268,450,451],$Vn2,{367:168,74:409,92:410,3:411,118:433,132:443,134:444,4:$V1,5:$V2,65:$Vq2,69:$Vr2,70:$Vs2,90:$Vt2,93:$Vu2,97:$Vv2,98:$Vw2,99:$Vx2,104:$Vy2,105:$Vz2,106:$VA2,107:$VB2,108:$VC2,109:$VD2,110:$VE2,111:$VF2,112:$VG2,113:$VH2,114:$VI2,115:$VJ2,116:$VK2,117:$VL2,119:$VM2,120:$VN2,122:$VO2,123:$VP2,124:$VQ2,126:$VR2,128:$VS2,130:$VT2,136:$VU2,138:$VV2,140:$VW2,142:$VX2,143:$VY2,144:$VZ2,145:$V_2,146:$V$2,147:$V03,149:$V13,159:$V23,161:$V33,172:$Vo2,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,368:$Vg1,372:$Vh1}),{304:[1,457]},{157:[1,458]},o($VH,[2,531],{90:[1,459]}),{352:[1,460]},{157:[1,461]},o($VH,[2,535],{90:[1,462],157:[1,463]}),{3:217,4:$V1,5:$V2,173:464},{36:465,67:[1,466],72:67,81:$V6,158:92,163:$Va},o($V43,[2,62]),{69:[1,467]},o($VH,[2,603]),{9:98,264:[1,468],450:$VE,451:$VF},o($VH,[2,601]),o($VH,[2,602]),{3:469,4:$V1,5:$V2},o($VH,[2,524]),{120:[1,470]},o([8,67,69,70,71,81,104,120,122,123,128,157,161,163,202,257,264,268,294,307,319,320,324,325,344,348,349,350,450,451],$Vk2,{117:$Vl2}),o($VH,[2,551]),o($VH,[2,554]),o($VH,[2,555]),o($VH,[2,556]),o($VH,$Vb2,{67:[1,471]}),{70:$Vc2,91:351,106:$VN,107:$VO,116:$VQ,126:$VS,155:$VW,170:352,175:354,225:353,254:$V81,255:$V91,256:$Va1,260:$Vd1,367:355,372:$Vh1},o($V53,[2,291]),o($V53,[2,292]),o($V53,[2,293]),o($V53,[2,294]),o($V53,[2,295]),o($V53,[2,296]),o($V53,[2,297]),{70:$V92},o($VH,$V0,{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,48:39,49:40,50:41,51:42,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,72:67,446:88,158:92,3:93,278:322,10:472,4:$V1,5:$V2,47:$V4,65:$V5,81:$V6,90:$VI1,97:$VJ1,98:$VK1,99:$VL1,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,120:$V8,128:$VR1,130:$V9,144:$VS1,145:$VT1,153:$VU1,154:$VV1,163:$Va,233:$Vb,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72,287:$Vc,290:$Vd,291:$Ve,298:$Vf,344:$Vg,347:$Vh,348:$Vi,351:$Vj,353:$Vk,355:$Vl,356:$Vm,364:$Vn,365:$Vo,366:$Vp,383:$Vq,385:$Vr,386:$Vs,388:$Vt,389:$Vu,390:$Vv,391:$Vw,392:$Vx,396:$Vy,397:$Vz,400:$VA,401:$VB,447:$VC,449:$VD}),o($VH,[2,611],{67:$V63}),o($VH,[2,612]),o($V73,[2,318],{278:322,90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72}),o($VH,[2,613],{67:[1,475]}),o($VH,[2,614],{67:[1,476]}),o($VE1,[2,619]),o($VE1,[2,621]),o($VE1,[2,615]),o($VE1,[2,616]),{202:[1,478],378:477,382:[1,479]},{3:480,4:$V1,5:$V2},o($Vi1,[2,592]),o($Vi1,[2,593]),o($VH,[2,553],{278:322,90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72}),{3:93,4:$V1,5:$V2,446:249,448:481},o($VH,[2,682],{67:$V93}),o($V73,[2,684]),o($VH,[2,687]),o($VH,[2,617],{278:322,90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72}),o($Va3,$Vu1,{160:483,169:$Vv1}),o($Va3,$Vu1,{160:484,169:$Vv1}),o($Va3,$Vu1,{160:485,169:$Vv1}),o($Vb3,[2,726],{223:127,174:128,224:129,89:130,222:131,170:132,225:133,91:134,226:135,175:136,176:137,227:138,228:139,229:140,118:141,230:142,51:144,132:146,3:147,367:168,162:486,148:487,221:488,100:489,4:$V1,5:$V2,70:$VM,106:$VN,107:$VO,112:$VP,116:$VQ,119:$VR,126:$VS,128:$VT,153:$VU,154:$VV,155:$VW,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,368:$Vg1,372:$Vh1}),{70:[1,491],106:$VN,170:490},{3:93,4:$V1,5:$V2,446:249,448:492},o($Vx1,[2,131]),o($Vx1,[2,132]),o($Vx1,[2,133]),o($Vx1,[2,134]),o($Vx1,[2,135]),o($Vx1,[2,136]),o($Vx1,[2,137]),o($VG,[2,4]),o($VG,$V0,{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,48:39,49:40,50:41,51:42,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,72:67,446:88,158:92,3:93,10:493,4:$V1,5:$V2,47:$V4,65:$V5,81:$V6,99:$V7,120:$V8,130:$V9,163:$Va,233:$Vb,287:$Vc,290:$Vd,291:$Ve,298:$Vf,344:$Vg,347:$Vh,348:$Vi,351:$Vj,353:$Vk,355:$Vl,356:$Vm,364:$Vn,365:$Vo,366:$Vp,383:$Vq,385:$Vr,386:$Vs,388:$Vt,389:$Vu,390:$Vv,391:$Vw,392:$Vx,396:$Vy,397:$Vz,400:$VA,401:$VB,447:$VC,449:$VD}),{344:[1,497],348:[1,494],349:[1,495],350:[1,496]},{3:498,4:$V1,5:$V2},{3:499,4:$V1,5:$V2},{128:[1,500]},o($Vc3,$VA1,{301:501,130:$VB1}),{202:[1,502]},{3:503,4:$V1,5:$V2},o($VH,[2,665],{67:$Vd3}),{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:505,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},o($V73,[2,668]),o($Ve3,[2,772],{367:168,425:506,118:507,114:[2,776],119:$Vo1,368:$Vg1,372:$Vh1}),{114:[1,508]},o($Vf3,$Vg3,{70:[1,509]}),o($Vh3,[2,786],{435:510,439:511,112:[1,512]}),{114:[2,777]},{3:513,4:$V1,5:$V2},o($Vi1,$VA1,{301:514,130:$VB1}),o($Vi1,$VA1,{301:515,130:$VB1}),o($VH1,[2,433]),o($VH1,[2,434]),{157:[1,516]},{157:[2,771]},o($Vi3,[2,766],{415:517,418:518,112:[1,519]}),o($VD1,[2,765]),{119:$VL,399:520},{4:$Vj3,69:[1,522],236:521,338:$Vk3},o($VH,[2,407],{104:[1,525]}),o($VH,[2,516]),{3:526,4:$V1,5:$V2},{258:[1,527]},o($Vc3,$VF1,{346:528,130:$VG1}),o($VH,[2,530]),{3:217,4:$V1,5:$V2,173:529},{3:217,4:$V1,5:$V2,173:530},o($VG,[2,605],{387:531,268:[1,532]}),{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:533,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:534,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:535,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:536,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:537,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:538,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:539,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:540,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{3:541,4:$V1,5:$V2,70:[1,543],106:$VN,170:542,174:544},{3:545,4:$V1,5:$V2,70:[1,547],106:$VN,170:546,174:548},o($Vl3,[2,391],{223:127,174:128,224:129,89:130,222:131,170:132,225:133,91:134,226:135,175:136,176:137,227:138,228:139,229:140,118:141,230:142,51:144,132:146,3:147,367:168,100:549,4:$V1,5:$V2,70:$VM,106:$VN,107:$VO,112:$VP,116:$VQ,119:$VR,126:$VS,128:$VT,153:$VU,154:$VV,155:$VW,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,368:$Vg1,372:$Vh1}),o($Vl3,[2,392],{223:127,174:128,224:129,89:130,222:131,170:132,225:133,91:134,226:135,175:136,176:137,227:138,228:139,229:140,118:141,230:142,51:144,132:146,3:147,367:168,100:550,4:$V1,5:$V2,70:$VM,106:$VN,107:$VO,112:$VP,116:$VQ,119:$VR,126:$VS,128:$VT,153:$VU,154:$VV,155:$VW,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,368:$Vg1,372:$Vh1}),o($Vl3,[2,393],{223:127,174:128,224:129,89:130,222:131,170:132,225:133,91:134,226:135,175:136,176:137,227:138,228:139,229:140,118:141,230:142,51:144,132:146,3:147,367:168,100:551,4:$V1,5:$V2,70:$VM,106:$VN,107:$VO,112:$VP,116:$VQ,119:$VR,126:$VS,128:$VT,153:$VU,154:$VV,155:$VW,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,368:$Vg1,372:$Vh1}),o($Vl3,[2,394],{223:127,174:128,224:129,89:130,222:131,170:132,225:133,91:134,226:135,175:136,176:137,227:138,228:139,229:140,118:141,230:142,51:144,132:146,3:147,367:168,100:552,4:$V1,5:$V2,70:$VM,106:$VN,107:$VO,112:$VP,116:$VQ,119:$VR,126:$VS,128:$VT,153:$VU,154:$VV,155:$VW,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,368:$Vg1,372:$Vh1}),o($Vl3,$Vm3,{223:127,174:128,224:129,89:130,222:131,170:132,225:133,91:134,226:135,175:136,176:137,227:138,228:139,229:140,118:141,230:142,51:144,132:146,3:147,367:168,100:553,4:$V1,5:$V2,70:$VM,106:$VN,107:$VO,112:$VP,116:$VQ,119:$VR,126:$VS,128:$VT,153:$VU,154:$VV,155:$VW,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,368:$Vg1,372:$Vh1}),{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:554,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:555,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},o($Vl3,[2,396],{223:127,174:128,224:129,89:130,222:131,170:132,225:133,91:134,226:135,175:136,176:137,227:138,228:139,229:140,118:141,230:142,51:144,132:146,3:147,367:168,100:556,4:$V1,5:$V2,70:$VM,106:$VN,107:$VO,112:$VP,116:$VQ,119:$VR,126:$VS,128:$VT,153:$VU,154:$VV,155:$VW,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,368:$Vg1,372:$Vh1}),{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:557,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:558,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{138:[1,560],140:[1,562],279:559,286:[1,561]},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:563,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:564,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{3:377,4:$V1,5:$V2,70:[1,565],89:568,119:$Vn3,174:569,176:567,281:566},{280:[1,571]},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:572,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:573,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:574,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{4:$Vj3,236:575,338:$Vk3},{71:[1,576]},{71:[1,577]},{71:[1,578]},{71:[1,579],90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,278:322,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72},{71:[2,738]},{71:[2,739]},{109:$VJ,110:$VK},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:235,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,125:580,126:$VS,128:$VT,132:146,138:[1,582],153:$VU,154:$VV,155:$VW,159:[1,581],170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},o($Va3,[2,742],{253:583,453:585,71:[1,584],138:[1,587],159:[1,586]}),{3:588,4:$V1,5:$V2,123:$Vo3,154:[1,590]},o([4,5,8,47,65,67,69,70,71,81,85,93,99,104,105,106,107,109,110,112,114,115,116,117,119,120,122,123,124,126,128,130,136,138,140,142,143,144,145,146,147,149,155,157,159,161,163,172,180,182,194,195,196,197,198,199,200,201,205,212,215,216,218,233,244,245,246,247,248,249,250,251,252,256,264,266,267,268,271,272,273,274,275,276,277,280,282,283,285,287,290,291,298,344,347,348,351,353,355,356,364,365,366,368,372,383,385,386,388,389,390,391,392,396,397,400,401,413,419,447,449,450,451],[2,369],{278:322,90:$VI1,97:$VJ1,98:$VK1,108:$VM1,111:$VN1,113:$VO1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,284:$V62}),o($Vp3,[2,370],{278:322,97:$VJ1,98:$VK1,108:$VM1,111:$VN1,113:$VO1,154:$VV1}),o($Vp3,[2,371],{278:322,97:$VJ1,98:$VK1,108:$VM1,111:$VN1,113:$VO1,154:$VV1}),o($Vn1,[2,372],{278:322}),o($Va2,[2,328]),o($Va2,[2,744]),o($Va2,[2,745]),o($Va2,[2,329]),o([4,5,8,47,65,67,69,70,71,81,85,90,93,97,98,99,104,105,106,107,108,109,110,111,112,113,114,115,116,117,119,120,122,123,124,126,128,130,136,138,140,142,143,144,145,146,147,149,153,154,155,157,159,161,163,172,180,182,194,195,196,197,198,199,200,201,202,203,205,212,215,216,218,233,244,245,246,247,248,249,250,251,252,256,264,266,267,268,269,270,271,272,273,274,275,276,277,280,282,283,284,285,287,290,291,298,344,347,348,351,353,355,356,364,365,366,368,372,383,385,386,388,389,390,391,392,396,397,400,401,413,419,447,449,450,451],[2,326]),{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:591,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},o($Ve2,[2,559]),o($Ve2,[2,560]),o($Ve2,[2,561]),o($Ve2,[2,562]),o($Ve2,[2,564]),{36:592,72:67,81:$V6,158:92,163:$Va},{90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,262:593,265:359,266:$Vd2,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,278:322,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72},{263:594,264:$Vq3,265:595,266:$Vd2,268:$Vr3},o($Vs3,[2,335]),{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:597,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:598,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{4:$Vj3,236:599,338:$Vk3},o($Ve2,[2,565]),{67:[1,601],376:[1,600]},o($Ve2,[2,581]),o($Vt3,[2,588]),o($Vu3,[2,566]),o($Vu3,[2,567]),o($Vu3,[2,568]),o($Vu3,[2,569]),o($Vu3,[2,570]),o($Vu3,[2,571]),o($Vu3,[2,572]),o($Vu3,[2,573]),o($Vu3,[2,574]),{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:602,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},o([4,5,8,47,65,67,69,71,81,85,90,93,97,98,99,104,105,106,107,108,109,110,111,112,113,114,115,116,119,120,122,123,124,126,128,130,136,138,140,142,143,144,145,146,147,149,153,154,155,157,159,161,163,172,180,182,194,195,196,197,198,199,200,201,205,212,215,216,218,233,244,245,246,247,248,249,250,251,252,256,264,266,267,268,269,270,271,272,273,274,275,276,277,280,282,283,284,285,287,290,291,298,344,347,348,351,353,355,356,364,365,366,368,372,374,376,383,385,386,388,389,390,391,392,396,397,400,401,413,419,447,449,450,451],$V82,{70:$V92,117:$Vv3}),o($Vw3,[2,285],{70:$V92}),o($Vn1,[2,286]),{67:[1,605],374:[1,604]},o($Ve2,[2,578]),o($Vx3,[2,583]),{126:[1,606]},{126:[1,607]},{126:[1,608]},{36:612,70:[1,611],72:67,81:$V6,123:[1,609],158:92,163:$Va,294:[1,610]},{202:[1,614],404:613},{3:193,4:$V1,5:$V2,70:$Vj1,107:$Vk1,116:$VQ,118:187,119:$VR,126:$VS,155:$VW,173:188,174:190,175:189,176:191,183:615,186:192,260:$Vd1,367:168,368:$Vg1,372:$Vh1},{203:[2,632]},{71:[1,616]},o($Vj2,[2,732],{185:617,3:618,4:$V1,5:$V2}),o($Vi2,[2,731]),o($Vj2,[2,161]),{3:619,4:$V1,5:$V2},o($Vj2,[2,164]),{3:620,4:$V1,5:$V2},o($Vj2,[2,168]),{3:621,4:$V1,5:$V2},o($Vj2,[2,171]),{3:622,4:$V1,5:$V2},o($Vj2,[2,174]),{3:623,4:$V1,5:$V2},{3:624,4:$V1,5:$V2},{122:[1,625]},o($Vy3,[2,150],{75:626,157:[1,627]}),{3:193,4:$V1,5:$V2,107:[1,632],116:$VQ,119:[1,633],126:$VS,155:$VW,173:628,174:629,175:630,176:631,260:$Vd1},{3:638,4:$V1,5:$V2,87:634,88:635,89:636,90:$Vz3},o($Vp2,[2,697]),o($VA3,[2,694],{83:639,156:640,157:[1,641]}),o($Vm1,[2,693],{127:642,153:$VB3,154:$VC3,155:$VD3}),o([4,5,8,65,67,69,71,90,93,97,98,99,104,105,106,107,108,109,110,111,112,113,114,115,116,117,119,120,122,123,124,126,128,130,136,138,140,142,143,144,145,146,147,149,153,154,155,157,159,161,172,244,245,246,247,248,249,250,251,252,264,268,368,372,450,451],[2,71],{70:[1,646]}),{94:[1,647]},{3:648,4:$V1,5:$V2},o($VE3,[2,75]),{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:649,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:650,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{3:411,4:$V1,5:$V2,65:$Vq2,69:$Vr2,70:$Vs2,90:$Vt2,92:652,93:$Vu2,97:$Vv2,98:$Vw2,99:$Vx2,101:651,104:$Vy2,105:$Vz2,106:$VA2,107:$VB2,108:$VC2,109:$VD2,110:$VE2,111:$VF2,112:$VG2,113:$VH2,114:$VI2,115:$VJ2,116:$VK2,117:$VL2,118:433,119:$VM2,120:$VN2,122:$VO2,123:$VP2,124:$VQ2,126:$VR2,128:$VS2,130:$VT2,132:443,134:444,136:$VU2,138:$VV2,140:$VW2,142:$VX2,143:$VY2,144:$VZ2,145:$V_2,146:$V$2,147:$V03,149:$V13,159:$V23,161:$V33,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,367:168,368:$Vg1,372:$Vh1},{70:[1,653]},{70:[1,654]},{70:[1,655]},o($VE3,[2,83]),o($VE3,[2,84]),o($VE3,[2,85]),o($VE3,[2,86]),o($VE3,[2,87]),o($VE3,[2,88]),{3:656,4:$V1,5:$V2},{3:657,4:$V1,5:$V2,108:[1,658]},o($VE3,[2,92]),o($VE3,[2,93]),o($VE3,[2,94]),{117:[1,659]},o($VE3,[2,96]),{3:660,4:$V1,5:$V2,70:$Vc2,91:351,106:$VN,107:$VO,116:$VQ,126:$VS,155:$VW,170:352,175:354,225:353,254:$V81,255:$V91,256:$Va1,260:$Vd1,367:355,372:$Vh1},{119:[1,661]},{70:[1,662]},{119:[1,663]},o($VE3,[2,101]),{70:[1,664]},{3:665,4:$V1,5:$V2},{70:[1,666]},{70:[1,667]},{70:[1,668]},{70:[1,669]},{70:[1,670],138:[1,671]},{70:[1,672]},{70:[1,673]},{70:[1,674]},{70:[1,675]},{70:[1,676]},{70:[1,677]},{70:[1,678]},{70:[1,679]},{70:[1,680]},{70:[2,712]},{70:[2,713]},{3:217,4:$V1,5:$V2,173:681},{3:217,4:$V1,5:$V2,173:682},{91:683,107:$VO,256:$Va1},o($VH,[2,533],{90:[1,684]}),{3:217,4:$V1,5:$V2,173:685},{91:686,107:$VO,256:$Va1},{3:687,4:$V1,5:$V2},o($VH,[2,629]),o($VH,[2,60]),{3:209,4:$V1,5:$V2,68:688},{70:[1,689]},o($VH,[2,610]),o($VH,[2,523]),{3:638,4:$V1,5:$V2,89:692,116:$VF3,119:$VG3,121:690,288:691,289:693},{118:696,119:$Vo1,367:168,368:$Vg1,372:$Vh1},o($VH,[2,607]),{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:697,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},o($Vl3,$Vm3,{223:127,174:128,224:129,89:130,222:131,170:132,225:133,91:134,226:135,175:136,176:137,227:138,228:139,229:140,118:141,230:142,51:144,132:146,3:147,367:168,100:698,4:$V1,5:$V2,70:$VM,106:$VN,107:$VO,112:$VP,116:$VQ,119:$VR,126:$VS,128:$VT,153:$VU,154:$VV,155:$VW,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,368:$Vg1,372:$Vh1}),{91:699,107:$VO,256:$Va1},{3:241,4:$V1,5:$V2,395:700,396:$Vq1},o($VH,[2,589]),o($VH,[2,599]),o($VH,[2,600]),{97:[1,703],99:[1,701],380:702},o($VH,[2,681],{67:$V93}),{3:93,4:$V1,5:$V2,446:704},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:489,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,148:705,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,221:488,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:489,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,148:706,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,221:488,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:489,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,148:707,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,221:488,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},o($Vb3,[2,129]),o($Vb3,[2,727],{67:$VH3}),o($VI3,[2,248]),o($VI3,[2,255],{278:322,3:710,91:712,4:$V1,5:$V2,69:[1,709],90:$VI1,97:$VJ1,98:$VK1,99:$V83,106:[1,711],107:$VO,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,256:$Va1,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72}),o($Vt1,[2,728],{171:713,452:[1,714]}),{106:$VN,170:715},{67:$V93,71:[1,716]},o($VG,[2,8]),{122:[1,717],164:[1,718]},{164:[1,719]},{164:[1,720]},{164:[1,721]},o($VH,[2,512],{69:[1,723],70:[1,722]}),o($VH,[2,517]),{258:[1,724]},{3:725,4:$V1,5:$V2,91:726,107:$VO,256:$Va1},{3:217,4:$V1,5:$V2,173:727},{202:[1,728]},o([8,67,69,71,107,112,114,126,264,268,368,372,450,451],$VC1,{424:277,427:278,3:279,434:280,431:281,379:282,423:729,4:$V1,5:$V2,116:$Vr1,119:$Vs1}),o($VH,[2,666],{278:322,90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72}),o($V73,[2,774],{426:730,432:731,69:$VJ3}),o($Ve3,[2,773]),o([69,107,112,114,119,126,368,372],$VC1,{434:280,424:733,3:734,4:$V1,5:$V2}),o([67,69,71,107,112,114,126,368,372],$VC1,{423:276,424:277,427:278,3:279,434:280,431:281,379:282,422:735,4:$V1,5:$V2,116:$Vr1,119:$Vs1}),o($VK3,[2,788],{436:736,107:[1,737]}),o($Vh3,[2,787]),{3:738,4:$V1,5:$V2,106:[1,739]},o($VL3,[2,672]),{3:217,4:$V1,5:$V2,173:740},{3:217,4:$V1,5:$V2,173:741},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:742,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},o($VM3,[2,768],{416:743,91:744,107:$VO,256:$Va1}),o($Vi3,[2,767]),{3:745,4:$V1,5:$V2},o($VE1,[2,624]),o($VE1,[2,625],{99:[1,746]}),{4:$Vj3,236:747,338:$Vk3},o([5,8,47,65,67,69,71,81,85,90,93,97,98,99,104,105,106,107,108,109,110,111,112,113,114,115,116,117,119,120,122,123,124,126,128,130,136,138,140,142,143,144,145,146,147,149,153,154,155,157,159,161,163,172,180,182,194,195,196,197,198,199,200,201,205,212,215,216,218,233,244,245,246,247,248,249,250,251,252,256,257,264,266,267,268,269,270,271,272,273,274,275,276,277,280,282,283,284,285,287,290,291,294,298,307,319,320,324,325,344,347,348,351,353,355,356,364,365,366,368,372,383,385,386,388,389,390,391,392,396,397,400,401,413,419,447,449,450,451],[2,482],{4:[1,749],70:[1,748]}),{70:[1,750]},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:751,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},o($VH,[2,525]),o($Vc3,[2,505]),{3:752,4:$V1,5:$V2,91:753,107:$VO,256:$Va1},o($VH,[2,503]),o($VH,[2,550]),o($VH,[2,604]),o($VH,$V0,{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,48:39,49:40,50:41,51:42,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,72:67,446:88,158:92,3:93,10:754,4:$V1,5:$V2,47:$V4,65:$V5,81:$V6,99:$V7,120:$V8,130:$V9,163:$Va,233:$Vb,287:$Vc,290:$Vd,291:$Ve,298:$Vf,344:$Vg,347:$Vh,348:$Vi,351:$Vj,353:$Vk,355:$Vl,356:$Vm,364:$Vn,365:$Vo,366:$Vp,383:$Vq,385:$Vr,386:$Vs,388:$Vt,389:$Vu,390:$Vv,391:$Vw,392:$Vx,396:$Vy,397:$Vz,400:$VA,401:$VB,447:$VC,449:$VD}),o($VN3,[2,339],{278:322,97:$VJ1,98:$VK1,108:$VM1,111:$VN1,113:$VO1,153:$VU1,154:$VV1,270:$VX1}),o($VN3,[2,340],{278:322,97:$VJ1,98:$VK1,108:$VM1,111:$VN1,113:$VO1,153:$VU1,154:$VV1,270:$VX1}),o($Vp3,[2,341],{278:322,97:$VJ1,98:$VK1,108:$VM1,111:$VN1,113:$VO1,154:$VV1}),o($Vp3,[2,342],{278:322,97:$VJ1,98:$VK1,108:$VM1,111:$VN1,113:$VO1,154:$VV1}),o($VO3,[2,343],{278:322,97:$VJ1,98:$VK1,111:$VN1}),o($VO3,[2,344],{278:322,97:$VJ1,98:$VK1,111:$VN1}),o($VO3,[2,345],{278:322,97:$VJ1,98:$VK1,111:$VN1}),o([4,5,8,47,65,67,69,70,71,81,85,90,93,98,99,104,105,106,107,108,109,110,112,113,114,115,116,117,119,120,122,123,124,126,128,130,136,138,140,142,143,144,145,146,147,149,153,154,155,157,159,161,163,172,180,182,194,195,196,197,198,199,200,201,205,212,215,216,218,233,244,245,246,247,248,249,250,251,252,256,264,266,267,268,269,270,271,272,273,274,275,276,277,280,282,283,284,285,287,290,291,298,344,347,348,351,353,355,356,364,365,366,368,372,383,385,386,388,389,390,391,392,396,397,400,401,413,419,447,449,450,451],[2,346],{278:322,97:$VJ1,111:$VN1}),o($Vw3,[2,347],{70:$V92}),o($Vn1,[2,348]),{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:755,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},o($Vn1,[2,350]),o($Vw3,[2,351],{70:$V92}),o($Vn1,[2,352]),{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:756,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},o($Vn1,[2,354]),o($VP3,[2,355],{278:322,90:$VI1,97:$VJ1,98:$VK1,108:$VM1,111:$VN1,113:$VO1,128:$VR1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,280:$V32,284:$V62}),o($VP3,[2,356],{278:322,90:$VI1,97:$VJ1,98:$VK1,108:$VM1,111:$VN1,113:$VO1,128:$VR1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,280:$V32,284:$V62}),o($VP3,[2,357],{278:322,90:$VI1,97:$VJ1,98:$VK1,108:$VM1,111:$VN1,113:$VO1,128:$VR1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,280:$V32,284:$V62}),o($VP3,[2,358],{278:322,90:$VI1,97:$VJ1,98:$VK1,108:$VM1,111:$VN1,113:$VO1,128:$VR1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,280:$V32,284:$V62}),o([4,5,8,47,65,81,99,114,115,120,130,144,145,163,233,264,268,271,272,273,274,275,276,277,282,283,285,287,290,291,298,344,347,348,351,353,355,356,364,365,366,383,385,386,388,389,390,391,392,396,397,400,401,447,449,450,451],$VQ3,{278:322,90:$VI1,97:$VJ1,98:$VK1,108:$VM1,111:$VN1,113:$VO1,128:$VR1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,280:$V32,284:$V62}),o($VP3,[2,360],{278:322,90:$VI1,97:$VJ1,98:$VK1,108:$VM1,111:$VN1,113:$VO1,128:$VR1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,280:$V32,284:$V62}),o($VP3,[2,361],{278:322,90:$VI1,97:$VJ1,98:$VK1,108:$VM1,111:$VN1,113:$VO1,128:$VR1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,280:$V32,284:$V62}),o($VP3,[2,362],{278:322,90:$VI1,97:$VJ1,98:$VK1,108:$VM1,111:$VN1,113:$VO1,128:$VR1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,280:$V32,284:$V62}),o($VP3,[2,363],{278:322,90:$VI1,97:$VJ1,98:$VK1,108:$VM1,111:$VN1,113:$VO1,128:$VR1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,280:$V32,284:$V62}),o($VP3,[2,364],{278:322,90:$VI1,97:$VJ1,98:$VK1,108:$VM1,111:$VN1,113:$VO1,128:$VR1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,280:$V32,284:$V62}),{70:[1,757]},{70:[2,397]},{70:[2,398]},{70:[2,399]},o($VR3,[2,367],{278:322,90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,280:$V32,284:$V62}),o([4,5,8,47,65,67,69,70,71,81,85,93,104,105,106,107,109,110,112,116,117,119,120,122,123,124,126,130,136,138,140,142,143,145,146,147,149,155,157,159,161,163,172,180,182,194,195,196,197,198,199,200,201,205,212,215,216,218,233,244,245,246,247,248,249,250,251,252,256,264,266,267,268,285,287,290,291,298,344,347,348,351,353,355,356,364,365,366,368,372,383,385,386,388,389,390,391,392,396,397,400,401,413,419,447,449,450,451],[2,368],{278:322,90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,280:$V32,282:$V42,283:$V52,284:$V62}),{3:147,4:$V1,5:$V2,36:758,51:144,70:$VM,71:[1,760],72:67,81:$V6,89:130,91:134,100:235,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,125:759,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,158:92,163:$Va,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},o($Vn1,[2,380]),o($Vn1,[2,382]),o($Vn1,[2,388]),o($Vn1,[2,389]),{3:349,4:$V1,5:$V2,70:[1,761]},{3:377,4:$V1,5:$V2,70:[1,762],89:568,119:$Vn3,174:569,176:764,281:763},o($VR3,[2,384],{278:322,90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,280:$V32,284:$V62}),o($VR3,[2,385],{278:322,90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,280:$V32,284:$V62}),o([4,5,8,47,65,67,69,70,71,81,85,93,99,104,105,106,107,109,110,112,114,115,116,117,119,120,122,123,124,126,128,130,136,138,140,142,143,144,145,146,147,149,155,157,159,161,163,172,180,182,194,195,196,197,198,199,200,201,205,212,215,216,218,233,244,245,246,247,248,249,250,251,252,256,264,266,267,268,271,272,273,274,275,276,277,280,282,283,284,285,287,290,291,298,344,347,348,351,353,355,356,364,365,366,368,372,383,385,386,388,389,390,391,392,396,397,400,401,413,419,447,449,450,451],[2,386],{278:322,90:$VI1,97:$VJ1,98:$VK1,108:$VM1,111:$VN1,113:$VO1,153:$VU1,154:$VV1,269:$VW1,270:$VX1}),o($Vn1,[2,387]),o($Vn1,[2,279]),o($Vn1,[2,280]),o($Vn1,[2,281]),o($Vn1,[2,373]),{67:$V63,71:[1,765]},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:766,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:767,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:235,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,125:768,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},o($Va2,[2,317]),o($Va3,[2,743]),o($Va3,[2,740]),o($Va3,[2,741]),o($Vn1,$VS3),o($VT3,[2,261]),o($Vn1,[2,257]),{71:[1,770],90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,278:322,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72},{71:[1,771]},{263:772,264:$Vq3,265:595,266:$Vd2,268:$Vr3},{264:[1,773]},o($Vs3,[2,334]),{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:774,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,267:[1,775],269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,278:322,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72},{69:[1,776],90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,278:322,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72},{67:[1,777]},o($Ve2,[2,579]),{3:377,4:$V1,5:$V2,70:$Vf2,89:372,91:370,106:$VN,107:$VO,116:$VQ,118:367,119:$Vo1,126:$VS,155:$VW,170:369,174:375,175:374,225:371,226:373,254:$V81,255:$V91,256:$Va1,257:$Vb1,260:$Vd1,367:168,368:$Vg1,370:779,371:368,372:$Vh1,376:[1,778]},{71:[1,780],90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,278:322,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72},{3:781,4:$V1,5:$V2,123:$Vo3},o($Ve2,[2,576]),{3:385,4:$V1,5:$V2,106:$Vg2,107:$Vh2,374:[1,782],377:783},{3:377,4:$V1,5:$V2,70:$Vf2,89:372,91:370,106:$VN,107:$VO,116:$VQ,118:367,119:$Vo1,126:$VS,155:$VW,170:369,174:375,175:374,225:371,226:373,254:$V81,255:$V91,256:$Va1,257:$Vb1,260:$Vd1,367:168,368:$Vg1,370:784,371:368,372:$Vh1},{3:377,4:$V1,5:$V2,70:$Vf2,89:372,91:370,106:$VN,107:$VO,116:$VQ,118:367,119:$Vo1,126:$VS,155:$VW,170:369,174:375,175:374,225:371,226:373,254:$V81,255:$V91,256:$Va1,257:$Vb1,260:$Vd1,367:168,368:$Vg1,370:785,371:368,372:$Vh1},{3:377,4:$V1,5:$V2,70:$Vf2,89:372,91:370,106:$VN,107:$VO,116:$VQ,118:367,119:$Vo1,126:$VS,155:$VW,170:369,174:375,175:374,225:371,226:373,254:$V81,255:$V91,256:$Va1,257:$Vb1,260:$Vd1,367:168,368:$Vg1,370:786,371:368,372:$Vh1},{70:$VU3,116:$VQ,118:789,119:$Vo1,126:$VS,155:$VW,175:790,260:$Vd1,293:787,367:168,368:$Vg1,372:$Vh1},{123:[1,791]},{3:638,4:$V1,5:$V2,89:793,204:792},o($VV3,[2,411]),{266:$VW3,405:794,407:795,408:796},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:798,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{202:[2,633]},o($Vj2,[2,159],{3:799,4:$V1,5:$V2,69:[1,800]}),o($Vj2,[2,160]),o($Vj2,[2,733]),o($Vj2,[2,162]),o($Vj2,[2,165]),o($Vj2,[2,169]),o($Vj2,[2,172]),o($Vj2,[2,175]),o([4,5,8,65,67,69,70,71,81,93,104,120,122,123,128,136,142,143,157,161,163,180,182,194,195,196,197,198,199,200,201,202,203,205,218,257,264,268,294,307,319,320,324,325,344,348,349,350,450,451],[2,177]),{3:801,4:$V1,5:$V2},o($VX3,[2,214],{76:802,104:[1,803]}),{3:193,4:$V1,5:$V2,70:[1,805],107:$Vk1,116:$VQ,118:187,119:$VR,126:$VS,155:$VW,173:188,174:190,175:189,176:191,177:804,183:806,186:192,260:$Vd1,367:168,368:$Vg1,372:$Vh1},o($Vm2,[2,142]),o($Vm2,[2,143]),o($Vm2,[2,144]),o($Vm2,[2,145]),o($Vm2,[2,146]),{3:349,4:$V1,5:$V2},o($Vl1,[2,66],{67:[1,807]}),o($VY3,[2,68]),o($VY3,[2,69]),{91:808,107:$VO,256:$Va1},o([8,65,67,71,93,99,104,136,142,143,157,172,180,182,194,195,196,197,198,199,200,201,205,218,264,268,450,451],$V82,{117:$Vv3}),o($VA3,[2,65]),o($VA3,[2,695]),{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:809,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},o($VE3,[2,104]),o($VE3,[2,122]),o($VE3,[2,123]),o($VE3,[2,124]),{3:147,4:$V1,5:$V2,51:144,70:$VM,71:[2,704],89:130,91:134,100:235,103:810,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,125:811,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{70:[1,812]},o($VE3,[2,74]),o([4,5,8,65,67,69,70,71,93,99,104,105,106,107,109,110,112,114,115,116,117,119,120,122,123,124,126,130,136,138,140,142,143,144,145,146,147,149,155,157,159,161,172,244,245,246,247,248,249,250,251,252,264,268,368,372,450,451],[2,76],{278:322,90:$VI1,97:$VJ1,98:$VK1,108:$VM1,111:$VN1,113:$VO1,128:$VR1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72}),o([4,5,8,65,67,69,70,71,90,93,99,104,105,106,107,109,110,112,114,115,116,117,119,120,122,123,124,126,128,130,136,138,140,142,143,144,145,146,147,149,155,157,159,161,172,244,245,246,247,248,249,250,251,252,264,268,368,372,450,451],[2,77],{278:322,97:$VJ1,98:$VK1,108:$VM1,111:$VN1,113:$VO1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72}),{3:411,4:$V1,5:$V2,65:$Vq2,69:$Vr2,70:$Vs2,71:[1,813],90:$Vt2,92:814,93:$Vu2,97:$Vv2,98:$Vw2,99:$Vx2,104:$Vy2,105:$Vz2,106:$VA2,107:$VB2,108:$VC2,109:$VD2,110:$VE2,111:$VF2,112:$VG2,113:$VH2,114:$VI2,115:$VJ2,116:$VK2,117:$VL2,118:433,119:$VM2,120:$VN2,122:$VO2,123:$VP2,124:$VQ2,126:$VR2,128:$VS2,130:$VT2,132:443,134:444,136:$VU2,138:$VV2,140:$VW2,142:$VX2,143:$VY2,144:$VZ2,145:$V_2,146:$V$2,147:$V03,149:$V13,159:$V23,161:$V33,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,367:168,368:$Vg1,372:$Vh1},o($VZ3,[2,700],{127:642,153:$VB3,154:$VC3,155:$VD3}),{3:411,4:$V1,5:$V2,65:$Vq2,69:$Vr2,70:$Vs2,90:$Vt2,92:816,93:$Vu2,97:$Vv2,98:$Vw2,99:$Vx2,102:815,104:$Vy2,105:$Vz2,106:$VA2,107:$VB2,108:$VC2,109:$VD2,110:$VE2,111:$VF2,112:$VG2,113:$VH2,114:$VI2,115:$VJ2,116:$VK2,117:$VL2,118:433,119:$VM2,120:$VN2,122:$VO2,123:$VP2,124:$VQ2,126:$VR2,128:$VS2,130:$VT2,132:443,134:444,136:$VU2,138:$VV2,140:$VW2,142:$VX2,143:$VY2,144:$VZ2,145:$V_2,146:$V$2,147:$V03,149:$V13,159:$V23,161:$V33,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,367:168,368:$Vg1,372:$Vh1},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:817,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{3:818,4:$V1,5:$V2},o($VE3,[2,89]),o($VE3,[2,90]),o($VE3,[2,91]),o($VE3,[2,95]),o($VE3,[2,97]),{3:819,4:$V1,5:$V2},{3:638,4:$V1,5:$V2,89:692,116:$VF3,119:$VG3,121:820,288:691,289:693},{3:821,4:$V1,5:$V2},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:235,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,125:822,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},o($VE3,[2,103]),o($VZ3,[2,706],{129:823}),o($VZ3,[2,708],{131:824}),o($VZ3,[2,710],{133:825}),o($VZ3,[2,714],{135:826}),o($V_3,$V$3,{137:827,152:828}),{70:[1,829]},o($VZ3,[2,716],{139:830}),o($VZ3,[2,718],{141:831}),o($V_3,$V$3,{152:828,137:832}),o($V_3,$V$3,{152:828,137:833}),o($V_3,$V$3,{152:828,137:834}),o($V_3,$V$3,{152:828,137:835}),{3:411,4:$V1,5:$V2,65:$Vq2,69:$Vr2,70:$Vs2,90:$Vt2,92:836,93:$Vu2,97:$Vv2,98:$Vw2,99:$Vx2,104:$Vy2,105:$Vz2,106:$VA2,107:$VB2,108:$VC2,109:$VD2,110:$VE2,111:$VF2,112:$VG2,113:$VH2,114:$VI2,115:$VJ2,116:$VK2,117:$VL2,118:433,119:$VM2,120:$VN2,122:$VO2,123:$VP2,124:$VQ2,126:$VR2,128:$VS2,130:$VT2,132:443,134:444,136:$VU2,138:$VV2,140:$VW2,142:$VX2,143:$VY2,144:$VZ2,145:$V_2,146:$V$2,147:$V03,149:$V13,159:$V23,161:$V33,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,367:168,368:$Vg1,372:$Vh1},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:489,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,148:837,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,221:488,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},o($V04,[2,720],{150:838}),o($VH,[2,543],{157:[1,839]}),o($VH,[2,539],{157:[1,840]}),o($VH,[2,532]),{91:841,107:$VO,256:$Va1},o($VH,[2,541],{157:[1,842]}),o($VH,[2,536]),o($VH,[2,537],{90:[1,843]}),o($V43,[2,61]),{36:844,72:67,81:$V6,158:92,163:$Va},o($VH,[2,401],{67:$V14,104:[1,845]}),o($V24,[2,402]),{99:[1,847]},{3:848,4:$V1,5:$V2},o($Vi1,[2,746]),o($Vi1,[2,747]),o($VH,[2,557]),o($V73,[2,319],{278:322,90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72}),o($VP3,$VQ3,{278:322,90:$VI1,97:$VJ1,98:$VK1,108:$VM1,111:$VN1,113:$VO1,128:$VR1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,280:$V32,284:$V62}),o($VE1,[2,618]),o($VE1,[2,620]),{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:849,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{97:[1,851],99:[1,850]},{3:853,4:$V1,5:$V2,70:$V34,106:$V44,381:852},o($V73,[2,683]),o($Vb3,[2,126],{67:$VH3}),o($Vb3,[2,127],{67:$VH3}),o($Vb3,[2,128],{67:$VH3}),{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:489,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,221:856,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{3:857,4:$V1,5:$V2,91:859,106:[1,858],107:$VO,256:$Va1},o($VI3,[2,250]),o($VI3,[2,252]),o($VI3,[2,254]),o($Vt1,[2,138]),o($Vt1,[2,729]),{71:[1,860]},o($Vw1,[2,686]),{3:861,4:$V1,5:$V2},{3:862,4:$V1,5:$V2},{3:864,4:$V1,5:$V2,334:863},{3:864,4:$V1,5:$V2,334:865},{3:866,4:$V1,5:$V2},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:235,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,125:867,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{3:868,4:$V1,5:$V2},o($Vc3,[2,445]),o($VH,$V54,{354:869,69:$V64,70:[1,870]}),o($VH,$V54,{354:872,69:$V64}),{70:[1,873]},{3:217,4:$V1,5:$V2,173:874},o($V73,[2,667]),o($V73,[2,669]),o($V73,[2,775]),{116:$Vr1,119:$Vs1,379:875},o($V74,[2,778],{367:168,428:876,118:877,119:$Vo1,368:$Vg1,372:$Vh1}),o($Vf3,$Vg3),{67:$Vd3,71:[1,878]},o($V84,[2,790],{437:879,438:880,126:[1,881]}),o($VK3,[2,789]),o($Vh3,[2,677]),o($Vh3,[2,678]),o($VH,[2,432],{70:[1,882]}),{69:[1,884],70:[1,883]},{90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,122:[1,885],128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,278:322,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72},o($VV3,$V94,{72:67,158:92,417:886,36:889,81:$V6,120:$Va4,163:$Va,419:$Vb4}),o($VM3,[2,769]),o($Vi3,[2,659]),{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:890,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},o($VE1,[2,626],{99:[1,891]}),{106:$Vc4,247:$Vd4,337:892},o([4,5,8,47,65,67,69,71,81,85,90,93,97,98,99,104,105,106,107,108,109,110,111,112,113,114,115,116,117,119,120,122,123,124,126,128,130,136,138,140,142,143,144,145,146,147,149,153,154,155,157,159,161,163,172,180,182,194,195,196,197,198,199,200,201,205,212,215,216,218,233,244,245,246,247,248,249,250,251,252,256,257,264,266,267,268,269,270,271,272,273,274,275,276,277,280,282,283,284,285,287,290,291,294,298,307,319,320,324,325,344,347,348,351,353,355,356,364,365,366,368,372,383,385,386,388,389,390,391,392,396,397,400,401,413,419,447,449,450,451],[2,483],{70:[1,895]}),{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:897,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,295:896,367:168,368:$Vg1,372:$Vh1},o($VH,[2,406],{278:322,90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72}),o($VH,[2,526]),o($VH,[2,527]),o($VH,[2,606]),{71:[1,898],90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,278:322,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72},{71:[1,899],90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,278:322,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72},{3:147,4:$V1,5:$V2,36:900,51:144,70:$VM,72:67,81:$V6,89:130,91:134,100:235,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,125:901,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,158:92,163:$Va,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{71:[1,902]},{67:$V63,71:[1,903]},o($Vn1,[2,378]),{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:904,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{3:147,4:$V1,5:$V2,36:905,51:144,70:$VM,71:[1,907],72:67,81:$V6,89:130,91:134,100:235,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,125:906,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,158:92,163:$Va,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},o($Vn1,[2,381]),o($Vn1,[2,383]),o($Vn1,$Ve4,{239:908,240:$Vf4}),{71:[1,910],90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,278:322,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72},{71:[1,911],90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,278:322,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72},{67:$V63,71:[1,912]},{3:913,4:$V1,5:$V2,154:[1,914]},o($Ve2,[2,558]),o($Vn1,[2,327]),{264:[1,915]},o($Vn1,[2,333]),{90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,264:[2,337],269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,278:322,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:916,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{4:$Vj3,236:917,338:$Vk3},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:918,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},o($Ve2,[2,580]),o($Vt3,[2,587]),o($Vu3,[2,575]),o($VT3,$VS3),o($Ve2,[2,577]),o($Vx3,[2,582]),o($Vx3,[2,584]),o($Vx3,[2,585]),o($Vx3,[2,586]),o($VV3,[2,408],{67:$Vg4}),{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:897,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,295:921,367:168,368:$Vg1,372:$Vh1},o($Vh4,[2,416]),o($Vh4,[2,417]),o($VV3,[2,409]),{67:$Vi4,71:[1,922]},o($Vj4,[2,429]),o($VH,[2,653],{406:924,407:925,408:926,266:$VW3,413:[1,927]}),o($Vk4,[2,637]),o($Vk4,[2,638]),{128:[1,929],409:[1,928]},{90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,266:[2,634],269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,278:322,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72},o($Vj2,[2,157]),{3:930,4:$V1,5:$V2},o($VH,[2,511]),o($Vl4,[2,216],{77:931,205:[1,932]}),{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:933,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},o($Vy3,[2,147],{178:934,187:936,179:937,188:938,193:941,67:$Vm4,180:$Vn4,182:$Vo4,194:$Vp4,195:$Vq4,196:$Vr4,197:$Vs4,198:$Vt4,199:$Vu4,200:$Vv4,201:$Vw4}),{3:193,4:$V1,5:$V2,36:390,70:$Vj1,72:67,81:$V6,107:$Vk1,116:$VQ,118:187,119:$VR,126:$VS,155:$VW,158:92,163:$Va,173:188,174:190,175:189,176:191,177:950,183:806,186:192,260:$Vd1,367:168,368:$Vg1,372:$Vh1},o($Vj4,[2,155]),{3:638,4:$V1,5:$V2,88:951,89:636,90:$Vz3},o($VY3,[2,70]),o($VA3,[2,125],{278:322,90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72}),{71:[1,952]},{67:$V63,71:[2,705]},{3:147,4:$V1,5:$V2,51:144,70:$VM,71:[2,698],89:130,91:134,95:953,96:954,100:957,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,214:955,215:[1,956],222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},o($VE3,[2,78]),o($VZ3,[2,701],{127:642,153:$VB3,154:$VC3,155:$VD3}),{3:411,4:$V1,5:$V2,65:$Vq2,69:$Vr2,70:$Vs2,71:[1,958],90:$Vt2,92:959,93:$Vu2,97:$Vv2,98:$Vw2,99:$Vx2,104:$Vy2,105:$Vz2,106:$VA2,107:$VB2,108:$VC2,109:$VD2,110:$VE2,111:$VF2,112:$VG2,113:$VH2,114:$VI2,115:$VJ2,116:$VK2,117:$VL2,118:433,119:$VM2,120:$VN2,122:$VO2,123:$VP2,124:$VQ2,126:$VR2,128:$VS2,130:$VT2,132:443,134:444,136:$VU2,138:$VV2,140:$VW2,142:$VX2,143:$VY2,144:$VZ2,145:$V_2,146:$V$2,147:$V03,149:$V13,159:$V23,161:$V33,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,367:168,368:$Vg1,372:$Vh1},o($VZ3,[2,702],{127:642,153:$VB3,154:$VC3,155:$VD3}),{71:[1,960],90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,278:322,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72},{71:[1,961]},o($VE3,[2,98]),{67:$V14,71:[1,962]},o($VE3,[2,100]),{67:$V63,71:[1,963]},{3:411,4:$V1,5:$V2,65:$Vq2,69:$Vr2,70:$Vs2,71:[1,964],90:$Vt2,92:965,93:$Vu2,97:$Vv2,98:$Vw2,99:$Vx2,104:$Vy2,105:$Vz2,106:$VA2,107:$VB2,108:$VC2,109:$VD2,110:$VE2,111:$VF2,112:$VG2,113:$VH2,114:$VI2,115:$VJ2,116:$VK2,117:$VL2,118:433,119:$VM2,120:$VN2,122:$VO2,123:$VP2,124:$VQ2,126:$VR2,128:$VS2,130:$VT2,132:443,134:444,136:$VU2,138:$VV2,140:$VW2,142:$VX2,143:$VY2,144:$VZ2,145:$V_2,146:$V$2,147:$V03,149:$V13,159:$V23,161:$V33,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,367:168,368:$Vg1,372:$Vh1},{3:411,4:$V1,5:$V2,65:$Vq2,69:$Vr2,70:$Vs2,71:[1,966],90:$Vt2,92:967,93:$Vu2,97:$Vv2,98:$Vw2,99:$Vx2,104:$Vy2,105:$Vz2,106:$VA2,107:$VB2,108:$VC2,109:$VD2,110:$VE2,111:$VF2,112:$VG2,113:$VH2,114:$VI2,115:$VJ2,116:$VK2,117:$VL2,118:433,119:$VM2,120:$VN2,122:$VO2,123:$VP2,124:$VQ2,126:$VR2,128:$VS2,130:$VT2,132:443,134:444,136:$VU2,138:$VV2,140:$VW2,142:$VX2,143:$VY2,144:$VZ2,145:$V_2,146:$V$2,147:$V03,149:$V13,159:$V23,161:$V33,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,367:168,368:$Vg1,372:$Vh1},{3:411,4:$V1,5:$V2,65:$Vq2,69:$Vr2,70:$Vs2,71:[1,968],90:$Vt2,92:969,93:$Vu2,97:$Vv2,98:$Vw2,99:$Vx2,104:$Vy2,105:$Vz2,106:$VA2,107:$VB2,108:$VC2,109:$VD2,110:$VE2,111:$VF2,112:$VG2,113:$VH2,114:$VI2,115:$VJ2,116:$VK2,117:$VL2,118:433,119:$VM2,120:$VN2,122:$VO2,123:$VP2,124:$VQ2,126:$VR2,128:$VS2,130:$VT2,132:443,134:444,136:$VU2,138:$VV2,140:$VW2,142:$VX2,143:$VY2,144:$VZ2,145:$V_2,146:$V$2,147:$V03,149:$V13,159:$V23,161:$V33,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,367:168,368:$Vg1,372:$Vh1},{3:411,4:$V1,5:$V2,65:$Vq2,69:$Vr2,70:$Vs2,71:[1,970],90:$Vt2,92:971,93:$Vu2,97:$Vv2,98:$Vw2,99:$Vx2,104:$Vy2,105:$Vz2,106:$VA2,107:$VB2,108:$VC2,109:$VD2,110:$VE2,111:$VF2,112:$VG2,113:$VH2,114:$VI2,115:$VJ2,116:$VK2,117:$VL2,118:433,119:$VM2,120:$VN2,122:$VO2,123:$VP2,124:$VQ2,126:$VR2,128:$VS2,130:$VT2,132:443,134:444,136:$VU2,138:$VV2,140:$VW2,142:$VX2,143:$VY2,144:$VZ2,145:$V_2,146:$V$2,147:$V03,149:$V13,159:$V23,161:$V33,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,367:168,368:$Vg1,372:$Vh1},{67:$Vx4,71:[1,972]},o($Vy4,[2,121],{367:168,3:411,118:433,132:443,134:444,92:974,4:$V1,5:$V2,65:$Vq2,69:$Vr2,70:$Vs2,90:$Vt2,93:$Vu2,97:$Vv2,98:$Vw2,99:$Vx2,104:$Vy2,105:$Vz2,106:$VA2,107:$VB2,108:$VC2,109:$VD2,110:$VE2,111:$VF2,112:$VG2,113:$VH2,114:$VI2,115:$VJ2,116:$VK2,117:$VL2,119:$VM2,120:$VN2,122:$VO2,123:$VP2,124:$VQ2,126:$VR2,128:$VS2,130:$VT2,136:$VU2,138:$VV2,140:$VW2,142:$VX2,143:$VY2,144:$VZ2,145:$V_2,146:$V$2,147:$V03,149:$V13,159:$V23,161:$V33,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,368:$Vg1,372:$Vh1}),o($V_3,$V$3,{152:828,137:975}),{3:411,4:$V1,5:$V2,65:$Vq2,69:$Vr2,70:$Vs2,71:[1,976],90:$Vt2,92:977,93:$Vu2,97:$Vv2,98:$Vw2,99:$Vx2,104:$Vy2,105:$Vz2,106:$VA2,107:$VB2,108:$VC2,109:$VD2,110:$VE2,111:$VF2,112:$VG2,113:$VH2,114:$VI2,115:$VJ2,116:$VK2,117:$VL2,118:433,119:$VM2,120:$VN2,122:$VO2,123:$VP2,124:$VQ2,126:$VR2,128:$VS2,130:$VT2,132:443,134:444,136:$VU2,138:$VV2,140:$VW2,142:$VX2,143:$VY2,144:$VZ2,145:$V_2,146:$V$2,147:$V03,149:$V13,159:$V23,161:$V33,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,367:168,368:$Vg1,372:$Vh1},{3:411,4:$V1,5:$V2,65:$Vq2,69:$Vr2,70:$Vs2,71:[1,978],90:$Vt2,92:979,93:$Vu2,97:$Vv2,98:$Vw2,99:$Vx2,104:$Vy2,105:$Vz2,106:$VA2,107:$VB2,108:$VC2,109:$VD2,110:$VE2,111:$VF2,112:$VG2,113:$VH2,114:$VI2,115:$VJ2,116:$VK2,117:$VL2,118:433,119:$VM2,120:$VN2,122:$VO2,123:$VP2,124:$VQ2,126:$VR2,128:$VS2,130:$VT2,132:443,134:444,136:$VU2,138:$VV2,140:$VW2,142:$VX2,143:$VY2,144:$VZ2,145:$V_2,146:$V$2,147:$V03,149:$V13,159:$V23,161:$V33,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,367:168,368:$Vg1,372:$Vh1},{67:$Vx4,71:[1,980]},{67:$Vx4,71:[1,981]},{67:$Vx4,71:[1,982]},{67:$Vx4,71:[1,983]},{71:[1,984],127:642,153:$VB3,154:$VC3,155:$VD3},{67:$VH3,71:[1,985]},{3:411,4:$V1,5:$V2,65:$Vq2,67:[1,986],69:$Vr2,70:$Vs2,90:$Vt2,92:987,93:$Vu2,97:$Vv2,98:$Vw2,99:$Vx2,104:$Vy2,105:$Vz2,106:$VA2,107:$VB2,108:$VC2,109:$VD2,110:$VE2,111:$VF2,112:$VG2,113:$VH2,114:$VI2,115:$VJ2,116:$VK2,117:$VL2,118:433,119:$VM2,120:$VN2,122:$VO2,123:$VP2,124:$VQ2,126:$VR2,128:$VS2,130:$VT2,132:443,134:444,136:$VU2,138:$VV2,140:$VW2,142:$VX2,143:$VY2,144:$VZ2,145:$V_2,146:$V$2,147:$V03,149:$V13,159:$V23,161:$V33,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,367:168,368:$Vg1,372:$Vh1},{3:988,4:$V1,5:$V2},{3:989,4:$V1,5:$V2},o($VH,[2,534]),{3:990,4:$V1,5:$V2},{91:991,107:$VO,256:$Va1},{71:[1,992]},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:993,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{3:638,4:$V1,5:$V2,89:692,116:$VF3,119:$VG3,288:994,289:693},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:995,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{99:[1,996]},o($VH,[2,590],{278:322,90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72}),{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:997,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{3:853,4:$V1,5:$V2,70:$V34,106:$V44,381:998},o($Vz4,[2,595]),o($Vz4,[2,596]),o($Vz4,[2,597]),{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:999,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},o($VI3,[2,247]),o($VI3,[2,249]),o($VI3,[2,251]),o($VI3,[2,253]),o($Vt1,[2,139]),o($VH,[2,506]),{122:[1,1e3]},o($VH,[2,507]),o($V73,[2,477],{236:1001,4:$Vj3,336:[1,1002],338:$Vk3}),o($VH,[2,508]),o($VH,[2,510]),{67:$V63,71:[1,1003]},o($VH,[2,514]),o($VH,[2,518]),{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:235,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,125:1004,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{3:1005,4:$V1,5:$V2},o($VH,[2,520]),{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,95:1006,100:957,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,214:955,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{70:[1,1007]},{3:1008,4:$V1,5:$V2},{69:$VJ3,114:[2,780],429:1009,432:1010},o($V74,[2,779]),o($V73,[2,671]),o($V84,[2,675]),o($V84,[2,791]),{3:1011,4:$V1,5:$V2},{3:864,4:$V1,5:$V2,69:[1,1014],302:1012,309:1013,334:1015},{3:638,4:$V1,5:$V2,89:793,204:1016},{36:1017,72:67,81:$V6,158:92,163:$Va},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:1018,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},o($VV3,[2,658]),{3:638,4:$V1,5:$V2,89:692,116:$VF3,119:$VG3,121:1019,288:691,289:693},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:235,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,125:1020,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},o($VV3,[2,663]),o($VE1,[2,627],{278:322,90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72}),{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:1021,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{67:[1,1022],71:[1,1023]},o($Vy4,[2,485]),o($Vy4,[2,486]),{106:$Vc4,247:$Vd4,337:1024},{67:$VA4,71:[1,1025]},o($Vy4,[2,421],{278:322,90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72}),o($Vn1,[2,349]),o($Vn1,[2,353]),{71:[1,1027]},{67:$V63,71:[1,1028]},o($Vn1,[2,374]),o($Vn1,[2,376]),{71:[1,1029],90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,278:322,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72},{71:[1,1030]},{67:$V63,71:[1,1031]},o($Vn1,[2,379]),o($Vn1,[2,298]),{70:[1,1032]},o($Vn1,$Ve4,{239:1033,240:$Vf4}),o($Vn1,$Ve4,{239:1034,240:$Vf4}),o($Va2,[2,316]),o($VT3,[2,259]),o($Vn1,[2,256]),o($Vn1,[2,332]),o($Vs3,[2,336],{278:322,90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72}),{67:[1,1036],71:[1,1035]},{67:[1,1038],71:[1,1037],90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,278:322,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72},{3:913,4:$V1,5:$V2},{70:[1,1039],116:$VQ,118:1040,119:$Vo1,126:$VS,155:$VW,175:1041,260:$Vd1,367:168,368:$Vg1,372:$Vh1},{67:$VA4,71:[1,1042]},{36:1044,72:67,81:$V6,123:[1,1043],158:92,163:$Va},{3:638,4:$V1,5:$V2,89:1045},o($VH,[2,630]),o($Vk4,[2,635]),o($Vk4,[2,636]),{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:489,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,148:1046,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,221:488,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{144:[1,1048],267:[1,1047]},{409:[1,1049]},o($Vj2,[2,158]),o($VB4,[2,235],{78:1050,93:[1,1051]}),{94:[1,1052]},o($VX3,[2,215],{278:322,90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72}),o($Vy3,[2,148],{188:938,193:941,187:1053,179:1054,180:$Vn4,182:$Vo4,194:$Vp4,195:$Vq4,196:$Vr4,197:$Vs4,198:$Vt4,199:$Vu4,200:$Vv4,201:$Vw4}),{3:193,4:$V1,5:$V2,70:$Vj1,107:$Vk1,116:$VQ,118:187,119:$VR,126:$VS,155:$VW,173:188,174:190,175:189,176:191,183:1055,186:192,260:$Vd1,367:168,368:$Vg1,372:$Vh1},o($VC4,[2,181]),o($VC4,[2,182]),{3:193,4:$V1,5:$V2,70:[1,1060],116:$VQ,118:1058,119:$VR,126:$VS,155:$VW,173:1057,174:1061,175:1059,176:1062,189:1056,260:$Vd1,367:168,368:$Vg1,372:$Vh1},{181:[1,1063],195:$VD4},{181:[1,1065],195:$VE4},o($VF4,[2,198]),{180:[1,1069],182:[1,1068],193:1067,195:$Vq4,196:$Vr4,197:$Vs4,198:$Vt4,199:$Vu4,200:$Vv4,201:$Vw4},o($VF4,[2,200]),{195:[1,1070]},{182:[1,1072],195:[1,1071]},{182:[1,1074],195:[1,1073]},{182:[1,1075]},{195:[1,1076]},{195:[1,1077]},{67:$Vm4,178:1078,179:937,180:$Vn4,182:$Vo4,187:936,188:938,193:941,194:$Vp4,195:$Vq4,196:$Vr4,197:$Vs4,198:$Vt4,199:$Vu4,200:$Vv4,201:$Vw4},o($VY3,[2,67]),o($VE3,[2,80]),{67:$VG4,71:[1,1079]},{71:[1,1081]},o($VH4,[2,237]),{71:[2,699]},o($VH4,[2,239],{278:322,90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,215:[1,1082],216:[1,1083],269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72}),o($VE3,[2,79]),o($VZ3,[2,703],{127:642,153:$VB3,154:$VC3,155:$VD3}),o($VE3,[2,81]),o($VE3,[2,82]),o($VE3,[2,99]),o($VE3,[2,102]),o($VE3,[2,105]),o($VZ3,[2,707],{127:642,153:$VB3,154:$VC3,155:$VD3}),o($VE3,[2,106]),o($VZ3,[2,709],{127:642,153:$VB3,154:$VC3,155:$VD3}),o($VE3,[2,107]),o($VZ3,[2,711],{127:642,153:$VB3,154:$VC3,155:$VD3}),o($VE3,[2,108]),o($VZ3,[2,715],{127:642,153:$VB3,154:$VC3,155:$VD3}),o($VE3,[2,109]),o($V_3,[2,722],{151:1084}),o($V_3,[2,725],{127:642,153:$VB3,154:$VC3,155:$VD3}),{67:$Vx4,71:[1,1085]},o($VE3,[2,111]),o($VZ3,[2,717],{127:642,153:$VB3,154:$VC3,155:$VD3}),o($VE3,[2,112]),o($VZ3,[2,719],{127:642,153:$VB3,154:$VC3,155:$VD3}),o($VE3,[2,113]),o($VE3,[2,114]),o($VE3,[2,115]),o($VE3,[2,116]),o($VE3,[2,117]),o($VE3,[2,118]),{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:235,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,125:1086,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},o($V04,[2,721],{127:642,153:$VB3,154:$VC3,155:$VD3}),o($VH,[2,544]),o($VH,[2,540]),o($VH,[2,542]),o($VH,[2,538]),o($V43,[2,63]),o($VH,[2,400],{278:322,90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72}),o($V24,[2,403]),o($V24,[2,404],{278:322,90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72}),{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:1087,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},o($VH,[2,591],{278:322,90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72}),o($Vz4,[2,594]),{71:[1,1088],90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,278:322,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72},{3:1089,4:$V1,5:$V2},o($V73,[2,487],{335:1090,339:1091,340:1092,317:1100,128:$VI4,161:$VJ4,257:$VK4,294:$VL4,307:$VM4,319:$VN4,320:$VO4,324:$VP4,325:$VQ4}),o($V73,[2,476]),o($VH,[2,513],{69:[1,1103]}),{67:$V63,71:[1,1104]},o($VH,[2,522]),{67:$VG4,71:[1,1105]},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,95:1106,100:957,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,214:955,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},o($VL3,[2,673]),{114:[1,1107]},{114:[2,781]},o($V84,[2,676]),{71:[1,1108]},{67:[1,1109],71:[2,447]},{36:1110,72:67,81:$V6,158:92,163:$Va},o($Vy4,[2,473]),{67:$Vi4,71:[1,1111]},o($VH,[2,762],{359:1112,360:1113,65:$VR4}),o($VV3,$V94,{72:67,158:92,278:322,36:889,417:1115,81:$V6,90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,120:$Va4,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,163:$Va,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72,419:$Vb4}),o($VV3,[2,661],{67:$V14}),o($VV3,[2,662],{67:$V63}),o($VE1,[2,628],{278:322,90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72}),{106:[1,1116]},o($VS4,[2,480]),{67:[1,1117],71:[1,1118]},o($VS4,[2,484]),{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:1119,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},o($Vn1,[2,365]),o($Vn1,[2,366]),o($Vn1,[2,390]),o($Vn1,[2,375]),o($Vn1,[2,377]),{93:$VT4,241:1120,242:1121,243:[1,1122]},o($Vn1,[2,299]),o($Vn1,[2,300]),o($Vn1,[2,287]),{106:[1,1124]},o($Vn1,[2,289]),{106:[1,1125]},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:897,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,295:1126,367:168,368:$Vg1,372:$Vh1},o($Vh4,[2,419]),o($Vh4,[2,420]),o($Vh4,[2,415]),{70:$VU3,116:$VQ,118:789,119:$Vo1,126:$VS,155:$VW,175:790,260:$Vd1,293:1127,367:168,368:$Vg1,372:$Vh1},o($VV3,[2,412]),o($Vj4,[2,430]),o($VH,[2,654],{67:$VH3,172:[1,1128]}),{287:$VU4,290:$VV4,410:1129},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:1132,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{94:[1,1134],144:[1,1135],267:[1,1133]},o($VW4,[2,243],{79:1136,218:[1,1137]}),{94:[1,1138]},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:1144,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,206:1139,208:1140,209:$VX4,210:$VY4,211:$VZ4,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},o($VC4,[2,179]),o($VC4,[2,180]),o($Vj4,[2,156]),o($VC4,[2,213],{190:1145,202:[1,1146],203:[1,1147]}),o($V_4,[2,184],{3:1148,4:$V1,5:$V2,69:[1,1149]}),o($V$4,[2,734],{191:1150,69:[1,1151]}),{3:1152,4:$V1,5:$V2,69:[1,1153]},{36:1154,72:67,81:$V6,158:92,163:$Va},o($V_4,[2,192],{3:1155,4:$V1,5:$V2,69:[1,1156]}),o($V_4,[2,195],{3:1157,4:$V1,5:$V2,69:[1,1158]}),{70:[1,1159]},o($VF4,[2,210]),{70:[1,1160]},o($VF4,[2,206]),o($VF4,[2,199]),{195:$VE4},{195:$VD4},o($VF4,[2,201]),o($VF4,[2,202]),{195:[1,1161]},o($VF4,[2,204]),{195:[1,1162]},{195:[1,1163]},o($VF4,[2,208]),o($VF4,[2,209]),{71:[1,1164],179:1054,180:$Vn4,182:$Vo4,187:1053,188:938,193:941,194:$Vp4,195:$Vq4,196:$Vr4,197:$Vs4,198:$Vt4,199:$Vu4,200:$Vv4,201:$Vw4},o($VE3,[2,72]),{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:957,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,214:1165,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},o($VE3,[2,73]),o($VH4,[2,240]),{217:[1,1166]},o($Vy4,[2,120],{367:168,3:411,118:433,132:443,134:444,92:1167,4:$V1,5:$V2,65:$Vq2,69:$Vr2,70:$Vs2,90:$Vt2,93:$Vu2,97:$Vv2,98:$Vw2,99:$Vx2,104:$Vy2,105:$Vz2,106:$VA2,107:$VB2,108:$VC2,109:$VD2,110:$VE2,111:$VF2,112:$VG2,113:$VH2,114:$VI2,115:$VJ2,116:$VK2,117:$VL2,119:$VM2,120:$VN2,122:$VO2,123:$VP2,124:$VQ2,126:$VR2,128:$VS2,130:$VT2,136:$VU2,138:$VV2,140:$VW2,142:$VX2,143:$VY2,144:$VZ2,145:$V_2,146:$V$2,147:$V03,149:$V13,159:$V23,161:$V33,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,368:$Vg1,372:$Vh1}),o($VE3,[2,110]),{67:$V63,71:[1,1168]},o($V24,[2,405],{278:322,90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72}),o($Vz4,[2,598]),o($VH,[2,509]),o($V73,[2,475]),o($V73,[2,488],{317:1100,340:1169,128:$VI4,161:$VJ4,257:$VK4,294:$VL4,307:$VM4,319:$VN4,320:$VO4,324:$VP4,325:$VQ4}),o($V53,[2,490]),{321:[1,1170]},{321:[1,1171]},{3:217,4:$V1,5:$V2,173:1172},o($V53,[2,496],{70:[1,1173]}),{3:231,4:$V1,5:$V2,70:[1,1175],91:225,106:$VN,107:$VO,116:$VQ,126:$VS,155:$VW,170:224,174:229,175:228,225:226,226:227,232:$Vp1,238:1174,254:$V81,255:$V91,256:$Va1,257:$Vb1,260:$Vd1},o($V53,[2,499]),{257:[1,1176]},o($V53,[2,501]),o($V53,[2,502]),{70:[1,1177]},{3:1178,4:$V1,5:$V2},o($VH,$V54,{354:1179,69:$V64}),o($VH,[2,528]),{67:$VG4,71:[1,1180]},o([8,67,71,107,112,126,264,268,450,451],$VC1,{434:280,379:282,3:734,430:1181,424:1182,431:1183,4:$V1,5:$V2,116:$Vr1,119:$Vs1}),o($VH,[2,435],{303:1184,305:1185,306:1186,4:$V05,294:$V15,307:$V25}),o($V35,$V45,{3:864,310:1190,334:1191,311:1192,312:1193,4:$V1,5:$V2,318:$V55}),{71:[2,448]},{69:[1,1195]},o($VH,[2,546]),o($VH,[2,763]),{319:[1,1197],361:[1,1196]},o($VV3,[2,664]),{71:[1,1198]},{106:[1,1199]},o($VS4,[2,481]),o($Vy4,[2,422],{278:322,90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72}),{71:[1,1200],93:$VT4,242:1201},{71:[1,1202]},{94:[1,1203]},{94:[1,1204]},{71:[1,1205]},{71:[1,1206]},{67:$VA4,71:[1,1207]},o($VV3,[2,410],{67:$Vg4}),{3:217,4:$V1,5:$V2,116:$Vr1,119:$Vs1,173:1209,379:1208},o($Vk4,[2,639]),o($Vk4,[2,641]),{120:[1,1210]},{90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,267:[1,1211],269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,278:322,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72},{291:$V65,411:1212},{365:[1,1215],412:[1,1214]},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:1216,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},o($VA3,[2,226],{80:1217,136:[1,1218],142:[1,1220],143:[1,1219]}),{106:$VN,170:1221},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,95:1222,100:957,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,214:955,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},o($Vl4,[2,224],{207:1223,67:$V75,212:[1,1225]}),o($V85,[2,218]),{120:[1,1226]},{70:[1,1227]},{70:[1,1228]},o($V85,[2,223],{278:322,90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72}),o($VC4,[2,183]),{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:1229,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{3:638,4:$V1,5:$V2,89:793,204:1230},o($V_4,[2,185]),{3:1231,4:$V1,5:$V2},o($V_4,[2,736],{192:1232,3:1233,4:$V1,5:$V2}),o($V$4,[2,735]),o($V_4,[2,188]),{3:1234,4:$V1,5:$V2},{71:[1,1235]},o($V_4,[2,193]),{3:1236,4:$V1,5:$V2},o($V_4,[2,196]),{3:1237,4:$V1,5:$V2},{36:1238,72:67,81:$V6,158:92,163:$Va},{36:1239,72:67,81:$V6,158:92,163:$Va},o($VF4,[2,203]),o($VF4,[2,205]),o($VF4,[2,207]),o($Vy3,[2,149]),o($VH4,[2,238]),o($VH4,[2,241],{215:[1,1240]}),o($V_3,[2,723],{127:642,153:$VB3,154:$VC3,155:$VD3}),o($VE3,[2,119]),o($V53,[2,489]),o($V53,[2,492]),{325:[1,1241]},o($V53,[2,756],{343:1242,341:1243,70:$V95}),{106:$VN,170:1245},o($V53,[2,497]),{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:1246,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},o($V53,[2,500]),{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:1247,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},o($VH,[2,515]),o($VH,[2,519]),o($VH,[2,529]),o($V73,[2,670]),o($V73,[2,782]),o($V73,[2,783]),o($VH,[2,431]),o($VH,[2,436],{306:1248,4:$V05,294:$V15,307:$V25}),o($Va5,[2,438]),o($Va5,[2,439]),{99:[1,1249]},{99:[1,1250]},{67:[1,1251],71:[2,446]},o($Vy4,[2,474]),o($Vy4,[2,449]),{161:[1,1259],167:[1,1260],313:1252,314:1253,315:1254,316:1255,317:1256,319:$VN4,320:[1,1257],321:[1,1261],324:[1,1258]},{3:1262,4:$V1,5:$V2},{36:1263,72:67,81:$V6,158:92,163:$Va},{362:[1,1264]},{363:[1,1265]},o($VS4,[2,478]),{71:[1,1266]},o($Vn1,[2,302]),{71:[1,1267]},o($Vn1,[2,303]),{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:1144,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,206:1268,208:1140,209:$VX4,210:$VY4,211:$VZ4,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,95:1269,100:957,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,214:955,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},o($Vn1,[2,288]),o($Vn1,[2,290]),o($Vh4,[2,418]),{3:1270,4:$V1,5:$V2},o($VH,[2,656],{70:[1,1271]}),{3:638,4:$V1,5:$V2,89:692,116:$VF3,119:$VG3,121:1272,288:691,289:693},{287:$VU4,290:$VV4,410:1273},o($Vk4,[2,643]),{70:[1,1275],123:[1,1274],294:[1,1276]},{144:[1,1278],267:[1,1277]},{144:[1,1280],267:[1,1279]},{90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,267:[1,1281],269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,278:322,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72},o($VA3,[2,64]),{36:1282,72:67,81:$V6,138:[1,1283],158:92,163:$Va,213:[1,1284]},{36:1285,72:67,81:$V6,158:92,163:$Va,213:[1,1286]},{36:1287,72:67,81:$V6,158:92,163:$Va,213:[1,1288]},o($VW4,[2,245],{219:1289,220:[1,1290]}),o($VB4,[2,236],{67:$VG4}),o($Vl4,[2,217]),{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:1144,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,208:1291,209:$VX4,210:$VY4,211:$VZ4,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:1292,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{70:[1,1293]},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:1144,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,206:1294,208:1140,209:$VX4,210:$VY4,211:$VZ4,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:1144,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,206:1295,208:1140,209:$VX4,210:$VY4,211:$VZ4,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},o($VC4,[2,211],{278:322,90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72}),o($VC4,[2,212],{67:$Vi4}),o($V_4,[2,186]),o($V_4,[2,187]),o($V_4,[2,737]),o($V_4,[2,189]),{3:1296,4:$V1,5:$V2,69:[1,1297]},o($V_4,[2,194]),o($V_4,[2,197]),{71:[1,1298]},{71:[1,1299]},o($VH4,[2,242]),{3:217,4:$V1,5:$V2,173:1300},o($V53,[2,494]),o($V53,[2,757]),{3:1301,4:$V1,5:$V2},{67:[1,1302]},{71:[1,1303],90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,278:322,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72},{71:[1,1304],90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,278:322,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72},o($Va5,[2,437]),{3:1305,4:$V1,5:$V2},{106:$VN,170:1306},o($V35,$V45,{312:1193,311:1307,318:$V55}),o($V73,[2,451]),o($V73,[2,452]),o($V73,[2,453]),o($V73,[2,454]),o($V73,[2,455]),{321:[1,1308]},{321:[1,1309]},{3:1311,4:$V1,5:$V2,70:[2,752],333:1310},{3:1312,4:$V1,5:$V2},{3:1313,4:$V1,5:$V2},o($V35,[2,457]),o($VH,[2,760],{358:1314,360:1315,65:$VR4}),o($VH,[2,547]),o($VH,[2,548],{318:[1,1316]}),o($VS4,[2,479]),o($Vn1,[2,304]),o([71,93],[2,305],{67:$V75}),{67:$VG4,71:[2,306]},o($VH,[2,655]),{3:638,4:$V1,5:$V2,89:793,204:1317},o($Vk4,[2,642],{67:$V14}),o($Vk4,[2,640]),{70:$VU3,116:$VQ,118:789,119:$Vo1,126:$VS,155:$VW,175:790,260:$Vd1,293:1318,367:168,368:$Vg1,372:$Vh1},{3:638,4:$V1,5:$V2,89:793,204:1319},{123:[1,1320]},{291:$V65,411:1321},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:1322,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{291:$V65,411:1323},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:1324,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{291:$V65,411:1325},o($VA3,[2,227]),{36:1326,72:67,81:$V6,158:92,163:$Va,213:[1,1327]},{36:1328,72:67,81:$V6,158:92,163:$Va},o($VA3,[2,229]),{36:1329,72:67,81:$V6,158:92,163:$Va},o($VA3,[2,230]),{36:1330,72:67,81:$V6,158:92,163:$Va},o($VW4,[2,244]),{106:$VN,170:1331},o($V85,[2,219]),o($Vl4,[2,225],{278:322,90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72}),{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:1144,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,206:1332,208:1140,209:$VX4,210:$VY4,211:$VZ4,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{67:$V75,71:[1,1333]},{67:$V75,71:[1,1334]},o($V_4,[2,190]),{3:1335,4:$V1,5:$V2},{3:1336,4:$V1,5:$V2,69:[1,1337]},{3:1338,4:$V1,5:$V2,69:[1,1339]},o($V53,[2,754],{342:1340,341:1341,70:$V95}),{71:[1,1342]},{106:$VN,170:1343},o($V53,[2,498]),o($V53,[2,458]),o($Va5,[2,440]),o($Va5,[2,441]),o($Vy4,[2,450]),{3:1345,4:$V1,5:$V2,70:[2,748],322:1344},{70:[1,1346]},{70:[1,1347]},{70:[2,753]},{70:[1,1348]},{70:[1,1349]},o($VH,[2,545]),o($VH,[2,761]),o($V35,$V45,{312:1193,311:1350,318:$V55}),{67:$Vi4,71:[1,1351]},o($Vk4,[2,649],{67:$Vg4}),{67:$Vi4,71:[1,1352]},o($Vk4,[2,651]),o($Vk4,[2,644]),{90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,267:[1,1353],269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,278:322,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72},o($Vk4,[2,647]),{90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,267:[1,1354],269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,278:322,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72},o($Vk4,[2,645]),o($VA3,[2,228]),{36:1355,72:67,81:$V6,158:92,163:$Va},o($VA3,[2,231]),o($VA3,[2,233]),o($VA3,[2,234]),o($VW4,[2,246]),{67:$V75,71:[1,1356]},o($V85,[2,221]),o($V85,[2,222]),o($V_4,[2,191]),o($VC4,[2,151]),{3:1357,4:$V1,5:$V2},o($VC4,[2,153]),{3:1358,4:$V1,5:$V2},o($V53,[2,493]),o($V53,[2,755]),o($V53,[2,491]),{71:[1,1359]},{70:[1,1360]},{70:[2,749]},{3:1362,4:$V1,5:$V2,107:$Vb5,323:1361},{3:638,4:$V1,5:$V2,89:793,204:1364},{3:638,4:$V1,5:$V2,89:793,204:1365},{3:638,4:$V1,5:$V2,89:793,204:1366},o($VH,[2,549]),o($VH,[2,657]),{123:[1,1367],294:[1,1368]},{291:$V65,411:1369},{287:$VU4,290:$VV4,410:1370},o($VA3,[2,232]),o($V85,[2,220]),o($VC4,[2,152]),o($VC4,[2,154]),o($V53,[2,495]),{3:1362,4:$V1,5:$V2,107:$Vb5,323:1371},{67:$Vc5,71:[1,1372]},o($Vy4,[2,469]),o($Vy4,[2,470]),{67:$Vi4,71:[1,1374]},{67:$Vi4,71:[1,1375]},{67:$Vi4,71:[1,1376]},{70:$VU3,116:$VQ,118:789,119:$Vo1,126:$VS,155:$VW,175:790,260:$Vd1,293:1377,367:168,368:$Vg1,372:$Vh1},{123:[1,1378]},o($Vk4,[2,646]),o($Vk4,[2,648]),{67:$Vc5,71:[1,1379]},{325:[1,1380]},{3:1381,4:$V1,5:$V2,107:[1,1382]},o($V73,[2,466]),o($V73,[2,467]),o($V73,[2,468]),o($Vk4,[2,650],{67:$Vg4}),o($Vk4,[2,652]),o($V73,[2,459]),{3:217,4:$V1,5:$V2,173:1383},o($Vy4,[2,471]),o($Vy4,[2,472]),o($Vd5,[2,750],{326:1384,328:1385,70:[1,1386]}),o($V73,[2,462],{327:1387,329:1388,202:[1,1389]}),o($Vd5,[2,751]),{3:1362,4:$V1,5:$V2,107:$Vb5,323:1390},o($V73,[2,460]),{202:[1,1392],330:1391},{290:[1,1393]},{67:$Vc5,71:[1,1394]},o($V73,[2,463]),{287:[1,1395]},{331:[1,1396]},o($Vd5,[2,461]),{331:[1,1397]},{332:[1,1398]},{332:[1,1399]},{202:[2,464]},o($V73,[2,465])],defaultActions:{97:[2,3],171:[2,307],172:[2,308],173:[2,309],174:[2,310],175:[2,311],176:[2,312],177:[2,313],178:[2,314],179:[2,315],184:[2,631],281:[2,777],288:[2,771],335:[2,738],336:[2,739],389:[2,632],455:[2,712],456:[2,713],560:[2,397],561:[2,398],562:[2,399],615:[2,633],956:[2,699],1010:[2,781],1110:[2,448],1311:[2,753],1345:[2,749],1398:[2,464]},parseError:function parseError(str,hash){if(hash.recoverable){this.trace(str)
+}else{throw new Error(str)}},parse:function parse(input){var self=this,stack=[0],tstack=[],vstack=[null],lstack=[],table=this.table,yytext="",yylineno=0,yyleng=0,recovering=0,TERROR=2,EOF=1;var args=lstack.slice.call(arguments,1);var lexer=Object.create(this.lexer);var sharedState={yy:{}};for(var k in this.yy){if(Object.prototype.hasOwnProperty.call(this.yy,k)){sharedState.yy[k]=this.yy[k]}}lexer.setInput(input,sharedState.yy);sharedState.yy.lexer=lexer;sharedState.yy.parser=this;if(typeof lexer.yylloc=="undefined"){lexer.yylloc={}}var yyloc=lexer.yylloc;lstack.push(yyloc);var ranges=lexer.options&&lexer.options.ranges;if(typeof sharedState.yy.parseError==="function"){this.parseError=sharedState.yy.parseError}else{this.parseError=Object.getPrototypeOf(this).parseError}function popStack(n){stack.length=stack.length-2*n;vstack.length=vstack.length-n;lstack.length=lstack.length-n}_token_stack:function lex(){var token;token=lexer.lex()||EOF;if(typeof token!=="number"){token=self.symbols_[token]||token}return token}var symbol,preErrorSymbol,state,action,a,r,yyval={},p,len,newState,expected;while(true){state=stack[stack.length-1];if(this.defaultActions[state]){action=this.defaultActions[state]}else{if(symbol===null||typeof symbol=="undefined"){symbol=lex()}action=table[state]&&table[state][symbol]}if(typeof action==="undefined"||!action.length||!action[0]){var errStr="";expected=[];for(p in table[state]){if(this.terminals_[p]&&p>TERROR){expected.push("'"+this.terminals_[p]+"'")}}if(lexer.showPosition){errStr="Parse error on line "+(yylineno+1)+":\n"+lexer.showPosition()+"\nExpecting "+expected.join(", ")+", got '"+(this.terminals_[symbol]||symbol)+"'"}else{errStr="Parse error on line "+(yylineno+1)+": Unexpected "+(symbol==EOF?"end of input":"'"+(this.terminals_[symbol]||symbol)+"'")}this.parseError(errStr,{text:lexer.match,token:this.terminals_[symbol]||symbol,line:lexer.yylineno,loc:yyloc,expected:expected})}if(action[0]instanceof Array&&action.length>1){throw new Error("Parse Error: multiple actions possible at state: "+state+", token: "+symbol)}switch(action[0]){case 1:stack.push(symbol);vstack.push(lexer.yytext);lstack.push(lexer.yylloc);stack.push(action[1]);symbol=null;if(!preErrorSymbol){yyleng=lexer.yyleng;yytext=lexer.yytext;yylineno=lexer.yylineno;yyloc=lexer.yylloc;if(recovering>0){recovering--}}else{symbol=preErrorSymbol;preErrorSymbol=null}break;case 2:len=this.productions_[action[1]][1];yyval.$=vstack[vstack.length-len];yyval._$={first_line:lstack[lstack.length-(len||1)].first_line,last_line:lstack[lstack.length-1].last_line,first_column:lstack[lstack.length-(len||1)].first_column,last_column:lstack[lstack.length-1].last_column};if(ranges){yyval._$.range=[lstack[lstack.length-(len||1)].range[0],lstack[lstack.length-1].range[1]]}r=this.performAction.apply(yyval,[yytext,yyleng,yylineno,sharedState.yy,action[1],vstack,lstack].concat(args));if(typeof r!=="undefined"){return r}if(len){stack=stack.slice(0,-1*len*2);vstack=vstack.slice(0,-1*len);lstack=lstack.slice(0,-1*len)}stack.push(this.productions_[action[1]][0]);vstack.push(yyval.$);lstack.push(yyval._$);newState=table[stack[stack.length-2]][stack[stack.length-1]];stack.push(newState);break;case 3:return true}}return true}};var lexer=function(){var lexer={EOF:1,parseError:function parseError(str,hash){if(this.yy.parser){this.yy.parser.parseError(str,hash)}else{throw new Error(str)}},setInput:function(input,yy){this.yy=yy||this.yy||{};this._input=input;this._more=this._backtrack=this.done=false;this.yylineno=this.yyleng=0;this.yytext=this.matched=this.match="";this.conditionStack=["INITIAL"];this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0};if(this.options.ranges){this.yylloc.range=[0,0]}this.offset=0;return this},input:function(){var ch=this._input[0];this.yytext+=ch;this.yyleng++;this.offset++;this.match+=ch;this.matched+=ch;var lines=ch.match(/(?:\r\n?|\n).*/g);if(lines){this.yylineno++;this.yylloc.last_line++}else{this.yylloc.last_column++}if(this.options.ranges){this.yylloc.range[1]++}this._input=this._input.slice(1);return ch},unput:function(ch){var len=ch.length;var lines=ch.split(/(?:\r\n?|\n)/g);this._input=ch+this._input;this.yytext=this.yytext.substr(0,this.yytext.length-len);this.offset-=len;var oldLines=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1);this.matched=this.matched.substr(0,this.matched.length-1);if(lines.length-1){this.yylineno-=lines.length-1}var r=this.yylloc.range;this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:lines?(lines.length===oldLines.length?this.yylloc.first_column:0)+oldLines[oldLines.length-lines.length].length-lines[0].length:this.yylloc.first_column-len};if(this.options.ranges){this.yylloc.range=[r[0],r[0]+this.yyleng-len]}this.yyleng=this.yytext.length;return this},more:function(){this._more=true;return this},reject:function(){if(this.options.backtrack_lexer){this._backtrack=true}else{return this.parseError("Lexical error on line "+(this.yylineno+1)+". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})}return this},less:function(n){this.unput(this.match.slice(n))},pastInput:function(){var past=this.matched.substr(0,this.matched.length-this.match.length);return(past.length>20?"...":"")+past.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var next=this.match;if(next.length<20){next+=this._input.substr(0,20-next.length)}return(next.substr(0,20)+(next.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var pre=this.pastInput();var c=new Array(pre.length+1).join("-");return pre+this.upcomingInput()+"\n"+c+"^"},test_match:function(match,indexed_rule){var token,lines,backup;if(this.options.backtrack_lexer){backup={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done};if(this.options.ranges){backup.yylloc.range=this.yylloc.range.slice(0)}}lines=match[0].match(/(?:\r\n?|\n).*/g);if(lines){this.yylineno+=lines.length}this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:lines?lines[lines.length-1].length-lines[lines.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+match[0].length};this.yytext+=match[0];this.match+=match[0];this.matches=match;this.yyleng=this.yytext.length;if(this.options.ranges){this.yylloc.range=[this.offset,this.offset+=this.yyleng]}this._more=false;this._backtrack=false;this._input=this._input.slice(match[0].length);this.matched+=match[0];token=this.performAction.call(this,this.yy,this,indexed_rule,this.conditionStack[this.conditionStack.length-1]);if(this.done&&this._input){this.done=false}if(token){return token}else if(this._backtrack){for(var k in backup){this[k]=backup[k]}return false}return false},next:function(){if(this.done){return this.EOF}if(!this._input){this.done=true}var token,match,tempMatch,index;if(!this._more){this.yytext="";this.match=""}var rules=this._currentRules();for(var i=0;imatch[0].length)){match=tempMatch;index=i;if(this.options.backtrack_lexer){token=this.test_match(tempMatch,rules[i]);if(token!==false){return token}else if(this._backtrack){match=false;continue}else{return false}}else if(!this.options.flex){break}}}if(match){token=this.test_match(match,rules[index]);if(token!==false){return token}return false}if(this._input===""){return this.EOF}else{return this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})}},lex:function lex(){var r=this.next();if(r){return r}else{return this.lex()}},begin:function begin(condition){this.conditionStack.push(condition)},popState:function popState(){var n=this.conditionStack.length-1;if(n>0){return this.conditionStack.pop()}else{return this.conditionStack[0]}},_currentRules:function _currentRules(){if(this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]){return this.conditions[this.conditionStack[this.conditionStack.length-1]].rules}else{return this.conditions["INITIAL"].rules}},topState:function topState(n){n=this.conditionStack.length-1-Math.abs(n||0);if(n>=0){return this.conditionStack[n]}else{return"INITIAL"}},pushState:function pushState(condition){this.begin(condition)},stateStackSize:function stateStackSize(){return this.conditionStack.length},options:{"case-insensitive":true},performAction:function anonymous(yy,yy_,$avoiding_name_collisions,YY_START){var YYSTATE=YY_START;switch($avoiding_name_collisions){case 0:return 233;break;case 1:return 260;break;case 2:return 368;break;case 3:return 5;break;case 4:return 5;break;case 5:return 256;break;case 6:return 256;break;case 7:return 107;break;case 8:return 107;break;case 9:return;break;case 10:break;case 11:return 145;break;case 12:return 144;break;case 13:yy_.yytext="VALUE";return 163;break;case 14:yy_.yytext="ROW";return 163;break;case 15:yy_.yytext="COLUMN";return 163;break;case 16:yy_.yytext="MATRIX";return 163;break;case 17:yy_.yytext="INDEX";return 163;break;case 18:yy_.yytext="RECORDSET";return 163;break;case 19:yy_.yytext="TEXT";return 163;break;case 20:yy_.yytext="SELECT";return 163;break;case 21:return"ABSOLUTE";break;case 22:return 332;break;case 23:return 349;break;case 24:return 251;break;case 25:return 138;break;case 26:return 347;break;case 27:return 144;break;case 28:return 201;break;case 29:return 140;break;case 30:return 181;break;case 31:return 252;break;case 32:return 69;break;case 33:return 366;break;case 34:return 215;break;case 35:return 351;break;case 36:return 307;break;case 37:return 248;break;case 38:return 386;break;case 39:return 282;break;case 40:return 390;break;case 41:return 283;break;case 42:return 269;break;case 43:return 94;break;case 44:return 261;break;case 45:return 235;break;case 46:return 319;break;case 47:return 105;break;case 48:return"CLOSE";break;case 49:return 216;break;case 50:return 164;break;case 51:return 164;break;case 52:return 383;break;case 53:return 318;break;case 54:return 419;break;case 55:return 389;break;case 56:return 237;break;case 57:return 213;break;case 58:return 245;break;case 59:return 298;break;case 60:return 180;break;case 61:return 211;break;case 62:return 232;break;case 63:return"CURSOR";break;case 64:return 352;break;case 65:return 397;break;case 66:return 294;break;case 67:return 290;break;case 68:return"DELETED";break;case 69:return 215;break;case 70:return 353;break;case 71:return 159;break;case 72:return 344;break;case 73:return 396;break;case 74:return 110;break;case 75:return 264;break;case 76:return 338;break;case 77:return 268;break;case 78:return 143;break;case 79:return 258;break;case 80:return 12;break;case 81:return 255;break;case 82:return"FETCH";break;case 83:return 249;break;case 84:return 324;break;case 85:return 157;break;case 86:return 451;break;case 87:return 421;break;case 88:return 205;break;case 89:return 209;break;case 90:return 212;break;case 91:return 364;break;case 92:return 130;break;case 93:return 307;break;case 94:return 284;break;case 95:return 280;break;case 96:return 167;break;case 97:return 196;break;case 98:return 291;break;case 99:return"INSERTED";break;case 100:return 142;break;case 101:return 172;break;case 102:return 195;break;case 103:return 321;break;case 104:return 250;break;case 105:return"LET";break;case 106:return 197;break;case 107:return 90;break;case 108:return 218;break;case 109:return 409;break;case 110:return 165;break;case 111:return 247;break;case 112:return 401;break;case 113:return 246;break;case 114:return 143;break;case 115:return 350;break;case 116:return 194;break;case 117:return"NEXT";break;case 118:return 234;break;case 119:return 217;break;case 120:return 331;break;case 121:return 128;break;case 122:return 257;break;case 123:return 382;break;case 124:return 202;break;case 125:return 362;break;case 126:return 220;break;case 127:return"OPEN";break;case 128:return 363;break;case 129:return 145;break;case 130:return 93;break;case 131:return 182;break;case 132:return 240;break;case 133:return 146;break;case 134:return 243;break;case 135:return 452;break;case 136:return 14;break;case 137:return 320;break;case 138:return 391;break;case 139:return"PRIOR";break;case 140:return 13;break;case 141:return 361;break;case 142:return 168;break;case 143:return"REDUCE";break;case 144:return 325;break;case 145:return"RELATIVE";break;case 146:return 85;break;case 147:return 348;break;case 148:return 149;break;case 149:return 392;break;case 150:return"RESTORE";break;case 151:return 147;break;case 152:return 147;break;case 153:return 198;break;case 154:return 385;break;case 155:return 210;break;case 156:return 124;break;case 157:return 352;break;case 158:return 81;break;case 159:return 200;break;case 160:return 120;break;case 161:return 120;break;case 162:return 356;break;case 163:return 286;break;case 164:return 365;break;case 165:return"STRATEGY";break;case 166:return"STORE";break;case 167:return 244;break;case 168:return 304;break;case 169:return 304;break;case 170:return 412;break;case 171:return 308;break;case 172:return 308;break;case 173:return 166;break;case 174:return 267;break;case 175:return"TIMEOUT";break;case 176:return 122;break;case 177:return 169;break;case 178:return 384;break;case 179:return 384;break;case 180:return 254;break;case 181:return 400;break;case 182:return 136;break;case 183:return 161;break;case 184:return 287;break;case 185:return 355;break;case 186:return 203;break;case 187:return 123;break;case 188:return 109;break;case 189:return 357;break;case 190:return 266;break;case 191:return 104;break;case 192:return 388;break;case 193:return 65;break;case 194:return 384;break;case 195:return 106;break;case 196:return 106;break;case 197:return 97;break;case 198:return 112;break;case 199:return 153;break;case 200:return 270;break;case 201:return 154;break;case 202:return 108;break;case 203:return 113;break;case 204:return 277;break;case 205:return 274;break;case 206:return 276;break;case 207:return 273;break;case 208:return 271;break;case 209:return 114;break;case 210:return 272;break;case 211:return 275;break;case 212:return 115;break;case 213:return 99;break;case 214:return 275;break;case 215:return 70;break;case 216:return 71;break;case 217:return 119;break;case 218:return 372;break;case 219:return 374;break;case 220:return 376;break;case 221:return 447;break;case 222:return 449;break;case 223:return 117;break;case 224:return 67;break;case 225:return 285;break;case 226:return 126;break;case 227:return 450;break;case 228:return 116;break;case 229:return 155;break;case 230:return 111;break;case 231:return 98;break;case 232:return 4;break;case 233:return 8;break;case 234:return"INVALID";break}},rules:[/^(?:``([^\`])+``)/i,/^(?:\[\?\])/i,/^(?:@\[)/i,/^(?:\[([^\]])*?\])/i,/^(?:`([^\`])*?`)/i,/^(?:N(['](\\.|[^']|\\')*?['])+)/i,/^(?:X(['](\\.|[^']|\\')*?['])+)/i,/^(?:(['](\\.|[^']|\\')*?['])+)/i,/^(?:(["](\\.|[^"]|\\")*?["])+)/i,/^(?:--(.*?)($|\r\n|\r|\n))/i,/^(?:\s+)/i,/^(?:\|\|)/i,/^(?:&&)/i,/^(?:VALUE\s+OF\s+SELECT\b)/i,/^(?:ROW\s+OF\s+SELECT\b)/i,/^(?:COLUMN\s+OF\s+SELECT\b)/i,/^(?:MATRIX\s+OF\s+SELECT\b)/i,/^(?:INDEX\s+OF\s+SELECT\b)/i,/^(?:RECORDSET\s+OF\s+SELECT\b)/i,/^(?:TEXT\s+OF\s+SELECT\b)/i,/^(?:SELECT\b)/i,/^(?:ABSOLUTE\b)/i,/^(?:ACTION\b)/i,/^(?:ADD\b)/i,/^(?:AGGR\b)/i,/^(?:ALL\b)/i,/^(?:ALTER\b)/i,/^(?:AND\b)/i,/^(?:ANTI\b)/i,/^(?:ANY\b)/i,/^(?:APPLY\b)/i,/^(?:ARRAY\b)/i,/^(?:AS\b)/i,/^(?:ASSERT\b)/i,/^(?:ASC\b)/i,/^(?:ATTACH\b)/i,/^(?:AUTO(_)?INCREMENT\b)/i,/^(?:AVG\b)/i,/^(?:BEGIN\b)/i,/^(?:BETWEEN\b)/i,/^(?:BREAK\b)/i,/^(?:NOT\s+BETWEEN\b)/i,/^(?:NOT\s+LIKE\b)/i,/^(?:BY\b)/i,/^(?:CASE\b)/i,/^(?:CAST\b)/i,/^(?:CHECK\b)/i,/^(?:CLASS\b)/i,/^(?:CLOSE\b)/i,/^(?:COLLATE\b)/i,/^(?:COLUMN\b)/i,/^(?:COLUMNS\b)/i,/^(?:COMMIT\b)/i,/^(?:CONSTRAINT\b)/i,/^(?:CONTENT\b)/i,/^(?:CONTINUE\b)/i,/^(?:CONVERT\b)/i,/^(?:CORRESPONDING\b)/i,/^(?:COUNT\b)/i,/^(?:CREATE\b)/i,/^(?:CROSS\b)/i,/^(?:CUBE\b)/i,/^(?:CURRENT_TIMESTAMP\b)/i,/^(?:CURSOR\b)/i,/^(?:DATABASE(S)?)/i,/^(?:DECLARE\b)/i,/^(?:DEFAULT\b)/i,/^(?:DELETE\b)/i,/^(?:DELETED\b)/i,/^(?:DESC\b)/i,/^(?:DETACH\b)/i,/^(?:DISTINCT\b)/i,/^(?:DROP\b)/i,/^(?:ECHO\b)/i,/^(?:EDGE\b)/i,/^(?:END\b)/i,/^(?:ENUM\b)/i,/^(?:ELSE\b)/i,/^(?:EXCEPT\b)/i,/^(?:EXISTS\b)/i,/^(?:EXPLAIN\b)/i,/^(?:FALSE\b)/i,/^(?:FETCH\b)/i,/^(?:FIRST\b)/i,/^(?:FOREIGN\b)/i,/^(?:FROM\b)/i,/^(?:GO\b)/i,/^(?:GRAPH\b)/i,/^(?:GROUP\b)/i,/^(?:GROUPING\b)/i,/^(?:HAVING\b)/i,/^(?:HELP\b)/i,/^(?:IF\b)/i,/^(?:IDENTITY\b)/i,/^(?:IS\b)/i,/^(?:IN\b)/i,/^(?:INDEX\b)/i,/^(?:INNER\b)/i,/^(?:INSERT\b)/i,/^(?:INSERTED\b)/i,/^(?:INTERSECT\b)/i,/^(?:INTO\b)/i,/^(?:JOIN\b)/i,/^(?:KEY\b)/i,/^(?:LAST\b)/i,/^(?:LET\b)/i,/^(?:LEFT\b)/i,/^(?:LIKE\b)/i,/^(?:LIMIT\b)/i,/^(?:MATCHED\b)/i,/^(?:MATRIX\b)/i,/^(?:MAX\b)/i,/^(?:MERGE\b)/i,/^(?:MIN\b)/i,/^(?:MINUS\b)/i,/^(?:MODIFY\b)/i,/^(?:NATURAL\b)/i,/^(?:NEXT\b)/i,/^(?:NEW\b)/i,/^(?:NOCASE\b)/i,/^(?:NO\b)/i,/^(?:NOT\b)/i,/^(?:NULL\b)/i,/^(?:OFF\b)/i,/^(?:ON\b)/i,/^(?:ONLY\b)/i,/^(?:OFFSET\b)/i,/^(?:OPEN\b)/i,/^(?:OPTION\b)/i,/^(?:OR\b)/i,/^(?:ORDER\b)/i,/^(?:OUTER\b)/i,/^(?:OVER\b)/i,/^(?:PATH\b)/i,/^(?:PARTITION\b)/i,/^(?:PERCENT\b)/i,/^(?:PLAN\b)/i,/^(?:PRIMARY\b)/i,/^(?:PRINT\b)/i,/^(?:PRIOR\b)/i,/^(?:QUERY\b)/i,/^(?:READ\b)/i,/^(?:RECORDSET\b)/i,/^(?:REDUCE\b)/i,/^(?:REFERENCES\b)/i,/^(?:RELATIVE\b)/i,/^(?:REMOVE\b)/i,/^(?:RENAME\b)/i,/^(?:REPEAT\b)/i,/^(?:REQUIRE\b)/i,/^(?:RESTORE\b)/i,/^(?:RETURN\b)/i,/^(?:RETURNS\b)/i,/^(?:RIGHT\b)/i,/^(?:ROLLBACK\b)/i,/^(?:ROLLUP\b)/i,/^(?:ROW\b)/i,/^(?:SCHEMA(S)?)/i,/^(?:SEARCH\b)/i,/^(?:SEMI\b)/i,/^(?:SET\b)/i,/^(?:SETS\b)/i,/^(?:SHOW\b)/i,/^(?:SOME\b)/i,/^(?:SOURCE\b)/i,/^(?:STRATEGY\b)/i,/^(?:STORE\b)/i,/^(?:SUM\b)/i,/^(?:TABLE\b)/i,/^(?:TABLES\b)/i,/^(?:TARGET\b)/i,/^(?:TEMP\b)/i,/^(?:TEMPORARY\b)/i,/^(?:TEXTSTRING\b)/i,/^(?:THEN\b)/i,/^(?:TIMEOUT\b)/i,/^(?:TO\b)/i,/^(?:TOP\b)/i,/^(?:TRAN\b)/i,/^(?:TRANSACTION\b)/i,/^(?:TRUE\b)/i,/^(?:TRUNCATE\b)/i,/^(?:UNION\b)/i,/^(?:UNIQUE\b)/i,/^(?:UPDATE\b)/i,/^(?:USE\b)/i,/^(?:USING\b)/i,/^(?:VALUE(S)?)/i,/^(?:VERTEX\b)/i,/^(?:VIEW\b)/i,/^(?:WHEN\b)/i,/^(?:WHERE\b)/i,/^(?:WHILE\b)/i,/^(?:WITH\b)/i,/^(?:WORK\b)/i,/^(?:(\d*[.])?\d+[eE]\d+)/i,/^(?:(\d*[.])?\d+)/i,/^(?:->)/i,/^(?:#)/i,/^(?:\+)/i,/^(?:-)/i,/^(?:\*)/i,/^(?:\/)/i,/^(?:%)/i,/^(?:!===)/i,/^(?:===)/i,/^(?:!==)/i,/^(?:==)/i,/^(?:>=)/i,/^(?:>)/i,/^(?:<=)/i,/^(?:<>)/i,/^(?:<)/i,/^(?:=)/i,/^(?:!=)/i,/^(?:\()/i,/^(?:\))/i,/^(?:@)/i,/^(?:\{)/i,/^(?:\})/i,/^(?:\])/i,/^(?::-)/i,/^(?:\?-)/i,/^(?:\.)/i,/^(?:,)/i,/^(?:::)/i,/^(?::)/i,/^(?:;)/i,/^(?:\$)/i,/^(?:\?)/i,/^(?:!)/i,/^(?:\^)/i,/^(?:[a-zA-Z_][a-zA-Z_0-9]*)/i,/^(?:$)/i,/^(?:.)/i],conditions:{INITIAL:{rules:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234],inclusive:true}}};return lexer}();parser.lexer=lexer;function Parser(){this.yy={}}Parser.prototype=parser;parser.Parser=Parser;return new Parser}();if(typeof require!=="undefined"&&typeof exports!=="undefined"){exports.parser=parser;exports.Parser=parser.Parser;exports.parse=function(){return parser.parse.apply(parser,arguments)};exports.main=function commonjsMain(args){if(!args[1]){console.log("Usage: "+args[0]+" FILE");process.exit(1)}var source=require("fs").readFileSync(require("path").normalize(args[1]),"utf8");return exports.parser.parse(source)};if(typeof module!=="undefined"&&require.main===module){exports.main(process.argv.slice(1))}}alasql.prettyflag=false;alasql.pretty=function(sql,flag){var pf=alasql.prettyflag;alasql.prettyflag=!flag;var s=alasql.parse(sql).toString();alasql.prettyflag=pf;return s};function K(s){if(alasql.prettyflag){return''+s.toUpperCase()+" "}else{return s}}function P(s){if(alasql.prettyflag){return''+s+" "}else{return s}}function L(s){if(alasql.prettyflag){return''+s+" "}else{return s}}function N(s){if(alasql.prettyflag){return''+s+" "}else{return s}}function S(s){if(alasql.prettyflag){return''+s+" "}else{return s}}function NL(){if(alasql.prettyflag){return" "}else{return" "}}function ID(){if(alasql.prettyflag){return" "}else{return""}}var utils=alasql.utils={};function n2u(s){return"(y="+s+",y===y?y:undefined)"}function und(s,r){return"(y="+s+',typeof y=="undefined"?undefined:'+r+")"}function returnTrue(){return true}function returnUndefined(){}var escapeq=utils.escapeq=function(s){return s.replace(/\'/g,"\\'")};var escapeqq=utils.undoubleq=function(s){return s.replace(/(\')/g,"''")};var doubleq=utils.doubleq=function(s){return s.replace(/(\'\')/g,"\\'")};var doubleqq=utils.doubleqq=function(s){return s.replace(/\'/g,"'")};var cutbom=function(s){if(s[0]==String.fromCharCode(65279))s=s.substr(1);return s};var loadFile=utils.loadFile=function(path,asy,success,error){if(typeof exports=="object"||typeof Meteor!="undefined"&&Meteor.isServer){if(typeof Meteor!="undefined"){var fs=Npm.require("fs")}else{var fs=require("fs")}if(typeof path=="undefined"){var buff="";process.stdin.setEncoding("utf8");process.stdin.on("readable",function(){var chunk=process.stdin.read();if(chunk!==null){buff+=chunk.toString()}});process.stdin.on("end",function(){success(cutbom(buff))})}else{if(asy){fs.readFile(path,function(err,data){if(err){throw err}success(cutbom(data.toString()))})}else{var data=fs.readFileSync(path);success(cutbom(data.toString()))}}}else if(typeof cordova=="object"){window.requestFileSystem(LocalFileSystem.PERSISTENT,0,function(fileSystem){fileSystem.root.getFile(path,{create:false},function(fileEntry){fileEntry.file(function(file){var fileReader=new FileReader;fileReader.onloadend=function(e){success(cutbom(this.result))};fileReader.readAsText(file)})})})}else{if(typeof path=="string"){if(path.substr(0,1)=="#"&&typeof document!="undefined"){var data=document.querySelector(path).textContent;success(data)}else{var xhr=new XMLHttpRequest;xhr.onreadystatechange=function(){if(xhr.readyState===XMLHttpRequest.DONE){if(xhr.status===200){if(success)success(cutbom(xhr.responseText))}else{if(error)error(xhr)}}};xhr.open("GET",path,asy);xhr.send()}}else if(path instanceof Event){var files=path.target.files;var reader=new FileReader;var name=files[0].name;reader.onload=function(e){var data=e.target.result;success(cutbom(data))};reader.readAsText(files[0])}}};var loadBinaryFile=utils.loadBinaryFile=function(path,asy,success,error){if(typeof exports=="object"||typeof Meteor!="undefined"&&Meteor.isServer){if(typeof Meteor!="undefined"){var fs=Npm.require("fs")}else{var fs=require("fs")}if(asy){fs.readFile(path,function(err,data){if(err){throw err}var arr=new Array;for(var i=0;i!=data.length;++i)arr[i]=String.fromCharCode(data[i]);success(arr.join(""))})}else{var data=fs.readFileSync(path);var arr=new Array;for(var i=0;i!=data.length;++i)arr[i]=String.fromCharCode(data[i]);success(arr.join(""))}}else{if(typeof path=="string"){var xhr=new XMLHttpRequest;xhr.open("GET",path,asy);xhr.responseType="arraybuffer";xhr.onload=function(){var data=new Uint8Array(xhr.response);var arr=new Array;for(var i=0;i!=data.length;++i)arr[i]=String.fromCharCode(data[i]);success(arr.join(""))};xhr.send()}else if(path instanceof Event){var files=path.target.files;var reader=new FileReader;var name=files[0].name;reader.onload=function(e){var data=e.target.result;success(data)};reader.readAsBinaryString(files[0])}}};var removeFile=utils.removeFile=function(path,cb){if(typeof exports=="object"){var fs=require("fs");fs.remove(path,cb)}else if(typeof cordova=="object"){window.requestFileSystem(LocalFileSystem.PERSISTENT,0,function(fileSystem){fileSystem.root.getFile(path,{create:false},function(fileEntry){fileEntry.remove(cb);if(cb)cb()},function(){if(cb)cb()})})}else{throw new Error("You can remove files only in Node.js and Apache Cordova")}};var deleteFile=utils.deleteFile=function(path,cb){if(typeof exports=="object"){var fs=require("fs");fs.unlink(path,cb)}};var fileExists=utils.fileExists=function(path,cb){if(typeof exports=="object"){var fs=require("fs");fs.exists(path,cb)}else if(typeof cordova=="object"){window.requestFileSystem(LocalFileSystem.PERSISTENT,0,function(fileSystem){fileSystem.root.getFile(path,{create:false},function(fileEntry){cb(true)},function(){cb(false)})})}else{throw new Error("You can use exists() only in Node.js or Apach Cordova")}};var saveFile=utils.saveFile=function(path,data,cb){var res=1;if(typeof path=="undefined"){res=data;if(cb)res=cb(res)}else{if(typeof exports=="object"){var fs=require("fs");var data=fs.writeFileSync(path,data);if(cb)res=cb(res)}else if(typeof cordova=="object"){window.requestFileSystem(LocalFileSystem.PERSISTENT,0,function(fileSystem){fileSystem.root.getFile(path,{create:true},function(fileEntry){fileEntry.createWriter(function(fileWriter){fileWriter.onwriteend=function(){if(cb)res=cb(res)};fileWriter.write(data)})})})}else{if(isIE()==9){var ndata=data.replace(/\r\n/g,"A;D;");ndata=ndata.replace(/\n/g,"D;");ndata=ndata.replace(/\t/g," ");var testlink=window.open("about:blank","_blank");testlink.document.write(ndata);testlink.document.close();testlink.document.execCommand("SaveAs",false,path);testlink.close()}else{var blob=new Blob([data],{type:"text/plain;charset=utf-8"});saveAs(blob,path);if(cb)res=cb(res)}}}return res};function isIE(){var myNav=navigator.userAgent.toLowerCase();return myNav.indexOf("msie")!=-1?parseInt(myNav.split("msie")[1]):false}var hash=utils.hash=function hash(str){var h=0;if(str.length==0)return h;for(var i=0;i=26){i=(i/26|0)-1;addr=String.fromCharCode(65+i%26)+addr;if(i>26){i=(i/26|0)-1;addr=String.fromCharCode(65+i%26)+addr}}return addr};var xlscn=utils.xlscn=function(s){var n=s.charCodeAt(0)-65;if(s.length>1){n=(n+1)*26+s.charCodeAt(1)-65;if(s.length>2){n=(n+1)*26+s.charCodeAt(2)-65}}return n};var domEmptyChildren=utils.domEmptyChildren=function(container){var len=container.childNodes.length;while(len--){container.removeChild(container.lastChild)}};alasql.utils.uncomment=function uncomment(str){str=("__"+str+"__").split("");var quote=false,quoteSign,blockComment=false,lineComment=false;for(var i=0,l=str.length;ialasql.MAXSQLCACHESIZE){db.resetSqlCache()}db.sqlCacheSize++;db.sqlCache[hh]=statement}var res=alasql.res=statement(params,cb,scope);return res}else{alasql.precompile(ast.statements[0],alasql.useid,params);var res=alasql.res=ast.statements[0].execute(databaseid,params,cb,scope);return res}}else{if(cb){alasql.adrun(databaseid,ast,params,cb,scope)}else{return alasql.drun(databaseid,ast,params,cb,scope)}}};alasql.drun=function(databaseid,ast,params,cb,scope){var useid=alasql.useid;if(useid!=databaseid)alasql.use(databaseid);var res=[];for(var i=0,ilen=ast.statements.length;i0){if(selectors&&selectors[0]&&selectors[0].srchid=="PROP"&&selectors[0].args&&selectors[0].args[0]){if(selectors[0].args[0].toUpperCase()=="XML"){stope.mode="XML";selectors.shift()}else if(selectors[0].args[0].toUpperCase()=="HTML"){stope.mode="HTML";selectors.shift()}else if(selectors[0].args[0].toUpperCase()=="JSON"){stope.mode="JSON";selectors.shift()}}if(selectors.length>0&&selectors[0].srchid=="VALUE"){stope.value=true;selectors.shift()}}if(this.from instanceof yy.Column){var dbid=this.from.databaseid||databaseid;fromdata=alasql.databases[dbid].tables[this.from.columnid].data}else if(this.from instanceof yy.FuncValue&&alasql.from[this.from.funcid.toUpperCase()]){var args=this.from.args.map(function(arg){var as=arg.toJavaScript();var fn=new Function("params,alasql","var y;return "+as).bind(this);return fn(params,alasql)});fromdata=alasql.from[this.from.funcid.toUpperCase()].apply(this,args)}else if(typeof this.from=="undefined"){fromdata=alasql.databases[databaseid].objects}else{var fromfn=new Function("params,alasql","var y;return "+this.from.toJavaScript());fromdata=fromfn(params,alasql);if(typeof Mongo=="object"&&typeof Mongo.Collection!="object"&&fromdata instanceof Mongo.Collection){fromdata=fromdata.find().fetch()}}if(typeof selectors!="undefined"&&selectors.length>0){if(false){selectors.forEach(function(selector){if(selector.srchid=="TO"){alasql.vars[selector.args[0]]=[]}})}res=processSelector(selectors,0,fromdata)}else{res=fromdata}if(this.into){var a1,a2;if(typeof this.into.args[0]!="undefined"){a1=new Function("params,alasql","var y;return "+this.into.args[0].toJavaScript())(params,alasql)}if(typeof this.into.args[1]!="undefined"){a2=new Function("params,alasql","var y;return "+this.into.args[1].toJavaScript())(params,alasql)}res=alasql.into[this.into.funcid.toUpperCase()](a1,a2,res,[],cb)}else{if(stope.value&&res.length>0)res=res[0];if(cb)res=cb(res)}return res;function processSelector(selectors,sidx,value){var sel=selectors[sidx];var SECURITY_BREAK=1e5;if(sel.selid){if(sel.selid=="PATH"){var queue=[{node:value,stack:[]}];var visited={};var path=[];var objects=alasql.databases[alasql.useid].objects;while(queue.length>0){var q=queue.shift();var node=q.node;var stack=q.stack;var r=processSelector(sel.args,0,node);if(r.length>0){if(sidx+1+1>selectors.length){return stack}else{var rv=[];if(stack&&stack.length>0){stack.forEach(function(stv){rv=rv.concat(processSelector(selectors,sidx+1,stv))})}return rv}}else{if(typeof visited[node.$id]!="undefined"){continue}else{visited[node.$id]=true;if(node.$out&&node.$out.length>0){node.$out.forEach(function(edgeid){var edge=objects[edgeid];var stack2=stack.concat(edge);stack2.push(objects[edge.$out[0]]);queue.push({node:objects[edge.$out[0]],stack:stack2})})}}}}return[]}if(sel.selid=="NOT"){var nest=processSelector(sel.args,0,value);if(nest.length>0){return[]}else{if(sidx+1+1>selectors.length){return[value]}else{return processSelector(selectors,sidx+1,value)}}}else if(sel.selid=="DISTINCT"){if(typeof sel.args=="undefined"||sel.args.length==0){var nest=distinctArray(value)}else{var nest=processSelector(sel.args,0,value)}if(nest.length==0){return[]}else{var res=distinctArray(nest);if(sidx+1+1>selectors.length){return res}else{return processSelector(selectors,sidx+1,res)}}}else if(sel.selid=="AND"){var res=true;sel.args.forEach(function(se){res=res&&processSelector(se,0,value).length>0});if(!res){return[]}else{if(sidx+1+1>selectors.length){return[value]}else{return processSelector(selectors,sidx+1,value)}}}else if(sel.selid=="OR"){var res=false;sel.args.forEach(function(se){res=res||processSelector(se,0,value).length>0});if(!res){return[]}else{if(sidx+1+1>selectors.length){return[value]}else{return processSelector(selectors,sidx+1,value)}}}else if(sel.selid=="ALL"){var nest=processSelector(sel.args[0],0,value);if(nest.length==0){return[]}else{if(sidx+1+1>selectors.length){return nest}else{return processSelector(selectors,sidx+1,nest)}}}else if(sel.selid=="ANY"){var nest=processSelector(sel.args[0],0,value);if(nest.length==0){return[]}else{if(sidx+1+1>selectors.length){return[nest[0]]}else{return processSelector(selectors,sidx+1,[nest[0]])}}}else if(sel.selid=="UNIONALL"){var nest=[];sel.args.forEach(function(se){nest=nest.concat(processSelector(se,0,value))});if(nest.length==0){return[]}else{if(sidx+1+1>selectors.length){return nest}else{return processSelector(selectors,sidx+1,nest)}}}else if(sel.selid=="UNION"){var nest=[];sel.args.forEach(function(se){nest=nest.concat(processSelector(se,0,value))});var nest=distinctArray(nest);if(nest.length==0){return[]}else{if(sidx+1+1>selectors.length){return nest}else{return processSelector(selectors,sidx+1,nest)}}}else if(sel.selid=="IF"){var nest=processSelector(sel.args,0,value);if(nest.length==0){return[]}else{if(sidx+1+1>selectors.length){return[value]}else{return processSelector(selectors,sidx+1,value)}}}else if(sel.selid=="REPEAT"){var lmin=sel.args[0].value;if(!sel.args[1]){var lmax=lmin}else{var lmax=sel.args[1].value}if(sel.args[2]){var lvar=sel.args[2].variable}else{var lvar}var lsel=sel.sels;var retval=[];if(lmin==0){if(sidx+1+1>selectors.length){retval=[value]}else{if(lvar)alasql.vars[lvar]=0;retval=retval.concat(processSelector(selectors,sidx+1,value))}}if(lmax>0){var nests=[{value:value,lvl:1}];var i=0;while(nests.length>0){var nest=nests[0];nests.shift();if(nest.lvl<=lmax){if(lvar)alasql.vars[lvar]=nest.lvl;var nest1=processSelector(sel.sels,0,nest.value);nest1.forEach(function(n){nests.push({value:n,lvl:nest.lvl+1})});if(nest.lvl>=lmin){if(sidx+1+1>selectors.length){retval=retval.concat(nest1)}else{nest1.forEach(function(n){retval=retval.concat(processSelector(selectors,sidx+1,n))})}}}i++;if(i>SECURITY_BREAK){throw new Error("Security brake. Number of iterations = "+i)}}}return retval}else if(sel.selid=="TO"){var oldv=alasql.vars[sel.args[0]];var newv=[];if(typeof oldv!="undefined"){newv=oldv.slice(0)}else{newv=[]}newv.push(value);if(sidx+1+1>selectors.length){return[value]}else{alasql.vars[sel.args[0]]=newv;var r1=processSelector(selectors,sidx+1,value);alasql.vars[sel.args[0]]=oldv;return r1}}else if(sel.selid=="ARRAY"){var nest=processSelector(sel.args,0,value);if(nest.length>0){var val=nest}else{return[]}if(sidx+1+1>selectors.length){return[val]}else{return processSelector(selectors,sidx+1,val)}}else if(sel.selid=="SUM"){var nest=processSelector(sel.args,0,value);if(nest.length>0){var val=nest.reduce(function(sum,current){return sum+current},0)}else{return[]}if(sidx+1+1>selectors.length){return[val]}else{return processSelector(selectors,sidx+1,val)}}else if(sel.selid=="AVG"){var nest=processSelector(sel.args,0,value);if(nest.length>0){var val=nest.reduce(function(sum,current){return sum+current},0)/nest.length}else{return[]}if(sidx+1+1>selectors.length){return[val]}else{return processSelector(selectors,sidx+1,val)}}else if(sel.selid=="COUNT"){var nest=processSelector(sel.args,0,value);if(nest.length>0){var val=nest.length}else{return[]}if(sidx+1+1>selectors.length){return[val]}else{return processSelector(selectors,sidx+1,val)}}else if(sel.selid=="FIRST"){var nest=processSelector(sel.args,0,value);if(nest.length>0)var val=nest[0];else return[];if(sidx+1+1>selectors.length){return[val]}else{return processSelector(selectors,sidx+1,val)}}else if(sel.selid=="LAST"){var nest=processSelector(sel.args,0,value);if(nest.length>0)var val=nest[nest.length-1];else return[];if(sidx+1+1>selectors.length){return[val]}else{return processSelector(selectors,sidx+1,val)}}else if(sel.selid=="MIN"){var nest=processSelector(sel.args,0,value);if(nest.length==0)return[];var val=nest.reduce(function(min,current){return Math.min(min,current)},Infinity);if(sidx+1+1>selectors.length){return[val]}else{return processSelector(selectors,sidx+1,val)}}else if(sel.selid=="MAX"){var nest=processSelector(sel.args,0,value);if(nest.length==0)return[];var val=nest.reduce(function(max,current){return Math.max(max,current)},-Infinity);if(sidx+1+1>selectors.length){return[val]}else{return processSelector(selectors,sidx+1,val)}}else if(sel.selid=="PLUS"){var retval=[];var nests=processSelector(sel.args,0,value).slice();if(sidx+1+1>selectors.length){retval=retval.concat(nests)}else{nests.forEach(function(n){retval=retval.concat(processSelector(selectors,sidx+1,n))})}var i=0;while(nests.length>0){var nest=nests.shift();nest=processSelector(sel.args,0,nest);nests=nests.concat(nest);if(sidx+1+1>selectors.length){retval=retval.concat(nest)}else{nest.forEach(function(n){var rn=processSelector(selectors,sidx+1,n);retval=retval.concat(rn)})}i++;if(i>SECURITY_BREAK){throw new Error("Security brake. Number of iterations = "+i)}}return retval}else if(sel.selid=="STAR"){var retval=[];retval=processSelector(selectors,sidx+1,value);var nests=processSelector(sel.args,0,value).slice();if(sidx+1+1>selectors.length){retval=retval.concat(nests)}else{nests.forEach(function(n){retval=retval.concat(processSelector(selectors,sidx+1,n))})}var i=0;while(nests.length>0){var nest=nests[0];nests.shift();nest=processSelector(sel.args,0,nest);nests=nests.concat(nest);if(sidx+1+1>selectors.length){}else{nest.forEach(function(n){retval=retval.concat(processSelector(selectors,sidx+1,n))})}i++;if(i>SECURITY_BREAK){throw new Error("Security brake. Number of iterations = "+i)}}return retval}else if(sel.selid=="QUESTION"){var retval=[];retval=retval.concat(processSelector(selectors,sidx+1,value));var nest=processSelector(sel.args,0,value);if(sidx+1+1>selectors.length){}else{nest.forEach(function(n){retval=retval.concat(processSelector(selectors,sidx+1,n))})}return retval}else if(sel.selid=="WITH"){var nest=processSelector(sel.args,0,value);if(nest.length==0){return[]}else{var r={status:1,values:nest}}}else if(sel.selid=="ROOT"){if(sidx+1+1>selectors.length){return[value]}else{return processSelector(selectors,sidx+1,fromdata)}}else{throw new Error("Wrong selector "+sel.selid)}}else if(sel.srchid){var r=alasql.srch[sel.srchid.toUpperCase()](value,sel.args,stope,params)}else{throw new Error("Selector not found")}if(typeof r=="undefined"){r={status:1,values:[value]}}var res=[];if(r.status==1){var arr=r.values;if(sidx+1+1>selectors.length){res=arr}else{for(var i=0;i0){return{status:1,values:arr}}else{return{status:-1,values:[]}}}else{if(typeof val!="object"||val===null||typeof args!="object"||typeof val[args[0]]=="undefined"){return{status:-1,values:[]}}else{return{status:1,values:[val[args[0]]]}}}};alasql.srch.APROP=function(val,args,stope){if(typeof val!="object"||val===null||typeof args!="object"||typeof val[args[0]]=="undefined"){return{status:1,values:[undefined]}}else{return{status:1,values:[val[args[0]]]}}};alasql.srch.ORDERBY=function(val,args,stope){var res=val.sort(compileSearchOrder(args));return{status:1,values:res}};alasql.srch.EQ=function(val,args,stope,params){var exprs=args[0].toJavaScript("x","");var exprfn=new Function("x,alasql,params","return "+exprs);if(val==exprfn(val,alasql,params)){return{status:1,values:[val]}}else{return{status:-1,values:[]}}};alasql.srch.LIKE=function(val,args,stope,params){var exprs=args[0].toJavaScript("x","");var exprfn=new Function("x,alasql,params","return "+exprs);if(val.toUpperCase().match(new RegExp("^"+exprfn(val,alasql,params).toUpperCase().replace(/%/g,".*")+"$"),"g")){return{status:1,values:[val]}}else{return{status:-1,values:[]}}};alasql.srch.ATTR=function(val,args,stope){if(stope.mode=="XML"){if(typeof args=="undefined"){return{status:1,values:[val.attributes]}}else{if(typeof val=="object"&&typeof val.attributes=="object"&&typeof val.attributes[args[0]]!="undefined"){return{status:1,values:[val.attributes[args[0]]]}}else{return{status:-1,values:[]}}}}else{throw new Error("ATTR is not using in usual mode")}};alasql.srch.CONTENT=function(val,args,stope){if(stope.mode=="XML"){return{status:1,values:[val.content]}}else{throw new Error("ATTR is not using in usual mode")}};alasql.srch.SHARP=function(val,args,stope){var obj=alasql.databases[alasql.useid].objects[args[0]];if(typeof val!="undefined"&&val===obj){return{status:1,values:[val]}}else{return{status:-1,values:[]}}};alasql.srch.PARENT=function(val,args,stope){console.log("PARENT");return{status:-1,values:[]}};alasql.srch.CHILD=function(val,args,stope){if(typeof val=="object"){if(val instanceof Array){return{status:1,values:val}}else{if(stope.mode=="XML"){return{status:1,values:Object.keys(val.children).map(function(key){return val.children[key]})}}else{return{status:1,values:Object.keys(val).map(function(key){return val[key]})}}}}else{return{status:1,values:[]}}};alasql.srch.KEYS=function(val,args){if(typeof val=="object"&&val!==null){return{status:1,values:Object.keys(val)}}else{return{status:1,values:[]}}};alasql.srch.WHERE=function(val,args){var exprs=args[0].toJavaScript("x","");var exprfn=new Function("x,alasql","return "+exprs);if(exprfn(val,alasql)){return{status:1,values:[val]}}else{return{status:-1,values:[]}}};alasql.srch.NAME=function(val,args){if(val.name==args[0]){return{status:1,values:[val]}}else{return{status:-1,values:[]}}};alasql.srch.CLASS=function(val,args){if(val.$class==args){return{status:1,values:[val]}}else{return{status:-1,values:[]}}};alasql.srch.VERTEX=function(val,args){if(val.$node=="VERTEX"){return{status:1,values:[val]}}else{return{status:-1,values:[]}}};alasql.srch.INSTANCEOF=function(val,args){if(val instanceof alasql.fn[args[0]]){return{status:1,values:[val]}}else{return{status:-1,values:[]}}};alasql.srch.EDGE=function(val,args){if(val.$node=="EDGE"){return{status:1,values:[val]}}else{return{status:-1,values:[]}}};alasql.srch.EX=function(val,args,stope,params){var exprs=args[0].toJavaScript("x","");var exprfn=new Function("x,alasql,params","return "+exprs);return{status:1,values:[exprfn(val,alasql,params)]}};alasql.srch.RETURN=function(val,args,stope,params){var res={};if(args&&args.length>0){args.forEach(function(arg){var exprs=arg.toJavaScript("x","");var exprfn=new Function("x,alasql,params","return "+exprs);if(typeof arg.as=="undefined")arg.as=arg.toString();res[arg.as]=exprfn(val,alasql,params)})}return{status:1,values:[res]}};alasql.srch.REF=function(val,args){return{status:1,values:[alasql.databases[alasql.useid].objects[val]]}};alasql.srch.OUT=function(val,args){if(val.$out&&val.$out.length>0){var res=val.$out.map(function(v){return alasql.databases[alasql.useid].objects[v]});return{status:1,values:res}}else{return{status:-1,values:[]}}};alasql.srch.IN=function(val,args){if(val.$in&&val.$in.length>0){var res=val.$in.map(function(v){return alasql.databases[alasql.useid].objects[v]});return{status:1,values:res}}else{return{status:-1,values:[]}}};alasql.srch.AS=function(val,args){alasql.vars[args[0]]=val;return{status:1,values:[val]}};alasql.srch.AT=function(val,args){var v=alasql.vars[args[0]];return{status:1,values:[v]}};alasql.srch.CLONEDEEP=function(val,args){var z=cloneDeep(val);return{status:1,values:[z]}};alasql.srch.SET=function(val,args,stope,params){var s=args.map(function(st){if(st.method=="@"){return"alasql.vars['"+st.variable+"']="+st.expression.toJavaScript("x","")}else if(st.method=="$"){return"params['"+st.variable+"']="+st.expression.toJavaScript("x","")}else{return"x['"+st.column.columnid+"']="+st.expression.toJavaScript("x","")}}).join(";");var setfn=new Function("x,params,alasql",s);setfn(val,params,alasql);return{status:1,values:[val]}};alasql.srch.ROW=function(val,args,stope,params){var s="var y;return [";s+=args.map(function(arg){return arg.toJavaScript("x","")}).join(",");s+="]";var setfn=new Function("x,params,alasql",s);var rv=setfn(val,params,alasql);return{status:1,values:[rv]}};alasql.srch.D3=function(val,args,stope,params){if(val.$node=="VERTEX"){}else if(val.$node=="EDGE"){val.source=val.$in[0];val.target=val.$out[0]}return{status:1,values:[val]}};compileSearchOrder=function(order){if(order){if(order&&order.length==1&&order[0].expression&&typeof order[0].expression=="function"){var func=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="";order.forEach(function(ord,idx){var dg="";if(ord.expression instanceof yy.NumValue){ord.expression=self.columns[ord.expression.value-1]}if(ord.expression instanceof yy.Column){var columnid=ord.expression.columnid;if(alasql.options.valueof)dg=".valueOf()";if(ord.nocase)dg+=".toUpperCase()";if(columnid=="_"){s+="if(a"+dg+(ord.direction=="ASC"?">":"<")+"b"+dg+")return 1;";s+="if(a"+dg+"==b"+dg+"){"}else{s+="if((a['"+columnid+"']||'')"+dg+(ord.direction=="ASC"?">":"<")+"(b['"+columnid+"']||'')"+dg+")return 1;";s+="if((a['"+columnid+"']||'')"+dg+"==(b['"+columnid+"']||'')"+dg+"){"}}else{dg=".valueOf()";if(ord.nocase)dg+=".toUpperCase()";s+="if(("+ord.toJavaScript("a","")+"||'')"+dg+(ord.direction=="ASC"?">(":"<(")+ord.toJavaScript("b","")+"||'')"+dg+")return 1;";s+="if(("+ord.toJavaScript("a","")+"||'')"+dg+"==("+ord.toJavaScript("b","")+"||'')"+dg+"){"}sk+="}"});s+="return 0;";s+=sk+"return -1";return new Function("a,b",s)}};function queryfn(query,oldscope,cb,A,B){var ms;query.sourceslen=query.sources.length;var slen=query.sourceslen;query.query=query;query.A=A;query.B=B;query.cb=cb;query.oldscope=oldscope;if(query.queriesfn){query.sourceslen+=query.queriesfn.length;slen+=query.queriesfn.length;query.queriesdata=[];query.queriesfn.forEach(function(q,idx){q.query.params=query.params;if(false){queryfn(q.query,query.oldscope,queryfn2,-idx-1,query)}else{queryfn2([],-idx-1,query)}})}var scope;if(!oldscope)scope={};else scope=cloneDeep(oldscope);query.scope=scope;var result;query.sources.forEach(function(source,idx){source.query=query;var rs=source.datafn(query,query.params,queryfn2,idx,alasql);if(typeof rs!=undefined){if((query.intofn||query.intoallfn)&&rs instanceof Array)rs=rs.length;result=rs}source.queriesdata=query.queriesdata});if(slen==0)result=queryfn3(query);return result}function queryfn2(data,idx,query){if(idx>=0){var source=query.sources[idx];source.data=data;if(typeof source.data=="function"){source.getfn=source.data;source.dontcache=source.getfn.dontcache;if(source.joinmode=="OUTER"||source.joinmode=="RIGHT"||source.joinmode=="ANTI"){source.dontcache=false}source.data={}}}else{query.queriesdata[-idx-1]=flatArray(data)}query.sourceslen--;if(query.sourceslen>0)return;return queryfn3(query)}function queryfn3(query){var scope=query.scope;preIndex(query);query.data=[];query.xgroups={};query.groups=[];var h=0;doJoin(query,scope,h);if(query.groupfn){query.data=[];if(query.groups.length==0){var g={};if(query.selectGroup.length>0){query.selectGroup.forEach(function(sg){if(sg.aggregatorid=="COUNT"||sg.aggregatorid=="SUM"){g[sg.nick]=0}else{g[sg.nick]=undefined}})}query.groups=[g]}for(var i=0,ilen=query.groups.length;i0){var removeKeys=query.removeKeys;var jlen=removeKeys.length;if(jlen>0){for(var i=0,ilen=query.data.length;i0){query.columns=query.columns.filter(function(column){var found=false;removeKeys.forEach(function(key){if(column.columnid==key)found=true});return!found})}}if(typeof query.removeLikeKeys!="undefined"&&query.removeLikeKeys.length>0){var removeLikeKeys=query.removeLikeKeys;for(var i=0,ilen=query.data.length;i0){query.columns=query.columns.filter(function(column){var found=false;removeLikeKeys.forEach(function(key){if(column.columnid.match(key))found=true});return!found})}}if(query.intoallfn){var res=query.intoallfn(query.columns,query.cb,query.params,query.alasql);return res}else if(query.intofn){for(var i=0,ilen=query.data.length;i0&&source.optimization=="ix"&&source.onleftfn&&source.onrightfn){if(source.databaseid&&alasql.databases[source.databaseid].tables[source.tableid]){if(!alasql.databases[source.databaseid].tables[source.tableid].indices)query.database.tables[source.tableid].indices={};var ixx=alasql.databases[source.databaseid].tables[source.tableid].indices[hash(source.onrightfns+"`"+source.srcwherefns)];if(!alasql.databases[source.databaseid].tables[source.tableid].dirty&&ixx){source.ix=ixx}}if(!source.ix){source.ix={};var scope={};var i=0;var ilen=source.data.length;var dataw;while((dataw=source.data[i])||source.getfn&&(dataw=source.getfn(i))||i=query.sources.length){if(query.wherefn(scope,query.params,alasql)){if(query.groupfn){query.groupfn(scope,query.params,alasql)}else{query.data.push(query.selectfn(scope,query.params,alasql))}}}else if(query.sources[h].applyselect){var source=query.sources[h];source.applyselect(query.params,function(data){if(data.length>0){for(var i=0;i0){s+=NL()+ID()+K("GROUP BY")+" "+this.group.map(function(grp){return grp.toString()}).join(", ")}if(this.having)s+=NL()+ID()+K("HAVING")+" "+this.having.toString();if(this.order&&this.order.length>0){s+=NL()+ID()+K("ORDER BY")+" "+this.order.map(function(ord){return ord.toString()}).join(", ")}if(this.limit)s+=NL()+ID()+K("LIMIT")+" "+this.limit.value;if(this.offset)s+=NL()+ID()+K("OFFSET")+" "+this.offset.value;if(this.union)s+=NL()+K("UNION")+(this.corresponding?" "+K("CORRESPONDING"):"")+NL()+this.union.toString();if(this.unionall)s+=NL()+K("UNION ALL")+(this.corresponding?" "+K("CORRESPONDING"):"")+NL()+this.unionall.toString();if(this.except)s+=NL()+K("EXCEPT")+(this.corresponding?" "+K("CORRESPONDING"):"")+NL()+this.except.toString();if(this.intersect)s+=NL()+K("INTERSECT")+(this.corresponding?" "+K("CORRESPONDING"):"")+NL()+this.intersect.toString();return s};yy.Select.prototype.toJavaScript=function(context,tableid,defcols){var s="alasql.utils.flatArray(this.queriesfn["+(this.queriesidx-1)+"](this.params,null,"+context+"))[0]";return s};yy.Select.prototype.compile=function(databaseid){var db=alasql.databases[databaseid];var query=new Query;query.removeKeys=[];query.explain=this.explain;query.explaination=[];query.explid=1;query.modifier=this.modifier;query.database=db;this.compileWhereExists(query);this.compileQueries(query);query.defcols=this.compileDefCols(query,databaseid);query.fromfn=this.compileFrom(query);if(this.joins)this.compileJoins(query);query.rownums=[];this.compileSelectGroup0(query);if(this.group||query.selectGroup.length>0){query.selectgfns=this.compileSelectGroup1(query)}else{query.selectfns=this.compileSelect1(query)}this.compileRemoveColumns(query);if(this.where)this.compileWhereJoins(query);query.wherefn=this.compileWhere(query);if(this.group||query.selectGroup.length>0)query.groupfn=this.compileGroup(query);if(this.having)query.havingfn=this.compileHaving(query);if(this.group||query.selectGroup.length>0){query.selectgfn=this.compileSelectGroup2(query)}else{query.selectfn=this.compileSelect2(query)}query.distinct=this.distinct;if(this.order)query.orderfn=this.compileOrder(query);if(this.top){query.limit=this.top.value}else if(this.limit){query.limit=this.limit.value;if(this.offset){query.offset=this.offset.value}}query.percent=this.percent;query.corresponding=this.corresponding;if(this.union){query.unionfn=this.union.compile(databaseid);if(this.union.order){query.orderfn=this.union.compileOrder(query)}else{query.orderfn=null}}else if(this.unionall){query.unionallfn=this.unionall.compile(databaseid);if(this.unionall.order){query.orderfn=this.unionall.compileOrder(query)}else{query.orderfn=null}}else if(this.except){query.exceptfn=this.except.compile(databaseid);if(this.except.order){query.orderfn=this.except.compileOrder(query)}else{query.orderfn=null}}else if(this.intersect){query.intersectfn=this.intersect.compile(databaseid);if(this.intersect.order){query.intersectfn=this.intersect.compileOrder(query)}else{query.orderfn=null}}if(this.into){if(this.into instanceof yy.Table){if(alasql.options.autocommit&&alasql.databases[this.into.databaseid||databaseid].engineid){query.intoallfns='return alasql.engines["'+alasql.databases[this.into.databaseid||databaseid].engineid+'"]'+'.intoTable("'+(this.into.databaseid||databaseid)+'","'+this.into.tableid+'",this.data, columns, cb);'}else{query.intofns="alasql.databases['"+(this.into.databaseid||databaseid)+"'].tables"+"['"+this.into.tableid+"'].data.push(r);"}}else if(this.into instanceof yy.VarValue){query.intoallfns='alasql.vars["'+this.into.variable+'"]=this.data;res=this.data.length;if(cb)res=cb(res);return res;'}else if(this.into instanceof yy.FuncValue){var qs="return alasql.into['"+this.into.funcid.toUpperCase()+"'](";if(this.into.args&&this.into.args.length>0){qs+=this.into.args[0].toJavaScript()+",";if(this.into.args.length>1){qs+=this.into.args[1].toJavaScript()+","}else{qs+="undefined,"}}else{qs+="undefined, undefined,"}query.intoallfns=qs+"this.data,columns,cb)"}else if(this.into instanceof yy.ParamValue){query.intofns="params['"+this.into.param+"'].push(r)"}if(query.intofns){query.intofn=new Function("r,i,params,alasql","var y;"+query.intofns)}else if(query.intoallfns){query.intoallfn=new Function("columns,cb,params,alasql","var y;"+query.intoallfns)}}var statement=function(params,cb,oldscope){query.params=params;var res1=queryfn(query,oldscope,function(res){if(query.rownums.length>0){for(var i=0,ilen=res.length;i0){var allcol={};for(var i=0;i0){var key;if(columns&&columns.length>0)key=columns[0].columnid;else key=Object.keys(res[0])[0];res=res[0][key]}else{res=undefined}}if(modifier=="ROW"){if(res.length>0){var key;var a=[];for(var key in res[0]){a.push(res[0][key])}res=a}else{res=undefined}}if(modifier=="COLUMN"){var ar=[];if(res.length>0){var key;if(columns&&columns.length>0)key=columns[0].columnid;else key=Object.keys(res[0])[0];for(var i=0,ilen=res.length;i0){key=columns[0].columnid;val=columns[1].columnid}else{var okeys=Object.keys(res[0]);key=okeys[0];val=okeys[1]}for(var i=0,ilen=res.length;i0)key=columns[0].columnid;else key=Object.keys(res[0])[0];var s="";for(var i=0,ilen=res.length;i0){if(tq.args[0]){s+=tq.args[0].toJavaScript("query.oldscope")+","}else{s+="null,"}if(tq.args[1]){s+=tq.args[1].toJavaScript("query.oldscope")+","}else{s+="null,"}}else{s+="null,null,"}s+="cb,idx,query";s+=");/*if(cb)res=cb(res,idx,query);*/return res";source.datafn=new Function("query, params, cb, idx, alasql",s)}else if(tq instanceof yy.FromData){source.datafn=function(query,params,cb,idx,alasql){var res=tq.data;if(cb)res=cb(res,idx,query);return res}}else{throw new Error("Wrong table at FROM")}query.sources.push(source)});query.defaultTableid=query.sources[0].alias};alasql.prepareFromData=function(data,array){var res=data;if(typeof data=="string"){res=data.split(/\r?\n/);if(array){for(var i=0,ilen=res.length;i0){if(jn.args[0]){s+=jn.args[0].toJavaScript("query.oldscope")+","}else{s+="null,"}if(jn.args[1]){s+=jn.args[1].toJavaScript("query.oldscope")+","}else{s+="null,"}}else{s+="null,null,"}s+="cb,idx,query";s+=");/*if(cb)res=cb(res,idx,query);*/return res";source.datafn=new Function("query, params, cb, idx, alasql",s);query.aliases[source.alias]={type:"funcvalue"}}var alias=source.alias;if(jn.natural){if(jn.using||jn.on){throw new Error("NATURAL JOIN cannot have USING or ON clauses")}else{if(query.sources.length>0){var prevSource=query.sources[query.sources.length-1];var prevTable=alasql.databases[prevSource.databaseid].tables[prevSource.tableid];var table=alasql.databases[source.databaseid].tables[source.tableid];if(prevTable&&table){var c1=prevTable.columns.map(function(col){return col.columnid});var c2=table.columns.map(function(col){return col.columnid});jn.using=arrayIntersect(c1,c2).map(function(colid){return{columnid:colid}})}else{throw new Error("In this version of Alasql NATURAL JOIN "+"works for tables with predefined columns only")}}}}if(jn.using){var prevSource=query.sources[query.sources.length-1];source.onleftfns=jn.using.map(function(col){return"p['"+(prevSource.alias||prevSource.tableid)+"']['"+col.columnid+"']"}).join('+"`"+');source.onleftfn=new Function("p,params,alasql","var y;return "+source.onleftfns);source.onrightfns=jn.using.map(function(col){return"p['"+(source.alias||source.tableid)+"']['"+col.columnid+"']"}).join('+"`"+');source.onrightfn=new Function("p,params,alasql","var y;return "+source.onrightfns);source.optimization="ix"}else if(jn.on){if(jn.on instanceof yy.Op&&jn.on.op=="="&&!jn.on.allsome){source.optimization="ix";var lefts="";var rights="";var middles="";var middlef=false;var ls=jn.on.left.toJavaScript("p",query.defaultTableid,query.defcols);var rs=jn.on.right.toJavaScript("p",query.defaultTableid,query.defcols);if(ls.indexOf("p['"+alias+"']")>-1&&!(rs.indexOf("p['"+alias+"']")>-1)){if((ls.match(/p\[\'.*?\'\]/g)||[]).every(function(s){return s=="p['"+alias+"']"})){rights=ls}else{middlef=true}}else if(!(ls.indexOf("p['"+alias+"']")>-1)&&rs.indexOf("p['"+alias+"']")>-1){if((rs.match(/p\[\'.*?\'\]/g)||[]).every(function(s){return s=="p['"+alias+"']"})){lefts=ls}else{middlef=true}}else{middlef=true}if(rs.indexOf("p['"+alias+"']")>-1&&!(ls.indexOf("p['"+alias+"']")>-1)){if((rs.match(/p\[\'.*?\'\]/g)||[]).every(function(s){return s=="p['"+alias+"']"})){rights=rs}else{middlef=true}}else if(!(rs.indexOf("p['"+alias+"']")>-1)&&ls.indexOf("p['"+alias+"']")>-1){if((ls.match(/p\[\'.*?\'\]/g)||[]).every(function(s){return s=="p['"+alias+"']"})){lefts=rs}else{middlef=true}}else{middlef=true}if(middlef){rights="";lefts="";middles=jn.on.toJavaScript("p",query.defaultTableid,query.defcols);source.optimization="no"}source.onleftfns=lefts;source.onrightfns=rights;source.onmiddlefns=middles||"true";source.onleftfn=new Function("p,params,alasql","var y;return "+source.onleftfns);source.onrightfn=new Function("p,params,alasql","var y;return "+source.onrightfns);source.onmiddlefn=new Function("p,params,alasql","var y;return "+source.onmiddlefns)}else{source.optimization="no";source.onmiddlefns=jn.on.toJavaScript("p",query.defaultTableid,query.defcols);source.onmiddlefn=new Function("p,params,alasql","var y;return "+jn.on.toJavaScript("p",query.defaultTableid,query.defcols))}}query.sources.push(source)}})};yy.Select.prototype.compileWhere=function(query){if(this.where){if(typeof this.where=="function"){return this.where}else{s=this.where.toJavaScript("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;optimizeWhereJoin(query,this.where.expression);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)}})};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.toJavaScript("p",query.defaultTableid,query.defcols);var fsrc=[];query.sources.forEach(function(source,idx){if(source.tableid){if(s.indexOf("p['"+source.alias+"']")>-1)fsrc.push(source)}});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}var src=fsrc[0];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.toJavaScript("p",query.defaultTableid,query.defcols);var rs=ast.right.toJavaScript("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.toJavaScript("p",query.defaultTableid,query.defcols);var rs=ast.right.toJavaScript("p",query.defaultTableid,query.defcols);if(ls.indexOf("p['"+fsrc[0].alias+"']")==-1){fsrc[0].wxleftfns=rs;fsrc[0].wxrightfns=ls}}}ast.reduced=true;return}else{if(ast.op="AND"){optimizeWhereJoin(query,ast.left);optimizeWhereJoin(query,ast.right)}}}yy.Select.prototype.compileGroup=function(query){var self=this;if(query.sources.length>0){var tableid=query.sources[0].alias}else{var tableid=""}var defcols=query.defcols;var allgroup=[[]];if(this.group){allgroup=decartes(this.group,query)}var allgroups=[];allgroup.forEach(function(a){allgroups=arrayUnion(allgroups,a)});query.allgroups=allgroups;if(false){allgroups.forEach(function(col2){if(query.selectColumns[colid]){}else{var tmpid="default";if(query.sources.length>0)tmpid=query.sources[0].alias;if(Object.keys(query.selectColumns).length!=0)query.removeKeys.push(colid);query.selectfns+="r['"+escapeq(colid)+"']="+new yy.Column({columnid:colid}).toJavaScript("p",tmpid)+";"}})}var s="";allgroup.forEach(function(agroup){s+="var acc,g=this.xgroups[";var rg=agroup.map(function(col2){var columnid=col2.split(" ")[0];var coljs=col2.split(" ")[1];if(columnid=="")return"1";else return coljs});if(rg.length==0)rg=["''"];s+=rg.join('+"`"+');s+="];if(!g) {this.groups.push((g=this.xgroups[";s+=rg.join('+"`"+');s+="] = {";s+=agroup.map(function(col2){var columnid=col2.split(" ")[0];var coljs=col2.split(" ")[1];if(columnid=="")return"";else return"'"+columnid+"':"+coljs+","}).join("");var neggroup=arrayDiff(allgroups,agroup);s+=neggroup.map(function(col2){var columnid=col2.split(" ")[0];var coljs=col2.split(" ")[1];return"'"+columnid+"':null,"}).join("");var aft="";s+=query.selectGroup.map(function(col,idx){var colexp=col.expression.toJavaScript("p",tableid,defcols);var colas=col.nick;if(col instanceof yy.AggrValue){if(col.distinct){aft+=",g['$$_VALUES_"+colas+"']={},g['$$_VALUES_"+colas+"']["+colexp+"]=true"}if(col.aggregatorid=="SUM"){return"'"+colas+"':("+colexp+")||0,"}else if(col.aggregatorid=="MIN"||col.aggregatorid=="MAX"||col.aggregatorid=="FIRST"||col.aggregatorid=="LAST"){return"'"+colas+"':"+colexp+","}else if(col.aggregatorid=="ARRAY"){return"'"+colas+"':["+colexp+"],"}else if(col.aggregatorid=="COUNT"){if(col.expression.columnid=="*"){return"'"+colas+"':1,"}else{return"'"+colas+"':(typeof "+colexp+' != "undefined")?1:0,'}}else if(col.aggregatorid=="AVG"){query.removeKeys.push("_SUM_"+colas);query.removeKeys.push("_COUNT_"+colas);return"'"+colas+"':"+colexp+",'_SUM_"+colas+"':("+colexp+")||0,'_COUNT_"+colas+"':(typeof "+colexp+' != "undefined")?1:0,'}else if(col.aggregatorid=="AGGR"){aft+=",g['"+colas+"']="+col.expression.toJavaScript("g",-1);return""}else if(col.aggregatorid=="REDUCE"){query.removeKeys.push("_REDUCE_"+colas);return"'"+colas+"':alasql.aggr['"+col.funcid+"']("+colexp+",undefined,(acc={})),"+"'__REDUCE__"+colas+"':acc,"}return""}else return""}).join("");s+="}"+aft+",g));} else {";s+=query.selectGroup.map(function(col,idx){var colas=col.nick;var colexp=col.expression.toJavaScript("p",tableid,defcols);if(col instanceof yy.AggrValue){if(col.distinct){var pre="if(typeof "+colexp+'!="undefined" && (!g[\'$$_VALUES_'+colas+"']["+colexp+"])) {";var post="g['$$_VALUES_"+colas+"']["+colexp+"]=true;}"}else{var pre="",post=""}if(col.aggregatorid=="SUM"){return pre+"g['"+colas+"']+=("+colexp+"||0);"+post}else if(col.aggregatorid=="COUNT"){if(col.expression.columnid=="*")return pre+"g['"+colas+"']++;"+post;else{return pre+"if(typeof "+colexp+'!="undefined") g[\''+colas+"']++;"+post}}else if(col.aggregatorid=="ARRAY"){return pre+"g['"+colas+"'].push("+colexp+");"+post}else if(col.aggregatorid=="MIN"){return pre+"g['"+colas+"']=Math.min(g['"+colas+"'],"+colexp+");"+post}else if(col.aggregatorid=="MAX"){return pre+"g['"+colas+"']=Math.max(g['"+colas+"'],"+colexp+");"+post}else if(col.aggregatorid=="FIRST"){return""}else if(col.aggregatorid=="LAST"){return pre+"g['"+colas+"']="+colexp+";"+post}else if(col.aggregatorid=="AVG"){return pre+"g['_SUM_"+colas+"']+=(y="+colexp+")||0;"+"g['_COUNT_"+colas+'\']+=(typeof y!="undefined")?1:0;'+"g['"+colas+"']=g['_SUM_"+colas+"']/g['_COUNT_"+colas+"'];"+post}else if(col.aggregatorid=="AGGR"){return pre+"g['"+colas+"']="+col.expression.toJavaScript("g",-1)+";"+post}else if(col.aggregatorid=="REDUCE"){return pre+"g['"+colas+"']=alasql.aggr."+col.funcid+"("+colexp+",g['"+colas+"'],g['__REDUCE__"+colas+"']);"+post}return""}else return""}).join("");s+="}"});return new Function("p,params,alasql",s)};function compileSelectStar(query,alias){var s="",sp="",ss=[];query.ixsources={};query.sources.forEach(function(source){query.ixsources[source.alias]=source});var columns;if(query.ixsources[alias]){var columns=query.ixsources[alias].columns}if(columns&&columns.length>0){columns.forEach(function(tcol){ss.push("'"+tcol.columnid+"':p['"+alias+"']['"+tcol.columnid+"']");query.selectColumns[escapeq(tcol.columnid)]=true;var coldef={columnid:tcol.columnid,dbtypeid:tcol.dbtypeid,dbsize:tcol.dbsize,dbprecision:tcol.dbprecision,dbenum:tcol.dbenum};query.columns.push(coldef);query.xcolumns[coldef.columnid]=coldef})}else{sp+='var w=p["'+alias+'"];for(var k in w){r[k]=w[k]};';query.dirtyColumns=true}return{s:ss.join(","),sp:sp}}yy.Select.prototype.compileSelect1=function(query){var self=this;query.columns=[];query.xcolumns={};query.selectColumns={};query.dirtyColumns=false;var s="var r={";var sp="";var ss=[];this.columns.forEach(function(col){if(col instanceof yy.Column){if(col.columnid=="*"){if(col.func){sp+="r=params['"+col.param+"'](p['"+query.sources[0].alias+"'],p,params,alasql);"}else if(col.tableid){var ret=compileSelectStar(query,col.tableid);if(ret.s)ss=ss.concat(ret.s);sp+=ret.sp}else{for(var alias in query.aliases){var ret=compileSelectStar(query,alias);if(ret.s)ss=ss.concat(ret.s);sp+=ret.sp}}}else{var tbid=col.tableid;var dbid=col.databaseid||query.sources[0].databaseid||query.database.databaseid;if(!tbid)tbid=query.defcols[col.columnid];if(!tbid)tbid=query.defaultTableid;if(col.columnid!="_"){ss.push("'"+escapeq(col.as||col.columnid)+"':p['"+tbid+"']['"+col.columnid+"']")
+}else{ss.push("'"+escapeq(col.as||col.columnid)+"':p['"+tbid+"']")}query.selectColumns[escapeq(col.as||col.columnid)]=true;if(query.aliases[tbid]&&query.aliases[tbid].type=="table"){if(!alasql.databases[dbid].tables[query.aliases[tbid].tableid]){throw new Error("Table '"+tbid+"' does not exists in database")}var columns=alasql.databases[dbid].tables[query.aliases[tbid].tableid].columns;var xcolumns=alasql.databases[dbid].tables[query.aliases[tbid].tableid].xcolumns;if(xcolumns&&columns.length>0){var tcol=xcolumns[col.columnid];var coldef={columnid:col.as||col.columnid,dbtypeid:tcol.dbtypeid,dbsize:tcol.dbsize,dbpecision:tcol.dbprecision,dbenum:tcol.dbenum};query.columns.push(coldef);query.xcolumns[coldef.columnid]=coldef}else{var coldef={columnid:col.as||col.columnid};query.columns.push(coldef);query.xcolumns[coldef.columnid]=coldef;query.dirtyColumns=true}}else{var coldef={columnid:col.as||col.columnid};query.columns.push(coldef);query.xcolumns[coldef.columnid]=coldef}}}else if(col instanceof yy.AggrValue){if(!self.group){self.group=[""]}if(!col.as)col.as=escapeq(col.toString());if(col.aggregatorid=="SUM"||col.aggregatorid=="MAX"||col.aggregatorid=="MIN"||col.aggregatorid=="FIRST"||col.aggregatorid=="LAST"||col.aggregatorid=="AVG"||col.aggregatorid=="ARRAY"||col.aggregatorid=="REDUCE"){ss.push("'"+escapeq(col.as)+"':"+n2u(col.expression.toJavaScript("p",query.defaultTableid,query.defcols)))}else if(col.aggregatorid=="COUNT"){ss.push("'"+escapeq(col.as)+"':1")}query.selectColumns[col.aggregatorid+"("+escapeq(col.expression.toString())+")"]=thtd;var coldef={columnid:col.as||col.columnid||col.toString()};query.columns.push(coldef);query.xcolumns[coldef.columnid]=coldef}else{ss.push("'"+escapeq(col.as||col.columnid||col.toString())+"':"+n2u(col.toJavaScript("p",query.defaultTableid,query.defcols)));query.selectColumns[escapeq(col.as||col.columnid||col.toString())]=true;var coldef={columnid:col.as||col.columnid||col.toString()};query.columns.push(coldef);query.xcolumns[coldef.columnid]=coldef}});s+=ss.join(",")+"};"+sp;return s};yy.Select.prototype.compileSelect2=function(query){var s=query.selectfns;return new Function("p,params,alasql","var y;"+s+"return r")};yy.Select.prototype.compileSelectGroup0=function(query){var self=this;self.columns.forEach(function(col,idx){if(col instanceof yy.Column&&col.columnid=="*"){}else{var colas;if(col instanceof yy.Column){colas=escapeq(col.columnid)}else{colas=escapeq(col.toString())}for(var i=0;irb)return 1;if(ra==rb)return 0;return-1}}var s="";var sk="";this.order.forEach(function(ord,idx){var dg="";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")dg=".valueOf()"}else{if(alasql.options.valueof)dg=".valueOf()"}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()";if(ord.nocase)dg+=".toUpperCase()";s+="if(("+ord.toJavaScript("a","")+"||'')"+dg+(ord.direction=="ASC"?">(":"<(")+ord.toJavaScript("b","")+"||'')"+dg+")return 1;";s+="if(("+ord.toJavaScript("a","")+"||'')"+dg+"==("+ord.toJavaScript("b","")+"||'')"+dg+"){"}sk+="}"});s+="return 0;";s+=sk+"return -1";query.orderfns=s;return new Function("a,b","var y;"+s)}};var rollup=function(a,query){var rr=[];var mask=0;var glen=a.length;for(var g=0;g"||this.op=="!"){var s=this.left.toString()+this.op;if(typeof this.right!="string"&&typeof this.right!="number")s+="(";s+=this.right.toString();if(typeof this.right!="string"&&typeof this.right!="number")s+=")";return s}return this.left.toString()+" "+P(this.op)+" "+(this.allsome?this.allsome+" ":"")+this.right.toString()};yy.Op.prototype.findAggregator=function(query){if(this.left&&this.left.findAggregator)this.left.findAggregator(query);if(this.right&&this.right.findAggregator&&!this.allsome){this.right.findAggregator(query)}};yy.Op.prototype.toType=function(tableid){if(["-","*","/","%","^"].indexOf(this.op)>-1)return"number";if(this.op=="+"){if(this.left.toType(tableid)=="string"||this.right.toType(tableid)=="string")return"string";if(this.left.toType(tableid)=="number"||this.right.toType(tableid)=="number")return"number"}if(["AND","OR","NOT","=","==","===","!=","!==","!===",">",">=","<","<=","IN","NOT IN","LIKE","NOT LIKE"].indexOf(this.op)>-1)return"boolean";if(this.op=="BETWEEN"||this.op=="NOT BETWEEN"||this.op=="IS NULL"||this.op=="IS NOT NULL")return"boolean";if(this.allsome)return"boolean";if(!this.op)return this.left.toType();return"unknown"};yy.Op.prototype.toJavaScript=function(context,tableid,defcols){var op=this.op;if(this.op=="=")op="===";else if(this.op=="<>")op="!=";else if(this.op=="OR")op="||";if(this.op=="->"){if(typeof this.right=="string"){return this.left.toJavaScript(context,tableid,defcols)+'["'+this.right+'"]'}else if(typeof this.right=="number"){return this.left.toJavaScript(context,tableid,defcols)+"["+this.right+"]"}else if(this.right instanceof yy.FuncValue){ss=[];if(!this.right.args||this.right.args.length==0){}else{var ss=this.right.args.map(function(arg){return arg.toJavaScript(context,tableid,defcols)})}return this.left.toJavaScript(context,tableid,defcols)+"['"+this.right.funcid+"']("+ss.join(",")+")"}else{return this.left.toJavaScript(context,tableid,defcols)+"["+this.right.toJavaScript(context,tableid,defcols)+"]"}}if(this.op=="!"){if(typeof this.right=="string"){return"alasql.databases[alasql.useid].objects["+this.left.toJavaScript(context,tableid,defcols)+']["'+this.right+'"]'}}if(this.op=="IS"){return"((typeof "+this.left.toJavaScript(context,tableid,defcols)+"=='undefined') == "+"(typeof "+this.right.toJavaScript(context,tableid,defcols)+"=='undefined'))"}if(this.op=="=="){return"alasql.utils.deepEqual("+this.left.toJavaScript(context,tableid,defcols)+","+this.right.toJavaScript(context,tableid,defcols)+")"}if(this.op=="==="){return"(("+this.left.toJavaScript(context,tableid,defcols)+").valueOf()===("+this.right.toJavaScript(context,tableid,defcols)+".valueOf()))"}if(this.op=="!==="){return"!(("+this.left.toJavaScript(context,tableid,defcols)+").valueOf()===("+this.right.toJavaScript(context,tableid,defcols)+".valueOf()))"}if(this.op=="!=="){return"(!alasql.utils.deepEqual("+this.left.toJavaScript(context,tableid,defcols)+","+this.right.toJavaScript(context,tableid,defcols)+"))"}if(this.op=="LIKE"){var s="("+this.left.toJavaScript(context,tableid,defcols)+"+'')"+".toUpperCase().match(new RegExp('^'+("+this.right.toJavaScript(context,tableid,defcols)+").replace(/\\%/g,'.*').toUpperCase()+'$','g'))";return s}if(this.op=="NOT LIKE"){var s="!(("+this.left.toJavaScript(context,tableid,defcols)+"+'')"+".toUpperCase().match(new RegExp('^'+("+this.right.toJavaScript(context,tableid,defcols)+").replace(/\\%/g,'.*').toUpperCase()+'$','g')))";return s}if(this.op=="BETWEEN"){return"(("+this.right1.toJavaScript(context,tableid,defcols)+"<="+this.left.toJavaScript(context,tableid,defcols)+")&&"+"("+this.left.toJavaScript(context,tableid,defcols)+"<="+this.right2.toJavaScript(context,tableid,defcols)+"))"}if(this.op=="NOT BETWEEN"){return"!(("+this.right1.toJavaScript(context,tableid,defcols)+"<="+this.left.toJavaScript(context,tableid,defcols)+")&&"+"("+this.left.toJavaScript(context,tableid,defcols)+"<="+this.right2.toJavaScript(context,tableid,defcols)+"))"}if(this.op=="IN"){if(this.right instanceof yy.Select){var s="(";s+="alasql.utils.flatArray(this.queriesfn["+this.queriesidx+"](params,null,context))";s+=".indexOf(";s+=this.left.toJavaScript(context,tableid,defcols)+")>-1)";return s}else if(this.right instanceof Array){var s="(["+this.right.map(function(a){return a.toJavaScript(context,tableid,defcols)}).join(",")+"].indexOf(";s+=this.left.toJavaScript(context,tableid,defcols)+")>-1)";return s}else{var s="("+this.right.toJavaScript(context,tableid,defcols)+".indexOf(";s+=this.left.toJavaScript(context,tableid,defcols)+")>-1)";return s}}if(this.op=="NOT IN"){if(this.right instanceof yy.Select){var s="(";s+="alasql.utils.flatArray(this.queriesfn["+this.queriesidx+"](params,null,p))";s+=".indexOf(";s+=this.left.toJavaScript(context,tableid,defcols)+")<0)";return s}else if(this.right instanceof Array){var s="(["+this.right.map(function(a){return a.toJavaScript(context,tableid,defcols)}).join(",")+"].indexOf(";s+=this.left.toJavaScript(context,tableid,defcols)+")<0)";return s}else{var s="("+this.right.toJavaScript(context,tableid,defcols)+".indexOf(";s+=this.left.toJavaScript(context,tableid,defcols)+")==-1)";return s}}if(this.allsome=="ALL"){if(this.right instanceof yy.Select){var s="alasql.utils.flatArray(this.query.queriesfn["+this.queriesidx+"](params,null,p))";s+=".every(function(b){return (";s+=this.left.toJavaScript(context,tableid,defcols)+")"+op+"b})";return s}else if(this.right instanceof Array){var s="["+this.right.map(function(a){return a.toJavaScript(context,tableid,defcols)}).join(",")+"].every(function(b){return (";s+=this.left.toJavaScript(context,tableid,defcols)+")"+op+"b})";return s}else{throw new Error("Wrong NOT IN operator without SELECT part")}}if(this.allsome=="SOME"||this.allsome=="ANY"){if(this.right instanceof yy.Select){var s="alasql.utils.flatArray(this.query.queriesfn["+this.queriesidx+"](params,null,p))";s+=".some(function(b){return (";s+=this.left.toJavaScript(context,tableid,defcols)+")"+op+"b})";return s}else if(this.right instanceof Array){var s="["+this.right.map(function(a){return a.toJavaScript(context,tableid,defcols)}).join(",")+"].some(function(b){return (";s+=this.left.toJavaScript(context,tableid,defcols)+")"+op+"b})";return s}else{throw new Error("Wrong NOT IN operator without SELECT part")}}if(this.op=="AND"){if(this.left.reduced){if(this.right.reduced){return"true"}else{return this.right.toJavaScript(context,tableid,defcols)}}else if(this.right.reduced){return this.left.toJavaScript(context,tableid,defcols)}op="&&"}if(this.op=="^"){return"Math.pow("+this.left.toJavaScript(context,tableid,defcols)+","+this.right.toJavaScript(context,tableid,defcols)+")"}return"("+this.left.toJavaScript(context,tableid,defcols)+op+this.right.toJavaScript(context,tableid,defcols)+")"};yy.VarValue=function(params){return yy.extend(this,params)};yy.VarValue.prototype.toString=function(){return"@"+L(this.variable)};yy.VarValue.prototype.toType=function(){return"unknown"};yy.VarValue.prototype.toJavaScript=function(){return"alasql.vars['"+this.variable+"']"};yy.NumValue=function(params){return yy.extend(this,params)};yy.NumValue.prototype.toString=function(){return N(this.value.toString())};yy.NumValue.prototype.toType=function(){return"number"};yy.NumValue.prototype.toJavaScript=function(){return""+this.value};yy.StringValue=function(params){return yy.extend(this,params)};yy.StringValue.prototype.toString=function(){return"'"+S(this.value.toString())+"'"};yy.StringValue.prototype.toType=function(){return"string"};yy.StringValue.prototype.toJavaScript=function(){return"'"+escapeq(this.value)+"'"};yy.LogicValue=function(params){return yy.extend(this,params)};yy.LogicValue.prototype.toString=function(){return this.value?"TRUE":"FALSE"};yy.LogicValue.prototype.toType=function(){return"boolean"};yy.LogicValue.prototype.toJavaScript=function(){return this.value?"true":"false"};yy.NullValue=function(params){return yy.extend(this,params)};yy.NullValue.prototype.toString=function(){return"NULL"};yy.NullValue.prototype.toJavaScript=function(){return"undefined"};yy.ParamValue=function(params){return yy.extend(this,params)};yy.ParamValue.prototype.toString=function(){return"$"+this.param};yy.ParamValue.prototype.toJavaScript=function(){if(typeof this.param=="string")return"params['"+this.param+"']";else return"params["+this.param+"]"};yy.UniOp=function(params){return yy.extend(this,params)};yy.UniOp.prototype.toString=function(){if(this.op=="-")return this.op+this.right.toString();if(this.op=="+")return this.op+this.right.toString();if(this.op=="#")return this.op+this.right.toString();if(this.op=="NOT")return this.op+"("+this.right.toString()+")";else if(this.op==null)return"("+this.right.toString()+")"};yy.UniOp.prototype.findAggregator=function(query){if(this.right.findAggregator)this.right.findAggregator(query)};yy.UniOp.prototype.toType=function(tableid){if(this.op=="-")return"number";if(this.op=="+")return"number";if(this.op=="NOT")return"boolean"};yy.UniOp.prototype.toJavaScript=function(context,tableid,defcols){if(this.op=="-")return"(-("+this.right.toJavaScript(context,tableid,defcols)+"))";if(this.op=="+")return"("+this.right.toJavaScript(context,tableid,defcols)+")";if(this.op=="NOT")return"!("+this.right.toJavaScript(context,tableid,defcols)+")";if(this.op=="#"){if(this.right instanceof yy.Column){return"(alasql.databases[alasql.useid].objects['"+this.right.columnid+"'])"}else{return"(alasql.databases[alasql.useid].objects["+this.right.toJavaScript(context,tableid,defcols)+"])"}}else if(this.op==null)return"("+this.right.toJavaScript(context,tableid,defcols)+")"};yy.Column=function(params){return yy.extend(this,params)};yy.Column.prototype.toString=function(){var s;if(this.columnid==+this.columnid){s="["+this.columnid+"]"}else{s=this.columnid}if(this.tableid){if(+this.columnid==this.columnid){s=this.tableid+s}else{s=this.tableid+"."+s}if(this.databaseid){s=this.databaseid+"."+s}}return s};yy.Column.prototype.toJavaScript=function(context,tableid,defcols){var s="";if(!this.tableid&&tableid==""&&!defcols){if(this.columnid!="_"){s=context+"['"+this.columnid+"']"}else{if(context=="g"){s="g['_']"}else{s=context}}}else{if(context=="g"){s="g['"+this.nick+"']"}else if(this.tableid){if(this.columnid!="_"){s=context+"['"+this.tableid+"']['"+this.columnid+"']"}else{if(context=="g"){s="g['_']"}else{s=context+"['"+this.tableid+"']"}}}else if(defcols){var tbid=defcols[this.columnid];if(tbid=="-"){throw new Error('Cannot resolve column "'+this.columnid+'" because it exists in two source tables')}else if(tbid){if(this.columnid!="_"){s=context+"['"+tbid+"']['"+this.columnid+"']"}else{s=context+"['"+tbid+"']"}}else{if(this.columnid!="_"){s=context+"['"+(this.tableid||tableid)+"']['"+this.columnid+"']"}else{s=context+"['"+(this.tableid||tableid)+"']"}}}else if(tableid==-1){s=context+"['"+this.columnid+"']"}else{if(this.columnid!="_"){s=context+"['"+(this.tableid||tableid)+"']['"+this.columnid+"']"}else{s=context+"['"+(this.tableid||tableid)+"']"}}}return s};yy.AggrValue=function(params){return yy.extend(this,params)};yy.AggrValue.prototype.toString=function(){var s="";if(this.aggregatorid=="REDUCE")s+=L(this.funcid)+"(";else s+=this.aggregatorid+"(";if(this.distinct)s+=K("DISTINCT")+" ";if(this.expression)s+=this.expression.toString();s+=")";if(this.over)s+=" "+this.over.toString();return s};yy.AggrValue.prototype.findAggregator=function(query){var colas=escapeq(this.toString())+":"+query.selectGroup.length;var found=false;if(!found){if(!this.nick){this.nick=colas;var found=false;for(var i=0;i-1)return"number";if(["ARRAY"].indexOf(this.aggregatorid)>-1)return"array";if(["FIRST","LAST"].indexOf(this.aggregatorid)>-1)return this.expression.toType()};yy.AggrValue.prototype.toJavaScript=function(context,tableid,defcols){var colas=this.nick;if(typeof colas=="undefined")colas=this.toString();return"g['"+colas+"']"};yy.OrderExpression=function(params){return yy.extend(this,params)};yy.OrderExpression.prototype.toString=function(){var s=this.expression.toString();if(this.order)s+=" "+this.order.toString();if(this.nocase)s+=" "+K("COLLATE")+" "+K("NOCASE");return s};yy.GroupExpression=function(params){return yy.extend(this,params)};yy.GroupExpression.prototype.toString=function(){return this.type+"("+this.group.toString()+")"};yy.ColumnDef=function(params){return yy.extend(this,params)};yy.ColumnDef.prototype.toString=function(){var s=this.columnid;if(this.dbtypeid)s+=" "+this.dbtypeid;if(this.dbsize){s+="("+this.dbsize;if(this.dbprecision)s+=","+this.dbprecision;s+=")"}if(this.primarykey)s+=" PRIMARY KEY";if(this.notnull)s+=" NOT NULL";return s};yy.FromData=function(params){return yy.extend(this,params)};yy.FromData.prototype.toString=function(){if(this.data)return K("DATA")+"("+(Math.random()*1e16|0)+")";else return"?"};yy.FromData.prototype.toJavaScript=function(){};yy.Select.prototype.exec=function(params,cb){if(this.preparams)params=this.preparams.concat(params);var databaseid=alasql.useid;db=alasql.databases[databaseid];var sql=this.toString();var hh=hash(sql);var statement=this.compile(databaseid);if(!statement)return;statement.sql=sql;statement.dbversion=db.dbversion;if(db.sqlCacheSize>alasql.MAXSQLCACHESIZE){db.resetSqlCache()}db.sqlCacheSize++;db.sqlCache[hh]=statement;var res=alasql.res=statement(params,cb);return res};yy.Select.prototype.Select=function(){var self=this;var agrs=[];if(arguments.length>1){args=Array.prototype.slice.call(arguments)}else if(arguments.length==1){if(arguments[0]instanceof Array){args=arguments[0]}else{args=[arguments[0]]}}else{throw new Error("Wrong number of arguments of Select() function")}self.columns=[];args.forEach(function(arg){if(typeof arg=="string"){self.columns.push(new yy.Column({columnid:arg}))}else if(typeof arg=="function"){var pari=0;if(self.preparams){pari=self.preparams.length}else{self.preparams=[]}self.preparams.push(arg);self.columns.push(new yy.Column({columnid:"*",func:arg,param:pari}))}else{}});return self};yy.Select.prototype.From=function(tableid){var self=this;if(!self.from)self.from=[];if(tableid instanceof Array){var pari=0;if(self.preparams){pari=self.preparams.length}else{self.preparams=[]}self.preparams.push(tableid);self.from.push(new yy.ParamValue({param:pari}))}else if(typeof tableid=="string"){self.from.push(new yy.Table({tableid:tableid}))}else{throw new Error("Unknown arguments in From() function")}return self};yy.Select.prototype.OrderBy=function(){var self=this;var agrs=[];self.order=[];if(arguments.length==0){args=["_"]}else if(arguments.length>1){args=Array.prototype.slice.call(arguments)}else if(arguments.length==1){if(arguments[0]instanceof Array){args=arguments[0]}else{args=[arguments[0]]}}else{throw new Error("Wrong number of arguments of Select() function")}if(args.length>0){args.forEach(function(arg){var expr=new yy.Column({columnid:arg});if(typeof arg=="function"){expr=arg}self.order.push(new yy.OrderExpression({expression:expr,direction:"ASC"}))})}return self};yy.Select.prototype.Top=function(topnum){var self=this;self.top=new yy.NumValue({value:topnum});return self};yy.Select.prototype.GroupBy=function(){var self=this;var agrs=[];if(arguments.length>1){args=Array.prototype.slice.call(arguments)}else if(arguments.length==1){if(arguments[0]instanceof Array){args=arguments[0]}else{args=[arguments[0]]}}else{throw new Error("Wrong number of arguments of Select() function")}self.group=[];args.forEach(function(arg){var expr=new yy.Column({columnid:arg});self.group.push(expr)});return self};yy.Select.prototype.Where=function(expr){var self=this;if(typeof expr=="function"){self.where=expr}return self};yy.FuncValue=function(params){return yy.extend(this,params)};yy.FuncValue.prototype.toString=function(){var s="";if(alasql.fn[this.funcid])s+=this.funcid;else if(alasql.aggr[this.funcid])s+=this.funcid;else if(alasql.stdlib[this.funcid.toUpperCase()]||alasql.stdfn[this.funcid.toUpperCase()])s+=this.funcid.toUpperCase();s+="(";if(this.args&&this.args.length>0){s+=this.args.map(function(arg){return arg.toString()}).join(",")}s+=")";if(this.as)s+=" AS "+this.as.toString();return s};yy.FuncValue.prototype.findAggregator=function(query){if(this.args&&this.args.length>0){this.args.forEach(function(arg){if(arg.findAggregator)arg.findAggregator(query)})}};yy.FuncValue.prototype.toJavaScript=function(context,tableid,defcols){var s="";var funcid=this.funcid;if(alasql.fn[funcid]){if(this.newid)s+="new ";s+="alasql.fn."+this.funcid+"(";if(this.args&&this.args.length>0){s+=this.args.map(function(arg){return arg.toJavaScript(context,tableid,defcols)}).join(",")}s+=")"}else if(alasql.stdlib[funcid.toUpperCase()]){if(this.args&&this.args.length>0){s+=alasql.stdlib[funcid.toUpperCase()].apply(this,this.args.map(function(arg){return arg.toJavaScript(context,tableid)}))}else{s+=alasql.stdlib[funcid.toUpperCase()]()}}else if(alasql.stdfn[funcid.toUpperCase()]){if(this.newid)s+="new ";s+="alasql.stdfn."+this.funcid.toUpperCase()+"(";if(this.args&&this.args.length>0){s+=this.args.map(function(arg){return arg.toJavaScript(context,tableid,defcols)}).join(",")}s+=")"}else{}return s};var stdlib=alasql.stdlib={};var stdfn=alasql.stdfn={};stdlib.ABS=function(a){return"Math.abs("+a+")"};stdlib.CLONEDEEP=function(a){return"alasql.utils.cloneDeep("+a+")"};stdlib.IIF=function(a,b,c){if(arguments.length==3){return"(("+a+")?("+b+"):("+c+"))"}else{throw new Error("Number of arguments of IFF is not equals to 3")}};stdlib.IFNULL=function(a,b){return"("+a+"||"+b+")"};stdlib.INSTR=function(s,p){return"(("+s+").indexOf("+p+")+1)"};stdlib.LEN=stdlib.LENGTH=function(s){return und(s,"y.length")};stdlib.LOWER=stdlib.LCASE=function(s){return und(s,"y.toLowerCase()")};stdlib.MAX=stdlib.GREATEST=function(){return"Math.max("+Array.prototype.join.call(arguments,",")+")"};stdlib.MIN=stdlib.LEAST=function(){return"Math.min("+Array.prototype.join.call(arguments,",")+")"};stdlib.SUBSTRING=stdlib.MID=function(a,b,c){if(arguments.length==2)return und(a,"y.substr("+b+"-1)");else if(arguments.length==3)return und(a,"y.substr("+b+"-1,"+c+")")};stdlib.ISNULL=stdlib.NULLIF=function(a,b){return"("+a+"=="+b+"?undefined:"+a+")"};stdlib.POWER=function(a,b){return"Math.pow("+a+","+b+")"};stdlib.RANDOM=function(r){if(arguments.length==0){return"Math.random()"}else{return"(Math.random()*("+r+")|0)"}};stdlib.ROUND=function(s,d){if(arguments.length==2){return"Math.round("+s+"*Math.pow(10,"+d+"))/Math.pow(10,"+d+")"}else{return"Math.round("+s+")"}};stdlib.ROWNUM=function(){return"1"};stdlib.ROW_NUMBER=function(){return"1"};stdlib.SQRT=function(s){return"Math.sqrt("+s+")"};stdlib.TRIM=function(s){return und(s,"y.trim()")};stdlib.UPPER=stdlib.UCASE=function(s){return und(s,"y.toUpperCase()")};alasql.aggr.GROUP_CONCAT=function(v,s){if(typeof s=="undefined")return v;else return s+","+v};alasql.aggr.MEDIAN=function(v,s,acc){if(typeof acc.arr=="undefined"){acc.arr=[v];
+return v}else{acc.arr.push(v);var p=acc.arr.sort();return p[p.length/2|0]}};alasql.aggr.VAR=function(v,s,acc){if(typeof acc.arr=="undefined"){acc.arr=[v];acc.sum=v}else{acc.arr.push(v);acc.sum+=v}var N=acc.arr.length;var avg=acc.sum/N;var std=0;for(var i=0;i0){this.whens.forEach(function(w){if(w.when.findAggregator)w.when.findAggregator(query);if(w.then.findAggregator)w.then.findAggregator(query)})}if(this.elses&&this.elses.findAggregator)this.elses.findAggregator(query)};yy.CaseValue.prototype.toJavaScript=function(context,tableid,defcols){var s="((function("+context+",params,alasql){var r;";if(this.expression){s+="v="+this.expression.toJavaScript(context,tableid,defcols)+";";s+=(this.whens||[]).map(function(w){return" if(v=="+w.when.toJavaScript(context,tableid,defcols)+") {r="+w.then.toJavaScript(context,tableid,defcols)+"}"}).join(" else ");if(this.elses)s+=" else {r="+this.elses.toJavaScript(context,tableid,defcols)+"}"}else{s+=(this.whens||[]).map(function(w){return" if("+w.when.toJavaScript(context,tableid,defcols)+") {r="+w.then.toJavaScript(context,tableid,defcols)+"}"}).join(" else ");if(this.elses)s+=" else {r="+this.elses.toJavaScript(context,tableid,defcols)+"}"}s+=";return r;}).bind(this))("+context+",params,alasql)";return s};yy.Json=function(params){return yy.extend(this,params)};yy.Json.prototype.toString=function(){var s="";s+=JSONtoString(this.value);s+="";return s};var JSONtoString=alasql.utils.JSONtoString=function(obj){var s="";if(typeof obj=="string")s='"'+obj+'"';else if(typeof obj=="number")s=obj;else if(typeof obj=="boolean")s=obj;else if(typeof obj=="object"){if(obj instanceof Array){s+="["+obj.map(function(b){return JSONtoString(b)}).join(",")+"]"}else if(!obj.toJavaScript||obj instanceof yy.Json){s="{";var ss=[];for(var k in obj){var s1="";if(typeof k=="string")s1+='"'+k+'"';else if(typeof k=="number")s1+=k;else if(typeof k=="boolean")s1+=k;else{throw new Error("THis is not ES6... no expressions on left side yet")}s1+=":"+JSONtoString(obj[k]);ss.push(s1)}s+=ss.join(",")+"}"}else if(obj.toString){s=obj.toString()}else{throw new Error("1Can not show JSON object "+JSON.stringify(obj))}}else{throw new Error("2Can not show JSON object "+JSON.stringify(obj))}return s};function JSONtoJavaScript(obj,context,tableid,defcols){var s="";if(typeof obj=="string")s='"'+obj+'"';else if(typeof obj=="number")s="("+obj+")";else if(typeof obj=="boolean")s=obj;else if(typeof obj=="object"){if(obj instanceof Array){s+="["+obj.map(function(b){return JSONtoJavaScript(b,context,tableid,defcols)}).join(",")+"]"}else if(!obj.toJavaScript||obj instanceof yy.Json){s="{";var ss=[];for(var k in obj){var s1="";if(typeof k=="string")s1+='"'+k+'"';else if(typeof k=="number")s1+=k;else if(typeof k=="boolean")s1+=k;else{throw new Error("THis is not ES6... no expressions on left side yet")}s1+=":"+JSONtoJavaScript(obj[k],context,tableid,defcols);ss.push(s1)}s+=ss.join(",")+"}"}else if(obj.toJavaScript){s=obj.toJavaScript(context,tableid,defcols)}else{throw new Error("1Can not parse JSON object "+JSON.stringify(obj))}}else{throw new Error("2Can not parse JSON object "+JSON.stringify(obj))}return s}yy.Json.prototype.toJavaScript=function(context,tableid,defcols){return JSONtoJavaScript(this.value,context,tableid,defcols)};yy.Convert=function(params){return yy.extend(this,params)};yy.Convert.prototype.toString=function(){var s="CONVERT(";s+=this.dbtypeid;if(typeof this.dbsize!="undefined"){s+="("+this.dbsize;if(this.dbprecision)s+=","+dbprecision;s+=")"}s+=","+this.expression.toString();if(this.style)s+=","+this.style;s+=")";return s};yy.Convert.prototype.toJavaScript=function(context,tableid,defcols){return"alasql.stdfn.CONVERT("+this.expression.toJavaScript(context,tableid,defcols)+',{dbtypeid:"'+this.dbtypeid+'",dbsize:'+this.dbsize+",style:"+this.style+"})";throw new Error("There is not such type conversion for "+this.toString())};alasql.stdfn.CONVERT=function(value,args){var val=value;if(args.style){var t;if(/\d{8}/.test(val))t=new Date(+val.substr(0,4),+val.substr(4,2)-1,+val.substr(6,2));else t=new Date(val);if(args.style==1){val=("0"+(t.getMonth()+1)).substr(-2)+"/"+("0"+t.getDate()).substr(-2)+"/"+("0"+t.getYear()).substr(-2)}else if(args.style==2){val=("0"+t.getYear()).substr(-2)+"."+("0"+(t.getMonth()+1)).substr(-2)+"."+("0"+t.getDate()).substr(-2)}else if(args.style==3){val=("0"+t.getDate()).substr(-2)+"/"+("0"+(t.getMonth()+1)).substr(-2)+"/"+("0"+t.getYear()).substr(-2)}else if(args.style==4){val=("0"+t.getDate()).substr(-2)+"."+("0"+(t.getMonth()+1)).substr(-2)+"."+("0"+t.getYear()).substr(-2)}else if(args.style==5){val=("0"+t.getDate()).substr(-2)+"-"+("0"+(t.getMonth()+1)).substr(-2)+"-"+("0"+t.getYear()).substr(-2)}else if(args.style==6){val=("0"+t.getDate()).substr(-2)+" "+t.toString().substr(4,3).toLowerCase()+" "+("0"+t.getYear()).substr(-2)}else if(args.style==7){val=t.toString().substr(4,3)+" "+("0"+t.getDate()).substr(-2)+","+("0"+t.getYear()).substr(-2)}else if(args.style==8){val=("0"+t.getHours()).substr(-2)+":"+("0"+(t.getMinutes()+1)).substr(-2)+":"+("0"+t.getSeconds()).substr(-2)}else if(args.style==10){val=("0"+(t.getMonth()+1)).substr(-2)+"-"+("0"+t.getDate()).substr(-2)+"-"+("0"+t.getYear()).substr(-2)}else if(args.style==11){val=("0"+t.getYear()).substr(-2)+"/"+("0"+(t.getMonth()+1)).substr(-2)+"/"+("0"+t.getDate()).substr(-2)}else if(args.style==12){val=("0"+t.getYear()).substr(-2)+("0"+(t.getMonth()+1)).substr(-2)+("0"+t.getDate()).substr(-2)}else if(args.style==101){val=("0"+(t.getMonth()+1)).substr(-2)+"/"+("0"+t.getDate()).substr(-2)+"/"+t.getFullYear()}else if(args.style==102){val=t.getFullYear()+"."+("0"+(t.getMonth()+1)).substr(-2)+"."+("0"+t.getDate()).substr(-2)}else if(args.style==103){val=("0"+t.getDate()).substr(-2)+"/"+("0"+(t.getMonth()+1)).substr(-2)+"/"+t.getFullYear()}else if(args.style==104){val=("0"+t.getDate()).substr(-2)+"."+("0"+(t.getMonth()+1)).substr(-2)+"."+t.getFullYear()}else if(args.style==105){val=("0"+t.getDate()).substr(-2)+"-"+("0"+(t.getMonth()+1)).substr(-2)+"-"+t.getFullYear()}else if(args.style==106){val=("0"+t.getDate()).substr(-2)+" "+t.toString().substr(4,3).toLowerCase()+" "+t.getFullYear()}else if(args.style==107){val=t.toString().substr(4,3)+" "+("0"+t.getDate()).substr(-2)+","+t.getFullYear()}else if(args.style==108){val=("0"+t.getHours()).substr(-2)+":"+("0"+(t.getMinutes()+1)).substr(-2)+":"+("0"+t.getSeconds()).substr(-2)}else if(args.style==110){val=("0"+(t.getMonth()+1)).substr(-2)+"-"+("0"+t.getDate()).substr(-2)+"-"+t.getFullYear()}else if(args.style==111){val=t.getFullYear()+"/"+("0"+(t.getMonth()+1)).substr(-2)+"/"+("0"+t.getDate()).substr(-2)}else if(args.style==112){val=t.getFullYear()+("0"+(t.getMonth()+1)).substr(-2)+("0"+t.getDate()).substr(-2)}else{throw new Error("The CONVERT style "+args.style+" is not realized yet.")}}var udbtypeid=args.dbtypeid.toUpperCase();if(args.dbtypeid=="Date"){return new Date(val)}else if(udbtypeid=="DATE"){var d=new Date(val);var s=d.getFullYear()+"."+("0"+(d.getMonth()+1)).substr(-2)+"."+("0"+d.getDate()).substr(-2);return s}else if(udbtypeid=="DATETIME"){var d=new Date(val);var s=d.getFullYear()+"."+("0"+(d.getMonth()+1)).substr(-2)+"."+("0"+d.getDate()).substr(-2);s+=" "+("0"+d.getHours()).substr(-2)+":"+("0"+d.getMinutes()).substr(-2)+":"+("0"+d.getSeconds()).substr(-2);s+="."+("00"+d.getMilliseconds()).substr(-3);return s}else if(["NUMBER","FLOAT"].indexOf(udbtypeid)>-1){return+val}else if(["MONEY"].indexOf(udbtypeid)>-1){var m=+val;return(m|0)+m*100%100/100}else if(["BOOLEAN"].indexOf(udbtypeid)>-1){return!!val}else if(["INT","INTEGER","SMALLINT","BIGINT","SERIAL","SMALLSERIAL","BIGSERIAL"].indexOf(args.dbtypeid.toUpperCase())>-1){return val|0}else if(["STRING","VARCHAR","NVARCHAR","CHARACTER VARIABLE"].indexOf(args.dbtypeid.toUpperCase())>-1){if(args.dbsize)return(""+val).substr(0,args.dbsize);else return""+val}else if(["CHAR","CHARACTER","NCHAR"].indexOf(udbtypeid)>-1){return(val+new Array(args.dbsize+1).join(" ")).substr(0,args.dbsize)}else if(["DECIMAL","NUMERIC"].indexOf(udbtypeid)>-1){var m=+val;var fxd=Math.pow(10,args.dbpecision);return(m|0)+m*fxd%fxd/fxd}else if(["JSON"].indexOf(udbtypeid)>-1){if(typeof val=="object")return val;try{return JSON.parse(val)}catch(err){throw new Error("Cannot convert string to JSON")}}return val};yy.ColumnDef=function(params){return yy.extend(this,params)};yy.ColumnDef.prototype.toString=function(){var s=this.columnid;if(this.dbtypeid)s+=" "+this.dbtypeid;if(this.dbsize){s+="("+this.dbsize;if(this.dbprecision)s+=","+this.dbprecision;s+=")"}if(this.primarykey)s+=" PRIMARY KEY";if(this.notnull)s+=" NOT NULL";return s};yy.CreateTable=function(params){return yy.extend(this,params)};yy.CreateTable.prototype.toString=function(){var s=K("CREATE");if(this.temporary)s+=" "+K("TEMPORARY");if(this.view)s+=" "+K("VIEW");else s+=" "+(this.class?K("CLASS"):K("TABLE"));if(this.ifnotexists)s+=" "+K("IF")+" "+K("NOT")+" "+K("EXISTS");s+=" "+this.table.toString();if(this.viewcolumns){s+="("+this.viewcolumns.map(function(vcol){return vcol.toString()}).join(",")+")"}if(this.as)s+=" "+K("AS")+" "+L(this.as);else{var ss=this.columns.map(function(col){return col.toString()});s+=" ("+NL()+ID()+ss.join(","+NL()+ID())+")"}if(this.view&&this.select){s+=" AS "+this.select.toString()}return s};yy.CreateTable.prototype.execute=function(databaseid,params,cb){var db=alasql.databases[this.table.databaseid||databaseid];var tableid=this.table.tableid;if(!tableid){throw new Error("Table name is not defined")}var columns=this.columns;var constraints=this.constraints||[];if(this.ifnotexists&&db.tables[tableid])return 0;if(db.tables[tableid]){throw new Error("Can not create table '"+tableid+"', because it already exists in the database '"+db.databaseid+"'")}var table=db.tables[tableid]=new alasql.Table;if(this.class){table.isclass=true}table.identities={};table.checkfn=[];var ss=[];if(this.columns){this.columns.forEach(function(col){var dbtypeid=col.dbtypeid;if(!alasql.fn[dbtypeid])dbtypeid=dbtypeid.toUpperCase();if(["SERIAL","SMALLSERIAL","BIGSERIAL"].indexOf(dbtypeid)>-1)col.identity={value:1,step:1};var newcol={columnid:col.columnid,dbtypeid:dbtypeid,dbsize:col.dbsize,dbprecision:col.dbprecision,notnull:col.notnull,identity:col.identity};if(col.identity){table.identities[col.columnid]={value:+col.identity.value,step:+col.identity.step}}if(col.check){table.checkfn.push(new Function("r","var y;return "+col.check.expression.toJavaScript("r","")))}if(col.default){ss.push("'"+col.columnid+"':"+col.default.toJavaScript("r",""))}if(col.primarykey){var pk=table.pk={};pk.columns=[col.columnid];pk.onrightfns="r['"+col.columnid+"']";pk.onrightfn=new Function("r","var y;return "+pk.onrightfns);pk.hh=hash(pk.onrightfns);table.uniqs[pk.hh]={}}if(col.unique){var uk={};if(typeof table.uk=="undefined")table.uk=[];table.uk.push(uk);uk.columns=[col.columnid];uk.onrightfns="r['"+col.columnid+"']";uk.onrightfn=new Function("r","var y;return "+uk.onrightfns);uk.hh=hash(uk.onrightfns);table.uniqs[uk.hh]={}}if(col.foreignkey){var fk=col.foreignkey.table;var fktable=alasql.databases[fk.databaseid||alasql.useid].tables[fk.tableid];if(typeof fk.columnid=="undefined"){if(fktable.pk.columns&&fktable.pk.columns.length>0){fk.columnid=fktable.pk.columns[0]}else{throw new Error("FOREIGN KEY allowed only to tables with PRIMARY KEYs")}}var fkfn=function(r){var rr={};if(typeof r[col.columnid]=="undefined")return true;rr[fk.columnid]=r[col.columnid];var addr=fktable.pk.onrightfn(rr);if(!fktable.uniqs[fktable.pk.hh][addr]){throw new Error('Foreign key "'+r[col.columnid]+'" is not found in table '+fktable.tableid)}return true};table.checkfn.push(fkfn)}table.columns.push(newcol);table.xcolumns[newcol.columnid]=newcol})}table.defaultfns=ss.join(",");constraints.forEach(function(con){if(con.type=="PRIMARY KEY"){if(table.pk){throw new Error("Primary key already exists")}var pk=table.pk={};pk.columns=con.columns;pk.onrightfns=pk.columns.map(function(columnid){return"r['"+columnid+"']"}).join("+'`'+");pk.onrightfn=new Function("r","var y;return "+pk.onrightfns);pk.hh=hash(pk.onrightfns);table.uniqs[pk.hh]={}}else if(con.type=="CHECK"){table.checkfn.push(new Function("r","var y;return "+con.expression.toJavaScript("r","")))}else if(con.type=="UNIQUE"){var uk={};if(!table.uk)table.uk=[];table.uk.push(uk);uk.columns=con.columns;uk.onrightfns=uk.columns.map(function(columnid){return"r['"+columnid+"']"}).join("+'`'+");uk.onrightfn=new Function("r","var y;return "+uk.onrightfns);uk.hh=hash(uk.onrightfns);table.uniqs[uk.hh]={}}else if(con.type=="FOREIGN KEY"){var col=table.xcolumns[con.columns[0]];var fk=con.fktable;if(con.fkcolumns&&con.fkcolumns.length>0)fk.columnid=con.fkcolumns[0];var fktable=alasql.databases[fk.databaseid||alasql.useid].tables[fk.tableid];if(typeof fk.columnid=="undefined"){fk.columnid=fktable.pk.columns[0]}var fkfn=function(r){var rr={};if(typeof r[col.columnid]=="undefined")return true;rr[fk.columnid]=r[col.columnid];var addr=fktable.pk.onrightfn(rr);if(!fktable.uniqs[fktable.pk.hh][addr]){throw new Error('Foreign key "'+r[col.columnid]+'" is not found in table '+fktable.tableid)}return true};table.checkfn.push(fkfn)}});if(this.view&&this.viewcolumns){var self=this;this.viewcolumns.forEach(function(vcol,idx){self.select.columns[idx].as=vcol.columnid})}if(db.engineid){return alasql.engines[db.engineid].createTable(this.table.databaseid||databaseid,tableid,this.ifnotexists,cb)}table.insert=function(r){var table=this;for(var columnid in table.identities){var ident=table.identities[columnid];r[columnid]=ident.value}if(table.checkfn&&table.checkfn.length>0){table.checkfn.forEach(function(checkfn){if(!checkfn(r)){throw new Error("Violation of CHECK constraint")}})}table.columns.forEach(function(column){if(column.notnull&&typeof r[column.columnid]=="undefined"){throw new Error("Wrong NULL value in NOT NULL column "+column.columnid)}});if(table.pk){var pk=table.pk;var addr=pk.onrightfn(r);if(typeof table.uniqs[pk.hh][addr]!="undefined"){throw new Error("Cannot insert record, because it already exists in primary key index")}}if(table.uk&&table.uk.length){table.uk.forEach(function(uk){var ukaddr=uk.onrightfn(r);if(typeof table.uniqs[uk.hh][ukaddr]!="undefined"){throw new Error("Cannot insert record, because it already exists in unique index")}})}table.data.push(r);for(var columnid in table.identities){var ident=table.identities[columnid];ident.value+=ident.step}if(table.pk){var pk=table.pk;var addr=pk.onrightfn(r);table.uniqs[pk.hh][addr]=r}if(table.uk&&table.uk.length){table.uk.forEach(function(uk){var ukaddr=uk.onrightfn(r);table.uniqs[uk.hh][ukaddr]=r})}};table.delete=function(i,params,alasql){var table=this;var r=this.data[i];if(this.pk){var pk=this.pk;var addr=pk.onrightfn(r);if(typeof this.uniqs[pk.hh][addr]=="undefined"){throw new Error("Something wrong with primary key index on table")}else{this.uniqs[pk.hh][addr]=undefined}}if(table.uk&&table.uk.length){table.uk.forEach(function(uk){var ukaddr=uk.onrightfn(r);if(typeof table.uniqs[uk.hh][ukaddr]=="undefined"){throw new Error("Something wrong with unique index on table")}table.uniqs[uk.hh][ukaddr]=undefined})}};table.deleteall=function(){this.data.length=0;if(this.pk){this.uniqs[this.pk.hh]={}}if(table.uk&&table.uk.length){table.uk.forEach(function(uk){table.uniqs[uk.hh]={}})}};table.update=function(assignfn,i,params){var r=cloneDeep(this.data[i]);if(this.pk){var pk=this.pk;pk.pkaddr=pk.onrightfn(r,params);if(typeof this.uniqs[pk.hh][pk.pkaddr]=="undefined"){throw new Error("Something wrong with index on table")}else{}}if(table.uk&&table.uk.length){table.uk.forEach(function(uk){uk.ukaddr=uk.onrightfn(r);if(typeof table.uniqs[uk.hh][uk.ukaddr]=="undefined"){throw new Error("Something wrong with unique index on table")}})}assignfn(r,params,alasql);if(table.checkfn&&table.checkfn.length>0){table.checkfn.forEach(function(checkfn){if(!checkfn(r)){throw new Error("Violation of CHECK constraint")}})}table.columns.forEach(function(column){if(column.notnull&&typeof r[column.columnid]=="undefined"){throw new Error("Wrong NULL value in NOT NULL column "+column.columnid)}});if(this.pk){pk.newpkaddr=pk.onrightfn(r);if(typeof this.uniqs[pk.hh][pk.newpkaddr]!="undefined"&&pk.newpkaddr!=pk.pkaddr){throw new Error("Record already exists")}else{}}if(table.uk&&table.uk.length){table.uk.forEach(function(uk){uk.newukaddr=uk.onrightfn(r);if(typeof table.uniqs[uk.hh][uk.newukaddr]!="undefined"&&uk.newukaddr!=uk.ukaddr){throw new Error("Record already exists")}})}if(this.pk){this.uniqs[pk.hh][pk.pkaddr]=undefined;this.uniqs[pk.hh][pk.newpkaddr]=r}if(table.uk&&table.uk.length){table.uk.forEach(function(uk){table.uniqs[uk.hh][uk.ukaddr]=undefined;table.uniqs[uk.hh][uk.newukaddr]=r})}this.data[i]=r};if(this.view&&this.select){table.view=true;table.select=this.select.compile(this.table.databaseid||databaseid)}var res;if(!alasql.options.nocount)res=1;if(cb)res=cb(res);return res};alasql.fn.Date=Object;alasql.fn.Date=Date;alasql.fn.Number=Number;alasql.fn.String=String;alasql.fn.Boolean=Boolean;stdfn.EXTEND=alasql.utils.extend;stdfn.CHAR=String.fromCharCode.bind(String);stdfn.ASCII=function(a){return a.charCodeAt(0)};stdfn.COALESCE=function(){for(var i=0;i0){var s=this.sets.map(function(st){return"x['"+st.column.columnid+"']="+st.expression.toJavaScript("x","")}).join(";");var setfn=new Function("x,params,alasql",s)}else if(this.content){}else if(this.select){}else{}var statement=function(params,cb){var res;var db=alasql.databases[dbid];if(typeof sharp!="undefined"){var id=sharp}else{var id=db.counter++}var vertex={$id:id,$node:"VERTEX"};db.objects[vertex.$id]=vertex;res=vertex;if(namefn)namefn(vertex);if(setfn)setfn(vertex,params,alasql);if(cb)res=cb(res);return res};return statement};yy.CreateEdge=function(params){return yy.extend(this,params)};yy.CreateEdge.prototype.toString=function(){var s=K("CREATE")+" "+K("EDGE")+" ";if(this.class)s+=L(this.class)+" ";return s};yy.CreateEdge.prototype.toJavaScript=function(context,tableid,defcols){var s="this.queriesfn["+(this.queriesidx-1)+"](this.params,null,"+context+")";return s};yy.CreateEdge.prototype.compile=function(databaseid){var dbid=databaseid;var fromfn=new Function("params,alasql","var y;return "+this.from.toJavaScript());var tofn=new Function("params,alasql","var y;return "+this.to.toJavaScript());if(typeof this.name!="undefined"){var s="x.name="+this.name.toJavaScript();var namefn=new Function("x",s)}if(this.sets&&this.sets.length>0){var s=this.sets.map(function(st){return"x['"+st.column.columnid+"']="+st.expression.toJavaScript("x","")}).join(";");var setfn=new Function("x,params,alasql","var y;"+s)}else if(this.content){}else if(this.select){}else{}var statement=function(params,cb){var res=0;var db=alasql.databases[dbid];var edge={$id:db.counter++,$node:"EDGE"};var v1=fromfn(params,alasql);var v2=tofn(params,alasql);edge.$in=[v1.$id];edge.$out=[v2.$id];if(typeof v1.$out=="undefined")v1.$out=[];v1.$out.push(edge.$id);if(typeof v2.$in=="undefined")v2.$in=[];v2.$in.push(edge.$id);db.objects[edge.$id]=edge;res=edge;if(namefn)namefn(edge);if(setfn)setfn(edge,params,alasql);if(cb)res=cb(res);return res};return statement};yy.CreateGraph=function(params){return yy.extend(this,params)};yy.CreateGraph.prototype.toString=function(){var s=K("CREATE")+" "+K("GRAPH")+" ";if(this.class)s+=L(this.class)+" ";return s};yy.CreateGraph.prototype.execute=function(databaseid,params,cb){var res=[];if(this.from){if(alasql.from[this.from.funcid]){this.graph=alasql.from[this.from.funcid.toUpperCase()](this.from.args[0].value);console.log(this.graph)}}this.graph.forEach(function(g){if(g.source){var e={};if(typeof g.as!="undefined")alasql.vars[g.as]=e;if(typeof g.prop!="undefined"){e.name=g.prop}if(typeof g.sharp!="undefined")e.$id=g.sharp;if(typeof g.name!="undefined")e.name=g.name;if(typeof g.class!="undefined")e.$class=g.class;var db=alasql.databases[databaseid];if(typeof e.$id=="undefined"){e.$id=db.counter++}e.$node="EDGE";if(typeof g.json!="undefined"){extend(e,new Function("params,alasql","var y;return "+g.json.toJavaScript())(params,alasql))}var v1;if(g.source.vars){var vo=alasql.vars[g.source.vars];if(typeof vo=="object")v1=vo;else v1=db.objects[vo]}else{var av1=g.source.sharp;if(typeof av1=="undefined")av1=g.source.prop;v1=alasql.databases[databaseid].objects[av1];if(typeof v1=="undefined"&&alasql.options.autovertex&&(typeof g.source.prop!="undefined"||typeof g.source.name!="undefined")){v1=findVertex(g.source.prop||g.source.name);if(typeof v1=="undefined"){v1=createVertex(g.source)}}}var v2;if(g.source.vars){var vo=alasql.vars[g.target.vars];if(typeof vo=="object")v2=vo;else v2=db.objects[vo]}else{var av2=g.target.sharp;if(typeof av2=="undefined")av2=g.target.prop;v2=alasql.databases[databaseid].objects[av2];if(typeof v2=="undefined"&&alasql.options.autovertex&&(typeof g.target.prop!="undefined"||typeof g.target.name!="undefined")){v2=findVertex(g.target.prop||g.target.name);if(typeof v2=="undefined"){v2=createVertex(g.target)}}}e.$in=[v1.$id];e.$out=[v2.$id];if(typeof v1.$out=="undefined")v1.$out=[];v1.$out.push(e.$id);if(typeof v2.$in=="undefined")v2.$in=[];v2.$in.push(e.$id);db.objects[e.$id]=e;if(typeof e.$class!="undefined"){if(typeof alasql.databases[databaseid].tables[e.$class]=="undefined"){throw new Error("No such class. Pleace use CREATE CLASS")}else{alasql.databases[databaseid].tables[e.$class].data.push(e)}}res.push(e.$id)}else{createVertex(g)}});if(cb)res=cb(res);return res;function findVertex(name){var objects=alasql.databases[alasql.useid].objects;for(var k in objects){if(objects[k].name==name){return objects[k]}}return undefined}function createVertex(g){var v={};if(typeof g.as!="undefined")alasql.vars[g.as]=v;if(typeof g.prop!="undefined"){v.$id=g.prop;v.name=g.prop}if(typeof g.sharp!="undefined")v.$id=g.sharp;if(typeof g.name!="undefined")v.name=g.name;if(typeof g.class!="undefined")v.$class=g.class;var db=alasql.databases[databaseid];if(typeof v.$id=="undefined"){v.$id=db.counter++}v.$node="VERTEX";if(typeof g.json!="undefined"){extend(v,new Function("params,alasql","var y;return "+g.json.toJavaScript())(params,alasql))}db.objects[v.$id]=v;if(typeof v.$class!="undefined"){if(typeof alasql.databases[databaseid].tables[v.$class]=="undefined"){throw new Error("No such class. Pleace use CREATE CLASS")}else{alasql.databases[databaseid].tables[v.$class].data.push(v)}}res.push(v.$id);return v}};yy.CreateGraph.prototype.compile1=function(databaseid){var dbid=databaseid;var fromfn=new Function("params,alasql","var y;return "+this.from.toJavaScript());var tofn=new Function("params,alasql","var y;return "+this.to.toJavaScript());if(typeof this.name!="undefined"){var s="x.name="+this.name.toJavaScript();var namefn=new Function("x",s)}if(this.sets&&this.sets.length>0){var s=this.sets.map(function(st){return"x['"+st.column.columnid+"']="+st.expression.toJavaScript("x","")}).join(";");var setfn=new Function("x,params,alasql","var y;"+s)}else if(this.content){}else if(this.select){}else{}var statement=function(params,cb){var res=0;var db=alasql.databases[dbid];var edge={$id:db.counter++,$node:"EDGE"};var v1=fromfn(params,alasql);var v2=tofn(params,alasql);edge.$in=[v1.$id];edge.$out=[v2.$id];if(typeof v1.$out=="undefined")v1.$out=[];v1.$out.push(edge.$id);if(typeof v2.$in=="undefined")v2.$in=[];v2.$in.push(edge.$id);db.objects[edge.$id]=edge;res=edge;if(namefn)namefn(edge);if(setfn)setfn(edge,params,alasql);if(cb)res=cb(res);return res};return statement};yy.AlterTable=function(params){return yy.extend(this,params)};yy.AlterTable.prototype.toString=function(){var s="ALTER TABLE "+this.table.toString();if(this.renameto)s+=" RENAME TO "+this.renameto;return s};yy.AlterTable.prototype.execute=function(databaseid,params,cb){var db=alasql.databases[databaseid];db.dbversion=Date.now();if(this.renameto){var oldtableid=this.table.tableid;var newtableid=this.renameto;var res=1;if(db.tables[newtableid]){throw new Error("Can not rename a table '"+oldtableid+"' to '"+newtableid+"', because the table with this name already exists")}else if(newtableid==oldtableid){throw new Error("Can not rename a table '"+oldtableid+"' to itself")}else{db.tables[newtableid]=db.tables[oldtableid];delete db.tables[oldtableid];res=1}if(cb)cb(res);return res}else if(this.addcolumn){var db=alasql.databases[this.table.databaseid||databaseid];db.dbversion++;var tableid=this.table.tableid;var table=db.tables[tableid];var columnid=this.addcolumn.columnid;if(table.xcolumns[columnid]){throw new Error('Cannot add column "'+columnid+'", because it already exists in the table "'+tableid+'"')}var col={columnid:columnid,dbtypeid:this.dbtypeid,dbsize:this.dbsize,dbprecision:this.dbprecision,dbenum:this.dbenum,defaultfns:null};var defaultfn=function(){};table.columns.push(col);table.xcolumns[columnid]=col;for(var i=0,ilen=table.data.length;i0){for(var i=0,ilen=table.data.length;i0){for(var i=0,ilen=table.data.length;i=0){q+="(x="+values[idx].toJavaScript()+",x==undefined?undefined:+x)"}else if(alasql.fn[table.xcolumns[col.columnid].dbtypeid]){q+="(new "+table.xcolumns[col.columnid].dbtypeid+"(";q+=values[idx].toJavaScript();q+="))"}else{q+=values[idx].toJavaScript()}}else{q+=values[idx].toJavaScript()}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].toJavaScript()}else if(alasql.fn[col.dbtypeid]){q+="(new "+col.dbtypeid+"(";q+=values[idx].toJavaScript();q+="))"}else{q+=values[idx].toJavaScript()}ss.push(q)})}else{sw=JSONtoJavaScript(values)}}if(db.tables[tableid].defaultfns){ss.unshift(db.tables[tableid].defaultfns)}if(sw){s+="a="+sw+";"}else{s+="a={"+ss.join(",")+"};"}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);"}else{s+="aa.push(a);"}});s33=s3+s;if(db.tables[tableid].insert){}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)}else if(this.select){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,null,cb);return res};return statement}else{var insertfn=function(db,params,alasql){var res=selectfn(params);if(db.tables[tableid].insert){for(var i=0,ilen=res.length;i0){s+="("+this.args.map(function(arg){return arg.toString()}).join(", ")+")"}if(this.as)s+=" "+K("AS")+" "+L(this.as);return s};yy.CreateDatabase.prototype.execute=function(databaseid,params,cb){var args;if(this.args&&this.args.length>0){args=this.args.map(function(arg){return new Function("params,alasql","var y;return "+arg.toJavaScript())(params,alasql)})}if(this.engineid){var res=alasql.engines[this.engineid].createDatabase(this.databaseid,this.args,this.ifnotexists,this.as,cb);return res}else{var dbid=this.databaseid;if(alasql.databases[dbid]){throw new Error("Database '"+dbid+"' already exists")}var a=new alasql.Database(dbid);var res=1;if(cb)return cb(res);return res}};yy.AttachDatabase=function(params){return yy.extend(this,params)};yy.AttachDatabase.prototype.toString=function(){var s=K("ATTACH");if(this.engineid)s+=" "+L(this.engineid);s+=" "+K("DATABASE")+" "+L(this.databaseid);if(args){s+="(";if(args.length>0){s+=args.map(function(arg){return arg.toString()}).join(", ")}s+=")"}if(this.as)s+=" "+K("AS")+" "+L(this.as);return s};yy.AttachDatabase.prototype.execute=function(databaseid,params,cb){if(!alasql.engines[this.engineid]){throw new Error('Engine "'+this.engineid+'" is not defined.')}var res=alasql.engines[this.engineid].attachDatabase(this.databaseid,this.as,this.args,params,cb);return res};yy.DetachDatabase=function(params){return yy.extend(this,params)};yy.DetachDatabase.prototype.toString=function(){var s=K("DETACH");s+=" "+K("DATABASE")+" "+L(this.databaseid);return s};yy.DetachDatabase.prototype.execute=function(databaseid,params,cb){if(!alasql.databases[this.databaseid].engineid){throw new Error('Cannot detach database "'+this.engineid+'", because it was not attached.')}var res;var dbid=this.databaseid;if(dbid==alasql.DEFAULTDATABASEID){throw new Error("Drop of default database is prohibited")}if(!alasql.databases[dbid]){if(!this.ifexists){throw new Error("Database '"+dbid+"' does not exist")}else{res=0}}else{delete alasql.databases[dbid];if(dbid==alasql.useid){alasql.use()}res=1}if(cb)cb(res);return res};yy.UseDatabase=function(params){return yy.extend(this,params)};yy.UseDatabase.prototype.toString=function(){return K("USE")+" "+K("DATABASE")+" "+L(this.databaseid)};yy.UseDatabase.prototype.execute=function(databaseid,params,cb){var dbid=this.databaseid;if(!alasql.databases[dbid]){throw new Error("Database '"+dbid+"' does not exist")}alasql.use(dbid);var res=1;if(cb)cb(res);return res};yy.DropDatabase=function(params){return yy.extend(this,params)};yy.DropDatabase.prototype.toString=function(){var s=K("DROP");if(this.ifexists)s+=" "+K("IF")+" "+K("EXISTS");s+=" "+K("DATABASE")+" "+L(this.databaseid);return s};yy.DropDatabase.prototype.execute=function(databaseid,params,cb){if(this.engineid){return alasql.engines[this.engineid].dropDatabase(this.databaseid,this.ifexists,cb)}var res;var dbid=this.databaseid;if(dbid==alasql.DEFAULTDATABASEID){throw new Error("Drop of default database is prohibited")}if(!alasql.databases[dbid]){if(!this.ifexists){throw new Error("Database '"+dbid+"' does not exist")}else{res=0}}else{if(alasql.databases[dbid].engineid){throw new Error("Cannot drop database '"+dbid+"', because it is attached. Detach it.")}delete alasql.databases[dbid];if(dbid==alasql.useid){alasql.use()}res=1}if(cb)cb(res);return res};yy.Declare=function(params){return yy.extend(this,params)};yy.Declare.prototype.toString=function(){var s=K("DECLARE")+" ";if(this.declares&&this.declares.length>0){s=this.declares.map(function(declare){var s="";s+="@"+L(declare.variable)+" ";s+=declare.dbtypeid;if(this.dbsize)s+="("+N(this.dbsize);if(this.dbprecision)s+=","+N(this.dbprecision);s+=")";if(declare.expression)s+=" = "+declare.expression.toString();return s}).join(",")}return s};yy.Declare.prototype.execute=function(databaseid,params,cb){var res=1;if(this.declares&&this.declares.length>0){this.declares.map(function(declare){var dbtypeid=declare.dbtypeid;if(!alasql.fn[dbtypeid])dbtypeid=dbtypeid.toUpperCase();alasql.declares[declare.variable]={dbtypeid:dbtypeid,dbsize:declare.dbsize,dbprecision:declare.dbprecision};if(declare.expression){alasql.vars[declare.variable]=new Function("params,alasql","return "+declare.expression.toJavaScript("({})","",null))(params,alasql);if(alasql.declares[declare.variable]){alasql.vars[declare.variable]=alasql.stdfn.CONVERT(alasql.vars[declare.variable],alasql.declares[declare.variable])}}})}if(cb)res=cb(res);return res};yy.ShowDatabases=function(params){return yy.extend(this,params)};yy.ShowDatabases.prototype.toString=function(){var s=K("SHOW")+" "+K("DATABASES");if(this.like)s+="LIKE "+this.like.toString();return s};yy.ShowDatabases.prototype.execute=function(databaseid,params,cb){if(this.engineid){return alasql.engines[this.engineid].showDatabases(this.like,cb)}else{var self=this;var res=[];for(dbid in alasql.databases){res.push({databaseid:dbid})}if(self.like&&res&&res.length>0){res=res.filter(function(d){return d.databaseid.match(new RegExp(self.like.value.replace(/\%/g,".*"),"g"))})}if(cb)cb(res);return res}};yy.ShowTables=function(params){return yy.extend(this,params)};yy.ShowTables.prototype.toString=function(){var s=K("SHOW")+" "+K("TABLES");if(this.databaseid)s+=" FROM "+this.databaseid;if(this.like)s+=" "+K("LIKE")+" "+this.like.toString();return s};yy.ShowTables.prototype.execute=function(databaseid,params,cb){var db=alasql.databases[this.databaseid||databaseid];var self=this;var res=[];for(tableid in db.tables){res.push({tableid:tableid})}if(self.like&&res&&res.length>0){res=res.filter(function(d){return d.tableid.match(new RegExp(self.like.value.replace(/\%/g,".*"),"g"))})}if(cb)cb(res);return res};yy.ShowColumns=function(params){return yy.extend(this,params)};yy.ShowColumns.prototype.toString=function(){var s=K("SHOW")+" "+K("COLUMNS");if(this.table.tableid)s+=" "+K("FROM")+" "+this.table.tableid;if(this.databaseid)s+=" "+K("FROM")+" "+this.databaseid;return s};yy.ShowColumns.prototype.execute=function(databaseid){var db=alasql.databases[this.databaseid||databaseid];var table=db.tables[this.table.tableid];var self=this;if(table&&table.columns){var res=table.columns.map(function(col){return{columnid:col.columnid,dbtypeid:col.dbtypeid,dbsize:col.dbsize}});return res}else{return[]}};yy.ShowIndex=function(params){return yy.extend(this,params)};yy.ShowIndex.prototype.toString=function(){var s=K("SHOW")+" "+K("INDEX");if(this.table.tableid)s+=" "+K("FROM")+" "+this.table.tableid;if(this.databaseid)s+=" "+K("FROM")+" "+this.databaseid;return s};yy.ShowIndex.prototype.execute=function(databaseid){var db=alasql.databases[this.databaseid||databaseid];var table=db.tables[this.table.tableid];var self=this;var res=[];if(table&&table.indices){for(var ind in table.indices){res.push({hh:ind,len:Object.keys(table.indices[ind]).length})}}return res};yy.ShowCreateTable=function(params){return yy.extend(this,params)};yy.ShowCreateTable.prototype.toString=function(){var s=K("SHOW")+" "+K("CREATE")+" "+K("TABLE")+" "+L(this.table.tableid);if(this.databaseid)s+=" "+K("FROM")+" "+L(this.databaseid);return s};yy.ShowCreateTable.prototype.execute=function(databaseid){var db=alasql.databases[this.databaseid||databaseid];var table=db.tables[this.table.tableid];var self=this;if(table){var s=K("CREATE")+" "+K("TABLE")+" "+L(this.table.tableid)+" (";var ss=[];if(table.columns){table.columns.forEach(function(col){var a=L(col.columnid)+" "+K(col.dbtypeid);if(col.dbsize)a+="("+N(col.dbsize)+")";if(col.primarykey)a+=" "+K("PRIMARY")+" "+K("KEY");ss.push(a)});s+=ss.join(", ")}s+=")";return s}else{throw new Error('There is no such table "'+this.table.tableid+'"')}};yy.SetVariable=function(params){return yy.extend(this,params)};yy.SetVariable.prototype.toString=function(){var s=K("SET")+" ";if(typeof this.value!="undefined")s+=K(this.variable.toUpperCase())+" "+(this.value?"ON":"OFF");if(this.expression)s+=this.method+L(this.variable)+" = "+this.expression.toString();return s};yy.SetVariable.prototype.execute=function(databaseid,params,cb){if(typeof this.value!="undefined"){var val=this.value;if(val=="ON")val=true;else if(val=="OFF")val=false;alasql.options[this.variable]=val}else if(this.expression){if(this.exists){this.existsfn=this.exists.map(function(ex){var nq=ex.compile(databaseid);if(nq.query&&!nq.query.modifier)nq.query.modifier="RECORDSET";return nq})}if(this.queries){this.queriesfn=this.queries.map(function(q){var nq=q.compile(databaseid);if(nq.query&&!nq.query.modifier)nq.query.modifier="RECORDSET";return nq})}var res=new Function("params,alasql","return "+this.expression.toJavaScript("({})","",null)).bind(this)(params,alasql);if(alasql.declares[this.variable]){res=alasql.stdfn.CONVERT(res,alasql.declares[this.variable])}if(this.props&&this.props.length>0){if(this.method=="@"){var fs="alasql.vars['"+this.variable+"']"}else{var fs="params['"+this.variable+"']"}fs+=this.props.map(function(prop){if(typeof prop=="string"){return"['"+prop+"']"}else if(typeof prop=="number"){return"["+prop+"]"}else{return"["+prop.toJavaScript()+"]"}}).join();new Function("value,params,alasql","var y;"+fs+"=value")(res,params,alasql)}else{if(this.method=="@"){alasql.vars[this.variable]=res}else{params[this.variable]=res}}}var res=1;if(cb)res=cb(res);return res};alasql.test=function(name,times,fn){if(arguments.length==0){alasql.log(alasql.con.results);return}else if(arguments.length==1){var tm=Date.now();fn();alasql.con.log(Date.now()-tm);return}if(arguments.length==2){fn=times;times=1}var tm=Date.now();for(var i=0;i",sql);if(res instanceof Array){if(console.table){console.table(res)}else{console.log(JSONtoString(res))}}else{console.log(JSONtoString(res))}}else{var el;if(target=="output"){el=document.getElementsByTagName("output")[0]}else{if(typeof target=="string"){el=document.getElementById(target)}else{el=target}}var s="";if(typeof sql=="string"&&alasql.options.logprompt){s+=""+alasql.pretty(sql)+"
"}if(res instanceof Array){if(res.length==0){s+="[ ]
"}else if(typeof res[0]!="object"||res[0]instanceof Array){for(var i=0,ilen=res.length;i"+loghtml(res[i])+"
"}}else{s+=loghtml(res)}}else{s+=loghtml(res)}el.innerHTML+=s}};alasql.clear=function(){var target=alasql.options.logtarget;if(typeof exports=="object"){target="console"}if(target=="console"||typeof exports=="object"){if(console.clear){console.clear()}else{}}else{var el;if(target=="output"){el=document.getElementsByTagName("output")[0]}else{if(typeof target=="string"){el=document.getElementById(target)}else{el=target}}el.innerHTML=""}};alasql.write=function(s){var target=alasql.options.logtarget;if(typeof exports=="object"){target="console"}if(target=="console"||typeof exports=="object"){if(console.log){console.log(s)}else{}}else{var el;if(target=="output"){el=document.getElementsByTagName("output")[0]}else{if(typeof target=="string"){el=document.getElementById(target)}else{el=target}}el.innerHTML+=s}};function loghtml(res){var s="";if(typeof res=="undefined"){s+="undefined"}else if(res instanceof Array){s+="";s+="";var cols=[];for(colid in res[0]){cols.push(colid)}s+="#";cols.forEach(function(colid){s+=" "+colid});for(var i=0,ilen=res.length;i"+(i+1);cols.forEach(function(colid){s+=" ";if(+res[i][colid]==+res[i][colid]){s+='';if(typeof res[i][colid]=="undefined")s+="NULL";else s+=res[i][colid];s+="
"}else{if(typeof res[i][colid]=="undefined"){s+="NULL"}else if(typeof res[i][colid]=="string"){s+=res[i][colid]}else s+=JSONtoString(res[i][colid])}})}s+="
"}else{s+=""+JSONtoString(res)+"
"}return s}function scrollTo(element,to,duration){if(duration<=0)return;var difference=to-element.scrollTop;var perTick=difference/duration*10;setTimeout(function(){if(element.scrollTop==to)return;element.scrollTop=element.scrollTop+perTick;scrollTo(element,to,duration-10)},10)}alasql.prompt=function(el,useidel,firstsql){if(typeof exports=="object"){throw new Error("The functionality of prompt is not realized for Node.js")}var prompti=0;if(typeof el=="string")el=document.getElementById(el);if(typeof useidel=="string")useidel=document.getElementById(useidel);useidel.textContent=alasql.useid;if(firstsql){alasql.prompthistory.push(firstsql);prompti=alasql.prompthistory.length;try{var tm=Date.now();alasql.log(firstsql);alasql.write(''+(Date.now()-tm)+" ms
")}catch(err){alasql.write(""+olduseid+"> "+sql+"
");alasql.write(''+err+"
")}}var y=el.getBoundingClientRect().top+document.getElementsByTagName("body")[0].scrollTop;scrollTo(document.getElementsByTagName("body")[0],y,500);el.onkeydown=function(event){if(event.which==13){var sql=el.value;var olduseid=alasql.useid;el.value="";alasql.prompthistory.push(sql);prompti=alasql.prompthistory.length;try{var tm=Date.now();alasql.log(sql);alasql.write('
'+(Date.now()-tm)+" ms
")}catch(err){alasql.write(""+olduseid+"> "+alasql.pretty(sql,false)+"
");alasql.write(''+err+"
")}el.focus();useidel.textContent=alasql.useid;var y=el.getBoundingClientRect().top+document.getElementsByTagName("body")[0].scrollTop;scrollTo(document.getElementsByTagName("body")[0],y,500)}else if(event.which==38){prompti--;if(prompti<0)prompti=0;if(alasql.prompthistory[prompti]){el.value=alasql.prompthistory[prompti];event.preventDefault()}}else if(event.which==40){prompti++;if(prompti>=alasql.prompthistory.length){prompti=alasql.prompthistory.length;el.value=""}else if(alasql.prompthistory[prompti]){el.value=alasql.prompthistory[prompti];event.preventDefault()}}}};yy.BeginTransaction=function(params){return yy.extend(this,params)};yy.BeginTransaction.prototype.toString=function(){return K("BEGIN")+" "+K("TRANSACTION")};yy.BeginTransaction.prototype.execute=function(databaseid,params,cb){var res=1;if(alasql.databases[databaseid].engineid){return alasql.engines[alasql.databases[alasql.useid].engineid].begin(databaseid,cb)}else{}if(cb)cb(res);return res};yy.CommitTransaction=function(params){return yy.extend(this,params)};yy.CommitTransaction.prototype.toString=function(){return K("COMMIT")+" "+K("TRANSACTION")};yy.CommitTransaction.prototype.execute=function(databaseid,params,cb){var res=1;if(alasql.databases[databaseid].engineid){return alasql.engines[alasql.databases[alasql.useid].engineid].commit(databaseid,cb)}else{}if(cb)cb(res);return res};yy.RollbackTransaction=function(params){return yy.extend(this,params)};yy.RollbackTransaction.prototype.toString=function(){return K("ROLLBACK")+" "+K("TRANSACTION")};yy.RollbackTransaction.prototype.execute=function(databaseid,params,cb){var res=1;if(alasql.databases[databaseid].engineid){return alasql.engines[alasql.databases[databaseid].engineid].rollback(databaseid,cb)}else{}if(cb)cb(res);return res};if(alasql.options.tsql){alasql.stdfn.OBJECT_ID=function(name,type){if(typeof type=="undefined")type="T";type=type.toUpperCase();var sname=name.split(".");var dbid=alasql.useid;var objname=sname[0];if(sname.length==2){dbid=sname[0];objname=sname[1]}var tables=alasql.databases[dbid].tables;dbid=alasql.databases[dbid].databaseid;for(var tableid in tables){if(tableid==objname){if(tables[tableid].view&&type=="V")return dbid+"."+tableid;if(!tables[tableid].view&&type=="T")return dbid+"."+tableid;return undefined}}return undefined}}if(alasql.options.mysql){}if(alasql.options.mysql||alasql.options.sqlite){alasql.from.INFORMATION_SCHEMA=function(filename,opts,cb,idx,query){if(filename=="VIEWS"||filename=="TABLES"){var res=[];for(var databaseid in alasql.databases){var tables=alasql.databases[databaseid].tables;for(var tableid in tables){if(tables[tableid].view&&filename=="VIEWS"||!tables[tableid].view&&filename=="TABLES"){res.push({TABLE_CATALOG:databaseid,TABLE_NAME:tableid})}}}if(cb)res=cb(res,idx,query);return res}throw new Error("Unknown INFORMATION_SCHEMA table")}}if(alasql.options.postgres){}if(alasql.options.oracle){}if(alasql.options.sqlite){}alasql.into.SQL=function(filename,opts,data,columns,cb){var res;if(typeof filename=="object"){opts=filename;filename=undefined}var opt={};alasql.utils.extend(opt,opts);if(typeof opt.tableid=="undefined"){throw new Error("Table for INSERT TO is not defined.")}var s="";if(columns.length==0){if(typeof data[0]=="object"){columns=Object.keys(data[0]).map(function(columnid){return{columnid:columnid}})}else{}}for(var i=0,ilen=data.length;i0){columns=Object.keys(data[0]).map(function(columnid){return{columnid:columnid}})}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};alasql.into.TAB=alasql.into.TSV=function(filename,opts,data,columns,cb){var opt={};alasql.utils.extend(opt,opts);opt.separator=" ";return alasql.into.CSV(filename,opt,data,columns,cb)};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.quote='"';alasql.utils.extend(opt,opts);var res=data.length;var s="";if(opt.headers){s+=columns.map(function(col){return col.columnid}).join(opt.separator)+"\n"}data.forEach(function(d,idx){s+=columns.map(function(col){var s=d[col.columnid];s=(s+"").replace(new RegExp("\\"+opt.quote,"g"),'""');if((s+"").indexOf(opt.separator)>-1||(s+"").indexOf(opt.quote)>-1)s=opt.quote+s+opt.quote;return s}).join(opt.separator)+"\n"});res=alasql.utils.saveFile(filename,s);if(cb)res=cb(res);return res};alasql.into.XLS=function(filename,opts,data,columns,cb){if(typeof filename=="object"){opts=filename;filename=undefined}var sheets={};if(opts&&opts.sheets){sheets=opts.sheets}var sheet={};if(typeof sheets["Sheet1"]!="undefined"){sheet=sheets[0]}else{if(typeof opts!="undefined"){sheet=opts}}if(typeof sheet.sheetid=="undefined"){sheet.sheetid="Sheet1"}var s=toHTML();var res=alasql.utils.saveFile(filename,s);if(cb)res=cb(res);return res;function toHTML(){var s=' ";s+="";s+="";if(typeof sheet.caption!="undefined"){var caption=sheet.caption;if(typeof caption=="string"){caption={title:caption}}s+="";s+=caption.title;s+=" "}if(typeof sheet.columns!="undefined"){columns=sheet.columns}else{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}})}}}}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;if(sheet.headers&&sheet.headers instanceof Array)column.title=sheet.headers[idx]});s+="";columns.forEach(function(column){s+=' '});s+=" ";if(sheet.headers){s+="";s+="";columns.forEach(function(column,columnidx){s+="";if(typeof column.title!="undefined"){if(typeof column.title=="function"){s+=column.title(sheet,column,columnidx)}else{s+=column.title}}s+=" "});s+=" ";s+=" "}s+="";if(data&&data.length>0){data.forEach(function(row,rowidx){if(rowidx>sheet.limit)return;s+="";columns.forEach(function(column,columnidx){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])}var value=row[column.columnid];if(typeof cell.value=="function"){value=cell.value(value,sheet,row,column,cell,rowidx,columnidx)}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 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{if(opts.types&&opts.types[typeid]&&opts.types[typeid].typestyle){typestyle=opts.types[typeid].typestyle}}typestyle=typestyle||'mso-number-format:"\\@";';s+="";var format=cell.format;if(typeof value=="undefined"){s+=""}else if(typeof format!="undefined"){if(typeof format=="function"){s+=format(value)}else if(typeof format=="string"){s+=value}else{throw new Error("Unknown format type. Should be function or string")}}else{if(typeid=="number"||typeid=="date"){s+=value.toString()}else if(typeid=="money"){s+=(+value).toFixed(2)}else{s+=value}}s+=" "});s+=" "})}s+=" ";s+="
";s+="";s+="";return s}function style(a){var s=' style="';if(a&&typeof a.style!="undefined"){s+=a.style+";"}s+='" ';return s}};alasql.into.XLSXML=function(filename,opts,data,columns,cb){if(typeof filename=="object"){opts=filename;filename=undefined}var sheets={};if(opts&&opts.sheets){sheets=opts.sheets}else{sheets.Sheet1=opts}var res=alasql.utils.saveFile(filename,toXML());if(cb)res=cb(res);return res;function toXML(){var s1=' 0 ';var s2="";var s3=" ";var styles={};var stylesn=62;function hstyle(st){var s="";for(var key in st){s+="<"+key;for(var attr in st[key]){s+=" ";if(attr.substr(0,2)=="x:"){s+=attr}else{s+="ss:"}s+=attr+'="'+st[key][attr]+'"'}s+="/>"}var hh=hash(s);if(styles[hh]){}else{styles[hh]={styleid:stylesn};s2+='";stylesn++}return"s"+styles[hh].styleid}for(var sheetid in sheets){var sheet=sheets[sheetid];if(typeof sheet.columns!="undefined"){columns=sheet.columns}else{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}})}}}}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;if(sheet.headers&&sheet.headers instanceof Array)column.title=sheet.headers[idx]});s3+=' ';columns.forEach(function(column,columnidx){s3+=' '});if(sheet.headers){s3+='';columns.forEach(function(column,columnidx){s3+="';if(typeof column.title!="undefined"){if(typeof column.title=="function"){s3+=column.title(sheet,column,columnidx)}else{s3+=column.title}}s3+=" | "});s3+="
"}if(data&&data.length>0){data.forEach(function(row,rowidx){if(rowidx>sheet.limit)return;var srow={};extend(srow,sheet.row);if(sheet.rows&&sheet.rows[rowidx]){extend(srow,sheet.rows[rowidx])}s3+="";columns.forEach(function(column,columnidx){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])}var value=row[column.columnid];if(typeof cell.value=="function"){value=cell.value(value,sheet,row,column,cell,rowidx,columnidx)}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";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{if(opts.types&&opts.types[typeid]&&opts.types[typeid].typestyle){typestyle=opts.types[typeid].typestyle}}typestyle=typestyle||'mso-number-format:"\\@";';s3+="";s3+='';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}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+="
"})}s3+="
"}s3+=" ";return s1+s2+s3}};alasql.into.XLSX=function(filename,opts,data,columns,cb){var res=1;if(deepEqual(columns,[{columnid:"_"}])){data=data.map(function(dat){return dat._});columns=undefined}else{}if(typeof exports=="object"){var XLSX=require("xlsx")}else{var XLSX=window.XLSX}if(typeof filename=="object"){opts=filename;filename=undefined}var wb={SheetNames:[],Sheets:{}};if(opts.sourcefilename){alasql.utils.loadBinaryFile(opts.sourcefilename,!!cb,function(data){wb=XLSX.read(data,{type:"binary"});doExport()})}else{doExport()}if(cb)res=cb(res);return res;function doExport(){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)}function prepareSheet(opts,data,columns,idx){var opt={sheetid:"Sheet"+idx,headers:true};alasql.utils.extend(opt,opts);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}});i++}for(var j=0;j>>8^CRC_TABLE[offset]}return crc^-1}function pack(items){var data=arguments,idx=0,buffer,bufferSize=0;items=items.split("");items.forEach(function(type){if(type=="v"){bufferSize+=2}else if(type=="V"||type=="l"){bufferSize+=4}});buffer=new Buffer(bufferSize);items.forEach(function(type,index){if(type=="v"){buffer.writeUInt16LE(data[index+1],idx);idx+=2}else if(type=="V"){buffer.writeUInt32LE(data[index+1],idx);idx+=4}else if(type=="l"){buffer.writeInt32LE(data[index+1],idx);idx+=4}});return buffer}function normalizeZipPath(zipPath){return zipPath.replace(/\\/g,"/").replace(/^\/|\/$/g,"")}this.addEntry=function(entry){entry.path=normalizeZipPath(entry.path);entries.push(entry)};this.addDir=function(zipPath,localPath){this.addEntry({path:zipPath,file:localPath,isFile:false})};this.addData=function(zipPath,data){if(!Buffer.isBuffer(data)){data=new Buffer(data)}this.addEntry({path:zipPath,data:data})};function buildZipBuffer(){var buffers=[];var length=0;function append(buf){if(typeof buf=="string"){buf=new Buffer(buf)}buffers.push(buf);length+=buf.length}entries.forEach(function(entry){var mtime,mdate;entry.extra=entry.extra||"";entry.comment=entry.comment||"";entry.cmethod=0;mtime=entry.mtime;mdate=entry.mdate;if(entry.mtime instanceof Date){mtime=entry.mtime.getHours();mtime=mtime<<6;mtime=mtime|entry.mtime.getMinutes();mtime=mtime<<5;mtime=mtime|entry.mtime.getSeconds()/2;mdate=entry.mtime.getFullYear()-1980;mdate=mdate<<4;mdate=mdate|entry.mtime.getMonth()+1;mdate=mdate<<5;mdate=mdate|entry.mtime.getDate()}var fileName=entry.path;if(!entry.isFile&&fileName.charAt(fileName.length-1)!="/"){entry.path=fileName=fileName+"/"}entry.offset=length;append(pack("VvvvvvlVVvv",67324752,20,2,entry.cmethod,mtime,mdate,entry.crc32,entry.csize,entry.size,fileName.length,entry.extra.length));append(fileName);append(entry.extra);append(entry.data);entry.mtime=mtime;entry.mdate=mdate;entry.eattr=entry.isFile?32:48});var startOffset=length;var centralDirSize=0;entries.forEach(function(entry){append(pack("VvvvvvvlVVvvvvvVV",33639248,20,20,2,entry.cmethod,entry.mtime,entry.mdate,entry.crc32,entry.csize,entry.size,entry.path.length,entry.extra.length,entry.comment.length,0,0,entry.eattr,entry.offset));append(entry.path);append(entry.extra);append(entry.comment);centralDirSize+=46+entry.path.length+entry.extra.length+entry.comment.length});var comment="";append(pack("VvvvvVVv",101010256,0,0,entries.length,entries.length,centralDirSize,startOffset,comment.length));append(comment);var buffer=Buffer.concat(buffers);return buffer}this.toBuffer=function(callback){var index=-1;function deflateNext(){var data;var entry=entries[++index];if(entry){entry.csize=entry.size=entry.crc32=0;data=entry.data=entry.data?entry.data:new Buffer(0);entry.mtime=new Date;if(entry.isFile!==false){entry.crc32=calculateCrc32(data);entry.isFile=true;entry.size=data.length;entry.csize=entry.size;deflateNext()}else{deflateNext()}}else{callback(buildZipBuffer())}}deflateNext()}};alasql.from.METEOR=function(filename,opts,cb,idx,query){var res=filename.find(opts).fetch();if(cb)res=cb(res,idx,query);return res};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};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=N)return EOF;if(eol)return eol=false,EOL;var j=I;if(text.charCodeAt(j)===quoteCode){var i=j;while(i++/g,"");return document();function document(){return{declaration:declaration(),root:tag()}}function declaration(){var m=match(/^<\?xml\s*/);if(!m)return;var node={attributes:{}};while(!(eos()||is("?>"))){var attr=attribute();if(!attr)return node;node.attributes[attr.name]=attr.value}match(/\?>\s*/);return node}function tag(){var m=match(/^<([\w-:.]+)\s*/);if(!m)return;var node={name:m[1],attributes:{},children:[]};while(!(eos()||is(">")||is("?>")||is("/>"))){var attr=attribute();if(!attr)return node;node.attributes[attr.name]=attr.value}if(match(/^\s*\/>\s*/)){return node}match(/\??>\s*/);node.content=content();var child;while(child=tag()){node.children.push(child)}match(/^<\/[\w-:.]+>\s*/);return node}function content(){var m=match(/^([^<]*)/);if(m)return m[1];return""}function attribute(){var m=match(/([\w:-]+)\s*=\s*("[^"]*"|'[^']*'|\w+)\s*/);if(!m)return;return{name:m[1],value:strip(m[2])}}function strip(val){return val.replace(/^['"]|['"]$/g,"")}function match(re){var m=xml.match(re);if(!m)return;xml=xml.slice(m[0].length);return m}function eos(){return 0==xml.length}function is(prefix){return 0==xml.indexOf(prefix)}}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};yy.Help=function(params){return yy.extend(this,params)};yy.Help.prototype.toString=function(){var s=K("HELP");if(this.subject)s+=" "+L(this.subject);return s};helpdocs=[{command:"ALTER TABLE table RENAME TO table"},{command:"ALTER TABLE table ADD COLUMN column coldef"},{command:"ALTER TABLE table MODIFY COLUMN column coldef"},{command:"ALTER TABLE table RENAME COLUMN column TO column"},{command:"ALTER TABLE table DROP column"},{command:"ATTACH engine DATABASE database"},{command:"ASSERT value"},{command:"BEGIN [TRANSACTION]"},{command:"COMMIT [TRANSACTION]"},{command:"CREATE [engine] DATABASE [IF NOT EXISTS] database"},{command:"CREATE TABLE [IF NOT EXISTS] table (column definitions)"},{command:"DELETE FROM table [WHERE expression]"},{command:"DETACH DATABASE database"},{command:"DROP [engine] DATABASE [IF EXISTS] database"},{command:"DROP TABLE [IF EXISTS] table"},{command:"INSERT INTO table VALUES value,..."},{command:"INSERT INTO table DEFAULT VALUES"},{command:"INSERT INTO table SELECT select"},{command:"HELP [subject]"},{command:"ROLLBACK [TRANSACTION]"},{command:"SELECT [modificator] columns [INTO table] [FROM table,...] [[mode] JOIN [ON] [USING]] [WHERE ] [GROUP BY] [HAVING] [ORDER BY] "},{command:"SET option value"},{command:"SHOW [engine] DATABASES"},{command:"SHOW TABLES"},{command:"SHOW CREATE TABLE table"},{command:"UPDATE table SET column1 = expression1, ... [WHERE expression]"},{command:"USE [DATABASE] database"},{command:"expression"},{command:'See also http://github/agershun/alasq for more information'}];yy.Help.prototype.execute=function(databaseid,params,cb){var ss=[];if(!this.subject){ss=helpdocs}else{ss.push('See also http://github/agershun/alasq for more information')}if(cb)ss=cb(ss);return ss};yy.Print=function(params){return yy.extend(this,params)};yy.Print.prototype.toString=function(){var s=K("PRINT");if(this.statement)s+=" "+this.statement.toString();return s};yy.Print.prototype.execute=function(databaseid,params,cb){var self=this;var res=1;alasql.precompile(this,databaseid,params);if(this.exprs&&this.exprs.length>0){var rs=this.exprs.map(function(expr){var exprfn=new Function("params,alasql,p","var y;return "+expr.toJavaScript("({})","",null)).bind(self);var r=exprfn(params,alasql);return JSONtoString(r)});console.log.apply(console,rs)}else if(this.select){var r=this.select.execute(databaseid,params);console.log(JSONtoString(r))}else{console.log()}if(cb)res=cb(res);return res};yy.Source=function(params){return yy.extend(this,params)};yy.Source.prototype.toString=function(){var s=K("SOURCE");if(this.url)s+=" "+S("'"+this.url+"'");return s};yy.Source.prototype.execute=function(databaseid,params,cb){var res;loadFile(this.url,!!cb,function(data){res=alasql(data);if(cb)res=cb(res);return res},function(err){throw err});return res};yy.Require=function(params){return yy.extend(this,params)};yy.Require.prototype.toString=function(){var s=K("REQUIRE");if(this.paths&&this.paths.length>0){s+=this.paths.map(function(path){return path.toString()}).join(",")}if(this.plugins&&this.plugins.length>0){s+=this.plugins.map(function(plugin){return plugin.toUpperCase()
+}).join(",")}return s};yy.Require.prototype.execute=function(databaseid,params,cb){var self=this;var res=0;var ss="";if(this.paths&&this.paths.length>0){this.paths.forEach(function(path){loadFile(path.value,!!cb,function(data){res++;ss+=data;if(res0){this.plugins.forEach(function(plugin){if(!alasql.plugins[plugin]){loadFile(alasql.path+"/alasql-"+plugin.toLowerCase()+".js",!!cb,function(data){res++;ss+=data;if(res0){res=res.filter(function(d){return d.databaseid.match(relike)})}}if(cb)cb(res);return res};LS.createTable=function(databaseid,tableid,ifnotexists,cb){var lsdbid=alasql.databases[databaseid].lsdbid;var tb=LS.get(lsdbid+"."+tableid);var res=1;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];lsdb.tables[tableid]={columns:table.columns};LS.set(lsdbid,lsdb);LS.set(lsdbid+"."+tableid,[]);if(cb)cb(res);return res};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);if(cb)cb(res);return res};LS.fromTable=function(databaseid,tableid,cb,idx,query){var lsdbid=alasql.databases[databaseid].lsdbid;var res=LS.get(lsdbid+"."+tableid);if(cb)res=cb(res,idx,query);return res};LS.intoTable=function(databaseid,tableid,value,columns,cb){var lsdbid=alasql.databases[databaseid].lsdbid;var res=value.length;var tb=LS.get(lsdbid+"."+tableid);if(!tb)tb=[];tb=tb.concat(value);LS.set(lsdbid+"."+tableid,tb);if(cb)cb(res);return res};LS.loadTableData=function(databaseid,tableid){var db=alasql.databases[databaseid];var lsdbid=alasql.databases[databaseid].lsdbid;db.tables[tableid].data=LS.get(lsdbid+"."+tableid)};LS.saveTableData=function(databaseid,tableid){var db=alasql.databases[databaseid];var lsdbid=alasql.databases[databaseid].lsdbid;LS.set(lsdbid+"."+tableid,db.tables[tableid].data);db.tables[tableid].data=null};LS.commit=function(databaseid,cb){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){lsdb.tables[tbid]={columns:db.tables[tbid].columns};LS.set(lsdbid+"."+tbid,db.tables[tbid].data)}}LS.set(lsdbid,lsdb);return 1};LS.begin=LS.commit;LS.rollback=function(databaseid,cb){var db=alasql.databases[databaseid];db.dbversion++;var lsdbid=alasql.databases[databaseid].lsdbid;var lsdb=LS.get(lsdbid);if(lsdb.tables){for(var tbid in lsdb.tables){var tb=new alasql.Table({columns:db.tables[tbid].columns});extend(tb,lsdb.tables[tbid]);lsdb.tables[tbid]=tb;if(!alasql.options.autocommit){lsdb.tables[tbid].data=LS.get(db.lsdbid+"."+tbid)}lsdb.tables[tbid].indexColumns()}}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"};var SQLITE=alasql.engines.SQLITE=function(){};SQLITE.createDatabase=function(wdbid,args,ifnotexists,dbid,cb){throw new Error("Connot create SQLITE database in memory. Attach it.")};SQLITE.dropDatabase=function(databaseid){throw new Error("This is impossible to drop SQLite database. Detach it.")};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')}if(args[0]&&args[0]instanceof yy.StringValue||args[0]instanceof yy.ParamValue){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};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)};SQLITE.intoTable=function(databaseid,tableid,value,columns,cb){var sqldb=alasql.databases[databaseid].sqldb;for(var i=0,ilen=value.length;i1){var sql="REQUIRE "+paths.map(function(p){return'"'+p+'"'}).join(",");alasql(sql,[],cb)}}else if(path===false){delete alasql.webworker;return}}}
\ No newline at end of file
diff --git a/dist/alasql.d.ts b/dist/alasql.d.ts
new file mode 100644
index 0000000000..018beb2e4c
--- /dev/null
+++ b/dist/alasql.d.ts
@@ -0,0 +1,54 @@
+// Type definitions for alasql.js v.0.1.8
+// Project: https://github.com/agershun/alasql
+// Definitions by: Andrey Gershun
+// Definitions: https://github.com/borisyankov/DefinitelyTyped
+
+
+interface AlaSQLCallback {
+ (data?:any,err?:Error):void
+}
+
+interface AlaSQLOptions {
+ errorlog: boolean;
+ valueof :boolean
+ dropifnotexists :boolean; // DROP database in any case
+ datetimeformat :string; // How to handle DATE and DATETIME types
+ casesensitive :boolean; // Table and column names are case sensitive and converted to lower-case
+ logtarget :string; // target for log. Values: 'console', 'output', 'id' of html tag
+ logprompt :boolean; // Print SQL at log
+ modifier :any; // values: RECORDSET, VALUE, ROW, COLUMN, MATRIX, TEXTSTRING, INDEX
+ columnlookup:number; // How many rows to lookup to define columns
+ autovertex:boolean;// Create vertex if not found
+ usedbo:boolean; // Use dbo as current database (for partial T-SQL comaptibility)
+ autocommit:boolean; // AUTOCOMMIT ON | OFF
+ cache:boolean; // Use cache
+ nocount:boolean;// for SET NOCOUNT OFF
+ nan:boolean;// Check for NaN and convert it to undefined
+ angularjs :boolean;
+ tsql:boolean;
+ mysql:boolean;
+ postgres:boolean;
+ oracle:boolean;
+ sqlite:boolean;
+ orientdb:boolean;
+}
+
+// Compiled Statement
+interface AlaSQLStatement {
+ (params?:any,cb?:AlaSQLCallback,scope?:any):any;
+}
+
+// Abstract Syntax Tree
+interface AlaSQLAST {
+ compile(databaseid:string):AlaSQLStatement;
+}
+
+interface AlaSQL {
+ (sql:any,params?:any,cb?:AlaSQLCallback,scope?:any):any;
+ parse(sql):AlaSQLAST;
+ options:AlaSQLOptions;
+ error: Error;
+}
+
+declare var alasql : AlaSQL;
+
diff --git a/dist/alasql.js b/dist/alasql.js
index 32bd62480d..7fabc49980 100644
--- a/dist/alasql.js
+++ b/dist/alasql.js
@@ -1,3 +1,4 @@
+/*! AlaSQL v0.1.9 (c) 2014-2015 Andrey Gershun | alasql.org/license */
/*
@module alasql
@version 0.1.8
@@ -125,7 +126,7 @@ var alasql = function alasql(sql, params, cb, scope) {
Current version of alasql
@constant {string}
*/
-alasql.version = "0.1.8";
+alasql.version = "0.1.9";
/**
Debug flag
@@ -10526,36 +10527,46 @@ alasql.stdfn.CONVERT = function(value, args) {
}
};
+ var udbtypeid = args.dbtypeid.toUpperCase();
+
if(args.dbtypeid == 'Date') {
return new Date(val);
- } else if(args.dbtypeid.toUpperCase() == 'DATE') {
+ } else if(udbtypeid == 'DATE') {
var d = new Date(val);
var s = d.getFullYear()+"."+("0"+(d.getMonth()+1)).substr(-2)+"."+("0"+d.getDate()).substr(-2);
return s;
- } else if(args.dbtypeid == 'DATETIME') {
+ } else if(udbtypeid == 'DATETIME') {
var d = new Date(val);
var s = d.getFullYear()+"."+("0"+(d.getMonth()+1)).substr(-2)+"."+("0"+d.getDate()).substr(-2);
s += " "+("0"+d.getHours()).substr(-2)+":"+("0"+d.getMinutes()).substr(-2)+":"+("0"+d.getSeconds()).substr(-2);
s += '.'+("00"+d.getMilliseconds()).substr(-3)
return s;
- } else if(args.dbtypeid.toUpperCase() == 'STRING') {
- return ""+val;
- } else if(args.dbtypeid.toUpperCase() == 'NUMBER' || args.dbtypeid == 'FLOAT') {
+ } else if(['NUMBER','FLOAT'].indexOf(udbtypeid)>-1) {
return +val;
- } else if(args.dbtypeid.toUpperCase() == 'MONEY') {
+ } else if(['MONEY'].indexOf(udbtypeid)>-1) {
var m = +val;
return (m|0)+((m*100)%100)/100;
- } else if(args.dbtypeid.toUpperCase() == 'BOOLEAN') {
+ } else if(['BOOLEAN'].indexOf(udbtypeid)>-1) {
return !!val;
- } else if(args.dbtypeid.toUpperCase() == 'INT') {
+ } else if(['INT','INTEGER','SMALLINT','BIGINT','SERIAL','SMALLSERIAL','BIGSERIAL'].indexOf(args.dbtypeid.toUpperCase())>-1) {
return val|0;
- } else if(args.dbtypeid.toUpperCase() == 'VARCHAR' || args.dbtypeid == 'NVARCHAR') {
+ } else if(['STRING','VARCHAR','NVARCHAR', 'CHARACTER VARIABLE'].indexOf(args.dbtypeid.toUpperCase())>-1) {
if(args.dbsize) return (""+val).substr(0,args.dbsize);
else return ""+val;
- } else if(args.dbtypeid.toUpperCase() == 'CHAR' || args.dbtypeid == 'NCHAR') {
+ } else if(['CHAR','CHARACTER', 'NCHAR'].indexOf(udbtypeid)>-1) {
return (val+(new Array(args.dbsize+1).join(" "))).substr(0,args.dbsize);
//else return ""+val.substr(0,1);
- }
+ } else if(['DECIMAL','NUMERIC'].indexOf(udbtypeid)>-1) {
+ var m = +val;
+ var fxd = Math.pow(10,args.dbpecision);
+ return (m|0)+((m*fxd)%fxd)/fxd;
+ } else if(['JSON'].indexOf(udbtypeid)>-1) {
+ if(typeof val == 'object') return val;
+ try {
+ return JSON.parse(val);
+ } catch(err) { throw new Error('Cannot convert string to JSON');};
+ };
+ return val;
};
@@ -10650,6 +10661,10 @@ yy.CreateTable.prototype.execute = function (databaseid, params, cb) {
this.columns.forEach(function(col) {
var dbtypeid = col.dbtypeid;
if(!alasql.fn[dbtypeid]) dbtypeid = dbtypeid.toUpperCase();
+
+ // Process SERIAL data type like Postgress
+ if(['SERIAL','SMALLSERIAL','BIGSERIAL'].indexOf(dbtypeid)>-1) col.identity = {value:1,step:1};
+
var newcol = {
columnid: col.columnid,
dbtypeid: dbtypeid,
diff --git a/dist/alasql.min.js b/dist/alasql.min.js
index 42aac82a40..a1cc1d1dcb 100644
--- a/dist/alasql.min.js
+++ b/dist/alasql.min.js
@@ -1,10 +1,10 @@
-(function(root,factory){if(typeof define==="function"&&define.amd){define([],factory)}else if(typeof exports==="object"){module.exports=factory()}else{root.alasql=factory()}})(this,function(){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){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){var select=new yy.Select({columns:[new yy.Column({columnid:"*"})],from:[new yy.ParamValue({param:0})]});select.preparams=[sql];return select}else{if(typeof sql=="string"&&sql[0]=="#"&&typeof document=="object"){sql=document.querySelector(sql).textContent}else if(typeof sql=="object"&&sql instanceof HTMElement){sql=sql.textContent}else if(typeof sql=="function"){sql=sql.toString().slice(14,-3)}return alasql.exec(sql,params,cb,scope)}}};alasql.version="0.1.8";alasql.debug=undefined;getAlaSQLPath();function getAlaSQLPath(){alasql.path="";if(typeof importScripts==="function"){alasql.path=""}else if(typeof exports!="undefined"){alasql.path=__dirname}else if(typeof Meteor=="object"&&Meteor.isClient){alasql.path="/packages/dist/"}else if(typeof Meteor=="object"&&Meteor.isServer){alasql.path="assets/packages/dist/"}else if(typeof document!="undefined"){var sc=document.getElementsByTagName("script");for(var i=0;i1&&($$[$0-4].toUpperCase()=="MAX"||$$[$0-4].toUpperCase()=="MIN")){this.$=new yy.FuncValue({funcid:$$[$0-4],args:$$[$0-2]})}else{this.$=new yy.AggrValue({aggregatorid:$$[$0-4].toUpperCase(),expression:$$[$0-2].pop(),over:$$[$0]})}break;case 299:this.$=new yy.AggrValue({aggregatorid:$$[$0-5].toUpperCase(),expression:$$[$0-2],distinct:true,over:$$[$0]});break;case 300:this.$=new yy.AggrValue({aggregatorid:$$[$0-5].toUpperCase(),expression:$$[$0-2],over:$$[$0]});break;case 302:case 303:this.$=new yy.Over;yy.extend(this.$,$$[$0-1]);break;case 304:this.$=new yy.Over;yy.extend(this.$,$$[$0-2]);yy.extend(this.$,$$[$0-1]);break;case 305:this.$={partition:$$[$0]};break;case 306:this.$={order:$$[$0]};break;case 307:this.$="SUM";break;case 308:this.$="COUNT";break;case 309:this.$="MIN";break;case 310:case 486:this.$="MAX";break;case 311:this.$="AVG";break;case 312:this.$="FIRST";break;case 313:this.$="LAST";break;case 314:this.$="AGGR";break;case 315:this.$="ARRAY";break;case 316:var funcid=$$[$0-4];var exprlist=$$[$0-1];if(exprlist.length>1&&(funcid.toUpperCase()=="MIN"||funcid.toUpperCase()=="MAX")){this.$=new yy.FuncValue({funcid:funcid,args:exprlist})}else if(alasql.aggr[$$[$0-4]]){this.$=new yy.AggrValue({aggregatorid:"REDUCE",funcid:funcid,expression:exprlist.pop(),distinct:$$[$0-2]=="DISTINCT"})}else{this.$=new yy.FuncValue({funcid:funcid,args:exprlist})};break;case 317:this.$=new yy.FuncValue({funcid:$$[$0-2]});break;case 319:$$[$0-2].push($$[$0]);this.$=$$[$0-2];break;case 320:this.$=new yy.NumValue({value:+$$[$0]});break;case 321:this.$=new yy.LogicValue({value:true});break;case 322:this.$=new yy.LogicValue({value:false});break;case 323:this.$=new yy.StringValue({value:$$[$0].substr(1,$$[$0].length-2).replace(/(\\\')/g,"'").replace(/(\'\')/g,"'")});break;case 324:this.$=new yy.StringValue({value:$$[$0].substr(2,$$[$0].length-3).replace(/(\\\')/g,"'").replace(/(\'\')/g,"'")});break;case 325:this.$=new yy.NullValue({value:undefined});break;case 326:this.$=new yy.VarValue({variable:$$[$0]});break;case 327:if(!yy.exists)yy.exists=[];this.$=new yy.ExistsValue({value:$$[$0-1],existsidx:yy.exists.length});yy.exists.push($$[$0-1]);break;case 328:case 329:this.$=new yy.ParamValue({param:$$[$0]});break;case 330:if(typeof yy.question=="undefined")yy.question=0;this.$=new yy.ParamValue({param:yy.question++});break;case 331:if(typeof yy.question=="undefined")yy.question=0;this.$=new yy.ParamValue({param:yy.question++,array:true});break;case 332:this.$=new yy.CaseValue({expression:$$[$0-3],whens:$$[$0-2],elses:$$[$0-1]});break;case 333:this.$=new yy.CaseValue({whens:$$[$0-2],elses:$$[$0-1]});break;case 334:case 635:case 636:this.$=$$[$0-1];this.$.push($$[$0]);break;case 336:this.$={when:$$[$0-2],then:$$[$0]};break;case 339:this.$=new yy.Op({left:$$[$0-2],op:"LIKE",right:$$[$0]});break;case 340:this.$=new yy.Op({left:$$[$0-2],op:"NOT LIKE",right:$$[$0]});break;case 341:this.$=new yy.Op({left:$$[$0-2],op:"+",right:$$[$0]});break;case 342:this.$=new yy.Op({left:$$[$0-2],op:"-",right:$$[$0]});break;case 343:this.$=new yy.Op({left:$$[$0-2],op:"*",right:$$[$0]});break;case 344:this.$=new yy.Op({left:$$[$0-2],op:"/",right:$$[$0]});break;case 345:this.$=new yy.Op({left:$$[$0-2],op:"%",right:$$[$0]});break;case 346:this.$=new yy.Op({left:$$[$0-2],op:"^",right:$$[$0]});break;case 347:case 348:case 350:this.$=new yy.Op({left:$$[$0-2],op:"->",right:$$[$0]});break;case 349:this.$=new yy.Op({left:$$[$0-4],op:"->",right:$$[$0-1]});break;case 351:case 352:case 354:this.$=new yy.Op({left:$$[$0-2],op:"!",right:$$[$0]});break;case 353:this.$=new yy.Op({left:$$[$0-4],op:"!",right:$$[$0-1]});break;case 355:this.$=new yy.Op({left:$$[$0-2],op:">",right:$$[$0]});break;case 356:this.$=new yy.Op({left:$$[$0-2],op:">=",right:$$[$0]});break;case 357:this.$=new yy.Op({left:$$[$0-2],op:"<",right:$$[$0]});break;case 358:this.$=new yy.Op({left:$$[$0-2],op:"<=",right:$$[$0]});break;case 359:this.$=new yy.Op({left:$$[$0-2],op:"=",right:$$[$0]});break;case 360:this.$=new yy.Op({left:$$[$0-2],op:"==",right:$$[$0]});break;case 361:this.$=new yy.Op({left:$$[$0-2],op:"===",right:$$[$0]});break;case 362:this.$=new yy.Op({left:$$[$0-2],op:"!=",right:$$[$0]});break;case 363:this.$=new yy.Op({left:$$[$0-2],op:"!==",right:$$[$0]});break;case 364:this.$=new yy.Op({left:$$[$0-2],op:"!===",right:$$[$0]});break;case 365:if(!yy.queries)yy.queries=[];this.$=new yy.Op({left:$$[$0-5],op:$$[$0-4],allsome:$$[$0-3],right:$$[$0-1],queriesidx:yy.queries.length});yy.queries.push($$[$0-1]);break;case 366:this.$=new yy.Op({left:$$[$0-5],op:$$[$0-4],allsome:$$[$0-3],right:$$[$0-1]});break;case 367:if($$[$0-2].op=="BETWEEN1"){if($$[$0-2].left.op=="AND"){this.$=new yy.Op({left:$$[$0-2].left.left,op:"AND",right:new yy.Op({left:$$[$0-2].left.right,op:"BETWEEN",right1:$$[$0-2].right,right2:$$[$0]})})}else{this.$=new yy.Op({left:$$[$0-2].left,op:"BETWEEN",right1:$$[$0-2].right,right2:$$[$0]})}}else if($$[$0-2].op=="NOT BETWEEN1"){if($$[$0-2].left.op=="AND"){this.$=new yy.Op({left:$$[$0-2].left.left,op:"AND",right:new yy.Op({left:$$[$0-2].left.right,op:"NOT BETWEEN",right1:$$[$0-2].right,right2:$$[$0]})})}else{this.$=new yy.Op({left:$$[$0-2].left,op:"NOT BETWEEN",right1:$$[$0-2].right,right2:$$[$0]})}}else{this.$=new yy.Op({left:$$[$0-2],op:"AND",right:$$[$0]})}break;case 368:this.$=new yy.Op({left:$$[$0-2],op:"OR",right:$$[$0]});break;case 369:this.$=new yy.UniOp({op:"NOT",right:$$[$0]});break;case 370:this.$=new yy.UniOp({op:"-",right:$$[$0]});break;case 371:this.$=new yy.UniOp({op:"+",right:$$[$0]});break;case 372:this.$=new yy.UniOp({op:"#",right:$$[$0]});break;case 373:this.$=new yy.UniOp({right:$$[$0-1]});break;case 374:if(!yy.queries)yy.queries=[];this.$=new yy.Op({left:$$[$0-4],op:"IN",right:$$[$0-1],queriesidx:yy.queries.length});yy.queries.push($$[$0-1]);break;case 375:if(!yy.queries)yy.queries=[];this.$=new yy.Op({left:$$[$0-5],op:"NOT IN",right:$$[$0-1],queriesidx:yy.queries.length});yy.queries.push($$[$0-1]);break;case 376:this.$=new yy.Op({left:$$[$0-4],op:"IN",right:$$[$0-1]});break;case 377:this.$=new yy.Op({left:$$[$0-5],op:"NOT IN",right:$$[$0-1]});break;case 378:this.$=new yy.Op({left:$$[$0-3],op:"IN",right:[]});break;case 379:this.$=new yy.Op({left:$$[$0-4],op:"NOT IN",right:[]});break;case 380:case 382:this.$=new yy.Op({left:$$[$0-2],op:"IN",right:$$[$0]});break;case 381:case 383:this.$=new yy.Op({left:$$[$0-3],op:"NOT IN",right:$$[$0]});break;case 384:this.$=new yy.Op({left:$$[$0-2],op:"BETWEEN1",right:$$[$0]});break;case 385:this.$=new yy.Op({left:$$[$0-2],op:"NOT BETWEEN1",right:$$[$0]});break;case 386:this.$=new yy.Op({op:"IS",left:$$[$0-2],right:$$[$0]});break;case 387:this.$=new yy.Convert({expression:$$[$0-2]});yy.extend(this.$,$$[$0]);break;case 388:case 389:this.$=$$[$0];break;case 390:this.$=$$[$0-1];break;case 397:this.$="ALL";break;case 398:this.$="SOME";break;case 399:this.$="ANY";break;case 400:this.$=new yy.Update({table:$$[$0-4],columns:$$[$0-2],where:$$[$0]});break;case 401:this.$=new yy.Update({table:$$[$0-2],columns:$$[$0]});break;case 404:this.$=new yy.SetColumn({column:$$[$0-2],expression:$$[$0]});break;case 405:this.$=new yy.SetColumn({variable:$$[$0-2],expression:$$[$0],method:$$[$0-3]});break;case 406:this.$=new yy.Delete({table:$$[$0-2],where:$$[$0]});break;case 407:this.$=new yy.Delete({table:$$[$0]});break;case 408:this.$=new yy.Insert({into:$$[$0-2],values:$$[$0]});break;case 409:this.$=new yy.Insert({into:$$[$0-2],"default":true});break;case 410:this.$=new yy.Insert({into:$$[$0-5],columns:$$[$0-3],values:$$[$0]});break;case 411:this.$=new yy.Insert({into:$$[$0-1],select:$$[$0]});break;case 412:this.$=new yy.Insert({into:$$[$0-4],columns:$$[$0-2],select:$$[$0]});break;case 415:this.$=[$$[$0-1]];break;case 418:this.$=$$[$0-4];$$[$0-4].push($$[$0-1]);break;case 419:case 420:case 422:case 430:this.$=$$[$0-2];$$[$0-2].push($$[$0]);break;case 431:this.$=new yy.CreateTable({table:$$[$0-4]});yy.extend(this.$,$$[$0-7]);yy.extend(this.$,$$[$0-6]);yy.extend(this.$,$$[$0-5]);yy.extend(this.$,$$[$0-2]);yy.extend(this.$,$$[$0]);break;case 432:this.$=new yy.CreateTable({table:$$[$0]});yy.extend(this.$,$$[$0-3]);yy.extend(this.$,$$[$0-2]);yy.extend(this.$,$$[$0-1]);break;case 434:this.$={"class":true};break;case 443:this.$={temporary:true};break;case 445:this.$={ifnotexists:true};break;case 446:this.$={columns:$$[$0-2],constraints:$$[$0]};break;case 447:this.$={columns:$$[$0]};break;case 448:this.$={as:$$[$0]};break;case 449:case 473:this.$=[$$[$0]];break;case 451:case 452:case 453:case 454:case 455:$$[$0].constraintid=$$[$0-1];this.$=$$[$0];break;case 458:this.$={type:"CHECK",expression:$$[$0-1]};break;case 459:this.$={type:"PRIMARY KEY",columns:$$[$0-1],clustered:($$[$0-3]+"").toUpperCase()};break;case 460:this.$={type:"FOREIGN KEY",columns:$$[$0-5],fktable:$$[$0-2],fkcolumns:$$[$0-1]};break;case 461:case 491:case 522:case 558:case 576:case 579:case 598:this.$=$$[$0-1];break;case 466:this.$={type:"UNIQUE",columns:$$[$0-1],clustered:($$[$0-3]+"").toUpperCase()};break;case 475:this.$=new yy.ColumnDef({columnid:$$[$0-2]});yy.extend(this.$,$$[$0-1]);yy.extend(this.$,$$[$0]);break;case 476:this.$=new yy.ColumnDef({columnid:$$[$0-1]});yy.extend(this.$,$$[$0]);break;case 477:this.$=new yy.ColumnDef({columnid:$$[$0],dbtypeid:""});break;case 478:this.$={dbtypeid:$$[$0-5],dbsize:$$[$0-3],dbprecision:+$$[$0-1]};break;case 479:this.$={dbtypeid:$$[$0-6]+($$[$0-5]?" "+$$[$0-5]:""),dbsize:$$[$0-3],dbprecision:+$$[$0-1]};break;case 480:this.$={dbtypeid:$$[$0-3],dbsize:$$[$0-1]};break;case 481:this.$={dbtypeid:$$[$0-4]+($$[$0-3]?" "+$$[$0-3]:""),dbsize:$$[$0-1]};break;case 482:this.$={dbtypeid:$$[$0]};break;case 483:this.$={dbtypeid:$$[$0-1]+($$[$0]?" "+$$[$0]:"")};break;case 484:this.$={dbtypeid:"ENUM",enumvalues:$$[$0-1]};break;case 485:case 678:this.$=+$$[$0];break;case 487:this.$=undefined;break;case 489:yy.extend($$[$0-1],$$[$0]);this.$=$$[$0-1];break;case 492:this.$={primarykey:true};break;case 493:case 494:this.$={foreignkey:{table:$$[$0-1],columnid:$$[$0]}};break;case 495:this.$={identity:{value:$$[$0-3],step:$$[$0-1]}};break;case 496:this.$={identity:{value:1,step:1}};break;case 497:this.$={"default":$$[$0]};break;case 498:this.$={"default":$$[$0-1]};break;case 499:this.$={"null":true};break;case 500:this.$={notnull:true};break;case 501:this.$={check:$$[$0]};break;case 502:this.$={unique:true};break;case 503:this.$=new yy.DropTable({table:$$[$0],type:$$[$0-2]});yy.extend(this.$,$$[$0-1]);break;case 505:this.$={ifexists:true};break;case 506:this.$=new yy.AlterTable({table:$$[$0-3],renameto:$$[$0]});break;case 507:this.$=new yy.AlterTable({table:$$[$0-3],addcolumn:$$[$0]});break;case 508:this.$=new yy.AlterTable({table:$$[$0-3],modifycolumn:$$[$0]});break;case 509:this.$=new yy.AlterTable({table:$$[$0-5],renamecolumn:$$[$0-2],to:$$[$0]});break;case 510:this.$=new yy.AlterTable({table:$$[$0-3],dropcolumn:$$[$0]});break;case 511:this.$=new yy.AlterTable({table:$$[$0-2],renameto:$$[$0]});break;case 512:this.$=new yy.AttachDatabase({databaseid:$$[$0],engineid:$$[$0-2].toUpperCase()});break;case 513:this.$=new yy.AttachDatabase({databaseid:$$[$0-3],engineid:$$[$0-5].toUpperCase(),args:$$[$0-1]});break;case 514:this.$=new yy.AttachDatabase({databaseid:$$[$0-2],engineid:$$[$0-4].toUpperCase(),as:$$[$0]});break;case 515:this.$=new yy.AttachDatabase({databaseid:$$[$0-5],engineid:$$[$0-7].toUpperCase(),as:$$[$0],args:$$[$0-3]});break;case 516:this.$=new yy.DetachDatabase({databaseid:$$[$0]});break;case 517:this.$=new yy.CreateDatabase({databaseid:$$[$0]});yy.extend(this.$,$$[$0]);break;case 518:this.$=new yy.CreateDatabase({engineid:$$[$0-4].toUpperCase(),databaseid:$$[$0-1],as:$$[$0]});yy.extend(this.$,$$[$0-2]);break;case 519:this.$=new yy.CreateDatabase({engineid:$$[$0-7].toUpperCase(),databaseid:$$[$0-4],args:$$[$0-2],as:$$[$0]});yy.extend(this.$,$$[$0-5]);break;case 520:this.$=new yy.CreateDatabase({engineid:$$[$0-4].toUpperCase(),as:$$[$0],args:[$$[$0-1]]});yy.extend(this.$,$$[$0-2]);break;case 521:this.$=undefined;break;case 523:case 524:this.$=new yy.UseDatabase({databaseid:$$[$0]});break;case 525:this.$=new yy.DropDatabase({databaseid:$$[$0]});yy.extend(this.$,$$[$0-1]);break;case 526:case 527:this.$=new yy.DropDatabase({databaseid:$$[$0],engineid:$$[$0-3].toUpperCase()});yy.extend(this.$,$$[$0-1]);break;case 528:this.$=new yy.CreateIndex({indexid:$$[$0-5],table:$$[$0-3],columns:$$[$0-1]});break;case 529:this.$=new yy.CreateIndex({indexid:$$[$0-5],table:$$[$0-3],columns:$$[$0-1],unique:true});break;case 530:this.$=new yy.DropIndex({indexid:$$[$0]});break;case 531:this.$=new yy.ShowDatabases;break;case 532:this.$=new yy.ShowDatabases({like:$$[$0]});break;case 533:this.$=new yy.ShowDatabases({engineid:$$[$0-1].toUpperCase()});break;case 534:this.$=new yy.ShowDatabases({engineid:$$[$0-3].toUpperCase(),like:$$[$0]});break;case 535:this.$=new yy.ShowTables;break;case 536:this.$=new yy.ShowTables({like:$$[$0]});break;case 537:this.$=new yy.ShowTables({databaseid:$$[$0]});break;case 538:this.$=new yy.ShowTables({like:$$[$0],databaseid:$$[$0-2]});break;case 539:this.$=new yy.ShowColumns({table:$$[$0]});break;case 540:this.$=new yy.ShowColumns({table:$$[$0-2],databaseid:$$[$0]});break;case 541:this.$=new yy.ShowIndex({table:$$[$0]});break;case 542:this.$=new yy.ShowIndex({table:$$[$0-2],databaseid:$$[$0]});break;case 543:this.$=new yy.ShowCreateTable({table:$$[$0]});break;case 544:this.$=new yy.ShowCreateTable({table:$$[$0-2],databaseid:$$[$0]});break;case 545:this.$=new yy.CreateTable({table:$$[$0-6],view:true,select:$$[$0-1],viewcolumns:$$[$0-4]});yy.extend(this.$,$$[$0-9]);yy.extend(this.$,$$[$0-7]);break;case 546:this.$=new yy.CreateTable({table:$$[$0-3],view:true,select:$$[$0-1]});yy.extend(this.$,$$[$0-6]);yy.extend(this.$,$$[$0-4]);break;case 550:this.$=new yy.DropTable({table:$$[$0],view:true});yy.extend(this.$,$$[$0-1]);break;case 551:this.$=new yy.Help({subject:$$[$0].value.toUpperCase()});break;case 552:this.$=new yy.Help;break;case 553:this.$=new yy.ExpressionStatement({expression:$$[$0]});break;case 554:this.$=new yy.Source({url:$$[$0].value});break;case 555:this.$=new yy.Assert({value:$$[$0]});break;case 556:this.$=new yy.Assert({value:$$[$0].value});break;case 557:this.$=new yy.Assert({value:$$[$0],message:$$[$0-2]});break;case 559:case 570:case 572:this.$=$$[$0].value;break;case 560:case 568:this.$=+$$[$0].value;break;case 561:this.$=!!$$[$0].value;break;case 569:this.$=""+$$[$0].value;break;case 575:this.$=$$[$0-1];break;case 577:case 580:this.$=$$[$0-2];break;case 578:this.$={};break;case 581:this.$=[];break;case 582:yy.extend($$[$0-2],$$[$0]);this.$=$$[$0-2];break;case 584:this.$={};this.$[$$[$0-2].substr(1,$$[$0-2].length-2)]=$$[$0];break;case 585:case 586:this.$={};this.$[$$[$0-2]]=$$[$0];break;case 589:this.$=new yy.SetVariable({variable:$$[$0-1].toLowerCase(),value:$$[$0]});break;case 590:this.$=new yy.SetVariable({variable:$$[$0-2],expression:$$[$0],method:$$[$0-3]});break;case 591:this.$=new yy.SetVariable({variable:$$[$0-3],props:$$[$0-2],expression:$$[$0],method:$$[$0-4]});break;case 592:this.$="@";break;case 593:this.$="$";break;case 599:this.$=true;break;case 600:this.$=false;break;case 601:this.$=new yy.CommitTransaction;break;case 602:this.$=new yy.RollbackTransaction;break;case 603:this.$=new yy.BeginTransaction;break;case 604:this.$=new yy.If({expression:$$[$0-2],thenstat:$$[$0-1],elsestat:$$[$0]});if($$[$0-1].exists)this.$.exists=$$[$0-1].exists;if($$[$0-1].queries)this.$.queries=$$[$0-1].queries;break;case 605:this.$=new yy.If({expression:$$[$0-1],thenstat:$$[$0]});if($$[$0].exists)this.$.exists=$$[$0].exists;if($$[$0].queries)this.$.queries=$$[$0].queries;break;case 606:this.$=$$[$0];break;case 607:this.$=new yy.While({expression:$$[$0-1],loopstat:$$[$0]});if($$[$0].exists)this.$.exists=$$[$0].exists;if($$[$0].queries)this.$.queries=$$[$0].queries;break;case 608:this.$=new yy.Continue;break;case 609:this.$=new yy.Break;break;case 610:this.$=new yy.BeginEnd({statements:$$[$0-1]});break;case 611:this.$=new yy.Print({exprs:$$[$0]});break;case 612:this.$=new yy.Print({select:$$[$0]});break;case 613:this.$=new yy.Require({paths:$$[$0]});break;case 614:this.$=new yy.Require({plugins:$$[$0]});break;case 615:case 616:this.$=$$[$0].toUpperCase();break;case 617:this.$=new yy.Echo({expr:$$[$0]});break;case 622:this.$=new yy.Declare({declares:$$[$0]});break;case 625:this.$={variable:$$[$0-1]};yy.extend(this.$,$$[$0]);break;case 626:this.$={variable:$$[$0-2]};yy.extend(this.$,$$[$0]);break;case 627:this.$={variable:$$[$0-3],expression:$$[$0]};yy.extend(this.$,$$[$0-2]);break;case 628:this.$={variable:$$[$0-4],expression:$$[$0]};yy.extend(this.$,$$[$0-2]);break;case 629:this.$=new yy.TruncateTable({table:$$[$0]});break;case 630:this.$=new yy.Merge;yy.extend(this.$,$$[$0-4]);yy.extend(this.$,$$[$0-3]);yy.extend(this.$,$$[$0-2]);yy.extend(this.$,{matches:$$[$0-1]});yy.extend(this.$,$$[$0]);break;case 631:case 632:this.$={into:$$[$0]};break;case 634:this.$={on:$$[$0]};break;case 639:this.$={matched:true,action:$$[$0]};break;case 640:this.$={matched:true,expr:$$[$0-2],action:$$[$0]};break;case 641:this.$={"delete":true};break;case 642:this.$={update:$$[$0]};break;case 643:case 644:this.$={matched:false,bytarget:true,action:$$[$0]};break;case 645:case 646:this.$={matched:false,bytarget:true,expr:$$[$0-2],action:$$[$0]};break;case 647:this.$={matched:false,bysource:true,action:$$[$0]};break;case 648:this.$={matched:false,bysource:true,expr:$$[$0-2],action:$$[$0]};break;case 649:this.$={insert:true,values:$$[$0]};break;case 650:this.$={insert:true,values:$$[$0],columns:$$[$0-3]};break;case 651:this.$={insert:true,defaultvalues:true};break;case 652:this.$={insert:true,defaultvalues:true,columns:$$[$0-3]};break;case 654:this.$={output:{columns:$$[$0]}};break;case 655:this.$={output:{columns:$$[$0-3],intovar:$$[$0],method:$$[$0-1]}};break;case 656:this.$={output:{columns:$$[$0-2],intotable:$$[$0]}};break;case 657:this.$={output:{columns:$$[$0-5],intotable:$$[$0-3],intocolumns:$$[$0-1]}};break;case 658:this.$=new yy.CreateVertex({"class":$$[$0-3],sharp:$$[$0-2],name:$$[$0-1]});yy.extend(this.$,$$[$0]);break;case 661:this.$={sets:$$[$0]};break;case 662:this.$={content:$$[$0]};break;case 663:this.$={select:$$[$0]};break;case 664:this.$=new yy.CreateEdge({from:$$[$0-3],to:$$[$0-1],name:$$[$0-5]});yy.extend(this.$,$$[$0]);break;case 665:this.$=new yy.CreateGraph({graph:$$[$0]});break;case 666:this.$=new yy.CreateGraph({from:$$[$0]});break;case 669:this.$=$$[$0-2];if($$[$0-1])this.$.json=new yy.Json({value:$$[$0-1]});if($$[$0])this.$.as=$$[$0];break;case 670:this.$={source:$$[$0-6],target:$$[$0]};if($$[$0-3])this.$.json=new yy.Json({value:$$[$0-3]});if($$[$0-2])this.$.as=$$[$0-2];yy.extend(this.$,$$[$0-4]);break;case 672:this.$={vars:$$[$0],method:$$[$0-1]};break;case 675:var s3=$$[$0-1];this.$={prop:$$[$0-3],sharp:$$[$0-2],name:typeof s3=="undefined"?undefined:s3.substr(1,s3.length-2),"class":$$[$0]};break;case 681:this.$=new yy.AddRule({left:$$[$0-2],right:$$[$0]});break;case 682:this.$=new yy.AddRule({right:$$[$0]});break;case 685:this.$=new yy.Term({termid:$$[$0]});break;case 686:this.$=new yy.Term({termid:$$[$0-3],args:$$[$0-1]});break;case 692:case 706:case 708:case 710:case 714:case 716:case 718:case 720:case 722:case 724:this.$=[];break;case 693:case 701:case 703:case 707:case 709:case 711:case 715:case 717:case 719:case 721:case 723:case 725:$$[$0-1].push($$[$0]);break;case 700:case 702:this.$=[$$[$0]];break}},table:[o([8,450,451],$V0,{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,48:39,49:40,50:41,51:42,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,72:67,446:88,158:92,3:93,4:$V1,5:$V2,12:$V3,47:$V4,65:$V5,81:$V6,99:$V7,120:$V8,130:$V9,163:$Va,233:$Vb,287:$Vc,290:$Vd,291:$Ve,298:$Vf,344:$Vg,347:$Vh,348:$Vi,351:$Vj,353:$Vk,355:$Vl,356:$Vm,364:$Vn,365:$Vo,366:$Vp,383:$Vq,385:$Vr,386:$Vs,388:$Vt,389:$Vu,390:$Vv,391:$Vw,392:$Vx,396:$Vy,397:$Vz,400:$VA,401:$VB,447:$VC,449:$VD}),{1:[3]},{8:[1,97],9:98,450:$VE,451:$VF},o($VG,[2,5]),o($VG,[2,6]),o($VH,[2,9]),o($VG,$V0,{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,48:39,49:40,50:41,51:42,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,72:67,446:88,158:92,3:93,10:101,4:$V1,5:$V2,13:[1,102],47:$V4,65:$V5,81:$V6,99:$V7,120:$V8,130:$V9,163:$Va,233:$Vb,287:$Vc,290:$Vd,291:$Ve,298:$Vf,344:$Vg,347:$Vh,348:$Vi,351:$Vj,353:$Vk,355:$Vl,356:$Vm,364:$Vn,365:$Vo,366:$Vp,383:$Vq,385:$Vr,386:$Vs,388:$Vt,389:$Vu,390:$Vv,391:$Vw,392:$Vx,396:$Vy,397:$Vz,400:$VA,401:$VB,447:$VC,449:$VD}),o($VH,[2,11]),o($VH,[2,12]),o($VH,[2,13]),o($VH,[2,14]),o($VH,[2,15]),o($VH,[2,16]),o($VH,[2,17]),o($VH,[2,18]),o($VH,[2,19]),o($VH,[2,20]),o($VH,[2,21]),o($VH,[2,22]),o($VH,[2,23]),o($VH,[2,24]),o($VH,[2,25]),o($VH,[2,26]),o($VH,[2,27]),o($VH,[2,28]),o($VH,[2,29]),o($VH,[2,30]),o($VH,[2,31]),o($VH,[2,32]),o($VH,[2,33]),o($VH,[2,34]),o($VH,[2,35]),o($VH,[2,36]),o($VH,[2,37]),o($VH,[2,38]),o($VH,[2,39]),o($VH,[2,40]),o($VH,[2,41]),o($VH,[2,42]),o($VH,[2,43]),o($VH,[2,44]),o($VH,[2,45]),o($VH,[2,46]),o($VH,[2,47]),o($VH,[2,48]),o($VH,[2,49]),o($VH,[2,50]),o($VH,[2,51]),o($VH,[2,52]),o($VH,[2,53]),o($VH,[2,54]),o($VH,[2,55]),o($VH,[2,56]),o($VH,[2,57]),o($VH,[2,58]),o($VH,[2,59]),{304:[1,103]},{3:104,4:$V1,5:$V2},o($VI,[2,442],{3:106,299:110,4:$V1,5:$V2,109:$VJ,110:$VK,161:[1,108],167:[1,107],308:[1,113],352:[1,105],421:[1,109]}),{119:$VL,398:114,399:115},{157:[1,117]},{352:[1,118]},{3:120,4:$V1,5:$V2,105:[1,125],167:[1,121],304:[1,124],345:122,352:[1,119],357:[1,123]},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:126,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},o($Vi1,[2,413],{292:181,172:[1,182]}),{3:193,4:$V1,5:$V2,70:$Vj1,107:$Vk1,116:$VQ,118:187,119:$VR,126:$VS,155:$VW,172:[1,185],173:188,174:190,175:189,176:191,183:184,186:192,260:$Vd1,367:168,368:$Vg1,372:$Vh1,402:183},{304:[1,195]},o($Vl1,[2,690],{73:196,84:197,85:[1,198]}),o($Vm1,[2,692],{82:199}),{3:203,4:$V1,5:$V2,164:[1,201],167:[1,204],298:[1,200],304:[1,205],352:[1,202]},{304:[1,206]},{3:209,4:$V1,5:$V2,66:207,68:208},o([264,450,451],$V0,{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,48:39,49:40,50:41,51:42,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,72:67,446:88,158:92,3:93,7:211,4:$V1,5:$V2,12:$V3,47:$V4,65:$V5,81:$V6,99:$V7,120:$V8,130:$V9,163:$Va,233:$Vb,287:$Vc,290:$Vd,291:$Ve,298:$Vf,344:$Vg,347:$Vh,348:$Vi,351:$Vj,353:$Vk,355:$Vl,356:$Vm,364:$Vn,365:$Vo,366:$Vp,383:$Vq,384:[1,210],385:$Vr,386:$Vs,388:$Vt,389:$Vu,390:$Vv,391:$Vw,392:$Vx,396:$Vy,397:$Vz,400:$VA,401:$VB,447:$VC,449:$VD}),{384:[1,212]},{384:[1,213]},{3:215,4:$V1,5:$V2,352:[1,214]},{3:217,4:$V1,5:$V2,173:216},o($VH,[2,552],{91:218,107:$VO,256:$Va1}),o($Vn1,[2,284]),{91:219,107:$VO,256:$Va1},{3:231,4:$V1,5:$V2,91:225,106:$VN,107:[1,222],116:$VQ,118:220,119:$Vo1,126:$VS,155:$VW,170:224,174:229,175:228,225:226,226:227,232:$Vp1,238:221,254:$V81,255:$V91,256:$Va1,257:$Vb1,260:$Vd1,367:168,368:$Vg1,372:$Vh1},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:232,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},o($VH,[2,608]),o($VH,[2,609]),{3:147,4:$V1,5:$V2,36:234,51:144,70:$VM,72:67,81:$V6,89:130,91:134,100:235,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,125:233,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,158:92,163:$Va,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{3:241,4:$V1,5:$V2,91:238,107:$VO,256:$Va1,393:236,394:237,395:239,396:$Vq1},{3:242,4:$V1,5:$V2,116:$Vr1,119:$Vs1,379:243},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:246,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{447:[1,247]},{3:93,4:$V1,5:$V2,446:249,448:248},{3:231,4:$V1,5:$V2,174:250},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:251,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},o($Vt1,$Vu1,{160:255,138:[1,254],159:[1,252],161:[1,253],169:$Vv1}),o($Vw1,[2,685],{70:[1,257]}),o($Vx1,[2,130],{123:[1,258],124:[1,259],164:[1,260],165:[1,261],166:[1,262],167:[1,263],168:[1,264]}),o($Vy1,[2,1]),o($Vy1,[2,2]),{1:[2,3]},o($VG,$V0,{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,48:39,49:40,50:41,51:42,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,72:67,446:88,158:92,3:93,10:265,4:$V1,5:$V2,47:$V4,65:$V5,81:$V6,99:$V7,120:$V8,130:$V9,163:$Va,233:$Vb,287:$Vc,290:$Vd,291:$Ve,298:$Vf,344:$Vg,347:$Vh,348:$Vi,351:$Vj,353:$Vk,355:$Vl,356:$Vm,364:$Vn,365:$Vo,366:$Vp,383:$Vq,385:$Vr,386:$Vs,388:$Vt,389:$Vu,390:$Vv,391:$Vw,392:$Vx,396:$Vy,397:$Vz,400:$VA,401:$VB,447:$VC,449:$VD}),o($Vz1,[2,688]),o($Vz1,[2,689]),o($VG,[2,7]),{14:[1,266]},{3:217,4:$V1,5:$V2,173:267},{352:[1,268]},o($Vi1,$VA1,{301:269,130:$VB1}),{352:[1,271]},{3:272,4:$V1,5:$V2},{167:[1,273]},o([8,67,69,107,112,114,126,264,268,368,372,450,451],$VC1,{422:274,423:276,424:277,427:278,3:279,434:280,431:281,379:282,4:$V1,5:$V2,116:$Vr1,119:$Vs1,157:[1,275]}),{105:[1,286],300:283,304:[1,285],357:[1,284]},{91:288,107:$VO,157:[2,770],256:$Va1,420:287},o($VD1,[2,764],{414:289,3:290,4:$V1,5:$V2}),o($VI,[2,443]),o($VH,[2,622],{67:[1,291]}),o($VE1,[2,623]),{3:292,4:$V1,5:$V2},{3:217,4:$V1,5:$V2,173:293},{3:294,4:$V1,5:$V2},o($Vi1,$VF1,{346:295,130:$VG1}),{352:[1,297]},{3:298,4:$V1,5:$V2},o($Vi1,$VF1,{346:299,130:$VG1}),o($Vi1,$VF1,{346:300,130:$VG1}),o($VH1,[2,758]),o($VH1,[2,759]),o($VH,$V0,{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,48:39,49:40,50:41,51:42,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,72:67,446:88,158:92,3:93,10:301,278:322,4:$V1,5:$V2,47:$V4,65:$V5,81:$V6,90:$VI1,97:$VJ1,98:$VK1,99:$VL1,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,120:$V8,128:$VR1,130:$V9,144:$VS1,145:$VT1,153:$VU1,154:$VV1,163:$Va,233:$Vb,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72,287:$Vc,290:$Vd,291:$Ve,298:$Vf,344:$Vg,347:$Vh,348:$Vi,351:$Vj,353:$Vk,355:$Vl,356:$Vm,364:$Vn,365:$Vo,366:$Vp,383:$Vq,385:$Vr,386:$Vs,388:$Vt,389:$Vu,390:$Vv,391:$Vw,392:$Vx,396:$Vy,397:$Vz,400:$VA,401:$VB,447:$VC,449:$VD}),o($Vn1,[2,263]),o($Vn1,[2,264]),o($Vn1,[2,265]),o($Vn1,[2,266]),o($Vn1,[2,267]),o($Vn1,[2,268]),o($Vn1,[2,269]),o($Vn1,[2,270]),o($Vn1,[2,271]),o($Vn1,[2,272]),o($Vn1,[2,273]),o($Vn1,[2,274]),o($Vn1,[2,275]),o($Vn1,[2,276]),o($Vn1,[2,277]),o($Vn1,[2,278]),{3:147,4:$V1,5:$V2,23:336,24:335,33:332,36:331,51:144,70:$VM,72:67,81:$V6,89:130,91:134,100:334,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,158:92,163:$Va,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,231:333,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,291:$Ve,298:[1,337],367:168,368:$Vg1,372:$Vh1},o($Vn1,[2,282]),o($Vn1,[2,283]),{70:[1,338]},o([4,5,8,47,65,67,69,71,81,85,90,93,97,98,99,104,105,106,107,108,109,110,111,112,113,114,115,116,119,120,122,123,124,126,128,130,136,138,140,142,143,144,145,146,147,149,153,154,155,157,159,161,163,172,180,182,194,195,196,197,198,199,200,201,205,212,215,216,218,233,244,245,246,247,248,249,250,251,252,256,264,266,267,268,269,270,271,272,273,274,275,276,277,280,282,283,284,285,287,290,291,298,344,347,348,351,353,355,356,364,365,366,368,372,383,385,386,388,389,390,391,392,396,397,400,401,413,419,447,449,450,451],$V82,{70:$V92,117:[1,340]}),{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:341,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:342,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:343,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:344,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},o($Vn1,[2,258]),o([4,5,8,47,65,67,69,70,71,81,85,90,93,97,98,99,104,105,106,107,108,109,110,111,112,113,114,115,116,117,119,120,122,123,124,126,128,130,136,138,140,142,143,144,145,146,147,149,153,154,155,157,159,161,163,172,180,182,194,195,196,197,198,199,200,201,202,203,205,212,215,216,218,220,232,233,234,235,237,244,245,246,247,248,249,250,251,252,254,255,256,257,258,260,261,264,266,267,268,269,270,271,272,273,274,275,276,277,280,282,283,284,285,287,290,291,294,298,307,319,320,324,325,344,347,348,351,353,355,356,364,365,366,368,372,374,376,383,385,386,388,389,390,391,392,396,397,400,401,413,419,447,449,450,451,452],[2,320]),o($Va2,[2,321]),o($Va2,[2,322]),o($Va2,$Vb2),o($Va2,[2,324]),o([4,5,8,47,65,67,69,70,71,81,85,90,93,97,98,99,104,105,106,107,108,109,110,111,112,113,114,115,116,117,119,120,122,123,124,126,128,130,136,138,140,142,143,144,145,146,147,149,153,154,155,157,159,161,163,172,180,182,194,195,196,197,198,199,200,201,205,212,215,216,218,233,244,245,246,247,248,249,250,251,252,256,257,264,266,267,268,269,270,271,272,273,274,275,276,277,280,282,283,284,285,287,290,291,294,298,307,319,320,324,325,344,347,348,351,353,355,356,364,365,366,368,372,374,376,383,385,386,388,389,390,391,392,396,397,400,401,413,419,447,449,450,451],[2,325]),{3:346,4:$V1,5:$V2,106:[1,347],259:345},{3:348,4:$V1,5:$V2},o($Va2,[2,330]),o($Va2,[2,331]),{3:349,4:$V1,5:$V2,70:$Vc2,91:351,106:$VN,107:$VO,116:$VQ,126:$VS,155:$VW,170:352,175:354,225:353,254:$V81,255:$V91,256:$Va1,260:$Vd1,367:355,372:$Vh1},{70:[1,356]},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:357,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,262:358,265:359,266:$Vd2,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{70:[1,361]},{70:[1,362]},o($Ve2,[2,563]),{3:377,4:$V1,5:$V2,70:$Vf2,89:372,91:370,106:$VN,107:$VO,116:$VQ,118:367,119:$Vo1,126:$VS,155:$VW,170:369,174:375,175:374,225:371,226:373,254:$V81,255:$V91,256:$Va1,257:$Vb1,260:$Vd1,367:168,368:$Vg1,369:363,370:366,371:368,372:$Vh1,375:364,376:[1,365]},{3:378,4:$V1,5:$V2,174:379},{70:[2,307]},{70:[2,308]},{70:[2,309]},{70:[2,310]},{70:[2,311]},{70:[2,312]},{70:[2,313]},{70:[2,314]},{70:[2,315]},{3:385,4:$V1,5:$V2,106:$Vg2,107:$Vh2,373:380,374:[1,381],377:382},{3:217,4:$V1,5:$V2,173:386},o($Vi1,[2,414]),{203:[1,388],403:387},{203:[2,631]},{3:193,4:$V1,5:$V2,70:$Vj1,107:$Vk1,116:$VQ,118:187,119:$VR,126:$VS,155:$VW,173:188,174:190,175:189,176:191,183:389,186:192,260:$Vd1,367:168,368:$Vg1,372:$Vh1},{36:390,72:67,81:$V6,158:92,163:$Va},o($Vi2,[2,730],{184:391,69:[1,392]}),o($Vj2,[2,163],{3:393,4:$V1,5:$V2,69:[1,394]}),o($Vj2,[2,166],{3:395,4:$V1,5:$V2,69:[1,396]}),o($Vj2,[2,167],{3:397,4:$V1,5:$V2,69:[1,398]}),o($Vj2,[2,170],{3:399,4:$V1,5:$V2,69:[1,400]}),o($Vj2,[2,173],{3:401,4:$V1,5:$V2,69:[1,402]}),o([4,5,8,65,67,69,71,93,104,136,142,143,157,180,182,194,195,196,197,198,199,200,201,202,203,205,218,264,268,450,451],$Vk2,{70:$V92,117:$Vl2}),o([4,5,8,65,67,69,71,93,104,136,142,143,180,182,194,195,196,197,198,199,200,201,202,203,205,218,264,268,450,451],[2,176]),{3:217,4:$V1,5:$V2,173:404},o($Vm2,$Vn2,{74:405,172:$Vo2}),o($Vl1,[2,691]),o($Vp2,[2,696],{86:407,164:[1,408]}),o([8,71,157,264,268,450,451],$Vn2,{367:168,74:409,92:410,3:411,118:433,132:443,134:444,4:$V1,5:$V2,65:$Vq2,69:$Vr2,70:$Vs2,90:$Vt2,93:$Vu2,97:$Vv2,98:$Vw2,99:$Vx2,104:$Vy2,105:$Vz2,106:$VA2,107:$VB2,108:$VC2,109:$VD2,110:$VE2,111:$VF2,112:$VG2,113:$VH2,114:$VI2,115:$VJ2,116:$VK2,117:$VL2,119:$VM2,120:$VN2,122:$VO2,123:$VP2,124:$VQ2,126:$VR2,128:$VS2,130:$VT2,136:$VU2,138:$VV2,140:$VW2,142:$VX2,143:$VY2,144:$VZ2,145:$V_2,146:$V$2,147:$V03,149:$V13,159:$V23,161:$V33,172:$Vo2,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,368:$Vg1,372:$Vh1}),{304:[1,457]},{157:[1,458]},o($VH,[2,531],{90:[1,459]}),{352:[1,460]},{157:[1,461]},o($VH,[2,535],{90:[1,462],157:[1,463]}),{3:217,4:$V1,5:$V2,173:464},{36:465,67:[1,466],72:67,81:$V6,158:92,163:$Va},o($V43,[2,62]),{69:[1,467]},o($VH,[2,603]),{9:98,264:[1,468],450:$VE,451:$VF},o($VH,[2,601]),o($VH,[2,602]),{3:469,4:$V1,5:$V2},o($VH,[2,524]),{120:[1,470]},o([8,67,69,70,71,81,104,120,122,123,128,157,161,163,202,257,264,268,294,307,319,320,324,325,344,348,349,350,450,451],$Vk2,{117:$Vl2}),o($VH,[2,551]),o($VH,[2,554]),o($VH,[2,555]),o($VH,[2,556]),o($VH,$Vb2,{67:[1,471]}),{70:$Vc2,91:351,106:$VN,107:$VO,116:$VQ,126:$VS,155:$VW,170:352,175:354,225:353,254:$V81,255:$V91,256:$Va1,260:$Vd1,367:355,372:$Vh1},o($V53,[2,291]),o($V53,[2,292]),o($V53,[2,293]),o($V53,[2,294]),o($V53,[2,295]),o($V53,[2,296]),o($V53,[2,297]),{70:$V92},o($VH,$V0,{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,48:39,49:40,50:41,51:42,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,72:67,446:88,158:92,3:93,278:322,10:472,4:$V1,5:$V2,47:$V4,65:$V5,81:$V6,90:$VI1,97:$VJ1,98:$VK1,99:$VL1,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,120:$V8,128:$VR1,130:$V9,144:$VS1,145:$VT1,153:$VU1,154:$VV1,163:$Va,233:$Vb,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72,287:$Vc,290:$Vd,291:$Ve,298:$Vf,344:$Vg,347:$Vh,348:$Vi,351:$Vj,353:$Vk,355:$Vl,356:$Vm,364:$Vn,365:$Vo,366:$Vp,383:$Vq,385:$Vr,386:$Vs,388:$Vt,389:$Vu,390:$Vv,391:$Vw,392:$Vx,396:$Vy,397:$Vz,400:$VA,401:$VB,447:$VC,449:$VD}),o($VH,[2,611],{67:$V63}),o($VH,[2,612]),o($V73,[2,318],{278:322,90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72}),o($VH,[2,613],{67:[1,475]}),o($VH,[2,614],{67:[1,476]}),o($VE1,[2,619]),o($VE1,[2,621]),o($VE1,[2,615]),o($VE1,[2,616]),{202:[1,478],378:477,382:[1,479]},{3:480,4:$V1,5:$V2},o($Vi1,[2,592]),o($Vi1,[2,593]),o($VH,[2,553],{278:322,90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72}),{3:93,4:$V1,5:$V2,446:249,448:481},o($VH,[2,682],{67:$V93}),o($V73,[2,684]),o($VH,[2,687]),o($VH,[2,617],{278:322,90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72}),o($Va3,$Vu1,{160:483,169:$Vv1}),o($Va3,$Vu1,{160:484,169:$Vv1}),o($Va3,$Vu1,{160:485,169:$Vv1}),o($Vb3,[2,726],{223:127,174:128,224:129,89:130,222:131,170:132,225:133,91:134,226:135,175:136,176:137,227:138,228:139,229:140,118:141,230:142,51:144,132:146,3:147,367:168,162:486,148:487,221:488,100:489,4:$V1,5:$V2,70:$VM,106:$VN,107:$VO,112:$VP,116:$VQ,119:$VR,126:$VS,128:$VT,153:$VU,154:$VV,155:$VW,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,368:$Vg1,372:$Vh1}),{70:[1,491],106:$VN,170:490},{3:93,4:$V1,5:$V2,446:249,448:492},o($Vx1,[2,131]),o($Vx1,[2,132]),o($Vx1,[2,133]),o($Vx1,[2,134]),o($Vx1,[2,135]),o($Vx1,[2,136]),o($Vx1,[2,137]),o($VG,[2,4]),o($VG,$V0,{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,48:39,49:40,50:41,51:42,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,72:67,446:88,158:92,3:93,10:493,4:$V1,5:$V2,47:$V4,65:$V5,81:$V6,99:$V7,120:$V8,130:$V9,163:$Va,233:$Vb,287:$Vc,290:$Vd,291:$Ve,298:$Vf,344:$Vg,347:$Vh,348:$Vi,351:$Vj,353:$Vk,355:$Vl,356:$Vm,364:$Vn,365:$Vo,366:$Vp,383:$Vq,385:$Vr,386:$Vs,388:$Vt,389:$Vu,390:$Vv,391:$Vw,392:$Vx,396:$Vy,397:$Vz,400:$VA,401:$VB,447:$VC,449:$VD}),{344:[1,497],348:[1,494],349:[1,495],350:[1,496]},{3:498,4:$V1,5:$V2},{3:499,4:$V1,5:$V2},{128:[1,500]},o($Vc3,$VA1,{301:501,130:$VB1}),{202:[1,502]},{3:503,4:$V1,5:$V2},o($VH,[2,665],{67:$Vd3}),{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:505,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},o($V73,[2,668]),o($Ve3,[2,772],{367:168,425:506,118:507,114:[2,776],119:$Vo1,368:$Vg1,372:$Vh1}),{114:[1,508]},o($Vf3,$Vg3,{70:[1,509]}),o($Vh3,[2,786],{435:510,439:511,112:[1,512]}),{114:[2,777]},{3:513,4:$V1,5:$V2},o($Vi1,$VA1,{301:514,130:$VB1}),o($Vi1,$VA1,{301:515,130:$VB1}),o($VH1,[2,433]),o($VH1,[2,434]),{157:[1,516]},{157:[2,771]},o($Vi3,[2,766],{415:517,418:518,112:[1,519]}),o($VD1,[2,765]),{119:$VL,399:520},{4:$Vj3,69:[1,522],236:521,338:$Vk3},o($VH,[2,407],{104:[1,525]}),o($VH,[2,516]),{3:526,4:$V1,5:$V2},{258:[1,527]},o($Vc3,$VF1,{346:528,130:$VG1}),o($VH,[2,530]),{3:217,4:$V1,5:$V2,173:529},{3:217,4:$V1,5:$V2,173:530},o($VG,[2,605],{387:531,268:[1,532]}),{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:533,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:534,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:535,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:536,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:537,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:538,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:539,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:540,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{3:541,4:$V1,5:$V2,70:[1,543],106:$VN,170:542,174:544},{3:545,4:$V1,5:$V2,70:[1,547],106:$VN,170:546,174:548},o($Vl3,[2,391],{223:127,174:128,224:129,89:130,222:131,170:132,225:133,91:134,226:135,175:136,176:137,227:138,228:139,229:140,118:141,230:142,51:144,132:146,3:147,367:168,100:549,4:$V1,5:$V2,70:$VM,106:$VN,107:$VO,112:$VP,116:$VQ,119:$VR,126:$VS,128:$VT,153:$VU,154:$VV,155:$VW,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,368:$Vg1,372:$Vh1}),o($Vl3,[2,392],{223:127,174:128,224:129,89:130,222:131,170:132,225:133,91:134,226:135,175:136,176:137,227:138,228:139,229:140,118:141,230:142,51:144,132:146,3:147,367:168,100:550,4:$V1,5:$V2,70:$VM,106:$VN,107:$VO,112:$VP,116:$VQ,119:$VR,126:$VS,128:$VT,153:$VU,154:$VV,155:$VW,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,368:$Vg1,372:$Vh1}),o($Vl3,[2,393],{223:127,174:128,224:129,89:130,222:131,170:132,225:133,91:134,226:135,175:136,176:137,227:138,228:139,229:140,118:141,230:142,51:144,132:146,3:147,367:168,100:551,4:$V1,5:$V2,70:$VM,106:$VN,107:$VO,112:$VP,116:$VQ,119:$VR,126:$VS,128:$VT,153:$VU,154:$VV,155:$VW,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,368:$Vg1,372:$Vh1}),o($Vl3,[2,394],{223:127,174:128,224:129,89:130,222:131,170:132,225:133,91:134,226:135,175:136,176:137,227:138,228:139,229:140,118:141,230:142,51:144,132:146,3:147,367:168,100:552,4:$V1,5:$V2,70:$VM,106:$VN,107:$VO,112:$VP,116:$VQ,119:$VR,126:$VS,128:$VT,153:$VU,154:$VV,155:$VW,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,368:$Vg1,372:$Vh1}),o($Vl3,$Vm3,{223:127,174:128,224:129,89:130,222:131,170:132,225:133,91:134,226:135,175:136,176:137,227:138,228:139,229:140,118:141,230:142,51:144,132:146,3:147,367:168,100:553,4:$V1,5:$V2,70:$VM,106:$VN,107:$VO,112:$VP,116:$VQ,119:$VR,126:$VS,128:$VT,153:$VU,154:$VV,155:$VW,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,368:$Vg1,372:$Vh1}),{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:554,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:555,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},o($Vl3,[2,396],{223:127,174:128,224:129,89:130,222:131,170:132,225:133,91:134,226:135,175:136,176:137,227:138,228:139,229:140,118:141,230:142,51:144,132:146,3:147,367:168,100:556,4:$V1,5:$V2,70:$VM,106:$VN,107:$VO,112:$VP,116:$VQ,119:$VR,126:$VS,128:$VT,153:$VU,154:$VV,155:$VW,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,368:$Vg1,372:$Vh1}),{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:557,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:558,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{138:[1,560],140:[1,562],279:559,286:[1,561]},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:563,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:564,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{3:377,4:$V1,5:$V2,70:[1,565],89:568,119:$Vn3,174:569,176:567,281:566},{280:[1,571]},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:572,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:573,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:574,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{4:$Vj3,236:575,338:$Vk3},{71:[1,576]},{71:[1,577]},{71:[1,578]},{71:[1,579],90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,278:322,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72},{71:[2,738]},{71:[2,739]},{109:$VJ,110:$VK},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:235,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,125:580,126:$VS,128:$VT,132:146,138:[1,582],153:$VU,154:$VV,155:$VW,159:[1,581],170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},o($Va3,[2,742],{253:583,453:585,71:[1,584],138:[1,587],159:[1,586]}),{3:588,4:$V1,5:$V2,123:$Vo3,154:[1,590]},o([4,5,8,47,65,67,69,70,71,81,85,93,99,104,105,106,107,109,110,112,114,115,116,117,119,120,122,123,124,126,128,130,136,138,140,142,143,144,145,146,147,149,155,157,159,161,163,172,180,182,194,195,196,197,198,199,200,201,205,212,215,216,218,233,244,245,246,247,248,249,250,251,252,256,264,266,267,268,271,272,273,274,275,276,277,280,282,283,285,287,290,291,298,344,347,348,351,353,355,356,364,365,366,368,372,383,385,386,388,389,390,391,392,396,397,400,401,413,419,447,449,450,451],[2,369],{278:322,90:$VI1,97:$VJ1,98:$VK1,108:$VM1,111:$VN1,113:$VO1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,284:$V62}),o($Vp3,[2,370],{278:322,97:$VJ1,98:$VK1,108:$VM1,111:$VN1,113:$VO1,154:$VV1}),o($Vp3,[2,371],{278:322,97:$VJ1,98:$VK1,108:$VM1,111:$VN1,113:$VO1,154:$VV1}),o($Vn1,[2,372],{278:322}),o($Va2,[2,328]),o($Va2,[2,744]),o($Va2,[2,745]),o($Va2,[2,329]),o([4,5,8,47,65,67,69,70,71,81,85,90,93,97,98,99,104,105,106,107,108,109,110,111,112,113,114,115,116,117,119,120,122,123,124,126,128,130,136,138,140,142,143,144,145,146,147,149,153,154,155,157,159,161,163,172,180,182,194,195,196,197,198,199,200,201,202,203,205,212,215,216,218,233,244,245,246,247,248,249,250,251,252,256,264,266,267,268,269,270,271,272,273,274,275,276,277,280,282,283,284,285,287,290,291,298,344,347,348,351,353,355,356,364,365,366,368,372,383,385,386,388,389,390,391,392,396,397,400,401,413,419,447,449,450,451],[2,326]),{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:591,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},o($Ve2,[2,559]),o($Ve2,[2,560]),o($Ve2,[2,561]),o($Ve2,[2,562]),o($Ve2,[2,564]),{36:592,72:67,81:$V6,158:92,163:$Va},{90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,262:593,265:359,266:$Vd2,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,278:322,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72},{263:594,264:$Vq3,265:595,266:$Vd2,268:$Vr3},o($Vs3,[2,335]),{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:597,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:598,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{4:$Vj3,236:599,338:$Vk3},o($Ve2,[2,565]),{67:[1,601],376:[1,600]},o($Ve2,[2,581]),o($Vt3,[2,588]),o($Vu3,[2,566]),o($Vu3,[2,567]),o($Vu3,[2,568]),o($Vu3,[2,569]),o($Vu3,[2,570]),o($Vu3,[2,571]),o($Vu3,[2,572]),o($Vu3,[2,573]),o($Vu3,[2,574]),{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:602,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},o([4,5,8,47,65,67,69,71,81,85,90,93,97,98,99,104,105,106,107,108,109,110,111,112,113,114,115,116,119,120,122,123,124,126,128,130,136,138,140,142,143,144,145,146,147,149,153,154,155,157,159,161,163,172,180,182,194,195,196,197,198,199,200,201,205,212,215,216,218,233,244,245,246,247,248,249,250,251,252,256,264,266,267,268,269,270,271,272,273,274,275,276,277,280,282,283,284,285,287,290,291,298,344,347,348,351,353,355,356,364,365,366,368,372,374,376,383,385,386,388,389,390,391,392,396,397,400,401,413,419,447,449,450,451],$V82,{70:$V92,117:$Vv3}),o($Vw3,[2,285],{70:$V92}),o($Vn1,[2,286]),{67:[1,605],374:[1,604]},o($Ve2,[2,578]),o($Vx3,[2,583]),{126:[1,606]},{126:[1,607]},{126:[1,608]},{36:612,70:[1,611],72:67,81:$V6,123:[1,609],158:92,163:$Va,294:[1,610]},{202:[1,614],404:613},{3:193,4:$V1,5:$V2,70:$Vj1,107:$Vk1,116:$VQ,118:187,119:$VR,126:$VS,155:$VW,173:188,174:190,175:189,176:191,183:615,186:192,260:$Vd1,367:168,368:$Vg1,372:$Vh1},{203:[2,632]},{71:[1,616]},o($Vj2,[2,732],{185:617,3:618,4:$V1,5:$V2}),o($Vi2,[2,731]),o($Vj2,[2,161]),{3:619,4:$V1,5:$V2},o($Vj2,[2,164]),{3:620,4:$V1,5:$V2},o($Vj2,[2,168]),{3:621,4:$V1,5:$V2},o($Vj2,[2,171]),{3:622,4:$V1,5:$V2},o($Vj2,[2,174]),{3:623,4:$V1,5:$V2},{3:624,4:$V1,5:$V2},{122:[1,625]},o($Vy3,[2,150],{75:626,157:[1,627]}),{3:193,4:$V1,5:$V2,107:[1,632],116:$VQ,119:[1,633],126:$VS,155:$VW,173:628,174:629,175:630,176:631,260:$Vd1},{3:638,4:$V1,5:$V2,87:634,88:635,89:636,90:$Vz3},o($Vp2,[2,697]),o($VA3,[2,694],{83:639,156:640,157:[1,641]}),o($Vm1,[2,693],{127:642,153:$VB3,154:$VC3,155:$VD3}),o([4,5,8,65,67,69,71,90,93,97,98,99,104,105,106,107,108,109,110,111,112,113,114,115,116,117,119,120,122,123,124,126,128,130,136,138,140,142,143,144,145,146,147,149,153,154,155,157,159,161,172,244,245,246,247,248,249,250,251,252,264,268,368,372,450,451],[2,71],{70:[1,646]}),{94:[1,647]},{3:648,4:$V1,5:$V2},o($VE3,[2,75]),{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:649,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:650,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{3:411,4:$V1,5:$V2,65:$Vq2,69:$Vr2,70:$Vs2,90:$Vt2,92:652,93:$Vu2,97:$Vv2,98:$Vw2,99:$Vx2,101:651,104:$Vy2,105:$Vz2,106:$VA2,107:$VB2,108:$VC2,109:$VD2,110:$VE2,111:$VF2,112:$VG2,113:$VH2,114:$VI2,115:$VJ2,116:$VK2,117:$VL2,118:433,119:$VM2,120:$VN2,122:$VO2,123:$VP2,124:$VQ2,126:$VR2,128:$VS2,130:$VT2,132:443,134:444,136:$VU2,138:$VV2,140:$VW2,142:$VX2,143:$VY2,144:$VZ2,145:$V_2,146:$V$2,147:$V03,149:$V13,159:$V23,161:$V33,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,367:168,368:$Vg1,372:$Vh1},{70:[1,653]},{70:[1,654]},{70:[1,655]},o($VE3,[2,83]),o($VE3,[2,84]),o($VE3,[2,85]),o($VE3,[2,86]),o($VE3,[2,87]),o($VE3,[2,88]),{3:656,4:$V1,5:$V2},{3:657,4:$V1,5:$V2,108:[1,658]},o($VE3,[2,92]),o($VE3,[2,93]),o($VE3,[2,94]),{117:[1,659]},o($VE3,[2,96]),{3:660,4:$V1,5:$V2,70:$Vc2,91:351,106:$VN,107:$VO,116:$VQ,126:$VS,155:$VW,170:352,175:354,225:353,254:$V81,255:$V91,256:$Va1,260:$Vd1,367:355,372:$Vh1},{119:[1,661]},{70:[1,662]},{119:[1,663]},o($VE3,[2,101]),{70:[1,664]},{3:665,4:$V1,5:$V2},{70:[1,666]},{70:[1,667]},{70:[1,668]},{70:[1,669]},{70:[1,670],138:[1,671]},{70:[1,672]},{70:[1,673]},{70:[1,674]},{70:[1,675]},{70:[1,676]},{70:[1,677]},{70:[1,678]},{70:[1,679]},{70:[1,680]},{70:[2,712]},{70:[2,713]},{3:217,4:$V1,5:$V2,173:681},{3:217,4:$V1,5:$V2,173:682},{91:683,107:$VO,256:$Va1},o($VH,[2,533],{90:[1,684]}),{3:217,4:$V1,5:$V2,173:685},{91:686,107:$VO,256:$Va1},{3:687,4:$V1,5:$V2},o($VH,[2,629]),o($VH,[2,60]),{3:209,4:$V1,5:$V2,68:688},{70:[1,689]},o($VH,[2,610]),o($VH,[2,523]),{3:638,4:$V1,5:$V2,89:692,116:$VF3,119:$VG3,121:690,288:691,289:693},{118:696,119:$Vo1,367:168,368:$Vg1,372:$Vh1},o($VH,[2,607]),{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:697,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},o($Vl3,$Vm3,{223:127,174:128,224:129,89:130,222:131,170:132,225:133,91:134,226:135,175:136,176:137,227:138,228:139,229:140,118:141,230:142,51:144,132:146,3:147,367:168,100:698,4:$V1,5:$V2,70:$VM,106:$VN,107:$VO,112:$VP,116:$VQ,119:$VR,126:$VS,128:$VT,153:$VU,154:$VV,155:$VW,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,368:$Vg1,372:$Vh1}),{91:699,107:$VO,256:$Va1},{3:241,4:$V1,5:$V2,395:700,396:$Vq1},o($VH,[2,589]),o($VH,[2,599]),o($VH,[2,600]),{97:[1,703],99:[1,701],380:702},o($VH,[2,681],{67:$V93}),{3:93,4:$V1,5:$V2,446:704},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:489,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,148:705,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,221:488,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:489,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,148:706,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,221:488,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:489,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,148:707,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,221:488,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},o($Vb3,[2,129]),o($Vb3,[2,727],{67:$VH3}),o($VI3,[2,248]),o($VI3,[2,255],{278:322,3:710,91:712,4:$V1,5:$V2,69:[1,709],90:$VI1,97:$VJ1,98:$VK1,99:$V83,106:[1,711],107:$VO,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,256:$Va1,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72}),o($Vt1,[2,728],{171:713,452:[1,714]}),{106:$VN,170:715},{67:$V93,71:[1,716]},o($VG,[2,8]),{122:[1,717],164:[1,718]},{164:[1,719]},{164:[1,720]},{164:[1,721]},o($VH,[2,512],{69:[1,723],70:[1,722]}),o($VH,[2,517]),{258:[1,724]},{3:725,4:$V1,5:$V2,91:726,107:$VO,256:$Va1},{3:217,4:$V1,5:$V2,173:727},{202:[1,728]},o([8,67,69,71,107,112,114,126,264,268,368,372,450,451],$VC1,{424:277,427:278,3:279,434:280,431:281,379:282,423:729,4:$V1,5:$V2,116:$Vr1,119:$Vs1}),o($VH,[2,666],{278:322,90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72}),o($V73,[2,774],{426:730,432:731,69:$VJ3}),o($Ve3,[2,773]),o([69,107,112,114,119,126,368,372],$VC1,{434:280,424:733,3:734,4:$V1,5:$V2}),o([67,69,71,107,112,114,126,368,372],$VC1,{423:276,424:277,427:278,3:279,434:280,431:281,379:282,422:735,4:$V1,5:$V2,116:$Vr1,119:$Vs1}),o($VK3,[2,788],{436:736,107:[1,737]}),o($Vh3,[2,787]),{3:738,4:$V1,5:$V2,106:[1,739]},o($VL3,[2,672]),{3:217,4:$V1,5:$V2,173:740},{3:217,4:$V1,5:$V2,173:741},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:742,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},o($VM3,[2,768],{416:743,91:744,107:$VO,256:$Va1}),o($Vi3,[2,767]),{3:745,4:$V1,5:$V2},o($VE1,[2,624]),o($VE1,[2,625],{99:[1,746]}),{4:$Vj3,236:747,338:$Vk3},o([5,8,47,65,67,69,71,81,85,90,93,97,98,99,104,105,106,107,108,109,110,111,112,113,114,115,116,117,119,120,122,123,124,126,128,130,136,138,140,142,143,144,145,146,147,149,153,154,155,157,159,161,163,172,180,182,194,195,196,197,198,199,200,201,205,212,215,216,218,233,244,245,246,247,248,249,250,251,252,256,257,264,266,267,268,269,270,271,272,273,274,275,276,277,280,282,283,284,285,287,290,291,294,298,307,319,320,324,325,344,347,348,351,353,355,356,364,365,366,368,372,383,385,386,388,389,390,391,392,396,397,400,401,413,419,447,449,450,451],[2,482],{4:[1,749],70:[1,748]}),{70:[1,750]},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:751,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},o($VH,[2,525]),o($Vc3,[2,505]),{3:752,4:$V1,5:$V2,91:753,107:$VO,256:$Va1},o($VH,[2,503]),o($VH,[2,550]),o($VH,[2,604]),o($VH,$V0,{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,48:39,49:40,50:41,51:42,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,72:67,446:88,158:92,3:93,10:754,4:$V1,5:$V2,47:$V4,65:$V5,81:$V6,99:$V7,120:$V8,130:$V9,163:$Va,233:$Vb,287:$Vc,290:$Vd,291:$Ve,298:$Vf,344:$Vg,347:$Vh,348:$Vi,351:$Vj,353:$Vk,355:$Vl,356:$Vm,364:$Vn,365:$Vo,366:$Vp,383:$Vq,385:$Vr,386:$Vs,388:$Vt,389:$Vu,390:$Vv,391:$Vw,392:$Vx,396:$Vy,397:$Vz,400:$VA,401:$VB,447:$VC,449:$VD}),o($VN3,[2,339],{278:322,97:$VJ1,98:$VK1,108:$VM1,111:$VN1,113:$VO1,153:$VU1,154:$VV1,270:$VX1}),o($VN3,[2,340],{278:322,97:$VJ1,98:$VK1,108:$VM1,111:$VN1,113:$VO1,153:$VU1,154:$VV1,270:$VX1}),o($Vp3,[2,341],{278:322,97:$VJ1,98:$VK1,108:$VM1,111:$VN1,113:$VO1,154:$VV1}),o($Vp3,[2,342],{278:322,97:$VJ1,98:$VK1,108:$VM1,111:$VN1,113:$VO1,154:$VV1}),o($VO3,[2,343],{278:322,97:$VJ1,98:$VK1,111:$VN1}),o($VO3,[2,344],{278:322,97:$VJ1,98:$VK1,111:$VN1}),o($VO3,[2,345],{278:322,97:$VJ1,98:$VK1,111:$VN1}),o([4,5,8,47,65,67,69,70,71,81,85,90,93,98,99,104,105,106,107,108,109,110,112,113,114,115,116,117,119,120,122,123,124,126,128,130,136,138,140,142,143,144,145,146,147,149,153,154,155,157,159,161,163,172,180,182,194,195,196,197,198,199,200,201,205,212,215,216,218,233,244,245,246,247,248,249,250,251,252,256,264,266,267,268,269,270,271,272,273,274,275,276,277,280,282,283,284,285,287,290,291,298,344,347,348,351,353,355,356,364,365,366,368,372,383,385,386,388,389,390,391,392,396,397,400,401,413,419,447,449,450,451],[2,346],{278:322,97:$VJ1,111:$VN1}),o($Vw3,[2,347],{70:$V92}),o($Vn1,[2,348]),{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:755,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},o($Vn1,[2,350]),o($Vw3,[2,351],{70:$V92}),o($Vn1,[2,352]),{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:756,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},o($Vn1,[2,354]),o($VP3,[2,355],{278:322,90:$VI1,97:$VJ1,98:$VK1,108:$VM1,111:$VN1,113:$VO1,128:$VR1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,280:$V32,284:$V62}),o($VP3,[2,356],{278:322,90:$VI1,97:$VJ1,98:$VK1,108:$VM1,111:$VN1,113:$VO1,128:$VR1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,280:$V32,284:$V62}),o($VP3,[2,357],{278:322,90:$VI1,97:$VJ1,98:$VK1,108:$VM1,111:$VN1,113:$VO1,128:$VR1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,280:$V32,284:$V62}),o($VP3,[2,358],{278:322,90:$VI1,97:$VJ1,98:$VK1,108:$VM1,111:$VN1,113:$VO1,128:$VR1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,280:$V32,284:$V62}),o([4,5,8,47,65,81,99,114,115,120,130,144,145,163,233,264,268,271,272,273,274,275,276,277,282,283,285,287,290,291,298,344,347,348,351,353,355,356,364,365,366,383,385,386,388,389,390,391,392,396,397,400,401,447,449,450,451],$VQ3,{278:322,90:$VI1,97:$VJ1,98:$VK1,108:$VM1,111:$VN1,113:$VO1,128:$VR1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,280:$V32,284:$V62}),o($VP3,[2,360],{278:322,90:$VI1,97:$VJ1,98:$VK1,108:$VM1,111:$VN1,113:$VO1,128:$VR1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,280:$V32,284:$V62}),o($VP3,[2,361],{278:322,90:$VI1,97:$VJ1,98:$VK1,108:$VM1,111:$VN1,113:$VO1,128:$VR1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,280:$V32,284:$V62}),o($VP3,[2,362],{278:322,90:$VI1,97:$VJ1,98:$VK1,108:$VM1,111:$VN1,113:$VO1,128:$VR1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,280:$V32,284:$V62}),o($VP3,[2,363],{278:322,90:$VI1,97:$VJ1,98:$VK1,108:$VM1,111:$VN1,113:$VO1,128:$VR1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,280:$V32,284:$V62}),o($VP3,[2,364],{278:322,90:$VI1,97:$VJ1,98:$VK1,108:$VM1,111:$VN1,113:$VO1,128:$VR1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,280:$V32,284:$V62}),{70:[1,757]},{70:[2,397]},{70:[2,398]},{70:[2,399]},o($VR3,[2,367],{278:322,90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,280:$V32,284:$V62}),o([4,5,8,47,65,67,69,70,71,81,85,93,104,105,106,107,109,110,112,116,117,119,120,122,123,124,126,130,136,138,140,142,143,145,146,147,149,155,157,159,161,163,172,180,182,194,195,196,197,198,199,200,201,205,212,215,216,218,233,244,245,246,247,248,249,250,251,252,256,264,266,267,268,285,287,290,291,298,344,347,348,351,353,355,356,364,365,366,368,372,383,385,386,388,389,390,391,392,396,397,400,401,413,419,447,449,450,451],[2,368],{278:322,90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,280:$V32,282:$V42,283:$V52,284:$V62}),{3:147,4:$V1,5:$V2,36:758,51:144,70:$VM,71:[1,760],72:67,81:$V6,89:130,91:134,100:235,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,125:759,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,158:92,163:$Va,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},o($Vn1,[2,380]),o($Vn1,[2,382]),o($Vn1,[2,388]),o($Vn1,[2,389]),{3:349,4:$V1,5:$V2,70:[1,761]},{3:377,4:$V1,5:$V2,70:[1,762],89:568,119:$Vn3,174:569,176:764,281:763},o($VR3,[2,384],{278:322,90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,280:$V32,284:$V62}),o($VR3,[2,385],{278:322,90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,280:$V32,284:$V62}),o([4,5,8,47,65,67,69,70,71,81,85,93,99,104,105,106,107,109,110,112,114,115,116,117,119,120,122,123,124,126,128,130,136,138,140,142,143,144,145,146,147,149,155,157,159,161,163,172,180,182,194,195,196,197,198,199,200,201,205,212,215,216,218,233,244,245,246,247,248,249,250,251,252,256,264,266,267,268,271,272,273,274,275,276,277,280,282,283,284,285,287,290,291,298,344,347,348,351,353,355,356,364,365,366,368,372,383,385,386,388,389,390,391,392,396,397,400,401,413,419,447,449,450,451],[2,386],{278:322,90:$VI1,97:$VJ1,98:$VK1,108:$VM1,111:$VN1,113:$VO1,153:$VU1,154:$VV1,269:$VW1,270:$VX1}),o($Vn1,[2,387]),o($Vn1,[2,279]),o($Vn1,[2,280]),o($Vn1,[2,281]),o($Vn1,[2,373]),{67:$V63,71:[1,765]},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:766,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:767,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:235,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,125:768,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},o($Va2,[2,317]),o($Va3,[2,743]),o($Va3,[2,740]),o($Va3,[2,741]),o($Vn1,$VS3),o($VT3,[2,261]),o($Vn1,[2,257]),{71:[1,770],90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,278:322,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72},{71:[1,771]},{263:772,264:$Vq3,265:595,266:$Vd2,268:$Vr3},{264:[1,773]},o($Vs3,[2,334]),{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:774,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,267:[1,775],269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,278:322,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72},{69:[1,776],90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,278:322,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72},{67:[1,777]},o($Ve2,[2,579]),{3:377,4:$V1,5:$V2,70:$Vf2,89:372,91:370,106:$VN,107:$VO,116:$VQ,118:367,119:$Vo1,126:$VS,155:$VW,170:369,174:375,175:374,225:371,226:373,254:$V81,255:$V91,256:$Va1,257:$Vb1,260:$Vd1,367:168,368:$Vg1,370:779,371:368,372:$Vh1,376:[1,778]},{71:[1,780],90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,278:322,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72},{3:781,4:$V1,5:$V2,123:$Vo3},o($Ve2,[2,576]),{3:385,4:$V1,5:$V2,106:$Vg2,107:$Vh2,374:[1,782],377:783},{3:377,4:$V1,5:$V2,70:$Vf2,89:372,91:370,106:$VN,107:$VO,116:$VQ,118:367,119:$Vo1,126:$VS,155:$VW,170:369,174:375,175:374,225:371,226:373,254:$V81,255:$V91,256:$Va1,257:$Vb1,260:$Vd1,367:168,368:$Vg1,370:784,371:368,372:$Vh1},{3:377,4:$V1,5:$V2,70:$Vf2,89:372,91:370,106:$VN,107:$VO,116:$VQ,118:367,119:$Vo1,126:$VS,155:$VW,170:369,174:375,175:374,225:371,226:373,254:$V81,255:$V91,256:$Va1,257:$Vb1,260:$Vd1,367:168,368:$Vg1,370:785,371:368,372:$Vh1},{3:377,4:$V1,5:$V2,70:$Vf2,89:372,91:370,106:$VN,107:$VO,116:$VQ,118:367,119:$Vo1,126:$VS,155:$VW,170:369,174:375,175:374,225:371,226:373,254:$V81,255:$V91,256:$Va1,257:$Vb1,260:$Vd1,367:168,368:$Vg1,370:786,371:368,372:$Vh1},{70:$VU3,116:$VQ,118:789,119:$Vo1,126:$VS,155:$VW,175:790,260:$Vd1,293:787,367:168,368:$Vg1,372:$Vh1},{123:[1,791]},{3:638,4:$V1,5:$V2,89:793,204:792},o($VV3,[2,411]),{266:$VW3,405:794,407:795,408:796},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:798,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{202:[2,633]},o($Vj2,[2,159],{3:799,4:$V1,5:$V2,69:[1,800]}),o($Vj2,[2,160]),o($Vj2,[2,733]),o($Vj2,[2,162]),o($Vj2,[2,165]),o($Vj2,[2,169]),o($Vj2,[2,172]),o($Vj2,[2,175]),o([4,5,8,65,67,69,70,71,81,93,104,120,122,123,128,136,142,143,157,161,163,180,182,194,195,196,197,198,199,200,201,202,203,205,218,257,264,268,294,307,319,320,324,325,344,348,349,350,450,451],[2,177]),{3:801,4:$V1,5:$V2},o($VX3,[2,214],{76:802,104:[1,803]}),{3:193,4:$V1,5:$V2,70:[1,805],107:$Vk1,116:$VQ,118:187,119:$VR,126:$VS,155:$VW,173:188,174:190,175:189,176:191,177:804,183:806,186:192,260:$Vd1,367:168,368:$Vg1,372:$Vh1},o($Vm2,[2,142]),o($Vm2,[2,143]),o($Vm2,[2,144]),o($Vm2,[2,145]),o($Vm2,[2,146]),{3:349,4:$V1,5:$V2},o($Vl1,[2,66],{67:[1,807]}),o($VY3,[2,68]),o($VY3,[2,69]),{91:808,107:$VO,256:$Va1},o([8,65,67,71,93,99,104,136,142,143,157,172,180,182,194,195,196,197,198,199,200,201,205,218,264,268,450,451],$V82,{117:$Vv3}),o($VA3,[2,65]),o($VA3,[2,695]),{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:809,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},o($VE3,[2,104]),o($VE3,[2,122]),o($VE3,[2,123]),o($VE3,[2,124]),{3:147,4:$V1,5:$V2,51:144,70:$VM,71:[2,704],89:130,91:134,100:235,103:810,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,125:811,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{70:[1,812]},o($VE3,[2,74]),o([4,5,8,65,67,69,70,71,93,99,104,105,106,107,109,110,112,114,115,116,117,119,120,122,123,124,126,130,136,138,140,142,143,144,145,146,147,149,155,157,159,161,172,244,245,246,247,248,249,250,251,252,264,268,368,372,450,451],[2,76],{278:322,90:$VI1,97:$VJ1,98:$VK1,108:$VM1,111:$VN1,113:$VO1,128:$VR1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72}),o([4,5,8,65,67,69,70,71,90,93,99,104,105,106,107,109,110,112,114,115,116,117,119,120,122,123,124,126,128,130,136,138,140,142,143,144,145,146,147,149,155,157,159,161,172,244,245,246,247,248,249,250,251,252,264,268,368,372,450,451],[2,77],{278:322,97:$VJ1,98:$VK1,108:$VM1,111:$VN1,113:$VO1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72}),{3:411,4:$V1,5:$V2,65:$Vq2,69:$Vr2,70:$Vs2,71:[1,813],90:$Vt2,92:814,93:$Vu2,97:$Vv2,98:$Vw2,99:$Vx2,104:$Vy2,105:$Vz2,106:$VA2,107:$VB2,108:$VC2,109:$VD2,110:$VE2,111:$VF2,112:$VG2,113:$VH2,114:$VI2,115:$VJ2,116:$VK2,117:$VL2,118:433,119:$VM2,120:$VN2,122:$VO2,123:$VP2,124:$VQ2,126:$VR2,128:$VS2,130:$VT2,132:443,134:444,136:$VU2,138:$VV2,140:$VW2,142:$VX2,143:$VY2,144:$VZ2,145:$V_2,146:$V$2,147:$V03,149:$V13,159:$V23,161:$V33,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,367:168,368:$Vg1,372:$Vh1},o($VZ3,[2,700],{127:642,153:$VB3,154:$VC3,155:$VD3}),{3:411,4:$V1,5:$V2,65:$Vq2,69:$Vr2,70:$Vs2,90:$Vt2,92:816,93:$Vu2,97:$Vv2,98:$Vw2,99:$Vx2,102:815,104:$Vy2,105:$Vz2,106:$VA2,107:$VB2,108:$VC2,109:$VD2,110:$VE2,111:$VF2,112:$VG2,113:$VH2,114:$VI2,115:$VJ2,116:$VK2,117:$VL2,118:433,119:$VM2,120:$VN2,122:$VO2,123:$VP2,124:$VQ2,126:$VR2,128:$VS2,130:$VT2,132:443,134:444,136:$VU2,138:$VV2,140:$VW2,142:$VX2,143:$VY2,144:$VZ2,145:$V_2,146:$V$2,147:$V03,149:$V13,159:$V23,161:$V33,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,367:168,368:$Vg1,372:$Vh1},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:817,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{3:818,4:$V1,5:$V2},o($VE3,[2,89]),o($VE3,[2,90]),o($VE3,[2,91]),o($VE3,[2,95]),o($VE3,[2,97]),{3:819,4:$V1,5:$V2},{3:638,4:$V1,5:$V2,89:692,116:$VF3,119:$VG3,121:820,288:691,289:693},{3:821,4:$V1,5:$V2},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:235,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,125:822,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},o($VE3,[2,103]),o($VZ3,[2,706],{129:823}),o($VZ3,[2,708],{131:824}),o($VZ3,[2,710],{133:825}),o($VZ3,[2,714],{135:826}),o($V_3,$V$3,{137:827,152:828}),{70:[1,829]},o($VZ3,[2,716],{139:830}),o($VZ3,[2,718],{141:831}),o($V_3,$V$3,{152:828,137:832}),o($V_3,$V$3,{152:828,137:833}),o($V_3,$V$3,{152:828,137:834}),o($V_3,$V$3,{152:828,137:835}),{3:411,4:$V1,5:$V2,65:$Vq2,69:$Vr2,70:$Vs2,90:$Vt2,92:836,93:$Vu2,97:$Vv2,98:$Vw2,99:$Vx2,104:$Vy2,105:$Vz2,106:$VA2,107:$VB2,108:$VC2,109:$VD2,110:$VE2,111:$VF2,112:$VG2,113:$VH2,114:$VI2,115:$VJ2,116:$VK2,117:$VL2,118:433,119:$VM2,120:$VN2,122:$VO2,123:$VP2,124:$VQ2,126:$VR2,128:$VS2,130:$VT2,132:443,134:444,136:$VU2,138:$VV2,140:$VW2,142:$VX2,143:$VY2,144:$VZ2,145:$V_2,146:$V$2,147:$V03,149:$V13,159:$V23,161:$V33,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,367:168,368:$Vg1,372:$Vh1},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:489,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,148:837,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,221:488,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},o($V04,[2,720],{150:838}),o($VH,[2,543],{157:[1,839]}),o($VH,[2,539],{157:[1,840]}),o($VH,[2,532]),{91:841,107:$VO,256:$Va1},o($VH,[2,541],{157:[1,842]}),o($VH,[2,536]),o($VH,[2,537],{90:[1,843]}),o($V43,[2,61]),{36:844,72:67,81:$V6,158:92,163:$Va},o($VH,[2,401],{67:$V14,104:[1,845]}),o($V24,[2,402]),{99:[1,847]},{3:848,4:$V1,5:$V2},o($Vi1,[2,746]),o($Vi1,[2,747]),o($VH,[2,557]),o($V73,[2,319],{278:322,90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72}),o($VP3,$VQ3,{278:322,90:$VI1,97:$VJ1,98:$VK1,108:$VM1,111:$VN1,113:$VO1,128:$VR1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,280:$V32,284:$V62}),o($VE1,[2,618]),o($VE1,[2,620]),{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:849,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{97:[1,851],99:[1,850]},{3:853,4:$V1,5:$V2,70:$V34,106:$V44,381:852},o($V73,[2,683]),o($Vb3,[2,126],{67:$VH3}),o($Vb3,[2,127],{67:$VH3}),o($Vb3,[2,128],{67:$VH3}),{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:489,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,221:856,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{3:857,4:$V1,5:$V2,91:859,106:[1,858],107:$VO,256:$Va1},o($VI3,[2,250]),o($VI3,[2,252]),o($VI3,[2,254]),o($Vt1,[2,138]),o($Vt1,[2,729]),{71:[1,860]},o($Vw1,[2,686]),{3:861,4:$V1,5:$V2},{3:862,4:$V1,5:$V2},{3:864,4:$V1,5:$V2,334:863},{3:864,4:$V1,5:$V2,334:865},{3:866,4:$V1,5:$V2},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:235,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,125:867,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{3:868,4:$V1,5:$V2},o($Vc3,[2,445]),o($VH,$V54,{354:869,69:$V64,70:[1,870]}),o($VH,$V54,{354:872,69:$V64}),{70:[1,873]},{3:217,4:$V1,5:$V2,173:874},o($V73,[2,667]),o($V73,[2,669]),o($V73,[2,775]),{116:$Vr1,119:$Vs1,379:875},o($V74,[2,778],{367:168,428:876,118:877,119:$Vo1,368:$Vg1,372:$Vh1}),o($Vf3,$Vg3),{67:$Vd3,71:[1,878]},o($V84,[2,790],{437:879,438:880,126:[1,881]}),o($VK3,[2,789]),o($Vh3,[2,677]),o($Vh3,[2,678]),o($VH,[2,432],{70:[1,882]}),{69:[1,884],70:[1,883]},{90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,122:[1,885],128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,278:322,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72},o($VV3,$V94,{72:67,158:92,417:886,36:889,81:$V6,120:$Va4,163:$Va,419:$Vb4}),o($VM3,[2,769]),o($Vi3,[2,659]),{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:890,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},o($VE1,[2,626],{99:[1,891]}),{106:$Vc4,247:$Vd4,337:892},o([4,5,8,47,65,67,69,71,81,85,90,93,97,98,99,104,105,106,107,108,109,110,111,112,113,114,115,116,117,119,120,122,123,124,126,128,130,136,138,140,142,143,144,145,146,147,149,153,154,155,157,159,161,163,172,180,182,194,195,196,197,198,199,200,201,205,212,215,216,218,233,244,245,246,247,248,249,250,251,252,256,257,264,266,267,268,269,270,271,272,273,274,275,276,277,280,282,283,284,285,287,290,291,294,298,307,319,320,324,325,344,347,348,351,353,355,356,364,365,366,368,372,383,385,386,388,389,390,391,392,396,397,400,401,413,419,447,449,450,451],[2,483],{70:[1,895]}),{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:897,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,295:896,367:168,368:$Vg1,372:$Vh1},o($VH,[2,406],{278:322,90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72}),o($VH,[2,526]),o($VH,[2,527]),o($VH,[2,606]),{71:[1,898],90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,278:322,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72},{71:[1,899],90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,278:322,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72},{3:147,4:$V1,5:$V2,36:900,51:144,70:$VM,72:67,81:$V6,89:130,91:134,100:235,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,125:901,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,158:92,163:$Va,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{71:[1,902]},{67:$V63,71:[1,903]},o($Vn1,[2,378]),{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:904,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{3:147,4:$V1,5:$V2,36:905,51:144,70:$VM,71:[1,907],72:67,81:$V6,89:130,91:134,100:235,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,125:906,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,158:92,163:$Va,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},o($Vn1,[2,381]),o($Vn1,[2,383]),o($Vn1,$Ve4,{239:908,240:$Vf4}),{71:[1,910],90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,278:322,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72},{71:[1,911],90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,278:322,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72},{67:$V63,71:[1,912]},{3:913,4:$V1,5:$V2,154:[1,914]},o($Ve2,[2,558]),o($Vn1,[2,327]),{264:[1,915]},o($Vn1,[2,333]),{90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,264:[2,337],269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,278:322,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:916,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{4:$Vj3,236:917,338:$Vk3},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:918,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},o($Ve2,[2,580]),o($Vt3,[2,587]),o($Vu3,[2,575]),o($VT3,$VS3),o($Ve2,[2,577]),o($Vx3,[2,582]),o($Vx3,[2,584]),o($Vx3,[2,585]),o($Vx3,[2,586]),o($VV3,[2,408],{67:$Vg4}),{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:897,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,295:921,367:168,368:$Vg1,372:$Vh1},o($Vh4,[2,416]),o($Vh4,[2,417]),o($VV3,[2,409]),{67:$Vi4,71:[1,922]},o($Vj4,[2,429]),o($VH,[2,653],{406:924,407:925,408:926,266:$VW3,413:[1,927]}),o($Vk4,[2,637]),o($Vk4,[2,638]),{128:[1,929],409:[1,928]},{90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,266:[2,634],269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,278:322,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72},o($Vj2,[2,157]),{3:930,4:$V1,5:$V2},o($VH,[2,511]),o($Vl4,[2,216],{77:931,205:[1,932]}),{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:933,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},o($Vy3,[2,147],{178:934,187:936,179:937,188:938,193:941,67:$Vm4,180:$Vn4,182:$Vo4,194:$Vp4,195:$Vq4,196:$Vr4,197:$Vs4,198:$Vt4,199:$Vu4,200:$Vv4,201:$Vw4}),{3:193,4:$V1,5:$V2,36:390,70:$Vj1,72:67,81:$V6,107:$Vk1,116:$VQ,118:187,119:$VR,126:$VS,155:$VW,158:92,163:$Va,173:188,174:190,175:189,176:191,177:950,183:806,186:192,260:$Vd1,367:168,368:$Vg1,372:$Vh1},o($Vj4,[2,155]),{3:638,4:$V1,5:$V2,88:951,89:636,90:$Vz3},o($VY3,[2,70]),o($VA3,[2,125],{278:322,90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72}),{71:[1,952]},{67:$V63,71:[2,705]},{3:147,4:$V1,5:$V2,51:144,70:$VM,71:[2,698],89:130,91:134,95:953,96:954,100:957,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,214:955,215:[1,956],222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},o($VE3,[2,78]),o($VZ3,[2,701],{127:642,153:$VB3,154:$VC3,155:$VD3}),{3:411,4:$V1,5:$V2,65:$Vq2,69:$Vr2,70:$Vs2,71:[1,958],90:$Vt2,92:959,93:$Vu2,97:$Vv2,98:$Vw2,99:$Vx2,104:$Vy2,105:$Vz2,106:$VA2,107:$VB2,108:$VC2,109:$VD2,110:$VE2,111:$VF2,112:$VG2,113:$VH2,114:$VI2,115:$VJ2,116:$VK2,117:$VL2,118:433,119:$VM2,120:$VN2,122:$VO2,123:$VP2,124:$VQ2,126:$VR2,128:$VS2,130:$VT2,132:443,134:444,136:$VU2,138:$VV2,140:$VW2,142:$VX2,143:$VY2,144:$VZ2,145:$V_2,146:$V$2,147:$V03,149:$V13,159:$V23,161:$V33,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,367:168,368:$Vg1,372:$Vh1},o($VZ3,[2,702],{127:642,153:$VB3,154:$VC3,155:$VD3}),{71:[1,960],90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,278:322,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72},{71:[1,961]},o($VE3,[2,98]),{67:$V14,71:[1,962]},o($VE3,[2,100]),{67:$V63,71:[1,963]},{3:411,4:$V1,5:$V2,65:$Vq2,69:$Vr2,70:$Vs2,71:[1,964],90:$Vt2,92:965,93:$Vu2,97:$Vv2,98:$Vw2,99:$Vx2,104:$Vy2,105:$Vz2,106:$VA2,107:$VB2,108:$VC2,109:$VD2,110:$VE2,111:$VF2,112:$VG2,113:$VH2,114:$VI2,115:$VJ2,116:$VK2,117:$VL2,118:433,119:$VM2,120:$VN2,122:$VO2,123:$VP2,124:$VQ2,126:$VR2,128:$VS2,130:$VT2,132:443,134:444,136:$VU2,138:$VV2,140:$VW2,142:$VX2,143:$VY2,144:$VZ2,145:$V_2,146:$V$2,147:$V03,149:$V13,159:$V23,161:$V33,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,367:168,368:$Vg1,372:$Vh1},{3:411,4:$V1,5:$V2,65:$Vq2,69:$Vr2,70:$Vs2,71:[1,966],90:$Vt2,92:967,93:$Vu2,97:$Vv2,98:$Vw2,99:$Vx2,104:$Vy2,105:$Vz2,106:$VA2,107:$VB2,108:$VC2,109:$VD2,110:$VE2,111:$VF2,112:$VG2,113:$VH2,114:$VI2,115:$VJ2,116:$VK2,117:$VL2,118:433,119:$VM2,120:$VN2,122:$VO2,123:$VP2,124:$VQ2,126:$VR2,128:$VS2,130:$VT2,132:443,134:444,136:$VU2,138:$VV2,140:$VW2,142:$VX2,143:$VY2,144:$VZ2,145:$V_2,146:$V$2,147:$V03,149:$V13,159:$V23,161:$V33,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,367:168,368:$Vg1,372:$Vh1},{3:411,4:$V1,5:$V2,65:$Vq2,69:$Vr2,70:$Vs2,71:[1,968],90:$Vt2,92:969,93:$Vu2,97:$Vv2,98:$Vw2,99:$Vx2,104:$Vy2,105:$Vz2,106:$VA2,107:$VB2,108:$VC2,109:$VD2,110:$VE2,111:$VF2,112:$VG2,113:$VH2,114:$VI2,115:$VJ2,116:$VK2,117:$VL2,118:433,119:$VM2,120:$VN2,122:$VO2,123:$VP2,124:$VQ2,126:$VR2,128:$VS2,130:$VT2,132:443,134:444,136:$VU2,138:$VV2,140:$VW2,142:$VX2,143:$VY2,144:$VZ2,145:$V_2,146:$V$2,147:$V03,149:$V13,159:$V23,161:$V33,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,367:168,368:$Vg1,372:$Vh1},{3:411,4:$V1,5:$V2,65:$Vq2,69:$Vr2,70:$Vs2,71:[1,970],90:$Vt2,92:971,93:$Vu2,97:$Vv2,98:$Vw2,99:$Vx2,104:$Vy2,105:$Vz2,106:$VA2,107:$VB2,108:$VC2,109:$VD2,110:$VE2,111:$VF2,112:$VG2,113:$VH2,114:$VI2,115:$VJ2,116:$VK2,117:$VL2,118:433,119:$VM2,120:$VN2,122:$VO2,123:$VP2,124:$VQ2,126:$VR2,128:$VS2,130:$VT2,132:443,134:444,136:$VU2,138:$VV2,140:$VW2,142:$VX2,143:$VY2,144:$VZ2,145:$V_2,146:$V$2,147:$V03,149:$V13,159:$V23,161:$V33,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,367:168,368:$Vg1,372:$Vh1},{67:$Vx4,71:[1,972]},o($Vy4,[2,121],{367:168,3:411,118:433,132:443,134:444,92:974,4:$V1,5:$V2,65:$Vq2,69:$Vr2,70:$Vs2,90:$Vt2,93:$Vu2,97:$Vv2,98:$Vw2,99:$Vx2,104:$Vy2,105:$Vz2,106:$VA2,107:$VB2,108:$VC2,109:$VD2,110:$VE2,111:$VF2,112:$VG2,113:$VH2,114:$VI2,115:$VJ2,116:$VK2,117:$VL2,119:$VM2,120:$VN2,122:$VO2,123:$VP2,124:$VQ2,126:$VR2,128:$VS2,130:$VT2,136:$VU2,138:$VV2,140:$VW2,142:$VX2,143:$VY2,144:$VZ2,145:$V_2,146:$V$2,147:$V03,149:$V13,159:$V23,161:$V33,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,368:$Vg1,372:$Vh1}),o($V_3,$V$3,{152:828,137:975}),{3:411,4:$V1,5:$V2,65:$Vq2,69:$Vr2,70:$Vs2,71:[1,976],90:$Vt2,92:977,93:$Vu2,97:$Vv2,98:$Vw2,99:$Vx2,104:$Vy2,105:$Vz2,106:$VA2,107:$VB2,108:$VC2,109:$VD2,110:$VE2,111:$VF2,112:$VG2,113:$VH2,114:$VI2,115:$VJ2,116:$VK2,117:$VL2,118:433,119:$VM2,120:$VN2,122:$VO2,123:$VP2,124:$VQ2,126:$VR2,128:$VS2,130:$VT2,132:443,134:444,136:$VU2,138:$VV2,140:$VW2,142:$VX2,143:$VY2,144:$VZ2,145:$V_2,146:$V$2,147:$V03,149:$V13,159:$V23,161:$V33,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,367:168,368:$Vg1,372:$Vh1},{3:411,4:$V1,5:$V2,65:$Vq2,69:$Vr2,70:$Vs2,71:[1,978],90:$Vt2,92:979,93:$Vu2,97:$Vv2,98:$Vw2,99:$Vx2,104:$Vy2,105:$Vz2,106:$VA2,107:$VB2,108:$VC2,109:$VD2,110:$VE2,111:$VF2,112:$VG2,113:$VH2,114:$VI2,115:$VJ2,116:$VK2,117:$VL2,118:433,119:$VM2,120:$VN2,122:$VO2,123:$VP2,124:$VQ2,126:$VR2,128:$VS2,130:$VT2,132:443,134:444,136:$VU2,138:$VV2,140:$VW2,142:$VX2,143:$VY2,144:$VZ2,145:$V_2,146:$V$2,147:$V03,149:$V13,159:$V23,161:$V33,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,367:168,368:$Vg1,372:$Vh1},{67:$Vx4,71:[1,980]},{67:$Vx4,71:[1,981]},{67:$Vx4,71:[1,982]},{67:$Vx4,71:[1,983]},{71:[1,984],127:642,153:$VB3,154:$VC3,155:$VD3},{67:$VH3,71:[1,985]},{3:411,4:$V1,5:$V2,65:$Vq2,67:[1,986],69:$Vr2,70:$Vs2,90:$Vt2,92:987,93:$Vu2,97:$Vv2,98:$Vw2,99:$Vx2,104:$Vy2,105:$Vz2,106:$VA2,107:$VB2,108:$VC2,109:$VD2,110:$VE2,111:$VF2,112:$VG2,113:$VH2,114:$VI2,115:$VJ2,116:$VK2,117:$VL2,118:433,119:$VM2,120:$VN2,122:$VO2,123:$VP2,124:$VQ2,126:$VR2,128:$VS2,130:$VT2,132:443,134:444,136:$VU2,138:$VV2,140:$VW2,142:$VX2,143:$VY2,144:$VZ2,145:$V_2,146:$V$2,147:$V03,149:$V13,159:$V23,161:$V33,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,367:168,368:$Vg1,372:$Vh1},{3:988,4:$V1,5:$V2},{3:989,4:$V1,5:$V2},o($VH,[2,534]),{3:990,4:$V1,5:$V2},{91:991,107:$VO,256:$Va1},{71:[1,992]},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:993,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{3:638,4:$V1,5:$V2,89:692,116:$VF3,119:$VG3,288:994,289:693},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:995,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{99:[1,996]},o($VH,[2,590],{278:322,90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72}),{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:997,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{3:853,4:$V1,5:$V2,70:$V34,106:$V44,381:998},o($Vz4,[2,595]),o($Vz4,[2,596]),o($Vz4,[2,597]),{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:999,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},o($VI3,[2,247]),o($VI3,[2,249]),o($VI3,[2,251]),o($VI3,[2,253]),o($Vt1,[2,139]),o($VH,[2,506]),{122:[1,1e3]},o($VH,[2,507]),o($V73,[2,477],{236:1001,4:$Vj3,336:[1,1002],338:$Vk3}),o($VH,[2,508]),o($VH,[2,510]),{67:$V63,71:[1,1003]},o($VH,[2,514]),o($VH,[2,518]),{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:235,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,125:1004,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{3:1005,4:$V1,5:$V2},o($VH,[2,520]),{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,95:1006,100:957,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,214:955,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{70:[1,1007]},{3:1008,4:$V1,5:$V2},{69:$VJ3,114:[2,780],429:1009,432:1010},o($V74,[2,779]),o($V73,[2,671]),o($V84,[2,675]),o($V84,[2,791]),{3:1011,4:$V1,5:$V2},{3:864,4:$V1,5:$V2,69:[1,1014],302:1012,309:1013,334:1015},{3:638,4:$V1,5:$V2,89:793,204:1016},{36:1017,72:67,81:$V6,158:92,163:$Va},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:1018,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},o($VV3,[2,658]),{3:638,4:$V1,5:$V2,89:692,116:$VF3,119:$VG3,121:1019,288:691,289:693},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:235,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,125:1020,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},o($VV3,[2,663]),o($VE1,[2,627],{278:322,90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72}),{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:1021,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{67:[1,1022],71:[1,1023]},o($Vy4,[2,485]),o($Vy4,[2,486]),{106:$Vc4,247:$Vd4,337:1024},{67:$VA4,71:[1,1025]},o($Vy4,[2,421],{278:322,90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72}),o($Vn1,[2,349]),o($Vn1,[2,353]),{71:[1,1027]},{67:$V63,71:[1,1028]},o($Vn1,[2,374]),o($Vn1,[2,376]),{71:[1,1029],90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,278:322,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72},{71:[1,1030]},{67:$V63,71:[1,1031]},o($Vn1,[2,379]),o($Vn1,[2,298]),{70:[1,1032]},o($Vn1,$Ve4,{239:1033,240:$Vf4}),o($Vn1,$Ve4,{239:1034,240:$Vf4}),o($Va2,[2,316]),o($VT3,[2,259]),o($Vn1,[2,256]),o($Vn1,[2,332]),o($Vs3,[2,336],{278:322,90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72}),{67:[1,1036],71:[1,1035]},{67:[1,1038],71:[1,1037],90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,278:322,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72},{3:913,4:$V1,5:$V2},{70:[1,1039],116:$VQ,118:1040,119:$Vo1,126:$VS,155:$VW,175:1041,260:$Vd1,367:168,368:$Vg1,372:$Vh1},{67:$VA4,71:[1,1042]},{36:1044,72:67,81:$V6,123:[1,1043],158:92,163:$Va},{3:638,4:$V1,5:$V2,89:1045},o($VH,[2,630]),o($Vk4,[2,635]),o($Vk4,[2,636]),{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:489,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,148:1046,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,221:488,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{144:[1,1048],267:[1,1047]},{409:[1,1049]},o($Vj2,[2,158]),o($VB4,[2,235],{78:1050,93:[1,1051]}),{94:[1,1052]},o($VX3,[2,215],{278:322,90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72}),o($Vy3,[2,148],{188:938,193:941,187:1053,179:1054,180:$Vn4,182:$Vo4,194:$Vp4,195:$Vq4,196:$Vr4,197:$Vs4,198:$Vt4,199:$Vu4,200:$Vv4,201:$Vw4}),{3:193,4:$V1,5:$V2,70:$Vj1,107:$Vk1,116:$VQ,118:187,119:$VR,126:$VS,155:$VW,173:188,174:190,175:189,176:191,183:1055,186:192,260:$Vd1,367:168,368:$Vg1,372:$Vh1},o($VC4,[2,181]),o($VC4,[2,182]),{3:193,4:$V1,5:$V2,70:[1,1060],116:$VQ,118:1058,119:$VR,126:$VS,155:$VW,173:1057,174:1061,175:1059,176:1062,189:1056,260:$Vd1,367:168,368:$Vg1,372:$Vh1},{181:[1,1063],195:$VD4},{181:[1,1065],195:$VE4},o($VF4,[2,198]),{180:[1,1069],182:[1,1068],193:1067,195:$Vq4,196:$Vr4,197:$Vs4,198:$Vt4,199:$Vu4,200:$Vv4,201:$Vw4},o($VF4,[2,200]),{195:[1,1070]},{182:[1,1072],195:[1,1071]},{182:[1,1074],195:[1,1073]},{182:[1,1075]},{195:[1,1076]},{195:[1,1077]},{67:$Vm4,178:1078,179:937,180:$Vn4,182:$Vo4,187:936,188:938,193:941,194:$Vp4,195:$Vq4,196:$Vr4,197:$Vs4,198:$Vt4,199:$Vu4,200:$Vv4,201:$Vw4},o($VY3,[2,67]),o($VE3,[2,80]),{67:$VG4,71:[1,1079]},{71:[1,1081]},o($VH4,[2,237]),{71:[2,699]},o($VH4,[2,239],{278:322,90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,215:[1,1082],216:[1,1083],269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72}),o($VE3,[2,79]),o($VZ3,[2,703],{127:642,153:$VB3,154:$VC3,155:$VD3}),o($VE3,[2,81]),o($VE3,[2,82]),o($VE3,[2,99]),o($VE3,[2,102]),o($VE3,[2,105]),o($VZ3,[2,707],{127:642,153:$VB3,154:$VC3,155:$VD3}),o($VE3,[2,106]),o($VZ3,[2,709],{127:642,153:$VB3,154:$VC3,155:$VD3}),o($VE3,[2,107]),o($VZ3,[2,711],{127:642,153:$VB3,154:$VC3,155:$VD3}),o($VE3,[2,108]),o($VZ3,[2,715],{127:642,153:$VB3,154:$VC3,155:$VD3}),o($VE3,[2,109]),o($V_3,[2,722],{151:1084}),o($V_3,[2,725],{127:642,153:$VB3,154:$VC3,155:$VD3}),{67:$Vx4,71:[1,1085]},o($VE3,[2,111]),o($VZ3,[2,717],{127:642,153:$VB3,154:$VC3,155:$VD3}),o($VE3,[2,112]),o($VZ3,[2,719],{127:642,153:$VB3,154:$VC3,155:$VD3}),o($VE3,[2,113]),o($VE3,[2,114]),o($VE3,[2,115]),o($VE3,[2,116]),o($VE3,[2,117]),o($VE3,[2,118]),{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:235,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,125:1086,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},o($V04,[2,721],{127:642,153:$VB3,154:$VC3,155:$VD3}),o($VH,[2,544]),o($VH,[2,540]),o($VH,[2,542]),o($VH,[2,538]),o($V43,[2,63]),o($VH,[2,400],{278:322,90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72}),o($V24,[2,403]),o($V24,[2,404],{278:322,90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72}),{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:1087,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},o($VH,[2,591],{278:322,90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72}),o($Vz4,[2,594]),{71:[1,1088],90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,278:322,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72},{3:1089,4:$V1,5:$V2},o($V73,[2,487],{335:1090,339:1091,340:1092,317:1100,128:$VI4,161:$VJ4,257:$VK4,294:$VL4,307:$VM4,319:$VN4,320:$VO4,324:$VP4,325:$VQ4}),o($V73,[2,476]),o($VH,[2,513],{69:[1,1103]}),{67:$V63,71:[1,1104]},o($VH,[2,522]),{67:$VG4,71:[1,1105]},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,95:1106,100:957,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,214:955,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},o($VL3,[2,673]),{114:[1,1107]},{114:[2,781]},o($V84,[2,676]),{71:[1,1108]},{67:[1,1109],71:[2,447]},{36:1110,72:67,81:$V6,158:92,163:$Va},o($Vy4,[2,473]),{67:$Vi4,71:[1,1111]},o($VH,[2,762],{359:1112,360:1113,65:$VR4}),o($VV3,$V94,{72:67,158:92,278:322,36:889,417:1115,81:$V6,90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,120:$Va4,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,163:$Va,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72,419:$Vb4}),o($VV3,[2,661],{67:$V14}),o($VV3,[2,662],{67:$V63}),o($VE1,[2,628],{278:322,90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72}),{106:[1,1116]},o($VS4,[2,480]),{67:[1,1117],71:[1,1118]},o($VS4,[2,484]),{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:1119,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},o($Vn1,[2,365]),o($Vn1,[2,366]),o($Vn1,[2,390]),o($Vn1,[2,375]),o($Vn1,[2,377]),{93:$VT4,241:1120,242:1121,243:[1,1122]},o($Vn1,[2,299]),o($Vn1,[2,300]),o($Vn1,[2,287]),{106:[1,1124]},o($Vn1,[2,289]),{106:[1,1125]},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:897,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,295:1126,367:168,368:$Vg1,372:$Vh1},o($Vh4,[2,419]),o($Vh4,[2,420]),o($Vh4,[2,415]),{70:$VU3,116:$VQ,118:789,119:$Vo1,126:$VS,155:$VW,175:790,260:$Vd1,293:1127,367:168,368:$Vg1,372:$Vh1},o($VV3,[2,412]),o($Vj4,[2,430]),o($VH,[2,654],{67:$VH3,172:[1,1128]}),{287:$VU4,290:$VV4,410:1129},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:1132,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{94:[1,1134],144:[1,1135],267:[1,1133]},o($VW4,[2,243],{79:1136,218:[1,1137]}),{94:[1,1138]},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:1144,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,206:1139,208:1140,209:$VX4,210:$VY4,211:$VZ4,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},o($VC4,[2,179]),o($VC4,[2,180]),o($Vj4,[2,156]),o($VC4,[2,213],{190:1145,202:[1,1146],203:[1,1147]}),o($V_4,[2,184],{3:1148,4:$V1,5:$V2,69:[1,1149]}),o($V$4,[2,734],{191:1150,69:[1,1151]}),{3:1152,4:$V1,5:$V2,69:[1,1153]},{36:1154,72:67,81:$V6,158:92,163:$Va},o($V_4,[2,192],{3:1155,4:$V1,5:$V2,69:[1,1156]}),o($V_4,[2,195],{3:1157,4:$V1,5:$V2,69:[1,1158]}),{70:[1,1159]},o($VF4,[2,210]),{70:[1,1160]},o($VF4,[2,206]),o($VF4,[2,199]),{195:$VE4},{195:$VD4},o($VF4,[2,201]),o($VF4,[2,202]),{195:[1,1161]},o($VF4,[2,204]),{195:[1,1162]},{195:[1,1163]},o($VF4,[2,208]),o($VF4,[2,209]),{71:[1,1164],179:1054,180:$Vn4,182:$Vo4,187:1053,188:938,193:941,194:$Vp4,195:$Vq4,196:$Vr4,197:$Vs4,198:$Vt4,199:$Vu4,200:$Vv4,201:$Vw4},o($VE3,[2,72]),{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:957,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,214:1165,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},o($VE3,[2,73]),o($VH4,[2,240]),{217:[1,1166]},o($Vy4,[2,120],{367:168,3:411,118:433,132:443,134:444,92:1167,4:$V1,5:$V2,65:$Vq2,69:$Vr2,70:$Vs2,90:$Vt2,93:$Vu2,97:$Vv2,98:$Vw2,99:$Vx2,104:$Vy2,105:$Vz2,106:$VA2,107:$VB2,108:$VC2,109:$VD2,110:$VE2,111:$VF2,112:$VG2,113:$VH2,114:$VI2,115:$VJ2,116:$VK2,117:$VL2,119:$VM2,120:$VN2,122:$VO2,123:$VP2,124:$VQ2,126:$VR2,128:$VS2,130:$VT2,136:$VU2,138:$VV2,140:$VW2,142:$VX2,143:$VY2,144:$VZ2,145:$V_2,146:$V$2,147:$V03,149:$V13,159:$V23,161:$V33,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,368:$Vg1,372:$Vh1}),o($VE3,[2,110]),{67:$V63,71:[1,1168]},o($V24,[2,405],{278:322,90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72}),o($Vz4,[2,598]),o($VH,[2,509]),o($V73,[2,475]),o($V73,[2,488],{317:1100,340:1169,128:$VI4,161:$VJ4,257:$VK4,294:$VL4,307:$VM4,319:$VN4,320:$VO4,324:$VP4,325:$VQ4}),o($V53,[2,490]),{321:[1,1170]},{321:[1,1171]},{3:217,4:$V1,5:$V2,173:1172},o($V53,[2,496],{70:[1,1173]}),{3:231,4:$V1,5:$V2,70:[1,1175],91:225,106:$VN,107:$VO,116:$VQ,126:$VS,155:$VW,170:224,174:229,175:228,225:226,226:227,232:$Vp1,238:1174,254:$V81,255:$V91,256:$Va1,257:$Vb1,260:$Vd1},o($V53,[2,499]),{257:[1,1176]},o($V53,[2,501]),o($V53,[2,502]),{70:[1,1177]},{3:1178,4:$V1,5:$V2},o($VH,$V54,{354:1179,69:$V64}),o($VH,[2,528]),{67:$VG4,71:[1,1180]},o([8,67,71,107,112,126,264,268,450,451],$VC1,{434:280,379:282,3:734,430:1181,424:1182,431:1183,4:$V1,5:$V2,116:$Vr1,119:$Vs1}),o($VH,[2,435],{303:1184,305:1185,306:1186,4:$V05,294:$V15,307:$V25}),o($V35,$V45,{3:864,310:1190,334:1191,311:1192,312:1193,4:$V1,5:$V2,318:$V55}),{71:[2,448]},{69:[1,1195]},o($VH,[2,546]),o($VH,[2,763]),{319:[1,1197],361:[1,1196]},o($VV3,[2,664]),{71:[1,1198]},{106:[1,1199]},o($VS4,[2,481]),o($Vy4,[2,422],{278:322,90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72}),{71:[1,1200],93:$VT4,242:1201},{71:[1,1202]},{94:[1,1203]},{94:[1,1204]},{71:[1,1205]},{71:[1,1206]},{67:$VA4,71:[1,1207]},o($VV3,[2,410],{67:$Vg4}),{3:217,4:$V1,5:$V2,116:$Vr1,119:$Vs1,173:1209,379:1208},o($Vk4,[2,639]),o($Vk4,[2,641]),{120:[1,1210]},{90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,267:[1,1211],269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,278:322,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72},{291:$V65,411:1212},{365:[1,1215],412:[1,1214]},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:1216,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},o($VA3,[2,226],{80:1217,136:[1,1218],142:[1,1220],143:[1,1219]}),{106:$VN,170:1221},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,95:1222,100:957,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,214:955,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},o($Vl4,[2,224],{207:1223,67:$V75,212:[1,1225]}),o($V85,[2,218]),{120:[1,1226]},{70:[1,1227]},{70:[1,1228]},o($V85,[2,223],{278:322,90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72}),o($VC4,[2,183]),{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:1229,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{3:638,4:$V1,5:$V2,89:793,204:1230},o($V_4,[2,185]),{3:1231,4:$V1,5:$V2},o($V_4,[2,736],{192:1232,3:1233,4:$V1,5:$V2}),o($V$4,[2,735]),o($V_4,[2,188]),{3:1234,4:$V1,5:$V2},{71:[1,1235]},o($V_4,[2,193]),{3:1236,4:$V1,5:$V2},o($V_4,[2,196]),{3:1237,4:$V1,5:$V2},{36:1238,72:67,81:$V6,158:92,163:$Va},{36:1239,72:67,81:$V6,158:92,163:$Va},o($VF4,[2,203]),o($VF4,[2,205]),o($VF4,[2,207]),o($Vy3,[2,149]),o($VH4,[2,238]),o($VH4,[2,241],{215:[1,1240]}),o($V_3,[2,723],{127:642,153:$VB3,154:$VC3,155:$VD3}),o($VE3,[2,119]),o($V53,[2,489]),o($V53,[2,492]),{325:[1,1241]},o($V53,[2,756],{343:1242,341:1243,70:$V95}),{106:$VN,170:1245},o($V53,[2,497]),{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:1246,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},o($V53,[2,500]),{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:1247,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},o($VH,[2,515]),o($VH,[2,519]),o($VH,[2,529]),o($V73,[2,670]),o($V73,[2,782]),o($V73,[2,783]),o($VH,[2,431]),o($VH,[2,436],{306:1248,4:$V05,294:$V15,307:$V25}),o($Va5,[2,438]),o($Va5,[2,439]),{99:[1,1249]},{99:[1,1250]},{67:[1,1251],71:[2,446]},o($Vy4,[2,474]),o($Vy4,[2,449]),{161:[1,1259],167:[1,1260],313:1252,314:1253,315:1254,316:1255,317:1256,319:$VN4,320:[1,1257],321:[1,1261],324:[1,1258]},{3:1262,4:$V1,5:$V2},{36:1263,72:67,81:$V6,158:92,163:$Va},{362:[1,1264]},{363:[1,1265]},o($VS4,[2,478]),{71:[1,1266]},o($Vn1,[2,302]),{71:[1,1267]},o($Vn1,[2,303]),{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:1144,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,206:1268,208:1140,209:$VX4,210:$VY4,211:$VZ4,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,95:1269,100:957,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,214:955,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},o($Vn1,[2,288]),o($Vn1,[2,290]),o($Vh4,[2,418]),{3:1270,4:$V1,5:$V2},o($VH,[2,656],{70:[1,1271]}),{3:638,4:$V1,5:$V2,89:692,116:$VF3,119:$VG3,121:1272,288:691,289:693},{287:$VU4,290:$VV4,410:1273},o($Vk4,[2,643]),{70:[1,1275],123:[1,1274],294:[1,1276]},{144:[1,1278],267:[1,1277]},{144:[1,1280],267:[1,1279]},{90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,267:[1,1281],269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,278:322,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72},o($VA3,[2,64]),{36:1282,72:67,81:$V6,138:[1,1283],158:92,163:$Va,213:[1,1284]},{36:1285,72:67,81:$V6,158:92,163:$Va,213:[1,1286]},{36:1287,72:67,81:$V6,158:92,163:$Va,213:[1,1288]},o($VW4,[2,245],{219:1289,220:[1,1290]}),o($VB4,[2,236],{67:$VG4}),o($Vl4,[2,217]),{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:1144,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,208:1291,209:$VX4,210:$VY4,211:$VZ4,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:1292,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{70:[1,1293]},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:1144,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,206:1294,208:1140,209:$VX4,210:$VY4,211:$VZ4,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:1144,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,206:1295,208:1140,209:$VX4,210:$VY4,211:$VZ4,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},o($VC4,[2,211],{278:322,90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72}),o($VC4,[2,212],{67:$Vi4}),o($V_4,[2,186]),o($V_4,[2,187]),o($V_4,[2,737]),o($V_4,[2,189]),{3:1296,4:$V1,5:$V2,69:[1,1297]},o($V_4,[2,194]),o($V_4,[2,197]),{71:[1,1298]},{71:[1,1299]},o($VH4,[2,242]),{3:217,4:$V1,5:$V2,173:1300},o($V53,[2,494]),o($V53,[2,757]),{3:1301,4:$V1,5:$V2},{67:[1,1302]},{71:[1,1303],90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,278:322,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72},{71:[1,1304],90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,278:322,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72},o($Va5,[2,437]),{3:1305,4:$V1,5:$V2},{106:$VN,170:1306},o($V35,$V45,{312:1193,311:1307,318:$V55}),o($V73,[2,451]),o($V73,[2,452]),o($V73,[2,453]),o($V73,[2,454]),o($V73,[2,455]),{321:[1,1308]},{321:[1,1309]},{3:1311,4:$V1,5:$V2,70:[2,752],333:1310},{3:1312,4:$V1,5:$V2},{3:1313,4:$V1,5:$V2},o($V35,[2,457]),o($VH,[2,760],{358:1314,360:1315,65:$VR4}),o($VH,[2,547]),o($VH,[2,548],{318:[1,1316]}),o($VS4,[2,479]),o($Vn1,[2,304]),o([71,93],[2,305],{67:$V75}),{67:$VG4,71:[2,306]},o($VH,[2,655]),{3:638,4:$V1,5:$V2,89:793,204:1317},o($Vk4,[2,642],{67:$V14}),o($Vk4,[2,640]),{70:$VU3,116:$VQ,118:789,119:$Vo1,126:$VS,155:$VW,175:790,260:$Vd1,293:1318,367:168,368:$Vg1,372:$Vh1},{3:638,4:$V1,5:$V2,89:793,204:1319},{123:[1,1320]},{291:$V65,411:1321},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:1322,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{291:$V65,411:1323},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:1324,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{291:$V65,411:1325},o($VA3,[2,227]),{36:1326,72:67,81:$V6,158:92,163:$Va,213:[1,1327]},{36:1328,72:67,81:$V6,158:92,163:$Va},o($VA3,[2,229]),{36:1329,72:67,81:$V6,158:92,163:$Va},o($VA3,[2,230]),{36:1330,72:67,81:$V6,158:92,163:$Va},o($VW4,[2,244]),{106:$VN,170:1331},o($V85,[2,219]),o($Vl4,[2,225],{278:322,90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72}),{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:1144,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,206:1332,208:1140,209:$VX4,210:$VY4,211:$VZ4,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{67:$V75,71:[1,1333]},{67:$V75,71:[1,1334]},o($V_4,[2,190]),{3:1335,4:$V1,5:$V2},{3:1336,4:$V1,5:$V2,69:[1,1337]},{3:1338,4:$V1,5:$V2,69:[1,1339]},o($V53,[2,754],{342:1340,341:1341,70:$V95}),{71:[1,1342]},{106:$VN,170:1343},o($V53,[2,498]),o($V53,[2,458]),o($Va5,[2,440]),o($Va5,[2,441]),o($Vy4,[2,450]),{3:1345,4:$V1,5:$V2,70:[2,748],322:1344},{70:[1,1346]},{70:[1,1347]},{70:[2,753]},{70:[1,1348]},{70:[1,1349]},o($VH,[2,545]),o($VH,[2,761]),o($V35,$V45,{312:1193,311:1350,318:$V55}),{67:$Vi4,71:[1,1351]},o($Vk4,[2,649],{67:$Vg4}),{67:$Vi4,71:[1,1352]},o($Vk4,[2,651]),o($Vk4,[2,644]),{90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,267:[1,1353],269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,278:322,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72},o($Vk4,[2,647]),{90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,267:[1,1354],269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,278:322,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72},o($Vk4,[2,645]),o($VA3,[2,228]),{36:1355,72:67,81:$V6,158:92,163:$Va},o($VA3,[2,231]),o($VA3,[2,233]),o($VA3,[2,234]),o($VW4,[2,246]),{67:$V75,71:[1,1356]},o($V85,[2,221]),o($V85,[2,222]),o($V_4,[2,191]),o($VC4,[2,151]),{3:1357,4:$V1,5:$V2},o($VC4,[2,153]),{3:1358,4:$V1,5:$V2},o($V53,[2,493]),o($V53,[2,755]),o($V53,[2,491]),{71:[1,1359]},{70:[1,1360]},{70:[2,749]},{3:1362,4:$V1,5:$V2,107:$Vb5,323:1361},{3:638,4:$V1,5:$V2,89:793,204:1364},{3:638,4:$V1,5:$V2,89:793,204:1365},{3:638,4:$V1,5:$V2,89:793,204:1366},o($VH,[2,549]),o($VH,[2,657]),{123:[1,1367],294:[1,1368]},{291:$V65,411:1369},{287:$VU4,290:$VV4,410:1370},o($VA3,[2,232]),o($V85,[2,220]),o($VC4,[2,152]),o($VC4,[2,154]),o($V53,[2,495]),{3:1362,4:$V1,5:$V2,107:$Vb5,323:1371},{67:$Vc5,71:[1,1372]},o($Vy4,[2,469]),o($Vy4,[2,470]),{67:$Vi4,71:[1,1374]},{67:$Vi4,71:[1,1375]},{67:$Vi4,71:[1,1376]},{70:$VU3,116:$VQ,118:789,119:$Vo1,126:$VS,155:$VW,175:790,260:$Vd1,293:1377,367:168,368:$Vg1,372:$Vh1},{123:[1,1378]},o($Vk4,[2,646]),o($Vk4,[2,648]),{67:$Vc5,71:[1,1379]},{325:[1,1380]},{3:1381,4:$V1,5:$V2,107:[1,1382]},o($V73,[2,466]),o($V73,[2,467]),o($V73,[2,468]),o($Vk4,[2,650],{67:$Vg4}),o($Vk4,[2,652]),o($V73,[2,459]),{3:217,4:$V1,5:$V2,173:1383},o($Vy4,[2,471]),o($Vy4,[2,472]),o($Vd5,[2,750],{326:1384,328:1385,70:[1,1386]}),o($V73,[2,462],{327:1387,329:1388,202:[1,1389]}),o($Vd5,[2,751]),{3:1362,4:$V1,5:$V2,107:$Vb5,323:1390},o($V73,[2,460]),{202:[1,1392],330:1391},{290:[1,1393]},{67:$Vc5,71:[1,1394]},o($V73,[2,463]),{287:[1,1395]},{331:[1,1396]},o($Vd5,[2,461]),{331:[1,1397]},{332:[1,1398]},{332:[1,1399]},{202:[2,464]},o($V73,[2,465])],defaultActions:{97:[2,3],171:[2,307],172:[2,308],173:[2,309],174:[2,310],175:[2,311],176:[2,312],177:[2,313],178:[2,314],179:[2,315],184:[2,631],281:[2,777],288:[2,771],335:[2,738],336:[2,739],389:[2,632],455:[2,712],456:[2,713],560:[2,397],561:[2,398],562:[2,399],615:[2,633],956:[2,699],1010:[2,781],1110:[2,448],1311:[2,753],1345:[2,749],1398:[2,464]},parseError:function parseError(str,hash){if(hash.recoverable){this.trace(str)
}else{throw new Error(str)}},parse:function parse(input){var self=this,stack=[0],tstack=[],vstack=[null],lstack=[],table=this.table,yytext="",yylineno=0,yyleng=0,recovering=0,TERROR=2,EOF=1;var args=lstack.slice.call(arguments,1);var lexer=Object.create(this.lexer);var sharedState={yy:{}};for(var k in this.yy){if(Object.prototype.hasOwnProperty.call(this.yy,k)){sharedState.yy[k]=this.yy[k]}}lexer.setInput(input,sharedState.yy);sharedState.yy.lexer=lexer;sharedState.yy.parser=this;if(typeof lexer.yylloc=="undefined"){lexer.yylloc={}}var yyloc=lexer.yylloc;lstack.push(yyloc);var ranges=lexer.options&&lexer.options.ranges;if(typeof sharedState.yy.parseError==="function"){this.parseError=sharedState.yy.parseError}else{this.parseError=Object.getPrototypeOf(this).parseError}function popStack(n){stack.length=stack.length-2*n;vstack.length=vstack.length-n;lstack.length=lstack.length-n}_token_stack:function lex(){var token;token=lexer.lex()||EOF;if(typeof token!=="number"){token=self.symbols_[token]||token}return token}var symbol,preErrorSymbol,state,action,a,r,yyval={},p,len,newState,expected;while(true){state=stack[stack.length-1];if(this.defaultActions[state]){action=this.defaultActions[state]}else{if(symbol===null||typeof symbol=="undefined"){symbol=lex()}action=table[state]&&table[state][symbol]}if(typeof action==="undefined"||!action.length||!action[0]){var errStr="";expected=[];for(p in table[state]){if(this.terminals_[p]&&p>TERROR){expected.push("'"+this.terminals_[p]+"'")}}if(lexer.showPosition){errStr="Parse error on line "+(yylineno+1)+":\n"+lexer.showPosition()+"\nExpecting "+expected.join(", ")+", got '"+(this.terminals_[symbol]||symbol)+"'"}else{errStr="Parse error on line "+(yylineno+1)+": Unexpected "+(symbol==EOF?"end of input":"'"+(this.terminals_[symbol]||symbol)+"'")}this.parseError(errStr,{text:lexer.match,token:this.terminals_[symbol]||symbol,line:lexer.yylineno,loc:yyloc,expected:expected})}if(action[0]instanceof Array&&action.length>1){throw new Error("Parse Error: multiple actions possible at state: "+state+", token: "+symbol)}switch(action[0]){case 1:stack.push(symbol);vstack.push(lexer.yytext);lstack.push(lexer.yylloc);stack.push(action[1]);symbol=null;if(!preErrorSymbol){yyleng=lexer.yyleng;yytext=lexer.yytext;yylineno=lexer.yylineno;yyloc=lexer.yylloc;if(recovering>0){recovering--}}else{symbol=preErrorSymbol;preErrorSymbol=null}break;case 2:len=this.productions_[action[1]][1];yyval.$=vstack[vstack.length-len];yyval._$={first_line:lstack[lstack.length-(len||1)].first_line,last_line:lstack[lstack.length-1].last_line,first_column:lstack[lstack.length-(len||1)].first_column,last_column:lstack[lstack.length-1].last_column};if(ranges){yyval._$.range=[lstack[lstack.length-(len||1)].range[0],lstack[lstack.length-1].range[1]]}r=this.performAction.apply(yyval,[yytext,yyleng,yylineno,sharedState.yy,action[1],vstack,lstack].concat(args));if(typeof r!=="undefined"){return r}if(len){stack=stack.slice(0,-1*len*2);vstack=vstack.slice(0,-1*len);lstack=lstack.slice(0,-1*len)}stack.push(this.productions_[action[1]][0]);vstack.push(yyval.$);lstack.push(yyval._$);newState=table[stack[stack.length-2]][stack[stack.length-1]];stack.push(newState);break;case 3:return true}}return true}};var lexer=function(){var lexer={EOF:1,parseError:function parseError(str,hash){if(this.yy.parser){this.yy.parser.parseError(str,hash)}else{throw new Error(str)}},setInput:function(input,yy){this.yy=yy||this.yy||{};this._input=input;this._more=this._backtrack=this.done=false;this.yylineno=this.yyleng=0;this.yytext=this.matched=this.match="";this.conditionStack=["INITIAL"];this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0};if(this.options.ranges){this.yylloc.range=[0,0]}this.offset=0;return this},input:function(){var ch=this._input[0];this.yytext+=ch;this.yyleng++;this.offset++;this.match+=ch;this.matched+=ch;var lines=ch.match(/(?:\r\n?|\n).*/g);if(lines){this.yylineno++;this.yylloc.last_line++}else{this.yylloc.last_column++}if(this.options.ranges){this.yylloc.range[1]++}this._input=this._input.slice(1);return ch},unput:function(ch){var len=ch.length;var lines=ch.split(/(?:\r\n?|\n)/g);this._input=ch+this._input;this.yytext=this.yytext.substr(0,this.yytext.length-len);this.offset-=len;var oldLines=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1);this.matched=this.matched.substr(0,this.matched.length-1);if(lines.length-1){this.yylineno-=lines.length-1}var r=this.yylloc.range;this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:lines?(lines.length===oldLines.length?this.yylloc.first_column:0)+oldLines[oldLines.length-lines.length].length-lines[0].length:this.yylloc.first_column-len};if(this.options.ranges){this.yylloc.range=[r[0],r[0]+this.yyleng-len]}this.yyleng=this.yytext.length;return this},more:function(){this._more=true;return this},reject:function(){if(this.options.backtrack_lexer){this._backtrack=true}else{return this.parseError("Lexical error on line "+(this.yylineno+1)+". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})}return this},less:function(n){this.unput(this.match.slice(n))},pastInput:function(){var past=this.matched.substr(0,this.matched.length-this.match.length);return(past.length>20?"...":"")+past.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var next=this.match;if(next.length<20){next+=this._input.substr(0,20-next.length)}return(next.substr(0,20)+(next.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var pre=this.pastInput();var c=new Array(pre.length+1).join("-");return pre+this.upcomingInput()+"\n"+c+"^"},test_match:function(match,indexed_rule){var token,lines,backup;if(this.options.backtrack_lexer){backup={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done};if(this.options.ranges){backup.yylloc.range=this.yylloc.range.slice(0)}}lines=match[0].match(/(?:\r\n?|\n).*/g);if(lines){this.yylineno+=lines.length}this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:lines?lines[lines.length-1].length-lines[lines.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+match[0].length};this.yytext+=match[0];this.match+=match[0];this.matches=match;this.yyleng=this.yytext.length;if(this.options.ranges){this.yylloc.range=[this.offset,this.offset+=this.yyleng]}this._more=false;this._backtrack=false;this._input=this._input.slice(match[0].length);this.matched+=match[0];token=this.performAction.call(this,this.yy,this,indexed_rule,this.conditionStack[this.conditionStack.length-1]);if(this.done&&this._input){this.done=false}if(token){return token}else if(this._backtrack){for(var k in backup){this[k]=backup[k]}return false}return false},next:function(){if(this.done){return this.EOF}if(!this._input){this.done=true}var token,match,tempMatch,index;if(!this._more){this.yytext="";this.match=""}var rules=this._currentRules();for(var i=0;imatch[0].length)){match=tempMatch;index=i;if(this.options.backtrack_lexer){token=this.test_match(tempMatch,rules[i]);if(token!==false){return token}else if(this._backtrack){match=false;continue}else{return false}}else if(!this.options.flex){break}}}if(match){token=this.test_match(match,rules[index]);if(token!==false){return token}return false}if(this._input===""){return this.EOF}else{return this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})}},lex:function lex(){var r=this.next();if(r){return r}else{return this.lex()}},begin:function begin(condition){this.conditionStack.push(condition)},popState:function popState(){var n=this.conditionStack.length-1;if(n>0){return this.conditionStack.pop()}else{return this.conditionStack[0]}},_currentRules:function _currentRules(){if(this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]){return this.conditions[this.conditionStack[this.conditionStack.length-1]].rules}else{return this.conditions["INITIAL"].rules}},topState:function topState(n){n=this.conditionStack.length-1-Math.abs(n||0);if(n>=0){return this.conditionStack[n]}else{return"INITIAL"}},pushState:function pushState(condition){this.begin(condition)},stateStackSize:function stateStackSize(){return this.conditionStack.length},options:{"case-insensitive":true},performAction:function anonymous(yy,yy_,$avoiding_name_collisions,YY_START){var YYSTATE=YY_START;switch($avoiding_name_collisions){case 0:return 233;break;case 1:return 260;break;case 2:return 368;break;case 3:return 5;break;case 4:return 5;break;case 5:return 256;break;case 6:return 256;break;case 7:return 107;break;case 8:return 107;break;case 9:return;break;case 10:break;case 11:return 145;break;case 12:return 144;break;case 13:yy_.yytext="VALUE";return 163;break;case 14:yy_.yytext="ROW";return 163;break;case 15:yy_.yytext="COLUMN";return 163;break;case 16:yy_.yytext="MATRIX";return 163;break;case 17:yy_.yytext="INDEX";return 163;break;case 18:yy_.yytext="RECORDSET";return 163;break;case 19:yy_.yytext="TEXT";return 163;break;case 20:yy_.yytext="SELECT";return 163;break;case 21:return"ABSOLUTE";break;case 22:return 332;break;case 23:return 349;break;case 24:return 251;break;case 25:return 138;break;case 26:return 347;break;case 27:return 144;break;case 28:return 201;break;case 29:return 140;break;case 30:return 181;break;case 31:return 252;break;case 32:return 69;break;case 33:return 366;break;case 34:return 215;break;case 35:return 351;break;case 36:return 307;break;case 37:return 248;break;case 38:return 386;break;case 39:return 282;break;case 40:return 390;break;case 41:return 283;break;case 42:return 269;break;case 43:return 94;break;case 44:return 261;break;case 45:return 235;break;case 46:return 319;break;case 47:return 105;break;case 48:return"CLOSE";break;case 49:return 216;break;case 50:return 164;break;case 51:return 164;break;case 52:return 383;break;case 53:return 318;break;case 54:return 419;break;case 55:return 389;break;case 56:return 237;break;case 57:return 213;break;case 58:return 245;break;case 59:return 298;break;case 60:return 180;break;case 61:return 211;break;case 62:return 232;break;case 63:return"CURSOR";break;case 64:return 352;break;case 65:return 397;break;case 66:return 294;break;case 67:return 290;break;case 68:return"DELETED";break;case 69:return 215;break;case 70:return 353;break;case 71:return 159;break;case 72:return 344;break;case 73:return 396;break;case 74:return 110;break;case 75:return 264;break;case 76:return 338;break;case 77:return 268;break;case 78:return 143;break;case 79:return 258;break;case 80:return 12;break;case 81:return 255;break;case 82:return"FETCH";break;case 83:return 249;break;case 84:return 324;break;case 85:return 157;break;case 86:return 451;break;case 87:return 421;break;case 88:return 205;break;case 89:return 209;break;case 90:return 212;break;case 91:return 364;break;case 92:return 130;break;case 93:return 307;break;case 94:return 284;break;case 95:return 280;break;case 96:return 167;break;case 97:return 196;break;case 98:return 291;break;case 99:return"INSERTED";break;case 100:return 142;break;case 101:return 172;break;case 102:return 195;break;case 103:return 321;break;case 104:return 250;break;case 105:return"LET";break;case 106:return 197;break;case 107:return 90;break;case 108:return 218;break;case 109:return 409;break;case 110:return 165;break;case 111:return 247;break;case 112:return 401;break;case 113:return 246;break;case 114:return 143;break;case 115:return 350;break;case 116:return 194;break;case 117:return"NEXT";break;case 118:return 234;break;case 119:return 217;break;case 120:return 331;break;case 121:return 128;break;case 122:return 257;break;case 123:return 382;break;case 124:return 202;break;case 125:return 362;break;case 126:return 220;break;case 127:return"OPEN";break;case 128:return 363;break;case 129:return 145;break;case 130:return 93;break;case 131:return 182;break;case 132:return 240;break;case 133:return 146;break;case 134:return 243;break;case 135:return 452;break;case 136:return 14;break;case 137:return 320;break;case 138:return 391;break;case 139:return"PRIOR";break;case 140:return 13;break;case 141:return 361;break;case 142:return 168;break;case 143:return"REDUCE";break;case 144:return 325;break;case 145:return"RELATIVE";break;case 146:return 85;break;case 147:return 348;break;case 148:return 149;break;case 149:return 392;break;case 150:return"RESTORE";break;case 151:return 147;break;case 152:return 147;break;case 153:return 198;break;case 154:return 385;break;case 155:return 210;break;case 156:return 124;break;case 157:return 352;break;case 158:return 81;break;case 159:return 200;break;case 160:return 120;break;case 161:return 120;break;case 162:return 356;break;case 163:return 286;break;case 164:return 365;break;case 165:return"STRATEGY";break;case 166:return"STORE";break;case 167:return 244;break;case 168:return 304;break;case 169:return 304;break;case 170:return 412;break;case 171:return 308;break;case 172:return 308;break;case 173:return 166;break;case 174:return 267;break;case 175:return"TIMEOUT";break;case 176:return 122;break;case 177:return 169;break;case 178:return 384;break;case 179:return 384;break;case 180:return 254;break;case 181:return 400;break;case 182:return 136;break;case 183:return 161;break;case 184:return 287;break;case 185:return 355;break;case 186:return 203;break;case 187:return 123;break;case 188:return 109;break;case 189:return 357;break;case 190:return 266;break;case 191:return 104;break;case 192:return 388;break;case 193:return 65;break;case 194:return 384;break;case 195:return 106;break;case 196:return 106;break;case 197:return 97;break;case 198:return 112;break;case 199:return 153;break;case 200:return 270;break;case 201:return 154;break;case 202:return 108;break;case 203:return 113;break;case 204:return 277;break;case 205:return 274;break;case 206:return 276;break;case 207:return 273;break;case 208:return 271;break;case 209:return 114;break;case 210:return 272;break;case 211:return 275;break;case 212:return 115;break;case 213:return 99;break;case 214:return 275;break;case 215:return 70;break;case 216:return 71;break;case 217:return 119;break;case 218:return 372;break;case 219:return 374;break;case 220:return 376;break;case 221:return 447;break;case 222:return 449;break;case 223:return 117;break;case 224:return 67;break;case 225:return 285;break;case 226:return 126;break;case 227:return 450;break;case 228:return 116;break;case 229:return 155;break;case 230:return 111;break;case 231:return 98;break;case 232:return 4;break;case 233:return 8;break;case 234:return"INVALID";break}},rules:[/^(?:``([^\`])+``)/i,/^(?:\[\?\])/i,/^(?:@\[)/i,/^(?:\[([^\]])*?\])/i,/^(?:`([^\`])*?`)/i,/^(?:N(['](\\.|[^']|\\')*?['])+)/i,/^(?:X(['](\\.|[^']|\\')*?['])+)/i,/^(?:(['](\\.|[^']|\\')*?['])+)/i,/^(?:(["](\\.|[^"]|\\")*?["])+)/i,/^(?:--(.*?)($|\r\n|\r|\n))/i,/^(?:\s+)/i,/^(?:\|\|)/i,/^(?:&&)/i,/^(?:VALUE\s+OF\s+SELECT\b)/i,/^(?:ROW\s+OF\s+SELECT\b)/i,/^(?:COLUMN\s+OF\s+SELECT\b)/i,/^(?:MATRIX\s+OF\s+SELECT\b)/i,/^(?:INDEX\s+OF\s+SELECT\b)/i,/^(?:RECORDSET\s+OF\s+SELECT\b)/i,/^(?:TEXT\s+OF\s+SELECT\b)/i,/^(?:SELECT\b)/i,/^(?:ABSOLUTE\b)/i,/^(?:ACTION\b)/i,/^(?:ADD\b)/i,/^(?:AGGR\b)/i,/^(?:ALL\b)/i,/^(?:ALTER\b)/i,/^(?:AND\b)/i,/^(?:ANTI\b)/i,/^(?:ANY\b)/i,/^(?:APPLY\b)/i,/^(?:ARRAY\b)/i,/^(?:AS\b)/i,/^(?:ASSERT\b)/i,/^(?:ASC\b)/i,/^(?:ATTACH\b)/i,/^(?:AUTO(_)?INCREMENT\b)/i,/^(?:AVG\b)/i,/^(?:BEGIN\b)/i,/^(?:BETWEEN\b)/i,/^(?:BREAK\b)/i,/^(?:NOT\s+BETWEEN\b)/i,/^(?:NOT\s+LIKE\b)/i,/^(?:BY\b)/i,/^(?:CASE\b)/i,/^(?:CAST\b)/i,/^(?:CHECK\b)/i,/^(?:CLASS\b)/i,/^(?:CLOSE\b)/i,/^(?:COLLATE\b)/i,/^(?:COLUMN\b)/i,/^(?:COLUMNS\b)/i,/^(?:COMMIT\b)/i,/^(?:CONSTRAINT\b)/i,/^(?:CONTENT\b)/i,/^(?:CONTINUE\b)/i,/^(?:CONVERT\b)/i,/^(?:CORRESPONDING\b)/i,/^(?:COUNT\b)/i,/^(?:CREATE\b)/i,/^(?:CROSS\b)/i,/^(?:CUBE\b)/i,/^(?:CURRENT_TIMESTAMP\b)/i,/^(?:CURSOR\b)/i,/^(?:DATABASE(S)?)/i,/^(?:DECLARE\b)/i,/^(?:DEFAULT\b)/i,/^(?:DELETE\b)/i,/^(?:DELETED\b)/i,/^(?:DESC\b)/i,/^(?:DETACH\b)/i,/^(?:DISTINCT\b)/i,/^(?:DROP\b)/i,/^(?:ECHO\b)/i,/^(?:EDGE\b)/i,/^(?:END\b)/i,/^(?:ENUM\b)/i,/^(?:ELSE\b)/i,/^(?:EXCEPT\b)/i,/^(?:EXISTS\b)/i,/^(?:EXPLAIN\b)/i,/^(?:FALSE\b)/i,/^(?:FETCH\b)/i,/^(?:FIRST\b)/i,/^(?:FOREIGN\b)/i,/^(?:FROM\b)/i,/^(?:GO\b)/i,/^(?:GRAPH\b)/i,/^(?:GROUP\b)/i,/^(?:GROUPING\b)/i,/^(?:HAVING\b)/i,/^(?:HELP\b)/i,/^(?:IF\b)/i,/^(?:IDENTITY\b)/i,/^(?:IS\b)/i,/^(?:IN\b)/i,/^(?:INDEX\b)/i,/^(?:INNER\b)/i,/^(?:INSERT\b)/i,/^(?:INSERTED\b)/i,/^(?:INTERSECT\b)/i,/^(?:INTO\b)/i,/^(?:JOIN\b)/i,/^(?:KEY\b)/i,/^(?:LAST\b)/i,/^(?:LET\b)/i,/^(?:LEFT\b)/i,/^(?:LIKE\b)/i,/^(?:LIMIT\b)/i,/^(?:MATCHED\b)/i,/^(?:MATRIX\b)/i,/^(?:MAX\b)/i,/^(?:MERGE\b)/i,/^(?:MIN\b)/i,/^(?:MINUS\b)/i,/^(?:MODIFY\b)/i,/^(?:NATURAL\b)/i,/^(?:NEXT\b)/i,/^(?:NEW\b)/i,/^(?:NOCASE\b)/i,/^(?:NO\b)/i,/^(?:NOT\b)/i,/^(?:NULL\b)/i,/^(?:OFF\b)/i,/^(?:ON\b)/i,/^(?:ONLY\b)/i,/^(?:OFFSET\b)/i,/^(?:OPEN\b)/i,/^(?:OPTION\b)/i,/^(?:OR\b)/i,/^(?:ORDER\b)/i,/^(?:OUTER\b)/i,/^(?:OVER\b)/i,/^(?:PATH\b)/i,/^(?:PARTITION\b)/i,/^(?:PERCENT\b)/i,/^(?:PLAN\b)/i,/^(?:PRIMARY\b)/i,/^(?:PRINT\b)/i,/^(?:PRIOR\b)/i,/^(?:QUERY\b)/i,/^(?:READ\b)/i,/^(?:RECORDSET\b)/i,/^(?:REDUCE\b)/i,/^(?:REFERENCES\b)/i,/^(?:RELATIVE\b)/i,/^(?:REMOVE\b)/i,/^(?:RENAME\b)/i,/^(?:REPEAT\b)/i,/^(?:REQUIRE\b)/i,/^(?:RESTORE\b)/i,/^(?:RETURN\b)/i,/^(?:RETURNS\b)/i,/^(?:RIGHT\b)/i,/^(?:ROLLBACK\b)/i,/^(?:ROLLUP\b)/i,/^(?:ROW\b)/i,/^(?:SCHEMA(S)?)/i,/^(?:SEARCH\b)/i,/^(?:SEMI\b)/i,/^(?:SET\b)/i,/^(?:SETS\b)/i,/^(?:SHOW\b)/i,/^(?:SOME\b)/i,/^(?:SOURCE\b)/i,/^(?:STRATEGY\b)/i,/^(?:STORE\b)/i,/^(?:SUM\b)/i,/^(?:TABLE\b)/i,/^(?:TABLES\b)/i,/^(?:TARGET\b)/i,/^(?:TEMP\b)/i,/^(?:TEMPORARY\b)/i,/^(?:TEXTSTRING\b)/i,/^(?:THEN\b)/i,/^(?:TIMEOUT\b)/i,/^(?:TO\b)/i,/^(?:TOP\b)/i,/^(?:TRAN\b)/i,/^(?:TRANSACTION\b)/i,/^(?:TRUE\b)/i,/^(?:TRUNCATE\b)/i,/^(?:UNION\b)/i,/^(?:UNIQUE\b)/i,/^(?:UPDATE\b)/i,/^(?:USE\b)/i,/^(?:USING\b)/i,/^(?:VALUE(S)?)/i,/^(?:VERTEX\b)/i,/^(?:VIEW\b)/i,/^(?:WHEN\b)/i,/^(?:WHERE\b)/i,/^(?:WHILE\b)/i,/^(?:WITH\b)/i,/^(?:WORK\b)/i,/^(?:(\d*[.])?\d+[eE]\d+)/i,/^(?:(\d*[.])?\d+)/i,/^(?:->)/i,/^(?:#)/i,/^(?:\+)/i,/^(?:-)/i,/^(?:\*)/i,/^(?:\/)/i,/^(?:%)/i,/^(?:!===)/i,/^(?:===)/i,/^(?:!==)/i,/^(?:==)/i,/^(?:>=)/i,/^(?:>)/i,/^(?:<=)/i,/^(?:<>)/i,/^(?:<)/i,/^(?:=)/i,/^(?:!=)/i,/^(?:\()/i,/^(?:\))/i,/^(?:@)/i,/^(?:\{)/i,/^(?:\})/i,/^(?:\])/i,/^(?::-)/i,/^(?:\?-)/i,/^(?:\.)/i,/^(?:,)/i,/^(?:::)/i,/^(?::)/i,/^(?:;)/i,/^(?:\$)/i,/^(?:\?)/i,/^(?:!)/i,/^(?:\^)/i,/^(?:[a-zA-Z_][a-zA-Z_0-9]*)/i,/^(?:$)/i,/^(?:.)/i],conditions:{INITIAL:{rules:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234],inclusive:true}}};return lexer}();parser.lexer=lexer;function Parser(){this.yy={}}Parser.prototype=parser;parser.Parser=Parser;return new Parser}();if(typeof require!=="undefined"&&typeof exports!=="undefined"){exports.parser=parser;exports.Parser=parser.Parser;exports.parse=function(){return parser.parse.apply(parser,arguments)};exports.main=function commonjsMain(args){if(!args[1]){console.log("Usage: "+args[0]+" FILE");process.exit(1)}var source=require("fs").readFileSync(require("path").normalize(args[1]),"utf8");return exports.parser.parse(source)};if(typeof module!=="undefined"&&require.main===module){exports.main(process.argv.slice(1))}}alasql.prettyflag=false;alasql.pretty=function(sql,flag){var pf=alasql.prettyflag;alasql.prettyflag=!flag;var s=alasql.parse(sql).toString();alasql.prettyflag=pf;return s};function K(s){if(alasql.prettyflag){return''+s.toUpperCase()+" "}else{return s}}function P(s){if(alasql.prettyflag){return''+s+" "}else{return s}}function L(s){if(alasql.prettyflag){return''+s+" "}else{return s}}function N(s){if(alasql.prettyflag){return''+s+" "}else{return s}}function S(s){if(alasql.prettyflag){return''+s+" "}else{return s}}function NL(){if(alasql.prettyflag){return" "}else{return" "}}function ID(){if(alasql.prettyflag){return" "}else{return""}}var utils=alasql.utils={};function n2u(s){return"(y="+s+",y===y?y:undefined)"}function und(s,r){return"(y="+s+',typeof y=="undefined"?undefined:'+r+")"}function returnTrue(){return true}function returnUndefined(){}var escapeq=utils.escapeq=function(s){return s.replace(/\'/g,"\\'")};var escapeqq=utils.undoubleq=function(s){return s.replace(/(\')/g,"''")};var doubleq=utils.doubleq=function(s){return s.replace(/(\'\')/g,"\\'")};var doubleqq=utils.doubleqq=function(s){return s.replace(/\'/g,"'")};var cutbom=function(s){if(s[0]==String.fromCharCode(65279))s=s.substr(1);return s};var loadFile=utils.loadFile=function(path,asy,success,error){if(typeof exports=="object"||typeof Meteor!="undefined"&&Meteor.isServer){if(typeof Meteor!="undefined"){var fs=Npm.require("fs")}else{var fs=require("fs")}if(typeof path=="undefined"){var buff="";process.stdin.setEncoding("utf8");process.stdin.on("readable",function(){var chunk=process.stdin.read();if(chunk!==null){buff+=chunk.toString()}});process.stdin.on("end",function(){success(cutbom(buff))})}else{if(asy){fs.readFile(path,function(err,data){if(err){throw err}success(cutbom(data.toString()))})}else{var data=fs.readFileSync(path);success(cutbom(data.toString()))}}}else if(typeof cordova=="object"){window.requestFileSystem(LocalFileSystem.PERSISTENT,0,function(fileSystem){fileSystem.root.getFile(path,{create:false},function(fileEntry){fileEntry.file(function(file){var fileReader=new FileReader;fileReader.onloadend=function(e){success(cutbom(this.result))};fileReader.readAsText(file)})})})}else{if(typeof path=="string"){if(path.substr(0,1)=="#"&&typeof document!="undefined"){var data=document.querySelector(path).textContent;success(data)}else{var xhr=new XMLHttpRequest;xhr.onreadystatechange=function(){if(xhr.readyState===XMLHttpRequest.DONE){if(xhr.status===200){if(success)success(cutbom(xhr.responseText))}else{if(error)error(xhr)}}};xhr.open("GET",path,asy);xhr.send()}}else if(path instanceof Event){var files=path.target.files;var reader=new FileReader;var name=files[0].name;reader.onload=function(e){var data=e.target.result;success(cutbom(data))};reader.readAsText(files[0])}}};var loadBinaryFile=utils.loadBinaryFile=function(path,asy,success,error){if(typeof exports=="object"||typeof Meteor!="undefined"&&Meteor.isServer){if(typeof Meteor!="undefined"){var fs=Npm.require("fs")}else{var fs=require("fs")}if(asy){fs.readFile(path,function(err,data){if(err){throw err}var arr=new Array;for(var i=0;i!=data.length;++i)arr[i]=String.fromCharCode(data[i]);success(arr.join(""))})}else{var data=fs.readFileSync(path);var arr=new Array;for(var i=0;i!=data.length;++i)arr[i]=String.fromCharCode(data[i]);success(arr.join(""))}}else{if(typeof path=="string"){var xhr=new XMLHttpRequest;xhr.open("GET",path,asy);xhr.responseType="arraybuffer";xhr.onload=function(){var data=new Uint8Array(xhr.response);var arr=new Array;for(var i=0;i!=data.length;++i)arr[i]=String.fromCharCode(data[i]);success(arr.join(""))};xhr.send()}else if(path instanceof Event){var files=path.target.files;var reader=new FileReader;var name=files[0].name;reader.onload=function(e){var data=e.target.result;success(data)};reader.readAsBinaryString(files[0])}}};var removeFile=utils.removeFile=function(path,cb){if(typeof exports=="object"){var fs=require("fs");fs.remove(path,cb)}else if(typeof cordova=="object"){window.requestFileSystem(LocalFileSystem.PERSISTENT,0,function(fileSystem){fileSystem.root.getFile(path,{create:false},function(fileEntry){fileEntry.remove(cb);if(cb)cb()},function(){if(cb)cb()})})}else{throw new Error("You can remove files only in Node.js and Apache Cordova")}};var deleteFile=utils.deleteFile=function(path,cb){if(typeof exports=="object"){var fs=require("fs");fs.unlink(path,cb)}};var fileExists=utils.fileExists=function(path,cb){if(typeof exports=="object"){var fs=require("fs");fs.exists(path,cb)}else if(typeof cordova=="object"){window.requestFileSystem(LocalFileSystem.PERSISTENT,0,function(fileSystem){fileSystem.root.getFile(path,{create:false},function(fileEntry){cb(true)},function(){cb(false)})})}else{throw new Error("You can use exists() only in Node.js or Apach Cordova")}};var saveFile=utils.saveFile=function(path,data,cb){var res=1;if(typeof path=="undefined"){res=data;if(cb)res=cb(res)}else{if(typeof exports=="object"){var fs=require("fs");var data=fs.writeFileSync(path,data);if(cb)res=cb(res)}else if(typeof cordova=="object"){window.requestFileSystem(LocalFileSystem.PERSISTENT,0,function(fileSystem){fileSystem.root.getFile(path,{create:true},function(fileEntry){fileEntry.createWriter(function(fileWriter){fileWriter.onwriteend=function(){if(cb)res=cb(res)};fileWriter.write(data)})})})}else{if(isIE()==9){var ndata=data.replace(/\r\n/g,"A;D;");ndata=ndata.replace(/\n/g,"D;");ndata=ndata.replace(/\t/g," ");var testlink=window.open("about:blank","_blank");testlink.document.write(ndata);testlink.document.close();testlink.document.execCommand("SaveAs",false,path);testlink.close()}else{var blob=new Blob([data],{type:"text/plain;charset=utf-8"});saveAs(blob,path);if(cb)res=cb(res)}}}return res};function isIE(){var myNav=navigator.userAgent.toLowerCase();return myNav.indexOf("msie")!=-1?parseInt(myNav.split("msie")[1]):false}var hash=utils.hash=function hash(str){var h=0;if(str.length==0)return h;for(var i=0;i=26){i=(i/26|0)-1;addr=String.fromCharCode(65+i%26)+addr;if(i>26){i=(i/26|0)-1;addr=String.fromCharCode(65+i%26)+addr}}return addr};var xlscn=utils.xlscn=function(s){var n=s.charCodeAt(0)-65;if(s.length>1){n=(n+1)*26+s.charCodeAt(1)-65;if(s.length>2){n=(n+1)*26+s.charCodeAt(2)-65}}return n};var domEmptyChildren=utils.domEmptyChildren=function(container){var len=container.childNodes.length;while(len--){container.removeChild(container.lastChild)}};alasql.utils.uncomment=function uncomment(str){str=("__"+str+"__").split("");var quote=false,quoteSign,blockComment=false,lineComment=false;for(var i=0,l=str.length;ialasql.MAXSQLCACHESIZE){db.resetSqlCache()}db.sqlCacheSize++;db.sqlCache[hh]=statement}var res=alasql.res=statement(params,cb,scope);return res}else{alasql.precompile(ast.statements[0],alasql.useid,params);var res=alasql.res=ast.statements[0].execute(databaseid,params,cb,scope);return res}}else{if(cb){alasql.adrun(databaseid,ast,params,cb,scope)}else{return alasql.drun(databaseid,ast,params,cb,scope)}}};alasql.drun=function(databaseid,ast,params,cb,scope){var useid=alasql.useid;if(useid!=databaseid)alasql.use(databaseid);var res=[];for(var i=0,ilen=ast.statements.length;i0){if(selectors&&selectors[0]&&selectors[0].srchid=="PROP"&&selectors[0].args&&selectors[0].args[0]){if(selectors[0].args[0].toUpperCase()=="XML"){stope.mode="XML";selectors.shift()}else if(selectors[0].args[0].toUpperCase()=="HTML"){stope.mode="HTML";selectors.shift()}else if(selectors[0].args[0].toUpperCase()=="JSON"){stope.mode="JSON";selectors.shift()}}if(selectors.length>0&&selectors[0].srchid=="VALUE"){stope.value=true;selectors.shift()}}if(this.from instanceof yy.Column){var dbid=this.from.databaseid||databaseid;fromdata=alasql.databases[dbid].tables[this.from.columnid].data}else if(this.from instanceof yy.FuncValue&&alasql.from[this.from.funcid.toUpperCase()]){var args=this.from.args.map(function(arg){var as=arg.toJavaScript();var fn=new Function("params,alasql","var y;return "+as).bind(this);return fn(params,alasql)});fromdata=alasql.from[this.from.funcid.toUpperCase()].apply(this,args)}else if(typeof this.from=="undefined"){fromdata=alasql.databases[databaseid].objects}else{var fromfn=new Function("params,alasql","var y;return "+this.from.toJavaScript());fromdata=fromfn(params,alasql);if(typeof Mongo=="object"&&typeof Mongo.Collection!="object"&&fromdata instanceof Mongo.Collection){fromdata=fromdata.find().fetch()}}if(typeof selectors!="undefined"&&selectors.length>0){if(false){selectors.forEach(function(selector){if(selector.srchid=="TO"){alasql.vars[selector.args[0]]=[]}})}res=processSelector(selectors,0,fromdata)}else{res=fromdata}if(this.into){var a1,a2;if(typeof this.into.args[0]!="undefined"){a1=new Function("params,alasql","var y;return "+this.into.args[0].toJavaScript())(params,alasql)}if(typeof this.into.args[1]!="undefined"){a2=new Function("params,alasql","var y;return "+this.into.args[1].toJavaScript())(params,alasql)}res=alasql.into[this.into.funcid.toUpperCase()](a1,a2,res,[],cb)}else{if(stope.value&&res.length>0)res=res[0];if(cb)res=cb(res)}return res;function processSelector(selectors,sidx,value){var sel=selectors[sidx];var SECURITY_BREAK=1e5;if(sel.selid){if(sel.selid=="PATH"){var queue=[{node:value,stack:[]}];var visited={};var path=[];var objects=alasql.databases[alasql.useid].objects;while(queue.length>0){var q=queue.shift();var node=q.node;var stack=q.stack;var r=processSelector(sel.args,0,node);if(r.length>0){if(sidx+1+1>selectors.length){return stack}else{var rv=[];if(stack&&stack.length>0){stack.forEach(function(stv){rv=rv.concat(processSelector(selectors,sidx+1,stv))})}return rv}}else{if(typeof visited[node.$id]!="undefined"){continue}else{visited[node.$id]=true;if(node.$out&&node.$out.length>0){node.$out.forEach(function(edgeid){var edge=objects[edgeid];var stack2=stack.concat(edge);stack2.push(objects[edge.$out[0]]);queue.push({node:objects[edge.$out[0]],stack:stack2})})}}}}return[]}if(sel.selid=="NOT"){var nest=processSelector(sel.args,0,value);if(nest.length>0){return[]}else{if(sidx+1+1>selectors.length){return[value]}else{return processSelector(selectors,sidx+1,value)}}}else if(sel.selid=="DISTINCT"){if(typeof sel.args=="undefined"||sel.args.length==0){var nest=distinctArray(value)}else{var nest=processSelector(sel.args,0,value)}if(nest.length==0){return[]}else{var res=distinctArray(nest);if(sidx+1+1>selectors.length){return res}else{return processSelector(selectors,sidx+1,res)}}}else if(sel.selid=="AND"){var res=true;sel.args.forEach(function(se){res=res&&processSelector(se,0,value).length>0});if(!res){return[]}else{if(sidx+1+1>selectors.length){return[value]}else{return processSelector(selectors,sidx+1,value)}}}else if(sel.selid=="OR"){var res=false;sel.args.forEach(function(se){res=res||processSelector(se,0,value).length>0});if(!res){return[]}else{if(sidx+1+1>selectors.length){return[value]}else{return processSelector(selectors,sidx+1,value)}}}else if(sel.selid=="ALL"){var nest=processSelector(sel.args[0],0,value);if(nest.length==0){return[]}else{if(sidx+1+1>selectors.length){return nest}else{return processSelector(selectors,sidx+1,nest)}}}else if(sel.selid=="ANY"){var nest=processSelector(sel.args[0],0,value);if(nest.length==0){return[]}else{if(sidx+1+1>selectors.length){return[nest[0]]}else{return processSelector(selectors,sidx+1,[nest[0]])}}}else if(sel.selid=="UNIONALL"){var nest=[];sel.args.forEach(function(se){nest=nest.concat(processSelector(se,0,value))});if(nest.length==0){return[]}else{if(sidx+1+1>selectors.length){return nest}else{return processSelector(selectors,sidx+1,nest)}}}else if(sel.selid=="UNION"){var nest=[];sel.args.forEach(function(se){nest=nest.concat(processSelector(se,0,value))});var nest=distinctArray(nest);if(nest.length==0){return[]}else{if(sidx+1+1>selectors.length){return nest}else{return processSelector(selectors,sidx+1,nest)}}}else if(sel.selid=="IF"){var nest=processSelector(sel.args,0,value);if(nest.length==0){return[]}else{if(sidx+1+1>selectors.length){return[value]}else{return processSelector(selectors,sidx+1,value)}}}else if(sel.selid=="REPEAT"){var lmin=sel.args[0].value;if(!sel.args[1]){var lmax=lmin}else{var lmax=sel.args[1].value}if(sel.args[2]){var lvar=sel.args[2].variable}else{var lvar}var lsel=sel.sels;var retval=[];if(lmin==0){if(sidx+1+1>selectors.length){retval=[value]}else{if(lvar)alasql.vars[lvar]=0;retval=retval.concat(processSelector(selectors,sidx+1,value))}}if(lmax>0){var nests=[{value:value,lvl:1}];var i=0;while(nests.length>0){var nest=nests[0];nests.shift();if(nest.lvl<=lmax){if(lvar)alasql.vars[lvar]=nest.lvl;var nest1=processSelector(sel.sels,0,nest.value);nest1.forEach(function(n){nests.push({value:n,lvl:nest.lvl+1})});if(nest.lvl>=lmin){if(sidx+1+1>selectors.length){retval=retval.concat(nest1)}else{nest1.forEach(function(n){retval=retval.concat(processSelector(selectors,sidx+1,n))})}}}i++;if(i>SECURITY_BREAK){throw new Error("Security brake. Number of iterations = "+i)}}}return retval}else if(sel.selid=="TO"){var oldv=alasql.vars[sel.args[0]];var newv=[];if(typeof oldv!="undefined"){newv=oldv.slice(0)}else{newv=[]}newv.push(value);if(sidx+1+1>selectors.length){return[value]}else{alasql.vars[sel.args[0]]=newv;var r1=processSelector(selectors,sidx+1,value);alasql.vars[sel.args[0]]=oldv;return r1}}else if(sel.selid=="ARRAY"){var nest=processSelector(sel.args,0,value);if(nest.length>0){var val=nest}else{return[]}if(sidx+1+1>selectors.length){return[val]}else{return processSelector(selectors,sidx+1,val)}}else if(sel.selid=="SUM"){var nest=processSelector(sel.args,0,value);if(nest.length>0){var val=nest.reduce(function(sum,current){return sum+current},0)}else{return[]}if(sidx+1+1>selectors.length){return[val]}else{return processSelector(selectors,sidx+1,val)}}else if(sel.selid=="AVG"){var nest=processSelector(sel.args,0,value);if(nest.length>0){var val=nest.reduce(function(sum,current){return sum+current},0)/nest.length}else{return[]}if(sidx+1+1>selectors.length){return[val]}else{return processSelector(selectors,sidx+1,val)}}else if(sel.selid=="COUNT"){var nest=processSelector(sel.args,0,value);if(nest.length>0){var val=nest.length}else{return[]}if(sidx+1+1>selectors.length){return[val]}else{return processSelector(selectors,sidx+1,val)}}else if(sel.selid=="FIRST"){var nest=processSelector(sel.args,0,value);if(nest.length>0)var val=nest[0];else return[];if(sidx+1+1>selectors.length){return[val]}else{return processSelector(selectors,sidx+1,val)}}else if(sel.selid=="LAST"){var nest=processSelector(sel.args,0,value);if(nest.length>0)var val=nest[nest.length-1];else return[];if(sidx+1+1>selectors.length){return[val]}else{return processSelector(selectors,sidx+1,val)}}else if(sel.selid=="MIN"){var nest=processSelector(sel.args,0,value);if(nest.length==0)return[];var val=nest.reduce(function(min,current){return Math.min(min,current)},Infinity);if(sidx+1+1>selectors.length){return[val]}else{return processSelector(selectors,sidx+1,val)}}else if(sel.selid=="MAX"){var nest=processSelector(sel.args,0,value);if(nest.length==0)return[];var val=nest.reduce(function(max,current){return Math.max(max,current)},-Infinity);if(sidx+1+1>selectors.length){return[val]}else{return processSelector(selectors,sidx+1,val)}}else if(sel.selid=="PLUS"){var retval=[];var nests=processSelector(sel.args,0,value).slice();if(sidx+1+1>selectors.length){retval=retval.concat(nests)}else{nests.forEach(function(n){retval=retval.concat(processSelector(selectors,sidx+1,n))})}var i=0;while(nests.length>0){var nest=nests.shift();nest=processSelector(sel.args,0,nest);nests=nests.concat(nest);if(sidx+1+1>selectors.length){retval=retval.concat(nest)}else{nest.forEach(function(n){var rn=processSelector(selectors,sidx+1,n);retval=retval.concat(rn)})}i++;if(i>SECURITY_BREAK){throw new Error("Security brake. Number of iterations = "+i)}}return retval}else if(sel.selid=="STAR"){var retval=[];retval=processSelector(selectors,sidx+1,value);var nests=processSelector(sel.args,0,value).slice();if(sidx+1+1>selectors.length){retval=retval.concat(nests)}else{nests.forEach(function(n){retval=retval.concat(processSelector(selectors,sidx+1,n))})}var i=0;while(nests.length>0){var nest=nests[0];nests.shift();nest=processSelector(sel.args,0,nest);nests=nests.concat(nest);if(sidx+1+1>selectors.length){}else{nest.forEach(function(n){retval=retval.concat(processSelector(selectors,sidx+1,n))})}i++;if(i>SECURITY_BREAK){throw new Error("Security brake. Number of iterations = "+i)}}return retval}else if(sel.selid=="QUESTION"){var retval=[];retval=retval.concat(processSelector(selectors,sidx+1,value));var nest=processSelector(sel.args,0,value);if(sidx+1+1>selectors.length){}else{nest.forEach(function(n){retval=retval.concat(processSelector(selectors,sidx+1,n))})}return retval}else if(sel.selid=="WITH"){var nest=processSelector(sel.args,0,value);if(nest.length==0){return[]}else{var r={status:1,values:nest}}}else if(sel.selid=="ROOT"){if(sidx+1+1>selectors.length){return[value]}else{return processSelector(selectors,sidx+1,fromdata)}}else{throw new Error("Wrong selector "+sel.selid)}}else if(sel.srchid){var r=alasql.srch[sel.srchid.toUpperCase()](value,sel.args,stope,params)}else{throw new Error("Selector not found")}if(typeof r=="undefined"){r={status:1,values:[value]}}var res=[];if(r.status==1){var arr=r.values;if(sidx+1+1>selectors.length){res=arr}else{for(var i=0;i0){return{status:1,values:arr}}else{return{status:-1,values:[]}}}else{if(typeof val!="object"||val===null||typeof args!="object"||typeof val[args[0]]=="undefined"){return{status:-1,values:[]}}else{return{status:1,values:[val[args[0]]]}}}};alasql.srch.APROP=function(val,args,stope){if(typeof val!="object"||val===null||typeof args!="object"||typeof val[args[0]]=="undefined"){return{status:1,values:[undefined]}}else{return{status:1,values:[val[args[0]]]}}};alasql.srch.ORDERBY=function(val,args,stope){var res=val.sort(compileSearchOrder(args));return{status:1,values:res}};alasql.srch.EQ=function(val,args,stope,params){var exprs=args[0].toJavaScript("x","");var exprfn=new Function("x,alasql,params","return "+exprs);if(val==exprfn(val,alasql,params)){return{status:1,values:[val]}}else{return{status:-1,values:[]}}};alasql.srch.LIKE=function(val,args,stope,params){var exprs=args[0].toJavaScript("x","");var exprfn=new Function("x,alasql,params","return "+exprs);if(val.toUpperCase().match(new RegExp("^"+exprfn(val,alasql,params).toUpperCase().replace(/%/g,".*")+"$"),"g")){return{status:1,values:[val]}}else{return{status:-1,values:[]}}};alasql.srch.ATTR=function(val,args,stope){if(stope.mode=="XML"){if(typeof args=="undefined"){return{status:1,values:[val.attributes]}}else{if(typeof val=="object"&&typeof val.attributes=="object"&&typeof val.attributes[args[0]]!="undefined"){return{status:1,values:[val.attributes[args[0]]]}}else{return{status:-1,values:[]}}}}else{throw new Error("ATTR is not using in usual mode")}};alasql.srch.CONTENT=function(val,args,stope){if(stope.mode=="XML"){return{status:1,values:[val.content]}}else{throw new Error("ATTR is not using in usual mode")}};alasql.srch.SHARP=function(val,args,stope){var obj=alasql.databases[alasql.useid].objects[args[0]];if(typeof val!="undefined"&&val===obj){return{status:1,values:[val]}}else{return{status:-1,values:[]}}};alasql.srch.PARENT=function(val,args,stope){console.log("PARENT");return{status:-1,values:[]}};alasql.srch.CHILD=function(val,args,stope){if(typeof val=="object"){if(val instanceof Array){return{status:1,values:val}}else{if(stope.mode=="XML"){return{status:1,values:Object.keys(val.children).map(function(key){return val.children[key]})}}else{return{status:1,values:Object.keys(val).map(function(key){return val[key]})}}}}else{return{status:1,values:[]}}};alasql.srch.KEYS=function(val,args){if(typeof val=="object"&&val!==null){return{status:1,values:Object.keys(val)}}else{return{status:1,values:[]}}};alasql.srch.WHERE=function(val,args){var exprs=args[0].toJavaScript("x","");var exprfn=new Function("x,alasql","return "+exprs);if(exprfn(val,alasql)){return{status:1,values:[val]}}else{return{status:-1,values:[]}}};alasql.srch.NAME=function(val,args){if(val.name==args[0]){return{status:1,values:[val]}}else{return{status:-1,values:[]}}};alasql.srch.CLASS=function(val,args){if(val.$class==args){return{status:1,values:[val]}}else{return{status:-1,values:[]}}};alasql.srch.VERTEX=function(val,args){if(val.$node=="VERTEX"){return{status:1,values:[val]}}else{return{status:-1,values:[]}}};alasql.srch.INSTANCEOF=function(val,args){if(val instanceof alasql.fn[args[0]]){return{status:1,values:[val]}}else{return{status:-1,values:[]}}};alasql.srch.EDGE=function(val,args){if(val.$node=="EDGE"){return{status:1,values:[val]}}else{return{status:-1,values:[]}}};alasql.srch.EX=function(val,args,stope,params){var exprs=args[0].toJavaScript("x","");var exprfn=new Function("x,alasql,params","return "+exprs);return{status:1,values:[exprfn(val,alasql,params)]}};alasql.srch.RETURN=function(val,args,stope,params){var res={};if(args&&args.length>0){args.forEach(function(arg){var exprs=arg.toJavaScript("x","");var exprfn=new Function("x,alasql,params","return "+exprs);if(typeof arg.as=="undefined")arg.as=arg.toString();res[arg.as]=exprfn(val,alasql,params)})}return{status:1,values:[res]}};alasql.srch.REF=function(val,args){return{status:1,values:[alasql.databases[alasql.useid].objects[val]]}};alasql.srch.OUT=function(val,args){if(val.$out&&val.$out.length>0){var res=val.$out.map(function(v){return alasql.databases[alasql.useid].objects[v]});return{status:1,values:res}}else{return{status:-1,values:[]}}};alasql.srch.IN=function(val,args){if(val.$in&&val.$in.length>0){var res=val.$in.map(function(v){return alasql.databases[alasql.useid].objects[v]});return{status:1,values:res}}else{return{status:-1,values:[]}}};alasql.srch.AS=function(val,args){alasql.vars[args[0]]=val;return{status:1,values:[val]}};alasql.srch.AT=function(val,args){var v=alasql.vars[args[0]];return{status:1,values:[v]}};alasql.srch.CLONEDEEP=function(val,args){var z=cloneDeep(val);return{status:1,values:[z]}};alasql.srch.SET=function(val,args,stope,params){var s=args.map(function(st){if(st.method=="@"){return"alasql.vars['"+st.variable+"']="+st.expression.toJavaScript("x","")}else if(st.method=="$"){return"params['"+st.variable+"']="+st.expression.toJavaScript("x","")}else{return"x['"+st.column.columnid+"']="+st.expression.toJavaScript("x","")}}).join(";");var setfn=new Function("x,params,alasql",s);setfn(val,params,alasql);return{status:1,values:[val]}};alasql.srch.ROW=function(val,args,stope,params){var s="var y;return [";s+=args.map(function(arg){return arg.toJavaScript("x","")}).join(",");s+="]";var setfn=new Function("x,params,alasql",s);var rv=setfn(val,params,alasql);return{status:1,values:[rv]}};alasql.srch.D3=function(val,args,stope,params){if(val.$node=="VERTEX"){}else if(val.$node=="EDGE"){val.source=val.$in[0];val.target=val.$out[0]}return{status:1,values:[val]}};compileSearchOrder=function(order){if(order){if(order&&order.length==1&&order[0].expression&&typeof order[0].expression=="function"){var func=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="";order.forEach(function(ord,idx){var dg="";if(ord.expression instanceof yy.NumValue){ord.expression=self.columns[ord.expression.value-1]}if(ord.expression instanceof yy.Column){var columnid=ord.expression.columnid;if(alasql.options.valueof)dg=".valueOf()";if(ord.nocase)dg+=".toUpperCase()";if(columnid=="_"){s+="if(a"+dg+(ord.direction=="ASC"?">":"<")+"b"+dg+")return 1;";s+="if(a"+dg+"==b"+dg+"){"}else{s+="if((a['"+columnid+"']||'')"+dg+(ord.direction=="ASC"?">":"<")+"(b['"+columnid+"']||'')"+dg+")return 1;";s+="if((a['"+columnid+"']||'')"+dg+"==(b['"+columnid+"']||'')"+dg+"){"}}else{dg=".valueOf()";if(ord.nocase)dg+=".toUpperCase()";s+="if(("+ord.toJavaScript("a","")+"||'')"+dg+(ord.direction=="ASC"?">(":"<(")+ord.toJavaScript("b","")+"||'')"+dg+")return 1;";s+="if(("+ord.toJavaScript("a","")+"||'')"+dg+"==("+ord.toJavaScript("b","")+"||'')"+dg+"){"}sk+="}"});s+="return 0;";s+=sk+"return -1";return new Function("a,b",s)}};function queryfn(query,oldscope,cb,A,B){var ms;query.sourceslen=query.sources.length;var slen=query.sourceslen;query.query=query;query.A=A;query.B=B;query.cb=cb;query.oldscope=oldscope;if(query.queriesfn){query.sourceslen+=query.queriesfn.length;slen+=query.queriesfn.length;query.queriesdata=[];query.queriesfn.forEach(function(q,idx){q.query.params=query.params;if(false){queryfn(q.query,query.oldscope,queryfn2,-idx-1,query)}else{queryfn2([],-idx-1,query)}})}var scope;if(!oldscope)scope={};else scope=cloneDeep(oldscope);query.scope=scope;var result;query.sources.forEach(function(source,idx){source.query=query;var rs=source.datafn(query,query.params,queryfn2,idx,alasql);if(typeof rs!=undefined){if((query.intofn||query.intoallfn)&&rs instanceof Array)rs=rs.length;result=rs}source.queriesdata=query.queriesdata});if(slen==0)result=queryfn3(query);return result}function queryfn2(data,idx,query){if(idx>=0){var source=query.sources[idx];source.data=data;if(typeof source.data=="function"){source.getfn=source.data;source.dontcache=source.getfn.dontcache;if(source.joinmode=="OUTER"||source.joinmode=="RIGHT"||source.joinmode=="ANTI"){source.dontcache=false}source.data={}}}else{query.queriesdata[-idx-1]=flatArray(data)}query.sourceslen--;if(query.sourceslen>0)return;return queryfn3(query)}function queryfn3(query){var scope=query.scope;preIndex(query);query.data=[];query.xgroups={};query.groups=[];var h=0;doJoin(query,scope,h);if(query.groupfn){query.data=[];if(query.groups.length==0){var g={};if(query.selectGroup.length>0){query.selectGroup.forEach(function(sg){if(sg.aggregatorid=="COUNT"||sg.aggregatorid=="SUM"){g[sg.nick]=0}else{g[sg.nick]=undefined}})}query.groups=[g]}for(var i=0,ilen=query.groups.length;i0){var removeKeys=query.removeKeys;var jlen=removeKeys.length;if(jlen>0){for(var i=0,ilen=query.data.length;i0){query.columns=query.columns.filter(function(column){var found=false;removeKeys.forEach(function(key){if(column.columnid==key)found=true});return!found})}}if(typeof query.removeLikeKeys!="undefined"&&query.removeLikeKeys.length>0){var removeLikeKeys=query.removeLikeKeys;for(var i=0,ilen=query.data.length;i0){query.columns=query.columns.filter(function(column){var found=false;removeLikeKeys.forEach(function(key){if(column.columnid.match(key))found=true});return!found})}}if(query.intoallfn){var res=query.intoallfn(query.columns,query.cb,query.params,query.alasql);return res}else if(query.intofn){for(var i=0,ilen=query.data.length;i0&&source.optimization=="ix"&&source.onleftfn&&source.onrightfn){if(source.databaseid&&alasql.databases[source.databaseid].tables[source.tableid]){if(!alasql.databases[source.databaseid].tables[source.tableid].indices)query.database.tables[source.tableid].indices={};var ixx=alasql.databases[source.databaseid].tables[source.tableid].indices[hash(source.onrightfns+"`"+source.srcwherefns)];if(!alasql.databases[source.databaseid].tables[source.tableid].dirty&&ixx){source.ix=ixx}}if(!source.ix){source.ix={};var scope={};var i=0;var ilen=source.data.length;var dataw;while((dataw=source.data[i])||source.getfn&&(dataw=source.getfn(i))||i=query.sources.length){if(query.wherefn(scope,query.params,alasql)){if(query.groupfn){query.groupfn(scope,query.params,alasql)}else{query.data.push(query.selectfn(scope,query.params,alasql))}}}else if(query.sources[h].applyselect){var source=query.sources[h];source.applyselect(query.params,function(data){if(data.length>0){for(var i=0;i0){s+=NL()+ID()+K("GROUP BY")+" "+this.group.map(function(grp){return grp.toString()}).join(", ")}if(this.having)s+=NL()+ID()+K("HAVING")+" "+this.having.toString();if(this.order&&this.order.length>0){s+=NL()+ID()+K("ORDER BY")+" "+this.order.map(function(ord){return ord.toString()}).join(", ")}if(this.limit)s+=NL()+ID()+K("LIMIT")+" "+this.limit.value;if(this.offset)s+=NL()+ID()+K("OFFSET")+" "+this.offset.value;if(this.union)s+=NL()+K("UNION")+(this.corresponding?" "+K("CORRESPONDING"):"")+NL()+this.union.toString();if(this.unionall)s+=NL()+K("UNION ALL")+(this.corresponding?" "+K("CORRESPONDING"):"")+NL()+this.unionall.toString();if(this.except)s+=NL()+K("EXCEPT")+(this.corresponding?" "+K("CORRESPONDING"):"")+NL()+this.except.toString();if(this.intersect)s+=NL()+K("INTERSECT")+(this.corresponding?" "+K("CORRESPONDING"):"")+NL()+this.intersect.toString();return s};yy.Select.prototype.toJavaScript=function(context,tableid,defcols){var s="alasql.utils.flatArray(this.queriesfn["+(this.queriesidx-1)+"](this.params,null,"+context+"))[0]";return s};yy.Select.prototype.compile=function(databaseid){var db=alasql.databases[databaseid];var query=new Query;query.removeKeys=[];query.explain=this.explain;query.explaination=[];query.explid=1;query.modifier=this.modifier;query.database=db;this.compileWhereExists(query);this.compileQueries(query);query.defcols=this.compileDefCols(query,databaseid);query.fromfn=this.compileFrom(query);if(this.joins)this.compileJoins(query);query.rownums=[];this.compileSelectGroup0(query);if(this.group||query.selectGroup.length>0){query.selectgfns=this.compileSelectGroup1(query)}else{query.selectfns=this.compileSelect1(query)}this.compileRemoveColumns(query);if(this.where)this.compileWhereJoins(query);query.wherefn=this.compileWhere(query);if(this.group||query.selectGroup.length>0)query.groupfn=this.compileGroup(query);if(this.having)query.havingfn=this.compileHaving(query);if(this.group||query.selectGroup.length>0){query.selectgfn=this.compileSelectGroup2(query)}else{query.selectfn=this.compileSelect2(query)}query.distinct=this.distinct;if(this.order)query.orderfn=this.compileOrder(query);if(this.top){query.limit=this.top.value}else if(this.limit){query.limit=this.limit.value;if(this.offset){query.offset=this.offset.value}}query.percent=this.percent;query.corresponding=this.corresponding;if(this.union){query.unionfn=this.union.compile(databaseid);if(this.union.order){query.orderfn=this.union.compileOrder(query)}else{query.orderfn=null}}else if(this.unionall){query.unionallfn=this.unionall.compile(databaseid);if(this.unionall.order){query.orderfn=this.unionall.compileOrder(query)}else{query.orderfn=null}}else if(this.except){query.exceptfn=this.except.compile(databaseid);if(this.except.order){query.orderfn=this.except.compileOrder(query)}else{query.orderfn=null}}else if(this.intersect){query.intersectfn=this.intersect.compile(databaseid);if(this.intersect.order){query.intersectfn=this.intersect.compileOrder(query)}else{query.orderfn=null}}if(this.into){if(this.into instanceof yy.Table){if(alasql.options.autocommit&&alasql.databases[this.into.databaseid||databaseid].engineid){query.intoallfns='return alasql.engines["'+alasql.databases[this.into.databaseid||databaseid].engineid+'"]'+'.intoTable("'+(this.into.databaseid||databaseid)+'","'+this.into.tableid+'",this.data, columns, cb);'}else{query.intofns="alasql.databases['"+(this.into.databaseid||databaseid)+"'].tables"+"['"+this.into.tableid+"'].data.push(r);"}}else if(this.into instanceof yy.VarValue){query.intoallfns='alasql.vars["'+this.into.variable+'"]=this.data;res=this.data.length;if(cb)res=cb(res);return res;'}else if(this.into instanceof yy.FuncValue){var qs="return alasql.into['"+this.into.funcid.toUpperCase()+"'](";if(this.into.args&&this.into.args.length>0){qs+=this.into.args[0].toJavaScript()+",";if(this.into.args.length>1){qs+=this.into.args[1].toJavaScript()+","}else{qs+="undefined,"}}else{qs+="undefined, undefined,"}query.intoallfns=qs+"this.data,columns,cb)"}else if(this.into instanceof yy.ParamValue){query.intofns="params['"+this.into.param+"'].push(r)"}if(query.intofns){query.intofn=new Function("r,i,params,alasql","var y;"+query.intofns)}else if(query.intoallfns){query.intoallfn=new Function("columns,cb,params,alasql","var y;"+query.intoallfns)}}var statement=function(params,cb,oldscope){query.params=params;var res1=queryfn(query,oldscope,function(res){if(query.rownums.length>0){for(var i=0,ilen=res.length;i0){var allcol={};for(var i=0;i0){var key;if(columns&&columns.length>0)key=columns[0].columnid;else key=Object.keys(res[0])[0];res=res[0][key]}else{res=undefined}}if(modifier=="ROW"){if(res.length>0){var key;var a=[];for(var key in res[0]){a.push(res[0][key])}res=a}else{res=undefined}}if(modifier=="COLUMN"){var ar=[];if(res.length>0){var key;if(columns&&columns.length>0)key=columns[0].columnid;else key=Object.keys(res[0])[0];for(var i=0,ilen=res.length;i0){key=columns[0].columnid;val=columns[1].columnid}else{var okeys=Object.keys(res[0]);key=okeys[0];val=okeys[1]}for(var i=0,ilen=res.length;i0)key=columns[0].columnid;else key=Object.keys(res[0])[0];var s="";for(var i=0,ilen=res.length;i0){if(tq.args[0]){s+=tq.args[0].toJavaScript("query.oldscope")+","}else{s+="null,"}if(tq.args[1]){s+=tq.args[1].toJavaScript("query.oldscope")+","}else{s+="null,"}}else{s+="null,null,"}s+="cb,idx,query";s+=");/*if(cb)res=cb(res,idx,query);*/return res";source.datafn=new Function("query, params, cb, idx, alasql",s)}else if(tq instanceof yy.FromData){source.datafn=function(query,params,cb,idx,alasql){var res=tq.data;if(cb)res=cb(res,idx,query);return res}}else{throw new Error("Wrong table at FROM")}query.sources.push(source)});query.defaultTableid=query.sources[0].alias};alasql.prepareFromData=function(data,array){var res=data;if(typeof data=="string"){res=data.split(/\r?\n/);if(array){for(var i=0,ilen=res.length;i0){if(jn.args[0]){s+=jn.args[0].toJavaScript("query.oldscope")+","}else{s+="null,"}if(jn.args[1]){s+=jn.args[1].toJavaScript("query.oldscope")+","}else{s+="null,"}}else{s+="null,null,"}s+="cb,idx,query";s+=");/*if(cb)res=cb(res,idx,query);*/return res";source.datafn=new Function("query, params, cb, idx, alasql",s);query.aliases[source.alias]={type:"funcvalue"}}var alias=source.alias;if(jn.natural){if(jn.using||jn.on){throw new Error("NATURAL JOIN cannot have USING or ON clauses")}else{if(query.sources.length>0){var prevSource=query.sources[query.sources.length-1];var prevTable=alasql.databases[prevSource.databaseid].tables[prevSource.tableid];var table=alasql.databases[source.databaseid].tables[source.tableid];if(prevTable&&table){var c1=prevTable.columns.map(function(col){return col.columnid});var c2=table.columns.map(function(col){return col.columnid});jn.using=arrayIntersect(c1,c2).map(function(colid){return{columnid:colid}})}else{throw new Error("In this version of Alasql NATURAL JOIN "+"works for tables with predefined columns only")}}}}if(jn.using){var prevSource=query.sources[query.sources.length-1];source.onleftfns=jn.using.map(function(col){return"p['"+(prevSource.alias||prevSource.tableid)+"']['"+col.columnid+"']"}).join('+"`"+');source.onleftfn=new Function("p,params,alasql","var y;return "+source.onleftfns);source.onrightfns=jn.using.map(function(col){return"p['"+(source.alias||source.tableid)+"']['"+col.columnid+"']"}).join('+"`"+');source.onrightfn=new Function("p,params,alasql","var y;return "+source.onrightfns);source.optimization="ix"}else if(jn.on){if(jn.on instanceof yy.Op&&jn.on.op=="="&&!jn.on.allsome){source.optimization="ix";var lefts="";var rights="";var middles="";var middlef=false;var ls=jn.on.left.toJavaScript("p",query.defaultTableid,query.defcols);var rs=jn.on.right.toJavaScript("p",query.defaultTableid,query.defcols);if(ls.indexOf("p['"+alias+"']")>-1&&!(rs.indexOf("p['"+alias+"']")>-1)){if((ls.match(/p\[\'.*?\'\]/g)||[]).every(function(s){return s=="p['"+alias+"']"})){rights=ls}else{middlef=true}}else if(!(ls.indexOf("p['"+alias+"']")>-1)&&rs.indexOf("p['"+alias+"']")>-1){if((rs.match(/p\[\'.*?\'\]/g)||[]).every(function(s){return s=="p['"+alias+"']"})){lefts=ls}else{middlef=true}}else{middlef=true}if(rs.indexOf("p['"+alias+"']")>-1&&!(ls.indexOf("p['"+alias+"']")>-1)){if((rs.match(/p\[\'.*?\'\]/g)||[]).every(function(s){return s=="p['"+alias+"']"})){rights=rs}else{middlef=true}}else if(!(rs.indexOf("p['"+alias+"']")>-1)&&ls.indexOf("p['"+alias+"']")>-1){if((ls.match(/p\[\'.*?\'\]/g)||[]).every(function(s){return s=="p['"+alias+"']"})){lefts=rs}else{middlef=true}}else{middlef=true}if(middlef){rights="";lefts="";middles=jn.on.toJavaScript("p",query.defaultTableid,query.defcols);source.optimization="no"}source.onleftfns=lefts;source.onrightfns=rights;source.onmiddlefns=middles||"true";source.onleftfn=new Function("p,params,alasql","var y;return "+source.onleftfns);source.onrightfn=new Function("p,params,alasql","var y;return "+source.onrightfns);source.onmiddlefn=new Function("p,params,alasql","var y;return "+source.onmiddlefns)}else{source.optimization="no";source.onmiddlefns=jn.on.toJavaScript("p",query.defaultTableid,query.defcols);source.onmiddlefn=new Function("p,params,alasql","var y;return "+jn.on.toJavaScript("p",query.defaultTableid,query.defcols))}}query.sources.push(source)}})};yy.Select.prototype.compileWhere=function(query){if(this.where){if(typeof this.where=="function"){return this.where}else{s=this.where.toJavaScript("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;optimizeWhereJoin(query,this.where.expression);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)}})};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.toJavaScript("p",query.defaultTableid,query.defcols);var fsrc=[];query.sources.forEach(function(source,idx){if(source.tableid){if(s.indexOf("p['"+source.alias+"']")>-1)fsrc.push(source)}});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}var src=fsrc[0];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.toJavaScript("p",query.defaultTableid,query.defcols);var rs=ast.right.toJavaScript("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.toJavaScript("p",query.defaultTableid,query.defcols);var rs=ast.right.toJavaScript("p",query.defaultTableid,query.defcols);if(ls.indexOf("p['"+fsrc[0].alias+"']")==-1){fsrc[0].wxleftfns=rs;fsrc[0].wxrightfns=ls}}}ast.reduced=true;return}else{if(ast.op="AND"){optimizeWhereJoin(query,ast.left);optimizeWhereJoin(query,ast.right)}}}yy.Select.prototype.compileGroup=function(query){var self=this;if(query.sources.length>0){var tableid=query.sources[0].alias}else{var tableid=""}var defcols=query.defcols;var allgroup=[[]];if(this.group){allgroup=decartes(this.group,query)}var allgroups=[];allgroup.forEach(function(a){allgroups=arrayUnion(allgroups,a)});query.allgroups=allgroups;if(false){allgroups.forEach(function(col2){if(query.selectColumns[colid]){}else{var tmpid="default";if(query.sources.length>0)tmpid=query.sources[0].alias;if(Object.keys(query.selectColumns).length!=0)query.removeKeys.push(colid);query.selectfns+="r['"+escapeq(colid)+"']="+new yy.Column({columnid:colid}).toJavaScript("p",tmpid)+";"}})}var s="";allgroup.forEach(function(agroup){s+="var acc,g=this.xgroups[";var rg=agroup.map(function(col2){var columnid=col2.split(" ")[0];var coljs=col2.split(" ")[1];if(columnid=="")return"1";else return coljs});if(rg.length==0)rg=["''"];s+=rg.join('+"`"+');s+="];if(!g) {this.groups.push((g=this.xgroups[";s+=rg.join('+"`"+');s+="] = {";s+=agroup.map(function(col2){var columnid=col2.split(" ")[0];var coljs=col2.split(" ")[1];if(columnid=="")return"";else return"'"+columnid+"':"+coljs+","}).join("");var neggroup=arrayDiff(allgroups,agroup);s+=neggroup.map(function(col2){var columnid=col2.split(" ")[0];var coljs=col2.split(" ")[1];return"'"+columnid+"':null,"}).join("");var aft="";s+=query.selectGroup.map(function(col,idx){var colexp=col.expression.toJavaScript("p",tableid,defcols);var colas=col.nick;if(col instanceof yy.AggrValue){if(col.distinct){aft+=",g['$$_VALUES_"+colas+"']={},g['$$_VALUES_"+colas+"']["+colexp+"]=true"}if(col.aggregatorid=="SUM"){return"'"+colas+"':("+colexp+")||0,"}else if(col.aggregatorid=="MIN"||col.aggregatorid=="MAX"||col.aggregatorid=="FIRST"||col.aggregatorid=="LAST"){return"'"+colas+"':"+colexp+","}else if(col.aggregatorid=="ARRAY"){return"'"+colas+"':["+colexp+"],"}else if(col.aggregatorid=="COUNT"){if(col.expression.columnid=="*"){return"'"+colas+"':1,"}else{return"'"+colas+"':(typeof "+colexp+' != "undefined")?1:0,'}}else if(col.aggregatorid=="AVG"){query.removeKeys.push("_SUM_"+colas);query.removeKeys.push("_COUNT_"+colas);return"'"+colas+"':"+colexp+",'_SUM_"+colas+"':("+colexp+")||0,'_COUNT_"+colas+"':(typeof "+colexp+' != "undefined")?1:0,'}else if(col.aggregatorid=="AGGR"){aft+=",g['"+colas+"']="+col.expression.toJavaScript("g",-1);return""}else if(col.aggregatorid=="REDUCE"){query.removeKeys.push("_REDUCE_"+colas);return"'"+colas+"':alasql.aggr['"+col.funcid+"']("+colexp+",undefined,(acc={})),"+"'__REDUCE__"+colas+"':acc,"}return""}else return""}).join("");s+="}"+aft+",g));} else {";s+=query.selectGroup.map(function(col,idx){var colas=col.nick;var colexp=col.expression.toJavaScript("p",tableid,defcols);if(col instanceof yy.AggrValue){if(col.distinct){var pre="if(typeof "+colexp+'!="undefined" && (!g[\'$$_VALUES_'+colas+"']["+colexp+"])) {";var post="g['$$_VALUES_"+colas+"']["+colexp+"]=true;}"}else{var pre="",post=""}if(col.aggregatorid=="SUM"){return pre+"g['"+colas+"']+=("+colexp+"||0);"+post}else if(col.aggregatorid=="COUNT"){if(col.expression.columnid=="*")return pre+"g['"+colas+"']++;"+post;else{return pre+"if(typeof "+colexp+'!="undefined") g[\''+colas+"']++;"+post}}else if(col.aggregatorid=="ARRAY"){return pre+"g['"+colas+"'].push("+colexp+");"+post}else if(col.aggregatorid=="MIN"){return pre+"g['"+colas+"']=Math.min(g['"+colas+"'],"+colexp+");"+post}else if(col.aggregatorid=="MAX"){return pre+"g['"+colas+"']=Math.max(g['"+colas+"'],"+colexp+");"+post}else if(col.aggregatorid=="FIRST"){return""}else if(col.aggregatorid=="LAST"){return pre+"g['"+colas+"']="+colexp+";"+post}else if(col.aggregatorid=="AVG"){return pre+"g['_SUM_"+colas+"']+=(y="+colexp+")||0;"+"g['_COUNT_"+colas+'\']+=(typeof y!="undefined")?1:0;'+"g['"+colas+"']=g['_SUM_"+colas+"']/g['_COUNT_"+colas+"'];"+post}else if(col.aggregatorid=="AGGR"){return pre+"g['"+colas+"']="+col.expression.toJavaScript("g",-1)+";"+post}else if(col.aggregatorid=="REDUCE"){return pre+"g['"+colas+"']=alasql.aggr."+col.funcid+"("+colexp+",g['"+colas+"'],g['__REDUCE__"+colas+"']);"+post}return""}else return""}).join("");s+="}"});return new Function("p,params,alasql",s)};function compileSelectStar(query,alias){var s="",sp="",ss=[];query.ixsources={};query.sources.forEach(function(source){query.ixsources[source.alias]=source});var columns;if(query.ixsources[alias]){var columns=query.ixsources[alias].columns}if(columns&&columns.length>0){columns.forEach(function(tcol){ss.push("'"+tcol.columnid+"':p['"+alias+"']['"+tcol.columnid+"']");query.selectColumns[escapeq(tcol.columnid)]=true;var coldef={columnid:tcol.columnid,dbtypeid:tcol.dbtypeid,dbsize:tcol.dbsize,dbprecision:tcol.dbprecision,dbenum:tcol.dbenum};query.columns.push(coldef);query.xcolumns[coldef.columnid]=coldef})}else{sp+='var w=p["'+alias+'"];for(var k in w){r[k]=w[k]};';query.dirtyColumns=true}return{s:ss.join(","),sp:sp}}yy.Select.prototype.compileSelect1=function(query){var self=this;query.columns=[];query.xcolumns={};query.selectColumns={};query.dirtyColumns=false;var s="var r={";var sp="";var ss=[];this.columns.forEach(function(col){if(col instanceof yy.Column){if(col.columnid=="*"){if(col.func){sp+="r=params['"+col.param+"'](p['"+query.sources[0].alias+"'],p,params,alasql);"}else if(col.tableid){var ret=compileSelectStar(query,col.tableid);if(ret.s)ss=ss.concat(ret.s);sp+=ret.sp}else{for(var alias in query.aliases){var ret=compileSelectStar(query,alias);if(ret.s)ss=ss.concat(ret.s);sp+=ret.sp}}}else{var tbid=col.tableid;var dbid=col.databaseid||query.sources[0].databaseid||query.database.databaseid;if(!tbid)tbid=query.defcols[col.columnid];if(!tbid)tbid=query.defaultTableid;if(col.columnid!="_"){ss.push("'"+escapeq(col.as||col.columnid)+"':p['"+tbid+"']['"+col.columnid+"']")
}else{ss.push("'"+escapeq(col.as||col.columnid)+"':p['"+tbid+"']")}query.selectColumns[escapeq(col.as||col.columnid)]=true;if(query.aliases[tbid]&&query.aliases[tbid].type=="table"){if(!alasql.databases[dbid].tables[query.aliases[tbid].tableid]){throw new Error("Table '"+tbid+"' does not exists in database")}var columns=alasql.databases[dbid].tables[query.aliases[tbid].tableid].columns;var xcolumns=alasql.databases[dbid].tables[query.aliases[tbid].tableid].xcolumns;if(xcolumns&&columns.length>0){var tcol=xcolumns[col.columnid];var coldef={columnid:col.as||col.columnid,dbtypeid:tcol.dbtypeid,dbsize:tcol.dbsize,dbpecision:tcol.dbprecision,dbenum:tcol.dbenum};query.columns.push(coldef);query.xcolumns[coldef.columnid]=coldef}else{var coldef={columnid:col.as||col.columnid};query.columns.push(coldef);query.xcolumns[coldef.columnid]=coldef;query.dirtyColumns=true}}else{var coldef={columnid:col.as||col.columnid};query.columns.push(coldef);query.xcolumns[coldef.columnid]=coldef}}}else if(col instanceof yy.AggrValue){if(!self.group){self.group=[""]}if(!col.as)col.as=escapeq(col.toString());if(col.aggregatorid=="SUM"||col.aggregatorid=="MAX"||col.aggregatorid=="MIN"||col.aggregatorid=="FIRST"||col.aggregatorid=="LAST"||col.aggregatorid=="AVG"||col.aggregatorid=="ARRAY"||col.aggregatorid=="REDUCE"){ss.push("'"+escapeq(col.as)+"':"+n2u(col.expression.toJavaScript("p",query.defaultTableid,query.defcols)))}else if(col.aggregatorid=="COUNT"){ss.push("'"+escapeq(col.as)+"':1")}query.selectColumns[col.aggregatorid+"("+escapeq(col.expression.toString())+")"]=thtd;var coldef={columnid:col.as||col.columnid||col.toString()};query.columns.push(coldef);query.xcolumns[coldef.columnid]=coldef}else{ss.push("'"+escapeq(col.as||col.columnid||col.toString())+"':"+n2u(col.toJavaScript("p",query.defaultTableid,query.defcols)));query.selectColumns[escapeq(col.as||col.columnid||col.toString())]=true;var coldef={columnid:col.as||col.columnid||col.toString()};query.columns.push(coldef);query.xcolumns[coldef.columnid]=coldef}});s+=ss.join(",")+"};"+sp;return s};yy.Select.prototype.compileSelect2=function(query){var s=query.selectfns;return new Function("p,params,alasql","var y;"+s+"return r")};yy.Select.prototype.compileSelectGroup0=function(query){var self=this;self.columns.forEach(function(col,idx){if(col instanceof yy.Column&&col.columnid=="*"){}else{var colas;if(col instanceof yy.Column){colas=escapeq(col.columnid)}else{colas=escapeq(col.toString())}for(var i=0;irb)return 1;if(ra==rb)return 0;return-1}}var s="";var sk="";this.order.forEach(function(ord,idx){var dg="";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")dg=".valueOf()"}else{if(alasql.options.valueof)dg=".valueOf()"}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()";if(ord.nocase)dg+=".toUpperCase()";s+="if(("+ord.toJavaScript("a","")+"||'')"+dg+(ord.direction=="ASC"?">(":"<(")+ord.toJavaScript("b","")+"||'')"+dg+")return 1;";s+="if(("+ord.toJavaScript("a","")+"||'')"+dg+"==("+ord.toJavaScript("b","")+"||'')"+dg+"){"}sk+="}"});s+="return 0;";s+=sk+"return -1";query.orderfns=s;return new Function("a,b","var y;"+s)}};var rollup=function(a,query){var rr=[];var mask=0;var glen=a.length;for(var g=0;g"||this.op=="!"){var s=this.left.toString()+this.op;if(typeof this.right!="string"&&typeof this.right!="number")s+="(";s+=this.right.toString();if(typeof this.right!="string"&&typeof this.right!="number")s+=")";return s}return this.left.toString()+" "+P(this.op)+" "+(this.allsome?this.allsome+" ":"")+this.right.toString()};yy.Op.prototype.findAggregator=function(query){if(this.left&&this.left.findAggregator)this.left.findAggregator(query);if(this.right&&this.right.findAggregator&&!this.allsome){this.right.findAggregator(query)}};yy.Op.prototype.toType=function(tableid){if(["-","*","/","%","^"].indexOf(this.op)>-1)return"number";if(this.op=="+"){if(this.left.toType(tableid)=="string"||this.right.toType(tableid)=="string")return"string";if(this.left.toType(tableid)=="number"||this.right.toType(tableid)=="number")return"number"}if(["AND","OR","NOT","=","==","===","!=","!==","!===",">",">=","<","<=","IN","NOT IN","LIKE","NOT LIKE"].indexOf(this.op)>-1)return"boolean";if(this.op=="BETWEEN"||this.op=="NOT BETWEEN"||this.op=="IS NULL"||this.op=="IS NOT NULL")return"boolean";if(this.allsome)return"boolean";if(!this.op)return this.left.toType();return"unknown"};yy.Op.prototype.toJavaScript=function(context,tableid,defcols){var op=this.op;if(this.op=="=")op="===";else if(this.op=="<>")op="!=";else if(this.op=="OR")op="||";if(this.op=="->"){if(typeof this.right=="string"){return this.left.toJavaScript(context,tableid,defcols)+'["'+this.right+'"]'}else if(typeof this.right=="number"){return this.left.toJavaScript(context,tableid,defcols)+"["+this.right+"]"}else if(this.right instanceof yy.FuncValue){ss=[];if(!this.right.args||this.right.args.length==0){}else{var ss=this.right.args.map(function(arg){return arg.toJavaScript(context,tableid,defcols)})}return this.left.toJavaScript(context,tableid,defcols)+"['"+this.right.funcid+"']("+ss.join(",")+")"}else{return this.left.toJavaScript(context,tableid,defcols)+"["+this.right.toJavaScript(context,tableid,defcols)+"]"}}if(this.op=="!"){if(typeof this.right=="string"){return"alasql.databases[alasql.useid].objects["+this.left.toJavaScript(context,tableid,defcols)+']["'+this.right+'"]'}}if(this.op=="IS"){return"((typeof "+this.left.toJavaScript(context,tableid,defcols)+"=='undefined') == "+"(typeof "+this.right.toJavaScript(context,tableid,defcols)+"=='undefined'))"}if(this.op=="=="){return"alasql.utils.deepEqual("+this.left.toJavaScript(context,tableid,defcols)+","+this.right.toJavaScript(context,tableid,defcols)+")"}if(this.op=="==="){return"(("+this.left.toJavaScript(context,tableid,defcols)+").valueOf()===("+this.right.toJavaScript(context,tableid,defcols)+".valueOf()))"}if(this.op=="!==="){return"!(("+this.left.toJavaScript(context,tableid,defcols)+").valueOf()===("+this.right.toJavaScript(context,tableid,defcols)+".valueOf()))"}if(this.op=="!=="){return"(!alasql.utils.deepEqual("+this.left.toJavaScript(context,tableid,defcols)+","+this.right.toJavaScript(context,tableid,defcols)+"))"}if(this.op=="LIKE"){var s="("+this.left.toJavaScript(context,tableid,defcols)+"+'')"+".toUpperCase().match(new RegExp('^'+("+this.right.toJavaScript(context,tableid,defcols)+").replace(/\\%/g,'.*').toUpperCase()+'$','g'))";return s}if(this.op=="NOT LIKE"){var s="!(("+this.left.toJavaScript(context,tableid,defcols)+"+'')"+".toUpperCase().match(new RegExp('^'+("+this.right.toJavaScript(context,tableid,defcols)+").replace(/\\%/g,'.*').toUpperCase()+'$','g')))";return s}if(this.op=="BETWEEN"){return"(("+this.right1.toJavaScript(context,tableid,defcols)+"<="+this.left.toJavaScript(context,tableid,defcols)+")&&"+"("+this.left.toJavaScript(context,tableid,defcols)+"<="+this.right2.toJavaScript(context,tableid,defcols)+"))"}if(this.op=="NOT BETWEEN"){return"!(("+this.right1.toJavaScript(context,tableid,defcols)+"<="+this.left.toJavaScript(context,tableid,defcols)+")&&"+"("+this.left.toJavaScript(context,tableid,defcols)+"<="+this.right2.toJavaScript(context,tableid,defcols)+"))"}if(this.op=="IN"){if(this.right instanceof yy.Select){var s="(";s+="alasql.utils.flatArray(this.queriesfn["+this.queriesidx+"](params,null,context))";s+=".indexOf(";s+=this.left.toJavaScript(context,tableid,defcols)+")>-1)";return s}else if(this.right instanceof Array){var s="(["+this.right.map(function(a){return a.toJavaScript(context,tableid,defcols)}).join(",")+"].indexOf(";s+=this.left.toJavaScript(context,tableid,defcols)+")>-1)";return s}else{var s="("+this.right.toJavaScript(context,tableid,defcols)+".indexOf(";s+=this.left.toJavaScript(context,tableid,defcols)+")>-1)";return s}}if(this.op=="NOT IN"){if(this.right instanceof yy.Select){var s="(";s+="alasql.utils.flatArray(this.queriesfn["+this.queriesidx+"](params,null,p))";s+=".indexOf(";s+=this.left.toJavaScript(context,tableid,defcols)+")<0)";return s}else if(this.right instanceof Array){var s="(["+this.right.map(function(a){return a.toJavaScript(context,tableid,defcols)}).join(",")+"].indexOf(";s+=this.left.toJavaScript(context,tableid,defcols)+")<0)";return s}else{var s="("+this.right.toJavaScript(context,tableid,defcols)+".indexOf(";s+=this.left.toJavaScript(context,tableid,defcols)+")==-1)";return s}}if(this.allsome=="ALL"){if(this.right instanceof yy.Select){var s="alasql.utils.flatArray(this.query.queriesfn["+this.queriesidx+"](params,null,p))";s+=".every(function(b){return (";s+=this.left.toJavaScript(context,tableid,defcols)+")"+op+"b})";return s}else if(this.right instanceof Array){var s="["+this.right.map(function(a){return a.toJavaScript(context,tableid,defcols)}).join(",")+"].every(function(b){return (";s+=this.left.toJavaScript(context,tableid,defcols)+")"+op+"b})";return s}else{throw new Error("Wrong NOT IN operator without SELECT part")}}if(this.allsome=="SOME"||this.allsome=="ANY"){if(this.right instanceof yy.Select){var s="alasql.utils.flatArray(this.query.queriesfn["+this.queriesidx+"](params,null,p))";s+=".some(function(b){return (";s+=this.left.toJavaScript(context,tableid,defcols)+")"+op+"b})";return s}else if(this.right instanceof Array){var s="["+this.right.map(function(a){return a.toJavaScript(context,tableid,defcols)}).join(",")+"].some(function(b){return (";s+=this.left.toJavaScript(context,tableid,defcols)+")"+op+"b})";return s}else{throw new Error("Wrong NOT IN operator without SELECT part")}}if(this.op=="AND"){if(this.left.reduced){if(this.right.reduced){return"true"}else{return this.right.toJavaScript(context,tableid,defcols)}}else if(this.right.reduced){return this.left.toJavaScript(context,tableid,defcols)}op="&&"}if(this.op=="^"){return"Math.pow("+this.left.toJavaScript(context,tableid,defcols)+","+this.right.toJavaScript(context,tableid,defcols)+")"}return"("+this.left.toJavaScript(context,tableid,defcols)+op+this.right.toJavaScript(context,tableid,defcols)+")"};yy.VarValue=function(params){return yy.extend(this,params)};yy.VarValue.prototype.toString=function(){return"@"+L(this.variable)};yy.VarValue.prototype.toType=function(){return"unknown"};yy.VarValue.prototype.toJavaScript=function(){return"alasql.vars['"+this.variable+"']"};yy.NumValue=function(params){return yy.extend(this,params)};yy.NumValue.prototype.toString=function(){return N(this.value.toString())};yy.NumValue.prototype.toType=function(){return"number"};yy.NumValue.prototype.toJavaScript=function(){return""+this.value};yy.StringValue=function(params){return yy.extend(this,params)};yy.StringValue.prototype.toString=function(){return"'"+S(this.value.toString())+"'"};yy.StringValue.prototype.toType=function(){return"string"};yy.StringValue.prototype.toJavaScript=function(){return"'"+escapeq(this.value)+"'"};yy.LogicValue=function(params){return yy.extend(this,params)};yy.LogicValue.prototype.toString=function(){return this.value?"TRUE":"FALSE"};yy.LogicValue.prototype.toType=function(){return"boolean"};yy.LogicValue.prototype.toJavaScript=function(){return this.value?"true":"false"};yy.NullValue=function(params){return yy.extend(this,params)};yy.NullValue.prototype.toString=function(){return"NULL"};yy.NullValue.prototype.toJavaScript=function(){return"undefined"};yy.ParamValue=function(params){return yy.extend(this,params)};yy.ParamValue.prototype.toString=function(){return"$"+this.param};yy.ParamValue.prototype.toJavaScript=function(){if(typeof this.param=="string")return"params['"+this.param+"']";else return"params["+this.param+"]"};yy.UniOp=function(params){return yy.extend(this,params)};yy.UniOp.prototype.toString=function(){if(this.op=="-")return this.op+this.right.toString();if(this.op=="+")return this.op+this.right.toString();if(this.op=="#")return this.op+this.right.toString();if(this.op=="NOT")return this.op+"("+this.right.toString()+")";else if(this.op==null)return"("+this.right.toString()+")"};yy.UniOp.prototype.findAggregator=function(query){if(this.right.findAggregator)this.right.findAggregator(query)};yy.UniOp.prototype.toType=function(tableid){if(this.op=="-")return"number";if(this.op=="+")return"number";if(this.op=="NOT")return"boolean"};yy.UniOp.prototype.toJavaScript=function(context,tableid,defcols){if(this.op=="-")return"(-("+this.right.toJavaScript(context,tableid,defcols)+"))";if(this.op=="+")return"("+this.right.toJavaScript(context,tableid,defcols)+")";if(this.op=="NOT")return"!("+this.right.toJavaScript(context,tableid,defcols)+")";if(this.op=="#"){if(this.right instanceof yy.Column){return"(alasql.databases[alasql.useid].objects['"+this.right.columnid+"'])"}else{return"(alasql.databases[alasql.useid].objects["+this.right.toJavaScript(context,tableid,defcols)+"])"}}else if(this.op==null)return"("+this.right.toJavaScript(context,tableid,defcols)+")"};yy.Column=function(params){return yy.extend(this,params)};yy.Column.prototype.toString=function(){var s;if(this.columnid==+this.columnid){s="["+this.columnid+"]"}else{s=this.columnid}if(this.tableid){if(+this.columnid==this.columnid){s=this.tableid+s}else{s=this.tableid+"."+s}if(this.databaseid){s=this.databaseid+"."+s}}return s};yy.Column.prototype.toJavaScript=function(context,tableid,defcols){var s="";if(!this.tableid&&tableid==""&&!defcols){if(this.columnid!="_"){s=context+"['"+this.columnid+"']"}else{if(context=="g"){s="g['_']"}else{s=context}}}else{if(context=="g"){s="g['"+this.nick+"']"}else if(this.tableid){if(this.columnid!="_"){s=context+"['"+this.tableid+"']['"+this.columnid+"']"}else{if(context=="g"){s="g['_']"}else{s=context+"['"+this.tableid+"']"}}}else if(defcols){var tbid=defcols[this.columnid];if(tbid=="-"){throw new Error('Cannot resolve column "'+this.columnid+'" because it exists in two source tables')}else if(tbid){if(this.columnid!="_"){s=context+"['"+tbid+"']['"+this.columnid+"']"}else{s=context+"['"+tbid+"']"}}else{if(this.columnid!="_"){s=context+"['"+(this.tableid||tableid)+"']['"+this.columnid+"']"}else{s=context+"['"+(this.tableid||tableid)+"']"}}}else if(tableid==-1){s=context+"['"+this.columnid+"']"}else{if(this.columnid!="_"){s=context+"['"+(this.tableid||tableid)+"']['"+this.columnid+"']"}else{s=context+"['"+(this.tableid||tableid)+"']"}}}return s};yy.AggrValue=function(params){return yy.extend(this,params)};yy.AggrValue.prototype.toString=function(){var s="";if(this.aggregatorid=="REDUCE")s+=L(this.funcid)+"(";else s+=this.aggregatorid+"(";if(this.distinct)s+=K("DISTINCT")+" ";if(this.expression)s+=this.expression.toString();s+=")";if(this.over)s+=" "+this.over.toString();return s};yy.AggrValue.prototype.findAggregator=function(query){var colas=escapeq(this.toString())+":"+query.selectGroup.length;var found=false;if(!found){if(!this.nick){this.nick=colas;var found=false;for(var i=0;i-1)return"number";if(["ARRAY"].indexOf(this.aggregatorid)>-1)return"array";if(["FIRST","LAST"].indexOf(this.aggregatorid)>-1)return this.expression.toType()};yy.AggrValue.prototype.toJavaScript=function(context,tableid,defcols){var colas=this.nick;if(typeof colas=="undefined")colas=this.toString();return"g['"+colas+"']"};yy.OrderExpression=function(params){return yy.extend(this,params)};yy.OrderExpression.prototype.toString=function(){var s=this.expression.toString();if(this.order)s+=" "+this.order.toString();if(this.nocase)s+=" "+K("COLLATE")+" "+K("NOCASE");return s};yy.GroupExpression=function(params){return yy.extend(this,params)};yy.GroupExpression.prototype.toString=function(){return this.type+"("+this.group.toString()+")"};yy.ColumnDef=function(params){return yy.extend(this,params)};yy.ColumnDef.prototype.toString=function(){var s=this.columnid;if(this.dbtypeid)s+=" "+this.dbtypeid;if(this.dbsize){s+="("+this.dbsize;if(this.dbprecision)s+=","+this.dbprecision;s+=")"}if(this.primarykey)s+=" PRIMARY KEY";if(this.notnull)s+=" NOT NULL";return s};yy.FromData=function(params){return yy.extend(this,params)};yy.FromData.prototype.toString=function(){if(this.data)return K("DATA")+"("+(Math.random()*1e16|0)+")";else return"?"};yy.FromData.prototype.toJavaScript=function(){};yy.Select.prototype.exec=function(params,cb){if(this.preparams)params=this.preparams.concat(params);var databaseid=alasql.useid;db=alasql.databases[databaseid];var sql=this.toString();var hh=hash(sql);var statement=this.compile(databaseid);if(!statement)return;statement.sql=sql;statement.dbversion=db.dbversion;if(db.sqlCacheSize>alasql.MAXSQLCACHESIZE){db.resetSqlCache()}db.sqlCacheSize++;db.sqlCache[hh]=statement;var res=alasql.res=statement(params,cb);return res};yy.Select.prototype.Select=function(){var self=this;var agrs=[];if(arguments.length>1){args=Array.prototype.slice.call(arguments)}else if(arguments.length==1){if(arguments[0]instanceof Array){args=arguments[0]}else{args=[arguments[0]]}}else{throw new Error("Wrong number of arguments of Select() function")}self.columns=[];args.forEach(function(arg){if(typeof arg=="string"){self.columns.push(new yy.Column({columnid:arg}))}else if(typeof arg=="function"){var pari=0;if(self.preparams){pari=self.preparams.length}else{self.preparams=[]}self.preparams.push(arg);self.columns.push(new yy.Column({columnid:"*",func:arg,param:pari}))}else{}});return self};yy.Select.prototype.From=function(tableid){var self=this;if(!self.from)self.from=[];if(tableid instanceof Array){var pari=0;if(self.preparams){pari=self.preparams.length}else{self.preparams=[]}self.preparams.push(tableid);self.from.push(new yy.ParamValue({param:pari}))}else if(typeof tableid=="string"){self.from.push(new yy.Table({tableid:tableid}))}else{throw new Error("Unknown arguments in From() function")}return self};yy.Select.prototype.OrderBy=function(){var self=this;var agrs=[];self.order=[];if(arguments.length==0){args=["_"]}else if(arguments.length>1){args=Array.prototype.slice.call(arguments)}else if(arguments.length==1){if(arguments[0]instanceof Array){args=arguments[0]}else{args=[arguments[0]]}}else{throw new Error("Wrong number of arguments of Select() function")}if(args.length>0){args.forEach(function(arg){var expr=new yy.Column({columnid:arg});if(typeof arg=="function"){expr=arg}self.order.push(new yy.OrderExpression({expression:expr,direction:"ASC"}))})}return self};yy.Select.prototype.Top=function(topnum){var self=this;self.top=new yy.NumValue({value:topnum});return self};yy.Select.prototype.GroupBy=function(){var self=this;var agrs=[];if(arguments.length>1){args=Array.prototype.slice.call(arguments)}else if(arguments.length==1){if(arguments[0]instanceof Array){args=arguments[0]}else{args=[arguments[0]]}}else{throw new Error("Wrong number of arguments of Select() function")}self.group=[];args.forEach(function(arg){var expr=new yy.Column({columnid:arg});self.group.push(expr)});return self};yy.Select.prototype.Where=function(expr){var self=this;if(typeof expr=="function"){self.where=expr}return self};yy.FuncValue=function(params){return yy.extend(this,params)};yy.FuncValue.prototype.toString=function(){var s="";if(alasql.fn[this.funcid])s+=this.funcid;else if(alasql.aggr[this.funcid])s+=this.funcid;else if(alasql.stdlib[this.funcid.toUpperCase()]||alasql.stdfn[this.funcid.toUpperCase()])s+=this.funcid.toUpperCase();s+="(";if(this.args&&this.args.length>0){s+=this.args.map(function(arg){return arg.toString()}).join(",")}s+=")";if(this.as)s+=" AS "+this.as.toString();return s};yy.FuncValue.prototype.findAggregator=function(query){if(this.args&&this.args.length>0){this.args.forEach(function(arg){if(arg.findAggregator)arg.findAggregator(query)})}};yy.FuncValue.prototype.toJavaScript=function(context,tableid,defcols){var s="";var funcid=this.funcid;if(alasql.fn[funcid]){if(this.newid)s+="new ";s+="alasql.fn."+this.funcid+"(";if(this.args&&this.args.length>0){s+=this.args.map(function(arg){return arg.toJavaScript(context,tableid,defcols)}).join(",")}s+=")"}else if(alasql.stdlib[funcid.toUpperCase()]){if(this.args&&this.args.length>0){s+=alasql.stdlib[funcid.toUpperCase()].apply(this,this.args.map(function(arg){return arg.toJavaScript(context,tableid)}))}else{s+=alasql.stdlib[funcid.toUpperCase()]()}}else if(alasql.stdfn[funcid.toUpperCase()]){if(this.newid)s+="new ";s+="alasql.stdfn."+this.funcid.toUpperCase()+"(";if(this.args&&this.args.length>0){s+=this.args.map(function(arg){return arg.toJavaScript(context,tableid,defcols)}).join(",")}s+=")"}else{}return s};var stdlib=alasql.stdlib={};var stdfn=alasql.stdfn={};stdlib.ABS=function(a){return"Math.abs("+a+")"};stdlib.CLONEDEEP=function(a){return"alasql.utils.cloneDeep("+a+")"};stdlib.IIF=function(a,b,c){if(arguments.length==3){return"(("+a+")?("+b+"):("+c+"))"}else{throw new Error("Number of arguments of IFF is not equals to 3")}};stdlib.IFNULL=function(a,b){return"("+a+"||"+b+")"};stdlib.INSTR=function(s,p){return"(("+s+").indexOf("+p+")+1)"};stdlib.LEN=stdlib.LENGTH=function(s){return und(s,"y.length")};stdlib.LOWER=stdlib.LCASE=function(s){return und(s,"y.toLowerCase()")};stdlib.MAX=stdlib.GREATEST=function(){return"Math.max("+Array.prototype.join.call(arguments,",")+")"};stdlib.MIN=stdlib.LEAST=function(){return"Math.min("+Array.prototype.join.call(arguments,",")+")"};stdlib.SUBSTRING=stdlib.MID=function(a,b,c){if(arguments.length==2)return und(a,"y.substr("+b+"-1)");else if(arguments.length==3)return und(a,"y.substr("+b+"-1,"+c+")")};stdlib.ISNULL=stdlib.NULLIF=function(a,b){return"("+a+"=="+b+"?undefined:"+a+")"};stdlib.POWER=function(a,b){return"Math.pow("+a+","+b+")"};stdlib.RANDOM=function(r){if(arguments.length==0){return"Math.random()"}else{return"(Math.random()*("+r+")|0)"}};stdlib.ROUND=function(s,d){if(arguments.length==2){return"Math.round("+s+"*Math.pow(10,"+d+"))/Math.pow(10,"+d+")"}else{return"Math.round("+s+")"}};stdlib.ROWNUM=function(){return"1"};stdlib.ROW_NUMBER=function(){return"1"};stdlib.SQRT=function(s){return"Math.sqrt("+s+")"};stdlib.TRIM=function(s){return und(s,"y.trim()")};stdlib.UPPER=stdlib.UCASE=function(s){return und(s,"y.toUpperCase()")};alasql.aggr.GROUP_CONCAT=function(v,s){if(typeof s=="undefined")return v;else return s+","+v};alasql.aggr.MEDIAN=function(v,s,acc){if(typeof acc.arr=="undefined"){acc.arr=[v];
-return v}else{acc.arr.push(v);var p=acc.arr.sort();return p[p.length/2|0]}};alasql.aggr.VAR=function(v,s,acc){if(typeof acc.arr=="undefined"){acc.arr=[v];acc.sum=v}else{acc.arr.push(v);acc.sum+=v}var N=acc.arr.length;var avg=acc.sum/N;var std=0;for(var i=0;i0){this.whens.forEach(function(w){if(w.when.findAggregator)w.when.findAggregator(query);if(w.then.findAggregator)w.then.findAggregator(query)})}if(this.elses&&this.elses.findAggregator)this.elses.findAggregator(query)};yy.CaseValue.prototype.toJavaScript=function(context,tableid,defcols){var s="((function("+context+",params,alasql){var r;";if(this.expression){s+="v="+this.expression.toJavaScript(context,tableid,defcols)+";";s+=(this.whens||[]).map(function(w){return" if(v=="+w.when.toJavaScript(context,tableid,defcols)+") {r="+w.then.toJavaScript(context,tableid,defcols)+"}"}).join(" else ");if(this.elses)s+=" else {r="+this.elses.toJavaScript(context,tableid,defcols)+"}"}else{s+=(this.whens||[]).map(function(w){return" if("+w.when.toJavaScript(context,tableid,defcols)+") {r="+w.then.toJavaScript(context,tableid,defcols)+"}"}).join(" else ");if(this.elses)s+=" else {r="+this.elses.toJavaScript(context,tableid,defcols)+"}"}s+=";return r;}).bind(this))("+context+",params,alasql)";return s};yy.Json=function(params){return yy.extend(this,params)};yy.Json.prototype.toString=function(){var s="";s+=JSONtoString(this.value);s+="";return s};var JSONtoString=alasql.utils.JSONtoString=function(obj){var s="";if(typeof obj=="string")s='"'+obj+'"';else if(typeof obj=="number")s=obj;else if(typeof obj=="boolean")s=obj;else if(typeof obj=="object"){if(obj instanceof Array){s+="["+obj.map(function(b){return JSONtoString(b)}).join(",")+"]"}else if(!obj.toJavaScript||obj instanceof yy.Json){s="{";var ss=[];for(var k in obj){var s1="";if(typeof k=="string")s1+='"'+k+'"';else if(typeof k=="number")s1+=k;else if(typeof k=="boolean")s1+=k;else{throw new Error("THis is not ES6... no expressions on left side yet")}s1+=":"+JSONtoString(obj[k]);ss.push(s1)}s+=ss.join(",")+"}"}else if(obj.toString){s=obj.toString()}else{throw new Error("1Can not show JSON object "+JSON.stringify(obj))}}else{throw new Error("2Can not show JSON object "+JSON.stringify(obj))}return s};function JSONtoJavaScript(obj,context,tableid,defcols){var s="";if(typeof obj=="string")s='"'+obj+'"';else if(typeof obj=="number")s="("+obj+")";else if(typeof obj=="boolean")s=obj;else if(typeof obj=="object"){if(obj instanceof Array){s+="["+obj.map(function(b){return JSONtoJavaScript(b,context,tableid,defcols)}).join(",")+"]"}else if(!obj.toJavaScript||obj instanceof yy.Json){s="{";var ss=[];for(var k in obj){var s1="";if(typeof k=="string")s1+='"'+k+'"';else if(typeof k=="number")s1+=k;else if(typeof k=="boolean")s1+=k;else{throw new Error("THis is not ES6... no expressions on left side yet")}s1+=":"+JSONtoJavaScript(obj[k],context,tableid,defcols);ss.push(s1)}s+=ss.join(",")+"}"}else if(obj.toJavaScript){s=obj.toJavaScript(context,tableid,defcols)}else{throw new Error("1Can not parse JSON object "+JSON.stringify(obj))}}else{throw new Error("2Can not parse JSON object "+JSON.stringify(obj))}return s}yy.Json.prototype.toJavaScript=function(context,tableid,defcols){return JSONtoJavaScript(this.value,context,tableid,defcols)};yy.Convert=function(params){return yy.extend(this,params)};yy.Convert.prototype.toString=function(){var s="CONVERT(";s+=this.dbtypeid;if(typeof this.dbsize!="undefined"){s+="("+this.dbsize;if(this.dbprecision)s+=","+dbprecision;s+=")"}s+=","+this.expression.toString();if(this.style)s+=","+this.style;s+=")";return s};yy.Convert.prototype.toJavaScript=function(context,tableid,defcols){return"alasql.stdfn.CONVERT("+this.expression.toJavaScript(context,tableid,defcols)+',{dbtypeid:"'+this.dbtypeid+'",dbsize:'+this.dbsize+",style:"+this.style+"})";throw new Error("There is not such type conversion for "+this.toString())};alasql.stdfn.CONVERT=function(value,args){var val=value;if(args.style){var t;if(/\d{8}/.test(val))t=new Date(+val.substr(0,4),+val.substr(4,2)-1,+val.substr(6,2));else t=new Date(val);if(args.style==1){val=("0"+(t.getMonth()+1)).substr(-2)+"/"+("0"+t.getDate()).substr(-2)+"/"+("0"+t.getYear()).substr(-2)}else if(args.style==2){val=("0"+t.getYear()).substr(-2)+"."+("0"+(t.getMonth()+1)).substr(-2)+"."+("0"+t.getDate()).substr(-2)}else if(args.style==3){val=("0"+t.getDate()).substr(-2)+"/"+("0"+(t.getMonth()+1)).substr(-2)+"/"+("0"+t.getYear()).substr(-2)}else if(args.style==4){val=("0"+t.getDate()).substr(-2)+"."+("0"+(t.getMonth()+1)).substr(-2)+"."+("0"+t.getYear()).substr(-2)}else if(args.style==5){val=("0"+t.getDate()).substr(-2)+"-"+("0"+(t.getMonth()+1)).substr(-2)+"-"+("0"+t.getYear()).substr(-2)}else if(args.style==6){val=("0"+t.getDate()).substr(-2)+" "+t.toString().substr(4,3).toLowerCase()+" "+("0"+t.getYear()).substr(-2)}else if(args.style==7){val=t.toString().substr(4,3)+" "+("0"+t.getDate()).substr(-2)+","+("0"+t.getYear()).substr(-2)}else if(args.style==8){val=("0"+t.getHours()).substr(-2)+":"+("0"+(t.getMinutes()+1)).substr(-2)+":"+("0"+t.getSeconds()).substr(-2)}else if(args.style==10){val=("0"+(t.getMonth()+1)).substr(-2)+"-"+("0"+t.getDate()).substr(-2)+"-"+("0"+t.getYear()).substr(-2)}else if(args.style==11){val=("0"+t.getYear()).substr(-2)+"/"+("0"+(t.getMonth()+1)).substr(-2)+"/"+("0"+t.getDate()).substr(-2)}else if(args.style==12){val=("0"+t.getYear()).substr(-2)+("0"+(t.getMonth()+1)).substr(-2)+("0"+t.getDate()).substr(-2)}else if(args.style==101){val=("0"+(t.getMonth()+1)).substr(-2)+"/"+("0"+t.getDate()).substr(-2)+"/"+t.getFullYear()}else if(args.style==102){val=t.getFullYear()+"."+("0"+(t.getMonth()+1)).substr(-2)+"."+("0"+t.getDate()).substr(-2)}else if(args.style==103){val=("0"+t.getDate()).substr(-2)+"/"+("0"+(t.getMonth()+1)).substr(-2)+"/"+t.getFullYear()}else if(args.style==104){val=("0"+t.getDate()).substr(-2)+"."+("0"+(t.getMonth()+1)).substr(-2)+"."+t.getFullYear()}else if(args.style==105){val=("0"+t.getDate()).substr(-2)+"-"+("0"+(t.getMonth()+1)).substr(-2)+"-"+t.getFullYear()}else if(args.style==106){val=("0"+t.getDate()).substr(-2)+" "+t.toString().substr(4,3).toLowerCase()+" "+t.getFullYear()}else if(args.style==107){val=t.toString().substr(4,3)+" "+("0"+t.getDate()).substr(-2)+","+t.getFullYear()}else if(args.style==108){val=("0"+t.getHours()).substr(-2)+":"+("0"+(t.getMinutes()+1)).substr(-2)+":"+("0"+t.getSeconds()).substr(-2)}else if(args.style==110){val=("0"+(t.getMonth()+1)).substr(-2)+"-"+("0"+t.getDate()).substr(-2)+"-"+t.getFullYear()}else if(args.style==111){val=t.getFullYear()+"/"+("0"+(t.getMonth()+1)).substr(-2)+"/"+("0"+t.getDate()).substr(-2)}else if(args.style==112){val=t.getFullYear()+("0"+(t.getMonth()+1)).substr(-2)+("0"+t.getDate()).substr(-2)}else{throw new Error("The CONVERT style "+args.style+" is not realized yet.")}}if(args.dbtypeid=="Date"){return new Date(val)}else if(args.dbtypeid.toUpperCase()=="DATE"){var d=new Date(val);var s=d.getFullYear()+"."+("0"+(d.getMonth()+1)).substr(-2)+"."+("0"+d.getDate()).substr(-2);return s}else if(args.dbtypeid=="DATETIME"){var d=new Date(val);var s=d.getFullYear()+"."+("0"+(d.getMonth()+1)).substr(-2)+"."+("0"+d.getDate()).substr(-2);s+=" "+("0"+d.getHours()).substr(-2)+":"+("0"+d.getMinutes()).substr(-2)+":"+("0"+d.getSeconds()).substr(-2);s+="."+("00"+d.getMilliseconds()).substr(-3);return s}else if(args.dbtypeid.toUpperCase()=="STRING"){return""+val}else if(args.dbtypeid.toUpperCase()=="NUMBER"||args.dbtypeid=="FLOAT"){return+val}else if(args.dbtypeid.toUpperCase()=="MONEY"){var m=+val;return(m|0)+m*100%100/100}else if(args.dbtypeid.toUpperCase()=="BOOLEAN"){return!!val}else if(args.dbtypeid.toUpperCase()=="INT"){return val|0}else if(args.dbtypeid.toUpperCase()=="VARCHAR"||args.dbtypeid=="NVARCHAR"){if(args.dbsize)return(""+val).substr(0,args.dbsize);else return""+val}else if(args.dbtypeid.toUpperCase()=="CHAR"||args.dbtypeid=="NCHAR"){return(val+new Array(args.dbsize+1).join(" ")).substr(0,args.dbsize)}};yy.ColumnDef=function(params){return yy.extend(this,params)};yy.ColumnDef.prototype.toString=function(){var s=this.columnid;if(this.dbtypeid)s+=" "+this.dbtypeid;if(this.dbsize){s+="("+this.dbsize;if(this.dbprecision)s+=","+this.dbprecision;s+=")"}if(this.primarykey)s+=" PRIMARY KEY";if(this.notnull)s+=" NOT NULL";return s};yy.CreateTable=function(params){return yy.extend(this,params)};yy.CreateTable.prototype.toString=function(){var s=K("CREATE");if(this.temporary)s+=" "+K("TEMPORARY");if(this.view)s+=" "+K("VIEW");else s+=" "+(this.class?K("CLASS"):K("TABLE"));if(this.ifnotexists)s+=" "+K("IF")+" "+K("NOT")+" "+K("EXISTS");s+=" "+this.table.toString();if(this.viewcolumns){s+="("+this.viewcolumns.map(function(vcol){return vcol.toString()}).join(",")+")"}if(this.as)s+=" "+K("AS")+" "+L(this.as);else{var ss=this.columns.map(function(col){return col.toString()});s+=" ("+NL()+ID()+ss.join(","+NL()+ID())+")"}if(this.view&&this.select){s+=" AS "+this.select.toString()}return s};yy.CreateTable.prototype.execute=function(databaseid,params,cb){var db=alasql.databases[this.table.databaseid||databaseid];var tableid=this.table.tableid;if(!tableid){throw new Error("Table name is not defined")}var columns=this.columns;var constraints=this.constraints||[];if(this.ifnotexists&&db.tables[tableid])return 0;if(db.tables[tableid]){throw new Error("Can not create table '"+tableid+"', because it already exists in the database '"+db.databaseid+"'")}var table=db.tables[tableid]=new alasql.Table;if(this.class){table.isclass=true}table.identities={};table.checkfn=[];var ss=[];if(this.columns){this.columns.forEach(function(col){var dbtypeid=col.dbtypeid;if(!alasql.fn[dbtypeid])dbtypeid=dbtypeid.toUpperCase();var newcol={columnid:col.columnid,dbtypeid:dbtypeid,dbsize:col.dbsize,dbprecision:col.dbprecision,notnull:col.notnull,identity:col.identity};if(col.identity){table.identities[col.columnid]={value:+col.identity.value,step:+col.identity.step}}if(col.check){table.checkfn.push(new Function("r","var y;return "+col.check.expression.toJavaScript("r","")))}if(col.default){ss.push("'"+col.columnid+"':"+col.default.toJavaScript("r",""))}if(col.primarykey){var pk=table.pk={};pk.columns=[col.columnid];pk.onrightfns="r['"+col.columnid+"']";pk.onrightfn=new Function("r","var y;return "+pk.onrightfns);pk.hh=hash(pk.onrightfns);table.uniqs[pk.hh]={}}if(col.unique){var uk={};if(typeof table.uk=="undefined")table.uk=[];table.uk.push(uk);uk.columns=[col.columnid];uk.onrightfns="r['"+col.columnid+"']";uk.onrightfn=new Function("r","var y;return "+uk.onrightfns);uk.hh=hash(uk.onrightfns);table.uniqs[uk.hh]={}}if(col.foreignkey){var fk=col.foreignkey.table;var fktable=alasql.databases[fk.databaseid||alasql.useid].tables[fk.tableid];if(typeof fk.columnid=="undefined"){if(fktable.pk.columns&&fktable.pk.columns.length>0){fk.columnid=fktable.pk.columns[0]}else{throw new Error("FOREIGN KEY allowed only to tables with PRIMARY KEYs")}}var fkfn=function(r){var rr={};if(typeof r[col.columnid]=="undefined")return true;rr[fk.columnid]=r[col.columnid];var addr=fktable.pk.onrightfn(rr);if(!fktable.uniqs[fktable.pk.hh][addr]){throw new Error('Foreign key "'+r[col.columnid]+'" is not found in table '+fktable.tableid)}return true};table.checkfn.push(fkfn)}table.columns.push(newcol);table.xcolumns[newcol.columnid]=newcol})}table.defaultfns=ss.join(",");constraints.forEach(function(con){if(con.type=="PRIMARY KEY"){if(table.pk){throw new Error("Primary key already exists")}var pk=table.pk={};pk.columns=con.columns;pk.onrightfns=pk.columns.map(function(columnid){return"r['"+columnid+"']"}).join("+'`'+");pk.onrightfn=new Function("r","var y;return "+pk.onrightfns);pk.hh=hash(pk.onrightfns);table.uniqs[pk.hh]={}}else if(con.type=="CHECK"){table.checkfn.push(new Function("r","var y;return "+con.expression.toJavaScript("r","")))}else if(con.type=="UNIQUE"){var uk={};if(!table.uk)table.uk=[];table.uk.push(uk);uk.columns=con.columns;uk.onrightfns=uk.columns.map(function(columnid){return"r['"+columnid+"']"}).join("+'`'+");uk.onrightfn=new Function("r","var y;return "+uk.onrightfns);uk.hh=hash(uk.onrightfns);table.uniqs[uk.hh]={}}else if(con.type=="FOREIGN KEY"){var col=table.xcolumns[con.columns[0]];var fk=con.fktable;if(con.fkcolumns&&con.fkcolumns.length>0)fk.columnid=con.fkcolumns[0];var fktable=alasql.databases[fk.databaseid||alasql.useid].tables[fk.tableid];if(typeof fk.columnid=="undefined"){fk.columnid=fktable.pk.columns[0]}var fkfn=function(r){var rr={};if(typeof r[col.columnid]=="undefined")return true;rr[fk.columnid]=r[col.columnid];var addr=fktable.pk.onrightfn(rr);if(!fktable.uniqs[fktable.pk.hh][addr]){throw new Error('Foreign key "'+r[col.columnid]+'" is not found in table '+fktable.tableid)}return true};table.checkfn.push(fkfn)}});if(this.view&&this.viewcolumns){var self=this;this.viewcolumns.forEach(function(vcol,idx){self.select.columns[idx].as=vcol.columnid})}if(db.engineid){return alasql.engines[db.engineid].createTable(this.table.databaseid||databaseid,tableid,this.ifnotexists,cb)}table.insert=function(r){var table=this;for(var columnid in table.identities){var ident=table.identities[columnid];r[columnid]=ident.value}if(table.checkfn&&table.checkfn.length>0){table.checkfn.forEach(function(checkfn){if(!checkfn(r)){throw new Error("Violation of CHECK constraint")}})}table.columns.forEach(function(column){if(column.notnull&&typeof r[column.columnid]=="undefined"){throw new Error("Wrong NULL value in NOT NULL column "+column.columnid)}});if(table.pk){var pk=table.pk;var addr=pk.onrightfn(r);if(typeof table.uniqs[pk.hh][addr]!="undefined"){throw new Error("Cannot insert record, because it already exists in primary key index")}}if(table.uk&&table.uk.length){table.uk.forEach(function(uk){var ukaddr=uk.onrightfn(r);if(typeof table.uniqs[uk.hh][ukaddr]!="undefined"){throw new Error("Cannot insert record, because it already exists in unique index")}})}table.data.push(r);for(var columnid in table.identities){var ident=table.identities[columnid];ident.value+=ident.step}if(table.pk){var pk=table.pk;var addr=pk.onrightfn(r);table.uniqs[pk.hh][addr]=r}if(table.uk&&table.uk.length){table.uk.forEach(function(uk){var ukaddr=uk.onrightfn(r);table.uniqs[uk.hh][ukaddr]=r})}};table.delete=function(i,params,alasql){var table=this;var r=this.data[i];if(this.pk){var pk=this.pk;var addr=pk.onrightfn(r);if(typeof this.uniqs[pk.hh][addr]=="undefined"){throw new Error("Something wrong with primary key index on table")}else{this.uniqs[pk.hh][addr]=undefined}}if(table.uk&&table.uk.length){table.uk.forEach(function(uk){var ukaddr=uk.onrightfn(r);if(typeof table.uniqs[uk.hh][ukaddr]=="undefined"){throw new Error("Something wrong with unique index on table")}table.uniqs[uk.hh][ukaddr]=undefined})}};table.deleteall=function(){this.data.length=0;if(this.pk){this.uniqs[this.pk.hh]={}}if(table.uk&&table.uk.length){table.uk.forEach(function(uk){table.uniqs[uk.hh]={}})}};table.update=function(assignfn,i,params){var r=cloneDeep(this.data[i]);if(this.pk){var pk=this.pk;pk.pkaddr=pk.onrightfn(r,params);if(typeof this.uniqs[pk.hh][pk.pkaddr]=="undefined"){throw new Error("Something wrong with index on table")}else{}}if(table.uk&&table.uk.length){table.uk.forEach(function(uk){uk.ukaddr=uk.onrightfn(r);if(typeof table.uniqs[uk.hh][uk.ukaddr]=="undefined"){throw new Error("Something wrong with unique index on table")}})}assignfn(r,params,alasql);if(table.checkfn&&table.checkfn.length>0){table.checkfn.forEach(function(checkfn){if(!checkfn(r)){throw new Error("Violation of CHECK constraint")}})}table.columns.forEach(function(column){if(column.notnull&&typeof r[column.columnid]=="undefined"){throw new Error("Wrong NULL value in NOT NULL column "+column.columnid)}});if(this.pk){pk.newpkaddr=pk.onrightfn(r);if(typeof this.uniqs[pk.hh][pk.newpkaddr]!="undefined"&&pk.newpkaddr!=pk.pkaddr){throw new Error("Record already exists")}else{}}if(table.uk&&table.uk.length){table.uk.forEach(function(uk){uk.newukaddr=uk.onrightfn(r);if(typeof table.uniqs[uk.hh][uk.newukaddr]!="undefined"&&uk.newukaddr!=uk.ukaddr){throw new Error("Record already exists")}})}if(this.pk){this.uniqs[pk.hh][pk.pkaddr]=undefined;this.uniqs[pk.hh][pk.newpkaddr]=r}if(table.uk&&table.uk.length){table.uk.forEach(function(uk){table.uniqs[uk.hh][uk.ukaddr]=undefined;table.uniqs[uk.hh][uk.newukaddr]=r})}this.data[i]=r};if(this.view&&this.select){table.view=true;table.select=this.select.compile(this.table.databaseid||databaseid)}var res;if(!alasql.options.nocount)res=1;if(cb)res=cb(res);return res};alasql.fn.Date=Object;alasql.fn.Date=Date;alasql.fn.Number=Number;alasql.fn.String=String;alasql.fn.Boolean=Boolean;stdfn.EXTEND=alasql.utils.extend;stdfn.CHAR=String.fromCharCode.bind(String);stdfn.ASCII=function(a){return a.charCodeAt(0)};stdfn.COALESCE=function(){for(var i=0;i0){var s=this.sets.map(function(st){return"x['"+st.column.columnid+"']="+st.expression.toJavaScript("x","")}).join(";");var setfn=new Function("x,params,alasql",s)}else if(this.content){}else if(this.select){}else{}var statement=function(params,cb){var res;var db=alasql.databases[dbid];if(typeof sharp!="undefined"){var id=sharp}else{var id=db.counter++}var vertex={$id:id,$node:"VERTEX"};db.objects[vertex.$id]=vertex;res=vertex;if(namefn)namefn(vertex);if(setfn)setfn(vertex,params,alasql);if(cb)res=cb(res);return res};return statement};yy.CreateEdge=function(params){return yy.extend(this,params)};yy.CreateEdge.prototype.toString=function(){var s=K("CREATE")+" "+K("EDGE")+" ";if(this.class)s+=L(this.class)+" ";return s};yy.CreateEdge.prototype.toJavaScript=function(context,tableid,defcols){var s="this.queriesfn["+(this.queriesidx-1)+"](this.params,null,"+context+")";return s};yy.CreateEdge.prototype.compile=function(databaseid){var dbid=databaseid;var fromfn=new Function("params,alasql","var y;return "+this.from.toJavaScript());var tofn=new Function("params,alasql","var y;return "+this.to.toJavaScript());if(typeof this.name!="undefined"){var s="x.name="+this.name.toJavaScript();var namefn=new Function("x",s)}if(this.sets&&this.sets.length>0){var s=this.sets.map(function(st){return"x['"+st.column.columnid+"']="+st.expression.toJavaScript("x","")}).join(";");var setfn=new Function("x,params,alasql","var y;"+s)}else if(this.content){}else if(this.select){}else{}var statement=function(params,cb){var res=0;var db=alasql.databases[dbid];var edge={$id:db.counter++,$node:"EDGE"};var v1=fromfn(params,alasql);var v2=tofn(params,alasql);edge.$in=[v1.$id];edge.$out=[v2.$id];if(typeof v1.$out=="undefined")v1.$out=[];v1.$out.push(edge.$id);if(typeof v2.$in=="undefined")v2.$in=[];v2.$in.push(edge.$id);db.objects[edge.$id]=edge;res=edge;if(namefn)namefn(edge);if(setfn)setfn(edge,params,alasql);if(cb)res=cb(res);return res};return statement};yy.CreateGraph=function(params){return yy.extend(this,params)};yy.CreateGraph.prototype.toString=function(){var s=K("CREATE")+" "+K("GRAPH")+" ";if(this.class)s+=L(this.class)+" ";return s};yy.CreateGraph.prototype.execute=function(databaseid,params,cb){var res=[];if(this.from){if(alasql.from[this.from.funcid]){this.graph=alasql.from[this.from.funcid.toUpperCase()](this.from.args[0].value);console.log(this.graph)}}this.graph.forEach(function(g){if(g.source){var e={};if(typeof g.as!="undefined")alasql.vars[g.as]=e;if(typeof g.prop!="undefined"){e.name=g.prop}if(typeof g.sharp!="undefined")e.$id=g.sharp;if(typeof g.name!="undefined")e.name=g.name;if(typeof g.class!="undefined")e.$class=g.class;var db=alasql.databases[databaseid];if(typeof e.$id=="undefined"){e.$id=db.counter++}e.$node="EDGE";if(typeof g.json!="undefined"){extend(e,new Function("params,alasql","var y;return "+g.json.toJavaScript())(params,alasql))}var v1;if(g.source.vars){var vo=alasql.vars[g.source.vars];if(typeof vo=="object")v1=vo;else v1=db.objects[vo]}else{var av1=g.source.sharp;if(typeof av1=="undefined")av1=g.source.prop;v1=alasql.databases[databaseid].objects[av1];if(typeof v1=="undefined"&&alasql.options.autovertex&&(typeof g.source.prop!="undefined"||typeof g.source.name!="undefined")){v1=findVertex(g.source.prop||g.source.name);if(typeof v1=="undefined"){v1=createVertex(g.source)}}}var v2;if(g.source.vars){var vo=alasql.vars[g.target.vars];if(typeof vo=="object")v2=vo;else v2=db.objects[vo]}else{var av2=g.target.sharp;if(typeof av2=="undefined")av2=g.target.prop;v2=alasql.databases[databaseid].objects[av2];if(typeof v2=="undefined"&&alasql.options.autovertex&&(typeof g.target.prop!="undefined"||typeof g.target.name!="undefined")){v2=findVertex(g.target.prop||g.target.name);if(typeof v2=="undefined"){v2=createVertex(g.target)}}}e.$in=[v1.$id];e.$out=[v2.$id];if(typeof v1.$out=="undefined")v1.$out=[];v1.$out.push(e.$id);if(typeof v2.$in=="undefined")v2.$in=[];v2.$in.push(e.$id);db.objects[e.$id]=e;if(typeof e.$class!="undefined"){if(typeof alasql.databases[databaseid].tables[e.$class]=="undefined"){throw new Error("No such class. Pleace use CREATE CLASS")}else{alasql.databases[databaseid].tables[e.$class].data.push(e)}}res.push(e.$id)}else{createVertex(g)}});if(cb)res=cb(res);return res;function findVertex(name){var objects=alasql.databases[alasql.useid].objects;for(var k in objects){if(objects[k].name==name){return objects[k]}}return undefined}function createVertex(g){var v={};if(typeof g.as!="undefined")alasql.vars[g.as]=v;if(typeof g.prop!="undefined"){v.$id=g.prop;v.name=g.prop}if(typeof g.sharp!="undefined")v.$id=g.sharp;if(typeof g.name!="undefined")v.name=g.name;if(typeof g.class!="undefined")v.$class=g.class;var db=alasql.databases[databaseid];if(typeof v.$id=="undefined"){v.$id=db.counter++}v.$node="VERTEX";if(typeof g.json!="undefined"){extend(v,new Function("params,alasql","var y;return "+g.json.toJavaScript())(params,alasql))}db.objects[v.$id]=v;if(typeof v.$class!="undefined"){if(typeof alasql.databases[databaseid].tables[v.$class]=="undefined"){throw new Error("No such class. Pleace use CREATE CLASS")}else{alasql.databases[databaseid].tables[v.$class].data.push(v)}}res.push(v.$id);return v}};yy.CreateGraph.prototype.compile1=function(databaseid){var dbid=databaseid;var fromfn=new Function("params,alasql","var y;return "+this.from.toJavaScript());var tofn=new Function("params,alasql","var y;return "+this.to.toJavaScript());if(typeof this.name!="undefined"){var s="x.name="+this.name.toJavaScript();var namefn=new Function("x",s)}if(this.sets&&this.sets.length>0){var s=this.sets.map(function(st){return"x['"+st.column.columnid+"']="+st.expression.toJavaScript("x","")}).join(";");var setfn=new Function("x,params,alasql","var y;"+s)}else if(this.content){}else if(this.select){}else{}var statement=function(params,cb){var res=0;var db=alasql.databases[dbid];var edge={$id:db.counter++,$node:"EDGE"};var v1=fromfn(params,alasql);var v2=tofn(params,alasql);edge.$in=[v1.$id];edge.$out=[v2.$id];if(typeof v1.$out=="undefined")v1.$out=[];v1.$out.push(edge.$id);if(typeof v2.$in=="undefined")v2.$in=[];v2.$in.push(edge.$id);db.objects[edge.$id]=edge;res=edge;if(namefn)namefn(edge);if(setfn)setfn(edge,params,alasql);if(cb)res=cb(res);return res};return statement};yy.AlterTable=function(params){return yy.extend(this,params)};yy.AlterTable.prototype.toString=function(){var s="ALTER TABLE "+this.table.toString();if(this.renameto)s+=" RENAME TO "+this.renameto;return s};yy.AlterTable.prototype.execute=function(databaseid,params,cb){var db=alasql.databases[databaseid];db.dbversion=Date.now();if(this.renameto){var oldtableid=this.table.tableid;var newtableid=this.renameto;var res=1;if(db.tables[newtableid]){throw new Error("Can not rename a table '"+oldtableid+"' to '"+newtableid+"', because the table with this name already exists")}else if(newtableid==oldtableid){throw new Error("Can not rename a table '"+oldtableid+"' to itself")}else{db.tables[newtableid]=db.tables[oldtableid];delete db.tables[oldtableid];res=1}if(cb)cb(res);return res}else if(this.addcolumn){var db=alasql.databases[this.table.databaseid||databaseid];db.dbversion++;var tableid=this.table.tableid;var table=db.tables[tableid];var columnid=this.addcolumn.columnid;if(table.xcolumns[columnid]){throw new Error('Cannot add column "'+columnid+'", because it already exists in the table "'+tableid+'"')}var col={columnid:columnid,dbtypeid:this.dbtypeid,dbsize:this.dbsize,dbprecision:this.dbprecision,dbenum:this.dbenum,defaultfns:null};var defaultfn=function(){};table.columns.push(col);table.xcolumns[columnid]=col;for(var i=0,ilen=table.data.length;i0){for(var i=0,ilen=table.data.length;i0){for(var i=0,ilen=table.data.length;i=0){q+="(x="+values[idx].toJavaScript()+",x==undefined?undefined:+x)"}else if(alasql.fn[table.xcolumns[col.columnid].dbtypeid]){q+="(new "+table.xcolumns[col.columnid].dbtypeid+"(";q+=values[idx].toJavaScript();q+="))"}else{q+=values[idx].toJavaScript()}}else{q+=values[idx].toJavaScript()}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].toJavaScript()}else if(alasql.fn[col.dbtypeid]){q+="(new "+col.dbtypeid+"(";q+=values[idx].toJavaScript();q+="))"}else{q+=values[idx].toJavaScript()}ss.push(q)})}else{sw=JSONtoJavaScript(values)}}if(db.tables[tableid].defaultfns){ss.unshift(db.tables[tableid].defaultfns)}if(sw){s+="a="+sw+";"}else{s+="a={"+ss.join(",")+"};"}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);"}else{s+="aa.push(a);"}});s33=s3+s;if(db.tables[tableid].insert){}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)}else if(this.select){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,null,cb);return res};return statement}else{var insertfn=function(db,params,alasql){var res=selectfn(params);if(db.tables[tableid].insert){for(var i=0,ilen=res.length;i0){s+="("+this.args.map(function(arg){return arg.toString()}).join(", ")+")"}if(this.as)s+=" "+K("AS")+" "+L(this.as);return s};yy.CreateDatabase.prototype.execute=function(databaseid,params,cb){var args;if(this.args&&this.args.length>0){args=this.args.map(function(arg){return new Function("params,alasql","var y;return "+arg.toJavaScript())(params,alasql)})}if(this.engineid){var res=alasql.engines[this.engineid].createDatabase(this.databaseid,this.args,this.ifnotexists,this.as,cb);return res}else{var dbid=this.databaseid;if(alasql.databases[dbid]){throw new Error("Database '"+dbid+"' already exists")}var a=new alasql.Database(dbid);var res=1;if(cb)return cb(res);return res}};yy.AttachDatabase=function(params){return yy.extend(this,params)};yy.AttachDatabase.prototype.toString=function(){var s=K("ATTACH");if(this.engineid)s+=" "+L(this.engineid);s+=" "+K("DATABASE")+" "+L(this.databaseid);if(args){s+="(";if(args.length>0){s+=args.map(function(arg){return arg.toString()}).join(", ")}s+=")"}if(this.as)s+=" "+K("AS")+" "+L(this.as);return s};yy.AttachDatabase.prototype.execute=function(databaseid,params,cb){if(!alasql.engines[this.engineid]){throw new Error('Engine "'+this.engineid+'" is not defined.')}var res=alasql.engines[this.engineid].attachDatabase(this.databaseid,this.as,this.args,params,cb);return res};yy.DetachDatabase=function(params){return yy.extend(this,params)};yy.DetachDatabase.prototype.toString=function(){var s=K("DETACH");s+=" "+K("DATABASE")+" "+L(this.databaseid);return s};yy.DetachDatabase.prototype.execute=function(databaseid,params,cb){if(!alasql.databases[this.databaseid].engineid){throw new Error('Cannot detach database "'+this.engineid+'", because it was not attached.')}var res;var dbid=this.databaseid;if(dbid==alasql.DEFAULTDATABASEID){throw new Error("Drop of default database is prohibited")}if(!alasql.databases[dbid]){if(!this.ifexists){throw new Error("Database '"+dbid+"' does not exist")}else{res=0}}else{delete alasql.databases[dbid];if(dbid==alasql.useid){alasql.use()}res=1}if(cb)cb(res);return res};yy.UseDatabase=function(params){return yy.extend(this,params)};yy.UseDatabase.prototype.toString=function(){return K("USE")+" "+K("DATABASE")+" "+L(this.databaseid)};yy.UseDatabase.prototype.execute=function(databaseid,params,cb){var dbid=this.databaseid;if(!alasql.databases[dbid]){throw new Error("Database '"+dbid+"' does not exist")}alasql.use(dbid);var res=1;if(cb)cb(res);return res};yy.DropDatabase=function(params){return yy.extend(this,params)};yy.DropDatabase.prototype.toString=function(){var s=K("DROP");if(this.ifexists)s+=" "+K("IF")+" "+K("EXISTS");s+=" "+K("DATABASE")+" "+L(this.databaseid);return s};yy.DropDatabase.prototype.execute=function(databaseid,params,cb){if(this.engineid){return alasql.engines[this.engineid].dropDatabase(this.databaseid,this.ifexists,cb)}var res;var dbid=this.databaseid;if(dbid==alasql.DEFAULTDATABASEID){throw new Error("Drop of default database is prohibited")}if(!alasql.databases[dbid]){if(!this.ifexists){throw new Error("Database '"+dbid+"' does not exist")}else{res=0}}else{if(alasql.databases[dbid].engineid){throw new Error("Cannot drop database '"+dbid+"', because it is attached. Detach it.")}delete alasql.databases[dbid];if(dbid==alasql.useid){alasql.use()}res=1}if(cb)cb(res);return res};yy.Declare=function(params){return yy.extend(this,params)};yy.Declare.prototype.toString=function(){var s=K("DECLARE")+" ";if(this.declares&&this.declares.length>0){s=this.declares.map(function(declare){var s="";s+="@"+L(declare.variable)+" ";s+=declare.dbtypeid;if(this.dbsize)s+="("+N(this.dbsize);if(this.dbprecision)s+=","+N(this.dbprecision);s+=")";if(declare.expression)s+=" = "+declare.expression.toString();return s}).join(",")}return s};yy.Declare.prototype.execute=function(databaseid,params,cb){var res=1;if(this.declares&&this.declares.length>0){this.declares.map(function(declare){var dbtypeid=declare.dbtypeid;if(!alasql.fn[dbtypeid])dbtypeid=dbtypeid.toUpperCase();alasql.declares[declare.variable]={dbtypeid:dbtypeid,dbsize:declare.dbsize,dbprecision:declare.dbprecision};if(declare.expression){alasql.vars[declare.variable]=new Function("params,alasql","return "+declare.expression.toJavaScript("({})","",null))(params,alasql);if(alasql.declares[declare.variable]){alasql.vars[declare.variable]=alasql.stdfn.CONVERT(alasql.vars[declare.variable],alasql.declares[declare.variable])}}})}if(cb)res=cb(res);return res};yy.ShowDatabases=function(params){return yy.extend(this,params)};yy.ShowDatabases.prototype.toString=function(){var s=K("SHOW")+" "+K("DATABASES");if(this.like)s+="LIKE "+this.like.toString();return s};yy.ShowDatabases.prototype.execute=function(databaseid,params,cb){if(this.engineid){return alasql.engines[this.engineid].showDatabases(this.like,cb)}else{var self=this;var res=[];for(dbid in alasql.databases){res.push({databaseid:dbid})}if(self.like&&res&&res.length>0){res=res.filter(function(d){return d.databaseid.match(new RegExp(self.like.value.replace(/\%/g,".*"),"g"))})}if(cb)cb(res);return res}};yy.ShowTables=function(params){return yy.extend(this,params)};yy.ShowTables.prototype.toString=function(){var s=K("SHOW")+" "+K("TABLES");if(this.databaseid)s+=" FROM "+this.databaseid;if(this.like)s+=" "+K("LIKE")+" "+this.like.toString();return s};yy.ShowTables.prototype.execute=function(databaseid,params,cb){var db=alasql.databases[this.databaseid||databaseid];var self=this;var res=[];for(tableid in db.tables){res.push({tableid:tableid})}if(self.like&&res&&res.length>0){res=res.filter(function(d){return d.tableid.match(new RegExp(self.like.value.replace(/\%/g,".*"),"g"))})}if(cb)cb(res);return res};yy.ShowColumns=function(params){return yy.extend(this,params)};yy.ShowColumns.prototype.toString=function(){var s=K("SHOW")+" "+K("COLUMNS");if(this.table.tableid)s+=" "+K("FROM")+" "+this.table.tableid;if(this.databaseid)s+=" "+K("FROM")+" "+this.databaseid;return s};yy.ShowColumns.prototype.execute=function(databaseid){var db=alasql.databases[this.databaseid||databaseid];var table=db.tables[this.table.tableid];var self=this;if(table&&table.columns){var res=table.columns.map(function(col){return{columnid:col.columnid,dbtypeid:col.dbtypeid,dbsize:col.dbsize}});return res}else{return[]}};yy.ShowIndex=function(params){return yy.extend(this,params)};yy.ShowIndex.prototype.toString=function(){var s=K("SHOW")+" "+K("INDEX");if(this.table.tableid)s+=" "+K("FROM")+" "+this.table.tableid;if(this.databaseid)s+=" "+K("FROM")+" "+this.databaseid;return s};yy.ShowIndex.prototype.execute=function(databaseid){var db=alasql.databases[this.databaseid||databaseid];var table=db.tables[this.table.tableid];var self=this;var res=[];if(table&&table.indices){for(var ind in table.indices){res.push({hh:ind,len:Object.keys(table.indices[ind]).length})}}return res};yy.ShowCreateTable=function(params){return yy.extend(this,params)};yy.ShowCreateTable.prototype.toString=function(){var s=K("SHOW")+" "+K("CREATE")+" "+K("TABLE")+" "+L(this.table.tableid);if(this.databaseid)s+=" "+K("FROM")+" "+L(this.databaseid);return s};yy.ShowCreateTable.prototype.execute=function(databaseid){var db=alasql.databases[this.databaseid||databaseid];var table=db.tables[this.table.tableid];var self=this;if(table){var s=K("CREATE")+" "+K("TABLE")+" "+L(this.table.tableid)+" (";var ss=[];if(table.columns){table.columns.forEach(function(col){var a=L(col.columnid)+" "+K(col.dbtypeid);if(col.dbsize)a+="("+N(col.dbsize)+")";if(col.primarykey)a+=" "+K("PRIMARY")+" "+K("KEY");ss.push(a)});s+=ss.join(", ")}s+=")";return s}else{throw new Error('There is no such table "'+this.table.tableid+'"')}};yy.SetVariable=function(params){return yy.extend(this,params)};yy.SetVariable.prototype.toString=function(){var s=K("SET")+" ";if(typeof this.value!="undefined")s+=K(this.variable.toUpperCase())+" "+(this.value?"ON":"OFF");if(this.expression)s+=this.method+L(this.variable)+" = "+this.expression.toString();return s};yy.SetVariable.prototype.execute=function(databaseid,params,cb){if(typeof this.value!="undefined"){var val=this.value;if(val=="ON")val=true;else if(val=="OFF")val=false;alasql.options[this.variable]=val}else if(this.expression){if(this.exists){this.existsfn=this.exists.map(function(ex){var nq=ex.compile(databaseid);if(nq.query&&!nq.query.modifier)nq.query.modifier="RECORDSET";return nq})}if(this.queries){this.queriesfn=this.queries.map(function(q){var nq=q.compile(databaseid);if(nq.query&&!nq.query.modifier)nq.query.modifier="RECORDSET";return nq})}var res=new Function("params,alasql","return "+this.expression.toJavaScript("({})","",null)).bind(this)(params,alasql);if(alasql.declares[this.variable]){res=alasql.stdfn.CONVERT(res,alasql.declares[this.variable])}if(this.props&&this.props.length>0){if(this.method=="@"){var fs="alasql.vars['"+this.variable+"']"}else{var fs="params['"+this.variable+"']"}fs+=this.props.map(function(prop){if(typeof prop=="string"){return"['"+prop+"']"}else if(typeof prop=="number"){return"["+prop+"]"}else{return"["+prop.toJavaScript()+"]"}}).join();new Function("value,params,alasql","var y;"+fs+"=value")(res,params,alasql)}else{if(this.method=="@"){alasql.vars[this.variable]=res}else{params[this.variable]=res}}}var res=1;if(cb)res=cb(res);return res};alasql.test=function(name,times,fn){if(arguments.length==0){alasql.log(alasql.con.results);return}else if(arguments.length==1){var tm=Date.now();fn();alasql.con.log(Date.now()-tm);return}if(arguments.length==2){fn=times;times=1}var tm=Date.now();for(var i=0;i",sql);if(res instanceof Array){if(console.table){console.table(res)}else{console.log(JSONtoString(res))}}else{console.log(JSONtoString(res))}}else{var el;if(target=="output"){el=document.getElementsByTagName("output")[0]}else{if(typeof target=="string"){el=document.getElementById(target)}else{el=target}}var s="";if(typeof sql=="string"&&alasql.options.logprompt){s+=""+alasql.pretty(sql)+"
"}if(res instanceof Array){if(res.length==0){s+="[ ]
"}else if(typeof res[0]!="object"||res[0]instanceof Array){for(var i=0,ilen=res.length;i"+loghtml(res[i])+"
"}}else{s+=loghtml(res)}}else{s+=loghtml(res)}el.innerHTML+=s}};alasql.clear=function(){var target=alasql.options.logtarget;if(typeof exports=="object"){target="console"}if(target=="console"||typeof exports=="object"){if(console.clear){console.clear()}else{}}else{var el;if(target=="output"){el=document.getElementsByTagName("output")[0]}else{if(typeof target=="string"){el=document.getElementById(target)}else{el=target}}el.innerHTML=""}};alasql.write=function(s){var target=alasql.options.logtarget;if(typeof exports=="object"){target="console"}if(target=="console"||typeof exports=="object"){if(console.log){console.log(s)}else{}}else{var el;if(target=="output"){el=document.getElementsByTagName("output")[0]}else{if(typeof target=="string"){el=document.getElementById(target)}else{el=target}}el.innerHTML+=s}};function loghtml(res){var s="";if(typeof res=="undefined"){s+="undefined"}else if(res instanceof Array){s+="";s+="";var cols=[];for(colid in res[0]){cols.push(colid)}s+="#";cols.forEach(function(colid){s+=" "+colid});for(var i=0,ilen=res.length;i"+(i+1);cols.forEach(function(colid){s+=" ";if(+res[i][colid]==+res[i][colid]){s+='';if(typeof res[i][colid]=="undefined")s+="NULL";else s+=res[i][colid];s+="
"}else{if(typeof res[i][colid]=="undefined"){s+="NULL"}else if(typeof res[i][colid]=="string"){s+=res[i][colid]}else s+=JSONtoString(res[i][colid])}})}s+="
"}else{s+=""+JSONtoString(res)+"
"}return s}function scrollTo(element,to,duration){if(duration<=0)return;var difference=to-element.scrollTop;var perTick=difference/duration*10;setTimeout(function(){if(element.scrollTop==to)return;element.scrollTop=element.scrollTop+perTick;scrollTo(element,to,duration-10)},10)}alasql.prompt=function(el,useidel,firstsql){if(typeof exports=="object"){throw new Error("The functionality of prompt is not realized for Node.js")}var prompti=0;if(typeof el=="string")el=document.getElementById(el);if(typeof useidel=="string")useidel=document.getElementById(useidel);useidel.textContent=alasql.useid;if(firstsql){alasql.prompthistory.push(firstsql);prompti=alasql.prompthistory.length;try{var tm=Date.now();alasql.log(firstsql);alasql.write(''+(Date.now()-tm)+" ms
")}catch(err){alasql.write(""+olduseid+"> "+sql+"
");alasql.write(''+err+"
")}}var y=el.getBoundingClientRect().top+document.getElementsByTagName("body")[0].scrollTop;scrollTo(document.getElementsByTagName("body")[0],y,500);el.onkeydown=function(event){if(event.which==13){var sql=el.value;var olduseid=alasql.useid;el.value="";alasql.prompthistory.push(sql);prompti=alasql.prompthistory.length;try{var tm=Date.now();alasql.log(sql);alasql.write('
'+(Date.now()-tm)+" ms
")}catch(err){alasql.write(""+olduseid+"> "+alasql.pretty(sql,false)+"
");alasql.write(''+err+"
")}el.focus();useidel.textContent=alasql.useid;var y=el.getBoundingClientRect().top+document.getElementsByTagName("body")[0].scrollTop;scrollTo(document.getElementsByTagName("body")[0],y,500)}else if(event.which==38){prompti--;if(prompti<0)prompti=0;if(alasql.prompthistory[prompti]){el.value=alasql.prompthistory[prompti];event.preventDefault()}}else if(event.which==40){prompti++;if(prompti>=alasql.prompthistory.length){prompti=alasql.prompthistory.length;el.value=""}else if(alasql.prompthistory[prompti]){el.value=alasql.prompthistory[prompti];event.preventDefault()}}}};yy.BeginTransaction=function(params){return yy.extend(this,params)};yy.BeginTransaction.prototype.toString=function(){return K("BEGIN")+" "+K("TRANSACTION")};yy.BeginTransaction.prototype.execute=function(databaseid,params,cb){var res=1;if(alasql.databases[databaseid].engineid){return alasql.engines[alasql.databases[alasql.useid].engineid].begin(databaseid,cb)}else{}if(cb)cb(res);return res};yy.CommitTransaction=function(params){return yy.extend(this,params)};yy.CommitTransaction.prototype.toString=function(){return K("COMMIT")+" "+K("TRANSACTION")};yy.CommitTransaction.prototype.execute=function(databaseid,params,cb){var res=1;if(alasql.databases[databaseid].engineid){return alasql.engines[alasql.databases[alasql.useid].engineid].commit(databaseid,cb)}else{}if(cb)cb(res);return res};yy.RollbackTransaction=function(params){return yy.extend(this,params)};yy.RollbackTransaction.prototype.toString=function(){return K("ROLLBACK")+" "+K("TRANSACTION")};yy.RollbackTransaction.prototype.execute=function(databaseid,params,cb){var res=1;if(alasql.databases[databaseid].engineid){return alasql.engines[alasql.databases[databaseid].engineid].rollback(databaseid,cb)}else{}if(cb)cb(res);return res};if(alasql.options.tsql){alasql.stdfn.OBJECT_ID=function(name,type){if(typeof type=="undefined")type="T";type=type.toUpperCase();var sname=name.split(".");var dbid=alasql.useid;var objname=sname[0];if(sname.length==2){dbid=sname[0];objname=sname[1]}var tables=alasql.databases[dbid].tables;dbid=alasql.databases[dbid].databaseid;for(var tableid in tables){if(tableid==objname){if(tables[tableid].view&&type=="V")return dbid+"."+tableid;if(!tables[tableid].view&&type=="T")return dbid+"."+tableid;return undefined}}return undefined}}if(alasql.options.mysql){}if(alasql.options.mysql||alasql.options.sqlite){alasql.from.INFORMATION_SCHEMA=function(filename,opts,cb,idx,query){if(filename=="VIEWS"||filename=="TABLES"){var res=[];for(var databaseid in alasql.databases){var tables=alasql.databases[databaseid].tables;for(var tableid in tables){if(tables[tableid].view&&filename=="VIEWS"||!tables[tableid].view&&filename=="TABLES"){res.push({TABLE_CATALOG:databaseid,TABLE_NAME:tableid})}}}if(cb)res=cb(res,idx,query);return res}throw new Error("Unknown INFORMATION_SCHEMA table")}}if(alasql.options.postgres){}if(alasql.options.oracle){}if(alasql.options.sqlite){}alasql.into.SQL=function(filename,opts,data,columns,cb){var res;if(typeof filename=="object"){opts=filename;filename=undefined}var opt={};alasql.utils.extend(opt,opts);if(typeof opt.tableid=="undefined"){throw new Error("Table for INSERT TO is not defined.")}var s="";if(columns.length==0){if(typeof data[0]=="object"){columns=Object.keys(data[0]).map(function(columnid){return{columnid:columnid}})}else{}}for(var i=0,ilen=data.length;i0){columns=Object.keys(data[0]).map(function(columnid){return{columnid:columnid}
-})}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};alasql.into.TAB=alasql.into.TSV=function(filename,opts,data,columns,cb){var opt={};alasql.utils.extend(opt,opts);opt.separator=" ";return alasql.into.CSV(filename,opt,data,columns,cb)};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.quote='"';alasql.utils.extend(opt,opts);var res=data.length;var s="";if(opt.headers){s+=columns.map(function(col){return col.columnid}).join(opt.separator)+"\n"}data.forEach(function(d,idx){s+=columns.map(function(col){var s=d[col.columnid];s=(s+"").replace(new RegExp("\\"+opt.quote,"g"),'""');if((s+"").indexOf(opt.separator)>-1||(s+"").indexOf(opt.quote)>-1)s=opt.quote+s+opt.quote;return s}).join(opt.separator)+"\n"});res=alasql.utils.saveFile(filename,s);if(cb)res=cb(res);return res};alasql.into.XLS=function(filename,opts,data,columns,cb){if(typeof filename=="object"){opts=filename;filename=undefined}var sheets={};if(opts&&opts.sheets){sheets=opts.sheets}var sheet={};if(typeof sheets["Sheet1"]!="undefined"){sheet=sheets[0]}else{if(typeof opts!="undefined"){sheet=opts}}if(typeof sheet.sheetid=="undefined"){sheet.sheetid="Sheet1"}var s=toHTML();var res=alasql.utils.saveFile(filename,s);if(cb)res=cb(res);return res;function toHTML(){var s=' ";s+="";s+="";if(typeof sheet.caption!="undefined"){var caption=sheet.caption;if(typeof caption=="string"){caption={title:caption}}s+="";s+=caption.title;s+=" "}if(typeof sheet.columns!="undefined"){columns=sheet.columns}else{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}})}}}}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;if(sheet.headers&&sheet.headers instanceof Array)column.title=sheet.headers[idx]});s+="";columns.forEach(function(column){s+=' '});s+=" ";if(sheet.headers){s+="";s+="";columns.forEach(function(column,columnidx){s+="";if(typeof column.title!="undefined"){if(typeof column.title=="function"){s+=column.title(sheet,column,columnidx)}else{s+=column.title}}s+=" "});s+=" ";s+=" "}s+="";if(data&&data.length>0){data.forEach(function(row,rowidx){if(rowidx>sheet.limit)return;s+="";columns.forEach(function(column,columnidx){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])}var value=row[column.columnid];if(typeof cell.value=="function"){value=cell.value(value,sheet,row,column,cell,rowidx,columnidx)}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 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{if(opts.types&&opts.types[typeid]&&opts.types[typeid].typestyle){typestyle=opts.types[typeid].typestyle}}typestyle=typestyle||'mso-number-format:"\\@";';s+="";var format=cell.format;if(typeof value=="undefined"){s+=""}else if(typeof format!="undefined"){if(typeof format=="function"){s+=format(value)}else if(typeof format=="string"){s+=value}else{throw new Error("Unknown format type. Should be function or string")}}else{if(typeid=="number"||typeid=="date"){s+=value.toString()}else if(typeid=="money"){s+=(+value).toFixed(2)}else{s+=value}}s+=" "});s+=" "})}s+=" ";s+="
";s+="";s+="";return s}function style(a){var s=' style="';if(a&&typeof a.style!="undefined"){s+=a.style+";"}s+='" ';return s}};alasql.into.XLSXML=function(filename,opts,data,columns,cb){if(typeof filename=="object"){opts=filename;filename=undefined}var sheets={};if(opts&&opts.sheets){sheets=opts.sheets}else{sheets.Sheet1=opts}var res=alasql.utils.saveFile(filename,toXML());if(cb)res=cb(res);return res;function toXML(){var s1=' 0 ';var s2="";var s3=" ";var styles={};var stylesn=62;function hstyle(st){var s="";for(var key in st){s+="<"+key;for(var attr in st[key]){s+=" ";if(attr.substr(0,2)=="x:"){s+=attr}else{s+="ss:"}s+=attr+'="'+st[key][attr]+'"'}s+="/>"}var hh=hash(s);if(styles[hh]){}else{styles[hh]={styleid:stylesn};s2+='";stylesn++}return"s"+styles[hh].styleid}for(var sheetid in sheets){var sheet=sheets[sheetid];if(typeof sheet.columns!="undefined"){columns=sheet.columns}else{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}})}}}}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;if(sheet.headers&&sheet.headers instanceof Array)column.title=sheet.headers[idx]});s3+=' ';columns.forEach(function(column,columnidx){s3+=' '});if(sheet.headers){s3+='';columns.forEach(function(column,columnidx){s3+="';if(typeof column.title!="undefined"){if(typeof column.title=="function"){s3+=column.title(sheet,column,columnidx)}else{s3+=column.title}}s3+=" | "});s3+="
"}if(data&&data.length>0){data.forEach(function(row,rowidx){if(rowidx>sheet.limit)return;var srow={};extend(srow,sheet.row);if(sheet.rows&&sheet.rows[rowidx]){extend(srow,sheet.rows[rowidx])}s3+="";columns.forEach(function(column,columnidx){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])}var value=row[column.columnid];if(typeof cell.value=="function"){value=cell.value(value,sheet,row,column,cell,rowidx,columnidx)}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";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{if(opts.types&&opts.types[typeid]&&opts.types[typeid].typestyle){typestyle=opts.types[typeid].typestyle}}typestyle=typestyle||'mso-number-format:"\\@";';s3+="";s3+='';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}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+="
"})}s3+="
"}s3+=" ";return s1+s2+s3}};alasql.into.XLSX=function(filename,opts,data,columns,cb){var res=1;if(deepEqual(columns,[{columnid:"_"}])){data=data.map(function(dat){return dat._});columns=undefined}else{}if(typeof exports=="object"){var XLSX=require("xlsx")}else{var XLSX=window.XLSX}if(typeof filename=="object"){opts=filename;filename=undefined}var wb={SheetNames:[],Sheets:{}};if(opts.sourcefilename){alasql.utils.loadBinaryFile(opts.sourcefilename,!!cb,function(data){wb=XLSX.read(data,{type:"binary"});doExport()})}else{doExport()}if(cb)res=cb(res);return res;function doExport(){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)}function prepareSheet(opts,data,columns,idx){var opt={sheetid:"Sheet"+idx,headers:true};alasql.utils.extend(opt,opts);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}});i++}for(var j=0;j>>8^CRC_TABLE[offset]}return crc^-1}function pack(items){var data=arguments,idx=0,buffer,bufferSize=0;items=items.split("");items.forEach(function(type){if(type=="v"){bufferSize+=2}else if(type=="V"||type=="l"){bufferSize+=4}});buffer=new Buffer(bufferSize);items.forEach(function(type,index){if(type=="v"){buffer.writeUInt16LE(data[index+1],idx);idx+=2}else if(type=="V"){buffer.writeUInt32LE(data[index+1],idx);idx+=4}else if(type=="l"){buffer.writeInt32LE(data[index+1],idx);idx+=4}});return buffer}function normalizeZipPath(zipPath){return zipPath.replace(/\\/g,"/").replace(/^\/|\/$/g,"")}this.addEntry=function(entry){entry.path=normalizeZipPath(entry.path);entries.push(entry)};this.addDir=function(zipPath,localPath){this.addEntry({path:zipPath,file:localPath,isFile:false})};this.addData=function(zipPath,data){if(!Buffer.isBuffer(data)){data=new Buffer(data)}this.addEntry({path:zipPath,data:data})};function buildZipBuffer(){var buffers=[];var length=0;function append(buf){if(typeof buf=="string"){buf=new Buffer(buf)}buffers.push(buf);length+=buf.length}entries.forEach(function(entry){var mtime,mdate;entry.extra=entry.extra||"";entry.comment=entry.comment||"";entry.cmethod=0;mtime=entry.mtime;mdate=entry.mdate;if(entry.mtime instanceof Date){mtime=entry.mtime.getHours();mtime=mtime<<6;mtime=mtime|entry.mtime.getMinutes();mtime=mtime<<5;mtime=mtime|entry.mtime.getSeconds()/2;mdate=entry.mtime.getFullYear()-1980;mdate=mdate<<4;mdate=mdate|entry.mtime.getMonth()+1;mdate=mdate<<5;mdate=mdate|entry.mtime.getDate()}var fileName=entry.path;if(!entry.isFile&&fileName.charAt(fileName.length-1)!="/"){entry.path=fileName=fileName+"/"}entry.offset=length;append(pack("VvvvvvlVVvv",67324752,20,2,entry.cmethod,mtime,mdate,entry.crc32,entry.csize,entry.size,fileName.length,entry.extra.length));append(fileName);append(entry.extra);append(entry.data);entry.mtime=mtime;entry.mdate=mdate;entry.eattr=entry.isFile?32:48});var startOffset=length;var centralDirSize=0;entries.forEach(function(entry){append(pack("VvvvvvvlVVvvvvvVV",33639248,20,20,2,entry.cmethod,entry.mtime,entry.mdate,entry.crc32,entry.csize,entry.size,entry.path.length,entry.extra.length,entry.comment.length,0,0,entry.eattr,entry.offset));append(entry.path);append(entry.extra);append(entry.comment);centralDirSize+=46+entry.path.length+entry.extra.length+entry.comment.length});var comment="";append(pack("VvvvvVVv",101010256,0,0,entries.length,entries.length,centralDirSize,startOffset,comment.length));append(comment);var buffer=Buffer.concat(buffers);return buffer}this.toBuffer=function(callback){var index=-1;function deflateNext(){var data;var entry=entries[++index];if(entry){entry.csize=entry.size=entry.crc32=0;data=entry.data=entry.data?entry.data:new Buffer(0);entry.mtime=new Date;if(entry.isFile!==false){entry.crc32=calculateCrc32(data);entry.isFile=true;entry.size=data.length;entry.csize=entry.size;deflateNext()}else{deflateNext()}}else{callback(buildZipBuffer())}}deflateNext()}};alasql.from.METEOR=function(filename,opts,cb,idx,query){var res=filename.find(opts).fetch();if(cb)res=cb(res,idx,query);return res};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};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=N)return EOF;if(eol)return eol=false,EOL;var j=I;if(text.charCodeAt(j)===quoteCode){var i=j;while(i++/g,"");return document();function document(){return{declaration:declaration(),root:tag()}}function declaration(){var m=match(/^<\?xml\s*/);if(!m)return;var node={attributes:{}};while(!(eos()||is("?>"))){var attr=attribute();if(!attr)return node;node.attributes[attr.name]=attr.value}match(/\?>\s*/);return node}function tag(){var m=match(/^<([\w-:.]+)\s*/);if(!m)return;var node={name:m[1],attributes:{},children:[]};while(!(eos()||is(">")||is("?>")||is("/>"))){var attr=attribute();if(!attr)return node;node.attributes[attr.name]=attr.value}if(match(/^\s*\/>\s*/)){return node}match(/\??>\s*/);node.content=content();var child;while(child=tag()){node.children.push(child)}match(/^<\/[\w-:.]+>\s*/);return node}function content(){var m=match(/^([^<]*)/);if(m)return m[1];return""}function attribute(){var m=match(/([\w:-]+)\s*=\s*("[^"]*"|'[^']*'|\w+)\s*/);if(!m)return;return{name:m[1],value:strip(m[2])}}function strip(val){return val.replace(/^['"]|['"]$/g,"")}function match(re){var m=xml.match(re);if(!m)return;xml=xml.slice(m[0].length);return m}function eos(){return 0==xml.length}function is(prefix){return 0==xml.indexOf(prefix)}}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};yy.Help=function(params){return yy.extend(this,params)};yy.Help.prototype.toString=function(){var s=K("HELP");if(this.subject)s+=" "+L(this.subject);return s};helpdocs=[{command:"ALTER TABLE table RENAME TO table"},{command:"ALTER TABLE table ADD COLUMN column coldef"},{command:"ALTER TABLE table MODIFY COLUMN column coldef"},{command:"ALTER TABLE table RENAME COLUMN column TO column"},{command:"ALTER TABLE table DROP column"},{command:"ATTACH engine DATABASE database"},{command:"ASSERT value"},{command:"BEGIN [TRANSACTION]"},{command:"COMMIT [TRANSACTION]"},{command:"CREATE [engine] DATABASE [IF NOT EXISTS] database"},{command:"CREATE TABLE [IF NOT EXISTS] table (column definitions)"},{command:"DELETE FROM table [WHERE expression]"},{command:"DETACH DATABASE database"},{command:"DROP [engine] DATABASE [IF EXISTS] database"},{command:"DROP TABLE [IF EXISTS] table"},{command:"INSERT INTO table VALUES value,..."},{command:"INSERT INTO table DEFAULT VALUES"},{command:"INSERT INTO table SELECT select"},{command:"HELP [subject]"},{command:"ROLLBACK [TRANSACTION]"},{command:"SELECT [modificator] columns [INTO table] [FROM table,...] [[mode] JOIN [ON] [USING]] [WHERE ] [GROUP BY] [HAVING] [ORDER BY] "},{command:"SET option value"},{command:"SHOW [engine] DATABASES"},{command:"SHOW TABLES"},{command:"SHOW CREATE TABLE table"},{command:"UPDATE table SET column1 = expression1, ... [WHERE expression]"},{command:"USE [DATABASE] database"},{command:"expression"},{command:'See also http://github/agershun/alasq for more information'}];yy.Help.prototype.execute=function(databaseid,params,cb){var ss=[];if(!this.subject){ss=helpdocs}else{ss.push('See also http://github/agershun/alasq for more information')}if(cb)ss=cb(ss);return ss};yy.Print=function(params){return yy.extend(this,params)};yy.Print.prototype.toString=function(){var s=K("PRINT");if(this.statement)s+=" "+this.statement.toString();return s};yy.Print.prototype.execute=function(databaseid,params,cb){var self=this;var res=1;alasql.precompile(this,databaseid,params);if(this.exprs&&this.exprs.length>0){var rs=this.exprs.map(function(expr){var exprfn=new Function("params,alasql,p","var y;return "+expr.toJavaScript("({})","",null)).bind(self);var r=exprfn(params,alasql);return JSONtoString(r)});console.log.apply(console,rs)}else if(this.select){var r=this.select.execute(databaseid,params);console.log(JSONtoString(r))}else{console.log()}if(cb)res=cb(res);return res};yy.Source=function(params){return yy.extend(this,params)};yy.Source.prototype.toString=function(){var s=K("SOURCE");if(this.url)s+=" "+S("'"+this.url+"'");return s};yy.Source.prototype.execute=function(databaseid,params,cb){var res;loadFile(this.url,!!cb,function(data){res=alasql(data);if(cb)res=cb(res);return res},function(err){throw err});return res};yy.Require=function(params){return yy.extend(this,params)};yy.Require.prototype.toString=function(){var s=K("REQUIRE");if(this.paths&&this.paths.length>0){s+=this.paths.map(function(path){return path.toString()}).join(",")}if(this.plugins&&this.plugins.length>0){s+=this.plugins.map(function(plugin){return plugin.toUpperCase()}).join(",")}return s};yy.Require.prototype.execute=function(databaseid,params,cb){var self=this;var res=0;var ss="";if(this.paths&&this.paths.length>0){this.paths.forEach(function(path){loadFile(path.value,!!cb,function(data){res++;ss+=data;if(res0){this.plugins.forEach(function(plugin){if(!alasql.plugins[plugin]){loadFile(alasql.path+"/alasql-"+plugin.toLowerCase()+".js",!!cb,function(data){res++;ss+=data;if(res0){res=res.filter(function(d){return d.databaseid.match(relike)})}}if(cb)cb(res);return res};LS.createTable=function(databaseid,tableid,ifnotexists,cb){var lsdbid=alasql.databases[databaseid].lsdbid;var tb=LS.get(lsdbid+"."+tableid);var res=1;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];lsdb.tables[tableid]={columns:table.columns};LS.set(lsdbid,lsdb);LS.set(lsdbid+"."+tableid,[]);if(cb)cb(res);return res};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);if(cb)cb(res);return res};LS.fromTable=function(databaseid,tableid,cb,idx,query){var lsdbid=alasql.databases[databaseid].lsdbid;var res=LS.get(lsdbid+"."+tableid);if(cb)res=cb(res,idx,query);return res};LS.intoTable=function(databaseid,tableid,value,columns,cb){var lsdbid=alasql.databases[databaseid].lsdbid;var res=value.length;var tb=LS.get(lsdbid+"."+tableid);if(!tb)tb=[];tb=tb.concat(value);LS.set(lsdbid+"."+tableid,tb);if(cb)cb(res);return res};LS.loadTableData=function(databaseid,tableid){var db=alasql.databases[databaseid];var lsdbid=alasql.databases[databaseid].lsdbid;db.tables[tableid].data=LS.get(lsdbid+"."+tableid)};LS.saveTableData=function(databaseid,tableid){var db=alasql.databases[databaseid];var lsdbid=alasql.databases[databaseid].lsdbid;LS.set(lsdbid+"."+tableid,db.tables[tableid].data);db.tables[tableid].data=null};LS.commit=function(databaseid,cb){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){lsdb.tables[tbid]={columns:db.tables[tbid].columns};LS.set(lsdbid+"."+tbid,db.tables[tbid].data)}}LS.set(lsdbid,lsdb);return 1};LS.begin=LS.commit;LS.rollback=function(databaseid,cb){var db=alasql.databases[databaseid];db.dbversion++;var lsdbid=alasql.databases[databaseid].lsdbid;var lsdb=LS.get(lsdbid);if(lsdb.tables){for(var tbid in lsdb.tables){var tb=new alasql.Table({columns:db.tables[tbid].columns});extend(tb,lsdb.tables[tbid]);lsdb.tables[tbid]=tb;if(!alasql.options.autocommit){lsdb.tables[tbid].data=LS.get(db.lsdbid+"."+tbid)}lsdb.tables[tbid].indexColumns()}}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"};var SQLITE=alasql.engines.SQLITE=function(){};SQLITE.createDatabase=function(wdbid,args,ifnotexists,dbid,cb){throw new Error("Connot create SQLITE database in memory. Attach it.")};SQLITE.dropDatabase=function(databaseid){throw new Error("This is impossible to drop SQLite database. Detach it.")};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')}if(args[0]&&args[0]instanceof yy.StringValue||args[0]instanceof yy.ParamValue){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};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)};SQLITE.intoTable=function(databaseid,tableid,value,columns,cb){var sqldb=alasql.databases[databaseid].sqldb;for(var i=0,ilen=value.length;i1){var sql="REQUIRE "+paths.map(function(p){return'"'+p+'"'}).join(",");alasql(sql,[],cb)}}else if(path===false){delete alasql.webworker;return}}}
\ No newline at end of file
+return v}else{acc.arr.push(v);var p=acc.arr.sort();return p[p.length/2|0]}};alasql.aggr.VAR=function(v,s,acc){if(typeof acc.arr=="undefined"){acc.arr=[v];acc.sum=v}else{acc.arr.push(v);acc.sum+=v}var N=acc.arr.length;var avg=acc.sum/N;var std=0;for(var i=0;i0){this.whens.forEach(function(w){if(w.when.findAggregator)w.when.findAggregator(query);if(w.then.findAggregator)w.then.findAggregator(query)})}if(this.elses&&this.elses.findAggregator)this.elses.findAggregator(query)};yy.CaseValue.prototype.toJavaScript=function(context,tableid,defcols){var s="((function("+context+",params,alasql){var r;";if(this.expression){s+="v="+this.expression.toJavaScript(context,tableid,defcols)+";";s+=(this.whens||[]).map(function(w){return" if(v=="+w.when.toJavaScript(context,tableid,defcols)+") {r="+w.then.toJavaScript(context,tableid,defcols)+"}"}).join(" else ");if(this.elses)s+=" else {r="+this.elses.toJavaScript(context,tableid,defcols)+"}"}else{s+=(this.whens||[]).map(function(w){return" if("+w.when.toJavaScript(context,tableid,defcols)+") {r="+w.then.toJavaScript(context,tableid,defcols)+"}"}).join(" else ");if(this.elses)s+=" else {r="+this.elses.toJavaScript(context,tableid,defcols)+"}"}s+=";return r;}).bind(this))("+context+",params,alasql)";return s};yy.Json=function(params){return yy.extend(this,params)};yy.Json.prototype.toString=function(){var s="";s+=JSONtoString(this.value);s+="";return s};var JSONtoString=alasql.utils.JSONtoString=function(obj){var s="";if(typeof obj=="string")s='"'+obj+'"';else if(typeof obj=="number")s=obj;else if(typeof obj=="boolean")s=obj;else if(typeof obj=="object"){if(obj instanceof Array){s+="["+obj.map(function(b){return JSONtoString(b)}).join(",")+"]"}else if(!obj.toJavaScript||obj instanceof yy.Json){s="{";var ss=[];for(var k in obj){var s1="";if(typeof k=="string")s1+='"'+k+'"';else if(typeof k=="number")s1+=k;else if(typeof k=="boolean")s1+=k;else{throw new Error("THis is not ES6... no expressions on left side yet")}s1+=":"+JSONtoString(obj[k]);ss.push(s1)}s+=ss.join(",")+"}"}else if(obj.toString){s=obj.toString()}else{throw new Error("1Can not show JSON object "+JSON.stringify(obj))}}else{throw new Error("2Can not show JSON object "+JSON.stringify(obj))}return s};function JSONtoJavaScript(obj,context,tableid,defcols){var s="";if(typeof obj=="string")s='"'+obj+'"';else if(typeof obj=="number")s="("+obj+")";else if(typeof obj=="boolean")s=obj;else if(typeof obj=="object"){if(obj instanceof Array){s+="["+obj.map(function(b){return JSONtoJavaScript(b,context,tableid,defcols)}).join(",")+"]"}else if(!obj.toJavaScript||obj instanceof yy.Json){s="{";var ss=[];for(var k in obj){var s1="";if(typeof k=="string")s1+='"'+k+'"';else if(typeof k=="number")s1+=k;else if(typeof k=="boolean")s1+=k;else{throw new Error("THis is not ES6... no expressions on left side yet")}s1+=":"+JSONtoJavaScript(obj[k],context,tableid,defcols);ss.push(s1)}s+=ss.join(",")+"}"}else if(obj.toJavaScript){s=obj.toJavaScript(context,tableid,defcols)}else{throw new Error("1Can not parse JSON object "+JSON.stringify(obj))}}else{throw new Error("2Can not parse JSON object "+JSON.stringify(obj))}return s}yy.Json.prototype.toJavaScript=function(context,tableid,defcols){return JSONtoJavaScript(this.value,context,tableid,defcols)};yy.Convert=function(params){return yy.extend(this,params)};yy.Convert.prototype.toString=function(){var s="CONVERT(";s+=this.dbtypeid;if(typeof this.dbsize!="undefined"){s+="("+this.dbsize;if(this.dbprecision)s+=","+dbprecision;s+=")"}s+=","+this.expression.toString();if(this.style)s+=","+this.style;s+=")";return s};yy.Convert.prototype.toJavaScript=function(context,tableid,defcols){return"alasql.stdfn.CONVERT("+this.expression.toJavaScript(context,tableid,defcols)+',{dbtypeid:"'+this.dbtypeid+'",dbsize:'+this.dbsize+",style:"+this.style+"})";throw new Error("There is not such type conversion for "+this.toString())};alasql.stdfn.CONVERT=function(value,args){var val=value;if(args.style){var t;if(/\d{8}/.test(val))t=new Date(+val.substr(0,4),+val.substr(4,2)-1,+val.substr(6,2));else t=new Date(val);if(args.style==1){val=("0"+(t.getMonth()+1)).substr(-2)+"/"+("0"+t.getDate()).substr(-2)+"/"+("0"+t.getYear()).substr(-2)}else if(args.style==2){val=("0"+t.getYear()).substr(-2)+"."+("0"+(t.getMonth()+1)).substr(-2)+"."+("0"+t.getDate()).substr(-2)}else if(args.style==3){val=("0"+t.getDate()).substr(-2)+"/"+("0"+(t.getMonth()+1)).substr(-2)+"/"+("0"+t.getYear()).substr(-2)}else if(args.style==4){val=("0"+t.getDate()).substr(-2)+"."+("0"+(t.getMonth()+1)).substr(-2)+"."+("0"+t.getYear()).substr(-2)}else if(args.style==5){val=("0"+t.getDate()).substr(-2)+"-"+("0"+(t.getMonth()+1)).substr(-2)+"-"+("0"+t.getYear()).substr(-2)}else if(args.style==6){val=("0"+t.getDate()).substr(-2)+" "+t.toString().substr(4,3).toLowerCase()+" "+("0"+t.getYear()).substr(-2)}else if(args.style==7){val=t.toString().substr(4,3)+" "+("0"+t.getDate()).substr(-2)+","+("0"+t.getYear()).substr(-2)}else if(args.style==8){val=("0"+t.getHours()).substr(-2)+":"+("0"+(t.getMinutes()+1)).substr(-2)+":"+("0"+t.getSeconds()).substr(-2)}else if(args.style==10){val=("0"+(t.getMonth()+1)).substr(-2)+"-"+("0"+t.getDate()).substr(-2)+"-"+("0"+t.getYear()).substr(-2)}else if(args.style==11){val=("0"+t.getYear()).substr(-2)+"/"+("0"+(t.getMonth()+1)).substr(-2)+"/"+("0"+t.getDate()).substr(-2)}else if(args.style==12){val=("0"+t.getYear()).substr(-2)+("0"+(t.getMonth()+1)).substr(-2)+("0"+t.getDate()).substr(-2)}else if(args.style==101){val=("0"+(t.getMonth()+1)).substr(-2)+"/"+("0"+t.getDate()).substr(-2)+"/"+t.getFullYear()}else if(args.style==102){val=t.getFullYear()+"."+("0"+(t.getMonth()+1)).substr(-2)+"."+("0"+t.getDate()).substr(-2)}else if(args.style==103){val=("0"+t.getDate()).substr(-2)+"/"+("0"+(t.getMonth()+1)).substr(-2)+"/"+t.getFullYear()}else if(args.style==104){val=("0"+t.getDate()).substr(-2)+"."+("0"+(t.getMonth()+1)).substr(-2)+"."+t.getFullYear()}else if(args.style==105){val=("0"+t.getDate()).substr(-2)+"-"+("0"+(t.getMonth()+1)).substr(-2)+"-"+t.getFullYear()}else if(args.style==106){val=("0"+t.getDate()).substr(-2)+" "+t.toString().substr(4,3).toLowerCase()+" "+t.getFullYear()}else if(args.style==107){val=t.toString().substr(4,3)+" "+("0"+t.getDate()).substr(-2)+","+t.getFullYear()}else if(args.style==108){val=("0"+t.getHours()).substr(-2)+":"+("0"+(t.getMinutes()+1)).substr(-2)+":"+("0"+t.getSeconds()).substr(-2)}else if(args.style==110){val=("0"+(t.getMonth()+1)).substr(-2)+"-"+("0"+t.getDate()).substr(-2)+"-"+t.getFullYear()}else if(args.style==111){val=t.getFullYear()+"/"+("0"+(t.getMonth()+1)).substr(-2)+"/"+("0"+t.getDate()).substr(-2)}else if(args.style==112){val=t.getFullYear()+("0"+(t.getMonth()+1)).substr(-2)+("0"+t.getDate()).substr(-2)}else{throw new Error("The CONVERT style "+args.style+" is not realized yet.")}}var udbtypeid=args.dbtypeid.toUpperCase();if(args.dbtypeid=="Date"){return new Date(val)}else if(udbtypeid=="DATE"){var d=new Date(val);var s=d.getFullYear()+"."+("0"+(d.getMonth()+1)).substr(-2)+"."+("0"+d.getDate()).substr(-2);return s}else if(udbtypeid=="DATETIME"){var d=new Date(val);var s=d.getFullYear()+"."+("0"+(d.getMonth()+1)).substr(-2)+"."+("0"+d.getDate()).substr(-2);s+=" "+("0"+d.getHours()).substr(-2)+":"+("0"+d.getMinutes()).substr(-2)+":"+("0"+d.getSeconds()).substr(-2);s+="."+("00"+d.getMilliseconds()).substr(-3);return s}else if(["NUMBER","FLOAT"].indexOf(udbtypeid)>-1){return+val}else if(["MONEY"].indexOf(udbtypeid)>-1){var m=+val;return(m|0)+m*100%100/100}else if(["BOOLEAN"].indexOf(udbtypeid)>-1){return!!val}else if(["INT","INTEGER","SMALLINT","BIGINT","SERIAL","SMALLSERIAL","BIGSERIAL"].indexOf(args.dbtypeid.toUpperCase())>-1){return val|0}else if(["STRING","VARCHAR","NVARCHAR","CHARACTER VARIABLE"].indexOf(args.dbtypeid.toUpperCase())>-1){if(args.dbsize)return(""+val).substr(0,args.dbsize);else return""+val}else if(["CHAR","CHARACTER","NCHAR"].indexOf(udbtypeid)>-1){return(val+new Array(args.dbsize+1).join(" ")).substr(0,args.dbsize)}else if(["DECIMAL","NUMERIC"].indexOf(udbtypeid)>-1){var m=+val;var fxd=Math.pow(10,args.dbpecision);return(m|0)+m*fxd%fxd/fxd}else if(["JSON"].indexOf(udbtypeid)>-1){if(typeof val=="object")return val;try{return JSON.parse(val)}catch(err){throw new Error("Cannot convert string to JSON")}}return val};yy.ColumnDef=function(params){return yy.extend(this,params)};yy.ColumnDef.prototype.toString=function(){var s=this.columnid;if(this.dbtypeid)s+=" "+this.dbtypeid;if(this.dbsize){s+="("+this.dbsize;if(this.dbprecision)s+=","+this.dbprecision;s+=")"}if(this.primarykey)s+=" PRIMARY KEY";if(this.notnull)s+=" NOT NULL";return s};yy.CreateTable=function(params){return yy.extend(this,params)};yy.CreateTable.prototype.toString=function(){var s=K("CREATE");if(this.temporary)s+=" "+K("TEMPORARY");if(this.view)s+=" "+K("VIEW");else s+=" "+(this.class?K("CLASS"):K("TABLE"));if(this.ifnotexists)s+=" "+K("IF")+" "+K("NOT")+" "+K("EXISTS");s+=" "+this.table.toString();if(this.viewcolumns){s+="("+this.viewcolumns.map(function(vcol){return vcol.toString()}).join(",")+")"}if(this.as)s+=" "+K("AS")+" "+L(this.as);else{var ss=this.columns.map(function(col){return col.toString()});s+=" ("+NL()+ID()+ss.join(","+NL()+ID())+")"}if(this.view&&this.select){s+=" AS "+this.select.toString()}return s};yy.CreateTable.prototype.execute=function(databaseid,params,cb){var db=alasql.databases[this.table.databaseid||databaseid];var tableid=this.table.tableid;if(!tableid){throw new Error("Table name is not defined")}var columns=this.columns;var constraints=this.constraints||[];if(this.ifnotexists&&db.tables[tableid])return 0;if(db.tables[tableid]){throw new Error("Can not create table '"+tableid+"', because it already exists in the database '"+db.databaseid+"'")}var table=db.tables[tableid]=new alasql.Table;if(this.class){table.isclass=true}table.identities={};table.checkfn=[];var ss=[];if(this.columns){this.columns.forEach(function(col){var dbtypeid=col.dbtypeid;if(!alasql.fn[dbtypeid])dbtypeid=dbtypeid.toUpperCase();if(["SERIAL","SMALLSERIAL","BIGSERIAL"].indexOf(dbtypeid)>-1)col.identity={value:1,step:1};var newcol={columnid:col.columnid,dbtypeid:dbtypeid,dbsize:col.dbsize,dbprecision:col.dbprecision,notnull:col.notnull,identity:col.identity};if(col.identity){table.identities[col.columnid]={value:+col.identity.value,step:+col.identity.step}}if(col.check){table.checkfn.push(new Function("r","var y;return "+col.check.expression.toJavaScript("r","")))}if(col.default){ss.push("'"+col.columnid+"':"+col.default.toJavaScript("r",""))}if(col.primarykey){var pk=table.pk={};pk.columns=[col.columnid];pk.onrightfns="r['"+col.columnid+"']";pk.onrightfn=new Function("r","var y;return "+pk.onrightfns);pk.hh=hash(pk.onrightfns);table.uniqs[pk.hh]={}}if(col.unique){var uk={};if(typeof table.uk=="undefined")table.uk=[];table.uk.push(uk);uk.columns=[col.columnid];uk.onrightfns="r['"+col.columnid+"']";uk.onrightfn=new Function("r","var y;return "+uk.onrightfns);uk.hh=hash(uk.onrightfns);table.uniqs[uk.hh]={}}if(col.foreignkey){var fk=col.foreignkey.table;var fktable=alasql.databases[fk.databaseid||alasql.useid].tables[fk.tableid];if(typeof fk.columnid=="undefined"){if(fktable.pk.columns&&fktable.pk.columns.length>0){fk.columnid=fktable.pk.columns[0]}else{throw new Error("FOREIGN KEY allowed only to tables with PRIMARY KEYs")}}var fkfn=function(r){var rr={};if(typeof r[col.columnid]=="undefined")return true;rr[fk.columnid]=r[col.columnid];var addr=fktable.pk.onrightfn(rr);if(!fktable.uniqs[fktable.pk.hh][addr]){throw new Error('Foreign key "'+r[col.columnid]+'" is not found in table '+fktable.tableid)}return true};table.checkfn.push(fkfn)}table.columns.push(newcol);table.xcolumns[newcol.columnid]=newcol})}table.defaultfns=ss.join(",");constraints.forEach(function(con){if(con.type=="PRIMARY KEY"){if(table.pk){throw new Error("Primary key already exists")}var pk=table.pk={};pk.columns=con.columns;pk.onrightfns=pk.columns.map(function(columnid){return"r['"+columnid+"']"}).join("+'`'+");pk.onrightfn=new Function("r","var y;return "+pk.onrightfns);pk.hh=hash(pk.onrightfns);table.uniqs[pk.hh]={}}else if(con.type=="CHECK"){table.checkfn.push(new Function("r","var y;return "+con.expression.toJavaScript("r","")))}else if(con.type=="UNIQUE"){var uk={};if(!table.uk)table.uk=[];table.uk.push(uk);uk.columns=con.columns;uk.onrightfns=uk.columns.map(function(columnid){return"r['"+columnid+"']"}).join("+'`'+");uk.onrightfn=new Function("r","var y;return "+uk.onrightfns);uk.hh=hash(uk.onrightfns);table.uniqs[uk.hh]={}}else if(con.type=="FOREIGN KEY"){var col=table.xcolumns[con.columns[0]];var fk=con.fktable;if(con.fkcolumns&&con.fkcolumns.length>0)fk.columnid=con.fkcolumns[0];var fktable=alasql.databases[fk.databaseid||alasql.useid].tables[fk.tableid];if(typeof fk.columnid=="undefined"){fk.columnid=fktable.pk.columns[0]}var fkfn=function(r){var rr={};if(typeof r[col.columnid]=="undefined")return true;rr[fk.columnid]=r[col.columnid];var addr=fktable.pk.onrightfn(rr);if(!fktable.uniqs[fktable.pk.hh][addr]){throw new Error('Foreign key "'+r[col.columnid]+'" is not found in table '+fktable.tableid)}return true};table.checkfn.push(fkfn)}});if(this.view&&this.viewcolumns){var self=this;this.viewcolumns.forEach(function(vcol,idx){self.select.columns[idx].as=vcol.columnid})}if(db.engineid){return alasql.engines[db.engineid].createTable(this.table.databaseid||databaseid,tableid,this.ifnotexists,cb)}table.insert=function(r){var table=this;for(var columnid in table.identities){var ident=table.identities[columnid];r[columnid]=ident.value}if(table.checkfn&&table.checkfn.length>0){table.checkfn.forEach(function(checkfn){if(!checkfn(r)){throw new Error("Violation of CHECK constraint")}})}table.columns.forEach(function(column){if(column.notnull&&typeof r[column.columnid]=="undefined"){throw new Error("Wrong NULL value in NOT NULL column "+column.columnid)}});if(table.pk){var pk=table.pk;var addr=pk.onrightfn(r);if(typeof table.uniqs[pk.hh][addr]!="undefined"){throw new Error("Cannot insert record, because it already exists in primary key index")}}if(table.uk&&table.uk.length){table.uk.forEach(function(uk){var ukaddr=uk.onrightfn(r);if(typeof table.uniqs[uk.hh][ukaddr]!="undefined"){throw new Error("Cannot insert record, because it already exists in unique index")}})}table.data.push(r);for(var columnid in table.identities){var ident=table.identities[columnid];ident.value+=ident.step}if(table.pk){var pk=table.pk;var addr=pk.onrightfn(r);table.uniqs[pk.hh][addr]=r}if(table.uk&&table.uk.length){table.uk.forEach(function(uk){var ukaddr=uk.onrightfn(r);table.uniqs[uk.hh][ukaddr]=r})}};table.delete=function(i,params,alasql){var table=this;var r=this.data[i];if(this.pk){var pk=this.pk;var addr=pk.onrightfn(r);if(typeof this.uniqs[pk.hh][addr]=="undefined"){throw new Error("Something wrong with primary key index on table")}else{this.uniqs[pk.hh][addr]=undefined}}if(table.uk&&table.uk.length){table.uk.forEach(function(uk){var ukaddr=uk.onrightfn(r);if(typeof table.uniqs[uk.hh][ukaddr]=="undefined"){throw new Error("Something wrong with unique index on table")}table.uniqs[uk.hh][ukaddr]=undefined})}};table.deleteall=function(){this.data.length=0;if(this.pk){this.uniqs[this.pk.hh]={}}if(table.uk&&table.uk.length){table.uk.forEach(function(uk){table.uniqs[uk.hh]={}})}};table.update=function(assignfn,i,params){var r=cloneDeep(this.data[i]);if(this.pk){var pk=this.pk;pk.pkaddr=pk.onrightfn(r,params);if(typeof this.uniqs[pk.hh][pk.pkaddr]=="undefined"){throw new Error("Something wrong with index on table")}else{}}if(table.uk&&table.uk.length){table.uk.forEach(function(uk){uk.ukaddr=uk.onrightfn(r);if(typeof table.uniqs[uk.hh][uk.ukaddr]=="undefined"){throw new Error("Something wrong with unique index on table")}})}assignfn(r,params,alasql);if(table.checkfn&&table.checkfn.length>0){table.checkfn.forEach(function(checkfn){if(!checkfn(r)){throw new Error("Violation of CHECK constraint")}})}table.columns.forEach(function(column){if(column.notnull&&typeof r[column.columnid]=="undefined"){throw new Error("Wrong NULL value in NOT NULL column "+column.columnid)}});if(this.pk){pk.newpkaddr=pk.onrightfn(r);if(typeof this.uniqs[pk.hh][pk.newpkaddr]!="undefined"&&pk.newpkaddr!=pk.pkaddr){throw new Error("Record already exists")}else{}}if(table.uk&&table.uk.length){table.uk.forEach(function(uk){uk.newukaddr=uk.onrightfn(r);if(typeof table.uniqs[uk.hh][uk.newukaddr]!="undefined"&&uk.newukaddr!=uk.ukaddr){throw new Error("Record already exists")}})}if(this.pk){this.uniqs[pk.hh][pk.pkaddr]=undefined;this.uniqs[pk.hh][pk.newpkaddr]=r}if(table.uk&&table.uk.length){table.uk.forEach(function(uk){table.uniqs[uk.hh][uk.ukaddr]=undefined;table.uniqs[uk.hh][uk.newukaddr]=r})}this.data[i]=r};if(this.view&&this.select){table.view=true;table.select=this.select.compile(this.table.databaseid||databaseid)}var res;if(!alasql.options.nocount)res=1;if(cb)res=cb(res);return res};alasql.fn.Date=Object;alasql.fn.Date=Date;alasql.fn.Number=Number;alasql.fn.String=String;alasql.fn.Boolean=Boolean;stdfn.EXTEND=alasql.utils.extend;stdfn.CHAR=String.fromCharCode.bind(String);stdfn.ASCII=function(a){return a.charCodeAt(0)};stdfn.COALESCE=function(){for(var i=0;i0){var s=this.sets.map(function(st){return"x['"+st.column.columnid+"']="+st.expression.toJavaScript("x","")}).join(";");var setfn=new Function("x,params,alasql",s)}else if(this.content){}else if(this.select){}else{}var statement=function(params,cb){var res;var db=alasql.databases[dbid];if(typeof sharp!="undefined"){var id=sharp}else{var id=db.counter++}var vertex={$id:id,$node:"VERTEX"};db.objects[vertex.$id]=vertex;res=vertex;if(namefn)namefn(vertex);if(setfn)setfn(vertex,params,alasql);if(cb)res=cb(res);return res};return statement};yy.CreateEdge=function(params){return yy.extend(this,params)};yy.CreateEdge.prototype.toString=function(){var s=K("CREATE")+" "+K("EDGE")+" ";if(this.class)s+=L(this.class)+" ";return s};yy.CreateEdge.prototype.toJavaScript=function(context,tableid,defcols){var s="this.queriesfn["+(this.queriesidx-1)+"](this.params,null,"+context+")";return s};yy.CreateEdge.prototype.compile=function(databaseid){var dbid=databaseid;var fromfn=new Function("params,alasql","var y;return "+this.from.toJavaScript());var tofn=new Function("params,alasql","var y;return "+this.to.toJavaScript());if(typeof this.name!="undefined"){var s="x.name="+this.name.toJavaScript();var namefn=new Function("x",s)}if(this.sets&&this.sets.length>0){var s=this.sets.map(function(st){return"x['"+st.column.columnid+"']="+st.expression.toJavaScript("x","")}).join(";");var setfn=new Function("x,params,alasql","var y;"+s)}else if(this.content){}else if(this.select){}else{}var statement=function(params,cb){var res=0;var db=alasql.databases[dbid];var edge={$id:db.counter++,$node:"EDGE"};var v1=fromfn(params,alasql);var v2=tofn(params,alasql);edge.$in=[v1.$id];edge.$out=[v2.$id];if(typeof v1.$out=="undefined")v1.$out=[];v1.$out.push(edge.$id);if(typeof v2.$in=="undefined")v2.$in=[];v2.$in.push(edge.$id);db.objects[edge.$id]=edge;res=edge;if(namefn)namefn(edge);if(setfn)setfn(edge,params,alasql);if(cb)res=cb(res);return res};return statement};yy.CreateGraph=function(params){return yy.extend(this,params)};yy.CreateGraph.prototype.toString=function(){var s=K("CREATE")+" "+K("GRAPH")+" ";if(this.class)s+=L(this.class)+" ";return s};yy.CreateGraph.prototype.execute=function(databaseid,params,cb){var res=[];if(this.from){if(alasql.from[this.from.funcid]){this.graph=alasql.from[this.from.funcid.toUpperCase()](this.from.args[0].value);console.log(this.graph)}}this.graph.forEach(function(g){if(g.source){var e={};if(typeof g.as!="undefined")alasql.vars[g.as]=e;if(typeof g.prop!="undefined"){e.name=g.prop}if(typeof g.sharp!="undefined")e.$id=g.sharp;if(typeof g.name!="undefined")e.name=g.name;if(typeof g.class!="undefined")e.$class=g.class;var db=alasql.databases[databaseid];if(typeof e.$id=="undefined"){e.$id=db.counter++}e.$node="EDGE";if(typeof g.json!="undefined"){extend(e,new Function("params,alasql","var y;return "+g.json.toJavaScript())(params,alasql))}var v1;if(g.source.vars){var vo=alasql.vars[g.source.vars];if(typeof vo=="object")v1=vo;else v1=db.objects[vo]}else{var av1=g.source.sharp;if(typeof av1=="undefined")av1=g.source.prop;v1=alasql.databases[databaseid].objects[av1];if(typeof v1=="undefined"&&alasql.options.autovertex&&(typeof g.source.prop!="undefined"||typeof g.source.name!="undefined")){v1=findVertex(g.source.prop||g.source.name);if(typeof v1=="undefined"){v1=createVertex(g.source)}}}var v2;if(g.source.vars){var vo=alasql.vars[g.target.vars];if(typeof vo=="object")v2=vo;else v2=db.objects[vo]}else{var av2=g.target.sharp;if(typeof av2=="undefined")av2=g.target.prop;v2=alasql.databases[databaseid].objects[av2];if(typeof v2=="undefined"&&alasql.options.autovertex&&(typeof g.target.prop!="undefined"||typeof g.target.name!="undefined")){v2=findVertex(g.target.prop||g.target.name);if(typeof v2=="undefined"){v2=createVertex(g.target)}}}e.$in=[v1.$id];e.$out=[v2.$id];if(typeof v1.$out=="undefined")v1.$out=[];v1.$out.push(e.$id);if(typeof v2.$in=="undefined")v2.$in=[];v2.$in.push(e.$id);db.objects[e.$id]=e;if(typeof e.$class!="undefined"){if(typeof alasql.databases[databaseid].tables[e.$class]=="undefined"){throw new Error("No such class. Pleace use CREATE CLASS")}else{alasql.databases[databaseid].tables[e.$class].data.push(e)}}res.push(e.$id)}else{createVertex(g)}});if(cb)res=cb(res);return res;function findVertex(name){var objects=alasql.databases[alasql.useid].objects;for(var k in objects){if(objects[k].name==name){return objects[k]}}return undefined}function createVertex(g){var v={};if(typeof g.as!="undefined")alasql.vars[g.as]=v;if(typeof g.prop!="undefined"){v.$id=g.prop;v.name=g.prop}if(typeof g.sharp!="undefined")v.$id=g.sharp;if(typeof g.name!="undefined")v.name=g.name;if(typeof g.class!="undefined")v.$class=g.class;var db=alasql.databases[databaseid];if(typeof v.$id=="undefined"){v.$id=db.counter++}v.$node="VERTEX";if(typeof g.json!="undefined"){extend(v,new Function("params,alasql","var y;return "+g.json.toJavaScript())(params,alasql))}db.objects[v.$id]=v;if(typeof v.$class!="undefined"){if(typeof alasql.databases[databaseid].tables[v.$class]=="undefined"){throw new Error("No such class. Pleace use CREATE CLASS")}else{alasql.databases[databaseid].tables[v.$class].data.push(v)}}res.push(v.$id);return v}};yy.CreateGraph.prototype.compile1=function(databaseid){var dbid=databaseid;var fromfn=new Function("params,alasql","var y;return "+this.from.toJavaScript());var tofn=new Function("params,alasql","var y;return "+this.to.toJavaScript());if(typeof this.name!="undefined"){var s="x.name="+this.name.toJavaScript();var namefn=new Function("x",s)}if(this.sets&&this.sets.length>0){var s=this.sets.map(function(st){return"x['"+st.column.columnid+"']="+st.expression.toJavaScript("x","")}).join(";");var setfn=new Function("x,params,alasql","var y;"+s)}else if(this.content){}else if(this.select){}else{}var statement=function(params,cb){var res=0;var db=alasql.databases[dbid];var edge={$id:db.counter++,$node:"EDGE"};var v1=fromfn(params,alasql);var v2=tofn(params,alasql);edge.$in=[v1.$id];edge.$out=[v2.$id];if(typeof v1.$out=="undefined")v1.$out=[];v1.$out.push(edge.$id);if(typeof v2.$in=="undefined")v2.$in=[];v2.$in.push(edge.$id);db.objects[edge.$id]=edge;res=edge;if(namefn)namefn(edge);if(setfn)setfn(edge,params,alasql);if(cb)res=cb(res);return res};return statement};yy.AlterTable=function(params){return yy.extend(this,params)};yy.AlterTable.prototype.toString=function(){var s="ALTER TABLE "+this.table.toString();if(this.renameto)s+=" RENAME TO "+this.renameto;return s};yy.AlterTable.prototype.execute=function(databaseid,params,cb){var db=alasql.databases[databaseid];db.dbversion=Date.now();if(this.renameto){var oldtableid=this.table.tableid;var newtableid=this.renameto;var res=1;if(db.tables[newtableid]){throw new Error("Can not rename a table '"+oldtableid+"' to '"+newtableid+"', because the table with this name already exists")}else if(newtableid==oldtableid){throw new Error("Can not rename a table '"+oldtableid+"' to itself")}else{db.tables[newtableid]=db.tables[oldtableid];delete db.tables[oldtableid];res=1}if(cb)cb(res);return res}else if(this.addcolumn){var db=alasql.databases[this.table.databaseid||databaseid];db.dbversion++;var tableid=this.table.tableid;var table=db.tables[tableid];var columnid=this.addcolumn.columnid;if(table.xcolumns[columnid]){throw new Error('Cannot add column "'+columnid+'", because it already exists in the table "'+tableid+'"')}var col={columnid:columnid,dbtypeid:this.dbtypeid,dbsize:this.dbsize,dbprecision:this.dbprecision,dbenum:this.dbenum,defaultfns:null};var defaultfn=function(){};table.columns.push(col);table.xcolumns[columnid]=col;for(var i=0,ilen=table.data.length;i0){for(var i=0,ilen=table.data.length;i0){for(var i=0,ilen=table.data.length;i=0){q+="(x="+values[idx].toJavaScript()+",x==undefined?undefined:+x)"}else if(alasql.fn[table.xcolumns[col.columnid].dbtypeid]){q+="(new "+table.xcolumns[col.columnid].dbtypeid+"(";q+=values[idx].toJavaScript();q+="))"}else{q+=values[idx].toJavaScript()}}else{q+=values[idx].toJavaScript()}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].toJavaScript()}else if(alasql.fn[col.dbtypeid]){q+="(new "+col.dbtypeid+"(";q+=values[idx].toJavaScript();q+="))"}else{q+=values[idx].toJavaScript()}ss.push(q)})}else{sw=JSONtoJavaScript(values)}}if(db.tables[tableid].defaultfns){ss.unshift(db.tables[tableid].defaultfns)}if(sw){s+="a="+sw+";"}else{s+="a={"+ss.join(",")+"};"}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);"}else{s+="aa.push(a);"}});s33=s3+s;if(db.tables[tableid].insert){}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)}else if(this.select){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,null,cb);return res};return statement}else{var insertfn=function(db,params,alasql){var res=selectfn(params);if(db.tables[tableid].insert){for(var i=0,ilen=res.length;i0){s+="("+this.args.map(function(arg){return arg.toString()}).join(", ")+")"}if(this.as)s+=" "+K("AS")+" "+L(this.as);return s};yy.CreateDatabase.prototype.execute=function(databaseid,params,cb){var args;if(this.args&&this.args.length>0){args=this.args.map(function(arg){return new Function("params,alasql","var y;return "+arg.toJavaScript())(params,alasql)})}if(this.engineid){var res=alasql.engines[this.engineid].createDatabase(this.databaseid,this.args,this.ifnotexists,this.as,cb);return res}else{var dbid=this.databaseid;if(alasql.databases[dbid]){throw new Error("Database '"+dbid+"' already exists")}var a=new alasql.Database(dbid);var res=1;if(cb)return cb(res);return res}};yy.AttachDatabase=function(params){return yy.extend(this,params)};yy.AttachDatabase.prototype.toString=function(){var s=K("ATTACH");if(this.engineid)s+=" "+L(this.engineid);s+=" "+K("DATABASE")+" "+L(this.databaseid);if(args){s+="(";if(args.length>0){s+=args.map(function(arg){return arg.toString()}).join(", ")}s+=")"}if(this.as)s+=" "+K("AS")+" "+L(this.as);return s};yy.AttachDatabase.prototype.execute=function(databaseid,params,cb){if(!alasql.engines[this.engineid]){throw new Error('Engine "'+this.engineid+'" is not defined.')}var res=alasql.engines[this.engineid].attachDatabase(this.databaseid,this.as,this.args,params,cb);return res};yy.DetachDatabase=function(params){return yy.extend(this,params)};yy.DetachDatabase.prototype.toString=function(){var s=K("DETACH");s+=" "+K("DATABASE")+" "+L(this.databaseid);return s};yy.DetachDatabase.prototype.execute=function(databaseid,params,cb){if(!alasql.databases[this.databaseid].engineid){throw new Error('Cannot detach database "'+this.engineid+'", because it was not attached.')}var res;var dbid=this.databaseid;if(dbid==alasql.DEFAULTDATABASEID){throw new Error("Drop of default database is prohibited")}if(!alasql.databases[dbid]){if(!this.ifexists){throw new Error("Database '"+dbid+"' does not exist")}else{res=0}}else{delete alasql.databases[dbid];if(dbid==alasql.useid){alasql.use()}res=1}if(cb)cb(res);return res};yy.UseDatabase=function(params){return yy.extend(this,params)};yy.UseDatabase.prototype.toString=function(){return K("USE")+" "+K("DATABASE")+" "+L(this.databaseid)};yy.UseDatabase.prototype.execute=function(databaseid,params,cb){var dbid=this.databaseid;if(!alasql.databases[dbid]){throw new Error("Database '"+dbid+"' does not exist")}alasql.use(dbid);var res=1;if(cb)cb(res);return res};yy.DropDatabase=function(params){return yy.extend(this,params)};yy.DropDatabase.prototype.toString=function(){var s=K("DROP");if(this.ifexists)s+=" "+K("IF")+" "+K("EXISTS");s+=" "+K("DATABASE")+" "+L(this.databaseid);return s};yy.DropDatabase.prototype.execute=function(databaseid,params,cb){if(this.engineid){return alasql.engines[this.engineid].dropDatabase(this.databaseid,this.ifexists,cb)}var res;var dbid=this.databaseid;if(dbid==alasql.DEFAULTDATABASEID){throw new Error("Drop of default database is prohibited")}if(!alasql.databases[dbid]){if(!this.ifexists){throw new Error("Database '"+dbid+"' does not exist")}else{res=0}}else{if(alasql.databases[dbid].engineid){throw new Error("Cannot drop database '"+dbid+"', because it is attached. Detach it.")}delete alasql.databases[dbid];if(dbid==alasql.useid){alasql.use()}res=1}if(cb)cb(res);return res};yy.Declare=function(params){return yy.extend(this,params)};yy.Declare.prototype.toString=function(){var s=K("DECLARE")+" ";if(this.declares&&this.declares.length>0){s=this.declares.map(function(declare){var s="";s+="@"+L(declare.variable)+" ";s+=declare.dbtypeid;if(this.dbsize)s+="("+N(this.dbsize);if(this.dbprecision)s+=","+N(this.dbprecision);s+=")";if(declare.expression)s+=" = "+declare.expression.toString();return s}).join(",")}return s};yy.Declare.prototype.execute=function(databaseid,params,cb){var res=1;if(this.declares&&this.declares.length>0){this.declares.map(function(declare){var dbtypeid=declare.dbtypeid;if(!alasql.fn[dbtypeid])dbtypeid=dbtypeid.toUpperCase();alasql.declares[declare.variable]={dbtypeid:dbtypeid,dbsize:declare.dbsize,dbprecision:declare.dbprecision};if(declare.expression){alasql.vars[declare.variable]=new Function("params,alasql","return "+declare.expression.toJavaScript("({})","",null))(params,alasql);if(alasql.declares[declare.variable]){alasql.vars[declare.variable]=alasql.stdfn.CONVERT(alasql.vars[declare.variable],alasql.declares[declare.variable])}}})}if(cb)res=cb(res);return res};yy.ShowDatabases=function(params){return yy.extend(this,params)};yy.ShowDatabases.prototype.toString=function(){var s=K("SHOW")+" "+K("DATABASES");if(this.like)s+="LIKE "+this.like.toString();return s};yy.ShowDatabases.prototype.execute=function(databaseid,params,cb){if(this.engineid){return alasql.engines[this.engineid].showDatabases(this.like,cb)}else{var self=this;var res=[];for(dbid in alasql.databases){res.push({databaseid:dbid})}if(self.like&&res&&res.length>0){res=res.filter(function(d){return d.databaseid.match(new RegExp(self.like.value.replace(/\%/g,".*"),"g"))})}if(cb)cb(res);return res}};yy.ShowTables=function(params){return yy.extend(this,params)};yy.ShowTables.prototype.toString=function(){var s=K("SHOW")+" "+K("TABLES");if(this.databaseid)s+=" FROM "+this.databaseid;if(this.like)s+=" "+K("LIKE")+" "+this.like.toString();return s};yy.ShowTables.prototype.execute=function(databaseid,params,cb){var db=alasql.databases[this.databaseid||databaseid];var self=this;var res=[];for(tableid in db.tables){res.push({tableid:tableid})}if(self.like&&res&&res.length>0){res=res.filter(function(d){return d.tableid.match(new RegExp(self.like.value.replace(/\%/g,".*"),"g"))})}if(cb)cb(res);return res};yy.ShowColumns=function(params){return yy.extend(this,params)};yy.ShowColumns.prototype.toString=function(){var s=K("SHOW")+" "+K("COLUMNS");if(this.table.tableid)s+=" "+K("FROM")+" "+this.table.tableid;if(this.databaseid)s+=" "+K("FROM")+" "+this.databaseid;return s};yy.ShowColumns.prototype.execute=function(databaseid){var db=alasql.databases[this.databaseid||databaseid];var table=db.tables[this.table.tableid];var self=this;if(table&&table.columns){var res=table.columns.map(function(col){return{columnid:col.columnid,dbtypeid:col.dbtypeid,dbsize:col.dbsize}});return res}else{return[]}};yy.ShowIndex=function(params){return yy.extend(this,params)};yy.ShowIndex.prototype.toString=function(){var s=K("SHOW")+" "+K("INDEX");if(this.table.tableid)s+=" "+K("FROM")+" "+this.table.tableid;if(this.databaseid)s+=" "+K("FROM")+" "+this.databaseid;return s};yy.ShowIndex.prototype.execute=function(databaseid){var db=alasql.databases[this.databaseid||databaseid];var table=db.tables[this.table.tableid];var self=this;var res=[];if(table&&table.indices){for(var ind in table.indices){res.push({hh:ind,len:Object.keys(table.indices[ind]).length})}}return res};yy.ShowCreateTable=function(params){return yy.extend(this,params)};yy.ShowCreateTable.prototype.toString=function(){var s=K("SHOW")+" "+K("CREATE")+" "+K("TABLE")+" "+L(this.table.tableid);if(this.databaseid)s+=" "+K("FROM")+" "+L(this.databaseid);return s};yy.ShowCreateTable.prototype.execute=function(databaseid){var db=alasql.databases[this.databaseid||databaseid];var table=db.tables[this.table.tableid];var self=this;if(table){var s=K("CREATE")+" "+K("TABLE")+" "+L(this.table.tableid)+" (";var ss=[];if(table.columns){table.columns.forEach(function(col){var a=L(col.columnid)+" "+K(col.dbtypeid);if(col.dbsize)a+="("+N(col.dbsize)+")";if(col.primarykey)a+=" "+K("PRIMARY")+" "+K("KEY");ss.push(a)});s+=ss.join(", ")}s+=")";return s}else{throw new Error('There is no such table "'+this.table.tableid+'"')}};yy.SetVariable=function(params){return yy.extend(this,params)};yy.SetVariable.prototype.toString=function(){var s=K("SET")+" ";if(typeof this.value!="undefined")s+=K(this.variable.toUpperCase())+" "+(this.value?"ON":"OFF");if(this.expression)s+=this.method+L(this.variable)+" = "+this.expression.toString();return s};yy.SetVariable.prototype.execute=function(databaseid,params,cb){if(typeof this.value!="undefined"){var val=this.value;if(val=="ON")val=true;else if(val=="OFF")val=false;alasql.options[this.variable]=val}else if(this.expression){if(this.exists){this.existsfn=this.exists.map(function(ex){var nq=ex.compile(databaseid);if(nq.query&&!nq.query.modifier)nq.query.modifier="RECORDSET";return nq})}if(this.queries){this.queriesfn=this.queries.map(function(q){var nq=q.compile(databaseid);if(nq.query&&!nq.query.modifier)nq.query.modifier="RECORDSET";return nq})}var res=new Function("params,alasql","return "+this.expression.toJavaScript("({})","",null)).bind(this)(params,alasql);if(alasql.declares[this.variable]){res=alasql.stdfn.CONVERT(res,alasql.declares[this.variable])}if(this.props&&this.props.length>0){if(this.method=="@"){var fs="alasql.vars['"+this.variable+"']"}else{var fs="params['"+this.variable+"']"}fs+=this.props.map(function(prop){if(typeof prop=="string"){return"['"+prop+"']"}else if(typeof prop=="number"){return"["+prop+"]"}else{return"["+prop.toJavaScript()+"]"}}).join();new Function("value,params,alasql","var y;"+fs+"=value")(res,params,alasql)}else{if(this.method=="@"){alasql.vars[this.variable]=res}else{params[this.variable]=res}}}var res=1;if(cb)res=cb(res);return res};alasql.test=function(name,times,fn){if(arguments.length==0){alasql.log(alasql.con.results);return}else if(arguments.length==1){var tm=Date.now();fn();alasql.con.log(Date.now()-tm);return}if(arguments.length==2){fn=times;times=1}var tm=Date.now();for(var i=0;i",sql);if(res instanceof Array){if(console.table){console.table(res)}else{console.log(JSONtoString(res))}}else{console.log(JSONtoString(res))}}else{var el;if(target=="output"){el=document.getElementsByTagName("output")[0]}else{if(typeof target=="string"){el=document.getElementById(target)}else{el=target}}var s="";if(typeof sql=="string"&&alasql.options.logprompt){s+=""+alasql.pretty(sql)+"
"}if(res instanceof Array){if(res.length==0){s+="[ ]
"}else if(typeof res[0]!="object"||res[0]instanceof Array){for(var i=0,ilen=res.length;i"+loghtml(res[i])+"
"}}else{s+=loghtml(res)}}else{s+=loghtml(res)}el.innerHTML+=s}};alasql.clear=function(){var target=alasql.options.logtarget;if(typeof exports=="object"){target="console"}if(target=="console"||typeof exports=="object"){if(console.clear){console.clear()}else{}}else{var el;if(target=="output"){el=document.getElementsByTagName("output")[0]}else{if(typeof target=="string"){el=document.getElementById(target)}else{el=target}}el.innerHTML=""}};alasql.write=function(s){var target=alasql.options.logtarget;if(typeof exports=="object"){target="console"}if(target=="console"||typeof exports=="object"){if(console.log){console.log(s)}else{}}else{var el;if(target=="output"){el=document.getElementsByTagName("output")[0]}else{if(typeof target=="string"){el=document.getElementById(target)}else{el=target}}el.innerHTML+=s}};function loghtml(res){var s="";if(typeof res=="undefined"){s+="undefined"}else if(res instanceof Array){s+="";s+="";var cols=[];for(colid in res[0]){cols.push(colid)}s+="#";cols.forEach(function(colid){s+=" "+colid});for(var i=0,ilen=res.length;i"+(i+1);cols.forEach(function(colid){s+=" ";if(+res[i][colid]==+res[i][colid]){s+='';if(typeof res[i][colid]=="undefined")s+="NULL";else s+=res[i][colid];s+="
"}else{if(typeof res[i][colid]=="undefined"){s+="NULL"}else if(typeof res[i][colid]=="string"){s+=res[i][colid]}else s+=JSONtoString(res[i][colid])}})}s+="
"}else{s+=""+JSONtoString(res)+"
"}return s}function scrollTo(element,to,duration){if(duration<=0)return;var difference=to-element.scrollTop;var perTick=difference/duration*10;setTimeout(function(){if(element.scrollTop==to)return;element.scrollTop=element.scrollTop+perTick;scrollTo(element,to,duration-10)},10)}alasql.prompt=function(el,useidel,firstsql){if(typeof exports=="object"){throw new Error("The functionality of prompt is not realized for Node.js")}var prompti=0;if(typeof el=="string")el=document.getElementById(el);if(typeof useidel=="string")useidel=document.getElementById(useidel);useidel.textContent=alasql.useid;if(firstsql){alasql.prompthistory.push(firstsql);prompti=alasql.prompthistory.length;try{var tm=Date.now();alasql.log(firstsql);alasql.write(''+(Date.now()-tm)+" ms
")}catch(err){alasql.write(""+olduseid+"> "+sql+"
");alasql.write(''+err+"
")}}var y=el.getBoundingClientRect().top+document.getElementsByTagName("body")[0].scrollTop;scrollTo(document.getElementsByTagName("body")[0],y,500);el.onkeydown=function(event){if(event.which==13){var sql=el.value;var olduseid=alasql.useid;el.value="";alasql.prompthistory.push(sql);prompti=alasql.prompthistory.length;try{var tm=Date.now();alasql.log(sql);alasql.write('
'+(Date.now()-tm)+" ms
")}catch(err){alasql.write(""+olduseid+"> "+alasql.pretty(sql,false)+"
");alasql.write(''+err+"
")}el.focus();useidel.textContent=alasql.useid;var y=el.getBoundingClientRect().top+document.getElementsByTagName("body")[0].scrollTop;scrollTo(document.getElementsByTagName("body")[0],y,500)}else if(event.which==38){prompti--;if(prompti<0)prompti=0;if(alasql.prompthistory[prompti]){el.value=alasql.prompthistory[prompti];event.preventDefault()}}else if(event.which==40){prompti++;if(prompti>=alasql.prompthistory.length){prompti=alasql.prompthistory.length;el.value=""}else if(alasql.prompthistory[prompti]){el.value=alasql.prompthistory[prompti];event.preventDefault()}}}};yy.BeginTransaction=function(params){return yy.extend(this,params)};yy.BeginTransaction.prototype.toString=function(){return K("BEGIN")+" "+K("TRANSACTION")};yy.BeginTransaction.prototype.execute=function(databaseid,params,cb){var res=1;if(alasql.databases[databaseid].engineid){return alasql.engines[alasql.databases[alasql.useid].engineid].begin(databaseid,cb)}else{}if(cb)cb(res);return res};yy.CommitTransaction=function(params){return yy.extend(this,params)};yy.CommitTransaction.prototype.toString=function(){return K("COMMIT")+" "+K("TRANSACTION")};yy.CommitTransaction.prototype.execute=function(databaseid,params,cb){var res=1;if(alasql.databases[databaseid].engineid){return alasql.engines[alasql.databases[alasql.useid].engineid].commit(databaseid,cb)}else{}if(cb)cb(res);return res};yy.RollbackTransaction=function(params){return yy.extend(this,params)};yy.RollbackTransaction.prototype.toString=function(){return K("ROLLBACK")+" "+K("TRANSACTION")};yy.RollbackTransaction.prototype.execute=function(databaseid,params,cb){var res=1;if(alasql.databases[databaseid].engineid){return alasql.engines[alasql.databases[databaseid].engineid].rollback(databaseid,cb)}else{}if(cb)cb(res);return res};if(alasql.options.tsql){alasql.stdfn.OBJECT_ID=function(name,type){if(typeof type=="undefined")type="T";type=type.toUpperCase();var sname=name.split(".");var dbid=alasql.useid;var objname=sname[0];if(sname.length==2){dbid=sname[0];objname=sname[1]}var tables=alasql.databases[dbid].tables;dbid=alasql.databases[dbid].databaseid;for(var tableid in tables){if(tableid==objname){if(tables[tableid].view&&type=="V")return dbid+"."+tableid;if(!tables[tableid].view&&type=="T")return dbid+"."+tableid;return undefined}}return undefined}}if(alasql.options.mysql){}if(alasql.options.mysql||alasql.options.sqlite){alasql.from.INFORMATION_SCHEMA=function(filename,opts,cb,idx,query){if(filename=="VIEWS"||filename=="TABLES"){var res=[];for(var databaseid in alasql.databases){var tables=alasql.databases[databaseid].tables;for(var tableid in tables){if(tables[tableid].view&&filename=="VIEWS"||!tables[tableid].view&&filename=="TABLES"){res.push({TABLE_CATALOG:databaseid,TABLE_NAME:tableid})}}}if(cb)res=cb(res,idx,query);return res}throw new Error("Unknown INFORMATION_SCHEMA table")}}if(alasql.options.postgres){}if(alasql.options.oracle){}if(alasql.options.sqlite){}alasql.into.SQL=function(filename,opts,data,columns,cb){var res;if(typeof filename=="object"){opts=filename;filename=undefined}var opt={};alasql.utils.extend(opt,opts);if(typeof opt.tableid=="undefined"){throw new Error("Table for INSERT TO is not defined.")}var s="";if(columns.length==0){if(typeof data[0]=="object"){columns=Object.keys(data[0]).map(function(columnid){return{columnid:columnid}})}else{}}for(var i=0,ilen=data.length;i0){columns=Object.keys(data[0]).map(function(columnid){return{columnid:columnid}})}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};alasql.into.TAB=alasql.into.TSV=function(filename,opts,data,columns,cb){var opt={};alasql.utils.extend(opt,opts);opt.separator=" ";return alasql.into.CSV(filename,opt,data,columns,cb)};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.quote='"';alasql.utils.extend(opt,opts);var res=data.length;var s="";if(opt.headers){s+=columns.map(function(col){return col.columnid}).join(opt.separator)+"\n"}data.forEach(function(d,idx){s+=columns.map(function(col){var s=d[col.columnid];s=(s+"").replace(new RegExp("\\"+opt.quote,"g"),'""');if((s+"").indexOf(opt.separator)>-1||(s+"").indexOf(opt.quote)>-1)s=opt.quote+s+opt.quote;return s}).join(opt.separator)+"\n"});res=alasql.utils.saveFile(filename,s);if(cb)res=cb(res);return res};alasql.into.XLS=function(filename,opts,data,columns,cb){if(typeof filename=="object"){opts=filename;filename=undefined}var sheets={};if(opts&&opts.sheets){sheets=opts.sheets}var sheet={};if(typeof sheets["Sheet1"]!="undefined"){sheet=sheets[0]}else{if(typeof opts!="undefined"){sheet=opts}}if(typeof sheet.sheetid=="undefined"){sheet.sheetid="Sheet1"}var s=toHTML();var res=alasql.utils.saveFile(filename,s);if(cb)res=cb(res);return res;function toHTML(){var s=' ";s+="";s+="";if(typeof sheet.caption!="undefined"){var caption=sheet.caption;if(typeof caption=="string"){caption={title:caption}}s+="";s+=caption.title;s+=" "}if(typeof sheet.columns!="undefined"){columns=sheet.columns}else{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}})}}}}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;if(sheet.headers&&sheet.headers instanceof Array)column.title=sheet.headers[idx]});s+="";columns.forEach(function(column){s+=' '});s+=" ";if(sheet.headers){s+="";s+="";columns.forEach(function(column,columnidx){s+="";if(typeof column.title!="undefined"){if(typeof column.title=="function"){s+=column.title(sheet,column,columnidx)}else{s+=column.title}}s+=" "});s+=" ";s+=" "}s+="";if(data&&data.length>0){data.forEach(function(row,rowidx){if(rowidx>sheet.limit)return;s+="";columns.forEach(function(column,columnidx){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])}var value=row[column.columnid];if(typeof cell.value=="function"){value=cell.value(value,sheet,row,column,cell,rowidx,columnidx)}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 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{if(opts.types&&opts.types[typeid]&&opts.types[typeid].typestyle){typestyle=opts.types[typeid].typestyle}}typestyle=typestyle||'mso-number-format:"\\@";';s+="";var format=cell.format;if(typeof value=="undefined"){s+=""}else if(typeof format!="undefined"){if(typeof format=="function"){s+=format(value)}else if(typeof format=="string"){s+=value}else{throw new Error("Unknown format type. Should be function or string")}}else{if(typeid=="number"||typeid=="date"){s+=value.toString()}else if(typeid=="money"){s+=(+value).toFixed(2)}else{s+=value}}s+=" "});s+=" "})}s+=" ";s+="
";s+="";s+="";return s}function style(a){var s=' style="';if(a&&typeof a.style!="undefined"){s+=a.style+";"}s+='" ';return s}};alasql.into.XLSXML=function(filename,opts,data,columns,cb){if(typeof filename=="object"){opts=filename;filename=undefined}var sheets={};if(opts&&opts.sheets){sheets=opts.sheets}else{sheets.Sheet1=opts}var res=alasql.utils.saveFile(filename,toXML());if(cb)res=cb(res);return res;function toXML(){var s1=' 0 ';var s2="";var s3=" ";var styles={};var stylesn=62;function hstyle(st){var s="";for(var key in st){s+="<"+key;for(var attr in st[key]){s+=" ";if(attr.substr(0,2)=="x:"){s+=attr}else{s+="ss:"}s+=attr+'="'+st[key][attr]+'"'}s+="/>"}var hh=hash(s);if(styles[hh]){}else{styles[hh]={styleid:stylesn};s2+='";stylesn++}return"s"+styles[hh].styleid}for(var sheetid in sheets){var sheet=sheets[sheetid];if(typeof sheet.columns!="undefined"){columns=sheet.columns}else{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}})}}}}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;if(sheet.headers&&sheet.headers instanceof Array)column.title=sheet.headers[idx]});s3+=' ';columns.forEach(function(column,columnidx){s3+=' '});if(sheet.headers){s3+='';columns.forEach(function(column,columnidx){s3+="';if(typeof column.title!="undefined"){if(typeof column.title=="function"){s3+=column.title(sheet,column,columnidx)}else{s3+=column.title}}s3+=" | "});s3+="
"}if(data&&data.length>0){data.forEach(function(row,rowidx){if(rowidx>sheet.limit)return;var srow={};extend(srow,sheet.row);if(sheet.rows&&sheet.rows[rowidx]){extend(srow,sheet.rows[rowidx])}s3+="";columns.forEach(function(column,columnidx){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])}var value=row[column.columnid];if(typeof cell.value=="function"){value=cell.value(value,sheet,row,column,cell,rowidx,columnidx)}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";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{if(opts.types&&opts.types[typeid]&&opts.types[typeid].typestyle){typestyle=opts.types[typeid].typestyle}}typestyle=typestyle||'mso-number-format:"\\@";';s3+="";s3+='';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}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+="
"})}s3+="
"}s3+=" ";return s1+s2+s3}};alasql.into.XLSX=function(filename,opts,data,columns,cb){var res=1;if(deepEqual(columns,[{columnid:"_"}])){data=data.map(function(dat){return dat._});columns=undefined}else{}if(typeof exports=="object"){var XLSX=require("xlsx")}else{var XLSX=window.XLSX}if(typeof filename=="object"){opts=filename;filename=undefined}var wb={SheetNames:[],Sheets:{}};if(opts.sourcefilename){alasql.utils.loadBinaryFile(opts.sourcefilename,!!cb,function(data){wb=XLSX.read(data,{type:"binary"});doExport()})}else{doExport()}if(cb)res=cb(res);return res;function doExport(){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)}function prepareSheet(opts,data,columns,idx){var opt={sheetid:"Sheet"+idx,headers:true};alasql.utils.extend(opt,opts);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}});i++}for(var j=0;j>>8^CRC_TABLE[offset]}return crc^-1}function pack(items){var data=arguments,idx=0,buffer,bufferSize=0;items=items.split("");items.forEach(function(type){if(type=="v"){bufferSize+=2}else if(type=="V"||type=="l"){bufferSize+=4}});buffer=new Buffer(bufferSize);items.forEach(function(type,index){if(type=="v"){buffer.writeUInt16LE(data[index+1],idx);idx+=2}else if(type=="V"){buffer.writeUInt32LE(data[index+1],idx);idx+=4}else if(type=="l"){buffer.writeInt32LE(data[index+1],idx);idx+=4}});return buffer}function normalizeZipPath(zipPath){return zipPath.replace(/\\/g,"/").replace(/^\/|\/$/g,"")}this.addEntry=function(entry){entry.path=normalizeZipPath(entry.path);entries.push(entry)};this.addDir=function(zipPath,localPath){this.addEntry({path:zipPath,file:localPath,isFile:false})};this.addData=function(zipPath,data){if(!Buffer.isBuffer(data)){data=new Buffer(data)}this.addEntry({path:zipPath,data:data})};function buildZipBuffer(){var buffers=[];var length=0;function append(buf){if(typeof buf=="string"){buf=new Buffer(buf)}buffers.push(buf);length+=buf.length}entries.forEach(function(entry){var mtime,mdate;entry.extra=entry.extra||"";entry.comment=entry.comment||"";entry.cmethod=0;mtime=entry.mtime;mdate=entry.mdate;if(entry.mtime instanceof Date){mtime=entry.mtime.getHours();mtime=mtime<<6;mtime=mtime|entry.mtime.getMinutes();mtime=mtime<<5;mtime=mtime|entry.mtime.getSeconds()/2;mdate=entry.mtime.getFullYear()-1980;mdate=mdate<<4;mdate=mdate|entry.mtime.getMonth()+1;mdate=mdate<<5;mdate=mdate|entry.mtime.getDate()}var fileName=entry.path;if(!entry.isFile&&fileName.charAt(fileName.length-1)!="/"){entry.path=fileName=fileName+"/"}entry.offset=length;append(pack("VvvvvvlVVvv",67324752,20,2,entry.cmethod,mtime,mdate,entry.crc32,entry.csize,entry.size,fileName.length,entry.extra.length));append(fileName);append(entry.extra);append(entry.data);entry.mtime=mtime;entry.mdate=mdate;entry.eattr=entry.isFile?32:48});var startOffset=length;var centralDirSize=0;entries.forEach(function(entry){append(pack("VvvvvvvlVVvvvvvVV",33639248,20,20,2,entry.cmethod,entry.mtime,entry.mdate,entry.crc32,entry.csize,entry.size,entry.path.length,entry.extra.length,entry.comment.length,0,0,entry.eattr,entry.offset));append(entry.path);append(entry.extra);append(entry.comment);centralDirSize+=46+entry.path.length+entry.extra.length+entry.comment.length});var comment="";append(pack("VvvvvVVv",101010256,0,0,entries.length,entries.length,centralDirSize,startOffset,comment.length));append(comment);var buffer=Buffer.concat(buffers);return buffer}this.toBuffer=function(callback){var index=-1;function deflateNext(){var data;var entry=entries[++index];if(entry){entry.csize=entry.size=entry.crc32=0;data=entry.data=entry.data?entry.data:new Buffer(0);entry.mtime=new Date;if(entry.isFile!==false){entry.crc32=calculateCrc32(data);entry.isFile=true;entry.size=data.length;entry.csize=entry.size;deflateNext()}else{deflateNext()}}else{callback(buildZipBuffer())}}deflateNext()}};alasql.from.METEOR=function(filename,opts,cb,idx,query){var res=filename.find(opts).fetch();if(cb)res=cb(res,idx,query);return res};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};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=N)return EOF;if(eol)return eol=false,EOL;var j=I;if(text.charCodeAt(j)===quoteCode){var i=j;while(i++/g,"");return document();function document(){return{declaration:declaration(),root:tag()}}function declaration(){var m=match(/^<\?xml\s*/);if(!m)return;var node={attributes:{}};while(!(eos()||is("?>"))){var attr=attribute();if(!attr)return node;node.attributes[attr.name]=attr.value}match(/\?>\s*/);return node}function tag(){var m=match(/^<([\w-:.]+)\s*/);if(!m)return;var node={name:m[1],attributes:{},children:[]};while(!(eos()||is(">")||is("?>")||is("/>"))){var attr=attribute();if(!attr)return node;node.attributes[attr.name]=attr.value}if(match(/^\s*\/>\s*/)){return node}match(/\??>\s*/);node.content=content();var child;while(child=tag()){node.children.push(child)}match(/^<\/[\w-:.]+>\s*/);return node}function content(){var m=match(/^([^<]*)/);if(m)return m[1];return""}function attribute(){var m=match(/([\w:-]+)\s*=\s*("[^"]*"|'[^']*'|\w+)\s*/);if(!m)return;return{name:m[1],value:strip(m[2])}}function strip(val){return val.replace(/^['"]|['"]$/g,"")}function match(re){var m=xml.match(re);if(!m)return;xml=xml.slice(m[0].length);return m}function eos(){return 0==xml.length}function is(prefix){return 0==xml.indexOf(prefix)}}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};yy.Help=function(params){return yy.extend(this,params)};yy.Help.prototype.toString=function(){var s=K("HELP");if(this.subject)s+=" "+L(this.subject);return s};helpdocs=[{command:"ALTER TABLE table RENAME TO table"},{command:"ALTER TABLE table ADD COLUMN column coldef"},{command:"ALTER TABLE table MODIFY COLUMN column coldef"},{command:"ALTER TABLE table RENAME COLUMN column TO column"},{command:"ALTER TABLE table DROP column"},{command:"ATTACH engine DATABASE database"},{command:"ASSERT value"},{command:"BEGIN [TRANSACTION]"},{command:"COMMIT [TRANSACTION]"},{command:"CREATE [engine] DATABASE [IF NOT EXISTS] database"},{command:"CREATE TABLE [IF NOT EXISTS] table (column definitions)"},{command:"DELETE FROM table [WHERE expression]"},{command:"DETACH DATABASE database"},{command:"DROP [engine] DATABASE [IF EXISTS] database"},{command:"DROP TABLE [IF EXISTS] table"},{command:"INSERT INTO table VALUES value,..."},{command:"INSERT INTO table DEFAULT VALUES"},{command:"INSERT INTO table SELECT select"},{command:"HELP [subject]"},{command:"ROLLBACK [TRANSACTION]"},{command:"SELECT [modificator] columns [INTO table] [FROM table,...] [[mode] JOIN [ON] [USING]] [WHERE ] [GROUP BY] [HAVING] [ORDER BY] "},{command:"SET option value"},{command:"SHOW [engine] DATABASES"},{command:"SHOW TABLES"},{command:"SHOW CREATE TABLE table"},{command:"UPDATE table SET column1 = expression1, ... [WHERE expression]"},{command:"USE [DATABASE] database"},{command:"expression"},{command:'See also http://github/agershun/alasq for more information'}];yy.Help.prototype.execute=function(databaseid,params,cb){var ss=[];if(!this.subject){ss=helpdocs}else{ss.push('See also http://github/agershun/alasq for more information')}if(cb)ss=cb(ss);return ss};yy.Print=function(params){return yy.extend(this,params)};yy.Print.prototype.toString=function(){var s=K("PRINT");if(this.statement)s+=" "+this.statement.toString();return s};yy.Print.prototype.execute=function(databaseid,params,cb){var self=this;var res=1;alasql.precompile(this,databaseid,params);if(this.exprs&&this.exprs.length>0){var rs=this.exprs.map(function(expr){var exprfn=new Function("params,alasql,p","var y;return "+expr.toJavaScript("({})","",null)).bind(self);var r=exprfn(params,alasql);return JSONtoString(r)});console.log.apply(console,rs)}else if(this.select){var r=this.select.execute(databaseid,params);console.log(JSONtoString(r))}else{console.log()}if(cb)res=cb(res);return res};yy.Source=function(params){return yy.extend(this,params)};yy.Source.prototype.toString=function(){var s=K("SOURCE");if(this.url)s+=" "+S("'"+this.url+"'");return s};yy.Source.prototype.execute=function(databaseid,params,cb){var res;loadFile(this.url,!!cb,function(data){res=alasql(data);if(cb)res=cb(res);return res},function(err){throw err});return res};yy.Require=function(params){return yy.extend(this,params)};yy.Require.prototype.toString=function(){var s=K("REQUIRE");if(this.paths&&this.paths.length>0){s+=this.paths.map(function(path){return path.toString()}).join(",")}if(this.plugins&&this.plugins.length>0){s+=this.plugins.map(function(plugin){return plugin.toUpperCase()
+}).join(",")}return s};yy.Require.prototype.execute=function(databaseid,params,cb){var self=this;var res=0;var ss="";if(this.paths&&this.paths.length>0){this.paths.forEach(function(path){loadFile(path.value,!!cb,function(data){res++;ss+=data;if(res0){this.plugins.forEach(function(plugin){if(!alasql.plugins[plugin]){loadFile(alasql.path+"/alasql-"+plugin.toLowerCase()+".js",!!cb,function(data){res++;ss+=data;if(res0){res=res.filter(function(d){return d.databaseid.match(relike)})}}if(cb)cb(res);return res};LS.createTable=function(databaseid,tableid,ifnotexists,cb){var lsdbid=alasql.databases[databaseid].lsdbid;var tb=LS.get(lsdbid+"."+tableid);var res=1;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];lsdb.tables[tableid]={columns:table.columns};LS.set(lsdbid,lsdb);LS.set(lsdbid+"."+tableid,[]);if(cb)cb(res);return res};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);if(cb)cb(res);return res};LS.fromTable=function(databaseid,tableid,cb,idx,query){var lsdbid=alasql.databases[databaseid].lsdbid;var res=LS.get(lsdbid+"."+tableid);if(cb)res=cb(res,idx,query);return res};LS.intoTable=function(databaseid,tableid,value,columns,cb){var lsdbid=alasql.databases[databaseid].lsdbid;var res=value.length;var tb=LS.get(lsdbid+"."+tableid);if(!tb)tb=[];tb=tb.concat(value);LS.set(lsdbid+"."+tableid,tb);if(cb)cb(res);return res};LS.loadTableData=function(databaseid,tableid){var db=alasql.databases[databaseid];var lsdbid=alasql.databases[databaseid].lsdbid;db.tables[tableid].data=LS.get(lsdbid+"."+tableid)};LS.saveTableData=function(databaseid,tableid){var db=alasql.databases[databaseid];var lsdbid=alasql.databases[databaseid].lsdbid;LS.set(lsdbid+"."+tableid,db.tables[tableid].data);db.tables[tableid].data=null};LS.commit=function(databaseid,cb){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){lsdb.tables[tbid]={columns:db.tables[tbid].columns};LS.set(lsdbid+"."+tbid,db.tables[tbid].data)}}LS.set(lsdbid,lsdb);return 1};LS.begin=LS.commit;LS.rollback=function(databaseid,cb){var db=alasql.databases[databaseid];db.dbversion++;var lsdbid=alasql.databases[databaseid].lsdbid;var lsdb=LS.get(lsdbid);if(lsdb.tables){for(var tbid in lsdb.tables){var tb=new alasql.Table({columns:db.tables[tbid].columns});extend(tb,lsdb.tables[tbid]);lsdb.tables[tbid]=tb;if(!alasql.options.autocommit){lsdb.tables[tbid].data=LS.get(db.lsdbid+"."+tbid)}lsdb.tables[tbid].indexColumns()}}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"};var SQLITE=alasql.engines.SQLITE=function(){};SQLITE.createDatabase=function(wdbid,args,ifnotexists,dbid,cb){throw new Error("Connot create SQLITE database in memory. Attach it.")};SQLITE.dropDatabase=function(databaseid){throw new Error("This is impossible to drop SQLite database. Detach it.")};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')}if(args[0]&&args[0]instanceof yy.StringValue||args[0]instanceof yy.ParamValue){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};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)};SQLITE.intoTable=function(databaseid,tableid,value,columns,cb){var sqldb=alasql.databases[databaseid].sqldb;for(var i=0,ilen=value.length;i1){var sql="REQUIRE "+paths.map(function(p){return'"'+p+'"'}).join(",");alasql(sql,[],cb)}}else if(path===false){delete alasql.webworker;return}}}
\ No newline at end of file
diff --git a/gulpfile.js b/gulpfile.js
index cf00aec327..6b2458d0ed 100644
--- a/gulpfile.js
+++ b/gulpfile.js
@@ -196,6 +196,13 @@ gulp.task('copy-console-org', function(){
/************************/
+// Echo plugin
+gulp.task('typescript', function(){
+ gulp.src(['./src/typescript/alasql.d.ts'])
+ .pipe(gulp.dest('./dist'));
+});
+
+
// Echo plugin
gulp.task('plugin-plugins', function(){
gulp.src([
@@ -242,6 +249,7 @@ gulp.task('default', ['js-merge' /*, 'jison-compile', 'jison-lex-compile' */], f
gulp.watch('./src/99worker*.js',function(){ gulp.run('js-merge-worker'); });
gulp.watch('./src/alasqlparser.jison',function(){ gulp.run('jison-compile'); });
+ gulp.watch('./src/typescript/alasql.d.ts',function(){ gulp.run('typescript'); });
gulp.watch('./src/echo/*.js',function(){ gulp.run('plugin-plugins'); });
gulp.watch('./src/md/*.js',function(){ gulp.run('plugin-plugins'); });
gulp.watch('./src/prolog/*.js',function(){ gulp.run('plugin-prolog'); });
diff --git a/meteor/.versions b/meteor/.versions
index 9533c83173..9456f5d983 100644
--- a/meteor/.versions
+++ b/meteor/.versions
@@ -1,4 +1,4 @@
-agershun:alasql@0.1.17
-local-test:agershun:alasql@0.1.17
+agershun:alasql@0.1.18
+local-test:agershun:alasql@0.1.18
meteor@1.1.6
underscore@1.0.3
diff --git a/meteor/README.md b/meteor/README.md
deleted file mode 100644
index 36aba83a66..0000000000
--- a/meteor/README.md
+++ /dev/null
@@ -1,844 +0,0 @@
-# AlaSQL.js - JavaScript SQL database library for relational and graph data manipulation with support of localStorage, IndexedDB, and Excel
-
-AlaSQL - '[à la SQL](http://en.wiktionary.org/wiki/%C3%A0_la)' - is a lightweight JavaScript SQL database designed to work in browser, Node.js, and Apache Cordova. It supports traditional SQL with some NoSQL functionality. Current version of AlaSQL can work in memory and use file, IndexedDB, and localStorage as a persistent storage.
-
-## How to use?
-
-AlaSQL is easy to use! Just install ```agershun:alasql```packageto your project and call ```alasql()``` function with SQL statement inside:
-
-```js
- alasql("CREATE TABLE cities (city string, population number)");
- alasql("INSERT INTO cities VALUES ('Rome',2863223), ('Paris',2249975),\
- ('Berlin',3517424), ('Madrid',3041579)");
- console.log( alasql("SELECT * FROM cities WHERE population < 3500000 ORDER BY population DESC") );
-```
-
-Please use:
-* [Issues](https://github.com/agershun/alasql/issues) to report bugs.
-* [Feathub](http://feathub.com/agershun/alasql) to vote for new features
-* [AlaSQL Forum](https://groups.google.com/d/forum/alasql) for discussions
-
-## Documentation
-
-* [AlaSQL Wiki](https://github.com/agershun/alasql/wiki)
-* [AlaSQL User Manual](http://www.slideshare.net/AndreyGershun/alasql-manual-141220-1)
-* [AlaSQL Coockbok](https://github.com/agershun/alasql/wiki/Data-manipulation) - Q&A, examples
-* [StackOverflow AlaSQL Q&A](http://stackoverflow.com/questions/tagged/alasql)
-
-## Why AlaSQL?
-
-* AlaSQL was written with pure JavaScript and does not use WebSQL database.
-* AlaSQL uses "good old" SQL with advanced funcionality like multiple JOINs, VIEWs, GROUPs, UNIONs, PRIMARY KEYs, ANY, ALL, IN, subqueries, ROLLUP(), CUBE() and GROUPING SETS(), CROSS APPLY, OUTER APPLY, WITH SELECT, views, functions, variables
-* AlaSQL works with all modern versions of browsers Chrome, Firefox, IE, Safari, Opera, Node.js, and mobile iOS and Android, plus Apache Cordova.
-* AlaSQL can to work directly with JavaScript objects and functions inside SQL, it can search JSON objects like JavaScript and NoSQL databases
-* AlaSQL supports file, IndexedDB, and localStorage (with AUTOCOMMIT ON and AUTOCOMMIT OFF modes)
-* Plus some [JavaScript sugar](#Sugar)
-* AlaSQL is fast, because it uses some optimization methods.
-
-Check AlaSQL vs other JavaScript SQL databases and data processing libraries:
-* [AlaSQL vs. WebSQL](http://jsperf.com/alasql-js-vs-websql/7) - for in-memory SELECT operations (see discussion at [issue #47](https://github.com/agershun/alasql/issues/47))
- * [AlaSQL vs. SQL.js](http://jsperf.com/sql-js-vs-alasql-js/4) - in-memory operations* [AlaSQL vs. Linq](http://jsperf.com/alasql-vs-linq-on-groupby) - test on 2^20 records
- * AlaSQL vs. CrossFilter - [test 1](http://jsperf.com/alasql-vs-crossfilter), [test 2 on 8000 records](http://jsperf.com/alasql-vs-crossfilter-athletic-data)
- * [AlaSQL vs. Lodash](http://jsperf.com/alasql-vs-lodash), [AlaSQL vs. Lodash vs. Underscore](http://jsperf.com/alasql-vs-lodash-sort/3)
- * [AlaSQL vs. Human](http://jsperf.com/javascript-array-grouping/7) :) - based on SatckOverflow [question on grouping](http://stackoverflow.com/questions/6781722/fast-grouping-of-a-javascript-array).
-
-## What is new?
-
-### AlaSQL and Meteor Mongo collections
-
-Now you can use Meteor collections as agruments. To do it simply store alasql.min.js to the client/lib directory and then apply SQL to Meteor Collections:
-
-```js
- Template.body.helpers({
- tasks: function () {
- return alasql('SELECT * FROM ?',[Tasks]);
- }
- });
-```
-
-Or you can use with find() options with special METEOR() from-function:
-```
- return alasql('SELECT * FROM ?',[Tasks]);
- return alasql('SELECT * FROM METEOR(?)',[Tasks]);
- return alasql('SELECT * FROM METEOR(?,?)',[Tasks,{text:"Hello world!"}]);
- return alasql('SELECT * FROM METEOR(?,{text:"Hello world!"})',[Tasks]);
-```
-
-### Search paths in graph
-
-Now you can search graphs with SEARCH operator:
-```js
- var res = alasql('CREATE GRAPH Pablo, Maxim, Alex, Napoleon, \
- Josephine, Kate, Julia {age:27}, Paloma, \
- #Pablo >loves> #Julia, #Maxim >> #Julia, #Alex >> #Kate, \
- #Kate >> #Julia, #Alex >> #Paloma, #Napoleon > "loves" > #Josephine, \
- #Josephine >"knows"> #Pablo');
-
- var res = alasql('SEARCH PATH(#Pablo) name FROM #Napoleon ');
- // returns ['loves','Josephine','knows','Pablo']
-```
-You can play with grpahs in AlaSQL in [this jsFiddle example](http://jsfiddle.net/fgzya692/1/).
-
-### Documents and graphs paradigms
-
-AlaSQL now is multi-paradigm database with support documents and graphs. Below you can find an example
-how to create graph:
-```js
- alasql('CREATE GRAPH #Olga, #Helen, #Pablo, #Andrey, #Alice, \
- #Olga >> #Pablo, #Helen >> #Andrey, \
- #Pablo >> #Alice, #Andrey >> #Alice');
-```
-and search over it with SEARCH operator:
-```js
- // Whom loves Olga?
- alasql('SEARCH / #Olga >> name');
- // ['Pablo']
-
- // Whom loves Olga's love objects?
- alasql('SEARCH / #Olga >> >> name');
- // ['Alice']
-
- // Who loves lovers of Alice?
- alasql('SEARCH / ANY(>> >> #Alice) name');
- // ['Olga','Helen']
-
-```
-You also make searches over JSON object with SEARCH operator:
-```js
- var data = {a:{a:{a:{a:{b:10}}}},b:20};
- var res = alasql('SEARCH a b FROM ?',[data]);
- var res = alasql('SEARCH (a)+ b FROM ?',[data]);
- var res = alasql('SEARCH (a a)+ b FROM ?',[data]);
- var res = alasql('SEARCH (a a a)+ b FROM ?',[data]);
- var res = alasql('SEARCH (/)+ b FROM ?',[data]);
- var res = alasql('SEARCH /+b FROM ?',[data]);
- var res = alasql('SEARCH a* b FROM ?',[data]);
- var res = alasql('SEARCH a+ b FROM ?',[data]);
- var res = alasql('SEARCH a? b WHERE(b>20) FROM ?',[data]);
-```
-Please see more examples in test300-test309.js. All these features will be documented soon.
-
-### Version upgrade from 0.0.51 to 0.1.0
-
-AlaSQL now is 6 month old and it can change minor release number from 0.0 to 0.1.
-
-As we decided earlier, we will change version number to 0.1 after cleaning some
-known bugs and problems (including [UNION CORRESPONDING](https://github.com/agershun/alasql/issues/75) issue and [IE9 file saving](https://github.com/agershun/alasql/issues/73)).
-
-The plans and priorities for development from version 0.1 to 0.2 will be:
-* Wiki documentation
-* Fixing bugs and clean the code
-* Add graph- and document- database paradigm functionality
-* Prepare to convert AlaSQL to modular structure (AlaSQL2)
-
-Other areas of future improvements (please add and vote for new features on [Feathub](http://feathub.com/agershun/alasql)):
-* Better Apache Cordova and other mobile frameworks support
-* Improve export to XLS and XLSX (adding colors and LibreOffice support)
-* Support key-value external storages and NoSQL databases
-* Add some missing SQL functionality (constraints, foreign keys, etc.)
-
-### AlaSQL export to Excel with colors (2)
-
-Now AlaSQL can save files to Excel and LibreOffice formats with colors and other
-Excel formatting functions. This function also work in IE9. This is a code sample:
-
-```js
- var mystyle = {
- headers:true,
- column: {style:{Font:{Bold:"1"}}},
- rows: {1:{style:{Font:{Color:"#FF0077"}}}},
- cells: {1:{1:{
- style: {Font:{Color:"#00FFFF"}}
- }}}
- };
- alasql('SELECT * INTO XLSXML("restest280b.xls",?) FROM ?',[mystyle,data]);
-```
-See the working example in [jsFiddle](http://jsfiddle.net/95j0txwx/7/)
-
-
-### AlaSQL export to Excel with colors (1)
-
-Now AlaSQL can export data to XLS format with coloring cells
-
-```js
- var opts = {
- headers: true,
- sheetid: 'My Birds',
- style:"background:#00ff00",
- columns: [
- {columnid:'a',title:'Albatroses',
- style:'background:red;font-size:20px',
- cell:{style:'background:blue'}
- },
- {columnid:'b',title:'Bird',cell:{
- style:function(value,sheet,row,column,rowidx,columnidx){
- return 'background'+(value==10?'brown':'white')
- }}},
- {
- columnid: 'b', cell:{value:function(value){ return value * value}}
- }
- ]
- };
-
- var res = alasql('SELECT * INTO XLS("restest257a.xls",?) FROM ?',[opts,data]);
-
-```
-Please, see the example with advanced color syntax [in jsFiddle](http://jsfiddle.net/agershun/95j0txwx/2/).
-
-### AlaSQL and Google Spreadsheets (with Tabletop)
-
-Now AlaSQL can read data (and make other manipulations like grouping, filtering, or saving to XLSX) directly from Google Spreadsheets. It uses wonderful [Tabletop library](https://github.com/jsoma/tabletop).
-
-```html
-
-
-
-
-```
-
-You can try this example [in jsFiddle](http://jsfiddle.net/ezy7rhhd/2).
-
-### AlaSQL as a WebWorker
-
-AlaSQL can work as a webworker. Include alasql-worker.js and that is it: AlaSQL will work as a webworker.
-
-```html
-
-
-```
-Try the example [at jsFiddle](http://jsfiddle.net/agershun/oxv4rzzc/).
-
-Another option - run alasql.worker() function:
-
-```html
-
-
-```
-Try this example [in jsFiddle](http://jsfiddle.net/agershun/rjwp8u48/3/).
-
-Also you can use AlaSQL in webworker just simply load it as a script:
-
-```js
- importScripts('alasql.min.js');
-```
-
-### Read and write Excel, CSV, TAB, JSON, and text files to/from database
-
-Now AlaSQL can work with files in XLS, XSLX, CSV, TAB, TXT, and JSON format
-
-```js
- alasql('select * into one from csv("mydata.csv")');
- alasql('select Country, Name from xlsx("cities.xlsx",{headers:true, range:"B1:E10"})\
- where Population > 100000',
- [],function(data){
- console.log(data);
- });
-```
-See [test168](test/test168.js) - [test169](test/test169.js)
-
-### d3.js + AlaSQL
-
-AlaSQL can be used with d3.js to create diagrams, like the example below. Here AlaSQL
-read Excel file with Olympic Prizes, group and sort rows by one of the axes, and then
-take top 10 records and create a list with axe values:
-
-```js
- function graph(axe) {
- alasql('SELECT TOP 10 '+axe+', SUM([Gold Medals]) AS Gold, \
- SUM([Silver Medals]) AS Silver, SUM([Bronze Medals]) AS Bronze \
- FROM XLSX("medals.xlsx",{headers:true}) \
- GROUP BY '+axe+' ORDER BY '+axe,[],function(data){
-
- d3.select("body")
- .append('ul')
- .data(data)
- .entry()
- .append('li')
- .text(function(d){return d[axe]});
- });
- }
-
- graph('Axe');
-
-```
-
-Try the [simple example](http://alasql.org/demo/005d3/) of AlaSQL + d3.js integration.
-
-
-### Google Maps + AlaSQL
-```js
- alasql("SELECT * FROM CSV("https://cdn.rawgit.com/albertyw/avenews/master/old/data/average-latitude-longitude-countries.csv",{headers:true})', [], function(country){
- var mapOptions = { zoom : 3, center : new google.maps.LatLng(40, 0),
- mapTypeId : google.maps.MapTypeId.ROADMAP
- };
- var map = new google.maps.Map(document.getElementById('map-canvas'), mapOptions);
- for (i = 0; i < country.length; i++) {
- var opts = {
- strokeColor : '#000000',
- fillColor : ["red","green","blue","brown"][i%4],
- fillOpacity : 0.35,
- map : map,
- center : new google.maps.LatLng(country[i].Latitude,country[i].Longitude),
- radius : 100000
- };
- new google.maps.Circle(opts);
- });
-```
-Check [this example](http://alasql.org/demo/009geo) and [this example](http://jsfiddle.net/agershun/1o2xq1yh/2/) of integrations AlaSQL and Google Maps.
-
-### ETL sample: CSV and IndexedDB database
-
-Upload CSV file with headers to IndexedDB database, and then save only asian countries
-to Excel file:
-```js
- alasql('ATTACH INDEXEDDB DATABASE geo; \
- CREATE TABLE IF NOT EXISTS geo.country; \
- SELECT * INTO geo.country FROM CSV("country.csv",{headers:true}); \
- SELECT * INTO XLSX("asia.xlsx") FROM geo.country WHERE continent_name = "Asia"');
-```
-See [the example](http://alasql.org/demo/001csv/).
-
-### Read SQLite database files
-
-AlaSQL can work with SQLite data files on the top of with [SQL.js](https://github.com/kripken/sql.js) library:
-```html
-
-
-
-```
-
-See more detailed [the example](http://alasql.org/demo/004sqlite/).
-
-### Angular.js and AlaSQL.js
-
-You can use AlaSQL together with Angular.js framework:
-
-```js
- $scope.exportData = function () {
- alasql('SELECT * INTO XLSX("john.xlsx",{headers:true}) FROM ?',[$scope.items]);
- };
-```
-See [simple example in jsFiddle](http://jsfiddle.net/agershun/00nfeq12/).
-
-Other examples of AlaSQL and Angular.js integration:
-
-* [Calculating average of array](http://jsfiddle.net/agershun/she06Lq3/2/)
-
-## Examples
-
-Try AlaSQL in console:
-* AlaSQL Console [http://alasql.org/console](http://alasql.org/console)
-* [Console source code](console/index.html)
-* [Alacon](alacon.js) - command-line AlaSQL console (to run: ```alacon "sql-statement" params...```)
-* [Alaserver](alaserver.js) - very simple AlaSQL-server (to run: ```alaserver```, then
-type in browser "http://127.0.0.1:1337/?SELECT VALUE 2*2" )
-
-Try AlaSQL in Fiddle:
-* Simple examples: [sample 1](http://jsfiddle.net/38hj2uwy/10/), [sample 2](http://jsfiddle.net/38hj2uwy/6/), [sample 3](http://jsfiddle.net/6a06dqhc/3/), [sample 4](http://jsfiddle.net/606ksx2g/1/), [sample 5](http://jsfiddle.net/agershun/38hj2uwy/40/)
-* [IndexedDB example](http://jsfiddle.net/agershun/1t2rrr78/)
-* [AlaSQL Sandbox](http://jsfiddle.net/czqfyhat/2/) - [source](examples/sandbox.html)
-* [Sieve of Eratosthenes](http://jsfiddle.net/agershun/1u05op11/) - [source](examples/prime.html)
-
-Other examples:
-* [World database](http://alasql.org/console?source 'world.sql';select top 10 * from City) - [source](console/index.html)
-* Mini-ETL: [upload CSV data to IndexedDB database](http://alasql.org/demo/001csv/)
-* [More than 200 of AlaSQL tests](test)
-
-### What People Say about AlaSQL?
-
-* [What people around the world say about AlaSQL](PEOPLE.md)
-
-### Presentations
-
-* [AlaSQL.js - fast JavaScript in-memory SQL database](http://www.slideshare.net/AndreyGershun/alasqljsfast-javascript-inmemory-sql-database)
-* [SQL and NoSQL in AlaSQL database](http://www.slideshare.net/AndreyGershun/sql-and-nosql-in-alasql)
-
-## Installation
-
-### In browser
-
-Include file: [alasql.js](./alasql.js) to the page.
-
-```html
-
-
-
-```
-Try this sample in [AlaSQL console](http://alasql.org/console?CREATE TABLE test (language INT, hello STRING);INSERT INTO test VALUES (1,'Hello!');INSERT INTO test VALUES (2,'Aloha!');INSERT INTO test VALUES (3,'Bonjour!');SELECT * FROM test WHERE language > 1)
-
-You can use alasql.js with define()/require() functions in browser as well, because it supports AMD and UMD:
-
-```js
- require(['../../alasql.js'], function(alasql) {
- var test1 = [{a:1,b:2,c:3},{a:4,b:5,c:6},{a:7,b:8,c:9}];
- console.table(alasql('SELECT a, b*c AS bc FROM ? AS t',[test1]));
- });
-```
-Like in this sample you do not need to CREATE TABLE and INSERTS if you do not need constraints functionality.
-
-### In Node.js
-
-Use the following command for installation:
-```
- npm install alasql
-```
-Then require alasql.js file:
-
-```js
- var alasql = require('alasql');
-
- var db = new alasql.Database();
-
- db.exec("CREATE TABLE test (one INT, two INT)");
- db.tables.test.data = [ // You can mix SQL and JavaScript
- {one:3,two:4},
- {one:5,two:6},
- ];
- var res = db.exec("SELECT * FROM test ORDER BY two DESC");
- console.log(res[0].one);
-
-```
-
-### Supported SQL statements
-
-* SELECT TOP number columns INTO table FROM tableid1 JOIN tableid2 ON oncond WHERE cond GROUP BY v1,v2 HAVING cond ORDER BY a,b, LIMIT number OFFSET number
-* INSERT INTO table \[ (field1, field2) \] VALUES (value1, value2), (value3, value4), ...
-* INSERT INTO table SELECT subquery
-* UPDATE table SET field = value1, field = value2 WHERE condition
-* DELETE FROM table WHERE condition
-* CREATE TABLE \[IF NOT EXISTS\] table (columns type PRIMARY KEY, constraints)
-* ALTER TABLE ADD COLUMN / DROP COLUMN
-* DROP TABLE \[IF EXISTS\] table
-* CREATE DATABASE, USE DATABASE, DROP DATABASE
-* SHOW DATABASES / SHOW TABLES / SHOW COLUMNS / SHOW CREATE TABLE
-* SOURCE 'url-file.sql'
-* ASSERT json-object
-* Expression (like SELECT expression)
-
-Try all these statements in [AlaSQL console](http://alasql.org/console?help)
-
-#### SELECT statement
-
-AlaSQL.js supports following subset of SELECT syntax:
-
-* SELECT column1, column2 AS alias3, FUNCTION(field4+field5) AS alias6, SUM(expression7) AS alias8, *, table2.*
-* TOP number
-* FROM table1, table2, (SELECT * FROM table3) alias
-* LEFT / RIGHT / INNER / OUTER / ANTI / SEMI / CROSS / NATURAL JOIN table2 ON condition / USING columns
-* WHERE condition
-* GROUP BY column1, column2, ROLLUP(a,b), CUBE(c,d,e), GROUPING SETS(g,h)
-* HAVING condition
-* ORDER BY column1, column2 DESC,
-* LIMIT number [OFFSET number]
-* UNION / UNION ALL select / INTERSECT / EXCEPT
-
-Operators:
-
-* +, -, *, /, %, AND, OR, NOT, BETWEEN, NOT BETWEEN, EXISTS (Subquery), > ALL (subquery/array), > ANY/SOME (subquery / array), [NOT] IN (subquery / array), LIKE
-* CAST (expression AS type)
-
-Aggregators:
-
-* SUM(), COUNT(), MIN(), MAX(), FIRST(), LAST(), AVG(), AGGR(), ARRAY(), REDUCE()
-
-GROUP BY Grouping functions:
-
-* ROLLUP(), CUBE(), GROUPING SETS()
-
-Functions:
-
-* ABS(), IIF(), IFNULL(), INSTR(), LOWER(), UPPER(), LCASE(), UCASE(), LEN(), LENGTH()
-* GREATEST(), LEAST()
-
-SELECT modifiers (non-standard SQL):
-* SELECT VALUE - get single value
-* SELECT ROW - get first row as an array
-* SELECT COLUMN - get first column as an array
-* SELECT MATRIX - get all results as an array of arrays
-
-#### User-defined JavaScript functions
-
-You can use all benefits of SQL and JavaScript togeather by defining user functions. Just add new functions to alasql.fn object:
-
-```js
- alasql.fn.double = function(x){return x*2};
- alasql.fn.sum10 = function(x,y) { return x+y*10; }
- db.exec('SELECT a, double(a) AS b, sum10(a,b) FROM test1');
-```
-
-User-defined functions are related to current database. You can define different functions in different databases.
-
-### alasql
-
-alasql is a main variable of module. You can use it immediatly as default database
-
-In browser:
-```html
-
-
-```
-Try this sample in [AlaSQL console](http://alasql.org/console?CREATE TABLE one (two INT))
-
-
-or in Node.js:
-```js
- var alasql = require('alasql');
- alasql('CREATE TABLE one (two INT)');
-```
-
-Another approach is to create new database:
-
-```js
- var mybase = new alasql.Database();
- mybase.exec('CREATE TABLE one (two INT)');
-```
-You can give a name to database and then access it from alasql:
-```js
- var mybase = new alasql.Database('mybase');
- console.log(alasql.databases.mybase);
-```
-
-Each database can be used with the following methods:
-
-```js
- var db = new alasql.Database() - create new alasql-database
- var res = db.exec("SELECT * FROM one") - executes SELECT query and returns array of objects
-```
-
-Usually, alasql.js works synchronously, but you can use callback.
-
-```js
- db.exec('SELECT * FROM test', [], function(res){
- console.log(res);
- });
-```
-
-or you can use aexec() - promised version of exec (in this case you need to install [es6-promise](https://www.npmjs.org/package/es6-promise) module for Node.js) (this feature is experimental and may be removed in a future to reduce dependices):
-```js
- db.aexec('SELECT * FROM test').then(function(res){
- console.log(res);
- });
-```
-You can use compile statements:
-```js
- var insert = db.compile('INSERT INTO one (1,2)');
- insert();
-```
-
-You can use parameters in compiled and interpreted statements:
-
-```js
- var insert1 = db.compile('INSERT INTO one (?,?)');
- var insert2 = db.compile('INSERT INTO one ($a,$b)');
- var insert3 = db.compile('INSERT INTO one (:a,:b)');
-
- insert1([1,2]);
- insert2({a:1,b:2});
- insert3({a:3,b:4});
-
- db.exec('INSERT INTO one (?,?)',[5,6]);
-
-```
-You even can use param in FROM clause:
-
-```js
- var years = [
- {yearid: 2012}, {yearid: 2013},
- {yearid: 2014}, {yearid: 2015},
- {yearid: 2016},
- ];
-
- var res = alasql.queryArray('SELECT * FROM ? AS years ' +
- 'WHERE yearid > ?', [years,2014]);
-
- // res == [2015,2016]
-```
-You can use array of arrays to make a query. In this case use square brackets for column name,
-like \[1\] or table\[2\] (remember, all arrays in JavaScript start with 0):
-```js
- var data = [
- [2014, 1, 1], [2015, 2, 1],
- [2016, 3, 1], [2017, 4, 2],
- [2018, 5, 3], [2019, 6, 3]
- ];
- var res = alasql('SELECT SUM([1]) FROM ? d WHERE [0]>2016', [data]);
-```
-Use alasql.queryArrayOfArrays() function to return array of arrays. In this case
-you can specify array position of selected column with number or number in brackets:
-```js
- var res = alasql.queryArrayOfArrays(
- 'SELECT [1] AS 0,[1]+[2] AS [1] FROM ? d WHERE [0]>2016', [data]);
-```
-This feature can be used as filter for arrays. Compare:
-```js
- // Same filter
- var res1 = alasql.queryArrayOfArrays('SELECT * FROM ? a WHERE [0]>2016', [data]);
- var res2 = data.filter(function(a){return a[0]>2016});
-
- // Complex filter with aggregating, grouping and sorting
- var res = alasql.queryArrayOfArrays(
- 'SELECT [2] AS 0, SUM([1]) AS 1 FROM ? a WHERE a[0]>? GROUP BY [0] ORDER BY [1]',
- [data, 2016]);
-
-```
-
-### Lower and Upper Case
-
-By default, AlaSQL is case-insensitive to all standard keywords (like SELECT) and standard functions (like ABS()). All database names, table names, column names, and user-defined functions are case sensitive.
-
-JavaScript is case-sensitive language, so use the same CaSe for AlaSQL and JavaScript data.
-
-Now you can use databases, tables, and columns with spaces inside square brackets:
-
-```sql
- CREATE DATABASE [My Database]; -- BTW You can use comments in the SQL statements
- USE [My Database]; /* or comments like this */
- CREATE TABLE [A.table] ([the-column] INT);
- INSERT INTO [A.table] VALUES (1),(2);
- SELECT [the-column] AS [AS] FROM [My Database];
-```
-Try this sample in [AlaSQL console](http://alasql.org/console?CREATE DATABASE [My Database];USE [My Database];CREATE TABLE [A.table] ([the-column] INT);INSERT INTO [A.table] VALUES (1),(2);SELECT [the-column] AS [AS] FROM [My Database])
-
-
-### JavaScript Sugar
-
-AlaSQL extends "good old" SQL to make it closer to JavaScript. The "sugar" includes:
-
-* Json objects - ``` {a:1,b:@[1,2,3]}
-* Object propertires - ```obj->property->subproperty```
-* Object and arrays elements - ```obj->(a*1)```
-* JavaScript functions - ```obj->valueOf()```
-* SELECT VALUE, ROW, COLUMN, MATRIX to format results of query
-
-### Transactions
-
-There is a limited support of transactions (with tx.rollback() and tx.commit() functions):
-
-```js
- db = new alasql.Database("mydb");
- db.transaction(function(tx) {
- tx.exec('SELECT COUNT(*) FROM students');
- tx.rollback();
- });
-
-```
-Warning: Sorry, transactions now are temporary unavailable due some complexities with realization.
-
-### SQL to JavaScript parser and compiler
-
-You can use AlaSQL to parse to AST and compile SQL statements:
-
-```js
- // Parse to AST
- var ast = alasql.parse("SELECT * FROM one");
- console.log(ast.toString()); // Print restored SQL statement
-
- // Compile to JavaScript function with or without parameters
- var statement = alasql.compile("SELECT * FROM one WHERE a > ? AND b < ?");
- statement([1,5]);
-```
-
-AlaSQL uses wonderful [Jison](http://jison.org) parser to produce AST-tree.
-
-
-### localStorage and DOM-storage
-You can use browser localStorage and [DOM-storage](https://github.com/node-browser-compat/dom-storage) as a data storage. Here is a sample:
-```
- alasql('CREATE localStorage DATABASE IF NOT EXISTS Atlas');
- alasql('ATTACH localStorage DATABASE Atlas AS MyAtlas');
- alasql('CREATE TABLE IF NOT EXISTS MyAtlas.City (city string, population number)');
- alasql('SELECT * INTO MyAtlas.City FROM ?',[[{city:'Vienna', population:1731000},
- {city:'Budapest', population:1728000}]]);
- var res = alasql('SELECT * FROM MyAtlas.City');
- console.log(res);
-```
-Try this sample in [jsFiddle](http://jsfiddle.net/agershun/x1gq3wf2/). Run this sample
-two or three times, and AlaSQL store more and more data in localStorage. Here, "Atlas" is
-the name of localStorage database, where "MyAtlas" is a memory AlaSQL database.
-
-You can use localStorage in two modes: SET AUTOCOMMIT ON to immediate save data
-to localStorage after each statement or SET AUTOCOMMIT OFF. In this case you need
-to use COMMIT statement to save all data from in-memory mirror to localStorage.
-
-### Work with CSV, TAB, TXT, and JSON files
-You can use files in these formats directly from AlaSQL (in sync and async modes):
-```js
- var res1 = alasq("select * from txt('mytext.txt') where [0] like 'M%'");
- var res2 = alasq("select * from tab('mydata.tab') order by [1]");
- var res3 = alasq("select [3] as city,[4] as population from csv('cities.csv')");
-
- alasq("select * from json('array.json')",[],function(res4){
- console.log(res4)
- });
-```
-See [test157.js](test/test157.js) as an example.
-
-### JSON-objects
-
-You can use JSON objects in your databases (do not forget use == and !== operators for deep comparision of objects):
-```sql
- 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
-
- 2
-
- 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)
-
-### Alacon - command-line utility
-
-You can use AlaSQL from the command-line:
-```sql
- > alacon "SELECT VALUE 1+1"
- 2
- > alacon "SELECT VALUE 1+?" 2
- 3
- > alacon "@{a:(1+?)}" 3
- 4
-```
-
-### Alaserver - simple database server
-
-Yes, you can even use AlaSQL as a very simple server for tests.
-
-To run enter the command:
-```
- alaserver [port]
-```
-then type in browser something like "http://127.0.0.1:1337/?SELECT VALUE 2*2"
-
-Warning: Alaserver is not multi-thread, not concurent, and not secured.
-
-
-### Performance
-
-According the preliminary performance tests alasql.js is faster than [sql.js]() in 5 to 10 times on more than 1000 records tables, and 2 to 3 times to [WebSQL]() on different queries.
-
-AlaSQL has four different optimization algorithm:
-* Caching of compiled queries
-* Joins: Preindexation of joined table
-* Joins: Prefiltering of WHERE expressions
-
-Now optimization algorithm has some limitations and therefore "table1 JOIN table2 USING column1, column2" is faster than "table1 JOIN table2 ON table1.column1 = table2.column1 AND table1.column2 = table2.column2 ", but with one column it is ok.
-
-### Limitations
-
-It is Ok with select for 1000000 records or 2 join two tables by 10000 records in each.
-Now you can use streamming functions to work with longer datasources (see [test/test143.js](test/test143.js).
-
-### Tests
-
-### Tests with Mocha
-AlaSQL uses ```mocha``` for tests. Run mocha from command line in directory with tests:
-
-```
- > cd test
- > mocha .
-```
-or run [test/index.html](test/index.html) for tests in browser.
-
-### Tests with AlaSQL ASSERT from SQL
-
-Now you can use AlaSQL [ASSERT](wiki/Assert) operator to test results of previous operation:
-```sql
- CREATE TABLE one (a INT);
- ASSERT 1;
- INSERT INTO one VALUES (1),(2),(3);
- ASSERT 3;
- SELECT * FROM one ORDER BY a DESC;
- ASSERT [{a:3},{a:2},{a:1}];
-```
-
-### Warnings
-AlaSQL project is very young and still in active development phase, therefore it may have some bugs. Please, wait a little bit before start to use it in production. I am going to add more tests and clean the code before relaese more stable version 0.1.0. Please, submit any bugs and suggestions in [Issues page](https://github.com/agershun/alasql/issues).
-
-You can check next version branches for new experimental features.
-
-### Known Bugs and Limitations
-
-1. ORDER BY clause on three or more UNIONS ( [See example in AlaSQL console](http://alasql.org/console?select 10 as a union all select 20 as a union all select 30 as a order by a desc) )
-2. 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 one of the future version.
-
-
-Probably, there are many of others. Please, [give me a chance](https://github.com/agershun/alasql/issues) to fix them. Thank you!
-
-### Future Plans
-
-Read my [to do](TODO.md) page - there are also the community generated feature requests here:
-
-[![Feature Requests](http://feathub.com/agershun/alasql?format=svg)](http://feathub.com/agershun/alasql)
-
-Take charge and vote on your favorite.
-
-
-
-### Similar and related projects
-
-* [AlaX](http://github.com/agershun/alax) - Export to Excel with colors and formats
-* [WebSQLShim](http://github.com/agershun/WebSQLShim) - WebSQL shim over IndexedDB (work in progress)
-* [AlaMDX](http://github.com/agershun/alamdx) - JavaScript MDX OLAP library (work in progresss)
-* [Other similar projects](http://github.com/agershun/alasql/wiki/Similar-Projects.md) - list of databases on JavaScript
-
-### FileSaver
-
-AlaSQL includess [FileSaver.js](https://github.com/eligrey/FileSaver.js/) library inside for saving files locally in browsers. Unfortunately, it cannot save files in Safari 8.0.
-
-### Contributors
-
-* [Andrey Gershun](http://github.com/agershun)
-* [Mathias Rangel Wulff](https://github.com/mathiasrw)
-* [Aubert Grégoire](https://github.com/gregaubert)
-
-### Credits
-
-Many thanks to Zach Carter for [Jison](http://zaach.github.io/jison/) parser generator, to the author of FileSaver.js, Andrew Kent for his [SQL Parser](https://github.com/forward/sql-parser),
-authors of [XLSX](https://github.com/SheetJS/js-xlsx) library,
-and other people for useful tools, which make our work much easier.
-
-## License
-
-[MIT licence information](LICENSE).
-
-The MIT license on this repo covers all contents of the repo, but does not supercede the existing licenses for products used for this work, including the Chinook Database (covered by the Microsoft Public License) and other products.
-
-(c) 2014, Andrey Gershun (agershun@gmail.com),
-
diff --git a/meteor/package.js b/meteor/package.js
index 0a08f612c3..cc12eaf49e 100644
--- a/meteor/package.js
+++ b/meteor/package.js
@@ -1,13 +1,13 @@
Package.describe({
name: 'agershun:alasql',
- version: '0.1.18',
+ version: '0.1.19',
// 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.
git: 'http://github.com/agershun/alasql.git',
// By default, Meteor will default to using README.md for documentation.
// To avoid submitting documentation, set this field to null.
- documentation: 'README.md'
+ documentation: '../README.md'
});
Package.onUse(function(api) {
diff --git a/node_modules/es6-promise/CHANGELOG.md b/node_modules/es6-promise/CHANGELOG.md
index 977b17c89e..e06b4967cf 100644
--- a/node_modules/es6-promise/CHANGELOG.md
+++ b/node_modules/es6-promise/CHANGELOG.md
@@ -1,43 +1,9 @@
-# master
-
-# 2.0.4
-
-* Fix npm package
-
-# 2.0.3
-
-* Fix useSetTimeout bug
-
-# 2.0.2
-
-* Adding RSVP#rethrow
-* add pre-built AMD link to README
-* adding promise#fail
-
-# 2.0.1
-* misc IE fixes, including IE array detection
-* upload passing builds to s3
-* async: use three args for addEventListener
-* satisfy both 1.0 and 1.1 specs
-* Run reduce tests only in node
-* RSVP.resolve now simply uses the internal resolution procedure
-* prevent multiple promise resolutions
-* simplify thenable handling
-* pre-allocate the deferred's shape
-* Moved from Rake-based builds to Grunt
-* Fix Promise subclassing bug
-* Add RSVP.configure('onerror')
-* Throw exception when RSVP.all is called without an array
-* refactor RSVP.all to just use a promise directly
-* Make `RSVP.denodeify` pass along `thisArg`
-* add RSVP.reject
-* Reject promise if resolver function throws an exception
-* add travis build-status
-* correctly test and fix self fulfillment
-* remove promise coercion.
-* Fix infinite recursion with deep self fulfilling promises
-* doc fixes
-
-# 2.0.0
-
-* No changelog beyond this point. Here be dragons.
+# Master
+
+# 2.0.0
+
+* re-sync with RSVP. Many large performance improvements and bugfixes.
+
+# 1.0.0
+
+* first subset of RSVP
diff --git a/node_modules/es6-promise/LICENSE b/node_modules/es6-promise/LICENSE
index 35599e2a9c..954ec5992d 100644
--- a/node_modules/es6-promise/LICENSE
+++ b/node_modules/es6-promise/LICENSE
@@ -1,19 +1,19 @@
-Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors
-
-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.
+Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors
+
+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.
diff --git a/node_modules/es6-promise/README.md b/node_modules/es6-promise/README.md
index 09a5f4378e..ca8678e2b9 100644
--- a/node_modules/es6-promise/README.md
+++ b/node_modules/es6-promise/README.md
@@ -1,52 +1,61 @@
-# ES6-Promises (subset of [rsvp.js](https://github.com/tildeio/rsvp.js))
-
-This is a polyfill of [ES6 Promises](https://github.com/domenic/promises-unwrapping). The implementation is a subset of [rsvp.js](https://github.com/tildeio/rsvp.js), if you're wanting extra features and more debugging options, check out the [full library](https://github.com/tildeio/rsvp.js).
-
-For API details and how to use promises, see the JavaScript Promises HTML5Rocks article .
-
-## Downloads
-
-* [promise](http://s3.amazonaws.com/es6-promises/promise-1.0.0.js)
-* [promise-min](http://s3.amazonaws.com/es6-promises/promise-1.0.0.min.js) (~2k gzipped)
-
-## Node.js
-
-To install:
-
-```sh
-npm install es6-promise
-```
-
-To use:
-
-```js
-var Promise = require('es6-promise').Promise;
-```
-
-## Usage in IE<10
-
-`catch` is a reserved word in IE<10, meaning `promise.catch(func)` throws a syntax error. To work around this, to a string to access the property:
-
-```js
-promise['catch'](function(err) {
- // ...
-});
-```
-
-Or use `.then` instead:
-
-```js
-promise.then(undefined, function(err) {
- // ...
-});
-```
-
-## Building & Testing
-
-This package uses the [grunt-microlib](https://github.com/thomasboyt/grunt-microlib) package for building.
-
-Custom tasks:
-
-* `grunt test` - Run Mocha tests through Node and PhantomJS.
-* `grunt test:phantom` - Run Mocha tests through PhantomJS (browser build).
-* `grunt test:node` - Run Mocha tests through Node (CommonJS build).
\ No newline at end of file
+# ES6-Promise (subset of [rsvp.js](https://github.com/tildeio/rsvp.js))
+
+This is a polyfill of the [ES6 Promise](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-promise-constructor). The implementation is a subset of [rsvp.js](https://github.com/tildeio/rsvp.js), if you're wanting extra features and more debugging options, check out the [full library](https://github.com/tildeio/rsvp.js).
+
+For API details and how to use promises, see the JavaScript Promises HTML5Rocks article .
+
+## Downloads
+
+* [es6-promise](https://raw.githubusercontent.com/jakearchibald/es6-promise/master/dist/es6-promise.js)
+* [es6-promise-min](https://raw.githubusercontent.com/jakearchibald/es6-promise/master/dist/es6-promise-min.js)
+
+## Node.js
+
+To install:
+
+```sh
+npm install es6-promise
+```
+
+To use:
+
+```js
+var Promise = require('es6-promise').Promise;
+```
+
+## Usage in IE<9
+
+`catch` is a reserved word in IE<9, meaning `promise.catch(func)` throws a syntax error. To work around this, you can use a string to access the property as shown in the following example.
+
+However, please remember that such technique is already provided by most common minifiers, making the resulting code safe for old browsers and production:
+
+```js
+promise['catch'](function(err) {
+ // ...
+});
+```
+
+Or use `.then` instead:
+
+```js
+promise.then(undefined, function(err) {
+ // ...
+});
+```
+
+## Auto-polyfill
+
+To polyfill the global environment (either in Node or in the browser via CommonJS) use the following code snippet:
+
+```js
+require('es6-promise').polyfill();
+```
+
+Notice that we don't assign the result of `polyfill()` to any variable. The `polyfill()` method will patch the global environment (in this case to the `Promise` name) when called.
+
+## Building & Testing
+
+* `npm run build` to build
+* `npm test` to run tests
+* `npm start` to run a build watcher, and webserver to test
+* `npm run test:server` for a testem test runner and watching builder
diff --git a/node_modules/es6-promise/dist/commonjs/main.js b/node_modules/es6-promise/dist/commonjs/main.js
deleted file mode 100644
index 2fd7021107..0000000000
--- a/node_modules/es6-promise/dist/commonjs/main.js
+++ /dev/null
@@ -1,5 +0,0 @@
-"use strict";
-var Promise = require("./promise/promise").Promise;
-var polyfill = require("./promise/polyfill").polyfill;
-exports.Promise = Promise;
-exports.polyfill = polyfill;
\ No newline at end of file
diff --git a/node_modules/es6-promise/dist/commonjs/promise/all.js b/node_modules/es6-promise/dist/commonjs/promise/all.js
deleted file mode 100644
index 86ccd1e50f..0000000000
--- a/node_modules/es6-promise/dist/commonjs/promise/all.js
+++ /dev/null
@@ -1,93 +0,0 @@
-"use strict";
-/* global toString */
-
-var isArray = require("./utils").isArray;
-var isFunction = require("./utils").isFunction;
-
-/**
- Returns a promise that is fulfilled when all the given promises have been
- fulfilled, or rejected if any of them become rejected. The return promise
- is fulfilled with an array that gives all the values in the order they were
- passed in the `promises` array argument.
-
- Example:
-
- ```javascript
- var promise1 = RSVP.resolve(1);
- var promise2 = RSVP.resolve(2);
- var promise3 = RSVP.resolve(3);
- var promises = [ promise1, promise2, promise3 ];
-
- RSVP.all(promises).then(function(array){
- // The array here would be [ 1, 2, 3 ];
- });
- ```
-
- If any of the `promises` given to `RSVP.all` are rejected, the first promise
- that is rejected will be given as an argument to the returned promises's
- rejection handler. For example:
-
- Example:
-
- ```javascript
- var promise1 = RSVP.resolve(1);
- var promise2 = RSVP.reject(new Error("2"));
- var promise3 = RSVP.reject(new Error("3"));
- var promises = [ promise1, promise2, promise3 ];
-
- RSVP.all(promises).then(function(array){
- // Code here never runs because there are rejected promises!
- }, function(error) {
- // error.message === "2"
- });
- ```
-
- @method all
- @for RSVP
- @param {Array} promises
- @param {String} label
- @return {Promise} promise that is fulfilled when all `promises` have been
- fulfilled, or rejected if any of them become rejected.
-*/
-function all(promises) {
- /*jshint validthis:true */
- var Promise = this;
-
- if (!isArray(promises)) {
- throw new TypeError('You must pass an array to all.');
- }
-
- return new Promise(function(resolve, reject) {
- var results = [], remaining = promises.length,
- promise;
-
- if (remaining === 0) {
- resolve([]);
- }
-
- function resolver(index) {
- return function(value) {
- resolveAll(index, value);
- };
- }
-
- function resolveAll(index, value) {
- results[index] = value;
- if (--remaining === 0) {
- resolve(results);
- }
- }
-
- for (var i = 0; i < promises.length; i++) {
- promise = promises[i];
-
- if (promise && isFunction(promise.then)) {
- promise.then(resolver(i), reject);
- } else {
- resolveAll(i, promise);
- }
- }
- });
-}
-
-exports.all = all;
\ No newline at end of file
diff --git a/node_modules/es6-promise/dist/commonjs/promise/asap.js b/node_modules/es6-promise/dist/commonjs/promise/asap.js
deleted file mode 100644
index a57575d312..0000000000
--- a/node_modules/es6-promise/dist/commonjs/promise/asap.js
+++ /dev/null
@@ -1,61 +0,0 @@
-"use strict";
-var browserGlobal = (typeof window !== 'undefined') ? window : {};
-var BrowserMutationObserver = browserGlobal.MutationObserver || browserGlobal.WebKitMutationObserver;
-var local = (typeof global !== 'undefined') ? global : (this === undefined? window:this);
-
-// node
-function useNextTick() {
- return function() {
- process.nextTick(flush);
- };
-}
-
-function useMutationObserver() {
- var iterations = 0;
- var observer = new BrowserMutationObserver(flush);
- var node = document.createTextNode('');
- observer.observe(node, { characterData: true });
-
- return function() {
- node.data = (iterations = ++iterations % 2);
- };
-}
-
-function useSetTimeout() {
- return function() {
- local.setTimeout(flush, 1);
- };
-}
-
-var queue = [];
-function flush() {
- for (var i = 0; i < queue.length; i++) {
- var tuple = queue[i];
- var callback = tuple[0], arg = tuple[1];
- callback(arg);
- }
- queue = [];
-}
-
-var scheduleFlush;
-
-// Decide what async method to use to triggering processing of queued callbacks:
-if (typeof process !== 'undefined' && {}.toString.call(process) === '[object process]') {
- scheduleFlush = useNextTick();
-} else if (BrowserMutationObserver) {
- scheduleFlush = useMutationObserver();
-} else {
- scheduleFlush = useSetTimeout();
-}
-
-function asap(callback, arg) {
- var length = queue.push([callback, arg]);
- if (length === 1) {
- // If length is 1, that means that we need to schedule an async flush.
- // If additional callbacks are queued before the queue is flushed, they
- // will be processed by this flush that we are scheduling.
- scheduleFlush();
- }
-}
-
-exports.asap = asap;
\ No newline at end of file
diff --git a/node_modules/es6-promise/dist/commonjs/promise/config.js b/node_modules/es6-promise/dist/commonjs/promise/config.js
deleted file mode 100644
index 1e73f4604b..0000000000
--- a/node_modules/es6-promise/dist/commonjs/promise/config.js
+++ /dev/null
@@ -1,15 +0,0 @@
-"use strict";
-var config = {
- instrument: false
-};
-
-function configure(name, value) {
- if (arguments.length === 2) {
- config[name] = value;
- } else {
- return config[name];
- }
-}
-
-exports.config = config;
-exports.configure = configure;
\ No newline at end of file
diff --git a/node_modules/es6-promise/dist/commonjs/promise/polyfill.js b/node_modules/es6-promise/dist/commonjs/promise/polyfill.js
deleted file mode 100644
index da5c309981..0000000000
--- a/node_modules/es6-promise/dist/commonjs/promise/polyfill.js
+++ /dev/null
@@ -1,38 +0,0 @@
-"use strict";
-/*global self*/
-var RSVPPromise = require("./promise").Promise;
-var isFunction = require("./utils").isFunction;
-
-function polyfill() {
- var local;
-
- if (typeof global !== 'undefined') {
- local = global;
- } else if (typeof window !== 'undefined' && window.document) {
- local = window;
- } else {
- local = self;
- }
-
- var es6PromiseSupport =
- "Promise" in local &&
- // Some of these methods are missing from
- // Firefox/Chrome experimental implementations
- "resolve" in local.Promise &&
- "reject" in local.Promise &&
- "all" in local.Promise &&
- "race" in local.Promise &&
- // Older version of the spec had a resolver object
- // as the arg rather than a function
- (function() {
- var resolve;
- new local.Promise(function(r) { resolve = r; });
- return isFunction(resolve);
- }());
-
- if (!es6PromiseSupport) {
- local.Promise = RSVPPromise;
- }
-}
-
-exports.polyfill = polyfill;
\ No newline at end of file
diff --git a/node_modules/es6-promise/dist/commonjs/promise/promise.js b/node_modules/es6-promise/dist/commonjs/promise/promise.js
deleted file mode 100644
index 7fc04fa894..0000000000
--- a/node_modules/es6-promise/dist/commonjs/promise/promise.js
+++ /dev/null
@@ -1,211 +0,0 @@
-"use strict";
-var config = require("./config").config;
-var configure = require("./config").configure;
-var objectOrFunction = require("./utils").objectOrFunction;
-var isFunction = require("./utils").isFunction;
-var now = require("./utils").now;
-var all = require("./all").all;
-var race = require("./race").race;
-var staticResolve = require("./resolve").resolve;
-var staticReject = require("./reject").reject;
-var asap = require("./asap").asap;
-
-var counter = 0;
-
-config.async = asap; // default async is asap;
-
-function Promise(resolver) {
- if (!isFunction(resolver)) {
- throw new TypeError('You must pass a resolver function as the first argument to the promise constructor');
- }
-
- if (!(this instanceof Promise)) {
- throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.");
- }
-
- this._subscribers = [];
-
- invokeResolver(resolver, this);
-}
-
-function invokeResolver(resolver, promise) {
- function resolvePromise(value) {
- resolve(promise, value);
- }
-
- function rejectPromise(reason) {
- reject(promise, reason);
- }
-
- try {
- resolver(resolvePromise, rejectPromise);
- } catch(e) {
- rejectPromise(e);
- }
-}
-
-function invokeCallback(settled, promise, callback, detail) {
- var hasCallback = isFunction(callback),
- value, error, succeeded, failed;
-
- if (hasCallback) {
- try {
- value = callback(detail);
- succeeded = true;
- } catch(e) {
- failed = true;
- error = e;
- }
- } else {
- value = detail;
- succeeded = true;
- }
-
- if (handleThenable(promise, value)) {
- return;
- } else if (hasCallback && succeeded) {
- resolve(promise, value);
- } else if (failed) {
- reject(promise, error);
- } else if (settled === FULFILLED) {
- resolve(promise, value);
- } else if (settled === REJECTED) {
- reject(promise, value);
- }
-}
-
-var PENDING = void 0;
-var SEALED = 0;
-var FULFILLED = 1;
-var REJECTED = 2;
-
-function subscribe(parent, child, onFulfillment, onRejection) {
- var subscribers = parent._subscribers;
- var length = subscribers.length;
-
- subscribers[length] = child;
- subscribers[length + FULFILLED] = onFulfillment;
- subscribers[length + REJECTED] = onRejection;
-}
-
-function publish(promise, settled) {
- var child, callback, subscribers = promise._subscribers, detail = promise._detail;
-
- for (var i = 0; i < subscribers.length; i += 3) {
- child = subscribers[i];
- callback = subscribers[i + settled];
-
- invokeCallback(settled, child, callback, detail);
- }
-
- promise._subscribers = null;
-}
-
-Promise.prototype = {
- constructor: Promise,
-
- _state: undefined,
- _detail: undefined,
- _subscribers: undefined,
-
- then: function(onFulfillment, onRejection) {
- var promise = this;
-
- var thenPromise = new this.constructor(function() {});
-
- if (this._state) {
- var callbacks = arguments;
- config.async(function invokePromiseCallback() {
- invokeCallback(promise._state, thenPromise, callbacks[promise._state - 1], promise._detail);
- });
- } else {
- subscribe(this, thenPromise, onFulfillment, onRejection);
- }
-
- return thenPromise;
- },
-
- 'catch': function(onRejection) {
- return this.then(null, onRejection);
- }
-};
-
-Promise.all = all;
-Promise.race = race;
-Promise.resolve = staticResolve;
-Promise.reject = staticReject;
-
-function handleThenable(promise, value) {
- var then = null,
- resolved;
-
- try {
- if (promise === value) {
- throw new TypeError("A promises callback cannot return that same promise.");
- }
-
- if (objectOrFunction(value)) {
- then = value.then;
-
- if (isFunction(then)) {
- then.call(value, function(val) {
- if (resolved) { return true; }
- resolved = true;
-
- if (value !== val) {
- resolve(promise, val);
- } else {
- fulfill(promise, val);
- }
- }, function(val) {
- if (resolved) { return true; }
- resolved = true;
-
- reject(promise, val);
- });
-
- return true;
- }
- }
- } catch (error) {
- if (resolved) { return true; }
- reject(promise, error);
- return true;
- }
-
- return false;
-}
-
-function resolve(promise, value) {
- if (promise === value) {
- fulfill(promise, value);
- } else if (!handleThenable(promise, value)) {
- fulfill(promise, value);
- }
-}
-
-function fulfill(promise, value) {
- if (promise._state !== PENDING) { return; }
- promise._state = SEALED;
- promise._detail = value;
-
- config.async(publishFulfillment, promise);
-}
-
-function reject(promise, reason) {
- if (promise._state !== PENDING) { return; }
- promise._state = SEALED;
- promise._detail = reason;
-
- config.async(publishRejection, promise);
-}
-
-function publishFulfillment(promise) {
- publish(promise, promise._state = FULFILLED);
-}
-
-function publishRejection(promise) {
- publish(promise, promise._state = REJECTED);
-}
-
-exports.Promise = Promise;
\ No newline at end of file
diff --git a/node_modules/es6-promise/dist/commonjs/promise/race.js b/node_modules/es6-promise/dist/commonjs/promise/race.js
deleted file mode 100644
index 9a21f873bd..0000000000
--- a/node_modules/es6-promise/dist/commonjs/promise/race.js
+++ /dev/null
@@ -1,89 +0,0 @@
-"use strict";
-/* global toString */
-var isArray = require("./utils").isArray;
-
-/**
- `RSVP.race` allows you to watch a series of promises and act as soon as the
- first promise given to the `promises` argument fulfills or rejects.
-
- Example:
-
- ```javascript
- var promise1 = new RSVP.Promise(function(resolve, reject){
- setTimeout(function(){
- resolve("promise 1");
- }, 200);
- });
-
- var promise2 = new RSVP.Promise(function(resolve, reject){
- setTimeout(function(){
- resolve("promise 2");
- }, 100);
- });
-
- RSVP.race([promise1, promise2]).then(function(result){
- // result === "promise 2" because it was resolved before promise1
- // was resolved.
- });
- ```
-
- `RSVP.race` is deterministic in that only the state of the first completed
- promise matters. For example, even if other promises given to the `promises`
- array argument are resolved, but the first completed promise has become
- rejected before the other promises became fulfilled, the returned promise
- will become rejected:
-
- ```javascript
- var promise1 = new RSVP.Promise(function(resolve, reject){
- setTimeout(function(){
- resolve("promise 1");
- }, 200);
- });
-
- var promise2 = new RSVP.Promise(function(resolve, reject){
- setTimeout(function(){
- reject(new Error("promise 2"));
- }, 100);
- });
-
- RSVP.race([promise1, promise2]).then(function(result){
- // Code here never runs because there are rejected promises!
- }, function(reason){
- // reason.message === "promise2" because promise 2 became rejected before
- // promise 1 became fulfilled
- });
- ```
-
- @method race
- @for RSVP
- @param {Array} promises array of promises to observe
- @param {String} label optional string for describing the promise returned.
- Useful for tooling.
- @return {Promise} a promise that becomes fulfilled with the value the first
- completed promises is resolved with if the first completed promise was
- fulfilled, or rejected with the reason that the first completed promise
- was rejected with.
-*/
-function race(promises) {
- /*jshint validthis:true */
- var Promise = this;
-
- if (!isArray(promises)) {
- throw new TypeError('You must pass an array to race.');
- }
- return new Promise(function(resolve, reject) {
- var results = [], promise;
-
- for (var i = 0; i < promises.length; i++) {
- promise = promises[i];
-
- if (promise && typeof promise.then === 'function') {
- promise.then(resolve, reject);
- } else {
- resolve(promise);
- }
- }
- });
-}
-
-exports.race = race;
\ No newline at end of file
diff --git a/node_modules/es6-promise/dist/commonjs/promise/reject.js b/node_modules/es6-promise/dist/commonjs/promise/reject.js
deleted file mode 100644
index d8e90c517f..0000000000
--- a/node_modules/es6-promise/dist/commonjs/promise/reject.js
+++ /dev/null
@@ -1,47 +0,0 @@
-"use strict";
-/**
- `RSVP.reject` returns a promise that will become rejected with the passed
- `reason`. `RSVP.reject` is essentially shorthand for the following:
-
- ```javascript
- var promise = new RSVP.Promise(function(resolve, reject){
- reject(new Error('WHOOPS'));
- });
-
- promise.then(function(value){
- // Code here doesn't run because the promise is rejected!
- }, function(reason){
- // reason.message === 'WHOOPS'
- });
- ```
-
- Instead of writing the above, your code now simply becomes the following:
-
- ```javascript
- var promise = RSVP.reject(new Error('WHOOPS'));
-
- promise.then(function(value){
- // Code here doesn't run because the promise is rejected!
- }, function(reason){
- // reason.message === 'WHOOPS'
- });
- ```
-
- @method reject
- @for RSVP
- @param {Any} reason value that the returned promise will be rejected with.
- @param {String} label optional string for identifying the returned promise.
- Useful for tooling.
- @return {Promise} a promise that will become rejected with the given
- `reason`.
-*/
-function reject(reason) {
- /*jshint validthis:true */
- var Promise = this;
-
- return new Promise(function (resolve, reject) {
- reject(reason);
- });
-}
-
-exports.reject = reject;
\ No newline at end of file
diff --git a/node_modules/es6-promise/dist/commonjs/promise/resolve.js b/node_modules/es6-promise/dist/commonjs/promise/resolve.js
deleted file mode 100644
index 930fd00d3c..0000000000
--- a/node_modules/es6-promise/dist/commonjs/promise/resolve.js
+++ /dev/null
@@ -1,15 +0,0 @@
-"use strict";
-function resolve(value) {
- /*jshint validthis:true */
- if (value && typeof value === 'object' && value.constructor === this) {
- return value;
- }
-
- var Promise = this;
-
- return new Promise(function(resolve) {
- resolve(value);
- });
-}
-
-exports.resolve = resolve;
\ No newline at end of file
diff --git a/node_modules/es6-promise/dist/commonjs/promise/utils.js b/node_modules/es6-promise/dist/commonjs/promise/utils.js
deleted file mode 100644
index 7791c2b2b4..0000000000
--- a/node_modules/es6-promise/dist/commonjs/promise/utils.js
+++ /dev/null
@@ -1,22 +0,0 @@
-"use strict";
-function objectOrFunction(x) {
- return isFunction(x) || (typeof x === "object" && x !== null);
-}
-
-function isFunction(x) {
- return typeof x === "function";
-}
-
-function isArray(x) {
- return Object.prototype.toString.call(x) === "[object Array]";
-}
-
-// Date.now is not available in browsers < IE9
-// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/now#Compatibility
-var now = Date.now || function() { return new Date().getTime(); };
-
-
-exports.objectOrFunction = objectOrFunction;
-exports.isFunction = isFunction;
-exports.isArray = isArray;
-exports.now = now;
\ No newline at end of file
diff --git a/node_modules/es6-promise/dist/es6-promise.js b/node_modules/es6-promise/dist/es6-promise.js
new file mode 100644
index 0000000000..308f3acb2d
--- /dev/null
+++ b/node_modules/es6-promise/dist/es6-promise.js
@@ -0,0 +1,957 @@
+/*!
+ * @overview es6-promise - a tiny implementation of Promises/A+.
+ * @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald)
+ * @license Licensed under MIT license
+ * See https://raw.githubusercontent.com/jakearchibald/es6-promise/master/LICENSE
+ * @version 2.1.1
+ */
+
+(function() {
+ "use strict";
+ function lib$es6$promise$utils$$objectOrFunction(x) {
+ return typeof x === 'function' || (typeof x === 'object' && x !== null);
+ }
+
+ function lib$es6$promise$utils$$isFunction(x) {
+ return typeof x === 'function';
+ }
+
+ function lib$es6$promise$utils$$isMaybeThenable(x) {
+ return typeof x === 'object' && x !== null;
+ }
+
+ var lib$es6$promise$utils$$_isArray;
+ if (!Array.isArray) {
+ lib$es6$promise$utils$$_isArray = function (x) {
+ return Object.prototype.toString.call(x) === '[object Array]';
+ };
+ } else {
+ lib$es6$promise$utils$$_isArray = Array.isArray;
+ }
+
+ var lib$es6$promise$utils$$isArray = lib$es6$promise$utils$$_isArray;
+ var lib$es6$promise$asap$$len = 0;
+ var lib$es6$promise$asap$$toString = {}.toString;
+ var lib$es6$promise$asap$$vertxNext;
+ function lib$es6$promise$asap$$asap(callback, arg) {
+ lib$es6$promise$asap$$queue[lib$es6$promise$asap$$len] = callback;
+ lib$es6$promise$asap$$queue[lib$es6$promise$asap$$len + 1] = arg;
+ lib$es6$promise$asap$$len += 2;
+ if (lib$es6$promise$asap$$len === 2) {
+ // If len is 2, that means that we need to schedule an async flush.
+ // If additional callbacks are queued before the queue is flushed, they
+ // will be processed by this flush that we are scheduling.
+ lib$es6$promise$asap$$scheduleFlush();
+ }
+ }
+
+ var lib$es6$promise$asap$$default = lib$es6$promise$asap$$asap;
+
+ var lib$es6$promise$asap$$browserWindow = (typeof window !== 'undefined') ? window : undefined;
+ var lib$es6$promise$asap$$browserGlobal = lib$es6$promise$asap$$browserWindow || {};
+ var lib$es6$promise$asap$$BrowserMutationObserver = lib$es6$promise$asap$$browserGlobal.MutationObserver || lib$es6$promise$asap$$browserGlobal.WebKitMutationObserver;
+ var lib$es6$promise$asap$$isNode = typeof process !== 'undefined' && {}.toString.call(process) === '[object process]';
+
+ // test for web worker but not in IE10
+ var lib$es6$promise$asap$$isWorker = typeof Uint8ClampedArray !== 'undefined' &&
+ typeof importScripts !== 'undefined' &&
+ typeof MessageChannel !== 'undefined';
+
+ // node
+ function lib$es6$promise$asap$$useNextTick() {
+ var nextTick = process.nextTick;
+ // node version 0.10.x displays a deprecation warning when nextTick is used recursively
+ // setImmediate should be used instead instead
+ var version = process.versions.node.match(/^(?:(\d+)\.)?(?:(\d+)\.)?(\*|\d+)$/);
+ if (Array.isArray(version) && version[1] === '0' && version[2] === '10') {
+ nextTick = setImmediate;
+ }
+ return function() {
+ nextTick(lib$es6$promise$asap$$flush);
+ };
+ }
+
+ // vertx
+ function lib$es6$promise$asap$$useVertxTimer() {
+ return function() {
+ lib$es6$promise$asap$$vertxNext(lib$es6$promise$asap$$flush);
+ };
+ }
+
+ function lib$es6$promise$asap$$useMutationObserver() {
+ var iterations = 0;
+ var observer = new lib$es6$promise$asap$$BrowserMutationObserver(lib$es6$promise$asap$$flush);
+ var node = document.createTextNode('');
+ observer.observe(node, { characterData: true });
+
+ return function() {
+ node.data = (iterations = ++iterations % 2);
+ };
+ }
+
+ // web worker
+ function lib$es6$promise$asap$$useMessageChannel() {
+ var channel = new MessageChannel();
+ channel.port1.onmessage = lib$es6$promise$asap$$flush;
+ return function () {
+ channel.port2.postMessage(0);
+ };
+ }
+
+ function lib$es6$promise$asap$$useSetTimeout() {
+ return function() {
+ setTimeout(lib$es6$promise$asap$$flush, 1);
+ };
+ }
+
+ var lib$es6$promise$asap$$queue = new Array(1000);
+ function lib$es6$promise$asap$$flush() {
+ for (var i = 0; i < lib$es6$promise$asap$$len; i+=2) {
+ var callback = lib$es6$promise$asap$$queue[i];
+ var arg = lib$es6$promise$asap$$queue[i+1];
+
+ callback(arg);
+
+ lib$es6$promise$asap$$queue[i] = undefined;
+ lib$es6$promise$asap$$queue[i+1] = undefined;
+ }
+
+ lib$es6$promise$asap$$len = 0;
+ }
+
+ function lib$es6$promise$asap$$attemptVertex() {
+ try {
+ var r = require;
+ var vertx = r('vertx');
+ lib$es6$promise$asap$$vertxNext = vertx.runOnLoop || vertx.runOnContext;
+ return lib$es6$promise$asap$$useVertxTimer();
+ } catch(e) {
+ return lib$es6$promise$asap$$useSetTimeout();
+ }
+ }
+
+ var lib$es6$promise$asap$$scheduleFlush;
+ // Decide what async method to use to triggering processing of queued callbacks:
+ if (lib$es6$promise$asap$$isNode) {
+ lib$es6$promise$asap$$scheduleFlush = lib$es6$promise$asap$$useNextTick();
+ } else if (lib$es6$promise$asap$$BrowserMutationObserver) {
+ lib$es6$promise$asap$$scheduleFlush = lib$es6$promise$asap$$useMutationObserver();
+ } else if (lib$es6$promise$asap$$isWorker) {
+ lib$es6$promise$asap$$scheduleFlush = lib$es6$promise$asap$$useMessageChannel();
+ } else if (lib$es6$promise$asap$$browserWindow === undefined && typeof require === 'function') {
+ lib$es6$promise$asap$$scheduleFlush = lib$es6$promise$asap$$attemptVertex();
+ } else {
+ lib$es6$promise$asap$$scheduleFlush = lib$es6$promise$asap$$useSetTimeout();
+ }
+
+ function lib$es6$promise$$internal$$noop() {}
+
+ var lib$es6$promise$$internal$$PENDING = void 0;
+ var lib$es6$promise$$internal$$FULFILLED = 1;
+ var lib$es6$promise$$internal$$REJECTED = 2;
+
+ var lib$es6$promise$$internal$$GET_THEN_ERROR = new lib$es6$promise$$internal$$ErrorObject();
+
+ function lib$es6$promise$$internal$$selfFullfillment() {
+ return new TypeError("You cannot resolve a promise with itself");
+ }
+
+ function lib$es6$promise$$internal$$cannotReturnOwn() {
+ return new TypeError('A promises callback cannot return that same promise.');
+ }
+
+ function lib$es6$promise$$internal$$getThen(promise) {
+ try {
+ return promise.then;
+ } catch(error) {
+ lib$es6$promise$$internal$$GET_THEN_ERROR.error = error;
+ return lib$es6$promise$$internal$$GET_THEN_ERROR;
+ }
+ }
+
+ function lib$es6$promise$$internal$$tryThen(then, value, fulfillmentHandler, rejectionHandler) {
+ try {
+ then.call(value, fulfillmentHandler, rejectionHandler);
+ } catch(e) {
+ return e;
+ }
+ }
+
+ function lib$es6$promise$$internal$$handleForeignThenable(promise, thenable, then) {
+ lib$es6$promise$asap$$default(function(promise) {
+ var sealed = false;
+ var error = lib$es6$promise$$internal$$tryThen(then, thenable, function(value) {
+ if (sealed) { return; }
+ sealed = true;
+ if (thenable !== value) {
+ lib$es6$promise$$internal$$resolve(promise, value);
+ } else {
+ lib$es6$promise$$internal$$fulfill(promise, value);
+ }
+ }, function(reason) {
+ if (sealed) { return; }
+ sealed = true;
+
+ lib$es6$promise$$internal$$reject(promise, reason);
+ }, 'Settle: ' + (promise._label || ' unknown promise'));
+
+ if (!sealed && error) {
+ sealed = true;
+ lib$es6$promise$$internal$$reject(promise, error);
+ }
+ }, promise);
+ }
+
+ function lib$es6$promise$$internal$$handleOwnThenable(promise, thenable) {
+ if (thenable._state === lib$es6$promise$$internal$$FULFILLED) {
+ lib$es6$promise$$internal$$fulfill(promise, thenable._result);
+ } else if (thenable._state === lib$es6$promise$$internal$$REJECTED) {
+ lib$es6$promise$$internal$$reject(promise, thenable._result);
+ } else {
+ lib$es6$promise$$internal$$subscribe(thenable, undefined, function(value) {
+ lib$es6$promise$$internal$$resolve(promise, value);
+ }, function(reason) {
+ lib$es6$promise$$internal$$reject(promise, reason);
+ });
+ }
+ }
+
+ function lib$es6$promise$$internal$$handleMaybeThenable(promise, maybeThenable) {
+ if (maybeThenable.constructor === promise.constructor) {
+ lib$es6$promise$$internal$$handleOwnThenable(promise, maybeThenable);
+ } else {
+ var then = lib$es6$promise$$internal$$getThen(maybeThenable);
+
+ if (then === lib$es6$promise$$internal$$GET_THEN_ERROR) {
+ lib$es6$promise$$internal$$reject(promise, lib$es6$promise$$internal$$GET_THEN_ERROR.error);
+ } else if (then === undefined) {
+ lib$es6$promise$$internal$$fulfill(promise, maybeThenable);
+ } else if (lib$es6$promise$utils$$isFunction(then)) {
+ lib$es6$promise$$internal$$handleForeignThenable(promise, maybeThenable, then);
+ } else {
+ lib$es6$promise$$internal$$fulfill(promise, maybeThenable);
+ }
+ }
+ }
+
+ function lib$es6$promise$$internal$$resolve(promise, value) {
+ if (promise === value) {
+ lib$es6$promise$$internal$$reject(promise, lib$es6$promise$$internal$$selfFullfillment());
+ } else if (lib$es6$promise$utils$$objectOrFunction(value)) {
+ lib$es6$promise$$internal$$handleMaybeThenable(promise, value);
+ } else {
+ lib$es6$promise$$internal$$fulfill(promise, value);
+ }
+ }
+
+ function lib$es6$promise$$internal$$publishRejection(promise) {
+ if (promise._onerror) {
+ promise._onerror(promise._result);
+ }
+
+ lib$es6$promise$$internal$$publish(promise);
+ }
+
+ function lib$es6$promise$$internal$$fulfill(promise, value) {
+ if (promise._state !== lib$es6$promise$$internal$$PENDING) { return; }
+
+ promise._result = value;
+ promise._state = lib$es6$promise$$internal$$FULFILLED;
+
+ if (promise._subscribers.length !== 0) {
+ lib$es6$promise$asap$$default(lib$es6$promise$$internal$$publish, promise);
+ }
+ }
+
+ function lib$es6$promise$$internal$$reject(promise, reason) {
+ if (promise._state !== lib$es6$promise$$internal$$PENDING) { return; }
+ promise._state = lib$es6$promise$$internal$$REJECTED;
+ promise._result = reason;
+
+ lib$es6$promise$asap$$default(lib$es6$promise$$internal$$publishRejection, promise);
+ }
+
+ function lib$es6$promise$$internal$$subscribe(parent, child, onFulfillment, onRejection) {
+ var subscribers = parent._subscribers;
+ var length = subscribers.length;
+
+ parent._onerror = null;
+
+ subscribers[length] = child;
+ subscribers[length + lib$es6$promise$$internal$$FULFILLED] = onFulfillment;
+ subscribers[length + lib$es6$promise$$internal$$REJECTED] = onRejection;
+
+ if (length === 0 && parent._state) {
+ lib$es6$promise$asap$$default(lib$es6$promise$$internal$$publish, parent);
+ }
+ }
+
+ function lib$es6$promise$$internal$$publish(promise) {
+ var subscribers = promise._subscribers;
+ var settled = promise._state;
+
+ if (subscribers.length === 0) { return; }
+
+ var child, callback, detail = promise._result;
+
+ for (var i = 0; i < subscribers.length; i += 3) {
+ child = subscribers[i];
+ callback = subscribers[i + settled];
+
+ if (child) {
+ lib$es6$promise$$internal$$invokeCallback(settled, child, callback, detail);
+ } else {
+ callback(detail);
+ }
+ }
+
+ promise._subscribers.length = 0;
+ }
+
+ function lib$es6$promise$$internal$$ErrorObject() {
+ this.error = null;
+ }
+
+ var lib$es6$promise$$internal$$TRY_CATCH_ERROR = new lib$es6$promise$$internal$$ErrorObject();
+
+ function lib$es6$promise$$internal$$tryCatch(callback, detail) {
+ try {
+ return callback(detail);
+ } catch(e) {
+ lib$es6$promise$$internal$$TRY_CATCH_ERROR.error = e;
+ return lib$es6$promise$$internal$$TRY_CATCH_ERROR;
+ }
+ }
+
+ function lib$es6$promise$$internal$$invokeCallback(settled, promise, callback, detail) {
+ var hasCallback = lib$es6$promise$utils$$isFunction(callback),
+ value, error, succeeded, failed;
+
+ if (hasCallback) {
+ value = lib$es6$promise$$internal$$tryCatch(callback, detail);
+
+ if (value === lib$es6$promise$$internal$$TRY_CATCH_ERROR) {
+ failed = true;
+ error = value.error;
+ value = null;
+ } else {
+ succeeded = true;
+ }
+
+ if (promise === value) {
+ lib$es6$promise$$internal$$reject(promise, lib$es6$promise$$internal$$cannotReturnOwn());
+ return;
+ }
+
+ } else {
+ value = detail;
+ succeeded = true;
+ }
+
+ if (promise._state !== lib$es6$promise$$internal$$PENDING) {
+ // noop
+ } else if (hasCallback && succeeded) {
+ lib$es6$promise$$internal$$resolve(promise, value);
+ } else if (failed) {
+ lib$es6$promise$$internal$$reject(promise, error);
+ } else if (settled === lib$es6$promise$$internal$$FULFILLED) {
+ lib$es6$promise$$internal$$fulfill(promise, value);
+ } else if (settled === lib$es6$promise$$internal$$REJECTED) {
+ lib$es6$promise$$internal$$reject(promise, value);
+ }
+ }
+
+ function lib$es6$promise$$internal$$initializePromise(promise, resolver) {
+ try {
+ resolver(function resolvePromise(value){
+ lib$es6$promise$$internal$$resolve(promise, value);
+ }, function rejectPromise(reason) {
+ lib$es6$promise$$internal$$reject(promise, reason);
+ });
+ } catch(e) {
+ lib$es6$promise$$internal$$reject(promise, e);
+ }
+ }
+
+ function lib$es6$promise$enumerator$$Enumerator(Constructor, input) {
+ var enumerator = this;
+
+ enumerator._instanceConstructor = Constructor;
+ enumerator.promise = new Constructor(lib$es6$promise$$internal$$noop);
+
+ if (enumerator._validateInput(input)) {
+ enumerator._input = input;
+ enumerator.length = input.length;
+ enumerator._remaining = input.length;
+
+ enumerator._init();
+
+ if (enumerator.length === 0) {
+ lib$es6$promise$$internal$$fulfill(enumerator.promise, enumerator._result);
+ } else {
+ enumerator.length = enumerator.length || 0;
+ enumerator._enumerate();
+ if (enumerator._remaining === 0) {
+ lib$es6$promise$$internal$$fulfill(enumerator.promise, enumerator._result);
+ }
+ }
+ } else {
+ lib$es6$promise$$internal$$reject(enumerator.promise, enumerator._validationError());
+ }
+ }
+
+ lib$es6$promise$enumerator$$Enumerator.prototype._validateInput = function(input) {
+ return lib$es6$promise$utils$$isArray(input);
+ };
+
+ lib$es6$promise$enumerator$$Enumerator.prototype._validationError = function() {
+ return new Error('Array Methods must be provided an Array');
+ };
+
+ lib$es6$promise$enumerator$$Enumerator.prototype._init = function() {
+ this._result = new Array(this.length);
+ };
+
+ var lib$es6$promise$enumerator$$default = lib$es6$promise$enumerator$$Enumerator;
+
+ lib$es6$promise$enumerator$$Enumerator.prototype._enumerate = function() {
+ var enumerator = this;
+
+ var length = enumerator.length;
+ var promise = enumerator.promise;
+ var input = enumerator._input;
+
+ for (var i = 0; promise._state === lib$es6$promise$$internal$$PENDING && i < length; i++) {
+ enumerator._eachEntry(input[i], i);
+ }
+ };
+
+ lib$es6$promise$enumerator$$Enumerator.prototype._eachEntry = function(entry, i) {
+ var enumerator = this;
+ var c = enumerator._instanceConstructor;
+
+ if (lib$es6$promise$utils$$isMaybeThenable(entry)) {
+ if (entry.constructor === c && entry._state !== lib$es6$promise$$internal$$PENDING) {
+ entry._onerror = null;
+ enumerator._settledAt(entry._state, i, entry._result);
+ } else {
+ enumerator._willSettleAt(c.resolve(entry), i);
+ }
+ } else {
+ enumerator._remaining--;
+ enumerator._result[i] = entry;
+ }
+ };
+
+ lib$es6$promise$enumerator$$Enumerator.prototype._settledAt = function(state, i, value) {
+ var enumerator = this;
+ var promise = enumerator.promise;
+
+ if (promise._state === lib$es6$promise$$internal$$PENDING) {
+ enumerator._remaining--;
+
+ if (state === lib$es6$promise$$internal$$REJECTED) {
+ lib$es6$promise$$internal$$reject(promise, value);
+ } else {
+ enumerator._result[i] = value;
+ }
+ }
+
+ if (enumerator._remaining === 0) {
+ lib$es6$promise$$internal$$fulfill(promise, enumerator._result);
+ }
+ };
+
+ lib$es6$promise$enumerator$$Enumerator.prototype._willSettleAt = function(promise, i) {
+ var enumerator = this;
+
+ lib$es6$promise$$internal$$subscribe(promise, undefined, function(value) {
+ enumerator._settledAt(lib$es6$promise$$internal$$FULFILLED, i, value);
+ }, function(reason) {
+ enumerator._settledAt(lib$es6$promise$$internal$$REJECTED, i, reason);
+ });
+ };
+ function lib$es6$promise$promise$all$$all(entries) {
+ return new lib$es6$promise$enumerator$$default(this, entries).promise;
+ }
+ var lib$es6$promise$promise$all$$default = lib$es6$promise$promise$all$$all;
+ function lib$es6$promise$promise$race$$race(entries) {
+ /*jshint validthis:true */
+ var Constructor = this;
+
+ var promise = new Constructor(lib$es6$promise$$internal$$noop);
+
+ if (!lib$es6$promise$utils$$isArray(entries)) {
+ lib$es6$promise$$internal$$reject(promise, new TypeError('You must pass an array to race.'));
+ return promise;
+ }
+
+ var length = entries.length;
+
+ function onFulfillment(value) {
+ lib$es6$promise$$internal$$resolve(promise, value);
+ }
+
+ function onRejection(reason) {
+ lib$es6$promise$$internal$$reject(promise, reason);
+ }
+
+ for (var i = 0; promise._state === lib$es6$promise$$internal$$PENDING && i < length; i++) {
+ lib$es6$promise$$internal$$subscribe(Constructor.resolve(entries[i]), undefined, onFulfillment, onRejection);
+ }
+
+ return promise;
+ }
+ var lib$es6$promise$promise$race$$default = lib$es6$promise$promise$race$$race;
+ function lib$es6$promise$promise$resolve$$resolve(object) {
+ /*jshint validthis:true */
+ var Constructor = this;
+
+ if (object && typeof object === 'object' && object.constructor === Constructor) {
+ return object;
+ }
+
+ var promise = new Constructor(lib$es6$promise$$internal$$noop);
+ lib$es6$promise$$internal$$resolve(promise, object);
+ return promise;
+ }
+ var lib$es6$promise$promise$resolve$$default = lib$es6$promise$promise$resolve$$resolve;
+ function lib$es6$promise$promise$reject$$reject(reason) {
+ /*jshint validthis:true */
+ var Constructor = this;
+ var promise = new Constructor(lib$es6$promise$$internal$$noop);
+ lib$es6$promise$$internal$$reject(promise, reason);
+ return promise;
+ }
+ var lib$es6$promise$promise$reject$$default = lib$es6$promise$promise$reject$$reject;
+
+ var lib$es6$promise$promise$$counter = 0;
+
+ function lib$es6$promise$promise$$needsResolver() {
+ throw new TypeError('You must pass a resolver function as the first argument to the promise constructor');
+ }
+
+ function lib$es6$promise$promise$$needsNew() {
+ throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.");
+ }
+
+ var lib$es6$promise$promise$$default = lib$es6$promise$promise$$Promise;
+ /**
+ Promise objects represent the eventual result of an asynchronous operation. The
+ primary way of interacting with a promise is through its `then` method, which
+ registers callbacks to receive either a promise’s eventual value or the reason
+ why the promise cannot be fulfilled.
+
+ Terminology
+ -----------
+
+ - `promise` is an object or function with a `then` method whose behavior conforms to this specification.
+ - `thenable` is an object or function that defines a `then` method.
+ - `value` is any legal JavaScript value (including undefined, a thenable, or a promise).
+ - `exception` is a value that is thrown using the throw statement.
+ - `reason` is a value that indicates why a promise was rejected.
+ - `settled` the final resting state of a promise, fulfilled or rejected.
+
+ A promise can be in one of three states: pending, fulfilled, or rejected.
+
+ Promises that are fulfilled have a fulfillment value and are in the fulfilled
+ state. Promises that are rejected have a rejection reason and are in the
+ rejected state. A fulfillment value is never a thenable.
+
+ Promises can also be said to *resolve* a value. If this value is also a
+ promise, then the original promise's settled state will match the value's
+ settled state. So a promise that *resolves* a promise that rejects will
+ itself reject, and a promise that *resolves* a promise that fulfills will
+ itself fulfill.
+
+
+ Basic Usage:
+ ------------
+
+ ```js
+ var promise = new Promise(function(resolve, reject) {
+ // on success
+ resolve(value);
+
+ // on failure
+ reject(reason);
+ });
+
+ promise.then(function(value) {
+ // on fulfillment
+ }, function(reason) {
+ // on rejection
+ });
+ ```
+
+ Advanced Usage:
+ ---------------
+
+ Promises shine when abstracting away asynchronous interactions such as
+ `XMLHttpRequest`s.
+
+ ```js
+ function getJSON(url) {
+ return new Promise(function(resolve, reject){
+ var xhr = new XMLHttpRequest();
+
+ xhr.open('GET', url);
+ xhr.onreadystatechange = handler;
+ xhr.responseType = 'json';
+ xhr.setRequestHeader('Accept', 'application/json');
+ xhr.send();
+
+ function handler() {
+ if (this.readyState === this.DONE) {
+ if (this.status === 200) {
+ resolve(this.response);
+ } else {
+ reject(new Error('getJSON: `' + url + '` failed with status: [' + this.status + ']'));
+ }
+ }
+ };
+ });
+ }
+
+ getJSON('/posts.json').then(function(json) {
+ // on fulfillment
+ }, function(reason) {
+ // on rejection
+ });
+ ```
+
+ Unlike callbacks, promises are great composable primitives.
+
+ ```js
+ Promise.all([
+ getJSON('/posts'),
+ getJSON('/comments')
+ ]).then(function(values){
+ values[0] // => postsJSON
+ values[1] // => commentsJSON
+
+ return values;
+ });
+ ```
+
+ @class Promise
+ @param {function} resolver
+ Useful for tooling.
+ @constructor
+ */
+ function lib$es6$promise$promise$$Promise(resolver) {
+ this._id = lib$es6$promise$promise$$counter++;
+ this._state = undefined;
+ this._result = undefined;
+ this._subscribers = [];
+
+ if (lib$es6$promise$$internal$$noop !== resolver) {
+ if (!lib$es6$promise$utils$$isFunction(resolver)) {
+ lib$es6$promise$promise$$needsResolver();
+ }
+
+ if (!(this instanceof lib$es6$promise$promise$$Promise)) {
+ lib$es6$promise$promise$$needsNew();
+ }
+
+ lib$es6$promise$$internal$$initializePromise(this, resolver);
+ }
+ }
+
+ lib$es6$promise$promise$$Promise.all = lib$es6$promise$promise$all$$default;
+ lib$es6$promise$promise$$Promise.race = lib$es6$promise$promise$race$$default;
+ lib$es6$promise$promise$$Promise.resolve = lib$es6$promise$promise$resolve$$default;
+ lib$es6$promise$promise$$Promise.reject = lib$es6$promise$promise$reject$$default;
+
+ lib$es6$promise$promise$$Promise.prototype = {
+ constructor: lib$es6$promise$promise$$Promise,
+
+ /**
+ The primary way of interacting with a promise is through its `then` method,
+ which registers callbacks to receive either a promise's eventual value or the
+ reason why the promise cannot be fulfilled.
+
+ ```js
+ findUser().then(function(user){
+ // user is available
+ }, function(reason){
+ // user is unavailable, and you are given the reason why
+ });
+ ```
+
+ Chaining
+ --------
+
+ The return value of `then` is itself a promise. This second, 'downstream'
+ promise is resolved with the return value of the first promise's fulfillment
+ or rejection handler, or rejected if the handler throws an exception.
+
+ ```js
+ findUser().then(function (user) {
+ return user.name;
+ }, function (reason) {
+ return 'default name';
+ }).then(function (userName) {
+ // If `findUser` fulfilled, `userName` will be the user's name, otherwise it
+ // will be `'default name'`
+ });
+
+ findUser().then(function (user) {
+ throw new Error('Found user, but still unhappy');
+ }, function (reason) {
+ throw new Error('`findUser` rejected and we're unhappy');
+ }).then(function (value) {
+ // never reached
+ }, function (reason) {
+ // if `findUser` fulfilled, `reason` will be 'Found user, but still unhappy'.
+ // If `findUser` rejected, `reason` will be '`findUser` rejected and we're unhappy'.
+ });
+ ```
+ If the downstream promise does not specify a rejection handler, rejection reasons will be propagated further downstream.
+
+ ```js
+ findUser().then(function (user) {
+ throw new PedagogicalException('Upstream error');
+ }).then(function (value) {
+ // never reached
+ }).then(function (value) {
+ // never reached
+ }, function (reason) {
+ // The `PedgagocialException` is propagated all the way down to here
+ });
+ ```
+
+ Assimilation
+ ------------
+
+ Sometimes the value you want to propagate to a downstream promise can only be
+ retrieved asynchronously. This can be achieved by returning a promise in the
+ fulfillment or rejection handler. The downstream promise will then be pending
+ until the returned promise is settled. This is called *assimilation*.
+
+ ```js
+ findUser().then(function (user) {
+ return findCommentsByAuthor(user);
+ }).then(function (comments) {
+ // The user's comments are now available
+ });
+ ```
+
+ If the assimliated promise rejects, then the downstream promise will also reject.
+
+ ```js
+ findUser().then(function (user) {
+ return findCommentsByAuthor(user);
+ }).then(function (comments) {
+ // If `findCommentsByAuthor` fulfills, we'll have the value here
+ }, function (reason) {
+ // If `findCommentsByAuthor` rejects, we'll have the reason here
+ });
+ ```
+
+ Simple Example
+ --------------
+
+ Synchronous Example
+
+ ```javascript
+ var result;
+
+ try {
+ result = findResult();
+ // success
+ } catch(reason) {
+ // failure
+ }
+ ```
+
+ Errback Example
+
+ ```js
+ findResult(function(result, err){
+ if (err) {
+ // failure
+ } else {
+ // success
+ }
+ });
+ ```
+
+ Promise Example;
+
+ ```javascript
+ findResult().then(function(result){
+ // success
+ }, function(reason){
+ // failure
+ });
+ ```
+
+ Advanced Example
+ --------------
+
+ Synchronous Example
+
+ ```javascript
+ var author, books;
+
+ try {
+ author = findAuthor();
+ books = findBooksByAuthor(author);
+ // success
+ } catch(reason) {
+ // failure
+ }
+ ```
+
+ Errback Example
+
+ ```js
+
+ function foundBooks(books) {
+
+ }
+
+ function failure(reason) {
+
+ }
+
+ findAuthor(function(author, err){
+ if (err) {
+ failure(err);
+ // failure
+ } else {
+ try {
+ findBoooksByAuthor(author, function(books, err) {
+ if (err) {
+ failure(err);
+ } else {
+ try {
+ foundBooks(books);
+ } catch(reason) {
+ failure(reason);
+ }
+ }
+ });
+ } catch(error) {
+ failure(err);
+ }
+ // success
+ }
+ });
+ ```
+
+ Promise Example;
+
+ ```javascript
+ findAuthor().
+ then(findBooksByAuthor).
+ then(function(books){
+ // found books
+ }).catch(function(reason){
+ // something went wrong
+ });
+ ```
+
+ @method then
+ @param {Function} onFulfilled
+ @param {Function} onRejected
+ Useful for tooling.
+ @return {Promise}
+ */
+ then: function(onFulfillment, onRejection) {
+ var parent = this;
+ var state = parent._state;
+
+ if (state === lib$es6$promise$$internal$$FULFILLED && !onFulfillment || state === lib$es6$promise$$internal$$REJECTED && !onRejection) {
+ return this;
+ }
+
+ var child = new this.constructor(lib$es6$promise$$internal$$noop);
+ var result = parent._result;
+
+ if (state) {
+ var callback = arguments[state - 1];
+ lib$es6$promise$asap$$default(function(){
+ lib$es6$promise$$internal$$invokeCallback(state, child, callback, result);
+ });
+ } else {
+ lib$es6$promise$$internal$$subscribe(parent, child, onFulfillment, onRejection);
+ }
+
+ return child;
+ },
+
+ /**
+ `catch` is simply sugar for `then(undefined, onRejection)` which makes it the same
+ as the catch block of a try/catch statement.
+
+ ```js
+ function findAuthor(){
+ throw new Error('couldn't find that author');
+ }
+
+ // synchronous
+ try {
+ findAuthor();
+ } catch(reason) {
+ // something went wrong
+ }
+
+ // async with promises
+ findAuthor().catch(function(reason){
+ // something went wrong
+ });
+ ```
+
+ @method catch
+ @param {Function} onRejection
+ Useful for tooling.
+ @return {Promise}
+ */
+ 'catch': function(onRejection) {
+ return this.then(null, onRejection);
+ }
+ };
+ function lib$es6$promise$polyfill$$polyfill() {
+ var local;
+
+ if (typeof global !== 'undefined') {
+ local = global;
+ } else if (typeof self !== 'undefined') {
+ local = self;
+ } else {
+ try {
+ local = Function('return this')();
+ } catch (e) {
+ throw new Error('polyfill failed because global object is unavailable in this environment');
+ }
+ }
+
+ var P = local.Promise;
+
+ if (P && Object.prototype.toString.call(P.resolve()) === '[object Promise]' && !P.cast) {
+ return;
+ }
+
+ local.Promise = lib$es6$promise$promise$$default;
+ }
+ var lib$es6$promise$polyfill$$default = lib$es6$promise$polyfill$$polyfill;
+
+ var lib$es6$promise$umd$$ES6Promise = {
+ 'Promise': lib$es6$promise$promise$$default,
+ 'polyfill': lib$es6$promise$polyfill$$default
+ };
+
+ /* global define:true module:true window: true */
+ if (typeof define === 'function' && define['amd']) {
+ define(function() { return lib$es6$promise$umd$$ES6Promise; });
+ } else if (typeof module !== 'undefined' && module['exports']) {
+ module['exports'] = lib$es6$promise$umd$$ES6Promise;
+ } else if (typeof this !== 'undefined') {
+ this['ES6Promise'] = lib$es6$promise$umd$$ES6Promise;
+ }
+
+ lib$es6$promise$polyfill$$default();
+}).call(this);
+
diff --git a/node_modules/es6-promise/dist/es6-promise.min.js b/node_modules/es6-promise/dist/es6-promise.min.js
new file mode 100644
index 0000000000..0552e12e17
--- /dev/null
+++ b/node_modules/es6-promise/dist/es6-promise.min.js
@@ -0,0 +1,9 @@
+/*!
+ * @overview es6-promise - a tiny implementation of Promises/A+.
+ * @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald)
+ * @license Licensed under MIT license
+ * See https://raw.githubusercontent.com/jakearchibald/es6-promise/master/LICENSE
+ * @version 2.1.1
+ */
+
+(function(){"use strict";function lib$es6$promise$utils$$objectOrFunction(x){return typeof x==="function"||typeof x==="object"&&x!==null}function lib$es6$promise$utils$$isFunction(x){return typeof x==="function"}function lib$es6$promise$utils$$isMaybeThenable(x){return typeof x==="object"&&x!==null}var lib$es6$promise$utils$$_isArray;if(!Array.isArray){lib$es6$promise$utils$$_isArray=function(x){return Object.prototype.toString.call(x)==="[object Array]"}}else{lib$es6$promise$utils$$_isArray=Array.isArray}var lib$es6$promise$utils$$isArray=lib$es6$promise$utils$$_isArray;var lib$es6$promise$asap$$len=0;var lib$es6$promise$asap$$toString={}.toString;var lib$es6$promise$asap$$vertxNext;function lib$es6$promise$asap$$asap(callback,arg){lib$es6$promise$asap$$queue[lib$es6$promise$asap$$len]=callback;lib$es6$promise$asap$$queue[lib$es6$promise$asap$$len+1]=arg;lib$es6$promise$asap$$len+=2;if(lib$es6$promise$asap$$len===2){lib$es6$promise$asap$$scheduleFlush()}}var lib$es6$promise$asap$$default=lib$es6$promise$asap$$asap;var lib$es6$promise$asap$$browserWindow=typeof window!=="undefined"?window:undefined;var lib$es6$promise$asap$$browserGlobal=lib$es6$promise$asap$$browserWindow||{};var lib$es6$promise$asap$$BrowserMutationObserver=lib$es6$promise$asap$$browserGlobal.MutationObserver||lib$es6$promise$asap$$browserGlobal.WebKitMutationObserver;var lib$es6$promise$asap$$isNode=typeof process!=="undefined"&&{}.toString.call(process)==="[object process]";var lib$es6$promise$asap$$isWorker=typeof Uint8ClampedArray!=="undefined"&&typeof importScripts!=="undefined"&&typeof MessageChannel!=="undefined";function lib$es6$promise$asap$$useNextTick(){var nextTick=process.nextTick;var version=process.versions.node.match(/^(?:(\d+)\.)?(?:(\d+)\.)?(\*|\d+)$/);if(Array.isArray(version)&&version[1]==="0"&&version[2]==="10"){nextTick=setImmediate}return function(){nextTick(lib$es6$promise$asap$$flush)}}function lib$es6$promise$asap$$useVertxTimer(){return function(){lib$es6$promise$asap$$vertxNext(lib$es6$promise$asap$$flush)}}function lib$es6$promise$asap$$useMutationObserver(){var iterations=0;var observer=new lib$es6$promise$asap$$BrowserMutationObserver(lib$es6$promise$asap$$flush);var node=document.createTextNode("");observer.observe(node,{characterData:true});return function(){node.data=iterations=++iterations%2}}function lib$es6$promise$asap$$useMessageChannel(){var channel=new MessageChannel;channel.port1.onmessage=lib$es6$promise$asap$$flush;return function(){channel.port2.postMessage(0)}}function lib$es6$promise$asap$$useSetTimeout(){return function(){setTimeout(lib$es6$promise$asap$$flush,1)}}var lib$es6$promise$asap$$queue=new Array(1e3);function lib$es6$promise$asap$$flush(){for(var i=0;ie;e++){var g=c[e];if(".."===g)d.pop();else{if("."===g)continue;d.push(g)}}return d.join("/")}if(d._eak_seen=e,f[a])return f[a];if(f[a]={},!e[a])throw new Error("Could not find module "+a);for(var g,h=e[a],i=h.deps,j=h.callback,k=[],l=0,m=i.length;m>l;l++)"exports"===i[l]?k.push(g={}):k.push(b(c(i[l])));var n=j.apply(this,k);return f[a]=g||n}}(),a("promise/all",["./utils","exports"],function(a,b){"use strict";function c(a){var b=this;if(!d(a))throw new TypeError("You must pass an array to all.");return new b(function(b,c){function d(a){return function(b){f(a,b)}}function f(a,c){h[a]=c,0===--i&&b(h)}var g,h=[],i=a.length;0===i&&b([]);for(var j=0;j
+//
+// 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 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.
+
+// when used in node, this will actually load the util module we depend on
+// versus loading the builtin util module as happens otherwise
+// this is a bug in node module loading as far as I am concerned
+var util = require('util/');
+
+var pSlice = Array.prototype.slice;
+var hasOwn = Object.prototype.hasOwnProperty;
+
+// 1. The assert module provides functions that throw
+// AssertionError's when particular conditions are not met. The
+// assert module must conform to the following interface.
+
+var assert = module.exports = ok;
+
+// 2. The AssertionError is defined in assert.
+// new assert.AssertionError({ message: message,
+// actual: actual,
+// expected: expected })
+
+assert.AssertionError = function AssertionError(options) {
+ this.name = 'AssertionError';
+ this.actual = options.actual;
+ this.expected = options.expected;
+ this.operator = options.operator;
+ if (options.message) {
+ this.message = options.message;
+ this.generatedMessage = false;
+ } else {
+ this.message = getMessage(this);
+ this.generatedMessage = true;
+ }
+ var stackStartFunction = options.stackStartFunction || fail;
+
+ if (Error.captureStackTrace) {
+ Error.captureStackTrace(this, stackStartFunction);
+ }
+ else {
+ // non v8 browsers so we can have a stacktrace
+ var err = new Error();
+ if (err.stack) {
+ var out = err.stack;
+
+ // try to strip useless frames
+ var fn_name = stackStartFunction.name;
+ var idx = out.indexOf('\n' + fn_name);
+ if (idx >= 0) {
+ // once we have located the function frame
+ // we need to strip out everything before it (and its line)
+ var next_line = out.indexOf('\n', idx + 1);
+ out = out.substring(next_line + 1);
+ }
+
+ this.stack = out;
+ }
+ }
+};
+
+// assert.AssertionError instanceof Error
+util.inherits(assert.AssertionError, Error);
+
+function replacer(key, value) {
+ if (util.isUndefined(value)) {
+ return '' + value;
+ }
+ if (util.isNumber(value) && (isNaN(value) || !isFinite(value))) {
+ return value.toString();
+ }
+ if (util.isFunction(value) || util.isRegExp(value)) {
+ return value.toString();
+ }
+ return value;
+}
+
+function truncate(s, n) {
+ if (util.isString(s)) {
+ return s.length < n ? s : s.slice(0, n);
+ } else {
+ return s;
+ }
+}
+
+function getMessage(self) {
+ return truncate(JSON.stringify(self.actual, replacer), 128) + ' ' +
+ self.operator + ' ' +
+ truncate(JSON.stringify(self.expected, replacer), 128);
+}
+
+// At present only the three keys mentioned above are used and
+// understood by the spec. Implementations or sub modules can pass
+// other keys to the AssertionError's constructor - they will be
+// ignored.
+
+// 3. All of the following functions must throw an AssertionError
+// when a corresponding condition is not met, with a message that
+// may be undefined if not provided. All assertion methods provide
+// both the actual and expected values to the assertion error for
+// display purposes.
+
+function fail(actual, expected, message, operator, stackStartFunction) {
+ throw new assert.AssertionError({
+ message: message,
+ actual: actual,
+ expected: expected,
+ operator: operator,
+ stackStartFunction: stackStartFunction
+ });
+}
+
+// EXTENSION! allows for well behaved errors defined elsewhere.
+assert.fail = fail;
+
+// 4. Pure assertion tests whether a value is truthy, as determined
+// by !!guard.
+// assert.ok(guard, message_opt);
+// This statement is equivalent to assert.equal(true, !!guard,
+// message_opt);. To test strictly for the value true, use
+// assert.strictEqual(true, guard, message_opt);.
+
+function ok(value, message) {
+ if (!value) fail(value, true, message, '==', assert.ok);
+}
+assert.ok = ok;
+
+// 5. The equality assertion tests shallow, coercive equality with
+// ==.
+// assert.equal(actual, expected, message_opt);
+
+assert.equal = function equal(actual, expected, message) {
+ if (actual != expected) fail(actual, expected, message, '==', assert.equal);
+};
+
+// 6. The non-equality assertion tests for whether two objects are not equal
+// with != assert.notEqual(actual, expected, message_opt);
+
+assert.notEqual = function notEqual(actual, expected, message) {
+ if (actual == expected) {
+ fail(actual, expected, message, '!=', assert.notEqual);
+ }
+};
+
+// 7. The equivalence assertion tests a deep equality relation.
+// assert.deepEqual(actual, expected, message_opt);
+
+assert.deepEqual = function deepEqual(actual, expected, message) {
+ if (!_deepEqual(actual, expected)) {
+ fail(actual, expected, message, 'deepEqual', assert.deepEqual);
+ }
+};
+
+function _deepEqual(actual, expected) {
+ // 7.1. All identical values are equivalent, as determined by ===.
+ if (actual === expected) {
+ return true;
+
+ } else if (util.isBuffer(actual) && util.isBuffer(expected)) {
+ if (actual.length != expected.length) return false;
+
+ for (var i = 0; i < actual.length; i++) {
+ if (actual[i] !== expected[i]) return false;
+ }
+
+ return true;
+
+ // 7.2. If the expected value is a Date object, the actual value is
+ // equivalent if it is also a Date object that refers to the same time.
+ } else if (util.isDate(actual) && util.isDate(expected)) {
+ return actual.getTime() === expected.getTime();
+
+ // 7.3 If the expected value is a RegExp object, the actual value is
+ // equivalent if it is also a RegExp object with the same source and
+ // properties (`global`, `multiline`, `lastIndex`, `ignoreCase`).
+ } else if (util.isRegExp(actual) && util.isRegExp(expected)) {
+ return actual.source === expected.source &&
+ actual.global === expected.global &&
+ actual.multiline === expected.multiline &&
+ actual.lastIndex === expected.lastIndex &&
+ actual.ignoreCase === expected.ignoreCase;
+
+ // 7.4. Other pairs that do not both pass typeof value == 'object',
+ // equivalence is determined by ==.
+ } else if (!util.isObject(actual) && !util.isObject(expected)) {
+ return actual == expected;
+
+ // 7.5 For all other Object pairs, including Array objects, equivalence is
+ // determined by having the same number of owned properties (as verified
+ // with Object.prototype.hasOwnProperty.call), the same set of keys
+ // (although not necessarily the same order), equivalent values for every
+ // corresponding key, and an identical 'prototype' property. Note: this
+ // accounts for both named and indexed properties on Arrays.
+ } else {
+ return objEquiv(actual, expected);
+ }
+}
+
+function isArguments(object) {
+ return Object.prototype.toString.call(object) == '[object Arguments]';
+}
+
+function objEquiv(a, b) {
+ if (util.isNullOrUndefined(a) || util.isNullOrUndefined(b))
+ return false;
+ // an identical 'prototype' property.
+ if (a.prototype !== b.prototype) return false;
+ //~~~I've managed to break Object.keys through screwy arguments passing.
+ // Converting to array solves the problem.
+ if (isArguments(a)) {
+ if (!isArguments(b)) {
+ return false;
+ }
+ a = pSlice.call(a);
+ b = pSlice.call(b);
+ return _deepEqual(a, b);
+ }
+ try {
+ var ka = objectKeys(a),
+ kb = objectKeys(b),
+ key, i;
+ } catch (e) {//happens when one is a string literal and the other isn't
+ return false;
+ }
+ // having the same number of owned properties (keys incorporates
+ // hasOwnProperty)
+ if (ka.length != kb.length)
+ return false;
+ //the same set of keys (although not necessarily the same order),
+ ka.sort();
+ kb.sort();
+ //~~~cheap key test
+ for (i = ka.length - 1; i >= 0; i--) {
+ if (ka[i] != kb[i])
+ return false;
+ }
+ //equivalent values for every corresponding key, and
+ //~~~possibly expensive deep test
+ for (i = ka.length - 1; i >= 0; i--) {
+ key = ka[i];
+ if (!_deepEqual(a[key], b[key])) return false;
+ }
+ return true;
+}
+
+// 8. The non-equivalence assertion tests for any deep inequality.
+// assert.notDeepEqual(actual, expected, message_opt);
+
+assert.notDeepEqual = function notDeepEqual(actual, expected, message) {
+ if (_deepEqual(actual, expected)) {
+ fail(actual, expected, message, 'notDeepEqual', assert.notDeepEqual);
+ }
+};
+
+// 9. The strict equality assertion tests strict equality, as determined by ===.
+// assert.strictEqual(actual, expected, message_opt);
+
+assert.strictEqual = function strictEqual(actual, expected, message) {
+ if (actual !== expected) {
+ fail(actual, expected, message, '===', assert.strictEqual);
+ }
+};
+
+// 10. The strict non-equality assertion tests for strict inequality, as
+// determined by !==. assert.notStrictEqual(actual, expected, message_opt);
+
+assert.notStrictEqual = function notStrictEqual(actual, expected, message) {
+ if (actual === expected) {
+ fail(actual, expected, message, '!==', assert.notStrictEqual);
+ }
+};
+
+function expectedException(actual, expected) {
+ if (!actual || !expected) {
+ return false;
+ }
+
+ if (Object.prototype.toString.call(expected) == '[object RegExp]') {
+ return expected.test(actual);
+ } else if (actual instanceof expected) {
+ return true;
+ } else if (expected.call({}, actual) === true) {
+ return true;
+ }
+
+ return false;
+}
+
+function _throws(shouldThrow, block, expected, message) {
+ var actual;
+
+ if (util.isString(expected)) {
+ message = expected;
+ expected = null;
+ }
+
+ try {
+ block();
+ } catch (e) {
+ actual = e;
+ }
+
+ message = (expected && expected.name ? ' (' + expected.name + ').' : '.') +
+ (message ? ' ' + message : '.');
+
+ if (shouldThrow && !actual) {
+ fail(actual, expected, 'Missing expected exception' + message);
+ }
+
+ if (!shouldThrow && expectedException(actual, expected)) {
+ fail(actual, expected, 'Got unwanted exception' + message);
+ }
+
+ if ((shouldThrow && actual && expected &&
+ !expectedException(actual, expected)) || (!shouldThrow && actual)) {
+ throw actual;
+ }
+}
+
+// 11. Expected to throw an error:
+// assert.throws(block, Error_opt, message_opt);
+
+assert.throws = function(block, /*optional*/error, /*optional*/message) {
+ _throws.apply(this, [true].concat(pSlice.call(arguments)));
+};
+
+// EXTENSION! This is annoying to write outside this module.
+assert.doesNotThrow = function(block, /*optional*/message) {
+ _throws.apply(this, [false].concat(pSlice.call(arguments)));
+};
+
+assert.ifError = function(err) { if (err) {throw err;}};
+
+var objectKeys = Object.keys || function (obj) {
+ var keys = [];
+ for (var key in obj) {
+ if (hasOwn.call(obj, key)) keys.push(key);
+ }
+ return keys;
+};
+
+},{"util/":6}],3:[function(require,module,exports){
+if (typeof Object.create === 'function') {
+ // implementation from standard node.js 'util' module
+ module.exports = function inherits(ctor, superCtor) {
+ ctor.super_ = superCtor
+ ctor.prototype = Object.create(superCtor.prototype, {
+ constructor: {
+ value: ctor,
+ enumerable: false,
+ writable: true,
+ configurable: true
+ }
+ });
+ };
+} else {
+ // old school shim for old browsers
+ module.exports = function inherits(ctor, superCtor) {
+ ctor.super_ = superCtor
+ var TempCtor = function () {}
+ TempCtor.prototype = superCtor.prototype
+ ctor.prototype = new TempCtor()
+ ctor.prototype.constructor = ctor
+ }
+}
+
+},{}],4:[function(require,module,exports){
+// shim for using process in browser
+
+var process = module.exports = {};
+
+process.nextTick = (function () {
+ var canSetImmediate = typeof window !== 'undefined'
+ && window.setImmediate;
+ var canMutationObserver = typeof window !== 'undefined'
+ && window.MutationObserver;
+ var canPost = typeof window !== 'undefined'
+ && window.postMessage && window.addEventListener
+ ;
+
+ if (canSetImmediate) {
+ return function (f) { return window.setImmediate(f) };
+ }
+
+ var queue = [];
+
+ if (canMutationObserver) {
+ var hiddenDiv = document.createElement("div");
+ var observer = new MutationObserver(function () {
+ var queueList = queue.slice();
+ queue.length = 0;
+ queueList.forEach(function (fn) {
+ fn();
+ });
+ });
+
+ observer.observe(hiddenDiv, { attributes: true });
+
+ return function nextTick(fn) {
+ if (!queue.length) {
+ hiddenDiv.setAttribute('yes', 'no');
+ }
+ queue.push(fn);
+ };
+ }
+
+ if (canPost) {
+ window.addEventListener('message', function (ev) {
+ var source = ev.source;
+ if ((source === window || source === null) && ev.data === 'process-tick') {
+ ev.stopPropagation();
+ if (queue.length > 0) {
+ var fn = queue.shift();
+ fn();
+ }
+ }
+ }, true);
+
+ return function nextTick(fn) {
+ queue.push(fn);
+ window.postMessage('process-tick', '*');
+ };
+ }
+
+ return function nextTick(fn) {
+ setTimeout(fn, 0);
+ };
+})();
+
+process.title = 'browser';
+process.browser = true;
+process.env = {};
+process.argv = [];
+
+function noop() {}
+
+process.on = noop;
+process.addListener = noop;
+process.once = noop;
+process.off = noop;
+process.removeListener = noop;
+process.removeAllListeners = noop;
+process.emit = noop;
+
+process.binding = function (name) {
+ throw new Error('process.binding is not supported');
+};
+
+// TODO(shtylman)
+process.cwd = function () { return '/' };
+process.chdir = function (dir) {
+ throw new Error('process.chdir is not supported');
+};
+
+},{}],5:[function(require,module,exports){
+module.exports = function isBuffer(arg) {
+ return arg && typeof arg === 'object'
+ && typeof arg.copy === 'function'
+ && typeof arg.fill === 'function'
+ && typeof arg.readUInt8 === 'function';
+}
+},{}],6:[function(require,module,exports){
+(function (process,global){
+// Copyright Joyent, Inc. and other Node contributors.
+//
+// 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.
+
+var formatRegExp = /%[sdj%]/g;
+exports.format = function(f) {
+ if (!isString(f)) {
+ var objects = [];
+ for (var i = 0; i < arguments.length; i++) {
+ objects.push(inspect(arguments[i]));
+ }
+ return objects.join(' ');
+ }
+
+ var i = 1;
+ var args = arguments;
+ var len = args.length;
+ var str = String(f).replace(formatRegExp, function(x) {
+ if (x === '%%') return '%';
+ if (i >= len) return x;
+ switch (x) {
+ case '%s': return String(args[i++]);
+ case '%d': return Number(args[i++]);
+ case '%j':
+ try {
+ return JSON.stringify(args[i++]);
+ } catch (_) {
+ return '[Circular]';
+ }
+ default:
+ return x;
+ }
+ });
+ for (var x = args[i]; i < len; x = args[++i]) {
+ if (isNull(x) || !isObject(x)) {
+ str += ' ' + x;
+ } else {
+ str += ' ' + inspect(x);
+ }
+ }
+ return str;
+};
+
+
+// Mark that a method should not be used.
+// Returns a modified function which warns once by default.
+// If --no-deprecation is set, then it is a no-op.
+exports.deprecate = function(fn, msg) {
+ // Allow for deprecating things in the process of starting up.
+ if (isUndefined(global.process)) {
+ return function() {
+ return exports.deprecate(fn, msg).apply(this, arguments);
+ };
+ }
+
+ if (process.noDeprecation === true) {
+ return fn;
+ }
+
+ var warned = false;
+ function deprecated() {
+ if (!warned) {
+ if (process.throwDeprecation) {
+ throw new Error(msg);
+ } else if (process.traceDeprecation) {
+ console.trace(msg);
+ } else {
+ console.error(msg);
+ }
+ warned = true;
+ }
+ return fn.apply(this, arguments);
+ }
+
+ return deprecated;
+};
+
+
+var debugs = {};
+var debugEnviron;
+exports.debuglog = function(set) {
+ if (isUndefined(debugEnviron))
+ debugEnviron = process.env.NODE_DEBUG || '';
+ set = set.toUpperCase();
+ if (!debugs[set]) {
+ if (new RegExp('\\b' + set + '\\b', 'i').test(debugEnviron)) {
+ var pid = process.pid;
+ debugs[set] = function() {
+ var msg = exports.format.apply(exports, arguments);
+ console.error('%s %d: %s', set, pid, msg);
+ };
+ } else {
+ debugs[set] = function() {};
+ }
+ }
+ return debugs[set];
+};
+
+
+/**
+ * Echos the value of a value. Trys to print the value out
+ * in the best way possible given the different types.
+ *
+ * @param {Object} obj The object to print out.
+ * @param {Object} opts Optional options object that alters the output.
+ */
+/* legacy: obj, showHidden, depth, colors*/
+function inspect(obj, opts) {
+ // default options
+ var ctx = {
+ seen: [],
+ stylize: stylizeNoColor
+ };
+ // legacy...
+ if (arguments.length >= 3) ctx.depth = arguments[2];
+ if (arguments.length >= 4) ctx.colors = arguments[3];
+ if (isBoolean(opts)) {
+ // legacy...
+ ctx.showHidden = opts;
+ } else if (opts) {
+ // got an "options" object
+ exports._extend(ctx, opts);
+ }
+ // set default options
+ if (isUndefined(ctx.showHidden)) ctx.showHidden = false;
+ if (isUndefined(ctx.depth)) ctx.depth = 2;
+ if (isUndefined(ctx.colors)) ctx.colors = false;
+ if (isUndefined(ctx.customInspect)) ctx.customInspect = true;
+ if (ctx.colors) ctx.stylize = stylizeWithColor;
+ return formatValue(ctx, obj, ctx.depth);
+}
+exports.inspect = inspect;
+
+
+// http://en.wikipedia.org/wiki/ANSI_escape_code#graphics
+inspect.colors = {
+ 'bold' : [1, 22],
+ 'italic' : [3, 23],
+ 'underline' : [4, 24],
+ 'inverse' : [7, 27],
+ 'white' : [37, 39],
+ 'grey' : [90, 39],
+ 'black' : [30, 39],
+ 'blue' : [34, 39],
+ 'cyan' : [36, 39],
+ 'green' : [32, 39],
+ 'magenta' : [35, 39],
+ 'red' : [31, 39],
+ 'yellow' : [33, 39]
+};
+
+// Don't use 'blue' not visible on cmd.exe
+inspect.styles = {
+ 'special': 'cyan',
+ 'number': 'yellow',
+ 'boolean': 'yellow',
+ 'undefined': 'grey',
+ 'null': 'bold',
+ 'string': 'green',
+ 'date': 'magenta',
+ // "name": intentionally not styling
+ 'regexp': 'red'
+};
+
+
+function stylizeWithColor(str, styleType) {
+ var style = inspect.styles[styleType];
+
+ if (style) {
+ return '\u001b[' + inspect.colors[style][0] + 'm' + str +
+ '\u001b[' + inspect.colors[style][1] + 'm';
+ } else {
+ return str;
+ }
+}
+
+
+function stylizeNoColor(str, styleType) {
+ return str;
+}
+
+
+function arrayToHash(array) {
+ var hash = {};
+
+ array.forEach(function(val, idx) {
+ hash[val] = true;
+ });
+
+ return hash;
+}
+
+
+function formatValue(ctx, value, recurseTimes) {
+ // Provide a hook for user-specified inspect functions.
+ // Check that value is an object with an inspect function on it
+ if (ctx.customInspect &&
+ value &&
+ isFunction(value.inspect) &&
+ // Filter out the util module, it's inspect function is special
+ value.inspect !== exports.inspect &&
+ // Also filter out any prototype objects using the circular check.
+ !(value.constructor && value.constructor.prototype === value)) {
+ var ret = value.inspect(recurseTimes, ctx);
+ if (!isString(ret)) {
+ ret = formatValue(ctx, ret, recurseTimes);
+ }
+ return ret;
+ }
+
+ // Primitive types cannot have properties
+ var primitive = formatPrimitive(ctx, value);
+ if (primitive) {
+ return primitive;
+ }
+
+ // Look up the keys of the object.
+ var keys = Object.keys(value);
+ var visibleKeys = arrayToHash(keys);
+
+ if (ctx.showHidden) {
+ keys = Object.getOwnPropertyNames(value);
+ }
+
+ // IE doesn't make error fields non-enumerable
+ // http://msdn.microsoft.com/en-us/library/ie/dww52sbt(v=vs.94).aspx
+ if (isError(value)
+ && (keys.indexOf('message') >= 0 || keys.indexOf('description') >= 0)) {
+ return formatError(value);
+ }
+
+ // Some type of object without properties can be shortcutted.
+ if (keys.length === 0) {
+ if (isFunction(value)) {
+ var name = value.name ? ': ' + value.name : '';
+ return ctx.stylize('[Function' + name + ']', 'special');
+ }
+ if (isRegExp(value)) {
+ return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
+ }
+ if (isDate(value)) {
+ return ctx.stylize(Date.prototype.toString.call(value), 'date');
+ }
+ if (isError(value)) {
+ return formatError(value);
+ }
+ }
+
+ var base = '', array = false, braces = ['{', '}'];
+
+ // Make Array say that they are Array
+ if (isArray(value)) {
+ array = true;
+ braces = ['[', ']'];
+ }
+
+ // Make functions say that they are functions
+ if (isFunction(value)) {
+ var n = value.name ? ': ' + value.name : '';
+ base = ' [Function' + n + ']';
+ }
+
+ // Make RegExps say that they are RegExps
+ if (isRegExp(value)) {
+ base = ' ' + RegExp.prototype.toString.call(value);
+ }
+
+ // Make dates with properties first say the date
+ if (isDate(value)) {
+ base = ' ' + Date.prototype.toUTCString.call(value);
+ }
+
+ // Make error with message first say the error
+ if (isError(value)) {
+ base = ' ' + formatError(value);
+ }
+
+ if (keys.length === 0 && (!array || value.length == 0)) {
+ return braces[0] + base + braces[1];
+ }
+
+ if (recurseTimes < 0) {
+ if (isRegExp(value)) {
+ return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
+ } else {
+ return ctx.stylize('[Object]', 'special');
+ }
+ }
+
+ ctx.seen.push(value);
+
+ var output;
+ if (array) {
+ output = formatArray(ctx, value, recurseTimes, visibleKeys, keys);
+ } else {
+ output = keys.map(function(key) {
+ return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array);
+ });
+ }
+
+ ctx.seen.pop();
+
+ return reduceToSingleString(output, base, braces);
+}
+
+
+function formatPrimitive(ctx, value) {
+ if (isUndefined(value))
+ return ctx.stylize('undefined', 'undefined');
+ if (isString(value)) {
+ var simple = '\'' + JSON.stringify(value).replace(/^"|"$/g, '')
+ .replace(/'/g, "\\'")
+ .replace(/\\"/g, '"') + '\'';
+ return ctx.stylize(simple, 'string');
+ }
+ if (isNumber(value))
+ return ctx.stylize('' + value, 'number');
+ if (isBoolean(value))
+ return ctx.stylize('' + value, 'boolean');
+ // For some reason typeof null is "object", so special case here.
+ if (isNull(value))
+ return ctx.stylize('null', 'null');
+}
+
+
+function formatError(value) {
+ return '[' + Error.prototype.toString.call(value) + ']';
+}
+
+
+function formatArray(ctx, value, recurseTimes, visibleKeys, keys) {
+ var output = [];
+ for (var i = 0, l = value.length; i < l; ++i) {
+ if (hasOwnProperty(value, String(i))) {
+ output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
+ String(i), true));
+ } else {
+ output.push('');
+ }
+ }
+ keys.forEach(function(key) {
+ if (!key.match(/^\d+$/)) {
+ output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
+ key, true));
+ }
+ });
+ return output;
+}
+
+
+function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) {
+ var name, str, desc;
+ desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] };
+ if (desc.get) {
+ if (desc.set) {
+ str = ctx.stylize('[Getter/Setter]', 'special');
+ } else {
+ str = ctx.stylize('[Getter]', 'special');
+ }
+ } else {
+ if (desc.set) {
+ str = ctx.stylize('[Setter]', 'special');
+ }
+ }
+ if (!hasOwnProperty(visibleKeys, key)) {
+ name = '[' + key + ']';
+ }
+ if (!str) {
+ if (ctx.seen.indexOf(desc.value) < 0) {
+ if (isNull(recurseTimes)) {
+ str = formatValue(ctx, desc.value, null);
+ } else {
+ str = formatValue(ctx, desc.value, recurseTimes - 1);
+ }
+ if (str.indexOf('\n') > -1) {
+ if (array) {
+ str = str.split('\n').map(function(line) {
+ return ' ' + line;
+ }).join('\n').substr(2);
+ } else {
+ str = '\n' + str.split('\n').map(function(line) {
+ return ' ' + line;
+ }).join('\n');
+ }
+ }
+ } else {
+ str = ctx.stylize('[Circular]', 'special');
+ }
+ }
+ if (isUndefined(name)) {
+ if (array && key.match(/^\d+$/)) {
+ return str;
+ }
+ name = JSON.stringify('' + key);
+ if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) {
+ name = name.substr(1, name.length - 2);
+ name = ctx.stylize(name, 'name');
+ } else {
+ name = name.replace(/'/g, "\\'")
+ .replace(/\\"/g, '"')
+ .replace(/(^"|"$)/g, "'");
+ name = ctx.stylize(name, 'string');
+ }
+ }
+
+ return name + ': ' + str;
+}
+
+
+function reduceToSingleString(output, base, braces) {
+ var numLinesEst = 0;
+ var length = output.reduce(function(prev, cur) {
+ numLinesEst++;
+ if (cur.indexOf('\n') >= 0) numLinesEst++;
+ return prev + cur.replace(/\u001b\[\d\d?m/g, '').length + 1;
+ }, 0);
+
+ if (length > 60) {
+ return braces[0] +
+ (base === '' ? '' : base + '\n ') +
+ ' ' +
+ output.join(',\n ') +
+ ' ' +
+ braces[1];
+ }
+
+ return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1];
+}
+
+
+// NOTE: These type checking functions intentionally don't use `instanceof`
+// because it is fragile and can be easily faked with `Object.create()`.
+function isArray(ar) {
+ return Array.isArray(ar);
+}
+exports.isArray = isArray;
+
+function isBoolean(arg) {
+ return typeof arg === 'boolean';
+}
+exports.isBoolean = isBoolean;
+
+function isNull(arg) {
+ return arg === null;
+}
+exports.isNull = isNull;
+
+function isNullOrUndefined(arg) {
+ return arg == null;
+}
+exports.isNullOrUndefined = isNullOrUndefined;
+
+function isNumber(arg) {
+ return typeof arg === 'number';
+}
+exports.isNumber = isNumber;
+
+function isString(arg) {
+ return typeof arg === 'string';
+}
+exports.isString = isString;
+
+function isSymbol(arg) {
+ return typeof arg === 'symbol';
+}
+exports.isSymbol = isSymbol;
+
+function isUndefined(arg) {
+ return arg === void 0;
+}
+exports.isUndefined = isUndefined;
+
+function isRegExp(re) {
+ return isObject(re) && objectToString(re) === '[object RegExp]';
+}
+exports.isRegExp = isRegExp;
+
+function isObject(arg) {
+ return typeof arg === 'object' && arg !== null;
+}
+exports.isObject = isObject;
+
+function isDate(d) {
+ return isObject(d) && objectToString(d) === '[object Date]';
+}
+exports.isDate = isDate;
+
+function isError(e) {
+ return isObject(e) &&
+ (objectToString(e) === '[object Error]' || e instanceof Error);
+}
+exports.isError = isError;
+
+function isFunction(arg) {
+ return typeof arg === 'function';
+}
+exports.isFunction = isFunction;
+
+function isPrimitive(arg) {
+ return arg === null ||
+ typeof arg === 'boolean' ||
+ typeof arg === 'number' ||
+ typeof arg === 'string' ||
+ typeof arg === 'symbol' || // ES6 symbol
+ typeof arg === 'undefined';
+}
+exports.isPrimitive = isPrimitive;
+
+exports.isBuffer = require('./support/isBuffer');
+
+function objectToString(o) {
+ return Object.prototype.toString.call(o);
+}
+
+
+function pad(n) {
+ return n < 10 ? '0' + n.toString(10) : n.toString(10);
+}
+
+
+var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep',
+ 'Oct', 'Nov', 'Dec'];
+
+// 26 Feb 16:19:34
+function timestamp() {
+ var d = new Date();
+ var time = [pad(d.getHours()),
+ pad(d.getMinutes()),
+ pad(d.getSeconds())].join(':');
+ return [d.getDate(), months[d.getMonth()], time].join(' ');
+}
+
+
+// log is just a thin wrapper to console.log that prepends a timestamp
+exports.log = function() {
+ console.log('%s - %s', timestamp(), exports.format.apply(exports, arguments));
+};
+
+
+/**
+ * Inherit the prototype methods from one constructor into another.
+ *
+ * The Function.prototype.inherits from lang.js rewritten as a standalone
+ * function (not on Function.prototype). NOTE: If this file is to be loaded
+ * during bootstrapping this function needs to be rewritten using some native
+ * functions as prototype setup using normal JavaScript does not work as
+ * expected during bootstrapping (see mirror.js in r114903).
+ *
+ * @param {function} ctor Constructor function which needs to inherit the
+ * prototype.
+ * @param {function} superCtor Constructor function to inherit prototype from.
+ */
+exports.inherits = require('inherits');
+
+exports._extend = function(origin, add) {
+ // Don't do anything if add isn't an object
+ if (!add || !isObject(add)) return origin;
+
+ var keys = Object.keys(add);
+ var i = keys.length;
+ while (i--) {
+ origin[keys[i]] = add[keys[i]];
+ }
+ return origin;
+};
+
+function hasOwnProperty(obj, prop) {
+ return Object.prototype.hasOwnProperty.call(obj, prop);
+}
+
+}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
+},{"./support/isBuffer":5,"_process":4,"inherits":3}],7:[function(require,module,exports){
+require("./tests/2.1.2");
+require("./tests/2.1.3");
+require("./tests/2.2.1");
+require("./tests/2.2.2");
+require("./tests/2.2.3");
+require("./tests/2.2.4");
+require("./tests/2.2.5");
+require("./tests/2.2.6");
+require("./tests/2.2.7");
+require("./tests/2.3.1");
+require("./tests/2.3.2");
+require("./tests/2.3.3");
+require("./tests/2.3.4");
+
+},{"./tests/2.1.2":8,"./tests/2.1.3":9,"./tests/2.2.1":10,"./tests/2.2.2":11,"./tests/2.2.3":12,"./tests/2.2.4":13,"./tests/2.2.5":14,"./tests/2.2.6":15,"./tests/2.2.7":16,"./tests/2.3.1":17,"./tests/2.3.2":18,"./tests/2.3.3":19,"./tests/2.3.4":20}],8:[function(require,module,exports){
+(function (global){
+"use strict";
+
+var assert = require("assert");
+var testFulfilled = require("./helpers/testThreeCases").testFulfilled;
+
+var adapter = global.adapter;
+var deferred = adapter.deferred;
+
+var dummy = { dummy: "dummy" }; // we fulfill or reject with this when we don't intend to test against it
+
+describe("2.1.2.1: When fulfilled, a promise: must not transition to any other state.", function () {
+ testFulfilled(dummy, function (promise, done) {
+ var onFulfilledCalled = false;
+
+ promise.then(function onFulfilled() {
+ onFulfilledCalled = true;
+ }, function onRejected() {
+ assert.strictEqual(onFulfilledCalled, false);
+ done();
+ });
+
+ setTimeout(done, 100);
+ });
+
+ specify("trying to fulfill then immediately reject", function (done) {
+ var d = deferred();
+ var onFulfilledCalled = false;
+
+ d.promise.then(function onFulfilled() {
+ onFulfilledCalled = true;
+ }, function onRejected() {
+ assert.strictEqual(onFulfilledCalled, false);
+ done();
+ });
+
+ d.resolve(dummy);
+ d.reject(dummy);
+ setTimeout(done, 100);
+ });
+
+ specify("trying to fulfill then reject, delayed", function (done) {
+ var d = deferred();
+ var onFulfilledCalled = false;
+
+ d.promise.then(function onFulfilled() {
+ onFulfilledCalled = true;
+ }, function onRejected() {
+ assert.strictEqual(onFulfilledCalled, false);
+ done();
+ });
+
+ setTimeout(function () {
+ d.resolve(dummy);
+ d.reject(dummy);
+ }, 50);
+ setTimeout(done, 100);
+ });
+
+ specify("trying to fulfill immediately then reject delayed", function (done) {
+ var d = deferred();
+ var onFulfilledCalled = false;
+
+ d.promise.then(function onFulfilled() {
+ onFulfilledCalled = true;
+ }, function onRejected() {
+ assert.strictEqual(onFulfilledCalled, false);
+ done();
+ });
+
+ d.resolve(dummy);
+ setTimeout(function () {
+ d.reject(dummy);
+ }, 50);
+ setTimeout(done, 100);
+ });
+});
+
+}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
+},{"./helpers/testThreeCases":22,"assert":2}],9:[function(require,module,exports){
+(function (global){
+"use strict";
+
+var assert = require("assert");
+var testRejected = require("./helpers/testThreeCases").testRejected;
+
+var adapter = global.adapter;
+var deferred = adapter.deferred;
+
+var dummy = { dummy: "dummy" }; // we fulfill or reject with this when we don't intend to test against it
+
+describe("2.1.3.1: When rejected, a promise: must not transition to any other state.", function () {
+ testRejected(dummy, function (promise, done) {
+ var onRejectedCalled = false;
+
+ promise.then(function onFulfilled() {
+ assert.strictEqual(onRejectedCalled, false);
+ done();
+ }, function onRejected() {
+ onRejectedCalled = true;
+ });
+
+ setTimeout(done, 100);
+ });
+
+ specify("trying to reject then immediately fulfill", function (done) {
+ var d = deferred();
+ var onRejectedCalled = false;
+
+ d.promise.then(function onFulfilled() {
+ assert.strictEqual(onRejectedCalled, false);
+ done();
+ }, function onRejected() {
+ onRejectedCalled = true;
+ });
+
+ d.reject(dummy);
+ d.resolve(dummy);
+ setTimeout(done, 100);
+ });
+
+ specify("trying to reject then fulfill, delayed", function (done) {
+ var d = deferred();
+ var onRejectedCalled = false;
+
+ d.promise.then(function onFulfilled() {
+ assert.strictEqual(onRejectedCalled, false);
+ done();
+ }, function onRejected() {
+ onRejectedCalled = true;
+ });
+
+ setTimeout(function () {
+ d.reject(dummy);
+ d.resolve(dummy);
+ }, 50);
+ setTimeout(done, 100);
+ });
+
+ specify("trying to reject immediately then fulfill delayed", function (done) {
+ var d = deferred();
+ var onRejectedCalled = false;
+
+ d.promise.then(function onFulfilled() {
+ assert.strictEqual(onRejectedCalled, false);
+ done();
+ }, function onRejected() {
+ onRejectedCalled = true;
+ });
+
+ d.reject(dummy);
+ setTimeout(function () {
+ d.resolve(dummy);
+ }, 50);
+ setTimeout(done, 100);
+ });
+});
+
+}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
+},{"./helpers/testThreeCases":22,"assert":2}],10:[function(require,module,exports){
+(function (global){
+"use strict";
+
+var adapter = global.adapter;
+var resolved = adapter.resolved;
+var rejected = adapter.rejected;
+
+var dummy = { dummy: "dummy" }; // we fulfill or reject with this when we don't intend to test against it
+
+describe("2.2.1: Both `onFulfilled` and `onRejected` are optional arguments.", function () {
+ describe("2.2.1.1: If `onFulfilled` is not a function, it must be ignored.", function () {
+ describe("applied to a directly-rejected promise", function () {
+ function testNonFunction(nonFunction, stringRepresentation) {
+ specify("`onFulfilled` is " + stringRepresentation, function (done) {
+ rejected(dummy).then(nonFunction, function () {
+ done();
+ });
+ });
+ }
+
+ testNonFunction(undefined, "`undefined`");
+ testNonFunction(null, "`null`");
+ testNonFunction(false, "`false`");
+ testNonFunction(5, "`5`");
+ testNonFunction({}, "an object");
+ });
+
+ describe("applied to a promise rejected and then chained off of", function () {
+ function testNonFunction(nonFunction, stringRepresentation) {
+ specify("`onFulfilled` is " + stringRepresentation, function (done) {
+ rejected(dummy).then(function () { }, undefined).then(nonFunction, function () {
+ done();
+ });
+ });
+ }
+
+ testNonFunction(undefined, "`undefined`");
+ testNonFunction(null, "`null`");
+ testNonFunction(false, "`false`");
+ testNonFunction(5, "`5`");
+ testNonFunction({}, "an object");
+ });
+ });
+
+ describe("2.2.1.2: If `onRejected` is not a function, it must be ignored.", function () {
+ describe("applied to a directly-fulfilled promise", function () {
+ function testNonFunction(nonFunction, stringRepresentation) {
+ specify("`onRejected` is " + stringRepresentation, function (done) {
+ resolved(dummy).then(function () {
+ done();
+ }, nonFunction);
+ });
+ }
+
+ testNonFunction(undefined, "`undefined`");
+ testNonFunction(null, "`null`");
+ testNonFunction(false, "`false`");
+ testNonFunction(5, "`5`");
+ testNonFunction({}, "an object");
+ });
+
+ describe("applied to a promise fulfilled and then chained off of", function () {
+ function testNonFunction(nonFunction, stringRepresentation) {
+ specify("`onFulfilled` is " + stringRepresentation, function (done) {
+ resolved(dummy).then(undefined, function () { }).then(function () {
+ done();
+ }, nonFunction);
+ });
+ }
+
+ testNonFunction(undefined, "`undefined`");
+ testNonFunction(null, "`null`");
+ testNonFunction(false, "`false`");
+ testNonFunction(5, "`5`");
+ testNonFunction({}, "an object");
+ });
+ });
+});
+
+}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
+},{}],11:[function(require,module,exports){
+(function (global){
+"use strict";
+
+var assert = require("assert");
+var testFulfilled = require("./helpers/testThreeCases").testFulfilled;
+
+var adapter = global.adapter;
+var resolved = adapter.resolved;
+var deferred = adapter.deferred;
+
+var dummy = { dummy: "dummy" }; // we fulfill or reject with this when we don't intend to test against it
+var sentinel = { sentinel: "sentinel" }; // a sentinel fulfillment value to test for with strict equality
+
+describe("2.2.2: If `onFulfilled` is a function,", function () {
+ describe("2.2.2.1: it must be called after `promise` is fulfilled, with `promise`’s fulfillment value as its " +
+ "first argument.", function () {
+ testFulfilled(sentinel, function (promise, done) {
+ promise.then(function onFulfilled(value) {
+ assert.strictEqual(value, sentinel);
+ done();
+ });
+ });
+ });
+
+ describe("2.2.2.2: it must not be called before `promise` is fulfilled", function () {
+ specify("fulfilled after a delay", function (done) {
+ var d = deferred();
+ var isFulfilled = false;
+
+ d.promise.then(function onFulfilled() {
+ assert.strictEqual(isFulfilled, true);
+ done();
+ });
+
+ setTimeout(function () {
+ d.resolve(dummy);
+ isFulfilled = true;
+ }, 50);
+ });
+
+ specify("never fulfilled", function (done) {
+ var d = deferred();
+ var onFulfilledCalled = false;
+
+ d.promise.then(function onFulfilled() {
+ onFulfilledCalled = true;
+ done();
+ });
+
+ setTimeout(function () {
+ assert.strictEqual(onFulfilledCalled, false);
+ done();
+ }, 150);
+ });
+ });
+
+ describe("2.2.2.3: it must not be called more than once.", function () {
+ specify("already-fulfilled", function (done) {
+ var timesCalled = 0;
+
+ resolved(dummy).then(function onFulfilled() {
+ assert.strictEqual(++timesCalled, 1);
+ done();
+ });
+ });
+
+ specify("trying to fulfill a pending promise more than once, immediately", function (done) {
+ var d = deferred();
+ var timesCalled = 0;
+
+ d.promise.then(function onFulfilled() {
+ assert.strictEqual(++timesCalled, 1);
+ done();
+ });
+
+ d.resolve(dummy);
+ d.resolve(dummy);
+ });
+
+ specify("trying to fulfill a pending promise more than once, delayed", function (done) {
+ var d = deferred();
+ var timesCalled = 0;
+
+ d.promise.then(function onFulfilled() {
+ assert.strictEqual(++timesCalled, 1);
+ done();
+ });
+
+ setTimeout(function () {
+ d.resolve(dummy);
+ d.resolve(dummy);
+ }, 50);
+ });
+
+ specify("trying to fulfill a pending promise more than once, immediately then delayed", function (done) {
+ var d = deferred();
+ var timesCalled = 0;
+
+ d.promise.then(function onFulfilled() {
+ assert.strictEqual(++timesCalled, 1);
+ done();
+ });
+
+ d.resolve(dummy);
+ setTimeout(function () {
+ d.resolve(dummy);
+ }, 50);
+ });
+
+ specify("when multiple `then` calls are made, spaced apart in time", function (done) {
+ var d = deferred();
+ var timesCalled = [0, 0, 0];
+
+ d.promise.then(function onFulfilled() {
+ assert.strictEqual(++timesCalled[0], 1);
+ });
+
+ setTimeout(function () {
+ d.promise.then(function onFulfilled() {
+ assert.strictEqual(++timesCalled[1], 1);
+ });
+ }, 50);
+
+ setTimeout(function () {
+ d.promise.then(function onFulfilled() {
+ assert.strictEqual(++timesCalled[2], 1);
+ done();
+ });
+ }, 100);
+
+ setTimeout(function () {
+ d.resolve(dummy);
+ }, 150);
+ });
+
+ specify("when `then` is interleaved with fulfillment", function (done) {
+ var d = deferred();
+ var timesCalled = [0, 0];
+
+ d.promise.then(function onFulfilled() {
+ assert.strictEqual(++timesCalled[0], 1);
+ });
+
+ d.resolve(dummy);
+
+ d.promise.then(function onFulfilled() {
+ assert.strictEqual(++timesCalled[1], 1);
+ done();
+ });
+ });
+ });
+});
+
+}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
+},{"./helpers/testThreeCases":22,"assert":2}],12:[function(require,module,exports){
+(function (global){
+"use strict";
+
+var assert = require("assert");
+var testRejected = require("./helpers/testThreeCases").testRejected;
+
+var adapter = global.adapter;
+var rejected = adapter.rejected;
+var deferred = adapter.deferred;
+
+var dummy = { dummy: "dummy" }; // we fulfill or reject with this when we don't intend to test against it
+var sentinel = { sentinel: "sentinel" }; // a sentinel fulfillment value to test for with strict equality
+
+describe("2.2.3: If `onRejected` is a function,", function () {
+ describe("2.2.3.1: it must be called after `promise` is rejected, with `promise`’s rejection reason as its " +
+ "first argument.", function () {
+ testRejected(sentinel, function (promise, done) {
+ promise.then(null, function onRejected(reason) {
+ assert.strictEqual(reason, sentinel);
+ done();
+ });
+ });
+ });
+
+ describe("2.2.3.2: it must not be called before `promise` is rejected", function () {
+ specify("rejected after a delay", function (done) {
+ var d = deferred();
+ var isRejected = false;
+
+ d.promise.then(null, function onRejected() {
+ assert.strictEqual(isRejected, true);
+ done();
+ });
+
+ setTimeout(function () {
+ d.reject(dummy);
+ isRejected = true;
+ }, 50);
+ });
+
+ specify("never rejected", function (done) {
+ var d = deferred();
+ var onRejectedCalled = false;
+
+ d.promise.then(null, function onRejected() {
+ onRejectedCalled = true;
+ done();
+ });
+
+ setTimeout(function () {
+ assert.strictEqual(onRejectedCalled, false);
+ done();
+ }, 150);
+ });
+ });
+
+ describe("2.2.3.3: it must not be called more than once.", function () {
+ specify("already-rejected", function (done) {
+ var timesCalled = 0;
+
+ rejected(dummy).then(null, function onRejected() {
+ assert.strictEqual(++timesCalled, 1);
+ done();
+ });
+ });
+
+ specify("trying to reject a pending promise more than once, immediately", function (done) {
+ var d = deferred();
+ var timesCalled = 0;
+
+ d.promise.then(null, function onRejected() {
+ assert.strictEqual(++timesCalled, 1);
+ done();
+ });
+
+ d.reject(dummy);
+ d.reject(dummy);
+ });
+
+ specify("trying to reject a pending promise more than once, delayed", function (done) {
+ var d = deferred();
+ var timesCalled = 0;
+
+ d.promise.then(null, function onRejected() {
+ assert.strictEqual(++timesCalled, 1);
+ done();
+ });
+
+ setTimeout(function () {
+ d.reject(dummy);
+ d.reject(dummy);
+ }, 50);
+ });
+
+ specify("trying to reject a pending promise more than once, immediately then delayed", function (done) {
+ var d = deferred();
+ var timesCalled = 0;
+
+ d.promise.then(null, function onRejected() {
+ assert.strictEqual(++timesCalled, 1);
+ done();
+ });
+
+ d.reject(dummy);
+ setTimeout(function () {
+ d.reject(dummy);
+ }, 50);
+ });
+
+ specify("when multiple `then` calls are made, spaced apart in time", function (done) {
+ var d = deferred();
+ var timesCalled = [0, 0, 0];
+
+ d.promise.then(null, function onRejected() {
+ assert.strictEqual(++timesCalled[0], 1);
+ });
+
+ setTimeout(function () {
+ d.promise.then(null, function onRejected() {
+ assert.strictEqual(++timesCalled[1], 1);
+ });
+ }, 50);
+
+ setTimeout(function () {
+ d.promise.then(null, function onRejected() {
+ assert.strictEqual(++timesCalled[2], 1);
+ done();
+ });
+ }, 100);
+
+ setTimeout(function () {
+ d.reject(dummy);
+ }, 150);
+ });
+
+ specify("when `then` is interleaved with rejection", function (done) {
+ var d = deferred();
+ var timesCalled = [0, 0];
+
+ d.promise.then(null, function onRejected() {
+ assert.strictEqual(++timesCalled[0], 1);
+ });
+
+ d.reject(dummy);
+
+ d.promise.then(null, function onRejected() {
+ assert.strictEqual(++timesCalled[1], 1);
+ done();
+ });
+ });
+ });
+});
+
+}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
+},{"./helpers/testThreeCases":22,"assert":2}],13:[function(require,module,exports){
+(function (global){
+"use strict";
+
+var assert = require("assert");
+var testFulfilled = require("./helpers/testThreeCases").testFulfilled;
+var testRejected = require("./helpers/testThreeCases").testRejected;
+
+var adapter = global.adapter;
+var resolved = adapter.resolved;
+var rejected = adapter.rejected;
+var deferred = adapter.deferred;
+
+var dummy = { dummy: "dummy" }; // we fulfill or reject with this when we don't intend to test against it
+
+describe("2.2.4: `onFulfilled` or `onRejected` must not be called until the execution context stack contains only " +
+ "platform code.", function () {
+ describe("`then` returns before the promise becomes fulfilled or rejected", function () {
+ testFulfilled(dummy, function (promise, done) {
+ var thenHasReturned = false;
+
+ promise.then(function onFulfilled() {
+ assert.strictEqual(thenHasReturned, true);
+ done();
+ });
+
+ thenHasReturned = true;
+ });
+ testRejected(dummy, function (promise, done) {
+ var thenHasReturned = false;
+
+ promise.then(null, function onRejected() {
+ assert.strictEqual(thenHasReturned, true);
+ done();
+ });
+
+ thenHasReturned = true;
+ });
+ });
+
+ describe("Clean-stack execution ordering tests (fulfillment case)", function () {
+ specify("when `onFulfilled` is added immediately before the promise is fulfilled",
+ function () {
+ var d = deferred();
+ var onFulfilledCalled = false;
+
+ d.promise.then(function onFulfilled() {
+ onFulfilledCalled = true;
+ });
+
+ d.resolve(dummy);
+
+ assert.strictEqual(onFulfilledCalled, false);
+ });
+
+ specify("when `onFulfilled` is added immediately after the promise is fulfilled",
+ function () {
+ var d = deferred();
+ var onFulfilledCalled = false;
+
+ d.resolve(dummy);
+
+ d.promise.then(function onFulfilled() {
+ onFulfilledCalled = true;
+ });
+
+ assert.strictEqual(onFulfilledCalled, false);
+ });
+
+ specify("when one `onFulfilled` is added inside another `onFulfilled`", function (done) {
+ var promise = resolved();
+ var firstOnFulfilledFinished = false;
+
+ promise.then(function () {
+ promise.then(function () {
+ assert.strictEqual(firstOnFulfilledFinished, true);
+ done();
+ });
+ firstOnFulfilledFinished = true;
+ });
+ });
+
+ specify("when `onFulfilled` is added inside an `onRejected`", function (done) {
+ var promise = rejected();
+ var promise2 = resolved();
+ var firstOnRejectedFinished = false;
+
+ promise.then(null, function () {
+ promise2.then(function () {
+ assert.strictEqual(firstOnRejectedFinished, true);
+ done();
+ });
+ firstOnRejectedFinished = true;
+ });
+ });
+
+ specify("when the promise is fulfilled asynchronously", function (done) {
+ var d = deferred();
+ var firstStackFinished = false;
+
+ setTimeout(function () {
+ d.resolve(dummy);
+ firstStackFinished = true;
+ }, 0);
+
+ d.promise.then(function () {
+ assert.strictEqual(firstStackFinished, true);
+ done();
+ });
+ });
+ });
+
+ describe("Clean-stack execution ordering tests (rejection case)", function () {
+ specify("when `onRejected` is added immediately before the promise is rejected",
+ function () {
+ var d = deferred();
+ var onRejectedCalled = false;
+
+ d.promise.then(null, function onRejected() {
+ onRejectedCalled = true;
+ });
+
+ d.reject(dummy);
+
+ assert.strictEqual(onRejectedCalled, false);
+ });
+
+ specify("when `onRejected` is added immediately after the promise is rejected",
+ function () {
+ var d = deferred();
+ var onRejectedCalled = false;
+
+ d.reject(dummy);
+
+ d.promise.then(null, function onRejected() {
+ onRejectedCalled = true;
+ });
+
+ assert.strictEqual(onRejectedCalled, false);
+ });
+
+ specify("when `onRejected` is added inside an `onFulfilled`", function (done) {
+ var promise = resolved();
+ var promise2 = rejected();
+ var firstOnFulfilledFinished = false;
+
+ promise.then(function () {
+ promise2.then(null, function () {
+ assert.strictEqual(firstOnFulfilledFinished, true);
+ done();
+ });
+ firstOnFulfilledFinished = true;
+ });
+ });
+
+ specify("when one `onRejected` is added inside another `onRejected`", function (done) {
+ var promise = rejected();
+ var firstOnRejectedFinished = false;
+
+ promise.then(null, function () {
+ promise.then(null, function () {
+ assert.strictEqual(firstOnRejectedFinished, true);
+ done();
+ });
+ firstOnRejectedFinished = true;
+ });
+ });
+
+ specify("when the promise is rejected asynchronously", function (done) {
+ var d = deferred();
+ var firstStackFinished = false;
+
+ setTimeout(function () {
+ d.reject(dummy);
+ firstStackFinished = true;
+ }, 0);
+
+ d.promise.then(null, function () {
+ assert.strictEqual(firstStackFinished, true);
+ done();
+ });
+ });
+ });
+});
+
+}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
+},{"./helpers/testThreeCases":22,"assert":2}],14:[function(require,module,exports){
+(function (global){
+/*jshint strict: false */
+
+var assert = require("assert");
+
+var adapter = global.adapter;
+var resolved = adapter.resolved;
+var rejected = adapter.rejected;
+
+var dummy = { dummy: "dummy" }; // we fulfill or reject with this when we don't intend to test against it
+function impimentsUseStrictCorrectly() {
+ "use strict";
+ function test() {
+ /*jshint validthis:true */
+ return !this;
+ }
+ return test();
+}
+describe("2.2.5 `onFulfilled` and `onRejected` must be called as functions (i.e. with no `this` value).", function () {
+ if (impimentsUseStrictCorrectly()) {
+ describe("strict mode", function () {
+ specify("fulfilled", function (done) {
+ resolved(dummy).then(function onFulfilled() {
+ "use strict";
+
+ assert.strictEqual(this, undefined);
+ done();
+ });
+ });
+
+ specify("rejected", function (done) {
+ rejected(dummy).then(null, function onRejected() {
+ "use strict";
+
+ assert.strictEqual(this, undefined);
+ done();
+ });
+ });
+ });
+ }
+ describe("sloppy mode", function () {
+ specify("fulfilled", function (done) {
+ resolved(dummy).then(function onFulfilled() {
+ assert.strictEqual(this, global);
+ done();
+ });
+ });
+
+ specify("rejected", function (done) {
+ rejected(dummy).then(null, function onRejected() {
+ assert.strictEqual(this, global);
+ done();
+ });
+ });
+ });
+});
+
+}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
+},{"assert":2}],15:[function(require,module,exports){
+"use strict";
+
+var assert = require("assert");
+var sinon = require("sinon");
+var testFulfilled = require("./helpers/testThreeCases").testFulfilled;
+var testRejected = require("./helpers/testThreeCases").testRejected;
+
+var dummy = { dummy: "dummy" }; // we fulfill or reject with this when we don't intend to test against it
+var other = { other: "other" }; // a value we don't want to be strict equal to
+var sentinel = { sentinel: "sentinel" }; // a sentinel fulfillment value to test for with strict equality
+var sentinel2 = { sentinel2: "sentinel2" };
+var sentinel3 = { sentinel3: "sentinel3" };
+
+function callbackAggregator(times, ultimateCallback) {
+ var soFar = 0;
+ return function () {
+ if (++soFar === times) {
+ ultimateCallback();
+ }
+ };
+}
+
+describe("2.2.6: `then` may be called multiple times on the same promise.", function () {
+ describe("2.2.6.1: If/when `promise` is fulfilled, all respective `onFulfilled` callbacks must execute in the " +
+ "order of their originating calls to `then`.", function () {
+ describe("multiple boring fulfillment handlers", function () {
+ testFulfilled(sentinel, function (promise, done) {
+ var handler1 = sinon.stub().returns(other);
+ var handler2 = sinon.stub().returns(other);
+ var handler3 = sinon.stub().returns(other);
+
+ var spy = sinon.spy();
+ promise.then(handler1, spy);
+ promise.then(handler2, spy);
+ promise.then(handler3, spy);
+
+ promise.then(function (value) {
+ assert.strictEqual(value, sentinel);
+
+ sinon.assert.calledWith(handler1, sinon.match.same(sentinel));
+ sinon.assert.calledWith(handler2, sinon.match.same(sentinel));
+ sinon.assert.calledWith(handler3, sinon.match.same(sentinel));
+ sinon.assert.notCalled(spy);
+
+ done();
+ });
+ });
+ });
+
+ describe("multiple fulfillment handlers, one of which throws", function () {
+ testFulfilled(sentinel, function (promise, done) {
+ var handler1 = sinon.stub().returns(other);
+ var handler2 = sinon.stub().throws(other);
+ var handler3 = sinon.stub().returns(other);
+
+ var spy = sinon.spy();
+ promise.then(handler1, spy);
+ promise.then(handler2, spy);
+ promise.then(handler3, spy);
+
+ promise.then(function (value) {
+ assert.strictEqual(value, sentinel);
+
+ sinon.assert.calledWith(handler1, sinon.match.same(sentinel));
+ sinon.assert.calledWith(handler2, sinon.match.same(sentinel));
+ sinon.assert.calledWith(handler3, sinon.match.same(sentinel));
+ sinon.assert.notCalled(spy);
+
+ done();
+ });
+ });
+ });
+
+ describe("results in multiple branching chains with their own fulfillment values", function () {
+ testFulfilled(dummy, function (promise, done) {
+ var semiDone = callbackAggregator(3, done);
+
+ promise.then(function () {
+ return sentinel;
+ }).then(function (value) {
+ assert.strictEqual(value, sentinel);
+ semiDone();
+ });
+
+ promise.then(function () {
+ throw sentinel2;
+ }).then(null, function (reason) {
+ assert.strictEqual(reason, sentinel2);
+ semiDone();
+ });
+
+ promise.then(function () {
+ return sentinel3;
+ }).then(function (value) {
+ assert.strictEqual(value, sentinel3);
+ semiDone();
+ });
+ });
+ });
+
+ describe("`onFulfilled` handlers are called in the original order", function () {
+ testFulfilled(dummy, function (promise, done) {
+ var handler1 = sinon.spy(function handler1() {});
+ var handler2 = sinon.spy(function handler2() {});
+ var handler3 = sinon.spy(function handler3() {});
+
+ promise.then(handler1);
+ promise.then(handler2);
+ promise.then(handler3);
+
+ promise.then(function () {
+ sinon.assert.callOrder(handler1, handler2, handler3);
+ done();
+ });
+ });
+
+ describe("even when one handler is added inside another handler", function () {
+ testFulfilled(dummy, function (promise, done) {
+ var handler1 = sinon.spy(function handler1() {});
+ var handler2 = sinon.spy(function handler2() {});
+ var handler3 = sinon.spy(function handler3() {});
+
+ promise.then(function () {
+ handler1();
+ promise.then(handler3);
+ });
+ promise.then(handler2);
+
+ promise.then(function () {
+ // Give implementations a bit of extra time to flush their internal queue, if necessary.
+ setTimeout(function () {
+ sinon.assert.callOrder(handler1, handler2, handler3);
+ done();
+ }, 15);
+ });
+ });
+ });
+ });
+ });
+
+ describe("2.2.6.2: If/when `promise` is rejected, all respective `onRejected` callbacks must execute in the " +
+ "order of their originating calls to `then`.", function () {
+ describe("multiple boring rejection handlers", function () {
+ testRejected(sentinel, function (promise, done) {
+ var handler1 = sinon.stub().returns(other);
+ var handler2 = sinon.stub().returns(other);
+ var handler3 = sinon.stub().returns(other);
+
+ var spy = sinon.spy();
+ promise.then(spy, handler1);
+ promise.then(spy, handler2);
+ promise.then(spy, handler3);
+
+ promise.then(null, function (reason) {
+ assert.strictEqual(reason, sentinel);
+
+ sinon.assert.calledWith(handler1, sinon.match.same(sentinel));
+ sinon.assert.calledWith(handler2, sinon.match.same(sentinel));
+ sinon.assert.calledWith(handler3, sinon.match.same(sentinel));
+ sinon.assert.notCalled(spy);
+
+ done();
+ });
+ });
+ });
+
+ describe("multiple rejection handlers, one of which throws", function () {
+ testRejected(sentinel, function (promise, done) {
+ var handler1 = sinon.stub().returns(other);
+ var handler2 = sinon.stub().throws(other);
+ var handler3 = sinon.stub().returns(other);
+
+ var spy = sinon.spy();
+ promise.then(spy, handler1);
+ promise.then(spy, handler2);
+ promise.then(spy, handler3);
+
+ promise.then(null, function (reason) {
+ assert.strictEqual(reason, sentinel);
+
+ sinon.assert.calledWith(handler1, sinon.match.same(sentinel));
+ sinon.assert.calledWith(handler2, sinon.match.same(sentinel));
+ sinon.assert.calledWith(handler3, sinon.match.same(sentinel));
+ sinon.assert.notCalled(spy);
+
+ done();
+ });
+ });
+ });
+
+ describe("results in multiple branching chains with their own fulfillment values", function () {
+ testRejected(sentinel, function (promise, done) {
+ var semiDone = callbackAggregator(3, done);
+
+ promise.then(null, function () {
+ return sentinel;
+ }).then(function (value) {
+ assert.strictEqual(value, sentinel);
+ semiDone();
+ });
+
+ promise.then(null, function () {
+ throw sentinel2;
+ }).then(null, function (reason) {
+ assert.strictEqual(reason, sentinel2);
+ semiDone();
+ });
+
+ promise.then(null, function () {
+ return sentinel3;
+ }).then(function (value) {
+ assert.strictEqual(value, sentinel3);
+ semiDone();
+ });
+ });
+ });
+
+ describe("`onRejected` handlers are called in the original order", function () {
+ testRejected(dummy, function (promise, done) {
+ var handler1 = sinon.spy(function handler1() {});
+ var handler2 = sinon.spy(function handler2() {});
+ var handler3 = sinon.spy(function handler3() {});
+
+ promise.then(null, handler1);
+ promise.then(null, handler2);
+ promise.then(null, handler3);
+
+ promise.then(null, function () {
+ sinon.assert.callOrder(handler1, handler2, handler3);
+ done();
+ });
+ });
+
+ describe("even when one handler is added inside another handler", function () {
+ testRejected(dummy, function (promise, done) {
+ var handler1 = sinon.spy(function handler1() {});
+ var handler2 = sinon.spy(function handler2() {});
+ var handler3 = sinon.spy(function handler3() {});
+
+ promise.then(null, function () {
+ handler1();
+ promise.then(null, handler3);
+ });
+ promise.then(null, handler2);
+
+ promise.then(null, function () {
+ // Give implementations a bit of extra time to flush their internal queue, if necessary.
+ setTimeout(function () {
+ sinon.assert.callOrder(handler1, handler2, handler3);
+ done();
+ }, 15);
+ });
+ });
+ });
+ });
+ });
+});
+
+},{"./helpers/testThreeCases":22,"assert":2,"sinon":24}],16:[function(require,module,exports){
+(function (global){
+"use strict";
+
+var assert = require("assert");
+var testFulfilled = require("./helpers/testThreeCases").testFulfilled;
+var testRejected = require("./helpers/testThreeCases").testRejected;
+var reasons = require("./helpers/reasons");
+
+var adapter = global.adapter;
+var deferred = adapter.deferred;
+
+var dummy = { dummy: "dummy" }; // we fulfill or reject with this when we don't intend to test against it
+var sentinel = { sentinel: "sentinel" }; // a sentinel fulfillment value to test for with strict equality
+var other = { other: "other" }; // a value we don't want to be strict equal to
+
+describe("2.2.7: `then` must return a promise: `promise2 = promise1.then(onFulfilled, onRejected)`", function () {
+ specify("is a promise", function () {
+ var promise1 = deferred().promise;
+ var promise2 = promise1.then();
+
+ assert(typeof promise2 === "object" || typeof promise2 === "function");
+ assert.notStrictEqual(promise2, null);
+ assert.strictEqual(typeof promise2.then, "function");
+ });
+
+ describe("2.2.7.1: If either `onFulfilled` or `onRejected` returns a value `x`, run the Promise Resolution " +
+ "Procedure `[[Resolve]](promise2, x)`", function () {
+ specify("see separate 3.3 tests", function () { });
+ });
+
+ describe("2.2.7.2: If either `onFulfilled` or `onRejected` throws an exception `e`, `promise2` must be rejected " +
+ "with `e` as the reason.", function () {
+ function testReason(expectedReason, stringRepresentation) {
+ describe("The reason is " + stringRepresentation, function () {
+ testFulfilled(dummy, function (promise1, done) {
+ var promise2 = promise1.then(function onFulfilled() {
+ throw expectedReason;
+ });
+
+ promise2.then(null, function onPromise2Rejected(actualReason) {
+ assert.strictEqual(actualReason, expectedReason);
+ done();
+ });
+ });
+ testRejected(dummy, function (promise1, done) {
+ var promise2 = promise1.then(null, function onRejected() {
+ throw expectedReason;
+ });
+
+ promise2.then(null, function onPromise2Rejected(actualReason) {
+ assert.strictEqual(actualReason, expectedReason);
+ done();
+ });
+ });
+ });
+ }
+
+ Object.keys(reasons).forEach(function (stringRepresentation) {
+ testReason(reasons[stringRepresentation], stringRepresentation);
+ });
+ });
+
+ describe("2.2.7.3: If `onFulfilled` is not a function and `promise1` is fulfilled, `promise2` must be fulfilled " +
+ "with the same value.", function () {
+
+ function testNonFunction(nonFunction, stringRepresentation) {
+ describe("`onFulfilled` is " + stringRepresentation, function () {
+ testFulfilled(sentinel, function (promise1, done) {
+ var promise2 = promise1.then(nonFunction);
+
+ promise2.then(function onPromise2Fulfilled(value) {
+ assert.strictEqual(value, sentinel);
+ done();
+ });
+ });
+ });
+ }
+
+ testNonFunction(undefined, "`undefined`");
+ testNonFunction(null, "`null`");
+ testNonFunction(false, "`false`");
+ testNonFunction(5, "`5`");
+ testNonFunction({}, "an object");
+ testNonFunction([function () { return other; }], "an array containing a function");
+ });
+
+ describe("2.2.7.4: If `onRejected` is not a function and `promise1` is rejected, `promise2` must be rejected " +
+ "with the same reason.", function () {
+
+ function testNonFunction(nonFunction, stringRepresentation) {
+ describe("`onRejected` is " + stringRepresentation, function () {
+ testRejected(sentinel, function (promise1, done) {
+ var promise2 = promise1.then(null, nonFunction);
+
+ promise2.then(null, function onPromise2Rejected(reason) {
+ assert.strictEqual(reason, sentinel);
+ done();
+ });
+ });
+ });
+ }
+
+ testNonFunction(undefined, "`undefined`");
+ testNonFunction(null, "`null`");
+ testNonFunction(false, "`false`");
+ testNonFunction(5, "`5`");
+ testNonFunction({}, "an object");
+ testNonFunction([function () { return other; }], "an array containing a function");
+ });
+});
+
+}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
+},{"./helpers/reasons":21,"./helpers/testThreeCases":22,"assert":2}],17:[function(require,module,exports){
+(function (global){
+"use strict";
+
+var assert = require("assert");
+
+var adapter = global.adapter;
+var resolved = adapter.resolved;
+var rejected = adapter.rejected;
+
+var dummy = { dummy: "dummy" }; // we fulfill or reject with this when we don't intend to test against it
+
+describe("2.3.1: If `promise` and `x` refer to the same object, reject `promise` with a `TypeError' as the reason.",
+ function () {
+ specify("via return from a fulfilled promise", function (done) {
+ var promise = resolved(dummy).then(function () {
+ return promise;
+ });
+
+ promise.then(null, function (reason) {
+ assert(reason instanceof TypeError);
+ done();
+ });
+ });
+
+ specify("via return from a rejected promise", function (done) {
+ var promise = rejected(dummy).then(null, function () {
+ return promise;
+ });
+
+ promise.then(null, function (reason) {
+ assert(reason instanceof TypeError);
+ done();
+ });
+ });
+});
+
+}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
+},{"assert":2}],18:[function(require,module,exports){
+(function (global){
+"use strict";
+
+var assert = require("assert");
+
+var adapter = global.adapter;
+var resolved = adapter.resolved;
+var rejected = adapter.rejected;
+var deferred = adapter.deferred;
+
+var dummy = { dummy: "dummy" }; // we fulfill or reject with this when we don't intend to test against it
+var sentinel = { sentinel: "sentinel" }; // a sentinel fulfillment value to test for with strict equality
+
+function testPromiseResolution(xFactory, test) {
+ specify("via return from a fulfilled promise", function (done) {
+ var promise = resolved(dummy).then(function onBasePromiseFulfilled() {
+ return xFactory();
+ });
+
+ test(promise, done);
+ });
+
+ specify("via return from a rejected promise", function (done) {
+ var promise = rejected(dummy).then(null, function onBasePromiseRejected() {
+ return xFactory();
+ });
+
+ test(promise, done);
+ });
+}
+
+describe("2.3.2: If `x` is a promise, adopt its state", function () {
+ describe("2.3.2.1: If `x` is pending, `promise` must remain pending until `x` is fulfilled or rejected.",
+ function () {
+ function xFactory() {
+ return deferred().promise;
+ }
+
+ testPromiseResolution(xFactory, function (promise, done) {
+ var wasFulfilled = false;
+ var wasRejected = false;
+
+ promise.then(
+ function onPromiseFulfilled() {
+ wasFulfilled = true;
+ },
+ function onPromiseRejected() {
+ wasRejected = true;
+ }
+ );
+
+ setTimeout(function () {
+ assert.strictEqual(wasFulfilled, false);
+ assert.strictEqual(wasRejected, false);
+ done();
+ }, 100);
+ });
+ });
+
+ describe("2.3.2.2: If/when `x` is fulfilled, fulfill `promise` with the same value.", function () {
+ describe("`x` is already-fulfilled", function () {
+ function xFactory() {
+ return resolved(sentinel);
+ }
+
+ testPromiseResolution(xFactory, function (promise, done) {
+ promise.then(function onPromiseFulfilled(value) {
+ assert.strictEqual(value, sentinel);
+ done();
+ });
+ });
+ });
+
+ describe("`x` is eventually-fulfilled", function () {
+ var d = null;
+
+ function xFactory() {
+ d = deferred();
+ setTimeout(function () {
+ d.resolve(sentinel);
+ }, 50);
+ return d.promise;
+ }
+
+ testPromiseResolution(xFactory, function (promise, done) {
+ promise.then(function onPromiseFulfilled(value) {
+ assert.strictEqual(value, sentinel);
+ done();
+ });
+ });
+ });
+ });
+
+ describe("2.3.2.3: If/when `x` is rejected, reject `promise` with the same reason.", function () {
+ describe("`x` is already-rejected", function () {
+ function xFactory() {
+ return rejected(sentinel);
+ }
+
+ testPromiseResolution(xFactory, function (promise, done) {
+ promise.then(null, function onPromiseRejected(reason) {
+ assert.strictEqual(reason, sentinel);
+ done();
+ });
+ });
+ });
+
+ describe("`x` is eventually-rejected", function () {
+ var d = null;
+
+ function xFactory() {
+ d = deferred();
+ setTimeout(function () {
+ d.reject(sentinel);
+ }, 50);
+ return d.promise;
+ }
+
+ testPromiseResolution(xFactory, function (promise, done) {
+ promise.then(null, function onPromiseRejected(reason) {
+ assert.strictEqual(reason, sentinel);
+ done();
+ });
+ });
+ });
+ });
+});
+
+}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
+},{"assert":2}],19:[function(require,module,exports){
+(function (global){
+"use strict";
+
+var assert = require("assert");
+var thenables = require("./helpers/thenables");
+var reasons = require("./helpers/reasons");
+
+var adapter = global.adapter;
+var resolved = adapter.resolved;
+var rejected = adapter.rejected;
+var deferred = adapter.deferred;
+
+var dummy = { dummy: "dummy" }; // we fulfill or reject with this when we don't intend to test against it
+var sentinel = { sentinel: "sentinel" }; // a sentinel fulfillment value to test for with strict equality
+var other = { other: "other" }; // a value we don't want to be strict equal to
+var sentinelArray = [sentinel]; // a sentinel fulfillment value to test when we need an array
+
+function testPromiseResolution(xFactory, test) {
+ specify("via return from a fulfilled promise", function (done) {
+ var promise = resolved(dummy).then(function onBasePromiseFulfilled() {
+ return xFactory();
+ });
+
+ test(promise, done);
+ });
+
+ specify("via return from a rejected promise", function (done) {
+ var promise = rejected(dummy).then(null, function onBasePromiseRejected() {
+ return xFactory();
+ });
+
+ test(promise, done);
+ });
+}
+
+function testCallingResolvePromise(yFactory, stringRepresentation, test) {
+ describe("`y` is " + stringRepresentation, function () {
+ describe("`then` calls `resolvePromise` synchronously", function () {
+ function xFactory() {
+ return {
+ then: function (resolvePromise) {
+ resolvePromise(yFactory());
+ }
+ };
+ }
+
+ testPromiseResolution(xFactory, test);
+ });
+
+ describe("`then` calls `resolvePromise` asynchronously", function () {
+ function xFactory() {
+ return {
+ then: function (resolvePromise) {
+ setTimeout(function () {
+ resolvePromise(yFactory());
+ }, 0);
+ }
+ };
+ }
+
+ testPromiseResolution(xFactory, test);
+ });
+ });
+}
+
+function testCallingRejectPromise(r, stringRepresentation, test) {
+ describe("`r` is " + stringRepresentation, function () {
+ describe("`then` calls `rejectPromise` synchronously", function () {
+ function xFactory() {
+ return {
+ then: function (resolvePromise, rejectPromise) {
+ rejectPromise(r);
+ }
+ };
+ }
+
+ testPromiseResolution(xFactory, test);
+ });
+
+ describe("`then` calls `rejectPromise` asynchronously", function () {
+ function xFactory() {
+ return {
+ then: function (resolvePromise, rejectPromise) {
+ setTimeout(function () {
+ rejectPromise(r);
+ }, 0);
+ }
+ };
+ }
+
+ testPromiseResolution(xFactory, test);
+ });
+ });
+}
+
+function testCallingResolvePromiseFulfillsWith(yFactory, stringRepresentation, fulfillmentValue) {
+ testCallingResolvePromise(yFactory, stringRepresentation, function (promise, done) {
+ promise.then(function onPromiseFulfilled(value) {
+ assert.strictEqual(value, fulfillmentValue);
+ done();
+ });
+ });
+}
+
+function testCallingResolvePromiseRejectsWith(yFactory, stringRepresentation, rejectionReason) {
+ testCallingResolvePromise(yFactory, stringRepresentation, function (promise, done) {
+ promise.then(null, function onPromiseRejected(reason) {
+ assert.strictEqual(reason, rejectionReason);
+ done();
+ });
+ });
+}
+
+function testCallingRejectPromiseRejectsWith(reason, stringRepresentation) {
+ testCallingRejectPromise(reason, stringRepresentation, function (promise, done) {
+ promise.then(null, function onPromiseRejected(rejectionReason) {
+ assert.strictEqual(rejectionReason, reason);
+ done();
+ });
+ });
+}
+
+describe("2.3.3: Otherwise, if `x` is an object or function,", function () {
+ describe("2.3.3.1: Let `then` be `x.then`", function () {
+ describe("`x` is an object with null prototype", function () {
+ var numberOfTimesThenWasRetrieved = null;
+
+ beforeEach(function () {
+ numberOfTimesThenWasRetrieved = 0;
+ });
+
+ function xFactory() {
+ return Object.create(null, {
+ then: {
+ get: function () {
+ ++numberOfTimesThenWasRetrieved;
+ return function thenMethodForX(onFulfilled) {
+ onFulfilled();
+ };
+ }
+ }
+ });
+ }
+
+ testPromiseResolution(xFactory, function (promise, done) {
+ promise.then(function () {
+ assert.strictEqual(numberOfTimesThenWasRetrieved, 1);
+ done();
+ });
+ });
+ });
+
+ describe("`x` is an object with normal Object.prototype", function () {
+ var numberOfTimesThenWasRetrieved = null;
+
+ beforeEach(function () {
+ numberOfTimesThenWasRetrieved = 0;
+ });
+
+ function xFactory() {
+ return Object.create(Object.prototype, {
+ then: {
+ get: function () {
+ ++numberOfTimesThenWasRetrieved;
+ return function thenMethodForX(onFulfilled) {
+ onFulfilled();
+ };
+ }
+ }
+ });
+ }
+
+ testPromiseResolution(xFactory, function (promise, done) {
+ promise.then(function () {
+ assert.strictEqual(numberOfTimesThenWasRetrieved, 1);
+ done();
+ });
+ });
+ });
+
+ describe("`x` is a function", function () {
+ var numberOfTimesThenWasRetrieved = null;
+
+ beforeEach(function () {
+ numberOfTimesThenWasRetrieved = 0;
+ });
+
+ function xFactory() {
+ function x() { }
+
+ Object.defineProperty(x, "then", {
+ get: function () {
+ ++numberOfTimesThenWasRetrieved;
+ return function thenMethodForX(onFulfilled) {
+ onFulfilled();
+ };
+ }
+ });
+
+ return x;
+ }
+
+ testPromiseResolution(xFactory, function (promise, done) {
+ promise.then(function () {
+ assert.strictEqual(numberOfTimesThenWasRetrieved, 1);
+ done();
+ });
+ });
+ });
+ });
+
+ describe("2.3.3.2: If retrieving the property `x.then` results in a thrown exception `e`, reject `promise` with " +
+ "`e` as the reason.", function () {
+ function testRejectionViaThrowingGetter(e, stringRepresentation) {
+ function xFactory() {
+ return Object.create(Object.prototype, {
+ then: {
+ get: function () {
+ throw e;
+ }
+ }
+ });
+ }
+
+ describe("`e` is " + stringRepresentation, function () {
+ testPromiseResolution(xFactory, function (promise, done) {
+ promise.then(null, function (reason) {
+ assert.strictEqual(reason, e);
+ done();
+ });
+ });
+ });
+ }
+
+ Object.keys(reasons).forEach(function (stringRepresentation) {
+ testRejectionViaThrowingGetter(reasons[stringRepresentation], stringRepresentation);
+ });
+ });
+
+ describe("2.3.3.3: If `then` is a function, call it with `x` as `this`, first argument `resolvePromise`, and " +
+ "second argument `rejectPromise`", function () {
+ describe("Calls with `x` as `this` and two function arguments", function () {
+ function xFactory() {
+ var x = {
+ then: function (onFulfilled, onRejected) {
+ assert.strictEqual(this, x);
+ assert.strictEqual(typeof onFulfilled, "function");
+ assert.strictEqual(typeof onRejected, "function");
+ onFulfilled();
+ }
+ };
+ return x;
+ }
+
+ testPromiseResolution(xFactory, function (promise, done) {
+ promise.then(function () {
+ done();
+ });
+ });
+ });
+
+ describe("Uses the original value of `then`", function () {
+ var numberOfTimesThenWasRetrieved = null;
+
+ beforeEach(function () {
+ numberOfTimesThenWasRetrieved = 0;
+ });
+
+ function xFactory() {
+ return Object.create(Object.prototype, {
+ then: {
+ get: function () {
+ if (numberOfTimesThenWasRetrieved === 0) {
+ return function (onFulfilled) {
+ onFulfilled();
+ };
+ }
+ return null;
+ }
+ }
+ });
+ }
+
+ testPromiseResolution(xFactory, function (promise, done) {
+ promise.then(function () {
+ done();
+ });
+ });
+ });
+
+ describe("2.3.3.3.1: If/when `resolvePromise` is called with value `y`, run `[[Resolve]](promise, y)`",
+ function () {
+ describe("`y` is not a thenable", function () {
+ testCallingResolvePromiseFulfillsWith(function () { return undefined; }, "`undefined`", undefined);
+ testCallingResolvePromiseFulfillsWith(function () { return null; }, "`null`", null);
+ testCallingResolvePromiseFulfillsWith(function () { return false; }, "`false`", false);
+ testCallingResolvePromiseFulfillsWith(function () { return 5; }, "`5`", 5);
+ testCallingResolvePromiseFulfillsWith(function () { return sentinel; }, "an object", sentinel);
+ testCallingResolvePromiseFulfillsWith(function () { return sentinelArray; }, "an array", sentinelArray);
+ });
+
+ describe("`y` is a thenable", function () {
+ Object.keys(thenables.fulfilled).forEach(function (stringRepresentation) {
+ function yFactory() {
+ return thenables.fulfilled[stringRepresentation](sentinel);
+ }
+
+ testCallingResolvePromiseFulfillsWith(yFactory, stringRepresentation, sentinel);
+ });
+
+ Object.keys(thenables.rejected).forEach(function (stringRepresentation) {
+ function yFactory() {
+ return thenables.rejected[stringRepresentation](sentinel);
+ }
+
+ testCallingResolvePromiseRejectsWith(yFactory, stringRepresentation, sentinel);
+ });
+ });
+
+ describe("`y` is a thenable for a thenable", function () {
+ Object.keys(thenables.fulfilled).forEach(function (outerStringRepresentation) {
+ var outerThenableFactory = thenables.fulfilled[outerStringRepresentation];
+
+ Object.keys(thenables.fulfilled).forEach(function (innerStringRepresentation) {
+ var innerThenableFactory = thenables.fulfilled[innerStringRepresentation];
+
+ var stringRepresentation = outerStringRepresentation + " for " + innerStringRepresentation;
+
+ function yFactory() {
+ return outerThenableFactory(innerThenableFactory(sentinel));
+ }
+
+ testCallingResolvePromiseFulfillsWith(yFactory, stringRepresentation, sentinel);
+ });
+
+ Object.keys(thenables.rejected).forEach(function (innerStringRepresentation) {
+ var innerThenableFactory = thenables.rejected[innerStringRepresentation];
+
+ var stringRepresentation = outerStringRepresentation + " for " + innerStringRepresentation;
+
+ function yFactory() {
+ return outerThenableFactory(innerThenableFactory(sentinel));
+ }
+
+ testCallingResolvePromiseRejectsWith(yFactory, stringRepresentation, sentinel);
+ });
+ });
+ });
+ });
+
+ describe("2.3.3.3.2: If/when `rejectPromise` is called with reason `r`, reject `promise` with `r`",
+ function () {
+ Object.keys(reasons).forEach(function (stringRepresentation) {
+ testCallingRejectPromiseRejectsWith(reasons[stringRepresentation], stringRepresentation);
+ });
+ });
+
+ describe("2.3.3.3.3: If both `resolvePromise` and `rejectPromise` are called, or multiple calls to the same " +
+ "argument are made, the first call takes precedence, and any further calls are ignored.",
+ function () {
+ describe("calling `resolvePromise` then `rejectPromise`, both synchronously", function () {
+ function xFactory() {
+ return {
+ then: function (resolvePromise, rejectPromise) {
+ resolvePromise(sentinel);
+ rejectPromise(other);
+ }
+ };
+ }
+
+ testPromiseResolution(xFactory, function (promise, done) {
+ promise.then(function (value) {
+ assert.strictEqual(value, sentinel);
+ done();
+ });
+ });
+ });
+
+ describe("calling `resolvePromise` synchronously then `rejectPromise` asynchronously", function () {
+ function xFactory() {
+ return {
+ then: function (resolvePromise, rejectPromise) {
+ resolvePromise(sentinel);
+
+ setTimeout(function () {
+ rejectPromise(other);
+ }, 0);
+ }
+ };
+ }
+
+ testPromiseResolution(xFactory, function (promise, done) {
+ promise.then(function (value) {
+ assert.strictEqual(value, sentinel);
+ done();
+ });
+ });
+ });
+
+ describe("calling `resolvePromise` then `rejectPromise`, both asynchronously", function () {
+ function xFactory() {
+ return {
+ then: function (resolvePromise, rejectPromise) {
+ setTimeout(function () {
+ resolvePromise(sentinel);
+ }, 0);
+
+ setTimeout(function () {
+ rejectPromise(other);
+ }, 0);
+ }
+ };
+ }
+
+ testPromiseResolution(xFactory, function (promise, done) {
+ promise.then(function (value) {
+ assert.strictEqual(value, sentinel);
+ done();
+ });
+ });
+ });
+
+ describe("calling `resolvePromise` with an asynchronously-fulfilled promise, then calling " +
+ "`rejectPromise`, both synchronously", function () {
+ function xFactory() {
+ var d = deferred();
+ setTimeout(function () {
+ d.resolve(sentinel);
+ }, 50);
+
+ return {
+ then: function (resolvePromise, rejectPromise) {
+ resolvePromise(d.promise);
+ rejectPromise(other);
+ }
+ };
+ }
+
+ testPromiseResolution(xFactory, function (promise, done) {
+ promise.then(function (value) {
+ assert.strictEqual(value, sentinel);
+ done();
+ });
+ });
+ });
+
+ describe("calling `resolvePromise` with an asynchronously-rejected promise, then calling " +
+ "`rejectPromise`, both synchronously", function () {
+ function xFactory() {
+ var d = deferred();
+ setTimeout(function () {
+ d.reject(sentinel);
+ }, 50);
+
+ return {
+ then: function (resolvePromise, rejectPromise) {
+ resolvePromise(d.promise);
+ rejectPromise(other);
+ }
+ };
+ }
+
+ testPromiseResolution(xFactory, function (promise, done) {
+ promise.then(null, function (reason) {
+ assert.strictEqual(reason, sentinel);
+ done();
+ });
+ });
+ });
+
+ describe("calling `rejectPromise` then `resolvePromise`, both synchronously", function () {
+ function xFactory() {
+ return {
+ then: function (resolvePromise, rejectPromise) {
+ rejectPromise(sentinel);
+ resolvePromise(other);
+ }
+ };
+ }
+
+ testPromiseResolution(xFactory, function (promise, done) {
+ promise.then(null, function (reason) {
+ assert.strictEqual(reason, sentinel);
+ done();
+ });
+ });
+ });
+
+ describe("calling `rejectPromise` synchronously then `resolvePromise` asynchronously", function () {
+ function xFactory() {
+ return {
+ then: function (resolvePromise, rejectPromise) {
+ rejectPromise(sentinel);
+
+ setTimeout(function () {
+ resolvePromise(other);
+ }, 0);
+ }
+ };
+ }
+
+ testPromiseResolution(xFactory, function (promise, done) {
+ promise.then(null, function (reason) {
+ assert.strictEqual(reason, sentinel);
+ done();
+ });
+ });
+ });
+
+ describe("calling `rejectPromise` then `resolvePromise`, both asynchronously", function () {
+ function xFactory() {
+ return {
+ then: function (resolvePromise, rejectPromise) {
+ setTimeout(function () {
+ rejectPromise(sentinel);
+ }, 0);
+
+ setTimeout(function () {
+ resolvePromise(other);
+ }, 0);
+ }
+ };
+ }
+
+ testPromiseResolution(xFactory, function (promise, done) {
+ promise.then(null, function (reason) {
+ assert.strictEqual(reason, sentinel);
+ done();
+ });
+ });
+ });
+
+ describe("calling `resolvePromise` twice synchronously", function () {
+ function xFactory() {
+ return {
+ then: function (resolvePromise) {
+ resolvePromise(sentinel);
+ resolvePromise(other);
+ }
+ };
+ }
+
+ testPromiseResolution(xFactory, function (promise, done) {
+ promise.then(function (value) {
+ assert.strictEqual(value, sentinel);
+ done();
+ });
+ });
+ });
+
+ describe("calling `resolvePromise` twice, first synchronously then asynchronously", function () {
+ function xFactory() {
+ return {
+ then: function (resolvePromise) {
+ resolvePromise(sentinel);
+
+ setTimeout(function () {
+ resolvePromise(other);
+ }, 0);
+ }
+ };
+ }
+
+ testPromiseResolution(xFactory, function (promise, done) {
+ promise.then(function (value) {
+ assert.strictEqual(value, sentinel);
+ done();
+ });
+ });
+ });
+
+ describe("calling `resolvePromise` twice, both times asynchronously", function () {
+ function xFactory() {
+ return {
+ then: function (resolvePromise) {
+ setTimeout(function () {
+ resolvePromise(sentinel);
+ }, 0);
+
+ setTimeout(function () {
+ resolvePromise(other);
+ }, 0);
+ }
+ };
+ }
+
+ testPromiseResolution(xFactory, function (promise, done) {
+ promise.then(function (value) {
+ assert.strictEqual(value, sentinel);
+ done();
+ });
+ });
+ });
+
+ describe("calling `resolvePromise` with an asynchronously-fulfilled promise, then calling it again, both " +
+ "times synchronously", function () {
+ function xFactory() {
+ var d = deferred();
+ setTimeout(function () {
+ d.resolve(sentinel);
+ }, 50);
+
+ return {
+ then: function (resolvePromise) {
+ resolvePromise(d.promise);
+ resolvePromise(other);
+ }
+ };
+ }
+
+ testPromiseResolution(xFactory, function (promise, done) {
+ promise.then(function (value) {
+ assert.strictEqual(value, sentinel);
+ done();
+ });
+ });
+ });
+
+ describe("calling `resolvePromise` with an asynchronously-rejected promise, then calling it again, both " +
+ "times synchronously", function () {
+ function xFactory() {
+ var d = deferred();
+ setTimeout(function () {
+ d.reject(sentinel);
+ }, 50);
+
+ return {
+ then: function (resolvePromise) {
+ resolvePromise(d.promise);
+ resolvePromise(other);
+ }
+ };
+ }
+
+ testPromiseResolution(xFactory, function (promise, done) {
+ promise.then(null, function (reason) {
+ assert.strictEqual(reason, sentinel);
+ done();
+ });
+ });
+ });
+
+ describe("calling `rejectPromise` twice synchronously", function () {
+ function xFactory() {
+ return {
+ then: function (resolvePromise, rejectPromise) {
+ rejectPromise(sentinel);
+ rejectPromise(other);
+ }
+ };
+ }
+
+ testPromiseResolution(xFactory, function (promise, done) {
+ promise.then(null, function (reason) {
+ assert.strictEqual(reason, sentinel);
+ done();
+ });
+ });
+ });
+
+ describe("calling `rejectPromise` twice, first synchronously then asynchronously", function () {
+ function xFactory() {
+ return {
+ then: function (resolvePromise, rejectPromise) {
+ rejectPromise(sentinel);
+
+ setTimeout(function () {
+ rejectPromise(other);
+ }, 0);
+ }
+ };
+ }
+
+ testPromiseResolution(xFactory, function (promise, done) {
+ promise.then(null, function (reason) {
+ assert.strictEqual(reason, sentinel);
+ done();
+ });
+ });
+ });
+
+ describe("calling `rejectPromise` twice, both times asynchronously", function () {
+ function xFactory() {
+ return {
+ then: function (resolvePromise, rejectPromise) {
+ setTimeout(function () {
+ rejectPromise(sentinel);
+ }, 0);
+
+ setTimeout(function () {
+ rejectPromise(other);
+ }, 0);
+ }
+ };
+ }
+
+ testPromiseResolution(xFactory, function (promise, done) {
+ promise.then(null, function (reason) {
+ assert.strictEqual(reason, sentinel);
+ done();
+ });
+ });
+ });
+
+ describe("saving and abusing `resolvePromise` and `rejectPromise`", function () {
+ var savedResolvePromise, savedRejectPromise;
+
+ function xFactory() {
+ return {
+ then: function (resolvePromise, rejectPromise) {
+ savedResolvePromise = resolvePromise;
+ savedRejectPromise = rejectPromise;
+ }
+ };
+ }
+
+ beforeEach(function () {
+ savedResolvePromise = null;
+ savedRejectPromise = null;
+ });
+
+ testPromiseResolution(xFactory, function (promise, done) {
+ var timesFulfilled = 0;
+ var timesRejected = 0;
+
+ promise.then(
+ function () {
+ ++timesFulfilled;
+ },
+ function () {
+ ++timesRejected;
+ }
+ );
+
+ if (savedResolvePromise && savedRejectPromise) {
+ savedResolvePromise(dummy);
+ savedResolvePromise(dummy);
+ savedRejectPromise(dummy);
+ savedRejectPromise(dummy);
+ }
+
+ setTimeout(function () {
+ savedResolvePromise(dummy);
+ savedResolvePromise(dummy);
+ savedRejectPromise(dummy);
+ savedRejectPromise(dummy);
+ }, 50);
+
+ setTimeout(function () {
+ assert.strictEqual(timesFulfilled, 1);
+ assert.strictEqual(timesRejected, 0);
+ done();
+ }, 100);
+ });
+ });
+ });
+
+ describe("2.3.3.3.4: If calling `then` throws an exception `e`,", function () {
+ describe("2.3.3.3.4.1: If `resolvePromise` or `rejectPromise` have been called, ignore it.", function () {
+ describe("`resolvePromise` was called with a non-thenable", function () {
+ function xFactory() {
+ return {
+ then: function (resolvePromise) {
+ resolvePromise(sentinel);
+ throw other;
+ }
+ };
+ }
+
+ testPromiseResolution(xFactory, function (promise, done) {
+ promise.then(function (value) {
+ assert.strictEqual(value, sentinel);
+ done();
+ });
+ });
+ });
+
+ describe("`resolvePromise` was called with an asynchronously-fulfilled promise", function () {
+ function xFactory() {
+ var d = deferred();
+ setTimeout(function () {
+ d.resolve(sentinel);
+ }, 50);
+
+ return {
+ then: function (resolvePromise) {
+ resolvePromise(d.promise);
+ throw other;
+ }
+ };
+ }
+
+ testPromiseResolution(xFactory, function (promise, done) {
+ promise.then(function (value) {
+ assert.strictEqual(value, sentinel);
+ done();
+ });
+ });
+ });
+
+ describe("`resolvePromise` was called with an asynchronously-rejected promise", function () {
+ function xFactory() {
+ var d = deferred();
+ setTimeout(function () {
+ d.reject(sentinel);
+ }, 50);
+
+ return {
+ then: function (resolvePromise) {
+ resolvePromise(d.promise);
+ throw other;
+ }
+ };
+ }
+
+ testPromiseResolution(xFactory, function (promise, done) {
+ promise.then(null, function (reason) {
+ assert.strictEqual(reason, sentinel);
+ done();
+ });
+ });
+ });
+
+ describe("`rejectPromise` was called", function () {
+ function xFactory() {
+ return {
+ then: function (resolvePromise, rejectPromise) {
+ rejectPromise(sentinel);
+ throw other;
+ }
+ };
+ }
+
+ testPromiseResolution(xFactory, function (promise, done) {
+ promise.then(null, function (reason) {
+ assert.strictEqual(reason, sentinel);
+ done();
+ });
+ });
+ });
+
+ describe("`resolvePromise` then `rejectPromise` were called", function () {
+ function xFactory() {
+ return {
+ then: function (resolvePromise, rejectPromise) {
+ resolvePromise(sentinel);
+ rejectPromise(other);
+ throw other;
+ }
+ };
+ }
+
+ testPromiseResolution(xFactory, function (promise, done) {
+ promise.then(function (value) {
+ assert.strictEqual(value, sentinel);
+ done();
+ });
+ });
+ });
+
+ describe("`rejectPromise` then `resolvePromise` were called", function () {
+ function xFactory() {
+ return {
+ then: function (resolvePromise, rejectPromise) {
+ rejectPromise(sentinel);
+ resolvePromise(other);
+ throw other;
+ }
+ };
+ }
+
+ testPromiseResolution(xFactory, function (promise, done) {
+ promise.then(null, function (reason) {
+ assert.strictEqual(reason, sentinel);
+ done();
+ });
+ });
+ });
+ });
+
+ describe("2.3.3.3.4.2: Otherwise, reject `promise` with `e` as the reason.", function () {
+ describe("straightforward case", function () {
+ function xFactory() {
+ return {
+ then: function () {
+ throw sentinel;
+ }
+ };
+ }
+
+ testPromiseResolution(xFactory, function (promise, done) {
+ promise.then(null, function (reason) {
+ assert.strictEqual(reason, sentinel);
+ done();
+ });
+ });
+ });
+
+ describe("`resolvePromise` is called asynchronously before the `throw`", function () {
+ function xFactory() {
+ return {
+ then: function (resolvePromise) {
+ setTimeout(function () {
+ resolvePromise(other);
+ }, 0);
+ throw sentinel;
+ }
+ };
+ }
+
+ testPromiseResolution(xFactory, function (promise, done) {
+ promise.then(null, function (reason) {
+ assert.strictEqual(reason, sentinel);
+ done();
+ });
+ });
+ });
+
+ describe("`rejectPromise` is called asynchronously before the `throw`", function () {
+ function xFactory() {
+ return {
+ then: function (resolvePromise, rejectPromise) {
+ setTimeout(function () {
+ rejectPromise(other);
+ }, 0);
+ throw sentinel;
+ }
+ };
+ }
+
+ testPromiseResolution(xFactory, function (promise, done) {
+ promise.then(null, function (reason) {
+ assert.strictEqual(reason, sentinel);
+ done();
+ });
+ });
+ });
+ });
+ });
+ });
+
+ describe("2.3.3.4: If `then` is not a function, fulfill promise with `x`", function () {
+ function testFulfillViaNonFunction(then, stringRepresentation) {
+ var x = null;
+
+ beforeEach(function () {
+ x = { then: then };
+ });
+
+ function xFactory() {
+ return x;
+ }
+
+ describe("`then` is " + stringRepresentation, function () {
+ testPromiseResolution(xFactory, function (promise, done) {
+ promise.then(function (value) {
+ assert.strictEqual(value, x);
+ done();
+ });
+ });
+ });
+ }
+
+ testFulfillViaNonFunction(5, "`5`");
+ testFulfillViaNonFunction({}, "an object");
+ testFulfillViaNonFunction([function () { }], "an array containing a function");
+ testFulfillViaNonFunction(/a-b/i, "a regular expression");
+ testFulfillViaNonFunction(Object.create(Function.prototype), "an object inheriting from `Function.prototype`");
+ });
+});
+
+}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
+},{"./helpers/reasons":21,"./helpers/thenables":23,"assert":2}],20:[function(require,module,exports){
+"use strict";
+
+var assert = require("assert");
+var testFulfilled = require("./helpers/testThreeCases").testFulfilled;
+var testRejected = require("./helpers/testThreeCases").testRejected;
+
+var dummy = { dummy: "dummy" }; // we fulfill or reject with this when we don't intend to test against it
+
+describe("2.3.4: If `x` is not an object or function, fulfill `promise` with `x`", function () {
+ function testValue(expectedValue, stringRepresentation, beforeEachHook, afterEachHook) {
+ describe("The value is " + stringRepresentation, function () {
+ if (typeof beforeEachHook === "function") {
+ beforeEach(beforeEachHook);
+ }
+ if (typeof afterEachHook === "function") {
+ afterEach(afterEachHook);
+ }
+
+ testFulfilled(dummy, function (promise1, done) {
+ var promise2 = promise1.then(function onFulfilled() {
+ return expectedValue;
+ });
+
+ promise2.then(function onPromise2Fulfilled(actualValue) {
+ assert.strictEqual(actualValue, expectedValue);
+ done();
+ });
+ });
+ testRejected(dummy, function (promise1, done) {
+ var promise2 = promise1.then(null, function onRejected() {
+ return expectedValue;
+ });
+
+ promise2.then(function onPromise2Fulfilled(actualValue) {
+ assert.strictEqual(actualValue, expectedValue);
+ done();
+ });
+ });
+ });
+ }
+
+ testValue(undefined, "`undefined`");
+ testValue(null, "`null`");
+ testValue(false, "`false`");
+ testValue(true, "`true`");
+ testValue(0, "`0`");
+
+ testValue(
+ true,
+ "`true` with `Boolean.prototype` modified to have a `then` method",
+ function () {
+ Boolean.prototype.then = function () {};
+ },
+ function () {
+ delete Boolean.prototype.then;
+ }
+ );
+
+ testValue(
+ 1,
+ "`1` with `Number.prototype` modified to have a `then` method",
+ function () {
+ Number.prototype.then = function () {};
+ },
+ function () {
+ delete Number.prototype.then;
+ }
+ );
+});
+
+},{"./helpers/testThreeCases":22,"assert":2}],21:[function(require,module,exports){
+(function (global){
+"use strict";
+
+// This module exports some valid rejection reason factories, keyed by human-readable versions of their names.
+
+var adapter = global.adapter;
+var resolved = adapter.resolved;
+var rejected = adapter.rejected;
+
+var dummy = { dummy: "dummy" };
+
+exports["`undefined`"] = function () {
+ return undefined;
+};
+
+exports["`null`"] = function () {
+ return null;
+};
+
+exports["`false`"] = function () {
+ return false;
+};
+
+exports["`0`"] = function () {
+ return 0;
+};
+
+exports["an error"] = function () {
+ return new Error();
+};
+
+exports["an error without a stack"] = function () {
+ var error = new Error();
+ delete error.stack;
+
+ return error;
+};
+
+exports["a date"] = function () {
+ return new Date();
+};
+
+exports["an object"] = function () {
+ return {};
+};
+
+exports["an always-pending thenable"] = function () {
+ return { then: function () { } };
+};
+
+exports["a fulfilled promise"] = function () {
+ return resolved(dummy);
+};
+
+exports["a rejected promise"] = function () {
+ return rejected(dummy);
+};
+
+}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
+},{}],22:[function(require,module,exports){
+(function (global){
+"use strict";
+
+var adapter = global.adapter;
+var resolved = adapter.resolved;
+var rejected = adapter.rejected;
+var deferred = adapter.deferred;
+
+exports.testFulfilled = function (value, test) {
+ specify("already-fulfilled", function (done) {
+ test(resolved(value), done);
+ });
+
+ specify("immediately-fulfilled", function (done) {
+ var d = deferred();
+ test(d.promise, done);
+ d.resolve(value);
+ });
+
+ specify("eventually-fulfilled", function (done) {
+ var d = deferred();
+ test(d.promise, done);
+ setTimeout(function () {
+ d.resolve(value);
+ }, 50);
+ });
+};
+
+exports.testRejected = function (reason, test) {
+ specify("already-rejected", function (done) {
+ test(rejected(reason), done);
+ });
+
+ specify("immediately-rejected", function (done) {
+ var d = deferred();
+ test(d.promise, done);
+ d.reject(reason);
+ });
+
+ specify("eventually-rejected", function (done) {
+ var d = deferred();
+ test(d.promise, done);
+ setTimeout(function () {
+ d.reject(reason);
+ }, 50);
+ });
+};
+
+}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
+},{}],23:[function(require,module,exports){
+(function (global){
+"use strict";
+
+var adapter = global.adapter;
+var resolved = adapter.resolved;
+var rejected = adapter.rejected;
+var deferred = adapter.deferred;
+
+var other = { other: "other" }; // a value we don't want to be strict equal to
+
+exports.fulfilled = {
+ "a synchronously-fulfilled custom thenable": function (value) {
+ return {
+ then: function (onFulfilled) {
+ onFulfilled(value);
+ }
+ };
+ },
+
+ "an asynchronously-fulfilled custom thenable": function (value) {
+ return {
+ then: function (onFulfilled) {
+ setTimeout(function () {
+ onFulfilled(value);
+ }, 0);
+ }
+ };
+ },
+
+ "a synchronously-fulfilled one-time thenable": function (value) {
+ var numberOfTimesThenRetrieved = 0;
+ return Object.create(null, {
+ then: {
+ get: function () {
+ if (numberOfTimesThenRetrieved === 0) {
+ ++numberOfTimesThenRetrieved;
+ return function (onFulfilled) {
+ onFulfilled(value);
+ };
+ }
+ return null;
+ }
+ }
+ });
+ },
+
+ "a thenable that tries to fulfill twice": function (value) {
+ return {
+ then: function (onFulfilled) {
+ onFulfilled(value);
+ onFulfilled(other);
+ }
+ };
+ },
+
+ "a thenable that fulfills but then throws": function (value) {
+ return {
+ then: function (onFulfilled) {
+ onFulfilled(value);
+ throw other;
+ }
+ };
+ },
+
+ "an already-fulfilled promise": function (value) {
+ return resolved(value);
+ },
+
+ "an eventually-fulfilled promise": function (value) {
+ var d = deferred();
+ setTimeout(function () {
+ d.resolve(value);
+ }, 50);
+ return d.promise;
+ }
+};
+
+exports.rejected = {
+ "a synchronously-rejected custom thenable": function (reason) {
+ return {
+ then: function (onFulfilled, onRejected) {
+ onRejected(reason);
+ }
+ };
+ },
+
+ "an asynchronously-rejected custom thenable": function (reason) {
+ return {
+ then: function (onFulfilled, onRejected) {
+ setTimeout(function () {
+ onRejected(reason);
+ }, 0);
+ }
+ };
+ },
+
+ "a synchronously-rejected one-time thenable": function (reason) {
+ var numberOfTimesThenRetrieved = 0;
+ return Object.create(null, {
+ then: {
+ get: function () {
+ if (numberOfTimesThenRetrieved === 0) {
+ ++numberOfTimesThenRetrieved;
+ return function (onFulfilled, onRejected) {
+ onRejected(reason);
+ };
+ }
+ return null;
+ }
+ }
+ });
+ },
+
+ "a thenable that immediately throws in `then`": function (reason) {
+ return {
+ then: function () {
+ throw reason;
+ }
+ };
+ },
+
+ "an object with a throwing `then` accessor": function (reason) {
+ return Object.create(null, {
+ then: {
+ get: function () {
+ throw reason;
+ }
+ }
+ });
+ },
+
+ "an already-rejected promise": function (reason) {
+ return rejected(reason);
+ },
+
+ "an eventually-rejected promise": function (reason) {
+ var d = deferred();
+ setTimeout(function () {
+ d.reject(reason);
+ }, 50);
+ return d.promise;
+ }
+};
+
+}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
+},{}],24:[function(require,module,exports){
+/**
+ * Sinon core utilities. For internal use only.
+ *
+ * @author Christian Johansen (christian@cjohansen.no)
+ * @license BSD
+ *
+ * Copyright (c) 2010-2013 Christian Johansen
+ */
+"use strict";
+
+var sinon = (function () {
+ var sinon;
+ var isNode = typeof module !== "undefined" && module.exports && typeof require === "function";
+ var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd;
+
+ function loadDependencies(require, exports, module) {
+ sinon = module.exports = require("./sinon/util/core");
+ require("./sinon/extend");
+ require("./sinon/typeOf");
+ require("./sinon/times_in_words");
+ require("./sinon/spy");
+ require("./sinon/call");
+ require("./sinon/behavior");
+ require("./sinon/stub");
+ require("./sinon/mock");
+ require("./sinon/collection");
+ require("./sinon/assert");
+ require("./sinon/sandbox");
+ require("./sinon/test");
+ require("./sinon/test_case");
+ require("./sinon/match");
+ require("./sinon/format");
+ require("./sinon/log_error");
+ }
+
+ if (isAMD) {
+ define(loadDependencies);
+ } else if (isNode) {
+ loadDependencies(require, module.exports, module);
+ sinon = module.exports;
+ } else {
+ sinon = {};
+ }
+
+ return sinon;
+}());
+
+},{"./sinon/assert":25,"./sinon/behavior":26,"./sinon/call":27,"./sinon/collection":28,"./sinon/extend":29,"./sinon/format":30,"./sinon/log_error":31,"./sinon/match":32,"./sinon/mock":33,"./sinon/sandbox":34,"./sinon/spy":35,"./sinon/stub":36,"./sinon/test":37,"./sinon/test_case":38,"./sinon/times_in_words":39,"./sinon/typeOf":40,"./sinon/util/core":41}],25:[function(require,module,exports){
+(function (global){
+/**
+ * @depend times_in_words.js
+ * @depend util/core.js
+ * @depend match.js
+ * @depend format.js
+ */
+/**
+ * Assertions matching the test spy retrieval interface.
+ *
+ * @author Christian Johansen (christian@cjohansen.no)
+ * @license BSD
+ *
+ * Copyright (c) 2010-2013 Christian Johansen
+ */
+"use strict";
+
+(function (sinon, global) {
+ var slice = Array.prototype.slice;
+
+ function makeApi(sinon) {
+ var assert;
+
+ function verifyIsStub() {
+ var method;
+
+ for (var i = 0, l = arguments.length; i < l; ++i) {
+ method = arguments[i];
+
+ if (!method) {
+ assert.fail("fake is not a spy");
+ }
+
+ if (method.proxy) {
+ verifyIsStub(method.proxy);
+ } else {
+ if (typeof method != "function") {
+ assert.fail(method + " is not a function");
+ }
+
+ if (typeof method.getCall != "function") {
+ assert.fail(method + " is not stubbed");
+ }
+ }
+
+ }
+ }
+
+ function failAssertion(object, msg) {
+ object = object || global;
+ var failMethod = object.fail || assert.fail;
+ failMethod.call(object, msg);
+ }
+
+ function mirrorPropAsAssertion(name, method, message) {
+ if (arguments.length == 2) {
+ message = method;
+ method = name;
+ }
+
+ assert[name] = function (fake) {
+ verifyIsStub(fake);
+
+ var args = slice.call(arguments, 1);
+ var failed = false;
+
+ if (typeof method == "function") {
+ failed = !method(fake);
+ } else {
+ failed = typeof fake[method] == "function" ?
+ !fake[method].apply(fake, args) : !fake[method];
+ }
+
+ if (failed) {
+ failAssertion(this, (fake.printf || fake.proxy.printf).apply(fake, [message].concat(args)));
+ } else {
+ assert.pass(name);
+ }
+ };
+ }
+
+ function exposedName(prefix, prop) {
+ return !prefix || /^fail/.test(prop) ? prop :
+ prefix + prop.slice(0, 1).toUpperCase() + prop.slice(1);
+ }
+
+ assert = {
+ failException: "AssertError",
+
+ fail: function fail(message) {
+ var error = new Error(message);
+ error.name = this.failException || assert.failException;
+
+ throw error;
+ },
+
+ pass: function pass(assertion) {},
+
+ callOrder: function assertCallOrder() {
+ verifyIsStub.apply(null, arguments);
+ var expected = "", actual = "";
+
+ if (!sinon.calledInOrder(arguments)) {
+ try {
+ expected = [].join.call(arguments, ", ");
+ var calls = slice.call(arguments);
+ var i = calls.length;
+ while (i) {
+ if (!calls[--i].called) {
+ calls.splice(i, 1);
+ }
+ }
+ actual = sinon.orderByFirstCall(calls).join(", ");
+ } catch (e) {
+ // If this fails, we'll just fall back to the blank string
+ }
+
+ failAssertion(this, "expected " + expected + " to be " +
+ "called in order but were called as " + actual);
+ } else {
+ assert.pass("callOrder");
+ }
+ },
+
+ callCount: function assertCallCount(method, count) {
+ verifyIsStub(method);
+
+ if (method.callCount != count) {
+ var msg = "expected %n to be called " + sinon.timesInWords(count) +
+ " but was called %c%C";
+ failAssertion(this, method.printf(msg));
+ } else {
+ assert.pass("callCount");
+ }
+ },
+
+ expose: function expose(target, options) {
+ if (!target) {
+ throw new TypeError("target is null or undefined");
+ }
+
+ var o = options || {};
+ var prefix = typeof o.prefix == "undefined" && "assert" || o.prefix;
+ var includeFail = typeof o.includeFail == "undefined" || !!o.includeFail;
+
+ for (var method in this) {
+ if (method != "expose" && (includeFail || !/^(fail)/.test(method))) {
+ target[exposedName(prefix, method)] = this[method];
+ }
+ }
+
+ return target;
+ },
+
+ match: function match(actual, expectation) {
+ var matcher = sinon.match(expectation);
+ if (matcher.test(actual)) {
+ assert.pass("match");
+ } else {
+ var formatted = [
+ "expected value to match",
+ " expected = " + sinon.format(expectation),
+ " actual = " + sinon.format(actual)
+ ]
+ failAssertion(this, formatted.join("\n"));
+ }
+ }
+ };
+
+ mirrorPropAsAssertion("called", "expected %n to have been called at least once but was never called");
+ mirrorPropAsAssertion("notCalled", function (spy) { return !spy.called; },
+ "expected %n to not have been called but was called %c%C");
+ mirrorPropAsAssertion("calledOnce", "expected %n to be called once but was called %c%C");
+ mirrorPropAsAssertion("calledTwice", "expected %n to be called twice but was called %c%C");
+ mirrorPropAsAssertion("calledThrice", "expected %n to be called thrice but was called %c%C");
+ mirrorPropAsAssertion("calledOn", "expected %n to be called with %1 as this but was called with %t");
+ mirrorPropAsAssertion("alwaysCalledOn", "expected %n to always be called with %1 as this but was called with %t");
+ mirrorPropAsAssertion("calledWithNew", "expected %n to be called with new");
+ mirrorPropAsAssertion("alwaysCalledWithNew", "expected %n to always be called with new");
+ mirrorPropAsAssertion("calledWith", "expected %n to be called with arguments %*%C");
+ mirrorPropAsAssertion("calledWithMatch", "expected %n to be called with match %*%C");
+ mirrorPropAsAssertion("alwaysCalledWith", "expected %n to always be called with arguments %*%C");
+ mirrorPropAsAssertion("alwaysCalledWithMatch", "expected %n to always be called with match %*%C");
+ mirrorPropAsAssertion("calledWithExactly", "expected %n to be called with exact arguments %*%C");
+ mirrorPropAsAssertion("alwaysCalledWithExactly", "expected %n to always be called with exact arguments %*%C");
+ mirrorPropAsAssertion("neverCalledWith", "expected %n to never be called with arguments %*%C");
+ mirrorPropAsAssertion("neverCalledWithMatch", "expected %n to never be called with match %*%C");
+ mirrorPropAsAssertion("threw", "%n did not throw exception%C");
+ mirrorPropAsAssertion("alwaysThrew", "%n did not always throw exception%C");
+
+ sinon.assert = assert;
+ return assert;
+ }
+
+ var isNode = typeof module !== "undefined" && module.exports && typeof require == "function";
+ var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd;
+
+ function loadDependencies(require, exports, module) {
+ var sinon = require("./util/core");
+ require("./match");
+ require("./format");
+ module.exports = makeApi(sinon);
+ }
+
+ if (isAMD) {
+ define(loadDependencies);
+ } else if (isNode) {
+ loadDependencies(require, module.exports, module);
+ } else if (!sinon) {
+ return;
+ } else {
+ makeApi(sinon);
+ }
+
+}(typeof sinon == "object" && sinon || null, typeof window != "undefined" ? window : (typeof self != "undefined") ? self : global));
+
+}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
+},{"./format":30,"./match":32,"./util/core":41}],26:[function(require,module,exports){
+(function (process){
+/**
+ * @depend util/core.js
+ * @depend extend.js
+ */
+/**
+ * Stub behavior
+ *
+ * @author Christian Johansen (christian@cjohansen.no)
+ * @author Tim Fischbach (mail@timfischbach.de)
+ * @license BSD
+ *
+ * Copyright (c) 2010-2013 Christian Johansen
+ */
+"use strict";
+
+(function (sinon) {
+ var slice = Array.prototype.slice;
+ var join = Array.prototype.join;
+ var useLeftMostCallback = -1;
+ var useRightMostCallback = -2;
+
+ var nextTick = (function () {
+ if (typeof process === "object" && typeof process.nextTick === "function") {
+ return process.nextTick;
+ } else if (typeof setImmediate === "function") {
+ return setImmediate;
+ } else {
+ return function (callback) {
+ setTimeout(callback, 0);
+ };
+ }
+ })();
+
+ function throwsException(error, message) {
+ if (typeof error == "string") {
+ this.exception = new Error(message || "");
+ this.exception.name = error;
+ } else if (!error) {
+ this.exception = new Error("Error");
+ } else {
+ this.exception = error;
+ }
+
+ return this;
+ }
+
+ function getCallback(behavior, args) {
+ var callArgAt = behavior.callArgAt;
+
+ if (callArgAt >= 0) {
+ return args[callArgAt];
+ }
+
+ var argumentList;
+
+ if (callArgAt === useLeftMostCallback) {
+ argumentList = args;
+ }
+
+ if (callArgAt === useRightMostCallback) {
+ argumentList = slice.call(args).reverse();
+ }
+
+ var callArgProp = behavior.callArgProp;
+
+ for (var i = 0, l = argumentList.length; i < l; ++i) {
+ if (!callArgProp && typeof argumentList[i] == "function") {
+ return argumentList[i];
+ }
+
+ if (callArgProp && argumentList[i] &&
+ typeof argumentList[i][callArgProp] == "function") {
+ return argumentList[i][callArgProp];
+ }
+ }
+
+ return null;
+ }
+
+ function makeApi(sinon) {
+ function getCallbackError(behavior, func, args) {
+ if (behavior.callArgAt < 0) {
+ var msg;
+
+ if (behavior.callArgProp) {
+ msg = sinon.functionName(behavior.stub) +
+ " expected to yield to '" + behavior.callArgProp +
+ "', but no object with such a property was passed.";
+ } else {
+ msg = sinon.functionName(behavior.stub) +
+ " expected to yield, but no callback was passed.";
+ }
+
+ if (args.length > 0) {
+ msg += " Received [" + join.call(args, ", ") + "]";
+ }
+
+ return msg;
+ }
+
+ return "argument at index " + behavior.callArgAt + " is not a function: " + func;
+ }
+
+ function callCallback(behavior, args) {
+ if (typeof behavior.callArgAt == "number") {
+ var func = getCallback(behavior, args);
+
+ if (typeof func != "function") {
+ throw new TypeError(getCallbackError(behavior, func, args));
+ }
+
+ if (behavior.callbackAsync) {
+ nextTick(function () {
+ func.apply(behavior.callbackContext, behavior.callbackArguments);
+ });
+ } else {
+ func.apply(behavior.callbackContext, behavior.callbackArguments);
+ }
+ }
+ }
+
+ var proto = {
+ create: function create(stub) {
+ var behavior = sinon.extend({}, sinon.behavior);
+ delete behavior.create;
+ behavior.stub = stub;
+
+ return behavior;
+ },
+
+ isPresent: function isPresent() {
+ return (typeof this.callArgAt == "number" ||
+ this.exception ||
+ typeof this.returnArgAt == "number" ||
+ this.returnThis ||
+ this.returnValueDefined);
+ },
+
+ invoke: function invoke(context, args) {
+ callCallback(this, args);
+
+ if (this.exception) {
+ throw this.exception;
+ } else if (typeof this.returnArgAt == "number") {
+ return args[this.returnArgAt];
+ } else if (this.returnThis) {
+ return context;
+ }
+
+ return this.returnValue;
+ },
+
+ onCall: function onCall(index) {
+ return this.stub.onCall(index);
+ },
+
+ onFirstCall: function onFirstCall() {
+ return this.stub.onFirstCall();
+ },
+
+ onSecondCall: function onSecondCall() {
+ return this.stub.onSecondCall();
+ },
+
+ onThirdCall: function onThirdCall() {
+ return this.stub.onThirdCall();
+ },
+
+ withArgs: function withArgs(/* arguments */) {
+ throw new Error("Defining a stub by invoking \"stub.onCall(...).withArgs(...)\" is not supported. " +
+ "Use \"stub.withArgs(...).onCall(...)\" to define sequential behavior for calls with certain arguments.");
+ },
+
+ callsArg: function callsArg(pos) {
+ if (typeof pos != "number") {
+ throw new TypeError("argument index is not number");
+ }
+
+ this.callArgAt = pos;
+ this.callbackArguments = [];
+ this.callbackContext = undefined;
+ this.callArgProp = undefined;
+ this.callbackAsync = false;
+
+ return this;
+ },
+
+ callsArgOn: function callsArgOn(pos, context) {
+ if (typeof pos != "number") {
+ throw new TypeError("argument index is not number");
+ }
+ if (typeof context != "object") {
+ throw new TypeError("argument context is not an object");
+ }
+
+ this.callArgAt = pos;
+ this.callbackArguments = [];
+ this.callbackContext = context;
+ this.callArgProp = undefined;
+ this.callbackAsync = false;
+
+ return this;
+ },
+
+ callsArgWith: function callsArgWith(pos) {
+ if (typeof pos != "number") {
+ throw new TypeError("argument index is not number");
+ }
+
+ this.callArgAt = pos;
+ this.callbackArguments = slice.call(arguments, 1);
+ this.callbackContext = undefined;
+ this.callArgProp = undefined;
+ this.callbackAsync = false;
+
+ return this;
+ },
+
+ callsArgOnWith: function callsArgWith(pos, context) {
+ if (typeof pos != "number") {
+ throw new TypeError("argument index is not number");
+ }
+ if (typeof context != "object") {
+ throw new TypeError("argument context is not an object");
+ }
+
+ this.callArgAt = pos;
+ this.callbackArguments = slice.call(arguments, 2);
+ this.callbackContext = context;
+ this.callArgProp = undefined;
+ this.callbackAsync = false;
+
+ return this;
+ },
+
+ yields: function () {
+ this.callArgAt = useLeftMostCallback;
+ this.callbackArguments = slice.call(arguments, 0);
+ this.callbackContext = undefined;
+ this.callArgProp = undefined;
+ this.callbackAsync = false;
+
+ return this;
+ },
+
+ yieldsRight: function () {
+ this.callArgAt = useRightMostCallback;
+ this.callbackArguments = slice.call(arguments, 0);
+ this.callbackContext = undefined;
+ this.callArgProp = undefined;
+ this.callbackAsync = false;
+
+ return this;
+ },
+
+ yieldsOn: function (context) {
+ if (typeof context != "object") {
+ throw new TypeError("argument context is not an object");
+ }
+
+ this.callArgAt = useLeftMostCallback;
+ this.callbackArguments = slice.call(arguments, 1);
+ this.callbackContext = context;
+ this.callArgProp = undefined;
+ this.callbackAsync = false;
+
+ return this;
+ },
+
+ yieldsTo: function (prop) {
+ this.callArgAt = useLeftMostCallback;
+ this.callbackArguments = slice.call(arguments, 1);
+ this.callbackContext = undefined;
+ this.callArgProp = prop;
+ this.callbackAsync = false;
+
+ return this;
+ },
+
+ yieldsToOn: function (prop, context) {
+ if (typeof context != "object") {
+ throw new TypeError("argument context is not an object");
+ }
+
+ this.callArgAt = useLeftMostCallback;
+ this.callbackArguments = slice.call(arguments, 2);
+ this.callbackContext = context;
+ this.callArgProp = prop;
+ this.callbackAsync = false;
+
+ return this;
+ },
+
+ throws: throwsException,
+ throwsException: throwsException,
+
+ returns: function returns(value) {
+ this.returnValue = value;
+ this.returnValueDefined = true;
+
+ return this;
+ },
+
+ returnsArg: function returnsArg(pos) {
+ if (typeof pos != "number") {
+ throw new TypeError("argument index is not number");
+ }
+
+ this.returnArgAt = pos;
+
+ return this;
+ },
+
+ returnsThis: function returnsThis() {
+ this.returnThis = true;
+
+ return this;
+ }
+ };
+
+ // create asynchronous versions of callsArg* and yields* methods
+ for (var method in proto) {
+ // need to avoid creating anotherasync versions of the newly added async methods
+ if (proto.hasOwnProperty(method) &&
+ method.match(/^(callsArg|yields)/) &&
+ !method.match(/Async/)) {
+ proto[method + "Async"] = (function (syncFnName) {
+ return function () {
+ var result = this[syncFnName].apply(this, arguments);
+ this.callbackAsync = true;
+ return result;
+ };
+ })(method);
+ }
+ }
+
+ sinon.behavior = proto;
+ return proto;
+ }
+
+ var isNode = typeof module !== "undefined" && module.exports && typeof require == "function";
+ var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd;
+
+ function loadDependencies(require, exports, module) {
+ var sinon = require("./util/core");
+ require("./extend");
+ module.exports = makeApi(sinon);
+ }
+
+ if (isAMD) {
+ define(loadDependencies);
+ } else if (isNode) {
+ loadDependencies(require, module.exports, module);
+ } else if (!sinon) {
+ return;
+ } else {
+ makeApi(sinon);
+ }
+}(typeof sinon == "object" && sinon || null));
+
+}).call(this,require('_process'))
+},{"./extend":29,"./util/core":41,"_process":4}],27:[function(require,module,exports){
+/**
+ * @depend util/core.js
+ * @depend match.js
+ * @depend format.js
+ */
+/**
+ * Spy calls
+ *
+ * @author Christian Johansen (christian@cjohansen.no)
+ * @author Maximilian Antoni (mail@maxantoni.de)
+ * @license BSD
+ *
+ * Copyright (c) 2010-2013 Christian Johansen
+ * Copyright (c) 2013 Maximilian Antoni
+ */
+"use strict";
+
+(function (sinon) {
+ function makeApi(sinon) {
+ function throwYieldError(proxy, text, args) {
+ var msg = sinon.functionName(proxy) + text;
+ if (args.length) {
+ msg += " Received [" + slice.call(args).join(", ") + "]";
+ }
+ throw new Error(msg);
+ }
+
+ var slice = Array.prototype.slice;
+
+ var callProto = {
+ calledOn: function calledOn(thisValue) {
+ if (sinon.match && sinon.match.isMatcher(thisValue)) {
+ return thisValue.test(this.thisValue);
+ }
+ return this.thisValue === thisValue;
+ },
+
+ calledWith: function calledWith() {
+ var l = arguments.length;
+ if (l > this.args.length) {
+ return false;
+ }
+ for (var i = 0; i < l; i += 1) {
+ if (!sinon.deepEqual(arguments[i], this.args[i])) {
+ return false;
+ }
+ }
+
+ return true;
+ },
+
+ calledWithMatch: function calledWithMatch() {
+ var l = arguments.length;
+ if (l > this.args.length) {
+ return false;
+ }
+ for (var i = 0; i < l; i += 1) {
+ var actual = this.args[i];
+ var expectation = arguments[i];
+ if (!sinon.match || !sinon.match(expectation).test(actual)) {
+ return false;
+ }
+ }
+ return true;
+ },
+
+ calledWithExactly: function calledWithExactly() {
+ return arguments.length == this.args.length &&
+ this.calledWith.apply(this, arguments);
+ },
+
+ notCalledWith: function notCalledWith() {
+ return !this.calledWith.apply(this, arguments);
+ },
+
+ notCalledWithMatch: function notCalledWithMatch() {
+ return !this.calledWithMatch.apply(this, arguments);
+ },
+
+ returned: function returned(value) {
+ return sinon.deepEqual(value, this.returnValue);
+ },
+
+ threw: function threw(error) {
+ if (typeof error === "undefined" || !this.exception) {
+ return !!this.exception;
+ }
+
+ return this.exception === error || this.exception.name === error;
+ },
+
+ calledWithNew: function calledWithNew() {
+ return this.proxy.prototype && this.thisValue instanceof this.proxy;
+ },
+
+ calledBefore: function (other) {
+ return this.callId < other.callId;
+ },
+
+ calledAfter: function (other) {
+ return this.callId > other.callId;
+ },
+
+ callArg: function (pos) {
+ this.args[pos]();
+ },
+
+ callArgOn: function (pos, thisValue) {
+ this.args[pos].apply(thisValue);
+ },
+
+ callArgWith: function (pos) {
+ this.callArgOnWith.apply(this, [pos, null].concat(slice.call(arguments, 1)));
+ },
+
+ callArgOnWith: function (pos, thisValue) {
+ var args = slice.call(arguments, 2);
+ this.args[pos].apply(thisValue, args);
+ },
+
+ yield: function () {
+ this.yieldOn.apply(this, [null].concat(slice.call(arguments, 0)));
+ },
+
+ yieldOn: function (thisValue) {
+ var args = this.args;
+ for (var i = 0, l = args.length; i < l; ++i) {
+ if (typeof args[i] === "function") {
+ args[i].apply(thisValue, slice.call(arguments, 1));
+ return;
+ }
+ }
+ throwYieldError(this.proxy, " cannot yield since no callback was passed.", args);
+ },
+
+ yieldTo: function (prop) {
+ this.yieldToOn.apply(this, [prop, null].concat(slice.call(arguments, 1)));
+ },
+
+ yieldToOn: function (prop, thisValue) {
+ var args = this.args;
+ for (var i = 0, l = args.length; i < l; ++i) {
+ if (args[i] && typeof args[i][prop] === "function") {
+ args[i][prop].apply(thisValue, slice.call(arguments, 2));
+ return;
+ }
+ }
+ throwYieldError(this.proxy, " cannot yield to '" + prop +
+ "' since no callback was passed.", args);
+ },
+
+ toString: function () {
+ var callStr = this.proxy.toString() + "(";
+ var args = [];
+
+ for (var i = 0, l = this.args.length; i < l; ++i) {
+ args.push(sinon.format(this.args[i]));
+ }
+
+ callStr = callStr + args.join(", ") + ")";
+
+ if (typeof this.returnValue != "undefined") {
+ callStr += " => " + sinon.format(this.returnValue);
+ }
+
+ if (this.exception) {
+ callStr += " !" + this.exception.name;
+
+ if (this.exception.message) {
+ callStr += "(" + this.exception.message + ")";
+ }
+ }
+
+ return callStr;
+ }
+ };
+
+ callProto.invokeCallback = callProto.yield;
+
+ function createSpyCall(spy, thisValue, args, returnValue, exception, id) {
+ if (typeof id !== "number") {
+ throw new TypeError("Call id is not a number");
+ }
+ var proxyCall = sinon.create(callProto);
+ proxyCall.proxy = spy;
+ proxyCall.thisValue = thisValue;
+ proxyCall.args = args;
+ proxyCall.returnValue = returnValue;
+ proxyCall.exception = exception;
+ proxyCall.callId = id;
+
+ return proxyCall;
+ }
+ createSpyCall.toString = callProto.toString; // used by mocks
+
+ sinon.spyCall = createSpyCall;
+ return createSpyCall;
+ }
+
+ var isNode = typeof module !== "undefined" && module.exports && typeof require == "function";
+ var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd;
+
+ function loadDependencies(require, exports, module) {
+ var sinon = require("./util/core");
+ require("./match");
+ require("./format");
+ module.exports = makeApi(sinon);
+ }
+
+ if (isAMD) {
+ define(loadDependencies);
+ } else if (isNode) {
+ loadDependencies(require, module.exports, module);
+ } else if (!sinon) {
+ return;
+ } else {
+ makeApi(sinon);
+ }
+}(typeof sinon == "object" && sinon || null));
+
+},{"./format":30,"./match":32,"./util/core":41}],28:[function(require,module,exports){
+/**
+ * @depend util/core.js
+ * @depend spy.js
+ * @depend stub.js
+ * @depend mock.js
+ */
+/**
+ * Collections of stubs, spies and mocks.
+ *
+ * @author Christian Johansen (christian@cjohansen.no)
+ * @license BSD
+ *
+ * Copyright (c) 2010-2013 Christian Johansen
+ */
+"use strict";
+
+(function (sinon) {
+ var push = [].push;
+ var hasOwnProperty = Object.prototype.hasOwnProperty;
+
+ function getFakes(fakeCollection) {
+ if (!fakeCollection.fakes) {
+ fakeCollection.fakes = [];
+ }
+
+ return fakeCollection.fakes;
+ }
+
+ function each(fakeCollection, method) {
+ var fakes = getFakes(fakeCollection);
+
+ for (var i = 0, l = fakes.length; i < l; i += 1) {
+ if (typeof fakes[i][method] == "function") {
+ fakes[i][method]();
+ }
+ }
+ }
+
+ function compact(fakeCollection) {
+ var fakes = getFakes(fakeCollection);
+ var i = 0;
+ while (i < fakes.length) {
+ fakes.splice(i, 1);
+ }
+ }
+
+ function makeApi(sinon) {
+ var collection = {
+ verify: function resolve() {
+ each(this, "verify");
+ },
+
+ restore: function restore() {
+ each(this, "restore");
+ compact(this);
+ },
+
+ reset: function restore() {
+ each(this, "reset");
+ },
+
+ verifyAndRestore: function verifyAndRestore() {
+ var exception;
+
+ try {
+ this.verify();
+ } catch (e) {
+ exception = e;
+ }
+
+ this.restore();
+
+ if (exception) {
+ throw exception;
+ }
+ },
+
+ add: function add(fake) {
+ push.call(getFakes(this), fake);
+ return fake;
+ },
+
+ spy: function spy() {
+ return this.add(sinon.spy.apply(sinon, arguments));
+ },
+
+ stub: function stub(object, property, value) {
+ if (property) {
+ var original = object[property];
+
+ if (typeof original != "function") {
+ if (!hasOwnProperty.call(object, property)) {
+ throw new TypeError("Cannot stub non-existent own property " + property);
+ }
+
+ object[property] = value;
+
+ return this.add({
+ restore: function () {
+ object[property] = original;
+ }
+ });
+ }
+ }
+ if (!property && !!object && typeof object == "object") {
+ var stubbedObj = sinon.stub.apply(sinon, arguments);
+
+ for (var prop in stubbedObj) {
+ if (typeof stubbedObj[prop] === "function") {
+ this.add(stubbedObj[prop]);
+ }
+ }
+
+ return stubbedObj;
+ }
+
+ return this.add(sinon.stub.apply(sinon, arguments));
+ },
+
+ mock: function mock() {
+ return this.add(sinon.mock.apply(sinon, arguments));
+ },
+
+ inject: function inject(obj) {
+ var col = this;
+
+ obj.spy = function () {
+ return col.spy.apply(col, arguments);
+ };
+
+ obj.stub = function () {
+ return col.stub.apply(col, arguments);
+ };
+
+ obj.mock = function () {
+ return col.mock.apply(col, arguments);
+ };
+
+ return obj;
+ }
+ };
+
+ sinon.collection = collection;
+ return collection;
+ }
+
+ var isNode = typeof module !== "undefined" && module.exports && typeof require == "function";
+ var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd;
+
+ function loadDependencies(require, exports, module) {
+ var sinon = require("./util/core");
+ require("./mock");
+ require("./spy");
+ require("./stub");
+ module.exports = makeApi(sinon);
+ }
+
+ if (isAMD) {
+ define(loadDependencies);
+ } else if (isNode) {
+ loadDependencies(require, module.exports, module);
+ } else if (!sinon) {
+ return;
+ } else {
+ makeApi(sinon);
+ }
+}(typeof sinon == "object" && sinon || null));
+
+},{"./mock":33,"./spy":35,"./stub":36,"./util/core":41}],29:[function(require,module,exports){
+/**
+ * @depend util/core.js
+ */
+"use strict";
+
+(function (sinon) {
+ function makeApi(sinon) {
+
+ // Adapted from https://developer.mozilla.org/en/docs/ECMAScript_DontEnum_attribute#JScript_DontEnum_Bug
+ var hasDontEnumBug = (function () {
+ var obj = {
+ constructor: function () {
+ return "0";
+ },
+ toString: function () {
+ return "1";
+ },
+ valueOf: function () {
+ return "2";
+ },
+ toLocaleString: function () {
+ return "3";
+ },
+ prototype: function () {
+ return "4";
+ },
+ isPrototypeOf: function () {
+ return "5";
+ },
+ propertyIsEnumerable: function () {
+ return "6";
+ },
+ hasOwnProperty: function () {
+ return "7";
+ },
+ length: function () {
+ return "8";
+ },
+ unique: function () {
+ return "9"
+ }
+ };
+
+ var result = [];
+ for (var prop in obj) {
+ result.push(obj[prop]());
+ }
+ return result.join("") !== "0123456789";
+ })();
+
+ /* Public: Extend target in place with all (own) properties from sources in-order. Thus, last source will
+ * override properties in previous sources.
+ *
+ * target - The Object to extend
+ * sources - Objects to copy properties from.
+ *
+ * Returns the extended target
+ */
+ function extend(target /*, sources */) {
+ var sources = Array.prototype.slice.call(arguments, 1),
+ source, i, prop;
+
+ for (i = 0; i < sources.length; i++) {
+ source = sources[i];
+
+ for (prop in source) {
+ if (source.hasOwnProperty(prop)) {
+ target[prop] = source[prop];
+ }
+ }
+
+ // Make sure we copy (own) toString method even when in JScript with DontEnum bug
+ // See https://developer.mozilla.org/en/docs/ECMAScript_DontEnum_attribute#JScript_DontEnum_Bug
+ if (hasDontEnumBug && source.hasOwnProperty("toString") && source.toString !== target.toString) {
+ target.toString = source.toString;
+ }
+ }
+
+ return target;
+ };
+
+ sinon.extend = extend;
+ return sinon.extend;
+ }
+
+ function loadDependencies(require, exports, module) {
+ var sinon = require("./util/core");
+ module.exports = makeApi(sinon);
+ }
+
+ var isNode = typeof module !== "undefined" && module.exports && typeof require == "function";
+ var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd;
+
+ if (isAMD) {
+ define(loadDependencies);
+ } else if (isNode) {
+ loadDependencies(require, module.exports, module);
+ } else if (!sinon) {
+ return;
+ } else {
+ makeApi(sinon);
+ }
+}(typeof sinon == "object" && sinon || null));
+
+},{"./util/core":41}],30:[function(require,module,exports){
+/**
+ * @depend util/core.js
+ */
+/**
+ * Format functions
+ *
+ * @author Christian Johansen (christian@cjohansen.no)
+ * @license BSD
+ *
+ * Copyright (c) 2010-2014 Christian Johansen
+ */
+"use strict";
+
+(function (sinon, formatio) {
+ function makeApi(sinon) {
+ function valueFormatter(value) {
+ return "" + value;
+ }
+
+ function getFormatioFormatter() {
+ var formatter = formatio.configure({
+ quoteStrings: false,
+ limitChildrenCount: 250
+ });
+
+ function format() {
+ return formatter.ascii.apply(formatter, arguments);
+ };
+
+ return format;
+ }
+
+ function getNodeFormatter(value) {
+ function format(value) {
+ return typeof value == "object" && value.toString === Object.prototype.toString ? util.inspect(value) : value;
+ };
+
+ try {
+ var util = require("util");
+ } catch (e) {
+ /* Node, but no util module - would be very old, but better safe than sorry */
+ }
+
+ return util ? format : valueFormatter;
+ }
+
+ var isNode = typeof module !== "undefined" && module.exports && typeof require == "function",
+ formatter;
+
+ if (isNode) {
+ try {
+ formatio = require("formatio");
+ } catch (e) {}
+ }
+
+ if (formatio) {
+ formatter = getFormatioFormatter()
+ } else if (isNode) {
+ formatter = getNodeFormatter();
+ } else {
+ formatter = valueFormatter;
+ }
+
+ sinon.format = formatter;
+ return sinon.format;
+ }
+
+ function loadDependencies(require, exports, module) {
+ var sinon = require("./util/core");
+ module.exports = makeApi(sinon);
+ }
+
+ var isNode = typeof module !== "undefined" && module.exports && typeof require == "function";
+ var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd;
+
+ if (isAMD) {
+ define(loadDependencies);
+ } else if (isNode) {
+ loadDependencies(require, module.exports, module);
+ } else if (!sinon) {
+ return;
+ } else {
+ makeApi(sinon);
+ }
+}(
+ (typeof sinon == "object" && sinon || null),
+ (typeof formatio == "object" && formatio)
+));
+
+},{"./util/core":41,"formatio":48,"util":6}],31:[function(require,module,exports){
+/**
+ * @depend util/core.js
+ */
+/**
+ * Logs errors
+ *
+ * @author Christian Johansen (christian@cjohansen.no)
+ * @license BSD
+ *
+ * Copyright (c) 2010-2014 Christian Johansen
+ */
+"use strict";
+
+(function (sinon) {
+ // cache a reference to setTimeout, so that our reference won't be stubbed out
+ // when using fake timers and errors will still get logged
+ // https://github.com/cjohansen/Sinon.JS/issues/381
+ var realSetTimeout = setTimeout;
+
+ function makeApi(sinon) {
+
+ function log() {}
+
+ function logError(label, err) {
+ var msg = label + " threw exception: ";
+
+ sinon.log(msg + "[" + err.name + "] " + err.message);
+
+ if (err.stack) {
+ sinon.log(err.stack);
+ }
+
+ logError.setTimeout(function () {
+ err.message = msg + err.message;
+ throw err;
+ }, 0);
+ };
+
+ // wrap realSetTimeout with something we can stub in tests
+ logError.setTimeout = function (func, timeout) {
+ realSetTimeout(func, timeout);
+ }
+
+ var exports = {};
+ exports.log = sinon.log = log;
+ exports.logError = sinon.logError = logError;
+
+ return exports;
+ }
+
+ function loadDependencies(require, exports, module) {
+ var sinon = require("./util/core");
+ module.exports = makeApi(sinon);
+ }
+
+ var isNode = typeof module !== "undefined" && module.exports && typeof require == "function";
+ var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd;
+
+ if (isAMD) {
+ define(loadDependencies);
+ } else if (isNode) {
+ loadDependencies(require, module.exports, module);
+ } else if (!sinon) {
+ return;
+ } else {
+ makeApi(sinon);
+ }
+}(typeof sinon == "object" && sinon || null));
+
+},{"./util/core":41}],32:[function(require,module,exports){
+/**
+ * @depend util/core.js
+ * @depend typeOf.js
+ */
+/*jslint eqeqeq: false, onevar: false, plusplus: false*/
+/*global module, require, sinon*/
+/**
+ * Match functions
+ *
+ * @author Maximilian Antoni (mail@maxantoni.de)
+ * @license BSD
+ *
+ * Copyright (c) 2012 Maximilian Antoni
+ */
+"use strict";
+
+(function (sinon) {
+ function makeApi(sinon) {
+ function assertType(value, type, name) {
+ var actual = sinon.typeOf(value);
+ if (actual !== type) {
+ throw new TypeError("Expected type of " + name + " to be " +
+ type + ", but was " + actual);
+ }
+ }
+
+ var matcher = {
+ toString: function () {
+ return this.message;
+ }
+ };
+
+ function isMatcher(object) {
+ return matcher.isPrototypeOf(object);
+ }
+
+ function matchObject(expectation, actual) {
+ if (actual === null || actual === undefined) {
+ return false;
+ }
+ for (var key in expectation) {
+ if (expectation.hasOwnProperty(key)) {
+ var exp = expectation[key];
+ var act = actual[key];
+ if (match.isMatcher(exp)) {
+ if (!exp.test(act)) {
+ return false;
+ }
+ } else if (sinon.typeOf(exp) === "object") {
+ if (!matchObject(exp, act)) {
+ return false;
+ }
+ } else if (!sinon.deepEqual(exp, act)) {
+ return false;
+ }
+ }
+ }
+ return true;
+ }
+
+ matcher.or = function (m2) {
+ if (!arguments.length) {
+ throw new TypeError("Matcher expected");
+ } else if (!isMatcher(m2)) {
+ m2 = match(m2);
+ }
+ var m1 = this;
+ var or = sinon.create(matcher);
+ or.test = function (actual) {
+ return m1.test(actual) || m2.test(actual);
+ };
+ or.message = m1.message + ".or(" + m2.message + ")";
+ return or;
+ };
+
+ matcher.and = function (m2) {
+ if (!arguments.length) {
+ throw new TypeError("Matcher expected");
+ } else if (!isMatcher(m2)) {
+ m2 = match(m2);
+ }
+ var m1 = this;
+ var and = sinon.create(matcher);
+ and.test = function (actual) {
+ return m1.test(actual) && m2.test(actual);
+ };
+ and.message = m1.message + ".and(" + m2.message + ")";
+ return and;
+ };
+
+ var match = function (expectation, message) {
+ var m = sinon.create(matcher);
+ var type = sinon.typeOf(expectation);
+ switch (type) {
+ case "object":
+ if (typeof expectation.test === "function") {
+ m.test = function (actual) {
+ return expectation.test(actual) === true;
+ };
+ m.message = "match(" + sinon.functionName(expectation.test) + ")";
+ return m;
+ }
+ var str = [];
+ for (var key in expectation) {
+ if (expectation.hasOwnProperty(key)) {
+ str.push(key + ": " + expectation[key]);
+ }
+ }
+ m.test = function (actual) {
+ return matchObject(expectation, actual);
+ };
+ m.message = "match(" + str.join(", ") + ")";
+ break;
+ case "number":
+ m.test = function (actual) {
+ return expectation == actual;
+ };
+ break;
+ case "string":
+ m.test = function (actual) {
+ if (typeof actual !== "string") {
+ return false;
+ }
+ return actual.indexOf(expectation) !== -1;
+ };
+ m.message = "match(\"" + expectation + "\")";
+ break;
+ case "regexp":
+ m.test = function (actual) {
+ if (typeof actual !== "string") {
+ return false;
+ }
+ return expectation.test(actual);
+ };
+ break;
+ case "function":
+ m.test = expectation;
+ if (message) {
+ m.message = message;
+ } else {
+ m.message = "match(" + sinon.functionName(expectation) + ")";
+ }
+ break;
+ default:
+ m.test = function (actual) {
+ return sinon.deepEqual(expectation, actual);
+ };
+ }
+ if (!m.message) {
+ m.message = "match(" + expectation + ")";
+ }
+ return m;
+ };
+
+ match.isMatcher = isMatcher;
+
+ match.any = match(function () {
+ return true;
+ }, "any");
+
+ match.defined = match(function (actual) {
+ return actual !== null && actual !== undefined;
+ }, "defined");
+
+ match.truthy = match(function (actual) {
+ return !!actual;
+ }, "truthy");
+
+ match.falsy = match(function (actual) {
+ return !actual;
+ }, "falsy");
+
+ match.same = function (expectation) {
+ return match(function (actual) {
+ return expectation === actual;
+ }, "same(" + expectation + ")");
+ };
+
+ match.typeOf = function (type) {
+ assertType(type, "string", "type");
+ return match(function (actual) {
+ return sinon.typeOf(actual) === type;
+ }, "typeOf(\"" + type + "\")");
+ };
+
+ match.instanceOf = function (type) {
+ assertType(type, "function", "type");
+ return match(function (actual) {
+ return actual instanceof type;
+ }, "instanceOf(" + sinon.functionName(type) + ")");
+ };
+
+ function createPropertyMatcher(propertyTest, messagePrefix) {
+ return function (property, value) {
+ assertType(property, "string", "property");
+ var onlyProperty = arguments.length === 1;
+ var message = messagePrefix + "(\"" + property + "\"";
+ if (!onlyProperty) {
+ message += ", " + value;
+ }
+ message += ")";
+ return match(function (actual) {
+ if (actual === undefined || actual === null ||
+ !propertyTest(actual, property)) {
+ return false;
+ }
+ return onlyProperty || sinon.deepEqual(value, actual[property]);
+ }, message);
+ };
+ }
+
+ match.has = createPropertyMatcher(function (actual, property) {
+ if (typeof actual === "object") {
+ return property in actual;
+ }
+ return actual[property] !== undefined;
+ }, "has");
+
+ match.hasOwn = createPropertyMatcher(function (actual, property) {
+ return actual.hasOwnProperty(property);
+ }, "hasOwn");
+
+ match.bool = match.typeOf("boolean");
+ match.number = match.typeOf("number");
+ match.string = match.typeOf("string");
+ match.object = match.typeOf("object");
+ match.func = match.typeOf("function");
+ match.array = match.typeOf("array");
+ match.regexp = match.typeOf("regexp");
+ match.date = match.typeOf("date");
+
+ sinon.match = match;
+ return match;
+ }
+
+ var isNode = typeof module !== "undefined" && module.exports && typeof require == "function";
+ var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd;
+
+ function loadDependencies(require, exports, module) {
+ var sinon = require("./util/core");
+ require("./typeOf");
+ module.exports = makeApi(sinon);
+ }
+
+ if (isAMD) {
+ define(loadDependencies);
+ } else if (isNode) {
+ loadDependencies(require, module.exports, module);
+ } else if (!sinon) {
+ return;
+ } else {
+ makeApi(sinon);
+ }
+}(typeof sinon == "object" && sinon || null));
+
+},{"./typeOf":40,"./util/core":41}],33:[function(require,module,exports){
+/**
+ * @depend times_in_words.js
+ * @depend util/core.js
+ * @depend call.js
+ * @depend extend.js
+ * @depend match.js
+ * @depend spy.js
+ * @depend stub.js
+ * @depend format.js
+ */
+/**
+ * Mock functions.
+ *
+ * @author Christian Johansen (christian@cjohansen.no)
+ * @license BSD
+ *
+ * Copyright (c) 2010-2013 Christian Johansen
+ */
+"use strict";
+
+(function (sinon) {
+ function makeApi(sinon) {
+ var push = [].push;
+ var match = sinon.match;
+
+ function mock(object) {
+ if (!object) {
+ return sinon.expectation.create("Anonymous mock");
+ }
+
+ return mock.create(object);
+ }
+
+ function each(collection, callback) {
+ if (!collection) {
+ return;
+ }
+
+ for (var i = 0, l = collection.length; i < l; i += 1) {
+ callback(collection[i]);
+ }
+ }
+
+ sinon.extend(mock, {
+ create: function create(object) {
+ if (!object) {
+ throw new TypeError("object is null");
+ }
+
+ var mockObject = sinon.extend({}, mock);
+ mockObject.object = object;
+ delete mockObject.create;
+
+ return mockObject;
+ },
+
+ expects: function expects(method) {
+ if (!method) {
+ throw new TypeError("method is falsy");
+ }
+
+ if (!this.expectations) {
+ this.expectations = {};
+ this.proxies = [];
+ }
+
+ if (!this.expectations[method]) {
+ this.expectations[method] = [];
+ var mockObject = this;
+
+ sinon.wrapMethod(this.object, method, function () {
+ return mockObject.invokeMethod(method, this, arguments);
+ });
+
+ push.call(this.proxies, method);
+ }
+
+ var expectation = sinon.expectation.create(method);
+ push.call(this.expectations[method], expectation);
+
+ return expectation;
+ },
+
+ restore: function restore() {
+ var object = this.object;
+
+ each(this.proxies, function (proxy) {
+ if (typeof object[proxy].restore == "function") {
+ object[proxy].restore();
+ }
+ });
+ },
+
+ verify: function verify() {
+ var expectations = this.expectations || {};
+ var messages = [], met = [];
+
+ each(this.proxies, function (proxy) {
+ each(expectations[proxy], function (expectation) {
+ if (!expectation.met()) {
+ push.call(messages, expectation.toString());
+ } else {
+ push.call(met, expectation.toString());
+ }
+ });
+ });
+
+ this.restore();
+
+ if (messages.length > 0) {
+ sinon.expectation.fail(messages.concat(met).join("\n"));
+ } else if (met.length > 0) {
+ sinon.expectation.pass(messages.concat(met).join("\n"));
+ }
+
+ return true;
+ },
+
+ invokeMethod: function invokeMethod(method, thisValue, args) {
+ var expectations = this.expectations && this.expectations[method];
+ var length = expectations && expectations.length || 0, i;
+
+ for (i = 0; i < length; i += 1) {
+ if (!expectations[i].met() &&
+ expectations[i].allowsCall(thisValue, args)) {
+ return expectations[i].apply(thisValue, args);
+ }
+ }
+
+ var messages = [], available, exhausted = 0;
+
+ for (i = 0; i < length; i += 1) {
+ if (expectations[i].allowsCall(thisValue, args)) {
+ available = available || expectations[i];
+ } else {
+ exhausted += 1;
+ }
+ push.call(messages, " " + expectations[i].toString());
+ }
+
+ if (exhausted === 0) {
+ return available.apply(thisValue, args);
+ }
+
+ messages.unshift("Unexpected call: " + sinon.spyCall.toString.call({
+ proxy: method,
+ args: args
+ }));
+
+ sinon.expectation.fail(messages.join("\n"));
+ }
+ });
+
+ var times = sinon.timesInWords;
+ var slice = Array.prototype.slice;
+
+ function callCountInWords(callCount) {
+ if (callCount == 0) {
+ return "never called";
+ } else {
+ return "called " + times(callCount);
+ }
+ }
+
+ function expectedCallCountInWords(expectation) {
+ var min = expectation.minCalls;
+ var max = expectation.maxCalls;
+
+ if (typeof min == "number" && typeof max == "number") {
+ var str = times(min);
+
+ if (min != max) {
+ str = "at least " + str + " and at most " + times(max);
+ }
+
+ return str;
+ }
+
+ if (typeof min == "number") {
+ return "at least " + times(min);
+ }
+
+ return "at most " + times(max);
+ }
+
+ function receivedMinCalls(expectation) {
+ var hasMinLimit = typeof expectation.minCalls == "number";
+ return !hasMinLimit || expectation.callCount >= expectation.minCalls;
+ }
+
+ function receivedMaxCalls(expectation) {
+ if (typeof expectation.maxCalls != "number") {
+ return false;
+ }
+
+ return expectation.callCount == expectation.maxCalls;
+ }
+
+ function verifyMatcher(possibleMatcher, arg) {
+ if (match && match.isMatcher(possibleMatcher)) {
+ return possibleMatcher.test(arg);
+ } else {
+ return true;
+ }
+ }
+
+ sinon.expectation = {
+ minCalls: 1,
+ maxCalls: 1,
+
+ create: function create(methodName) {
+ var expectation = sinon.extend(sinon.stub.create(), sinon.expectation);
+ delete expectation.create;
+ expectation.method = methodName;
+
+ return expectation;
+ },
+
+ invoke: function invoke(func, thisValue, args) {
+ this.verifyCallAllowed(thisValue, args);
+
+ return sinon.spy.invoke.apply(this, arguments);
+ },
+
+ atLeast: function atLeast(num) {
+ if (typeof num != "number") {
+ throw new TypeError("'" + num + "' is not number");
+ }
+
+ if (!this.limitsSet) {
+ this.maxCalls = null;
+ this.limitsSet = true;
+ }
+
+ this.minCalls = num;
+
+ return this;
+ },
+
+ atMost: function atMost(num) {
+ if (typeof num != "number") {
+ throw new TypeError("'" + num + "' is not number");
+ }
+
+ if (!this.limitsSet) {
+ this.minCalls = null;
+ this.limitsSet = true;
+ }
+
+ this.maxCalls = num;
+
+ return this;
+ },
+
+ never: function never() {
+ return this.exactly(0);
+ },
+
+ once: function once() {
+ return this.exactly(1);
+ },
+
+ twice: function twice() {
+ return this.exactly(2);
+ },
+
+ thrice: function thrice() {
+ return this.exactly(3);
+ },
+
+ exactly: function exactly(num) {
+ if (typeof num != "number") {
+ throw new TypeError("'" + num + "' is not a number");
+ }
+
+ this.atLeast(num);
+ return this.atMost(num);
+ },
+
+ met: function met() {
+ return !this.failed && receivedMinCalls(this);
+ },
+
+ verifyCallAllowed: function verifyCallAllowed(thisValue, args) {
+ if (receivedMaxCalls(this)) {
+ this.failed = true;
+ sinon.expectation.fail(this.method + " already called " + times(this.maxCalls));
+ }
+
+ if ("expectedThis" in this && this.expectedThis !== thisValue) {
+ sinon.expectation.fail(this.method + " called with " + thisValue + " as thisValue, expected " +
+ this.expectedThis);
+ }
+
+ if (!("expectedArguments" in this)) {
+ return;
+ }
+
+ if (!args) {
+ sinon.expectation.fail(this.method + " received no arguments, expected " +
+ sinon.format(this.expectedArguments));
+ }
+
+ if (args.length < this.expectedArguments.length) {
+ sinon.expectation.fail(this.method + " received too few arguments (" + sinon.format(args) +
+ "), expected " + sinon.format(this.expectedArguments));
+ }
+
+ if (this.expectsExactArgCount &&
+ args.length != this.expectedArguments.length) {
+ sinon.expectation.fail(this.method + " received too many arguments (" + sinon.format(args) +
+ "), expected " + sinon.format(this.expectedArguments));
+ }
+
+ for (var i = 0, l = this.expectedArguments.length; i < l; i += 1) {
+
+ if (!verifyMatcher(this.expectedArguments[i], args[i])) {
+ sinon.expectation.fail(this.method + " received wrong arguments " + sinon.format(args) +
+ ", didn't match " + this.expectedArguments.toString());
+ }
+
+ if (!sinon.deepEqual(this.expectedArguments[i], args[i])) {
+ sinon.expectation.fail(this.method + " received wrong arguments " + sinon.format(args) +
+ ", expected " + sinon.format(this.expectedArguments));
+ }
+ }
+ },
+
+ allowsCall: function allowsCall(thisValue, args) {
+ if (this.met() && receivedMaxCalls(this)) {
+ return false;
+ }
+
+ if ("expectedThis" in this && this.expectedThis !== thisValue) {
+ return false;
+ }
+
+ if (!("expectedArguments" in this)) {
+ return true;
+ }
+
+ args = args || [];
+
+ if (args.length < this.expectedArguments.length) {
+ return false;
+ }
+
+ if (this.expectsExactArgCount &&
+ args.length != this.expectedArguments.length) {
+ return false;
+ }
+
+ for (var i = 0, l = this.expectedArguments.length; i < l; i += 1) {
+ if (!verifyMatcher(this.expectedArguments[i], args[i])) {
+ return false;
+ }
+
+ if (!sinon.deepEqual(this.expectedArguments[i], args[i])) {
+ return false;
+ }
+ }
+
+ return true;
+ },
+
+ withArgs: function withArgs() {
+ this.expectedArguments = slice.call(arguments);
+ return this;
+ },
+
+ withExactArgs: function withExactArgs() {
+ this.withArgs.apply(this, arguments);
+ this.expectsExactArgCount = true;
+ return this;
+ },
+
+ on: function on(thisValue) {
+ this.expectedThis = thisValue;
+ return this;
+ },
+
+ toString: function () {
+ var args = (this.expectedArguments || []).slice();
+
+ if (!this.expectsExactArgCount) {
+ push.call(args, "[...]");
+ }
+
+ var callStr = sinon.spyCall.toString.call({
+ proxy: this.method || "anonymous mock expectation",
+ args: args
+ });
+
+ var message = callStr.replace(", [...", "[, ...") + " " +
+ expectedCallCountInWords(this);
+
+ if (this.met()) {
+ return "Expectation met: " + message;
+ }
+
+ return "Expected " + message + " (" +
+ callCountInWords(this.callCount) + ")";
+ },
+
+ verify: function verify() {
+ if (!this.met()) {
+ sinon.expectation.fail(this.toString());
+ } else {
+ sinon.expectation.pass(this.toString());
+ }
+
+ return true;
+ },
+
+ pass: function pass(message) {
+ sinon.assert.pass(message);
+ },
+
+ fail: function fail(message) {
+ var exception = new Error(message);
+ exception.name = "ExpectationError";
+
+ throw exception;
+ }
+ };
+
+ sinon.mock = mock;
+ return mock;
+ }
+
+ var isNode = typeof module !== "undefined" && module.exports && typeof require == "function";
+ var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd;
+
+ function loadDependencies(require, exports, module) {
+ var sinon = require("./util/core");
+ require("./times_in_words");
+ require("./call");
+ require("./extend");
+ require("./match");
+ require("./spy");
+ require("./stub");
+ require("./format");
+
+ module.exports = makeApi(sinon);
+ }
+
+ if (isAMD) {
+ define(loadDependencies);
+ } else if (isNode) {
+ loadDependencies(require, module.exports, module);
+ } else if (!sinon) {
+ return;
+ } else {
+ makeApi(sinon);
+ }
+}(typeof sinon == "object" && sinon || null));
+
+},{"./call":27,"./extend":29,"./format":30,"./match":32,"./spy":35,"./stub":36,"./times_in_words":39,"./util/core":41}],34:[function(require,module,exports){
+/**
+ * @depend util/core.js
+ * @depend extend.js
+ * @depend collection.js
+ * @depend util/fake_timers.js
+ * @depend util/fake_server_with_clock.js
+ */
+/**
+ * Manages fake collections as well as fake utilities such as Sinon's
+ * timers and fake XHR implementation in one convenient object.
+ *
+ * @author Christian Johansen (christian@cjohansen.no)
+ * @license BSD
+ *
+ * Copyright (c) 2010-2013 Christian Johansen
+ */
+"use strict";
+
+(function () {
+ function makeApi(sinon) {
+ var push = [].push;
+
+ function exposeValue(sandbox, config, key, value) {
+ if (!value) {
+ return;
+ }
+
+ if (config.injectInto && !(key in config.injectInto)) {
+ config.injectInto[key] = value;
+ sandbox.injectedKeys.push(key);
+ } else {
+ push.call(sandbox.args, value);
+ }
+ }
+
+ function prepareSandboxFromConfig(config) {
+ var sandbox = sinon.create(sinon.sandbox);
+
+ if (config.useFakeServer) {
+ if (typeof config.useFakeServer == "object") {
+ sandbox.serverPrototype = config.useFakeServer;
+ }
+
+ sandbox.useFakeServer();
+ }
+
+ if (config.useFakeTimers) {
+ if (typeof config.useFakeTimers == "object") {
+ sandbox.useFakeTimers.apply(sandbox, config.useFakeTimers);
+ } else {
+ sandbox.useFakeTimers();
+ }
+ }
+
+ return sandbox;
+ }
+
+ sinon.sandbox = sinon.extend(sinon.create(sinon.collection), {
+ useFakeTimers: function useFakeTimers() {
+ this.clock = sinon.useFakeTimers.apply(sinon, arguments);
+
+ return this.add(this.clock);
+ },
+
+ serverPrototype: sinon.fakeServer,
+
+ useFakeServer: function useFakeServer() {
+ var proto = this.serverPrototype || sinon.fakeServer;
+
+ if (!proto || !proto.create) {
+ return null;
+ }
+
+ this.server = proto.create();
+ return this.add(this.server);
+ },
+
+ inject: function (obj) {
+ sinon.collection.inject.call(this, obj);
+
+ if (this.clock) {
+ obj.clock = this.clock;
+ }
+
+ if (this.server) {
+ obj.server = this.server;
+ obj.requests = this.server.requests;
+ }
+
+ obj.match = sinon.match;
+
+ return obj;
+ },
+
+ restore: function () {
+ sinon.collection.restore.apply(this, arguments);
+ this.restoreContext();
+ },
+
+ restoreContext: function () {
+ if (this.injectedKeys) {
+ for (var i = 0, j = this.injectedKeys.length; i < j; i++) {
+ delete this.injectInto[this.injectedKeys[i]];
+ }
+ this.injectedKeys = [];
+ }
+ },
+
+ create: function (config) {
+ if (!config) {
+ return sinon.create(sinon.sandbox);
+ }
+
+ var sandbox = prepareSandboxFromConfig(config);
+ sandbox.args = sandbox.args || [];
+ sandbox.injectedKeys = [];
+ sandbox.injectInto = config.injectInto;
+ var prop, value, exposed = sandbox.inject({});
+
+ if (config.properties) {
+ for (var i = 0, l = config.properties.length; i < l; i++) {
+ prop = config.properties[i];
+ value = exposed[prop] || prop == "sandbox" && sandbox;
+ exposeValue(sandbox, config, prop, value);
+ }
+ } else {
+ exposeValue(sandbox, config, "sandbox", value);
+ }
+
+ return sandbox;
+ },
+
+ match: sinon.match
+ });
+
+ sinon.sandbox.useFakeXMLHttpRequest = sinon.sandbox.useFakeServer;
+
+ return sinon.sandbox;
+ }
+
+ var isNode = typeof module !== "undefined" && module.exports && typeof require == "function";
+ var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd;
+
+ function loadDependencies(require, exports, module) {
+ var sinon = require("./util/core");
+ require("./extend");
+ require("./util/fake_server_with_clock");
+ require("./util/fake_timers");
+ require("./collection");
+ module.exports = makeApi(sinon);
+ }
+
+ if (isAMD) {
+ define(loadDependencies);
+ } else if (isNode) {
+ loadDependencies(require, module.exports, module);
+ } else if (!sinon) {
+ return;
+ } else {
+ makeApi(sinon);
+ }
+}());
+
+},{"./collection":28,"./extend":29,"./util/core":41,"./util/fake_server_with_clock":44,"./util/fake_timers":45}],35:[function(require,module,exports){
+/**
+ * @depend times_in_words.js
+ * @depend util/core.js
+ * @depend extend.js
+ * @depend call.js
+ * @depend format.js
+ */
+/**
+ * Spy functions
+ *
+ * @author Christian Johansen (christian@cjohansen.no)
+ * @license BSD
+ *
+ * Copyright (c) 2010-2013 Christian Johansen
+ */
+"use strict";
+
+(function (sinon) {
+
+ function makeApi(sinon) {
+ var push = Array.prototype.push;
+ var slice = Array.prototype.slice;
+ var callId = 0;
+
+ function spy(object, property, types) {
+ if (!property && typeof object == "function") {
+ return spy.create(object);
+ }
+
+ if (!object && !property) {
+ return spy.create(function () { });
+ }
+
+ if (types) {
+ var methodDesc = sinon.getPropertyDescriptor(object, property);
+ for (var i = 0; i < types.length; i++) {
+ methodDesc[types[i]] = spy.create(methodDesc[types[i]]);
+ }
+ return sinon.wrapMethod(object, property, methodDesc);
+ } else {
+ var method = object[property];
+ return sinon.wrapMethod(object, property, spy.create(method));
+ }
+ }
+
+ function matchingFake(fakes, args, strict) {
+ if (!fakes) {
+ return;
+ }
+
+ for (var i = 0, l = fakes.length; i < l; i++) {
+ if (fakes[i].matches(args, strict)) {
+ return fakes[i];
+ }
+ }
+ }
+
+ function incrementCallCount() {
+ this.called = true;
+ this.callCount += 1;
+ this.notCalled = false;
+ this.calledOnce = this.callCount == 1;
+ this.calledTwice = this.callCount == 2;
+ this.calledThrice = this.callCount == 3;
+ }
+
+ function createCallProperties() {
+ this.firstCall = this.getCall(0);
+ this.secondCall = this.getCall(1);
+ this.thirdCall = this.getCall(2);
+ this.lastCall = this.getCall(this.callCount - 1);
+ }
+
+ var vars = "a,b,c,d,e,f,g,h,i,j,k,l";
+ function createProxy(func, proxyLength) {
+ // Retain the function length:
+ var p;
+ if (proxyLength) {
+ eval("p = (function proxy(" + vars.substring(0, proxyLength * 2 - 1) +
+ ") { return p.invoke(func, this, slice.call(arguments)); });");
+ } else {
+ p = function proxy() {
+ return p.invoke(func, this, slice.call(arguments));
+ };
+ }
+ return p;
+ }
+
+ var uuid = 0;
+
+ // Public API
+ var spyApi = {
+ reset: function () {
+ if (this.invoking) {
+ var err = new Error("Cannot reset Sinon function while invoking it. " +
+ "Move the call to .reset outside of the callback.");
+ err.name = "InvalidResetException";
+ throw err;
+ }
+
+ this.called = false;
+ this.notCalled = true;
+ this.calledOnce = false;
+ this.calledTwice = false;
+ this.calledThrice = false;
+ this.callCount = 0;
+ this.firstCall = null;
+ this.secondCall = null;
+ this.thirdCall = null;
+ this.lastCall = null;
+ this.args = [];
+ this.returnValues = [];
+ this.thisValues = [];
+ this.exceptions = [];
+ this.callIds = [];
+ if (this.fakes) {
+ for (var i = 0; i < this.fakes.length; i++) {
+ this.fakes[i].reset();
+ }
+ }
+
+ return this;
+ },
+
+ create: function create(func, spyLength) {
+ var name;
+
+ if (typeof func != "function") {
+ func = function () { };
+ } else {
+ name = sinon.functionName(func);
+ }
+
+ if (!spyLength) {
+ spyLength = func.length;
+ }
+
+ var proxy = createProxy(func, spyLength);
+
+ sinon.extend(proxy, spy);
+ delete proxy.create;
+ sinon.extend(proxy, func);
+
+ proxy.reset();
+ proxy.prototype = func.prototype;
+ proxy.displayName = name || "spy";
+ proxy.toString = sinon.functionToString;
+ proxy.instantiateFake = sinon.spy.create;
+ proxy.id = "spy#" + uuid++;
+
+ return proxy;
+ },
+
+ invoke: function invoke(func, thisValue, args) {
+ var matching = matchingFake(this.fakes, args);
+ var exception, returnValue;
+
+ incrementCallCount.call(this);
+ push.call(this.thisValues, thisValue);
+ push.call(this.args, args);
+ push.call(this.callIds, callId++);
+
+ // Make call properties available from within the spied function:
+ createCallProperties.call(this);
+
+ try {
+ this.invoking = true;
+
+ if (matching) {
+ returnValue = matching.invoke(func, thisValue, args);
+ } else {
+ returnValue = (this.func || func).apply(thisValue, args);
+ }
+
+ var thisCall = this.getCall(this.callCount - 1);
+ if (thisCall.calledWithNew() && typeof returnValue !== "object") {
+ returnValue = thisValue;
+ }
+ } catch (e) {
+ exception = e;
+ } finally {
+ delete this.invoking;
+ }
+
+ push.call(this.exceptions, exception);
+ push.call(this.returnValues, returnValue);
+
+ // Make return value and exception available in the calls:
+ createCallProperties.call(this);
+
+ if (exception !== undefined) {
+ throw exception;
+ }
+
+ return returnValue;
+ },
+
+ named: function named(name) {
+ this.displayName = name;
+ return this;
+ },
+
+ getCall: function getCall(i) {
+ if (i < 0 || i >= this.callCount) {
+ return null;
+ }
+
+ return sinon.spyCall(this, this.thisValues[i], this.args[i],
+ this.returnValues[i], this.exceptions[i],
+ this.callIds[i]);
+ },
+
+ getCalls: function () {
+ var calls = [];
+ var i;
+
+ for (i = 0; i < this.callCount; i++) {
+ calls.push(this.getCall(i));
+ }
+
+ return calls;
+ },
+
+ calledBefore: function calledBefore(spyFn) {
+ if (!this.called) {
+ return false;
+ }
+
+ if (!spyFn.called) {
+ return true;
+ }
+
+ return this.callIds[0] < spyFn.callIds[spyFn.callIds.length - 1];
+ },
+
+ calledAfter: function calledAfter(spyFn) {
+ if (!this.called || !spyFn.called) {
+ return false;
+ }
+
+ return this.callIds[this.callCount - 1] > spyFn.callIds[spyFn.callCount - 1];
+ },
+
+ withArgs: function () {
+ var args = slice.call(arguments);
+
+ if (this.fakes) {
+ var match = matchingFake(this.fakes, args, true);
+
+ if (match) {
+ return match;
+ }
+ } else {
+ this.fakes = [];
+ }
+
+ var original = this;
+ var fake = this.instantiateFake();
+ fake.matchingAguments = args;
+ fake.parent = this;
+ push.call(this.fakes, fake);
+
+ fake.withArgs = function () {
+ return original.withArgs.apply(original, arguments);
+ };
+
+ for (var i = 0; i < this.args.length; i++) {
+ if (fake.matches(this.args[i])) {
+ incrementCallCount.call(fake);
+ push.call(fake.thisValues, this.thisValues[i]);
+ push.call(fake.args, this.args[i]);
+ push.call(fake.returnValues, this.returnValues[i]);
+ push.call(fake.exceptions, this.exceptions[i]);
+ push.call(fake.callIds, this.callIds[i]);
+ }
+ }
+ createCallProperties.call(fake);
+
+ return fake;
+ },
+
+ matches: function (args, strict) {
+ var margs = this.matchingAguments;
+
+ if (margs.length <= args.length &&
+ sinon.deepEqual(margs, args.slice(0, margs.length))) {
+ return !strict || margs.length == args.length;
+ }
+ },
+
+ printf: function (format) {
+ var spy = this;
+ var args = slice.call(arguments, 1);
+ var formatter;
+
+ return (format || "").replace(/%(.)/g, function (match, specifyer) {
+ formatter = spyApi.formatters[specifyer];
+
+ if (typeof formatter == "function") {
+ return formatter.call(null, spy, args);
+ } else if (!isNaN(parseInt(specifyer, 10))) {
+ return sinon.format(args[specifyer - 1]);
+ }
+
+ return "%" + specifyer;
+ });
+ }
+ };
+
+ function delegateToCalls(method, matchAny, actual, notCalled) {
+ spyApi[method] = function () {
+ if (!this.called) {
+ if (notCalled) {
+ return notCalled.apply(this, arguments);
+ }
+ return false;
+ }
+
+ var currentCall;
+ var matches = 0;
+
+ for (var i = 0, l = this.callCount; i < l; i += 1) {
+ currentCall = this.getCall(i);
+
+ if (currentCall[actual || method].apply(currentCall, arguments)) {
+ matches += 1;
+
+ if (matchAny) {
+ return true;
+ }
+ }
+ }
+
+ return matches === this.callCount;
+ };
+ }
+
+ delegateToCalls("calledOn", true);
+ delegateToCalls("alwaysCalledOn", false, "calledOn");
+ delegateToCalls("calledWith", true);
+ delegateToCalls("calledWithMatch", true);
+ delegateToCalls("alwaysCalledWith", false, "calledWith");
+ delegateToCalls("alwaysCalledWithMatch", false, "calledWithMatch");
+ delegateToCalls("calledWithExactly", true);
+ delegateToCalls("alwaysCalledWithExactly", false, "calledWithExactly");
+ delegateToCalls("neverCalledWith", false, "notCalledWith",
+ function () { return true; });
+ delegateToCalls("neverCalledWithMatch", false, "notCalledWithMatch",
+ function () { return true; });
+ delegateToCalls("threw", true);
+ delegateToCalls("alwaysThrew", false, "threw");
+ delegateToCalls("returned", true);
+ delegateToCalls("alwaysReturned", false, "returned");
+ delegateToCalls("calledWithNew", true);
+ delegateToCalls("alwaysCalledWithNew", false, "calledWithNew");
+ delegateToCalls("callArg", false, "callArgWith", function () {
+ throw new Error(this.toString() + " cannot call arg since it was not yet invoked.");
+ });
+ spyApi.callArgWith = spyApi.callArg;
+ delegateToCalls("callArgOn", false, "callArgOnWith", function () {
+ throw new Error(this.toString() + " cannot call arg since it was not yet invoked.");
+ });
+ spyApi.callArgOnWith = spyApi.callArgOn;
+ delegateToCalls("yield", false, "yield", function () {
+ throw new Error(this.toString() + " cannot yield since it was not yet invoked.");
+ });
+ // "invokeCallback" is an alias for "yield" since "yield" is invalid in strict mode.
+ spyApi.invokeCallback = spyApi.yield;
+ delegateToCalls("yieldOn", false, "yieldOn", function () {
+ throw new Error(this.toString() + " cannot yield since it was not yet invoked.");
+ });
+ delegateToCalls("yieldTo", false, "yieldTo", function (property) {
+ throw new Error(this.toString() + " cannot yield to '" + property +
+ "' since it was not yet invoked.");
+ });
+ delegateToCalls("yieldToOn", false, "yieldToOn", function (property) {
+ throw new Error(this.toString() + " cannot yield to '" + property +
+ "' since it was not yet invoked.");
+ });
+
+ spyApi.formatters = {
+ c: function (spy) {
+ return sinon.timesInWords(spy.callCount);
+ },
+
+ n: function (spy) {
+ return spy.toString();
+ },
+
+ C: function (spy) {
+ var calls = [];
+
+ for (var i = 0, l = spy.callCount; i < l; ++i) {
+ var stringifiedCall = " " + spy.getCall(i).toString();
+ if (/\n/.test(calls[i - 1])) {
+ stringifiedCall = "\n" + stringifiedCall;
+ }
+ push.call(calls, stringifiedCall);
+ }
+
+ return calls.length > 0 ? "\n" + calls.join("\n") : "";
+ },
+
+ t: function (spy) {
+ var objects = [];
+
+ for (var i = 0, l = spy.callCount; i < l; ++i) {
+ push.call(objects, sinon.format(spy.thisValues[i]));
+ }
+
+ return objects.join(", ");
+ },
+
+ "*": function (spy, args) {
+ var formatted = [];
+
+ for (var i = 0, l = args.length; i < l; ++i) {
+ push.call(formatted, sinon.format(args[i]));
+ }
+
+ return formatted.join(", ");
+ }
+ };
+
+ sinon.extend(spy, spyApi);
+
+ spy.spyCall = sinon.spyCall;
+ sinon.spy = spy;
+
+ return spy;
+ }
+
+ var isNode = typeof module !== "undefined" && module.exports && typeof require == "function";
+ var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd;
+
+ function loadDependencies(require, exports, module) {
+ var sinon = require("./util/core");
+ require("./call");
+ require("./extend");
+ require("./times_in_words");
+ require("./format");
+ module.exports = makeApi(sinon);
+ }
+
+ if (isAMD) {
+ define(loadDependencies);
+ } else if (isNode) {
+ loadDependencies(require, module.exports, module);
+ } else if (!sinon) {
+ return;
+ } else {
+ makeApi(sinon);
+ }
+}(typeof sinon == "object" && sinon || null));
+
+},{"./call":27,"./extend":29,"./format":30,"./times_in_words":39,"./util/core":41}],36:[function(require,module,exports){
+/**
+ * @depend util/core.js
+ * @depend extend.js
+ * @depend spy.js
+ * @depend behavior.js
+ */
+/**
+ * Stub functions
+ *
+ * @author Christian Johansen (christian@cjohansen.no)
+ * @license BSD
+ *
+ * Copyright (c) 2010-2013 Christian Johansen
+ */
+"use strict";
+
+(function (sinon) {
+ function makeApi(sinon) {
+ function stub(object, property, func) {
+ if (!!func && typeof func != "function" && typeof func != "object") {
+ throw new TypeError("Custom stub should be a function or a property descriptor");
+ }
+
+ var wrapper;
+
+ if (func) {
+ if (typeof func == "function") {
+ wrapper = sinon.spy && sinon.spy.create ? sinon.spy.create(func) : func;
+ } else {
+ wrapper = func;
+ if (sinon.spy && sinon.spy.create) {
+ var types = sinon.objectKeys(wrapper);
+ for (var i = 0; i < types.length; i++) {
+ wrapper[types[i]] = sinon.spy.create(wrapper[types[i]]);
+ }
+ }
+ }
+ } else {
+ var stubLength = 0;
+ if (typeof object == "object" && typeof object[property] == "function") {
+ stubLength = object[property].length;
+ }
+ wrapper = stub.create(stubLength);
+ }
+
+ if (!object && typeof property === "undefined") {
+ return sinon.stub.create();
+ }
+
+ if (typeof property === "undefined" && typeof object == "object") {
+ for (var prop in object) {
+ if (typeof object[prop] === "function") {
+ stub(object, prop);
+ }
+ }
+
+ return object;
+ }
+
+ return sinon.wrapMethod(object, property, wrapper);
+ }
+
+ function getDefaultBehavior(stub) {
+ return stub.defaultBehavior || getParentBehaviour(stub) || sinon.behavior.create(stub);
+ }
+
+ function getParentBehaviour(stub) {
+ return (stub.parent && getCurrentBehavior(stub.parent));
+ }
+
+ function getCurrentBehavior(stub) {
+ var behavior = stub.behaviors[stub.callCount - 1];
+ return behavior && behavior.isPresent() ? behavior : getDefaultBehavior(stub);
+ }
+
+ var uuid = 0;
+
+ var proto = {
+ create: function create(stubLength) {
+ var functionStub = function () {
+ return getCurrentBehavior(functionStub).invoke(this, arguments);
+ };
+
+ functionStub.id = "stub#" + uuid++;
+ var orig = functionStub;
+ functionStub = sinon.spy.create(functionStub, stubLength);
+ functionStub.func = orig;
+
+ sinon.extend(functionStub, stub);
+ functionStub.instantiateFake = sinon.stub.create;
+ functionStub.displayName = "stub";
+ functionStub.toString = sinon.functionToString;
+
+ functionStub.defaultBehavior = null;
+ functionStub.behaviors = [];
+
+ return functionStub;
+ },
+
+ resetBehavior: function () {
+ var i;
+
+ this.defaultBehavior = null;
+ this.behaviors = [];
+
+ delete this.returnValue;
+ delete this.returnArgAt;
+ this.returnThis = false;
+
+ if (this.fakes) {
+ for (i = 0; i < this.fakes.length; i++) {
+ this.fakes[i].resetBehavior();
+ }
+ }
+ },
+
+ onCall: function onCall(index) {
+ if (!this.behaviors[index]) {
+ this.behaviors[index] = sinon.behavior.create(this);
+ }
+
+ return this.behaviors[index];
+ },
+
+ onFirstCall: function onFirstCall() {
+ return this.onCall(0);
+ },
+
+ onSecondCall: function onSecondCall() {
+ return this.onCall(1);
+ },
+
+ onThirdCall: function onThirdCall() {
+ return this.onCall(2);
+ }
+ };
+
+ for (var method in sinon.behavior) {
+ if (sinon.behavior.hasOwnProperty(method) &&
+ !proto.hasOwnProperty(method) &&
+ method != "create" &&
+ method != "withArgs" &&
+ method != "invoke") {
+ proto[method] = (function (behaviorMethod) {
+ return function () {
+ this.defaultBehavior = this.defaultBehavior || sinon.behavior.create(this);
+ this.defaultBehavior[behaviorMethod].apply(this.defaultBehavior, arguments);
+ return this;
+ };
+ }(method));
+ }
+ }
+
+ sinon.extend(stub, proto);
+ sinon.stub = stub;
+
+ return stub;
+ }
+
+ var isNode = typeof module !== "undefined" && module.exports && typeof require == "function";
+ var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd;
+
+ function loadDependencies(require, exports, module) {
+ var sinon = require("./util/core");
+ require("./behavior");
+ require("./spy");
+ require("./extend");
+ module.exports = makeApi(sinon);
+ }
+
+ if (isAMD) {
+ define(loadDependencies);
+ } else if (isNode) {
+ loadDependencies(require, module.exports, module);
+ } else if (!sinon) {
+ return;
+ } else {
+ makeApi(sinon);
+ }
+}(typeof sinon == "object" && sinon || null));
+
+},{"./behavior":26,"./extend":29,"./spy":35,"./util/core":41}],37:[function(require,module,exports){
+/**
+ * @depend util/core.js
+ * @depend sandbox.js
+ */
+/**
+ * Test function, sandboxes fakes
+ *
+ * @author Christian Johansen (christian@cjohansen.no)
+ * @license BSD
+ *
+ * Copyright (c) 2010-2013 Christian Johansen
+ */
+"use strict";
+
+(function (sinon) {
+ function makeApi(sinon) {
+ var slice = Array.prototype.slice;
+
+ function test(callback) {
+ var type = typeof callback;
+
+ if (type != "function") {
+ throw new TypeError("sinon.test needs to wrap a test function, got " + type);
+ }
+
+ function sinonSandboxedTest() {
+ var config = sinon.getConfig(sinon.config);
+ config.injectInto = config.injectIntoThis && this || config.injectInto;
+ var sandbox = sinon.sandbox.create(config);
+ var args = slice.call(arguments);
+ var oldDone = args.length && args[args.length - 1];
+ var exception, result;
+
+ if (typeof oldDone == "function") {
+ args[args.length - 1] = function sinonDone(result) {
+ if (result) {
+ sandbox.restore();
+ throw exception;
+ } else {
+ sandbox.verifyAndRestore();
+ }
+ oldDone(result);
+ };
+ }
+
+ try {
+ result = callback.apply(this, args.concat(sandbox.args));
+ } catch (e) {
+ exception = e;
+ }
+
+ if (typeof oldDone != "function") {
+ if (typeof exception !== "undefined") {
+ sandbox.restore();
+ throw exception;
+ } else {
+ sandbox.verifyAndRestore();
+ }
+ }
+
+ return result;
+ }
+
+ if (callback.length) {
+ return function sinonAsyncSandboxedTest(callback) {
+ return sinonSandboxedTest.apply(this, arguments);
+ };
+ }
+
+ return sinonSandboxedTest;
+ }
+
+ test.config = {
+ injectIntoThis: true,
+ injectInto: null,
+ properties: ["spy", "stub", "mock", "clock", "server", "requests"],
+ useFakeTimers: true,
+ useFakeServer: true
+ };
+
+ sinon.test = test;
+ return test;
+ }
+
+ var isNode = typeof module !== "undefined" && module.exports && typeof require == "function";
+ var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd;
+
+ function loadDependencies(require, exports, module) {
+ var sinon = require("./util/core");
+ require("./sandbox");
+ module.exports = makeApi(sinon);
+ }
+
+ if (isAMD) {
+ define(loadDependencies);
+ } else if (isNode) {
+ loadDependencies(require, module.exports, module);
+ } else if (sinon) {
+ makeApi(sinon);
+ }
+}(typeof sinon == "object" && sinon || null));
+
+},{"./sandbox":34,"./util/core":41}],38:[function(require,module,exports){
+/**
+ * @depend util/core.js
+ * @depend test.js
+ */
+/**
+ * Test case, sandboxes all test functions
+ *
+ * @author Christian Johansen (christian@cjohansen.no)
+ * @license BSD
+ *
+ * Copyright (c) 2010-2013 Christian Johansen
+ */
+"use strict";
+
+(function (sinon) {
+ function createTest(property, setUp, tearDown) {
+ return function () {
+ if (setUp) {
+ setUp.apply(this, arguments);
+ }
+
+ var exception, result;
+
+ try {
+ result = property.apply(this, arguments);
+ } catch (e) {
+ exception = e;
+ }
+
+ if (tearDown) {
+ tearDown.apply(this, arguments);
+ }
+
+ if (exception) {
+ throw exception;
+ }
+
+ return result;
+ };
+ }
+
+ function makeApi(sinon) {
+ function testCase(tests, prefix) {
+ /*jsl:ignore*/
+ if (!tests || typeof tests != "object") {
+ throw new TypeError("sinon.testCase needs an object with test functions");
+ }
+ /*jsl:end*/
+
+ prefix = prefix || "test";
+ var rPrefix = new RegExp("^" + prefix);
+ var methods = {}, testName, property, method;
+ var setUp = tests.setUp;
+ var tearDown = tests.tearDown;
+
+ for (testName in tests) {
+ if (tests.hasOwnProperty(testName)) {
+ property = tests[testName];
+
+ if (/^(setUp|tearDown)$/.test(testName)) {
+ continue;
+ }
+
+ if (typeof property == "function" && rPrefix.test(testName)) {
+ method = property;
+
+ if (setUp || tearDown) {
+ method = createTest(property, setUp, tearDown);
+ }
+
+ methods[testName] = sinon.test(method);
+ } else {
+ methods[testName] = tests[testName];
+ }
+ }
+ }
+
+ return methods;
+ }
+
+ sinon.testCase = testCase;
+ return testCase;
+ }
+
+ var isNode = typeof module !== "undefined" && module.exports && typeof require == "function";
+ var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd;
+
+ function loadDependencies(require, exports, module) {
+ var sinon = require("./util/core");
+ require("./test");
+ module.exports = makeApi(sinon);
+ }
+
+ if (isAMD) {
+ define(loadDependencies);
+ } else if (isNode) {
+ loadDependencies(require, module.exports, module);
+ } else if (!sinon) {
+ return;
+ } else {
+ makeApi(sinon);
+ }
+}(typeof sinon == "object" && sinon || null));
+
+},{"./test":37,"./util/core":41}],39:[function(require,module,exports){
+/**
+ * @depend util/core.js
+ */
+"use strict";
+
+(function (sinon) {
+ function makeApi(sinon) {
+
+ function timesInWords(count) {
+ switch (count) {
+ case 1:
+ return "once";
+ case 2:
+ return "twice";
+ case 3:
+ return "thrice";
+ default:
+ return (count || 0) + " times";
+ }
+ }
+
+ sinon.timesInWords = timesInWords;
+ return sinon.timesInWords;
+ }
+
+ function loadDependencies(require, exports, module) {
+ var sinon = require("./util/core");
+ module.exports = makeApi(sinon);
+ }
+
+ var isNode = typeof module !== "undefined" && module.exports && typeof require == "function";
+ var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd;
+
+ if (isAMD) {
+ define(loadDependencies);
+ } else if (isNode) {
+ loadDependencies(require, module.exports, module);
+ } else if (!sinon) {
+ return;
+ } else {
+ makeApi(sinon);
+ }
+}(typeof sinon == "object" && sinon || null));
+
+},{"./util/core":41}],40:[function(require,module,exports){
+/**
+ * @depend util/core.js
+ */
+/**
+ * Format functions
+ *
+ * @author Christian Johansen (christian@cjohansen.no)
+ * @license BSD
+ *
+ * Copyright (c) 2010-2014 Christian Johansen
+ */
+"use strict";
+
+(function (sinon, formatio) {
+ function makeApi(sinon) {
+ function typeOf(value) {
+ if (value === null) {
+ return "null";
+ } else if (value === undefined) {
+ return "undefined";
+ }
+ var string = Object.prototype.toString.call(value);
+ return string.substring(8, string.length - 1).toLowerCase();
+ };
+
+ sinon.typeOf = typeOf;
+ return sinon.typeOf;
+ }
+
+ function loadDependencies(require, exports, module) {
+ var sinon = require("./util/core");
+ module.exports = makeApi(sinon);
+ }
+
+ var isNode = typeof module !== "undefined" && module.exports && typeof require == "function";
+ var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd;
+
+ if (isAMD) {
+ define(loadDependencies);
+ } else if (isNode) {
+ loadDependencies(require, module.exports, module);
+ } else if (!sinon) {
+ return;
+ } else {
+ makeApi(sinon);
+ }
+}(
+ (typeof sinon == "object" && sinon || null),
+ (typeof formatio == "object" && formatio)
+));
+
+},{"./util/core":41}],41:[function(require,module,exports){
+/**
+ * @depend ../../sinon.js
+ */
+/**
+ * Sinon core utilities. For internal use only.
+ *
+ * @author Christian Johansen (christian@cjohansen.no)
+ * @license BSD
+ *
+ * Copyright (c) 2010-2013 Christian Johansen
+ */
+"use strict";
+
+(function (sinon) {
+ var div = typeof document != "undefined" && document.createElement("div");
+ var hasOwn = Object.prototype.hasOwnProperty;
+
+ function isDOMNode(obj) {
+ var success = false;
+
+ try {
+ obj.appendChild(div);
+ success = div.parentNode == obj;
+ } catch (e) {
+ return false;
+ } finally {
+ try {
+ obj.removeChild(div);
+ } catch (e) {
+ // Remove failed, not much we can do about that
+ }
+ }
+
+ return success;
+ }
+
+ function isElement(obj) {
+ return div && obj && obj.nodeType === 1 && isDOMNode(obj);
+ }
+
+ function isFunction(obj) {
+ return typeof obj === "function" || !!(obj && obj.constructor && obj.call && obj.apply);
+ }
+
+ function isReallyNaN(val) {
+ return typeof val === "number" && isNaN(val);
+ }
+
+ function mirrorProperties(target, source) {
+ for (var prop in source) {
+ if (!hasOwn.call(target, prop)) {
+ target[prop] = source[prop];
+ }
+ }
+ }
+
+ function isRestorable(obj) {
+ return typeof obj === "function" && typeof obj.restore === "function" && obj.restore.sinon;
+ }
+
+ // Cheap way to detect if we have ES5 support.
+ var hasES5Support = "keys" in Object;
+
+ function makeApi(sinon) {
+ sinon.wrapMethod = function wrapMethod(object, property, method) {
+ if (!object) {
+ throw new TypeError("Should wrap property of object");
+ }
+
+ if (typeof method != "function" && typeof method != "object") {
+ throw new TypeError("Method wrapper should be a function or a property descriptor");
+ }
+
+ function checkWrappedMethod(wrappedMethod) {
+ if (!isFunction(wrappedMethod)) {
+ error = new TypeError("Attempted to wrap " + (typeof wrappedMethod) + " property " +
+ property + " as function");
+ } else if (wrappedMethod.restore && wrappedMethod.restore.sinon) {
+ error = new TypeError("Attempted to wrap " + property + " which is already wrapped");
+ } else if (wrappedMethod.calledBefore) {
+ var verb = !!wrappedMethod.returns ? "stubbed" : "spied on";
+ error = new TypeError("Attempted to wrap " + property + " which is already " + verb);
+ }
+
+ if (error) {
+ if (wrappedMethod && wrappedMethod.stackTrace) {
+ error.stack += "\n--------------\n" + wrappedMethod.stackTrace;
+ }
+ throw error;
+ }
+ }
+
+ var error, wrappedMethod;
+
+ // IE 8 does not support hasOwnProperty on the window object and Firefox has a problem
+ // when using hasOwn.call on objects from other frames.
+ var owned = object.hasOwnProperty ? object.hasOwnProperty(property) : hasOwn.call(object, property);
+
+ if (hasES5Support) {
+ var methodDesc = (typeof method == "function") ? {value: method} : method,
+ wrappedMethodDesc = sinon.getPropertyDescriptor(object, property),
+ i;
+
+ if (!wrappedMethodDesc) {
+ error = new TypeError("Attempted to wrap " + (typeof wrappedMethod) + " property " +
+ property + " as function");
+ } else if (wrappedMethodDesc.restore && wrappedMethodDesc.restore.sinon) {
+ error = new TypeError("Attempted to wrap " + property + " which is already wrapped");
+ }
+ if (error) {
+ if (wrappedMethodDesc && wrappedMethodDesc.stackTrace) {
+ error.stack += "\n--------------\n" + wrappedMethodDesc.stackTrace;
+ }
+ throw error;
+ }
+
+ var types = sinon.objectKeys(methodDesc);
+ for (i = 0; i < types.length; i++) {
+ wrappedMethod = wrappedMethodDesc[types[i]];
+ checkWrappedMethod(wrappedMethod);
+ }
+
+ mirrorProperties(methodDesc, wrappedMethodDesc);
+ for (i = 0; i < types.length; i++) {
+ mirrorProperties(methodDesc[types[i]], wrappedMethodDesc[types[i]]);
+ }
+ Object.defineProperty(object, property, methodDesc);
+ } else {
+ wrappedMethod = object[property];
+ checkWrappedMethod(wrappedMethod);
+ object[property] = method;
+ method.displayName = property;
+ }
+
+ method.displayName = property;
+
+ // Set up a stack trace which can be used later to find what line of
+ // code the original method was created on.
+ method.stackTrace = (new Error("Stack Trace for original")).stack;
+
+ method.restore = function () {
+ // For prototype properties try to reset by delete first.
+ // If this fails (ex: localStorage on mobile safari) then force a reset
+ // via direct assignment.
+ if (!owned) {
+ try {
+ delete object[property];
+ } catch (e) {}
+ // For native code functions `delete` fails without throwing an error
+ // on Chrome < 43, PhantomJS, etc.
+ // Use strict equality comparison to check failures then force a reset
+ // via direct assignment.
+ if (object[property] === method) {
+ object[property] = wrappedMethod;
+ }
+ } else if (hasES5Support) {
+ Object.defineProperty(object, property, wrappedMethodDesc);
+ }
+
+ if (!hasES5Support && object[property] === method) {
+ object[property] = wrappedMethod;
+ }
+ };
+
+ method.restore.sinon = true;
+
+ if (!hasES5Support) {
+ mirrorProperties(method, wrappedMethod);
+ }
+
+ return method;
+ };
+
+ sinon.create = function create(proto) {
+ var F = function () {};
+ F.prototype = proto;
+ return new F();
+ };
+
+ sinon.deepEqual = function deepEqual(a, b) {
+ if (sinon.match && sinon.match.isMatcher(a)) {
+ return a.test(b);
+ }
+
+ if (typeof a != "object" || typeof b != "object") {
+ if (isReallyNaN(a) && isReallyNaN(b)) {
+ return true;
+ } else {
+ return a === b;
+ }
+ }
+
+ if (isElement(a) || isElement(b)) {
+ return a === b;
+ }
+
+ if (a === b) {
+ return true;
+ }
+
+ if ((a === null && b !== null) || (a !== null && b === null)) {
+ return false;
+ }
+
+ if (a instanceof RegExp && b instanceof RegExp) {
+ return (a.source === b.source) && (a.global === b.global) &&
+ (a.ignoreCase === b.ignoreCase) && (a.multiline === b.multiline);
+ }
+
+ var aString = Object.prototype.toString.call(a);
+ if (aString != Object.prototype.toString.call(b)) {
+ return false;
+ }
+
+ if (aString == "[object Date]") {
+ return a.valueOf() === b.valueOf();
+ }
+
+ var prop, aLength = 0, bLength = 0;
+
+ if (aString == "[object Array]" && a.length !== b.length) {
+ return false;
+ }
+
+ for (prop in a) {
+ aLength += 1;
+
+ if (!(prop in b)) {
+ return false;
+ }
+
+ if (!deepEqual(a[prop], b[prop])) {
+ return false;
+ }
+ }
+
+ for (prop in b) {
+ bLength += 1;
+ }
+
+ return aLength == bLength;
+ };
+
+ sinon.functionName = function functionName(func) {
+ var name = func.displayName || func.name;
+
+ // Use function decomposition as a last resort to get function
+ // name. Does not rely on function decomposition to work - if it
+ // doesn't debugging will be slightly less informative
+ // (i.e. toString will say 'spy' rather than 'myFunc').
+ if (!name) {
+ var matches = func.toString().match(/function ([^\s\(]+)/);
+ name = matches && matches[1];
+ }
+
+ return name;
+ };
+
+ sinon.functionToString = function toString() {
+ if (this.getCall && this.callCount) {
+ var thisValue, prop, i = this.callCount;
+
+ while (i--) {
+ thisValue = this.getCall(i).thisValue;
+
+ for (prop in thisValue) {
+ if (thisValue[prop] === this) {
+ return prop;
+ }
+ }
+ }
+ }
+
+ return this.displayName || "sinon fake";
+ };
+
+ sinon.objectKeys = function objectKeys(obj) {
+ if (obj !== Object(obj)) {
+ throw new TypeError("sinon.objectKeys called on a non-object");
+ }
+
+ var keys = [];
+ var key;
+ for (key in obj) {
+ if (hasOwn.call(obj, key)) {
+ keys.push(key);
+ }
+ }
+
+ return keys;
+ };
+
+ sinon.getPropertyDescriptor = function getPropertyDescriptor(object, property) {
+ var proto = object, descriptor;
+ while (proto && !(descriptor = Object.getOwnPropertyDescriptor(proto, property))) {
+ proto = Object.getPrototypeOf(proto);
+ }
+ return descriptor;
+ }
+
+ sinon.getConfig = function (custom) {
+ var config = {};
+ custom = custom || {};
+ var defaults = sinon.defaultConfig;
+
+ for (var prop in defaults) {
+ if (defaults.hasOwnProperty(prop)) {
+ config[prop] = custom.hasOwnProperty(prop) ? custom[prop] : defaults[prop];
+ }
+ }
+
+ return config;
+ };
+
+ sinon.defaultConfig = {
+ injectIntoThis: true,
+ injectInto: null,
+ properties: ["spy", "stub", "mock", "clock", "server", "requests"],
+ useFakeTimers: true,
+ useFakeServer: true
+ };
+
+ sinon.timesInWords = function timesInWords(count) {
+ return count == 1 && "once" ||
+ count == 2 && "twice" ||
+ count == 3 && "thrice" ||
+ (count || 0) + " times";
+ };
+
+ sinon.calledInOrder = function (spies) {
+ for (var i = 1, l = spies.length; i < l; i++) {
+ if (!spies[i - 1].calledBefore(spies[i]) || !spies[i].called) {
+ return false;
+ }
+ }
+
+ return true;
+ };
+
+ sinon.orderByFirstCall = function (spies) {
+ return spies.sort(function (a, b) {
+ // uuid, won't ever be equal
+ var aCall = a.getCall(0);
+ var bCall = b.getCall(0);
+ var aId = aCall && aCall.callId || -1;
+ var bId = bCall && bCall.callId || -1;
+
+ return aId < bId ? -1 : 1;
+ });
+ };
+
+ sinon.createStubInstance = function (constructor) {
+ if (typeof constructor !== "function") {
+ throw new TypeError("The constructor should be a function.");
+ }
+ return sinon.stub(sinon.create(constructor.prototype));
+ };
+
+ sinon.restore = function (object) {
+ if (object !== null && typeof object === "object") {
+ for (var prop in object) {
+ if (isRestorable(object[prop])) {
+ object[prop].restore();
+ }
+ }
+ } else if (isRestorable(object)) {
+ object.restore();
+ }
+ };
+
+ return sinon;
+ }
+
+ var isNode = typeof module !== "undefined" && module.exports && typeof require == "function";
+ var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd;
+
+ function loadDependencies(require, exports) {
+ makeApi(exports);
+ }
+
+ if (isAMD) {
+ define(loadDependencies);
+ } else if (isNode) {
+ loadDependencies(require, module.exports);
+ } else if (!sinon) {
+ return;
+ } else {
+ makeApi(sinon);
+ }
+}(typeof sinon == "object" && sinon || null));
+
+},{}],42:[function(require,module,exports){
+/**
+ * Minimal Event interface implementation
+ *
+ * Original implementation by Sven Fuchs: https://gist.github.com/995028
+ * Modifications and tests by Christian Johansen.
+ *
+ * @author Sven Fuchs (svenfuchs@artweb-design.de)
+ * @author Christian Johansen (christian@cjohansen.no)
+ * @license BSD
+ *
+ * Copyright (c) 2011 Sven Fuchs, Christian Johansen
+ */
+"use strict";
+
+if (typeof sinon == "undefined") {
+ this.sinon = {};
+}
+
+(function () {
+ var push = [].push;
+
+ function makeApi(sinon) {
+ sinon.Event = function Event(type, bubbles, cancelable, target) {
+ this.initEvent(type, bubbles, cancelable, target);
+ };
+
+ sinon.Event.prototype = {
+ initEvent: function (type, bubbles, cancelable, target) {
+ this.type = type;
+ this.bubbles = bubbles;
+ this.cancelable = cancelable;
+ this.target = target;
+ },
+
+ stopPropagation: function () {},
+
+ preventDefault: function () {
+ this.defaultPrevented = true;
+ }
+ };
+
+ sinon.ProgressEvent = function ProgressEvent(type, progressEventRaw, target) {
+ this.initEvent(type, false, false, target);
+ this.loaded = progressEventRaw.loaded || null;
+ this.total = progressEventRaw.total || null;
+ this.lengthComputable = !!progressEventRaw.total;
+ };
+
+ sinon.ProgressEvent.prototype = new sinon.Event();
+
+ sinon.ProgressEvent.prototype.constructor = sinon.ProgressEvent;
+
+ sinon.CustomEvent = function CustomEvent(type, customData, target) {
+ this.initEvent(type, false, false, target);
+ this.detail = customData.detail || null;
+ };
+
+ sinon.CustomEvent.prototype = new sinon.Event();
+
+ sinon.CustomEvent.prototype.constructor = sinon.CustomEvent;
+
+ sinon.EventTarget = {
+ addEventListener: function addEventListener(event, listener) {
+ this.eventListeners = this.eventListeners || {};
+ this.eventListeners[event] = this.eventListeners[event] || [];
+ push.call(this.eventListeners[event], listener);
+ },
+
+ removeEventListener: function removeEventListener(event, listener) {
+ var listeners = this.eventListeners && this.eventListeners[event] || [];
+
+ for (var i = 0, l = listeners.length; i < l; ++i) {
+ if (listeners[i] == listener) {
+ return listeners.splice(i, 1);
+ }
+ }
+ },
+
+ dispatchEvent: function dispatchEvent(event) {
+ var type = event.type;
+ var listeners = this.eventListeners && this.eventListeners[type] || [];
+
+ for (var i = 0; i < listeners.length; i++) {
+ if (typeof listeners[i] == "function") {
+ listeners[i].call(this, event);
+ } else {
+ listeners[i].handleEvent(event);
+ }
+ }
+
+ return !!event.defaultPrevented;
+ }
+ };
+ }
+
+ var isNode = typeof module !== "undefined" && module.exports && typeof require == "function";
+ var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd;
+
+ function loadDependencies(require) {
+ var sinon = require("./core");
+ makeApi(sinon);
+ }
+
+ if (isAMD) {
+ define(loadDependencies);
+ } else if (isNode) {
+ loadDependencies(require);
+ } else {
+ makeApi(sinon);
+ }
+}());
+
+},{"./core":41}],43:[function(require,module,exports){
+/**
+ * @depend fake_xdomain_request.js
+ * @depend fake_xml_http_request.js
+ * @depend ../format.js
+ * @depend ../log_error.js
+ */
+/**
+ * The Sinon "server" mimics a web server that receives requests from
+ * sinon.FakeXMLHttpRequest and provides an API to respond to those requests,
+ * both synchronously and asynchronously. To respond synchronuously, canned
+ * answers have to be provided upfront.
+ *
+ * @author Christian Johansen (christian@cjohansen.no)
+ * @license BSD
+ *
+ * Copyright (c) 2010-2013 Christian Johansen
+ */
+"use strict";
+
+if (typeof sinon == "undefined") {
+ var sinon = {};
+}
+
+(function () {
+ var push = [].push;
+ function F() {}
+
+ function create(proto) {
+ F.prototype = proto;
+ return new F();
+ }
+
+ function responseArray(handler) {
+ var response = handler;
+
+ if (Object.prototype.toString.call(handler) != "[object Array]") {
+ response = [200, {}, handler];
+ }
+
+ if (typeof response[2] != "string") {
+ throw new TypeError("Fake server response body should be string, but was " +
+ typeof response[2]);
+ }
+
+ return response;
+ }
+
+ var wloc = typeof window !== "undefined" ? window.location : {};
+ var rCurrLoc = new RegExp("^" + wloc.protocol + "//" + wloc.host);
+
+ function matchOne(response, reqMethod, reqUrl) {
+ var rmeth = response.method;
+ var matchMethod = !rmeth || rmeth.toLowerCase() == reqMethod.toLowerCase();
+ var url = response.url;
+ var matchUrl = !url || url == reqUrl || (typeof url.test == "function" && url.test(reqUrl));
+
+ return matchMethod && matchUrl;
+ }
+
+ function match(response, request) {
+ var requestUrl = request.url;
+
+ if (!/^https?:\/\//.test(requestUrl) || rCurrLoc.test(requestUrl)) {
+ requestUrl = requestUrl.replace(rCurrLoc, "");
+ }
+
+ if (matchOne(response, this.getHTTPMethod(request), requestUrl)) {
+ if (typeof response.response == "function") {
+ var ru = response.url;
+ var args = [request].concat(ru && typeof ru.exec == "function" ? ru.exec(requestUrl).slice(1) : []);
+ return response.response.apply(response, args);
+ }
+
+ return true;
+ }
+
+ return false;
+ }
+
+ function makeApi(sinon) {
+ sinon.fakeServer = {
+ create: function () {
+ var server = create(this);
+ if (!sinon.xhr.supportsCORS) {
+ this.xhr = sinon.useFakeXDomainRequest();
+ } else {
+ this.xhr = sinon.useFakeXMLHttpRequest();
+ }
+ server.requests = [];
+
+ this.xhr.onCreate = function (xhrObj) {
+ server.addRequest(xhrObj);
+ };
+
+ return server;
+ },
+
+ addRequest: function addRequest(xhrObj) {
+ var server = this;
+ push.call(this.requests, xhrObj);
+
+ xhrObj.onSend = function () {
+ server.handleRequest(this);
+
+ if (server.respondImmediately) {
+ server.respond();
+ } else if (server.autoRespond && !server.responding) {
+ setTimeout(function () {
+ server.responding = false;
+ server.respond();
+ }, server.autoRespondAfter || 10);
+
+ server.responding = true;
+ }
+ };
+ },
+
+ getHTTPMethod: function getHTTPMethod(request) {
+ if (this.fakeHTTPMethods && /post/i.test(request.method)) {
+ var matches = (request.requestBody || "").match(/_method=([^\b;]+)/);
+ return !!matches ? matches[1] : request.method;
+ }
+
+ return request.method;
+ },
+
+ handleRequest: function handleRequest(xhr) {
+ if (xhr.async) {
+ if (!this.queue) {
+ this.queue = [];
+ }
+
+ push.call(this.queue, xhr);
+ } else {
+ this.processRequest(xhr);
+ }
+ },
+
+ log: function log(response, request) {
+ var str;
+
+ str = "Request:\n" + sinon.format(request) + "\n\n";
+ str += "Response:\n" + sinon.format(response) + "\n\n";
+
+ sinon.log(str);
+ },
+
+ respondWith: function respondWith(method, url, body) {
+ if (arguments.length == 1 && typeof method != "function") {
+ this.response = responseArray(method);
+ return;
+ }
+
+ if (!this.responses) { this.responses = []; }
+
+ if (arguments.length == 1) {
+ body = method;
+ url = method = null;
+ }
+
+ if (arguments.length == 2) {
+ body = url;
+ url = method;
+ method = null;
+ }
+
+ push.call(this.responses, {
+ method: method,
+ url: url,
+ response: typeof body == "function" ? body : responseArray(body)
+ });
+ },
+
+ respond: function respond() {
+ if (arguments.length > 0) {
+ this.respondWith.apply(this, arguments);
+ }
+
+ var queue = this.queue || [];
+ var requests = queue.splice(0, queue.length);
+ var request;
+
+ while (request = requests.shift()) {
+ this.processRequest(request);
+ }
+ },
+
+ processRequest: function processRequest(request) {
+ try {
+ if (request.aborted) {
+ return;
+ }
+
+ var response = this.response || [404, {}, ""];
+
+ if (this.responses) {
+ for (var l = this.responses.length, i = l - 1; i >= 0; i--) {
+ if (match.call(this, this.responses[i], request)) {
+ response = this.responses[i].response;
+ break;
+ }
+ }
+ }
+
+ if (request.readyState != 4) {
+ this.log(response, request);
+
+ request.respond(response[0], response[1], response[2]);
+ }
+ } catch (e) {
+ sinon.logError("Fake server request processing", e);
+ }
+ },
+
+ restore: function restore() {
+ return this.xhr.restore && this.xhr.restore.apply(this.xhr, arguments);
+ }
+ };
+ }
+
+ var isNode = typeof module !== "undefined" && module.exports && typeof require == "function";
+ var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd;
+
+ function loadDependencies(require, exports, module) {
+ var sinon = require("./core");
+ require("./fake_xdomain_request");
+ require("./fake_xml_http_request");
+ require("../format");
+ makeApi(sinon);
+ module.exports = sinon;
+ }
+
+ if (isAMD) {
+ define(loadDependencies);
+ } else if (isNode) {
+ loadDependencies(require, module.exports, module);
+ } else {
+ makeApi(sinon);
+ }
+}());
+
+},{"../format":30,"./core":41,"./fake_xdomain_request":46,"./fake_xml_http_request":47}],44:[function(require,module,exports){
+/**
+ * @depend fake_server.js
+ * @depend fake_timers.js
+ */
+/**
+ * Add-on for sinon.fakeServer that automatically handles a fake timer along with
+ * the FakeXMLHttpRequest. The direct inspiration for this add-on is jQuery
+ * 1.3.x, which does not use xhr object's onreadystatehandler at all - instead,
+ * it polls the object for completion with setInterval. Dispite the direct
+ * motivation, there is nothing jQuery-specific in this file, so it can be used
+ * in any environment where the ajax implementation depends on setInterval or
+ * setTimeout.
+ *
+ * @author Christian Johansen (christian@cjohansen.no)
+ * @license BSD
+ *
+ * Copyright (c) 2010-2013 Christian Johansen
+ */
+"use strict";
+
+(function () {
+ function makeApi(sinon) {
+ function Server() {}
+ Server.prototype = sinon.fakeServer;
+
+ sinon.fakeServerWithClock = new Server();
+
+ sinon.fakeServerWithClock.addRequest = function addRequest(xhr) {
+ if (xhr.async) {
+ if (typeof setTimeout.clock == "object") {
+ this.clock = setTimeout.clock;
+ } else {
+ this.clock = sinon.useFakeTimers();
+ this.resetClock = true;
+ }
+
+ if (!this.longestTimeout) {
+ var clockSetTimeout = this.clock.setTimeout;
+ var clockSetInterval = this.clock.setInterval;
+ var server = this;
+
+ this.clock.setTimeout = function (fn, timeout) {
+ server.longestTimeout = Math.max(timeout, server.longestTimeout || 0);
+
+ return clockSetTimeout.apply(this, arguments);
+ };
+
+ this.clock.setInterval = function (fn, timeout) {
+ server.longestTimeout = Math.max(timeout, server.longestTimeout || 0);
+
+ return clockSetInterval.apply(this, arguments);
+ };
+ }
+ }
+
+ return sinon.fakeServer.addRequest.call(this, xhr);
+ };
+
+ sinon.fakeServerWithClock.respond = function respond() {
+ var returnVal = sinon.fakeServer.respond.apply(this, arguments);
+
+ if (this.clock) {
+ this.clock.tick(this.longestTimeout || 0);
+ this.longestTimeout = 0;
+
+ if (this.resetClock) {
+ this.clock.restore();
+ this.resetClock = false;
+ }
+ }
+
+ return returnVal;
+ };
+
+ sinon.fakeServerWithClock.restore = function restore() {
+ if (this.clock) {
+ this.clock.restore();
+ }
+
+ return sinon.fakeServer.restore.apply(this, arguments);
+ };
+ }
+
+ var isNode = typeof module !== "undefined" && module.exports && typeof require == "function";
+ var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd;
+
+ function loadDependencies(require) {
+ var sinon = require("./core");
+ require("./fake_server");
+ require("./fake_timers");
+ makeApi(sinon);
+ }
+
+ if (isAMD) {
+ define(loadDependencies);
+ } else if (isNode) {
+ loadDependencies(require);
+ } else {
+ makeApi(sinon);
+ }
+}());
+
+},{"./core":41,"./fake_server":43,"./fake_timers":45}],45:[function(require,module,exports){
+(function (global){
+/*global lolex */
+
+/**
+ * Fake timer API
+ * setTimeout
+ * setInterval
+ * clearTimeout
+ * clearInterval
+ * tick
+ * reset
+ * Date
+ *
+ * Inspired by jsUnitMockTimeOut from JsUnit
+ *
+ * @author Christian Johansen (christian@cjohansen.no)
+ * @license BSD
+ *
+ * Copyright (c) 2010-2013 Christian Johansen
+ */
+"use strict";
+
+if (typeof sinon == "undefined") {
+ var sinon = {};
+}
+
+(function (global) {
+ function makeApi(sinon, lol) {
+ var llx = typeof lolex !== "undefined" ? lolex : lol;
+
+ sinon.useFakeTimers = function () {
+ var now, methods = Array.prototype.slice.call(arguments);
+
+ if (typeof methods[0] === "string") {
+ now = 0;
+ } else {
+ now = methods.shift();
+ }
+
+ var clock = llx.install(now || 0, methods);
+ clock.restore = clock.uninstall;
+ return clock;
+ };
+
+ sinon.clock = {
+ create: function (now) {
+ return llx.createClock(now);
+ }
+ };
+
+ sinon.timers = {
+ setTimeout: setTimeout,
+ clearTimeout: clearTimeout,
+ setImmediate: (typeof setImmediate !== "undefined" ? setImmediate : undefined),
+ clearImmediate: (typeof clearImmediate !== "undefined" ? clearImmediate : undefined),
+ setInterval: setInterval,
+ clearInterval: clearInterval,
+ Date: Date
+ };
+ }
+
+ var isNode = typeof module !== "undefined" && module.exports && typeof require == "function";
+ var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd;
+
+ function loadDependencies(require, epxorts, module, lolex) {
+ var sinon = require("./core");
+ makeApi(sinon, lolex);
+ module.exports = sinon;
+ }
+
+ if (isAMD) {
+ define(loadDependencies);
+ } else if (isNode) {
+ loadDependencies(require, module.exports, module, require("lolex"));
+ } else {
+ makeApi(sinon);
+ }
+}(typeof global != "undefined" && typeof global !== "function" ? global : this));
+
+}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
+},{"./core":41,"lolex":50}],46:[function(require,module,exports){
+/**
+ * @depend core.js
+ * @depend ../extend.js
+ * @depend event.js
+ * @depend ../log_error.js
+ */
+/**
+ * Fake XDomainRequest object
+ */
+"use strict";
+
+if (typeof sinon == "undefined") {
+ this.sinon = {};
+}
+
+// wrapper for global
+(function (global) {
+ var xdr = { XDomainRequest: global.XDomainRequest };
+ xdr.GlobalXDomainRequest = global.XDomainRequest;
+ xdr.supportsXDR = typeof xdr.GlobalXDomainRequest != "undefined";
+ xdr.workingXDR = xdr.supportsXDR ? xdr.GlobalXDomainRequest : false;
+
+ function makeApi(sinon) {
+ sinon.xdr = xdr;
+
+ function FakeXDomainRequest() {
+ this.readyState = FakeXDomainRequest.UNSENT;
+ this.requestBody = null;
+ this.requestHeaders = {};
+ this.status = 0;
+ this.timeout = null;
+
+ if (typeof FakeXDomainRequest.onCreate == "function") {
+ FakeXDomainRequest.onCreate(this);
+ }
+ }
+
+ function verifyState(xdr) {
+ if (xdr.readyState !== FakeXDomainRequest.OPENED) {
+ throw new Error("INVALID_STATE_ERR");
+ }
+
+ if (xdr.sendFlag) {
+ throw new Error("INVALID_STATE_ERR");
+ }
+ }
+
+ function verifyRequestSent(xdr) {
+ if (xdr.readyState == FakeXDomainRequest.UNSENT) {
+ throw new Error("Request not sent");
+ }
+ if (xdr.readyState == FakeXDomainRequest.DONE) {
+ throw new Error("Request done");
+ }
+ }
+
+ function verifyResponseBodyType(body) {
+ if (typeof body != "string") {
+ var error = new Error("Attempted to respond to fake XDomainRequest with " +
+ body + ", which is not a string.");
+ error.name = "InvalidBodyException";
+ throw error;
+ }
+ }
+
+ sinon.extend(FakeXDomainRequest.prototype, sinon.EventTarget, {
+ open: function open(method, url) {
+ this.method = method;
+ this.url = url;
+
+ this.responseText = null;
+ this.sendFlag = false;
+
+ this.readyStateChange(FakeXDomainRequest.OPENED);
+ },
+
+ readyStateChange: function readyStateChange(state) {
+ this.readyState = state;
+ var eventName = "";
+ switch (this.readyState) {
+ case FakeXDomainRequest.UNSENT:
+ break;
+ case FakeXDomainRequest.OPENED:
+ break;
+ case FakeXDomainRequest.LOADING:
+ if (this.sendFlag) {
+ //raise the progress event
+ eventName = "onprogress";
+ }
+ break;
+ case FakeXDomainRequest.DONE:
+ if (this.isTimeout) {
+ eventName = "ontimeout"
+ } else if (this.errorFlag || (this.status < 200 || this.status > 299)) {
+ eventName = "onerror";
+ } else {
+ eventName = "onload"
+ }
+ break;
+ }
+
+ // raising event (if defined)
+ if (eventName) {
+ if (typeof this[eventName] == "function") {
+ try {
+ this[eventName]();
+ } catch (e) {
+ sinon.logError("Fake XHR " + eventName + " handler", e);
+ }
+ }
+ }
+ },
+
+ send: function send(data) {
+ verifyState(this);
+
+ if (!/^(get|head)$/i.test(this.method)) {
+ this.requestBody = data;
+ }
+ this.requestHeaders["Content-Type"] = "text/plain;charset=utf-8";
+
+ this.errorFlag = false;
+ this.sendFlag = true;
+ this.readyStateChange(FakeXDomainRequest.OPENED);
+
+ if (typeof this.onSend == "function") {
+ this.onSend(this);
+ }
+ },
+
+ abort: function abort() {
+ this.aborted = true;
+ this.responseText = null;
+ this.errorFlag = true;
+
+ if (this.readyState > sinon.FakeXDomainRequest.UNSENT && this.sendFlag) {
+ this.readyStateChange(sinon.FakeXDomainRequest.DONE);
+ this.sendFlag = false;
+ }
+ },
+
+ setResponseBody: function setResponseBody(body) {
+ verifyRequestSent(this);
+ verifyResponseBodyType(body);
+
+ var chunkSize = this.chunkSize || 10;
+ var index = 0;
+ this.responseText = "";
+
+ do {
+ this.readyStateChange(FakeXDomainRequest.LOADING);
+ this.responseText += body.substring(index, index + chunkSize);
+ index += chunkSize;
+ } while (index < body.length);
+
+ this.readyStateChange(FakeXDomainRequest.DONE);
+ },
+
+ respond: function respond(status, contentType, body) {
+ // content-type ignored, since XDomainRequest does not carry this
+ // we keep the same syntax for respond(...) as for FakeXMLHttpRequest to ease
+ // test integration across browsers
+ this.status = typeof status == "number" ? status : 200;
+ this.setResponseBody(body || "");
+ },
+
+ simulatetimeout: function simulatetimeout() {
+ this.status = 0;
+ this.isTimeout = true;
+ // Access to this should actually throw an error
+ this.responseText = undefined;
+ this.readyStateChange(FakeXDomainRequest.DONE);
+ }
+ });
+
+ sinon.extend(FakeXDomainRequest, {
+ UNSENT: 0,
+ OPENED: 1,
+ LOADING: 3,
+ DONE: 4
+ });
+
+ sinon.useFakeXDomainRequest = function useFakeXDomainRequest() {
+ sinon.FakeXDomainRequest.restore = function restore(keepOnCreate) {
+ if (xdr.supportsXDR) {
+ global.XDomainRequest = xdr.GlobalXDomainRequest;
+ }
+
+ delete sinon.FakeXDomainRequest.restore;
+
+ if (keepOnCreate !== true) {
+ delete sinon.FakeXDomainRequest.onCreate;
+ }
+ };
+ if (xdr.supportsXDR) {
+ global.XDomainRequest = sinon.FakeXDomainRequest;
+ }
+ return sinon.FakeXDomainRequest;
+ };
+
+ sinon.FakeXDomainRequest = FakeXDomainRequest;
+ }
+
+ var isNode = typeof module !== "undefined" && module.exports && typeof require == "function";
+ var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd;
+
+ function loadDependencies(require, exports, module) {
+ var sinon = require("./core");
+ require("../extend");
+ require("./event");
+ require("../log_error");
+ makeApi(sinon);
+ module.exports = sinon;
+ }
+
+ if (isAMD) {
+ define(loadDependencies);
+ } else if (isNode) {
+ loadDependencies(require, module.exports, module);
+ } else {
+ makeApi(sinon);
+ }
+})(this);
+
+},{"../extend":29,"../log_error":31,"./core":41,"./event":42}],47:[function(require,module,exports){
+(function (global){
+/**
+ * @depend core.js
+ * @depend ../extend.js
+ * @depend event.js
+ * @depend ../log_error.js
+ */
+/**
+ * Fake XMLHttpRequest object
+ *
+ * @author Christian Johansen (christian@cjohansen.no)
+ * @license BSD
+ *
+ * Copyright (c) 2010-2013 Christian Johansen
+ */
+"use strict";
+
+(function (global) {
+
+ var supportsProgress = typeof ProgressEvent !== "undefined";
+ var supportsCustomEvent = typeof CustomEvent !== "undefined";
+ var sinonXhr = { XMLHttpRequest: global.XMLHttpRequest };
+ sinonXhr.GlobalXMLHttpRequest = global.XMLHttpRequest;
+ sinonXhr.GlobalActiveXObject = global.ActiveXObject;
+ sinonXhr.supportsActiveX = typeof sinonXhr.GlobalActiveXObject != "undefined";
+ sinonXhr.supportsXHR = typeof sinonXhr.GlobalXMLHttpRequest != "undefined";
+ sinonXhr.workingXHR = sinonXhr.supportsXHR ? sinonXhr.GlobalXMLHttpRequest : sinonXhr.supportsActiveX
+ ? function () { return new sinonXhr.GlobalActiveXObject("MSXML2.XMLHTTP.3.0") } : false;
+ sinonXhr.supportsCORS = sinonXhr.supportsXHR && "withCredentials" in (new sinonXhr.GlobalXMLHttpRequest());
+
+ /*jsl:ignore*/
+ var unsafeHeaders = {
+ "Accept-Charset": true,
+ "Accept-Encoding": true,
+ Connection: true,
+ "Content-Length": true,
+ Cookie: true,
+ Cookie2: true,
+ "Content-Transfer-Encoding": true,
+ Date: true,
+ Expect: true,
+ Host: true,
+ "Keep-Alive": true,
+ Referer: true,
+ TE: true,
+ Trailer: true,
+ "Transfer-Encoding": true,
+ Upgrade: true,
+ "User-Agent": true,
+ Via: true
+ };
+ /*jsl:end*/
+
+ function FakeXMLHttpRequest() {
+ this.readyState = FakeXMLHttpRequest.UNSENT;
+ this.requestHeaders = {};
+ this.requestBody = null;
+ this.status = 0;
+ this.statusText = "";
+ this.upload = new UploadProgress();
+ if (sinonXhr.supportsCORS) {
+ this.withCredentials = false;
+ }
+
+ var xhr = this;
+ var events = ["loadstart", "load", "abort", "loadend"];
+
+ function addEventListener(eventName) {
+ xhr.addEventListener(eventName, function (event) {
+ var listener = xhr["on" + eventName];
+
+ if (listener && typeof listener == "function") {
+ listener.call(this, event);
+ }
+ });
+ }
+
+ for (var i = events.length - 1; i >= 0; i--) {
+ addEventListener(events[i]);
+ }
+
+ if (typeof FakeXMLHttpRequest.onCreate == "function") {
+ FakeXMLHttpRequest.onCreate(this);
+ }
+ }
+
+ // An upload object is created for each
+ // FakeXMLHttpRequest and allows upload
+ // events to be simulated using uploadProgress
+ // and uploadError.
+ function UploadProgress() {
+ this.eventListeners = {
+ progress: [],
+ load: [],
+ abort: [],
+ error: []
+ }
+ }
+
+ UploadProgress.prototype.addEventListener = function addEventListener(event, listener) {
+ this.eventListeners[event].push(listener);
+ };
+
+ UploadProgress.prototype.removeEventListener = function removeEventListener(event, listener) {
+ var listeners = this.eventListeners[event] || [];
+
+ for (var i = 0, l = listeners.length; i < l; ++i) {
+ if (listeners[i] == listener) {
+ return listeners.splice(i, 1);
+ }
+ }
+ };
+
+ UploadProgress.prototype.dispatchEvent = function dispatchEvent(event) {
+ var listeners = this.eventListeners[event.type] || [];
+
+ for (var i = 0, listener; (listener = listeners[i]) != null; i++) {
+ listener(event);
+ }
+ };
+
+ function verifyState(xhr) {
+ if (xhr.readyState !== FakeXMLHttpRequest.OPENED) {
+ throw new Error("INVALID_STATE_ERR");
+ }
+
+ if (xhr.sendFlag) {
+ throw new Error("INVALID_STATE_ERR");
+ }
+ }
+
+ function getHeader(headers, header) {
+ header = header.toLowerCase();
+
+ for (var h in headers) {
+ if (h.toLowerCase() == header) {
+ return h;
+ }
+ }
+
+ return null;
+ }
+
+ // filtering to enable a white-list version of Sinon FakeXhr,
+ // where whitelisted requests are passed through to real XHR
+ function each(collection, callback) {
+ if (!collection) {
+ return;
+ }
+
+ for (var i = 0, l = collection.length; i < l; i += 1) {
+ callback(collection[i]);
+ }
+ }
+ function some(collection, callback) {
+ for (var index = 0; index < collection.length; index++) {
+ if (callback(collection[index]) === true) {
+ return true;
+ }
+ }
+ return false;
+ }
+ // largest arity in XHR is 5 - XHR#open
+ var apply = function (obj, method, args) {
+ switch (args.length) {
+ case 0: return obj[method]();
+ case 1: return obj[method](args[0]);
+ case 2: return obj[method](args[0], args[1]);
+ case 3: return obj[method](args[0], args[1], args[2]);
+ case 4: return obj[method](args[0], args[1], args[2], args[3]);
+ case 5: return obj[method](args[0], args[1], args[2], args[3], args[4]);
+ }
+ };
+
+ FakeXMLHttpRequest.filters = [];
+ FakeXMLHttpRequest.addFilter = function addFilter(fn) {
+ this.filters.push(fn)
+ };
+ var IE6Re = /MSIE 6/;
+ FakeXMLHttpRequest.defake = function defake(fakeXhr, xhrArgs) {
+ var xhr = new sinonXhr.workingXHR();
+ each([
+ "open",
+ "setRequestHeader",
+ "send",
+ "abort",
+ "getResponseHeader",
+ "getAllResponseHeaders",
+ "addEventListener",
+ "overrideMimeType",
+ "removeEventListener"
+ ], function (method) {
+ fakeXhr[method] = function () {
+ return apply(xhr, method, arguments);
+ };
+ });
+
+ var copyAttrs = function (args) {
+ each(args, function (attr) {
+ try {
+ fakeXhr[attr] = xhr[attr]
+ } catch (e) {
+ if (!IE6Re.test(navigator.userAgent)) {
+ throw e;
+ }
+ }
+ });
+ };
+
+ var stateChange = function stateChange() {
+ fakeXhr.readyState = xhr.readyState;
+ if (xhr.readyState >= FakeXMLHttpRequest.HEADERS_RECEIVED) {
+ copyAttrs(["status", "statusText"]);
+ }
+ if (xhr.readyState >= FakeXMLHttpRequest.LOADING) {
+ copyAttrs(["responseText", "response"]);
+ }
+ if (xhr.readyState === FakeXMLHttpRequest.DONE) {
+ copyAttrs(["responseXML"]);
+ }
+ if (fakeXhr.onreadystatechange) {
+ fakeXhr.onreadystatechange.call(fakeXhr, { target: fakeXhr });
+ }
+ };
+
+ if (xhr.addEventListener) {
+ for (var event in fakeXhr.eventListeners) {
+ if (fakeXhr.eventListeners.hasOwnProperty(event)) {
+ each(fakeXhr.eventListeners[event], function (handler) {
+ xhr.addEventListener(event, handler);
+ });
+ }
+ }
+ xhr.addEventListener("readystatechange", stateChange);
+ } else {
+ xhr.onreadystatechange = stateChange;
+ }
+ apply(xhr, "open", xhrArgs);
+ };
+ FakeXMLHttpRequest.useFilters = false;
+
+ function verifyRequestOpened(xhr) {
+ if (xhr.readyState != FakeXMLHttpRequest.OPENED) {
+ throw new Error("INVALID_STATE_ERR - " + xhr.readyState);
+ }
+ }
+
+ function verifyRequestSent(xhr) {
+ if (xhr.readyState == FakeXMLHttpRequest.DONE) {
+ throw new Error("Request done");
+ }
+ }
+
+ function verifyHeadersReceived(xhr) {
+ if (xhr.async && xhr.readyState != FakeXMLHttpRequest.HEADERS_RECEIVED) {
+ throw new Error("No headers received");
+ }
+ }
+
+ function verifyResponseBodyType(body) {
+ if (typeof body != "string") {
+ var error = new Error("Attempted to respond to fake XMLHttpRequest with " +
+ body + ", which is not a string.");
+ error.name = "InvalidBodyException";
+ throw error;
+ }
+ }
+
+ FakeXMLHttpRequest.parseXML = function parseXML(text) {
+ var xmlDoc;
+
+ if (typeof DOMParser != "undefined") {
+ var parser = new DOMParser();
+ xmlDoc = parser.parseFromString(text, "text/xml");
+ } else {
+ xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
+ xmlDoc.async = "false";
+ xmlDoc.loadXML(text);
+ }
+
+ return xmlDoc;
+ };
+
+ FakeXMLHttpRequest.statusCodes = {
+ 100: "Continue",
+ 101: "Switching Protocols",
+ 200: "OK",
+ 201: "Created",
+ 202: "Accepted",
+ 203: "Non-Authoritative Information",
+ 204: "No Content",
+ 205: "Reset Content",
+ 206: "Partial Content",
+ 207: "Multi-Status",
+ 300: "Multiple Choice",
+ 301: "Moved Permanently",
+ 302: "Found",
+ 303: "See Other",
+ 304: "Not Modified",
+ 305: "Use Proxy",
+ 307: "Temporary Redirect",
+ 400: "Bad Request",
+ 401: "Unauthorized",
+ 402: "Payment Required",
+ 403: "Forbidden",
+ 404: "Not Found",
+ 405: "Method Not Allowed",
+ 406: "Not Acceptable",
+ 407: "Proxy Authentication Required",
+ 408: "Request Timeout",
+ 409: "Conflict",
+ 410: "Gone",
+ 411: "Length Required",
+ 412: "Precondition Failed",
+ 413: "Request Entity Too Large",
+ 414: "Request-URI Too Long",
+ 415: "Unsupported Media Type",
+ 416: "Requested Range Not Satisfiable",
+ 417: "Expectation Failed",
+ 422: "Unprocessable Entity",
+ 500: "Internal Server Error",
+ 501: "Not Implemented",
+ 502: "Bad Gateway",
+ 503: "Service Unavailable",
+ 504: "Gateway Timeout",
+ 505: "HTTP Version Not Supported"
+ };
+
+ function makeApi(sinon) {
+ sinon.xhr = sinonXhr;
+
+ sinon.extend(FakeXMLHttpRequest.prototype, sinon.EventTarget, {
+ async: true,
+
+ open: function open(method, url, async, username, password) {
+ this.method = method;
+ this.url = url;
+ this.async = typeof async == "boolean" ? async : true;
+ this.username = username;
+ this.password = password;
+ this.responseText = null;
+ this.responseXML = null;
+ this.requestHeaders = {};
+ this.sendFlag = false;
+
+ if (FakeXMLHttpRequest.useFilters === true) {
+ var xhrArgs = arguments;
+ var defake = some(FakeXMLHttpRequest.filters, function (filter) {
+ return filter.apply(this, xhrArgs)
+ });
+ if (defake) {
+ return FakeXMLHttpRequest.defake(this, arguments);
+ }
+ }
+ this.readyStateChange(FakeXMLHttpRequest.OPENED);
+ },
+
+ readyStateChange: function readyStateChange(state) {
+ this.readyState = state;
+
+ if (typeof this.onreadystatechange == "function") {
+ try {
+ this.onreadystatechange();
+ } catch (e) {
+ sinon.logError("Fake XHR onreadystatechange handler", e);
+ }
+ }
+
+ this.dispatchEvent(new sinon.Event("readystatechange"));
+
+ switch (this.readyState) {
+ case FakeXMLHttpRequest.DONE:
+ this.dispatchEvent(new sinon.Event("load", false, false, this));
+ this.dispatchEvent(new sinon.Event("loadend", false, false, this));
+ this.upload.dispatchEvent(new sinon.Event("load", false, false, this));
+ if (supportsProgress) {
+ this.upload.dispatchEvent(new sinon.ProgressEvent("progress", {loaded: 100, total: 100}));
+ this.dispatchEvent(new sinon.ProgressEvent("progress", {loaded: 100, total: 100}));
+ }
+ break;
+ }
+ },
+
+ setRequestHeader: function setRequestHeader(header, value) {
+ verifyState(this);
+
+ if (unsafeHeaders[header] || /^(Sec-|Proxy-)/.test(header)) {
+ throw new Error("Refused to set unsafe header \"" + header + "\"");
+ }
+
+ if (this.requestHeaders[header]) {
+ this.requestHeaders[header] += "," + value;
+ } else {
+ this.requestHeaders[header] = value;
+ }
+ },
+
+ // Helps testing
+ setResponseHeaders: function setResponseHeaders(headers) {
+ verifyRequestOpened(this);
+ this.responseHeaders = {};
+
+ for (var header in headers) {
+ if (headers.hasOwnProperty(header)) {
+ this.responseHeaders[header] = headers[header];
+ }
+ }
+
+ if (this.async) {
+ this.readyStateChange(FakeXMLHttpRequest.HEADERS_RECEIVED);
+ } else {
+ this.readyState = FakeXMLHttpRequest.HEADERS_RECEIVED;
+ }
+ },
+
+ // Currently treats ALL data as a DOMString (i.e. no Document)
+ send: function send(data) {
+ verifyState(this);
+
+ if (!/^(get|head)$/i.test(this.method)) {
+ var contentType = getHeader(this.requestHeaders, "Content-Type");
+ if (this.requestHeaders[contentType]) {
+ var value = this.requestHeaders[contentType].split(";");
+ this.requestHeaders[contentType] = value[0] + ";charset=utf-8";
+ } else if (!(data instanceof FormData)) {
+ this.requestHeaders["Content-Type"] = "text/plain;charset=utf-8";
+ }
+
+ this.requestBody = data;
+ }
+
+ this.errorFlag = false;
+ this.sendFlag = this.async;
+ this.readyStateChange(FakeXMLHttpRequest.OPENED);
+
+ if (typeof this.onSend == "function") {
+ this.onSend(this);
+ }
+
+ this.dispatchEvent(new sinon.Event("loadstart", false, false, this));
+ },
+
+ abort: function abort() {
+ this.aborted = true;
+ this.responseText = null;
+ this.errorFlag = true;
+ this.requestHeaders = {};
+
+ if (this.readyState > FakeXMLHttpRequest.UNSENT && this.sendFlag) {
+ this.readyStateChange(FakeXMLHttpRequest.DONE);
+ this.sendFlag = false;
+ }
+
+ this.readyState = FakeXMLHttpRequest.UNSENT;
+
+ this.dispatchEvent(new sinon.Event("abort", false, false, this));
+
+ this.upload.dispatchEvent(new sinon.Event("abort", false, false, this));
+
+ if (typeof this.onerror === "function") {
+ this.onerror();
+ }
+ },
+
+ getResponseHeader: function getResponseHeader(header) {
+ if (this.readyState < FakeXMLHttpRequest.HEADERS_RECEIVED) {
+ return null;
+ }
+
+ if (/^Set-Cookie2?$/i.test(header)) {
+ return null;
+ }
+
+ header = getHeader(this.responseHeaders, header);
+
+ return this.responseHeaders[header] || null;
+ },
+
+ getAllResponseHeaders: function getAllResponseHeaders() {
+ if (this.readyState < FakeXMLHttpRequest.HEADERS_RECEIVED) {
+ return "";
+ }
+
+ var headers = "";
+
+ for (var header in this.responseHeaders) {
+ if (this.responseHeaders.hasOwnProperty(header) &&
+ !/^Set-Cookie2?$/i.test(header)) {
+ headers += header + ": " + this.responseHeaders[header] + "\r\n";
+ }
+ }
+
+ return headers;
+ },
+
+ setResponseBody: function setResponseBody(body) {
+ verifyRequestSent(this);
+ verifyHeadersReceived(this);
+ verifyResponseBodyType(body);
+
+ var chunkSize = this.chunkSize || 10;
+ var index = 0;
+ this.responseText = "";
+
+ do {
+ if (this.async) {
+ this.readyStateChange(FakeXMLHttpRequest.LOADING);
+ }
+
+ this.responseText += body.substring(index, index + chunkSize);
+ index += chunkSize;
+ } while (index < body.length);
+
+ var type = this.getResponseHeader("Content-Type");
+
+ if (this.responseText &&
+ (!type || /(text\/xml)|(application\/xml)|(\+xml)/.test(type))) {
+ try {
+ this.responseXML = FakeXMLHttpRequest.parseXML(this.responseText);
+ } catch (e) {
+ // Unable to parse XML - no biggie
+ }
+ }
+
+ this.readyStateChange(FakeXMLHttpRequest.DONE);
+ },
+
+ respond: function respond(status, headers, body) {
+ this.status = typeof status == "number" ? status : 200;
+ this.statusText = FakeXMLHttpRequest.statusCodes[this.status];
+ this.setResponseHeaders(headers || {});
+ this.setResponseBody(body || "");
+ },
+
+ uploadProgress: function uploadProgress(progressEventRaw) {
+ if (supportsProgress) {
+ this.upload.dispatchEvent(new sinon.ProgressEvent("progress", progressEventRaw));
+ }
+ },
+
+ downloadProgress: function downloadProgress(progressEventRaw) {
+ if (supportsProgress) {
+ this.dispatchEvent(new sinon.ProgressEvent("progress", progressEventRaw));
+ }
+ },
+
+ uploadError: function uploadError(error) {
+ if (supportsCustomEvent) {
+ this.upload.dispatchEvent(new sinon.CustomEvent("error", {detail: error}));
+ }
+ }
+ });
+
+ sinon.extend(FakeXMLHttpRequest, {
+ UNSENT: 0,
+ OPENED: 1,
+ HEADERS_RECEIVED: 2,
+ LOADING: 3,
+ DONE: 4
+ });
+
+ sinon.useFakeXMLHttpRequest = function () {
+ FakeXMLHttpRequest.restore = function restore(keepOnCreate) {
+ if (sinonXhr.supportsXHR) {
+ global.XMLHttpRequest = sinonXhr.GlobalXMLHttpRequest;
+ }
+
+ if (sinonXhr.supportsActiveX) {
+ global.ActiveXObject = sinonXhr.GlobalActiveXObject;
+ }
+
+ delete FakeXMLHttpRequest.restore;
+
+ if (keepOnCreate !== true) {
+ delete FakeXMLHttpRequest.onCreate;
+ }
+ };
+ if (sinonXhr.supportsXHR) {
+ global.XMLHttpRequest = FakeXMLHttpRequest;
+ }
+
+ if (sinonXhr.supportsActiveX) {
+ global.ActiveXObject = function ActiveXObject(objId) {
+ if (objId == "Microsoft.XMLHTTP" || /^Msxml2\.XMLHTTP/i.test(objId)) {
+
+ return new FakeXMLHttpRequest();
+ }
+
+ return new sinonXhr.GlobalActiveXObject(objId);
+ };
+ }
+
+ return FakeXMLHttpRequest;
+ };
+
+ sinon.FakeXMLHttpRequest = FakeXMLHttpRequest;
+ }
+
+ var isNode = typeof module !== "undefined" && module.exports && typeof require == "function";
+ var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd;
+
+ function loadDependencies(require, exports, module) {
+ var sinon = require("./core");
+ require("../extend");
+ require("./event");
+ require("../log_error");
+ makeApi(sinon);
+ module.exports = sinon;
+ }
+
+ if (isAMD) {
+ define(loadDependencies);
+ } else if (isNode) {
+ loadDependencies(require, module.exports, module);
+ } else if (typeof sinon === "undefined") {
+ return;
+ } else {
+ makeApi(sinon);
+ }
+
+})(typeof global !== "undefined" ? global : this);
+
+}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
+},{"../extend":29,"../log_error":31,"./core":41,"./event":42}],48:[function(require,module,exports){
+(function (global){
+((typeof define === "function" && define.amd && function (m) {
+ define("formatio", ["samsam"], m);
+}) || (typeof module === "object" && function (m) {
+ module.exports = m(require("samsam"));
+}) || function (m) { this.formatio = m(this.samsam); }
+)(function (samsam) {
+ "use strict";
+
+ var formatio = {
+ excludeConstructors: ["Object", /^.$/],
+ quoteStrings: true,
+ limitChildrenCount: 0
+ };
+
+ var hasOwn = Object.prototype.hasOwnProperty;
+
+ var specialObjects = [];
+ if (typeof global !== "undefined") {
+ specialObjects.push({ object: global, value: "[object global]" });
+ }
+ if (typeof document !== "undefined") {
+ specialObjects.push({
+ object: document,
+ value: "[object HTMLDocument]"
+ });
+ }
+ if (typeof window !== "undefined") {
+ specialObjects.push({ object: window, value: "[object Window]" });
+ }
+
+ function functionName(func) {
+ if (!func) { return ""; }
+ if (func.displayName) { return func.displayName; }
+ if (func.name) { return func.name; }
+ var matches = func.toString().match(/function\s+([^\(]+)/m);
+ return (matches && matches[1]) || "";
+ }
+
+ function constructorName(f, object) {
+ var name = functionName(object && object.constructor);
+ var excludes = f.excludeConstructors ||
+ formatio.excludeConstructors || [];
+
+ var i, l;
+ for (i = 0, l = excludes.length; i < l; ++i) {
+ if (typeof excludes[i] === "string" && excludes[i] === name) {
+ return "";
+ } else if (excludes[i].test && excludes[i].test(name)) {
+ return "";
+ }
+ }
+
+ return name;
+ }
+
+ function isCircular(object, objects) {
+ if (typeof object !== "object") { return false; }
+ var i, l;
+ for (i = 0, l = objects.length; i < l; ++i) {
+ if (objects[i] === object) { return true; }
+ }
+ return false;
+ }
+
+ function ascii(f, object, processed, indent) {
+ if (typeof object === "string") {
+ var qs = f.quoteStrings;
+ var quote = typeof qs !== "boolean" || qs;
+ return processed || quote ? '"' + object + '"' : object;
+ }
+
+ if (typeof object === "function" && !(object instanceof RegExp)) {
+ return ascii.func(object);
+ }
+
+ processed = processed || [];
+
+ if (isCircular(object, processed)) { return "[Circular]"; }
+
+ if (Object.prototype.toString.call(object) === "[object Array]") {
+ return ascii.array.call(f, object, processed);
+ }
+
+ if (!object) { return String((1/object) === -Infinity ? "-0" : object); }
+ if (samsam.isElement(object)) { return ascii.element(object); }
+
+ if (typeof object.toString === "function" &&
+ object.toString !== Object.prototype.toString) {
+ return object.toString();
+ }
+
+ var i, l;
+ for (i = 0, l = specialObjects.length; i < l; i++) {
+ if (object === specialObjects[i].object) {
+ return specialObjects[i].value;
+ }
+ }
+
+ return ascii.object.call(f, object, processed, indent);
+ }
+
+ ascii.func = function (func) {
+ return "function " + functionName(func) + "() {}";
+ };
+
+ ascii.array = function (array, processed) {
+ processed = processed || [];
+ processed.push(array);
+ var pieces = [];
+ var i, l;
+ l = (this.limitChildrenCount > 0) ?
+ Math.min(this.limitChildrenCount, array.length) : array.length;
+
+ for (i = 0; i < l; ++i) {
+ pieces.push(ascii(this, array[i], processed));
+ }
+
+ if(l < array.length)
+ pieces.push("[... " + (array.length - l) + " more elements]");
+
+ return "[" + pieces.join(", ") + "]";
+ };
+
+ ascii.object = function (object, processed, indent) {
+ processed = processed || [];
+ processed.push(object);
+ indent = indent || 0;
+ var pieces = [], properties = samsam.keys(object).sort();
+ var length = 3;
+ var prop, str, obj, i, k, l;
+ l = (this.limitChildrenCount > 0) ?
+ Math.min(this.limitChildrenCount, properties.length) : properties.length;
+
+ for (i = 0; i < l; ++i) {
+ prop = properties[i];
+ obj = object[prop];
+
+ if (isCircular(obj, processed)) {
+ str = "[Circular]";
+ } else {
+ str = ascii(this, obj, processed, indent + 2);
+ }
+
+ str = (/\s/.test(prop) ? '"' + prop + '"' : prop) + ": " + str;
+ length += str.length;
+ pieces.push(str);
+ }
+
+ var cons = constructorName(this, object);
+ var prefix = cons ? "[" + cons + "] " : "";
+ var is = "";
+ for (i = 0, k = indent; i < k; ++i) { is += " "; }
+
+ if(l < properties.length)
+ pieces.push("[... " + (properties.length - l) + " more elements]");
+
+ if (length + indent > 80) {
+ return prefix + "{\n " + is + pieces.join(",\n " + is) + "\n" +
+ is + "}";
+ }
+ return prefix + "{ " + pieces.join(", ") + " }";
+ };
+
+ ascii.element = function (element) {
+ var tagName = element.tagName.toLowerCase();
+ var attrs = element.attributes, attr, pairs = [], attrName, i, l, val;
+
+ for (i = 0, l = attrs.length; i < l; ++i) {
+ attr = attrs.item(i);
+ attrName = attr.nodeName.toLowerCase().replace("html:", "");
+ val = attr.nodeValue;
+ if (attrName !== "contenteditable" || val !== "inherit") {
+ if (!!val) { pairs.push(attrName + "=\"" + val + "\""); }
+ }
+ }
+
+ var formatted = "<" + tagName + (pairs.length > 0 ? " " : "");
+ var content = element.innerHTML;
+
+ if (content.length > 20) {
+ content = content.substr(0, 20) + "[...]";
+ }
+
+ var res = formatted + pairs.join(" ") + ">" + content +
+ "" + tagName + ">";
+
+ return res.replace(/ contentEditable="inherit"/, "");
+ };
+
+ function Formatio(options) {
+ for (var opt in options) {
+ this[opt] = options[opt];
+ }
+ }
+
+ Formatio.prototype = {
+ functionName: functionName,
+
+ configure: function (options) {
+ return new Formatio(options);
+ },
+
+ constructorName: function (object) {
+ return constructorName(this, object);
+ },
+
+ ascii: function (object, processed, indent) {
+ return ascii(this, object, processed, indent);
+ }
+ };
+
+ return Formatio.prototype;
+});
+
+}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
+},{"samsam":49}],49:[function(require,module,exports){
+((typeof define === "function" && define.amd && function (m) { define("samsam", m); }) ||
+ (typeof module === "object" &&
+ function (m) { module.exports = m(); }) || // Node
+ function (m) { this.samsam = m(); } // Browser globals
+)(function () {
+ var o = Object.prototype;
+ var div = typeof document !== "undefined" && document.createElement("div");
+
+ function isNaN(value) {
+ // Unlike global isNaN, this avoids type coercion
+ // typeof check avoids IE host object issues, hat tip to
+ // lodash
+ var val = value; // JsLint thinks value !== value is "weird"
+ return typeof value === "number" && value !== val;
+ }
+
+ function getClass(value) {
+ // Returns the internal [[Class]] by calling Object.prototype.toString
+ // with the provided value as this. Return value is a string, naming the
+ // internal class, e.g. "Array"
+ return o.toString.call(value).split(/[ \]]/)[1];
+ }
+
+ /**
+ * @name samsam.isArguments
+ * @param Object object
+ *
+ * Returns ``true`` if ``object`` is an ``arguments`` object,
+ * ``false`` otherwise.
+ */
+ function isArguments(object) {
+ if (getClass(object) === 'Arguments') { return true; }
+ if (typeof object !== "object" || typeof object.length !== "number" ||
+ getClass(object) === "Array") {
+ return false;
+ }
+ if (typeof object.callee == "function") { return true; }
+ try {
+ object[object.length] = 6;
+ delete object[object.length];
+ } catch (e) {
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * @name samsam.isElement
+ * @param Object object
+ *
+ * Returns ``true`` if ``object`` is a DOM element node. Unlike
+ * Underscore.js/lodash, this function will return ``false`` if ``object``
+ * is an *element-like* object, i.e. a regular object with a ``nodeType``
+ * property that holds the value ``1``.
+ */
+ function isElement(object) {
+ if (!object || object.nodeType !== 1 || !div) { return false; }
+ try {
+ object.appendChild(div);
+ object.removeChild(div);
+ } catch (e) {
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ * @name samsam.keys
+ * @param Object object
+ *
+ * Return an array of own property names.
+ */
+ function keys(object) {
+ var ks = [], prop;
+ for (prop in object) {
+ if (o.hasOwnProperty.call(object, prop)) { ks.push(prop); }
+ }
+ return ks;
+ }
+
+ /**
+ * @name samsam.isDate
+ * @param Object value
+ *
+ * Returns true if the object is a ``Date``, or *date-like*. Duck typing
+ * of date objects work by checking that the object has a ``getTime``
+ * function whose return value equals the return value from the object's
+ * ``valueOf``.
+ */
+ function isDate(value) {
+ return typeof value.getTime == "function" &&
+ value.getTime() == value.valueOf();
+ }
+
+ /**
+ * @name samsam.isNegZero
+ * @param Object value
+ *
+ * Returns ``true`` if ``value`` is ``-0``.
+ */
+ function isNegZero(value) {
+ return value === 0 && 1 / value === -Infinity;
+ }
+
+ /**
+ * @name samsam.equal
+ * @param Object obj1
+ * @param Object obj2
+ *
+ * Returns ``true`` if two objects are strictly equal. Compared to
+ * ``===`` there are two exceptions:
+ *
+ * - NaN is considered equal to NaN
+ * - -0 and +0 are not considered equal
+ */
+ function identical(obj1, obj2) {
+ if (obj1 === obj2 || (isNaN(obj1) && isNaN(obj2))) {
+ return obj1 !== 0 || isNegZero(obj1) === isNegZero(obj2);
+ }
+ }
+
+
+ /**
+ * @name samsam.deepEqual
+ * @param Object obj1
+ * @param Object obj2
+ *
+ * Deep equal comparison. Two values are "deep equal" if:
+ *
+ * - They are equal, according to samsam.identical
+ * - They are both date objects representing the same time
+ * - They are both arrays containing elements that are all deepEqual
+ * - They are objects with the same set of properties, and each property
+ * in ``obj1`` is deepEqual to the corresponding property in ``obj2``
+ *
+ * Supports cyclic objects.
+ */
+ function deepEqualCyclic(obj1, obj2) {
+
+ // used for cyclic comparison
+ // contain already visited objects
+ var objects1 = [],
+ objects2 = [],
+ // contain pathes (position in the object structure)
+ // of the already visited objects
+ // indexes same as in objects arrays
+ paths1 = [],
+ paths2 = [],
+ // contains combinations of already compared objects
+ // in the manner: { "$1['ref']$2['ref']": true }
+ compared = {};
+
+ /**
+ * used to check, if the value of a property is an object
+ * (cyclic logic is only needed for objects)
+ * only needed for cyclic logic
+ */
+ function isObject(value) {
+
+ if (typeof value === 'object' && value !== null &&
+ !(value instanceof Boolean) &&
+ !(value instanceof Date) &&
+ !(value instanceof Number) &&
+ !(value instanceof RegExp) &&
+ !(value instanceof String)) {
+
+ return true;
+ }
+
+ return false;
+ }
+
+ /**
+ * returns the index of the given object in the
+ * given objects array, -1 if not contained
+ * only needed for cyclic logic
+ */
+ function getIndex(objects, obj) {
+
+ var i;
+ for (i = 0; i < objects.length; i++) {
+ if (objects[i] === obj) {
+ return i;
+ }
+ }
+
+ return -1;
+ }
+
+ // does the recursion for the deep equal check
+ return (function deepEqual(obj1, obj2, path1, path2) {
+ var type1 = typeof obj1;
+ var type2 = typeof obj2;
+
+ // == null also matches undefined
+ if (obj1 === obj2 ||
+ isNaN(obj1) || isNaN(obj2) ||
+ obj1 == null || obj2 == null ||
+ type1 !== "object" || type2 !== "object") {
+
+ return identical(obj1, obj2);
+ }
+
+ // Elements are only equal if identical(expected, actual)
+ if (isElement(obj1) || isElement(obj2)) { return false; }
+
+ var isDate1 = isDate(obj1), isDate2 = isDate(obj2);
+ if (isDate1 || isDate2) {
+ if (!isDate1 || !isDate2 || obj1.getTime() !== obj2.getTime()) {
+ return false;
+ }
+ }
+
+ if (obj1 instanceof RegExp && obj2 instanceof RegExp) {
+ if (obj1.toString() !== obj2.toString()) { return false; }
+ }
+
+ var class1 = getClass(obj1);
+ var class2 = getClass(obj2);
+ var keys1 = keys(obj1);
+ var keys2 = keys(obj2);
+
+ if (isArguments(obj1) || isArguments(obj2)) {
+ if (obj1.length !== obj2.length) { return false; }
+ } else {
+ if (type1 !== type2 || class1 !== class2 ||
+ keys1.length !== keys2.length) {
+ return false;
+ }
+ }
+
+ var key, i, l,
+ // following vars are used for the cyclic logic
+ value1, value2,
+ isObject1, isObject2,
+ index1, index2,
+ newPath1, newPath2;
+
+ for (i = 0, l = keys1.length; i < l; i++) {
+ key = keys1[i];
+ if (!o.hasOwnProperty.call(obj2, key)) {
+ return false;
+ }
+
+ // Start of the cyclic logic
+
+ value1 = obj1[key];
+ value2 = obj2[key];
+
+ isObject1 = isObject(value1);
+ isObject2 = isObject(value2);
+
+ // determine, if the objects were already visited
+ // (it's faster to check for isObject first, than to
+ // get -1 from getIndex for non objects)
+ index1 = isObject1 ? getIndex(objects1, value1) : -1;
+ index2 = isObject2 ? getIndex(objects2, value2) : -1;
+
+ // determine the new pathes of the objects
+ // - for non cyclic objects the current path will be extended
+ // by current property name
+ // - for cyclic objects the stored path is taken
+ newPath1 = index1 !== -1
+ ? paths1[index1]
+ : path1 + '[' + JSON.stringify(key) + ']';
+ newPath2 = index2 !== -1
+ ? paths2[index2]
+ : path2 + '[' + JSON.stringify(key) + ']';
+
+ // stop recursion if current objects are already compared
+ if (compared[newPath1 + newPath2]) {
+ return true;
+ }
+
+ // remember the current objects and their pathes
+ if (index1 === -1 && isObject1) {
+ objects1.push(value1);
+ paths1.push(newPath1);
+ }
+ if (index2 === -1 && isObject2) {
+ objects2.push(value2);
+ paths2.push(newPath2);
+ }
+
+ // remember that the current objects are already compared
+ if (isObject1 && isObject2) {
+ compared[newPath1 + newPath2] = true;
+ }
+
+ // End of cyclic logic
+
+ // neither value1 nor value2 is a cycle
+ // continue with next level
+ if (!deepEqual(value1, value2, newPath1, newPath2)) {
+ return false;
+ }
+ }
+
+ return true;
+
+ }(obj1, obj2, '$1', '$2'));
+ }
+
+ var match;
+
+ function arrayContains(array, subset) {
+ if (subset.length === 0) { return true; }
+ var i, l, j, k;
+ for (i = 0, l = array.length; i < l; ++i) {
+ if (match(array[i], subset[0])) {
+ for (j = 0, k = subset.length; j < k; ++j) {
+ if (!match(array[i + j], subset[j])) { return false; }
+ }
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * @name samsam.match
+ * @param Object object
+ * @param Object matcher
+ *
+ * Compare arbitrary value ``object`` with matcher.
+ */
+ match = function match(object, matcher) {
+ if (matcher && typeof matcher.test === "function") {
+ return matcher.test(object);
+ }
+
+ if (typeof matcher === "function") {
+ return matcher(object) === true;
+ }
+
+ if (typeof matcher === "string") {
+ matcher = matcher.toLowerCase();
+ var notNull = typeof object === "string" || !!object;
+ return notNull &&
+ (String(object)).toLowerCase().indexOf(matcher) >= 0;
+ }
+
+ if (typeof matcher === "number") {
+ return matcher === object;
+ }
+
+ if (typeof matcher === "boolean") {
+ return matcher === object;
+ }
+
+ if (typeof(matcher) === "undefined") {
+ return typeof(object) === "undefined";
+ }
+
+ if (matcher === null) {
+ return object === null;
+ }
+
+ if (getClass(object) === "Array" && getClass(matcher) === "Array") {
+ return arrayContains(object, matcher);
+ }
+
+ if (matcher && typeof matcher === "object") {
+ if (matcher === object) {
+ return true;
+ }
+ var prop;
+ for (prop in matcher) {
+ var value = object[prop];
+ if (typeof value === "undefined" &&
+ typeof object.getAttribute === "function") {
+ value = object.getAttribute(prop);
+ }
+ if (matcher[prop] === null || typeof matcher[prop] === 'undefined') {
+ if (value !== matcher[prop]) {
+ return false;
+ }
+ } else if (typeof value === "undefined" || !match(value, matcher[prop])) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ throw new Error("Matcher was not a string, a number, a " +
+ "function, a boolean or an object");
+ };
+
+ return {
+ isArguments: isArguments,
+ isElement: isElement,
+ isDate: isDate,
+ isNegZero: isNegZero,
+ identical: identical,
+ deepEqual: deepEqualCyclic,
+ match: match,
+ keys: keys
+ };
+});
+
+},{}],50:[function(require,module,exports){
+(function (global){
+/*jslint eqeqeq: false, plusplus: false, evil: true, onevar: false, browser: true, forin: false*/
+/*global global*/
+/**
+ * @author Christian Johansen (christian@cjohansen.no) and contributors
+ * @license BSD
+ *
+ * Copyright (c) 2010-2014 Christian Johansen
+ */
+"use strict";
+
+// node expects setTimeout/setInterval to return a fn object w/ .ref()/.unref()
+// browsers, a number.
+// see https://github.com/cjohansen/Sinon.JS/pull/436
+var timeoutResult = setTimeout(function() {}, 0);
+var addTimerReturnsObject = typeof timeoutResult === "object";
+clearTimeout(timeoutResult);
+
+var NativeDate = Date;
+var id = 1;
+
+/**
+ * Parse strings like "01:10:00" (meaning 1 hour, 10 minutes, 0 seconds) into
+ * number of milliseconds. This is used to support human-readable strings passed
+ * to clock.tick()
+ */
+function parseTime(str) {
+ if (!str) {
+ return 0;
+ }
+
+ var strings = str.split(":");
+ var l = strings.length, i = l;
+ var ms = 0, parsed;
+
+ if (l > 3 || !/^(\d\d:){0,2}\d\d?$/.test(str)) {
+ throw new Error("tick only understands numbers and 'h:m:s'");
+ }
+
+ while (i--) {
+ parsed = parseInt(strings[i], 10);
+
+ if (parsed >= 60) {
+ throw new Error("Invalid time " + str);
+ }
+
+ ms += parsed * Math.pow(60, (l - i - 1));
+ }
+
+ return ms * 1000;
+}
+
+/**
+ * Used to grok the `now` parameter to createClock.
+ */
+function getEpoch(epoch) {
+ if (!epoch) { return 0; }
+ if (typeof epoch.getTime === "function") { return epoch.getTime(); }
+ if (typeof epoch === "number") { return epoch; }
+ throw new TypeError("now should be milliseconds since UNIX epoch");
+}
+
+function inRange(from, to, timer) {
+ return timer && timer.callAt >= from && timer.callAt <= to;
+}
+
+function mirrorDateProperties(target, source) {
+ if (source.now) {
+ target.now = function now() {
+ return target.clock.now;
+ };
+ } else {
+ delete target.now;
+ }
+
+ if (source.toSource) {
+ target.toSource = function toSource() {
+ return source.toSource();
+ };
+ } else {
+ delete target.toSource;
+ }
+
+ target.toString = function toString() {
+ return source.toString();
+ };
+
+ target.prototype = source.prototype;
+ target.parse = source.parse;
+ target.UTC = source.UTC;
+ target.prototype.toUTCString = source.prototype.toUTCString;
+
+ for (var prop in source) {
+ if (source.hasOwnProperty(prop)) {
+ target[prop] = source[prop];
+ }
+ }
+
+ return target;
+}
+
+function createDate() {
+ function ClockDate(year, month, date, hour, minute, second, ms) {
+ // Defensive and verbose to avoid potential harm in passing
+ // explicit undefined when user does not pass argument
+ switch (arguments.length) {
+ case 0:
+ return new NativeDate(ClockDate.clock.now);
+ case 1:
+ return new NativeDate(year);
+ case 2:
+ return new NativeDate(year, month);
+ case 3:
+ return new NativeDate(year, month, date);
+ case 4:
+ return new NativeDate(year, month, date, hour);
+ case 5:
+ return new NativeDate(year, month, date, hour, minute);
+ case 6:
+ return new NativeDate(year, month, date, hour, minute, second);
+ default:
+ return new NativeDate(year, month, date, hour, minute, second, ms);
+ }
+ }
+
+ return mirrorDateProperties(ClockDate, NativeDate);
+}
+
+function addTimer(clock, timer) {
+ if (typeof timer.func === "undefined") {
+ throw new Error("Callback must be provided to timer calls");
+ }
+
+ if (!clock.timers) {
+ clock.timers = {};
+ }
+
+ timer.id = id++;
+ timer.createdAt = clock.now;
+ timer.callAt = clock.now + (timer.delay || 0);
+
+ clock.timers[timer.id] = timer;
+
+ if (addTimerReturnsObject) {
+ return {
+ id: timer.id,
+ ref: function() {},
+ unref: function() {}
+ };
+ }
+ else {
+ return timer.id;
+ }
+}
+
+function firstTimerInRange(clock, from, to) {
+ var timers = clock.timers, timer = null;
+
+ for (var id in timers) {
+ if (!inRange(from, to, timers[id])) {
+ continue;
+ }
+
+ if (!timer || ~compareTimers(timer, timers[id])) {
+ timer = timers[id];
+ }
+ }
+
+ return timer;
+}
+
+function compareTimers(a, b) {
+ // Sort first by absolute timing
+ if (a.callAt < b.callAt) {
+ return -1;
+ }
+ if (a.callAt > b.callAt) {
+ return 1;
+ }
+
+ // Sort next by immediate, immediate timers take precedence
+ if (a.immediate && !b.immediate) {
+ return -1;
+ }
+ if (!a.immediate && b.immediate) {
+ return 1;
+ }
+
+ // Sort next by creation time, earlier-created timers take precedence
+ if (a.createdAt < b.createdAt) {
+ return -1;
+ }
+ if (a.createdAt > b.createdAt) {
+ return 1;
+ }
+
+ // Sort next by id, lower-id timers take precedence
+ if (a.id < b.id) {
+ return -1;
+ }
+ if (a.id > b.id) {
+ return 1;
+ }
+
+ // As timer ids are unique, no fallback `0` is necessary
+}
+
+function callTimer(clock, timer) {
+ if (typeof timer.interval == "number") {
+ clock.timers[timer.id].callAt += timer.interval;
+ } else {
+ delete clock.timers[timer.id];
+ }
+
+ try {
+ if (typeof timer.func == "function") {
+ timer.func.apply(null, timer.args);
+ } else {
+ eval(timer.func);
+ }
+ } catch (e) {
+ var exception = e;
+ }
+
+ if (!clock.timers[timer.id]) {
+ if (exception) {
+ throw exception;
+ }
+ return;
+ }
+
+ if (exception) {
+ throw exception;
+ }
+}
+
+function uninstall(clock, target) {
+ var method;
+
+ for (var i = 0, l = clock.methods.length; i < l; i++) {
+ method = clock.methods[i];
+
+ if (target[method].hadOwnProperty) {
+ target[method] = clock["_" + method];
+ } else {
+ try {
+ delete target[method];
+ } catch (e) {}
+ }
+ }
+
+ // Prevent multiple executions which will completely remove these props
+ clock.methods = [];
+}
+
+function hijackMethod(target, method, clock) {
+ clock[method].hadOwnProperty = Object.prototype.hasOwnProperty.call(target, method);
+ clock["_" + method] = target[method];
+
+ if (method == "Date") {
+ var date = mirrorDateProperties(clock[method], target[method]);
+ target[method] = date;
+ } else {
+ target[method] = function () {
+ return clock[method].apply(clock, arguments);
+ };
+
+ for (var prop in clock[method]) {
+ if (clock[method].hasOwnProperty(prop)) {
+ target[method][prop] = clock[method][prop];
+ }
+ }
+ }
+
+ target[method].clock = clock;
+}
+
+var timers = {
+ setTimeout: setTimeout,
+ clearTimeout: clearTimeout,
+ setImmediate: (typeof setImmediate !== "undefined" ? setImmediate : undefined),
+ clearImmediate: (typeof clearImmediate !== "undefined" ? clearImmediate: undefined),
+ setInterval: setInterval,
+ clearInterval: clearInterval,
+ Date: Date
+};
+
+var keys = Object.keys || function (obj) {
+ var ks = [];
+ for (var key in obj) {
+ ks.push(key);
+ }
+ return ks;
+};
+
+exports.timers = timers;
+
+var createClock = exports.createClock = function (now) {
+ var clock = {
+ now: getEpoch(now),
+ timeouts: {},
+ Date: createDate()
+ };
+
+ clock.Date.clock = clock;
+
+ clock.setTimeout = function setTimeout(func, timeout) {
+ return addTimer(clock, {
+ func: func,
+ args: Array.prototype.slice.call(arguments, 2),
+ delay: timeout
+ });
+ };
+
+ clock.clearTimeout = function clearTimeout(timerId) {
+ if (!timerId) {
+ // null appears to be allowed in most browsers, and appears to be
+ // relied upon by some libraries, like Bootstrap carousel
+ return;
+ }
+ if (!clock.timers) {
+ clock.timers = [];
+ }
+ // in Node, timerId is an object with .ref()/.unref(), and
+ // its .id field is the actual timer id.
+ if (typeof timerId === "object") {
+ timerId = timerId.id
+ }
+ if (timerId in clock.timers) {
+ delete clock.timers[timerId];
+ }
+ };
+
+ clock.setInterval = function setInterval(func, timeout) {
+ return addTimer(clock, {
+ func: func,
+ args: Array.prototype.slice.call(arguments, 2),
+ delay: timeout,
+ interval: timeout
+ });
+ };
+
+ clock.clearInterval = function clearInterval(timerId) {
+ clock.clearTimeout(timerId);
+ };
+
+ clock.setImmediate = function setImmediate(func) {
+ return addTimer(clock, {
+ func: func,
+ args: Array.prototype.slice.call(arguments, 1),
+ immediate: true
+ });
+ };
+
+ clock.clearImmediate = function clearImmediate(timerId) {
+ clock.clearTimeout(timerId);
+ };
+
+ clock.tick = function tick(ms) {
+ ms = typeof ms == "number" ? ms : parseTime(ms);
+ var tickFrom = clock.now, tickTo = clock.now + ms, previous = clock.now;
+ var timer = firstTimerInRange(clock, tickFrom, tickTo);
+
+ var firstException;
+ while (timer && tickFrom <= tickTo) {
+ if (clock.timers[timer.id]) {
+ tickFrom = clock.now = timer.callAt;
+ try {
+ callTimer(clock, timer);
+ } catch (e) {
+ firstException = firstException || e;
+ }
+ }
+
+ timer = firstTimerInRange(clock, previous, tickTo);
+ previous = tickFrom;
+ }
+
+ clock.now = tickTo;
+
+ if (firstException) {
+ throw firstException;
+ }
+
+ return clock.now;
+ };
+
+ clock.reset = function reset() {
+ clock.timers = {};
+ };
+
+ return clock;
+};
+
+exports.install = function install(target, now, toFake) {
+ if (typeof target === "number") {
+ toFake = now;
+ now = target;
+ target = null;
+ }
+
+ if (!target) {
+ target = global;
+ }
+
+ var clock = createClock(now);
+
+ clock.uninstall = function () {
+ uninstall(clock, target);
+ };
+
+ clock.methods = toFake || [];
+
+ if (clock.methods.length === 0) {
+ clock.methods = keys(timers);
+ }
+
+ for (var i = 0, l = clock.methods.length; i < l; i++) {
+ hijackMethod(target, clock.methods[i], clock);
+ }
+
+ return clock;
+};
+
+}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
+},{}],51:[function(require,module,exports){
+(function (process,global){
+(function() {
+ "use strict";
+ function lib$es6$promise$utils$$objectOrFunction(x) {
+ return typeof x === 'function' || (typeof x === 'object' && x !== null);
+ }
+
+ function lib$es6$promise$utils$$isFunction(x) {
+ return typeof x === 'function';
+ }
+
+ function lib$es6$promise$utils$$isMaybeThenable(x) {
+ return typeof x === 'object' && x !== null;
+ }
+
+ var lib$es6$promise$utils$$_isArray;
+ if (!Array.isArray) {
+ lib$es6$promise$utils$$_isArray = function (x) {
+ return Object.prototype.toString.call(x) === '[object Array]';
+ };
+ } else {
+ lib$es6$promise$utils$$_isArray = Array.isArray;
+ }
+
+ var lib$es6$promise$utils$$isArray = lib$es6$promise$utils$$_isArray;
+ var lib$es6$promise$asap$$len = 0;
+ var lib$es6$promise$asap$$toString = {}.toString;
+ var lib$es6$promise$asap$$vertxNext;
+ function lib$es6$promise$asap$$asap(callback, arg) {
+ lib$es6$promise$asap$$queue[lib$es6$promise$asap$$len] = callback;
+ lib$es6$promise$asap$$queue[lib$es6$promise$asap$$len + 1] = arg;
+ lib$es6$promise$asap$$len += 2;
+ if (lib$es6$promise$asap$$len === 2) {
+ // If len is 2, that means that we need to schedule an async flush.
+ // If additional callbacks are queued before the queue is flushed, they
+ // will be processed by this flush that we are scheduling.
+ lib$es6$promise$asap$$scheduleFlush();
+ }
+ }
+
+ var lib$es6$promise$asap$$default = lib$es6$promise$asap$$asap;
+
+ var lib$es6$promise$asap$$browserWindow = (typeof window !== 'undefined') ? window : undefined;
+ var lib$es6$promise$asap$$browserGlobal = lib$es6$promise$asap$$browserWindow || {};
+ var lib$es6$promise$asap$$BrowserMutationObserver = lib$es6$promise$asap$$browserGlobal.MutationObserver || lib$es6$promise$asap$$browserGlobal.WebKitMutationObserver;
+ var lib$es6$promise$asap$$isNode = typeof process !== 'undefined' && {}.toString.call(process) === '[object process]';
+
+ // test for web worker but not in IE10
+ var lib$es6$promise$asap$$isWorker = typeof Uint8ClampedArray !== 'undefined' &&
+ typeof importScripts !== 'undefined' &&
+ typeof MessageChannel !== 'undefined';
+
+ // node
+ function lib$es6$promise$asap$$useNextTick() {
+ var nextTick = process.nextTick;
+ // node version 0.10.x displays a deprecation warning when nextTick is used recursively
+ // setImmediate should be used instead instead
+ var version = process.versions.node.match(/^(?:(\d+)\.)?(?:(\d+)\.)?(\*|\d+)$/);
+ if (Array.isArray(version) && version[1] === '0' && version[2] === '10') {
+ nextTick = setImmediate;
+ }
+ return function() {
+ nextTick(lib$es6$promise$asap$$flush);
+ };
+ }
+
+ // vertx
+ function lib$es6$promise$asap$$useVertxTimer() {
+ return function() {
+ lib$es6$promise$asap$$vertxNext(lib$es6$promise$asap$$flush);
+ };
+ }
+
+ function lib$es6$promise$asap$$useMutationObserver() {
+ var iterations = 0;
+ var observer = new lib$es6$promise$asap$$BrowserMutationObserver(lib$es6$promise$asap$$flush);
+ var node = document.createTextNode('');
+ observer.observe(node, { characterData: true });
+
+ return function() {
+ node.data = (iterations = ++iterations % 2);
+ };
+ }
+
+ // web worker
+ function lib$es6$promise$asap$$useMessageChannel() {
+ var channel = new MessageChannel();
+ channel.port1.onmessage = lib$es6$promise$asap$$flush;
+ return function () {
+ channel.port2.postMessage(0);
+ };
+ }
+
+ function lib$es6$promise$asap$$useSetTimeout() {
+ return function() {
+ setTimeout(lib$es6$promise$asap$$flush, 1);
+ };
+ }
+
+ var lib$es6$promise$asap$$queue = new Array(1000);
+ function lib$es6$promise$asap$$flush() {
+ for (var i = 0; i < lib$es6$promise$asap$$len; i+=2) {
+ var callback = lib$es6$promise$asap$$queue[i];
+ var arg = lib$es6$promise$asap$$queue[i+1];
+
+ callback(arg);
+
+ lib$es6$promise$asap$$queue[i] = undefined;
+ lib$es6$promise$asap$$queue[i+1] = undefined;
+ }
+
+ lib$es6$promise$asap$$len = 0;
+ }
+
+ function lib$es6$promise$asap$$attemptVertex() {
+ try {
+ var r = require;
+ var vertx = r('vertx');
+ lib$es6$promise$asap$$vertxNext = vertx.runOnLoop || vertx.runOnContext;
+ return lib$es6$promise$asap$$useVertxTimer();
+ } catch(e) {
+ return lib$es6$promise$asap$$useSetTimeout();
+ }
+ }
+
+ var lib$es6$promise$asap$$scheduleFlush;
+ // Decide what async method to use to triggering processing of queued callbacks:
+ if (lib$es6$promise$asap$$isNode) {
+ lib$es6$promise$asap$$scheduleFlush = lib$es6$promise$asap$$useNextTick();
+ } else if (lib$es6$promise$asap$$BrowserMutationObserver) {
+ lib$es6$promise$asap$$scheduleFlush = lib$es6$promise$asap$$useMutationObserver();
+ } else if (lib$es6$promise$asap$$isWorker) {
+ lib$es6$promise$asap$$scheduleFlush = lib$es6$promise$asap$$useMessageChannel();
+ } else if (lib$es6$promise$asap$$browserWindow === undefined && typeof require === 'function') {
+ lib$es6$promise$asap$$scheduleFlush = lib$es6$promise$asap$$attemptVertex();
+ } else {
+ lib$es6$promise$asap$$scheduleFlush = lib$es6$promise$asap$$useSetTimeout();
+ }
+
+ function lib$es6$promise$$internal$$noop() {}
+
+ var lib$es6$promise$$internal$$PENDING = void 0;
+ var lib$es6$promise$$internal$$FULFILLED = 1;
+ var lib$es6$promise$$internal$$REJECTED = 2;
+
+ var lib$es6$promise$$internal$$GET_THEN_ERROR = new lib$es6$promise$$internal$$ErrorObject();
+
+ function lib$es6$promise$$internal$$selfFullfillment() {
+ return new TypeError("You cannot resolve a promise with itself");
+ }
+
+ function lib$es6$promise$$internal$$cannotReturnOwn() {
+ return new TypeError('A promises callback cannot return that same promise.');
+ }
+
+ function lib$es6$promise$$internal$$getThen(promise) {
+ try {
+ return promise.then;
+ } catch(error) {
+ lib$es6$promise$$internal$$GET_THEN_ERROR.error = error;
+ return lib$es6$promise$$internal$$GET_THEN_ERROR;
+ }
+ }
+
+ function lib$es6$promise$$internal$$tryThen(then, value, fulfillmentHandler, rejectionHandler) {
+ try {
+ then.call(value, fulfillmentHandler, rejectionHandler);
+ } catch(e) {
+ return e;
+ }
+ }
+
+ function lib$es6$promise$$internal$$handleForeignThenable(promise, thenable, then) {
+ lib$es6$promise$asap$$default(function(promise) {
+ var sealed = false;
+ var error = lib$es6$promise$$internal$$tryThen(then, thenable, function(value) {
+ if (sealed) { return; }
+ sealed = true;
+ if (thenable !== value) {
+ lib$es6$promise$$internal$$resolve(promise, value);
+ } else {
+ lib$es6$promise$$internal$$fulfill(promise, value);
+ }
+ }, function(reason) {
+ if (sealed) { return; }
+ sealed = true;
+
+ lib$es6$promise$$internal$$reject(promise, reason);
+ }, 'Settle: ' + (promise._label || ' unknown promise'));
+
+ if (!sealed && error) {
+ sealed = true;
+ lib$es6$promise$$internal$$reject(promise, error);
+ }
+ }, promise);
+ }
+
+ function lib$es6$promise$$internal$$handleOwnThenable(promise, thenable) {
+ if (thenable._state === lib$es6$promise$$internal$$FULFILLED) {
+ lib$es6$promise$$internal$$fulfill(promise, thenable._result);
+ } else if (thenable._state === lib$es6$promise$$internal$$REJECTED) {
+ lib$es6$promise$$internal$$reject(promise, thenable._result);
+ } else {
+ lib$es6$promise$$internal$$subscribe(thenable, undefined, function(value) {
+ lib$es6$promise$$internal$$resolve(promise, value);
+ }, function(reason) {
+ lib$es6$promise$$internal$$reject(promise, reason);
+ });
+ }
+ }
+
+ function lib$es6$promise$$internal$$handleMaybeThenable(promise, maybeThenable) {
+ if (maybeThenable.constructor === promise.constructor) {
+ lib$es6$promise$$internal$$handleOwnThenable(promise, maybeThenable);
+ } else {
+ var then = lib$es6$promise$$internal$$getThen(maybeThenable);
+
+ if (then === lib$es6$promise$$internal$$GET_THEN_ERROR) {
+ lib$es6$promise$$internal$$reject(promise, lib$es6$promise$$internal$$GET_THEN_ERROR.error);
+ } else if (then === undefined) {
+ lib$es6$promise$$internal$$fulfill(promise, maybeThenable);
+ } else if (lib$es6$promise$utils$$isFunction(then)) {
+ lib$es6$promise$$internal$$handleForeignThenable(promise, maybeThenable, then);
+ } else {
+ lib$es6$promise$$internal$$fulfill(promise, maybeThenable);
+ }
+ }
+ }
+
+ function lib$es6$promise$$internal$$resolve(promise, value) {
+ if (promise === value) {
+ lib$es6$promise$$internal$$reject(promise, lib$es6$promise$$internal$$selfFullfillment());
+ } else if (lib$es6$promise$utils$$objectOrFunction(value)) {
+ lib$es6$promise$$internal$$handleMaybeThenable(promise, value);
+ } else {
+ lib$es6$promise$$internal$$fulfill(promise, value);
+ }
+ }
+
+ function lib$es6$promise$$internal$$publishRejection(promise) {
+ if (promise._onerror) {
+ promise._onerror(promise._result);
+ }
+
+ lib$es6$promise$$internal$$publish(promise);
+ }
+
+ function lib$es6$promise$$internal$$fulfill(promise, value) {
+ if (promise._state !== lib$es6$promise$$internal$$PENDING) { return; }
+
+ promise._result = value;
+ promise._state = lib$es6$promise$$internal$$FULFILLED;
+
+ if (promise._subscribers.length !== 0) {
+ lib$es6$promise$asap$$default(lib$es6$promise$$internal$$publish, promise);
+ }
+ }
+
+ function lib$es6$promise$$internal$$reject(promise, reason) {
+ if (promise._state !== lib$es6$promise$$internal$$PENDING) { return; }
+ promise._state = lib$es6$promise$$internal$$REJECTED;
+ promise._result = reason;
+
+ lib$es6$promise$asap$$default(lib$es6$promise$$internal$$publishRejection, promise);
+ }
+
+ function lib$es6$promise$$internal$$subscribe(parent, child, onFulfillment, onRejection) {
+ var subscribers = parent._subscribers;
+ var length = subscribers.length;
+
+ parent._onerror = null;
+
+ subscribers[length] = child;
+ subscribers[length + lib$es6$promise$$internal$$FULFILLED] = onFulfillment;
+ subscribers[length + lib$es6$promise$$internal$$REJECTED] = onRejection;
+
+ if (length === 0 && parent._state) {
+ lib$es6$promise$asap$$default(lib$es6$promise$$internal$$publish, parent);
+ }
+ }
+
+ function lib$es6$promise$$internal$$publish(promise) {
+ var subscribers = promise._subscribers;
+ var settled = promise._state;
+
+ if (subscribers.length === 0) { return; }
+
+ var child, callback, detail = promise._result;
+
+ for (var i = 0; i < subscribers.length; i += 3) {
+ child = subscribers[i];
+ callback = subscribers[i + settled];
+
+ if (child) {
+ lib$es6$promise$$internal$$invokeCallback(settled, child, callback, detail);
+ } else {
+ callback(detail);
+ }
+ }
+
+ promise._subscribers.length = 0;
+ }
+
+ function lib$es6$promise$$internal$$ErrorObject() {
+ this.error = null;
+ }
+
+ var lib$es6$promise$$internal$$TRY_CATCH_ERROR = new lib$es6$promise$$internal$$ErrorObject();
+
+ function lib$es6$promise$$internal$$tryCatch(callback, detail) {
+ try {
+ return callback(detail);
+ } catch(e) {
+ lib$es6$promise$$internal$$TRY_CATCH_ERROR.error = e;
+ return lib$es6$promise$$internal$$TRY_CATCH_ERROR;
+ }
+ }
+
+ function lib$es6$promise$$internal$$invokeCallback(settled, promise, callback, detail) {
+ var hasCallback = lib$es6$promise$utils$$isFunction(callback),
+ value, error, succeeded, failed;
+
+ if (hasCallback) {
+ value = lib$es6$promise$$internal$$tryCatch(callback, detail);
+
+ if (value === lib$es6$promise$$internal$$TRY_CATCH_ERROR) {
+ failed = true;
+ error = value.error;
+ value = null;
+ } else {
+ succeeded = true;
+ }
+
+ if (promise === value) {
+ lib$es6$promise$$internal$$reject(promise, lib$es6$promise$$internal$$cannotReturnOwn());
+ return;
+ }
+
+ } else {
+ value = detail;
+ succeeded = true;
+ }
+
+ if (promise._state !== lib$es6$promise$$internal$$PENDING) {
+ // noop
+ } else if (hasCallback && succeeded) {
+ lib$es6$promise$$internal$$resolve(promise, value);
+ } else if (failed) {
+ lib$es6$promise$$internal$$reject(promise, error);
+ } else if (settled === lib$es6$promise$$internal$$FULFILLED) {
+ lib$es6$promise$$internal$$fulfill(promise, value);
+ } else if (settled === lib$es6$promise$$internal$$REJECTED) {
+ lib$es6$promise$$internal$$reject(promise, value);
+ }
+ }
+
+ function lib$es6$promise$$internal$$initializePromise(promise, resolver) {
+ try {
+ resolver(function resolvePromise(value){
+ lib$es6$promise$$internal$$resolve(promise, value);
+ }, function rejectPromise(reason) {
+ lib$es6$promise$$internal$$reject(promise, reason);
+ });
+ } catch(e) {
+ lib$es6$promise$$internal$$reject(promise, e);
+ }
+ }
+
+ function lib$es6$promise$enumerator$$Enumerator(Constructor, input) {
+ var enumerator = this;
+
+ enumerator._instanceConstructor = Constructor;
+ enumerator.promise = new Constructor(lib$es6$promise$$internal$$noop);
+
+ if (enumerator._validateInput(input)) {
+ enumerator._input = input;
+ enumerator.length = input.length;
+ enumerator._remaining = input.length;
+
+ enumerator._init();
+
+ if (enumerator.length === 0) {
+ lib$es6$promise$$internal$$fulfill(enumerator.promise, enumerator._result);
+ } else {
+ enumerator.length = enumerator.length || 0;
+ enumerator._enumerate();
+ if (enumerator._remaining === 0) {
+ lib$es6$promise$$internal$$fulfill(enumerator.promise, enumerator._result);
+ }
+ }
+ } else {
+ lib$es6$promise$$internal$$reject(enumerator.promise, enumerator._validationError());
+ }
+ }
+
+ lib$es6$promise$enumerator$$Enumerator.prototype._validateInput = function(input) {
+ return lib$es6$promise$utils$$isArray(input);
+ };
+
+ lib$es6$promise$enumerator$$Enumerator.prototype._validationError = function() {
+ return new Error('Array Methods must be provided an Array');
+ };
+
+ lib$es6$promise$enumerator$$Enumerator.prototype._init = function() {
+ this._result = new Array(this.length);
+ };
+
+ var lib$es6$promise$enumerator$$default = lib$es6$promise$enumerator$$Enumerator;
+
+ lib$es6$promise$enumerator$$Enumerator.prototype._enumerate = function() {
+ var enumerator = this;
+
+ var length = enumerator.length;
+ var promise = enumerator.promise;
+ var input = enumerator._input;
+
+ for (var i = 0; promise._state === lib$es6$promise$$internal$$PENDING && i < length; i++) {
+ enumerator._eachEntry(input[i], i);
+ }
+ };
+
+ lib$es6$promise$enumerator$$Enumerator.prototype._eachEntry = function(entry, i) {
+ var enumerator = this;
+ var c = enumerator._instanceConstructor;
+
+ if (lib$es6$promise$utils$$isMaybeThenable(entry)) {
+ if (entry.constructor === c && entry._state !== lib$es6$promise$$internal$$PENDING) {
+ entry._onerror = null;
+ enumerator._settledAt(entry._state, i, entry._result);
+ } else {
+ enumerator._willSettleAt(c.resolve(entry), i);
+ }
+ } else {
+ enumerator._remaining--;
+ enumerator._result[i] = entry;
+ }
+ };
+
+ lib$es6$promise$enumerator$$Enumerator.prototype._settledAt = function(state, i, value) {
+ var enumerator = this;
+ var promise = enumerator.promise;
+
+ if (promise._state === lib$es6$promise$$internal$$PENDING) {
+ enumerator._remaining--;
+
+ if (state === lib$es6$promise$$internal$$REJECTED) {
+ lib$es6$promise$$internal$$reject(promise, value);
+ } else {
+ enumerator._result[i] = value;
+ }
+ }
+
+ if (enumerator._remaining === 0) {
+ lib$es6$promise$$internal$$fulfill(promise, enumerator._result);
+ }
+ };
+
+ lib$es6$promise$enumerator$$Enumerator.prototype._willSettleAt = function(promise, i) {
+ var enumerator = this;
+
+ lib$es6$promise$$internal$$subscribe(promise, undefined, function(value) {
+ enumerator._settledAt(lib$es6$promise$$internal$$FULFILLED, i, value);
+ }, function(reason) {
+ enumerator._settledAt(lib$es6$promise$$internal$$REJECTED, i, reason);
+ });
+ };
+ function lib$es6$promise$promise$all$$all(entries) {
+ return new lib$es6$promise$enumerator$$default(this, entries).promise;
+ }
+ var lib$es6$promise$promise$all$$default = lib$es6$promise$promise$all$$all;
+ function lib$es6$promise$promise$race$$race(entries) {
+ /*jshint validthis:true */
+ var Constructor = this;
+
+ var promise = new Constructor(lib$es6$promise$$internal$$noop);
+
+ if (!lib$es6$promise$utils$$isArray(entries)) {
+ lib$es6$promise$$internal$$reject(promise, new TypeError('You must pass an array to race.'));
+ return promise;
+ }
+
+ var length = entries.length;
+
+ function onFulfillment(value) {
+ lib$es6$promise$$internal$$resolve(promise, value);
+ }
+
+ function onRejection(reason) {
+ lib$es6$promise$$internal$$reject(promise, reason);
+ }
+
+ for (var i = 0; promise._state === lib$es6$promise$$internal$$PENDING && i < length; i++) {
+ lib$es6$promise$$internal$$subscribe(Constructor.resolve(entries[i]), undefined, onFulfillment, onRejection);
+ }
+
+ return promise;
+ }
+ var lib$es6$promise$promise$race$$default = lib$es6$promise$promise$race$$race;
+ function lib$es6$promise$promise$resolve$$resolve(object) {
+ /*jshint validthis:true */
+ var Constructor = this;
+
+ if (object && typeof object === 'object' && object.constructor === Constructor) {
+ return object;
+ }
+
+ var promise = new Constructor(lib$es6$promise$$internal$$noop);
+ lib$es6$promise$$internal$$resolve(promise, object);
+ return promise;
+ }
+ var lib$es6$promise$promise$resolve$$default = lib$es6$promise$promise$resolve$$resolve;
+ function lib$es6$promise$promise$reject$$reject(reason) {
+ /*jshint validthis:true */
+ var Constructor = this;
+ var promise = new Constructor(lib$es6$promise$$internal$$noop);
+ lib$es6$promise$$internal$$reject(promise, reason);
+ return promise;
+ }
+ var lib$es6$promise$promise$reject$$default = lib$es6$promise$promise$reject$$reject;
+
+ var lib$es6$promise$promise$$counter = 0;
+
+ function lib$es6$promise$promise$$needsResolver() {
+ throw new TypeError('You must pass a resolver function as the first argument to the promise constructor');
+ }
+
+ function lib$es6$promise$promise$$needsNew() {
+ throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.");
+ }
+
+ var lib$es6$promise$promise$$default = lib$es6$promise$promise$$Promise;
+ /**
+ Promise objects represent the eventual result of an asynchronous operation. The
+ primary way of interacting with a promise is through its `then` method, which
+ registers callbacks to receive either a promise’s eventual value or the reason
+ why the promise cannot be fulfilled.
+
+ Terminology
+ -----------
+
+ - `promise` is an object or function with a `then` method whose behavior conforms to this specification.
+ - `thenable` is an object or function that defines a `then` method.
+ - `value` is any legal JavaScript value (including undefined, a thenable, or a promise).
+ - `exception` is a value that is thrown using the throw statement.
+ - `reason` is a value that indicates why a promise was rejected.
+ - `settled` the final resting state of a promise, fulfilled or rejected.
+
+ A promise can be in one of three states: pending, fulfilled, or rejected.
+
+ Promises that are fulfilled have a fulfillment value and are in the fulfilled
+ state. Promises that are rejected have a rejection reason and are in the
+ rejected state. A fulfillment value is never a thenable.
+
+ Promises can also be said to *resolve* a value. If this value is also a
+ promise, then the original promise's settled state will match the value's
+ settled state. So a promise that *resolves* a promise that rejects will
+ itself reject, and a promise that *resolves* a promise that fulfills will
+ itself fulfill.
+
+
+ Basic Usage:
+ ------------
+
+ ```js
+ var promise = new Promise(function(resolve, reject) {
+ // on success
+ resolve(value);
+
+ // on failure
+ reject(reason);
+ });
+
+ promise.then(function(value) {
+ // on fulfillment
+ }, function(reason) {
+ // on rejection
+ });
+ ```
+
+ Advanced Usage:
+ ---------------
+
+ Promises shine when abstracting away asynchronous interactions such as
+ `XMLHttpRequest`s.
+
+ ```js
+ function getJSON(url) {
+ return new Promise(function(resolve, reject){
+ var xhr = new XMLHttpRequest();
+
+ xhr.open('GET', url);
+ xhr.onreadystatechange = handler;
+ xhr.responseType = 'json';
+ xhr.setRequestHeader('Accept', 'application/json');
+ xhr.send();
+
+ function handler() {
+ if (this.readyState === this.DONE) {
+ if (this.status === 200) {
+ resolve(this.response);
+ } else {
+ reject(new Error('getJSON: `' + url + '` failed with status: [' + this.status + ']'));
+ }
+ }
+ };
+ });
+ }
+
+ getJSON('/posts.json').then(function(json) {
+ // on fulfillment
+ }, function(reason) {
+ // on rejection
+ });
+ ```
+
+ Unlike callbacks, promises are great composable primitives.
+
+ ```js
+ Promise.all([
+ getJSON('/posts'),
+ getJSON('/comments')
+ ]).then(function(values){
+ values[0] // => postsJSON
+ values[1] // => commentsJSON
+
+ return values;
+ });
+ ```
+
+ @class Promise
+ @param {function} resolver
+ Useful for tooling.
+ @constructor
+ */
+ function lib$es6$promise$promise$$Promise(resolver) {
+ this._id = lib$es6$promise$promise$$counter++;
+ this._state = undefined;
+ this._result = undefined;
+ this._subscribers = [];
+
+ if (lib$es6$promise$$internal$$noop !== resolver) {
+ if (!lib$es6$promise$utils$$isFunction(resolver)) {
+ lib$es6$promise$promise$$needsResolver();
+ }
+
+ if (!(this instanceof lib$es6$promise$promise$$Promise)) {
+ lib$es6$promise$promise$$needsNew();
+ }
+
+ lib$es6$promise$$internal$$initializePromise(this, resolver);
+ }
+ }
+
+ lib$es6$promise$promise$$Promise.all = lib$es6$promise$promise$all$$default;
+ lib$es6$promise$promise$$Promise.race = lib$es6$promise$promise$race$$default;
+ lib$es6$promise$promise$$Promise.resolve = lib$es6$promise$promise$resolve$$default;
+ lib$es6$promise$promise$$Promise.reject = lib$es6$promise$promise$reject$$default;
+
+ lib$es6$promise$promise$$Promise.prototype = {
+ constructor: lib$es6$promise$promise$$Promise,
+
+ /**
+ The primary way of interacting with a promise is through its `then` method,
+ which registers callbacks to receive either a promise's eventual value or the
+ reason why the promise cannot be fulfilled.
+
+ ```js
+ findUser().then(function(user){
+ // user is available
+ }, function(reason){
+ // user is unavailable, and you are given the reason why
+ });
+ ```
+
+ Chaining
+ --------
+
+ The return value of `then` is itself a promise. This second, 'downstream'
+ promise is resolved with the return value of the first promise's fulfillment
+ or rejection handler, or rejected if the handler throws an exception.
+
+ ```js
+ findUser().then(function (user) {
+ return user.name;
+ }, function (reason) {
+ return 'default name';
+ }).then(function (userName) {
+ // If `findUser` fulfilled, `userName` will be the user's name, otherwise it
+ // will be `'default name'`
+ });
+
+ findUser().then(function (user) {
+ throw new Error('Found user, but still unhappy');
+ }, function (reason) {
+ throw new Error('`findUser` rejected and we're unhappy');
+ }).then(function (value) {
+ // never reached
+ }, function (reason) {
+ // if `findUser` fulfilled, `reason` will be 'Found user, but still unhappy'.
+ // If `findUser` rejected, `reason` will be '`findUser` rejected and we're unhappy'.
+ });
+ ```
+ If the downstream promise does not specify a rejection handler, rejection reasons will be propagated further downstream.
+
+ ```js
+ findUser().then(function (user) {
+ throw new PedagogicalException('Upstream error');
+ }).then(function (value) {
+ // never reached
+ }).then(function (value) {
+ // never reached
+ }, function (reason) {
+ // The `PedgagocialException` is propagated all the way down to here
+ });
+ ```
+
+ Assimilation
+ ------------
+
+ Sometimes the value you want to propagate to a downstream promise can only be
+ retrieved asynchronously. This can be achieved by returning a promise in the
+ fulfillment or rejection handler. The downstream promise will then be pending
+ until the returned promise is settled. This is called *assimilation*.
+
+ ```js
+ findUser().then(function (user) {
+ return findCommentsByAuthor(user);
+ }).then(function (comments) {
+ // The user's comments are now available
+ });
+ ```
+
+ If the assimliated promise rejects, then the downstream promise will also reject.
+
+ ```js
+ findUser().then(function (user) {
+ return findCommentsByAuthor(user);
+ }).then(function (comments) {
+ // If `findCommentsByAuthor` fulfills, we'll have the value here
+ }, function (reason) {
+ // If `findCommentsByAuthor` rejects, we'll have the reason here
+ });
+ ```
+
+ Simple Example
+ --------------
+
+ Synchronous Example
+
+ ```javascript
+ var result;
+
+ try {
+ result = findResult();
+ // success
+ } catch(reason) {
+ // failure
+ }
+ ```
+
+ Errback Example
+
+ ```js
+ findResult(function(result, err){
+ if (err) {
+ // failure
+ } else {
+ // success
+ }
+ });
+ ```
+
+ Promise Example;
+
+ ```javascript
+ findResult().then(function(result){
+ // success
+ }, function(reason){
+ // failure
+ });
+ ```
+
+ Advanced Example
+ --------------
+
+ Synchronous Example
+
+ ```javascript
+ var author, books;
+
+ try {
+ author = findAuthor();
+ books = findBooksByAuthor(author);
+ // success
+ } catch(reason) {
+ // failure
+ }
+ ```
+
+ Errback Example
+
+ ```js
+
+ function foundBooks(books) {
+
+ }
+
+ function failure(reason) {
+
+ }
+
+ findAuthor(function(author, err){
+ if (err) {
+ failure(err);
+ // failure
+ } else {
+ try {
+ findBoooksByAuthor(author, function(books, err) {
+ if (err) {
+ failure(err);
+ } else {
+ try {
+ foundBooks(books);
+ } catch(reason) {
+ failure(reason);
+ }
+ }
+ });
+ } catch(error) {
+ failure(err);
+ }
+ // success
+ }
+ });
+ ```
+
+ Promise Example;
+
+ ```javascript
+ findAuthor().
+ then(findBooksByAuthor).
+ then(function(books){
+ // found books
+ }).catch(function(reason){
+ // something went wrong
+ });
+ ```
+
+ @method then
+ @param {Function} onFulfilled
+ @param {Function} onRejected
+ Useful for tooling.
+ @return {Promise}
+ */
+ then: function(onFulfillment, onRejection) {
+ var parent = this;
+ var state = parent._state;
+
+ if (state === lib$es6$promise$$internal$$FULFILLED && !onFulfillment || state === lib$es6$promise$$internal$$REJECTED && !onRejection) {
+ return this;
+ }
+
+ var child = new this.constructor(lib$es6$promise$$internal$$noop);
+ var result = parent._result;
+
+ if (state) {
+ var callback = arguments[state - 1];
+ lib$es6$promise$asap$$default(function(){
+ lib$es6$promise$$internal$$invokeCallback(state, child, callback, result);
+ });
+ } else {
+ lib$es6$promise$$internal$$subscribe(parent, child, onFulfillment, onRejection);
+ }
+
+ return child;
+ },
+
+ /**
+ `catch` is simply sugar for `then(undefined, onRejection)` which makes it the same
+ as the catch block of a try/catch statement.
+
+ ```js
+ function findAuthor(){
+ throw new Error('couldn't find that author');
+ }
+
+ // synchronous
+ try {
+ findAuthor();
+ } catch(reason) {
+ // something went wrong
+ }
+
+ // async with promises
+ findAuthor().catch(function(reason){
+ // something went wrong
+ });
+ ```
+
+ @method catch
+ @param {Function} onRejection
+ Useful for tooling.
+ @return {Promise}
+ */
+ 'catch': function(onRejection) {
+ return this.then(null, onRejection);
+ }
+ };
+ function lib$es6$promise$polyfill$$polyfill() {
+ var local;
+
+ if (typeof global !== 'undefined') {
+ local = global;
+ } else if (typeof self !== 'undefined') {
+ local = self;
+ } else {
+ try {
+ local = Function('return this')();
+ } catch (e) {
+ throw new Error('polyfill failed because global object is unavailable in this environment');
+ }
+ }
+
+ var P = local.Promise;
+
+ if (P && Object.prototype.toString.call(P.resolve()) === '[object Promise]' && !P.cast) {
+ return;
+ }
+
+ local.Promise = lib$es6$promise$promise$$default;
+ }
+ var lib$es6$promise$polyfill$$default = lib$es6$promise$polyfill$$polyfill;
+
+ var lib$es6$promise$umd$$ES6Promise = {
+ 'Promise': lib$es6$promise$promise$$default,
+ 'polyfill': lib$es6$promise$polyfill$$default
+ };
+
+ /* global define:true module:true window: true */
+ if (typeof define === 'function' && define['amd']) {
+ define(function() { return lib$es6$promise$umd$$ES6Promise; });
+ } else if (typeof module !== 'undefined' && module['exports']) {
+ module['exports'] = lib$es6$promise$umd$$ES6Promise;
+ } else if (typeof this !== 'undefined') {
+ this['ES6Promise'] = lib$es6$promise$umd$$ES6Promise;
+ }
+
+ lib$es6$promise$polyfill$$default();
+}).call(this);
+
+//# sourceMappingURL=es6-promise.js.map
+}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
+},{"_process":4}],52:[function(require,module,exports){
+(function (global){
+/*global describe, specify, it, assert */
+
+if (typeof Object.getPrototypeOf !== "function") {
+ Object.getPrototypeOf = "".__proto__ === String.prototype
+ ? function (object) {
+ return object.__proto__;
+ }
+ : function (object) {
+ // May break if the constructor has been tampered with
+ return object.constructor.prototype;
+ };
+}
+
+function keysOf(object) {
+ var results = [];
+
+ for (var key in object) {
+ if (object.hasOwnProperty(key)) {
+ results.push(key);
+ }
+ }
+
+ return results;
+}
+
+var g = typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : this;
+var Promise = g.adapter.Promise;
+var assert = require('assert');
+
+function objectEquals(obj1, obj2) {
+ for (var i in obj1) {
+ if (obj1.hasOwnProperty(i)) {
+ if (!obj2.hasOwnProperty(i)) return false;
+ if (obj1[i] != obj2[i]) return false;
+ }
+ }
+ for (var i in obj2) {
+ if (obj2.hasOwnProperty(i)) {
+ if (!obj1.hasOwnProperty(i)) return false;
+ if (obj1[i] != obj2[i]) return false;
+ }
+ }
+ return true;
+}
+
+describe("extensions", function() {
+ describe("Promise constructor", function() {
+ it('should exist and have length 1', function() {
+ assert(Promise);
+ assert.equal(Promise.length, 1);
+ });
+
+ it('should fulfill if `resolve` is called with a value', function(done) {
+ var promise = new Promise(function(resolve) { resolve('value'); });
+
+ promise.then(function(value) {
+ assert.equal(value, 'value');
+ done();
+ });
+ });
+
+ it('should reject if `reject` is called with a reason', function(done) {
+ var promise = new Promise(function(resolve, reject) { reject('reason'); });
+
+ promise.then(function() {
+ assert(false);
+ done();
+ }, function(reason) {
+ assert.equal(reason, 'reason');
+ done();
+ });
+ });
+
+ it('should be a constructor', function() {
+ var promise = new Promise(function() {});
+
+ assert.equal(Object.getPrototypeOf(promise), Promise.prototype, '[[Prototype]] equals Promise.prototype');
+ assert.equal(promise.constructor, Promise, 'constructor property of instances is set correctly');
+ assert.equal(Promise.prototype.constructor, Promise, 'constructor property of prototype is set correctly');
+ });
+
+ it('should NOT work without `new`', function() {
+ assert.throws(function(){
+ Promise(function(resolve) { resolve('value'); });
+ }, TypeError)
+ });
+
+ it('should throw a `TypeError` if not given a function', function() {
+ assert.throws(function () {
+ new Promise();
+ }, TypeError);
+
+ assert.throws(function () {
+ new Promise({});
+ }, TypeError);
+
+ assert.throws(function () {
+ new Promise('boo!');
+ }, TypeError);
+ });
+
+ it('should reject on resolver exception', function(done) {
+ new Promise(function() {
+ throw 'error';
+ }).then(null, function(e) {
+ assert.equal(e, 'error');
+ done();
+ });
+ });
+
+ it('should not resolve multiple times', function(done) {
+ var resolver, rejector, fulfilled = 0, rejected = 0;
+ var thenable = {
+ then: function(resolve, reject) {
+ resolver = resolve;
+ rejector = reject;
+ }
+ };
+
+ var promise = new Promise(function(resolve) {
+ resolve(1);
+ });
+
+ promise.then(function(value){
+ return thenable;
+ }).then(function(value){
+ fulfilled++;
+ }, function(reason) {
+ rejected++;
+ });
+
+ setTimeout(function() {
+ resolver(1);
+ resolver(1);
+ rejector(1);
+ rejector(1);
+
+ setTimeout(function() {
+ assert.equal(fulfilled, 1);
+ assert.equal(rejected, 0);
+ done();
+ }, 20);
+ }, 20);
+
+ });
+
+ describe('assimilation', function() {
+ it('should assimilate if `resolve` is called with a fulfilled promise', function(done) {
+ var originalPromise = new Promise(function(resolve) { resolve('original value'); });
+ var promise = new Promise(function(resolve) { resolve(originalPromise); });
+
+ promise.then(function(value) {
+ assert.equal(value, 'original value');
+ done();
+ });
+ });
+
+ it('should assimilate if `resolve` is called with a rejected promise', function(done) {
+ var originalPromise = new Promise(function(resolve, reject) { reject('original reason'); });
+ var promise = new Promise(function(resolve) { resolve(originalPromise); });
+
+ promise.then(function() {
+ assert(false);
+ done();
+ }, function(reason) {
+ assert.equal(reason, 'original reason');
+ done();
+ });
+ });
+
+ it('should assimilate if `resolve` is called with a fulfilled thenable', function(done) {
+ var originalThenable = {
+ then: function (onFulfilled) {
+ setTimeout(function() { onFulfilled('original value'); }, 0);
+ }
+ };
+ var promise = new Promise(function(resolve) { resolve(originalThenable); });
+
+ promise.then(function(value) {
+ assert.equal(value, 'original value');
+ done();
+ });
+ });
+
+ it('should assimilate if `resolve` is called with a rejected thenable', function(done) {
+ var originalThenable = {
+ then: function (onFulfilled, onRejected) {
+ setTimeout(function() { onRejected('original reason'); }, 0);
+ }
+ };
+ var promise = new Promise(function(resolve) { resolve(originalThenable); });
+
+ promise.then(function() {
+ assert(false);
+ done();
+ }, function(reason) {
+ assert.equal(reason, 'original reason');
+ done();
+ });
+ });
+
+
+ it('should assimilate two levels deep, for fulfillment of self fulfilling promises', function(done) {
+ var originalPromise, promise;
+ originalPromise = new Promise(function(resolve) {
+ setTimeout(function() {
+ resolve(originalPromise);
+ }, 0)
+ });
+
+ promise = new Promise(function(resolve) {
+ setTimeout(function() {
+ resolve(originalPromise);
+ }, 0);
+ });
+
+ promise.then(function(value) {
+ assert(false);
+ done();
+ })['catch'](function(reason) {
+ assert.equal(reason.message, "You cannot resolve a promise with itself");
+ assert(reason instanceof TypeError);
+ done();
+ });
+ });
+
+ it('should assimilate two levels deep, for fulfillment', function(done) {
+ var originalPromise = new Promise(function(resolve) { resolve('original value'); });
+ var nextPromise = new Promise(function(resolve) { resolve(originalPromise); });
+ var promise = new Promise(function(resolve) { resolve(nextPromise); });
+
+ promise.then(function(value) {
+ assert.equal(value, 'original value');
+ done();
+ });
+ });
+
+ it('should assimilate two levels deep, for rejection', function(done) {
+ var originalPromise = new Promise(function(resolve, reject) { reject('original reason'); });
+ var nextPromise = new Promise(function(resolve) { resolve(originalPromise); });
+ var promise = new Promise(function(resolve) { resolve(nextPromise); });
+
+ promise.then(function() {
+ assert(false);
+ done();
+ }, function(reason) {
+ assert.equal(reason, 'original reason');
+ done();
+ });
+ });
+
+ it('should assimilate three levels deep, mixing thenables and promises (fulfilled case)', function(done) {
+ var originalPromise = new Promise(function(resolve) { resolve('original value'); });
+ var intermediateThenable = {
+ then: function (onFulfilled) {
+ setTimeout(function() { onFulfilled(originalPromise); }, 0);
+ }
+ };
+ var promise = new Promise(function(resolve) { resolve(intermediateThenable); });
+
+ promise.then(function(value) {
+ assert.equal(value, 'original value');
+ done();
+ });
+ });
+
+ it('should assimilate three levels deep, mixing thenables and promises (rejected case)', function(done) {
+ var originalPromise = new Promise(function(resolve, reject) { reject('original reason'); });
+ var intermediateThenable = {
+ then: function (onFulfilled) {
+ setTimeout(function() { onFulfilled(originalPromise); }, 0);
+ }
+ };
+ var promise = new Promise(function(resolve) { resolve(intermediateThenable); });
+
+ promise.then(function() {
+ assert(false);
+ done();
+ }, function(reason) {
+ assert.equal(reason, 'original reason');
+ done();
+ });
+ });
+ });
+ });
+
+ describe("Promise.all", function() {
+ testAll(function(){
+ return Promise.all.apply(Promise, arguments);
+ });
+ });
+
+ function testAll(all) {
+ it('should exist', function() {
+ assert(all);
+ });
+
+ it('throws when not passed an array', function(done) {
+ var nothing = assertRejection(all());
+ var string = assertRejection(all(''));
+ var object = assertRejection(all({}));
+
+ Promise.all([
+ nothing,
+ string,
+ object
+ ]).then(function(){ done(); });
+ });
+
+ specify('fulfilled only after all of the other promises are fulfilled', function(done) {
+ var firstResolved, secondResolved, firstResolver, secondResolver;
+
+ var first = new Promise(function(resolve) {
+ firstResolver = resolve;
+ });
+ first.then(function() {
+ firstResolved = true;
+ });
+
+ var second = new Promise(function(resolve) {
+ secondResolver = resolve;
+ });
+ second.then(function() {
+ secondResolved = true;
+ });
+
+ setTimeout(function() {
+ firstResolver(true);
+ }, 0);
+
+ setTimeout(function() {
+ secondResolver(true);
+ }, 0);
+
+ all([first, second]).then(function() {
+ assert(firstResolved);
+ assert(secondResolved);
+ done();
+ });
+ });
+
+ specify('rejected as soon as a promise is rejected', function(done) {
+ var firstResolver, secondResolver;
+
+ var first = new Promise(function(resolve, reject) {
+ firstResolver = { resolve: resolve, reject: reject };
+ });
+
+ var second = new Promise(function(resolve, reject) {
+ secondResolver = { resolve: resolve, reject: reject };
+ });
+
+ setTimeout(function() {
+ firstResolver.reject({});
+ }, 0);
+
+ var firstWasRejected, secondCompleted;
+
+ first['catch'](function(){
+ firstWasRejected = true;
+ });
+
+ second.then(function(){
+ secondCompleted = true;
+ }, function() {
+ secondCompleted = true;
+ });
+
+ all([first, second]).then(function() {
+ assert(false);
+ }, function() {
+ assert(firstWasRejected);
+ assert(!secondCompleted);
+ done();
+ });
+ });
+
+ specify('passes the resolved values of each promise to the callback in the correct order', function(done) {
+ var firstResolver, secondResolver, thirdResolver;
+
+ var first = new Promise(function(resolve, reject) {
+ firstResolver = { resolve: resolve, reject: reject };
+ });
+
+ var second = new Promise(function(resolve, reject) {
+ secondResolver = { resolve: resolve, reject: reject };
+ });
+
+ var third = new Promise(function(resolve, reject) {
+ thirdResolver = { resolve: resolve, reject: reject };
+ });
+
+ thirdResolver.resolve(3);
+ firstResolver.resolve(1);
+ secondResolver.resolve(2);
+
+ all([first, second, third]).then(function(results) {
+ assert(results.length === 3);
+ assert(results[0] === 1);
+ assert(results[1] === 2);
+ assert(results[2] === 3);
+ done();
+ });
+ });
+
+ specify('resolves an empty array passed to all()', function(done) {
+ all([]).then(function(results) {
+ assert(results.length === 0);
+ done();
+ });
+ });
+
+ specify('works with null', function(done) {
+ all([null]).then(function(results) {
+ assert.equal(results[0], null);
+ done();
+ });
+ });
+
+ specify('works with a mix of promises and thenables and non-promises', function(done) {
+ var promise = new Promise(function(resolve) { resolve(1); });
+ var syncThenable = { then: function (onFulfilled) { onFulfilled(2); } };
+ var asyncThenable = { then: function (onFulfilled) { setTimeout(function() { onFulfilled(3); }, 0); } };
+ var nonPromise = 4;
+
+ all([promise, syncThenable, asyncThenable, nonPromise]).then(function(results) {
+ assert(objectEquals(results, [1, 2, 3, 4]));
+ done();
+ })['catch'](done);
+ });
+ }
+
+ describe("reject", function(){
+ specify("it should exist", function(){
+ assert(Promise.reject);
+ });
+
+ describe('it rejects', function(){
+ var reason = 'the reason',
+ promise = Promise.reject(reason);
+
+ promise.then(function(){
+ assert(false, 'should not fulfill');
+ }, function(actualReason){
+ assert.equal(reason, actualReason);
+ });
+ });
+ });
+
+ function assertRejection(promise) {
+ return promise.then(function(){
+ assert(false, 'expected rejection, but got fulfillment');
+ }, function(reason){
+ assert(reason instanceof Error);
+ });
+ }
+
+ describe('race', function() {
+ it("should exist", function() {
+ assert(Promise.race);
+ });
+
+ it("throws when not passed an array", function(done) {
+ var nothing = assertRejection(Promise.race());
+ var string = assertRejection(Promise.race(''));
+ var object = assertRejection(Promise.race({}));
+
+ Promise.all([
+ nothing,
+ string,
+ object
+ ]).then(function(){ done(); });
+ });
+
+ specify('fulfilled after one of the other promises are fulfilled', function(done) {
+ var firstResolved, secondResolved, firstResolver, secondResolver;
+
+ var first = new Promise(function(resolve) {
+ firstResolver = resolve;
+ });
+ first.then(function() {
+ firstResolved = true;
+ });
+
+ var second = new Promise(function(resolve) {
+ secondResolver = resolve;
+ });
+ second.then(function() {
+ secondResolved = true;
+ });
+
+ setTimeout(function() {
+ firstResolver(true);
+ }, 100);
+
+ setTimeout(function() {
+ secondResolver(true);
+ }, 0);
+
+ Promise.race([first, second]).then(function() {
+ assert(secondResolved);
+ assert.equal(firstResolved, undefined);
+ done();
+ });
+ });
+
+ specify('the race begins on nextTurn and prioritized by array entry', function(done) {
+ var firstResolver, secondResolver, nonPromise = 5;
+
+ var first = new Promise(function(resolve, reject) {
+ resolve(true);
+ });
+
+ var second = new Promise(function(resolve, reject) {
+ resolve(false);
+ });
+
+ Promise.race([first, second, nonPromise]).then(function(value) {
+ assert.equal(value, true);
+ done();
+ });
+ });
+
+ specify('rejected as soon as a promise is rejected', function(done) {
+ var firstResolver, secondResolver;
+
+ var first = new Promise(function(resolve, reject) {
+ firstResolver = { resolve: resolve, reject: reject };
+ });
+
+ var second = new Promise(function(resolve, reject) {
+ secondResolver = { resolve: resolve, reject: reject };
+ });
+
+ setTimeout(function() {
+ firstResolver.reject({});
+ }, 0);
+
+ var firstWasRejected, secondCompleted;
+
+ first['catch'](function(){
+ firstWasRejected = true;
+ });
+
+ second.then(function(){
+ secondCompleted = true;
+ }, function() {
+ secondCompleted = true;
+ });
+
+ Promise.race([first, second]).then(function() {
+ assert(false);
+ }, function() {
+ assert(firstWasRejected);
+ assert(!secondCompleted);
+ done();
+ });
+ });
+
+ specify('resolves an empty array to forever pending Promise', function(done) {
+ var foreverPendingPromise = Promise.race([]),
+ wasSettled = false;
+
+ foreverPendingPromise.then(function() {
+ wasSettled = true;
+ }, function() {
+ wasSettled = true;
+ });
+
+ setTimeout(function() {
+ assert(!wasSettled);
+ done();
+ }, 100);
+ });
+
+ specify('works with a mix of promises and thenables', function(done) {
+ var promise = new Promise(function(resolve) { setTimeout(function() { resolve(1); }, 10); }),
+ syncThenable = { then: function (onFulfilled) { onFulfilled(2); } };
+
+ Promise.race([promise, syncThenable]).then(function(result) {
+ assert(result, 2);
+ done();
+ });
+ });
+
+ specify('works with a mix of thenables and non-promises', function (done) {
+ var asyncThenable = { then: function (onFulfilled) { setTimeout(function() { onFulfilled(3); }, 0); } },
+ nonPromise = 4;
+
+ Promise.race([asyncThenable, nonPromise]).then(function(result) {
+ assert(result, 4);
+ done();
+ });
+ });
+ });
+
+ describe("resolve", function(){
+ specify("it should exist", function(){
+ assert(Promise.resolve);
+ });
+
+ describe("1. If x is a promise, adopt its state ", function(){
+ specify("1.1 If x is pending, promise must remain pending until x is fulfilled or rejected.", function(done){
+ var expectedValue, resolver, thenable, wrapped;
+
+ expectedValue = 'the value';
+ thenable = {
+ then: function(resolve, reject){
+ resolver = resolve;
+ }
+ };
+
+ wrapped = Promise.resolve(thenable);
+
+ wrapped.then(function(value){
+ assert(value === expectedValue);
+ done();
+ });
+
+ setTimeout(function(){
+ resolver(expectedValue);
+ }, 10);
+ });
+
+ specify("1.2 If/when x is fulfilled, fulfill promise with the same value.", function(done){
+ var expectedValue, thenable, wrapped;
+
+ expectedValue = 'the value';
+ thenable = {
+ then: function(resolve, reject){
+ resolve(expectedValue);
+ }
+ };
+
+ wrapped = Promise.resolve(thenable);
+
+ wrapped.then(function(value){
+ assert(value === expectedValue);
+ done();
+ })
+ });
+
+ specify("1.3 If/when x is rejected, reject promise with the same reason.", function(done){
+ var expectedError, thenable, wrapped;
+
+ expectedError = new Error();
+ thenable = {
+ then: function(resolve, reject){
+ reject(expectedError);
+ }
+ };
+
+ wrapped = Promise.resolve(thenable);
+
+ wrapped.then(null, function(error){
+ assert(error === expectedError);
+ done();
+ });
+ });
+ });
+
+ describe("2. Otherwise, if x is an object or function,", function(){
+ specify("2.1 Let then x.then", function(done){
+ var accessCount, resolver, wrapped, thenable;
+
+ accessCount = 0;
+ thenable = { };
+
+ // we likely don't need to test this, if the browser doesn't support it
+ if (typeof Object.defineProperty !== "function") { done(); return; }
+
+ Object.defineProperty(thenable, 'then', {
+ get: function(){
+ accessCount++;
+
+ if (accessCount > 1) {
+ throw new Error();
+ }
+
+ return function(){ };
+ }
+ });
+
+ assert(accessCount === 0);
+
+ wrapped = Promise.resolve(thenable);
+
+ assert(accessCount === 1);
+
+ done();
+ });
+
+ specify("2.2 If retrieving the property x.then results in a thrown exception e, reject promise with e as the reason.", function(done){
+ var wrapped, thenable, expectedError;
+
+ expectedError = new Error();
+ thenable = { };
+
+ // we likely don't need to test this, if the browser doesn't support it
+ if (typeof Object.defineProperty !== "function") { done(); return; }
+
+ Object.defineProperty(thenable, 'then', {
+ get: function(){
+ throw expectedError;
+ }
+ });
+
+ wrapped = Promise.resolve(thenable);
+
+ wrapped.then(null, function(error){
+ assert(error === expectedError, 'incorrect exception was thrown');
+ done();
+ });
+ });
+
+ describe('2.3. If then is a function, call it with x as this, first argument resolvePromise, and second argument rejectPromise, where', function(){
+ specify('2.3.1 If/when resolvePromise is called with a value y, run Resolve(promise, y)', function(done){
+ var expectedSuccess, resolver, rejector, thenable, wrapped, calledThis;
+
+ thenable = {
+ then: function(resolve, reject){
+ calledThis = this;
+ resolver = resolve;
+ rejector = reject;
+ }
+ };
+
+ expectedSuccess = 'success';
+ wrapped = Promise.resolve(thenable);
+
+ wrapped.then(function(success){
+ assert(calledThis === thenable, 'this must be the thenable');
+ assert(success === expectedSuccess, 'rejected promise with x');
+ done();
+ });
+
+ setTimeout(function() {
+ resolver(expectedSuccess);
+ }, 20);
+ });
+
+ specify('2.3.2 If/when rejectPromise is called with a reason r, reject promise with r.', function(done){
+ var expectedError, resolver, rejector, thenable, wrapped, calledThis;
+
+ thenable = {
+ then: function(resolve, reject){
+ calledThis = this;
+ resolver = resolve;
+ rejector = reject;
+ }
+ };
+
+ expectedError = new Error();
+
+ wrapped = Promise.resolve(thenable);
+
+ wrapped.then(null, function(error){
+ assert(error === expectedError, 'rejected promise with x');
+ done();
+ });
+
+ setTimeout(function() {
+ rejector(expectedError);
+ }, 20);
+ });
+
+ specify("2.3.3 If both resolvePromise and rejectPromise are called, or multiple calls to the same argument are made, the first call takes precedence, and any further calls are ignored", function(done){
+ var expectedError, expectedSuccess, resolver, rejector, thenable, wrapped, calledThis,
+ calledRejected, calledResolved;
+
+ calledRejected = 0;
+ calledResolved = 0;
+
+ thenable = {
+ then: function(resolve, reject){
+ calledThis = this;
+ resolver = resolve;
+ rejector = reject;
+ }
+ };
+
+ expectedError = new Error();
+
+ wrapped = Promise.resolve(thenable);
+
+ wrapped.then(function(){
+ calledResolved++;
+ }, function(error){
+ calledRejected++;
+ assert(calledResolved === 0, 'never resolved');
+ assert(calledRejected === 1, 'rejected only once');
+ assert(error === expectedError, 'rejected promise with x');
+ });
+
+ setTimeout(function() {
+ rejector(expectedError);
+ rejector(expectedError);
+
+ rejector('foo');
+
+ resolver('bar');
+ resolver('baz');
+ }, 20);
+
+ setTimeout(function(){
+ assert(calledRejected === 1, 'only rejected once');
+ assert(calledResolved === 0, 'never resolved');
+ done();
+ }, 50);
+ });
+
+ describe("2.3.4 If calling then throws an exception e", function(){
+ specify("2.3.4.1 If resolvePromise or rejectPromise have been called, ignore it.", function(done){
+ var expectedSuccess, resolver, rejector, thenable, wrapped, calledThis,
+ calledRejected, calledResolved;
+
+ expectedSuccess = 'success';
+
+ thenable = {
+ then: function(resolve, reject){
+ resolve(expectedSuccess);
+ throw expectedError;
+ }
+ };
+
+ wrapped = Promise.resolve(thenable);
+
+ wrapped.then(function(success){
+ assert(success === expectedSuccess, 'resolved not errored');
+ done();
+ });
+ });
+
+ specify("2.3.4.2 Otherwise, reject promise with e as the reason.", function(done) {
+ var expectedError, resolver, rejector, thenable, wrapped, calledThis, callCount;
+
+ expectedError = new Error();
+ callCount = 0;
+
+ thenable = { then: function() { throw expectedError; } };
+
+ wrapped = Promise.resolve(thenable);
+
+ wrapped.then(null, function(error){
+ callCount++;
+ assert(expectedError === error, 'expected the correct error to be rejected');
+ done();
+ });
+
+ assert(callCount === 0, 'expected async, was sync');
+ });
+ });
+ });
+
+ specify("2.4 If then is not a function, fulfill promise with x", function(done){
+ var expectedError, resolver, rejector, thenable, wrapped, calledThis, callCount;
+
+ thenable = { then: 3 };
+ callCount = 0;
+ wrapped = Promise.resolve(thenable);
+
+ wrapped.then(function(success){
+ callCount++;
+ assert(thenable === success, 'fulfilled promise with x');
+ done();
+ });
+
+ assert(callCount === 0, 'expected async, was sync');
+ });
+ });
+
+ describe("3. If x is not an object or function, ", function(){
+ specify("fulfill promise with x.", function(done){
+ var thenable, callCount, wrapped;
+
+ thenable = null;
+ callCount = 0;
+ wrapped = Promise.resolve(thenable);
+
+ wrapped.then(function(success){
+ callCount++;
+ assert(success === thenable, 'fulfilled promise with x');
+ done();
+ }, function(a){
+ assert(false, 'should not also reject');
+ });
+
+ assert(callCount === 0, 'expected async, was sync');
+ });
+ });
+ });
+
+ if (typeof Worker !== 'undefined') {
+ describe('web worker', function () {
+ it('should work', function (done) {
+ this.timeout(2000);
+ var worker = new Worker('worker.js');
+ worker.addEventListener('error', function(reason) {
+ done(new Error("Test failed:" + reason));
+ });
+ worker.addEventListener('message', function (e) {
+ worker.terminate();
+ assert.equal(e.data, 'pong');
+ done();
+ });
+ worker.postMessage('ping');
+ });
+ });
+ }
+});
+
+// thanks to @wizardwerdna for the test case -> https://github.com/tildeio/rsvp.js/issues/66
+// Only run these tests in node (phantomjs cannot handle them)
+if (typeof module !== 'undefined' && module.exports) {
+
+ describe("using reduce to sum integers using promises", function(){
+ it("should build the promise pipeline without error", function(){
+ var array, iters, pZero, i;
+
+ array = [];
+ iters = 1000;
+
+ for (i=1; i<=iters; i++) {
+ array.push(i);
+ }
+
+ pZero = Promise.resolve(0);
+
+ array.reduce(function(promise, nextVal) {
+ return promise.then(function(currentVal) {
+ return Promise.resolve(currentVal + nextVal);
+ });
+ }, pZero);
+ });
+
+ it("should get correct answer without blowing the nextTick stack", function(done){
+ var pZero, array, iters, result, i;
+
+ pZero = Promise.resolve(0);
+
+ array = [];
+ iters = 1000;
+
+ for (i=1; i<=iters; i++) {
+ array.push(i);
+ }
+
+ result = array.reduce(function(promise, nextVal) {
+ return promise.then(function(currentVal) {
+ return Promise.resolve(currentVal + nextVal);
+ });
+ }, pZero);
+
+ result.then(function(value){
+ assert.equal(value, (iters*(iters+1)/2));
+ done();
+ });
+ });
+ });
+}
+
+// Kudos to @Octane at https://github.com/getify/native-promise-only/issues/5 for this, and @getify for pinging me.
+describe("Thenables should not be able to run code during assimilation", function () {
+ specify("resolving to a thenable", function () {
+ var thenCalled = false;
+ var thenable = {
+ then: function () {
+ thenCalled = true;
+ }
+ };
+
+ Promise.resolve(thenable);
+ assert.strictEqual(thenCalled, false);
+ });
+
+ specify("resolving to an evil promise", function () {
+ var thenCalled = false;
+ var evilPromise = Promise.resolve();
+ evilPromise.then = function () {
+ thenCalled = true;
+ };
+
+ Promise.resolve(evilPromise);
+ assert.strictEqual(thenCalled, false);
+ });
+});
+
+}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
+},{"assert":2}],53:[function(require,module,exports){
+(function (global){
+var assert = require('assert');
+var g = typeof window !== 'undefined' ?
+ window : typeof global !== 'undefined' ? global : this;
+
+var Promise = g.ES6Promise || require('./es6-promise').Promise;
+
+function defer() {
+ var deferred = {};
+
+ deferred.promise = new Promise(function(resolve, reject) {
+ deferred.resolve = resolve;
+ deferred.reject = reject;
+ });
+
+ return deferred;
+}
+var resolve = Promise.resolve;
+var reject = Promise.reject;
+
+
+module.exports = g.adapter = {
+ resolved: function(a) { return Promise.resolve(a); },
+ rejected: function(a) { return Promise.reject(a); },
+ deferred: defer,
+ Promise: Promise
+};
+
+}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
+},{"./es6-promise":51,"assert":2}]},{},[1]);
diff --git a/node_modules/es6-promise/dist/test/es6-promise.js b/node_modules/es6-promise/dist/test/es6-promise.js
new file mode 100644
index 0000000000..5b096d6e6e
--- /dev/null
+++ b/node_modules/es6-promise/dist/test/es6-promise.js
@@ -0,0 +1,950 @@
+(function() {
+ "use strict";
+ function lib$es6$promise$utils$$objectOrFunction(x) {
+ return typeof x === 'function' || (typeof x === 'object' && x !== null);
+ }
+
+ function lib$es6$promise$utils$$isFunction(x) {
+ return typeof x === 'function';
+ }
+
+ function lib$es6$promise$utils$$isMaybeThenable(x) {
+ return typeof x === 'object' && x !== null;
+ }
+
+ var lib$es6$promise$utils$$_isArray;
+ if (!Array.isArray) {
+ lib$es6$promise$utils$$_isArray = function (x) {
+ return Object.prototype.toString.call(x) === '[object Array]';
+ };
+ } else {
+ lib$es6$promise$utils$$_isArray = Array.isArray;
+ }
+
+ var lib$es6$promise$utils$$isArray = lib$es6$promise$utils$$_isArray;
+ var lib$es6$promise$asap$$len = 0;
+ var lib$es6$promise$asap$$toString = {}.toString;
+ var lib$es6$promise$asap$$vertxNext;
+ function lib$es6$promise$asap$$asap(callback, arg) {
+ lib$es6$promise$asap$$queue[lib$es6$promise$asap$$len] = callback;
+ lib$es6$promise$asap$$queue[lib$es6$promise$asap$$len + 1] = arg;
+ lib$es6$promise$asap$$len += 2;
+ if (lib$es6$promise$asap$$len === 2) {
+ // If len is 2, that means that we need to schedule an async flush.
+ // If additional callbacks are queued before the queue is flushed, they
+ // will be processed by this flush that we are scheduling.
+ lib$es6$promise$asap$$scheduleFlush();
+ }
+ }
+
+ var lib$es6$promise$asap$$default = lib$es6$promise$asap$$asap;
+
+ var lib$es6$promise$asap$$browserWindow = (typeof window !== 'undefined') ? window : undefined;
+ var lib$es6$promise$asap$$browserGlobal = lib$es6$promise$asap$$browserWindow || {};
+ var lib$es6$promise$asap$$BrowserMutationObserver = lib$es6$promise$asap$$browserGlobal.MutationObserver || lib$es6$promise$asap$$browserGlobal.WebKitMutationObserver;
+ var lib$es6$promise$asap$$isNode = typeof process !== 'undefined' && {}.toString.call(process) === '[object process]';
+
+ // test for web worker but not in IE10
+ var lib$es6$promise$asap$$isWorker = typeof Uint8ClampedArray !== 'undefined' &&
+ typeof importScripts !== 'undefined' &&
+ typeof MessageChannel !== 'undefined';
+
+ // node
+ function lib$es6$promise$asap$$useNextTick() {
+ var nextTick = process.nextTick;
+ // node version 0.10.x displays a deprecation warning when nextTick is used recursively
+ // setImmediate should be used instead instead
+ var version = process.versions.node.match(/^(?:(\d+)\.)?(?:(\d+)\.)?(\*|\d+)$/);
+ if (Array.isArray(version) && version[1] === '0' && version[2] === '10') {
+ nextTick = setImmediate;
+ }
+ return function() {
+ nextTick(lib$es6$promise$asap$$flush);
+ };
+ }
+
+ // vertx
+ function lib$es6$promise$asap$$useVertxTimer() {
+ return function() {
+ lib$es6$promise$asap$$vertxNext(lib$es6$promise$asap$$flush);
+ };
+ }
+
+ function lib$es6$promise$asap$$useMutationObserver() {
+ var iterations = 0;
+ var observer = new lib$es6$promise$asap$$BrowserMutationObserver(lib$es6$promise$asap$$flush);
+ var node = document.createTextNode('');
+ observer.observe(node, { characterData: true });
+
+ return function() {
+ node.data = (iterations = ++iterations % 2);
+ };
+ }
+
+ // web worker
+ function lib$es6$promise$asap$$useMessageChannel() {
+ var channel = new MessageChannel();
+ channel.port1.onmessage = lib$es6$promise$asap$$flush;
+ return function () {
+ channel.port2.postMessage(0);
+ };
+ }
+
+ function lib$es6$promise$asap$$useSetTimeout() {
+ return function() {
+ setTimeout(lib$es6$promise$asap$$flush, 1);
+ };
+ }
+
+ var lib$es6$promise$asap$$queue = new Array(1000);
+ function lib$es6$promise$asap$$flush() {
+ for (var i = 0; i < lib$es6$promise$asap$$len; i+=2) {
+ var callback = lib$es6$promise$asap$$queue[i];
+ var arg = lib$es6$promise$asap$$queue[i+1];
+
+ callback(arg);
+
+ lib$es6$promise$asap$$queue[i] = undefined;
+ lib$es6$promise$asap$$queue[i+1] = undefined;
+ }
+
+ lib$es6$promise$asap$$len = 0;
+ }
+
+ function lib$es6$promise$asap$$attemptVertex() {
+ try {
+ var r = require;
+ var vertx = r('vertx');
+ lib$es6$promise$asap$$vertxNext = vertx.runOnLoop || vertx.runOnContext;
+ return lib$es6$promise$asap$$useVertxTimer();
+ } catch(e) {
+ return lib$es6$promise$asap$$useSetTimeout();
+ }
+ }
+
+ var lib$es6$promise$asap$$scheduleFlush;
+ // Decide what async method to use to triggering processing of queued callbacks:
+ if (lib$es6$promise$asap$$isNode) {
+ lib$es6$promise$asap$$scheduleFlush = lib$es6$promise$asap$$useNextTick();
+ } else if (lib$es6$promise$asap$$BrowserMutationObserver) {
+ lib$es6$promise$asap$$scheduleFlush = lib$es6$promise$asap$$useMutationObserver();
+ } else if (lib$es6$promise$asap$$isWorker) {
+ lib$es6$promise$asap$$scheduleFlush = lib$es6$promise$asap$$useMessageChannel();
+ } else if (lib$es6$promise$asap$$browserWindow === undefined && typeof require === 'function') {
+ lib$es6$promise$asap$$scheduleFlush = lib$es6$promise$asap$$attemptVertex();
+ } else {
+ lib$es6$promise$asap$$scheduleFlush = lib$es6$promise$asap$$useSetTimeout();
+ }
+
+ function lib$es6$promise$$internal$$noop() {}
+
+ var lib$es6$promise$$internal$$PENDING = void 0;
+ var lib$es6$promise$$internal$$FULFILLED = 1;
+ var lib$es6$promise$$internal$$REJECTED = 2;
+
+ var lib$es6$promise$$internal$$GET_THEN_ERROR = new lib$es6$promise$$internal$$ErrorObject();
+
+ function lib$es6$promise$$internal$$selfFullfillment() {
+ return new TypeError("You cannot resolve a promise with itself");
+ }
+
+ function lib$es6$promise$$internal$$cannotReturnOwn() {
+ return new TypeError('A promises callback cannot return that same promise.');
+ }
+
+ function lib$es6$promise$$internal$$getThen(promise) {
+ try {
+ return promise.then;
+ } catch(error) {
+ lib$es6$promise$$internal$$GET_THEN_ERROR.error = error;
+ return lib$es6$promise$$internal$$GET_THEN_ERROR;
+ }
+ }
+
+ function lib$es6$promise$$internal$$tryThen(then, value, fulfillmentHandler, rejectionHandler) {
+ try {
+ then.call(value, fulfillmentHandler, rejectionHandler);
+ } catch(e) {
+ return e;
+ }
+ }
+
+ function lib$es6$promise$$internal$$handleForeignThenable(promise, thenable, then) {
+ lib$es6$promise$asap$$default(function(promise) {
+ var sealed = false;
+ var error = lib$es6$promise$$internal$$tryThen(then, thenable, function(value) {
+ if (sealed) { return; }
+ sealed = true;
+ if (thenable !== value) {
+ lib$es6$promise$$internal$$resolve(promise, value);
+ } else {
+ lib$es6$promise$$internal$$fulfill(promise, value);
+ }
+ }, function(reason) {
+ if (sealed) { return; }
+ sealed = true;
+
+ lib$es6$promise$$internal$$reject(promise, reason);
+ }, 'Settle: ' + (promise._label || ' unknown promise'));
+
+ if (!sealed && error) {
+ sealed = true;
+ lib$es6$promise$$internal$$reject(promise, error);
+ }
+ }, promise);
+ }
+
+ function lib$es6$promise$$internal$$handleOwnThenable(promise, thenable) {
+ if (thenable._state === lib$es6$promise$$internal$$FULFILLED) {
+ lib$es6$promise$$internal$$fulfill(promise, thenable._result);
+ } else if (thenable._state === lib$es6$promise$$internal$$REJECTED) {
+ lib$es6$promise$$internal$$reject(promise, thenable._result);
+ } else {
+ lib$es6$promise$$internal$$subscribe(thenable, undefined, function(value) {
+ lib$es6$promise$$internal$$resolve(promise, value);
+ }, function(reason) {
+ lib$es6$promise$$internal$$reject(promise, reason);
+ });
+ }
+ }
+
+ function lib$es6$promise$$internal$$handleMaybeThenable(promise, maybeThenable) {
+ if (maybeThenable.constructor === promise.constructor) {
+ lib$es6$promise$$internal$$handleOwnThenable(promise, maybeThenable);
+ } else {
+ var then = lib$es6$promise$$internal$$getThen(maybeThenable);
+
+ if (then === lib$es6$promise$$internal$$GET_THEN_ERROR) {
+ lib$es6$promise$$internal$$reject(promise, lib$es6$promise$$internal$$GET_THEN_ERROR.error);
+ } else if (then === undefined) {
+ lib$es6$promise$$internal$$fulfill(promise, maybeThenable);
+ } else if (lib$es6$promise$utils$$isFunction(then)) {
+ lib$es6$promise$$internal$$handleForeignThenable(promise, maybeThenable, then);
+ } else {
+ lib$es6$promise$$internal$$fulfill(promise, maybeThenable);
+ }
+ }
+ }
+
+ function lib$es6$promise$$internal$$resolve(promise, value) {
+ if (promise === value) {
+ lib$es6$promise$$internal$$reject(promise, lib$es6$promise$$internal$$selfFullfillment());
+ } else if (lib$es6$promise$utils$$objectOrFunction(value)) {
+ lib$es6$promise$$internal$$handleMaybeThenable(promise, value);
+ } else {
+ lib$es6$promise$$internal$$fulfill(promise, value);
+ }
+ }
+
+ function lib$es6$promise$$internal$$publishRejection(promise) {
+ if (promise._onerror) {
+ promise._onerror(promise._result);
+ }
+
+ lib$es6$promise$$internal$$publish(promise);
+ }
+
+ function lib$es6$promise$$internal$$fulfill(promise, value) {
+ if (promise._state !== lib$es6$promise$$internal$$PENDING) { return; }
+
+ promise._result = value;
+ promise._state = lib$es6$promise$$internal$$FULFILLED;
+
+ if (promise._subscribers.length !== 0) {
+ lib$es6$promise$asap$$default(lib$es6$promise$$internal$$publish, promise);
+ }
+ }
+
+ function lib$es6$promise$$internal$$reject(promise, reason) {
+ if (promise._state !== lib$es6$promise$$internal$$PENDING) { return; }
+ promise._state = lib$es6$promise$$internal$$REJECTED;
+ promise._result = reason;
+
+ lib$es6$promise$asap$$default(lib$es6$promise$$internal$$publishRejection, promise);
+ }
+
+ function lib$es6$promise$$internal$$subscribe(parent, child, onFulfillment, onRejection) {
+ var subscribers = parent._subscribers;
+ var length = subscribers.length;
+
+ parent._onerror = null;
+
+ subscribers[length] = child;
+ subscribers[length + lib$es6$promise$$internal$$FULFILLED] = onFulfillment;
+ subscribers[length + lib$es6$promise$$internal$$REJECTED] = onRejection;
+
+ if (length === 0 && parent._state) {
+ lib$es6$promise$asap$$default(lib$es6$promise$$internal$$publish, parent);
+ }
+ }
+
+ function lib$es6$promise$$internal$$publish(promise) {
+ var subscribers = promise._subscribers;
+ var settled = promise._state;
+
+ if (subscribers.length === 0) { return; }
+
+ var child, callback, detail = promise._result;
+
+ for (var i = 0; i < subscribers.length; i += 3) {
+ child = subscribers[i];
+ callback = subscribers[i + settled];
+
+ if (child) {
+ lib$es6$promise$$internal$$invokeCallback(settled, child, callback, detail);
+ } else {
+ callback(detail);
+ }
+ }
+
+ promise._subscribers.length = 0;
+ }
+
+ function lib$es6$promise$$internal$$ErrorObject() {
+ this.error = null;
+ }
+
+ var lib$es6$promise$$internal$$TRY_CATCH_ERROR = new lib$es6$promise$$internal$$ErrorObject();
+
+ function lib$es6$promise$$internal$$tryCatch(callback, detail) {
+ try {
+ return callback(detail);
+ } catch(e) {
+ lib$es6$promise$$internal$$TRY_CATCH_ERROR.error = e;
+ return lib$es6$promise$$internal$$TRY_CATCH_ERROR;
+ }
+ }
+
+ function lib$es6$promise$$internal$$invokeCallback(settled, promise, callback, detail) {
+ var hasCallback = lib$es6$promise$utils$$isFunction(callback),
+ value, error, succeeded, failed;
+
+ if (hasCallback) {
+ value = lib$es6$promise$$internal$$tryCatch(callback, detail);
+
+ if (value === lib$es6$promise$$internal$$TRY_CATCH_ERROR) {
+ failed = true;
+ error = value.error;
+ value = null;
+ } else {
+ succeeded = true;
+ }
+
+ if (promise === value) {
+ lib$es6$promise$$internal$$reject(promise, lib$es6$promise$$internal$$cannotReturnOwn());
+ return;
+ }
+
+ } else {
+ value = detail;
+ succeeded = true;
+ }
+
+ if (promise._state !== lib$es6$promise$$internal$$PENDING) {
+ // noop
+ } else if (hasCallback && succeeded) {
+ lib$es6$promise$$internal$$resolve(promise, value);
+ } else if (failed) {
+ lib$es6$promise$$internal$$reject(promise, error);
+ } else if (settled === lib$es6$promise$$internal$$FULFILLED) {
+ lib$es6$promise$$internal$$fulfill(promise, value);
+ } else if (settled === lib$es6$promise$$internal$$REJECTED) {
+ lib$es6$promise$$internal$$reject(promise, value);
+ }
+ }
+
+ function lib$es6$promise$$internal$$initializePromise(promise, resolver) {
+ try {
+ resolver(function resolvePromise(value){
+ lib$es6$promise$$internal$$resolve(promise, value);
+ }, function rejectPromise(reason) {
+ lib$es6$promise$$internal$$reject(promise, reason);
+ });
+ } catch(e) {
+ lib$es6$promise$$internal$$reject(promise, e);
+ }
+ }
+
+ function lib$es6$promise$enumerator$$Enumerator(Constructor, input) {
+ var enumerator = this;
+
+ enumerator._instanceConstructor = Constructor;
+ enumerator.promise = new Constructor(lib$es6$promise$$internal$$noop);
+
+ if (enumerator._validateInput(input)) {
+ enumerator._input = input;
+ enumerator.length = input.length;
+ enumerator._remaining = input.length;
+
+ enumerator._init();
+
+ if (enumerator.length === 0) {
+ lib$es6$promise$$internal$$fulfill(enumerator.promise, enumerator._result);
+ } else {
+ enumerator.length = enumerator.length || 0;
+ enumerator._enumerate();
+ if (enumerator._remaining === 0) {
+ lib$es6$promise$$internal$$fulfill(enumerator.promise, enumerator._result);
+ }
+ }
+ } else {
+ lib$es6$promise$$internal$$reject(enumerator.promise, enumerator._validationError());
+ }
+ }
+
+ lib$es6$promise$enumerator$$Enumerator.prototype._validateInput = function(input) {
+ return lib$es6$promise$utils$$isArray(input);
+ };
+
+ lib$es6$promise$enumerator$$Enumerator.prototype._validationError = function() {
+ return new Error('Array Methods must be provided an Array');
+ };
+
+ lib$es6$promise$enumerator$$Enumerator.prototype._init = function() {
+ this._result = new Array(this.length);
+ };
+
+ var lib$es6$promise$enumerator$$default = lib$es6$promise$enumerator$$Enumerator;
+
+ lib$es6$promise$enumerator$$Enumerator.prototype._enumerate = function() {
+ var enumerator = this;
+
+ var length = enumerator.length;
+ var promise = enumerator.promise;
+ var input = enumerator._input;
+
+ for (var i = 0; promise._state === lib$es6$promise$$internal$$PENDING && i < length; i++) {
+ enumerator._eachEntry(input[i], i);
+ }
+ };
+
+ lib$es6$promise$enumerator$$Enumerator.prototype._eachEntry = function(entry, i) {
+ var enumerator = this;
+ var c = enumerator._instanceConstructor;
+
+ if (lib$es6$promise$utils$$isMaybeThenable(entry)) {
+ if (entry.constructor === c && entry._state !== lib$es6$promise$$internal$$PENDING) {
+ entry._onerror = null;
+ enumerator._settledAt(entry._state, i, entry._result);
+ } else {
+ enumerator._willSettleAt(c.resolve(entry), i);
+ }
+ } else {
+ enumerator._remaining--;
+ enumerator._result[i] = entry;
+ }
+ };
+
+ lib$es6$promise$enumerator$$Enumerator.prototype._settledAt = function(state, i, value) {
+ var enumerator = this;
+ var promise = enumerator.promise;
+
+ if (promise._state === lib$es6$promise$$internal$$PENDING) {
+ enumerator._remaining--;
+
+ if (state === lib$es6$promise$$internal$$REJECTED) {
+ lib$es6$promise$$internal$$reject(promise, value);
+ } else {
+ enumerator._result[i] = value;
+ }
+ }
+
+ if (enumerator._remaining === 0) {
+ lib$es6$promise$$internal$$fulfill(promise, enumerator._result);
+ }
+ };
+
+ lib$es6$promise$enumerator$$Enumerator.prototype._willSettleAt = function(promise, i) {
+ var enumerator = this;
+
+ lib$es6$promise$$internal$$subscribe(promise, undefined, function(value) {
+ enumerator._settledAt(lib$es6$promise$$internal$$FULFILLED, i, value);
+ }, function(reason) {
+ enumerator._settledAt(lib$es6$promise$$internal$$REJECTED, i, reason);
+ });
+ };
+ function lib$es6$promise$promise$all$$all(entries) {
+ return new lib$es6$promise$enumerator$$default(this, entries).promise;
+ }
+ var lib$es6$promise$promise$all$$default = lib$es6$promise$promise$all$$all;
+ function lib$es6$promise$promise$race$$race(entries) {
+ /*jshint validthis:true */
+ var Constructor = this;
+
+ var promise = new Constructor(lib$es6$promise$$internal$$noop);
+
+ if (!lib$es6$promise$utils$$isArray(entries)) {
+ lib$es6$promise$$internal$$reject(promise, new TypeError('You must pass an array to race.'));
+ return promise;
+ }
+
+ var length = entries.length;
+
+ function onFulfillment(value) {
+ lib$es6$promise$$internal$$resolve(promise, value);
+ }
+
+ function onRejection(reason) {
+ lib$es6$promise$$internal$$reject(promise, reason);
+ }
+
+ for (var i = 0; promise._state === lib$es6$promise$$internal$$PENDING && i < length; i++) {
+ lib$es6$promise$$internal$$subscribe(Constructor.resolve(entries[i]), undefined, onFulfillment, onRejection);
+ }
+
+ return promise;
+ }
+ var lib$es6$promise$promise$race$$default = lib$es6$promise$promise$race$$race;
+ function lib$es6$promise$promise$resolve$$resolve(object) {
+ /*jshint validthis:true */
+ var Constructor = this;
+
+ if (object && typeof object === 'object' && object.constructor === Constructor) {
+ return object;
+ }
+
+ var promise = new Constructor(lib$es6$promise$$internal$$noop);
+ lib$es6$promise$$internal$$resolve(promise, object);
+ return promise;
+ }
+ var lib$es6$promise$promise$resolve$$default = lib$es6$promise$promise$resolve$$resolve;
+ function lib$es6$promise$promise$reject$$reject(reason) {
+ /*jshint validthis:true */
+ var Constructor = this;
+ var promise = new Constructor(lib$es6$promise$$internal$$noop);
+ lib$es6$promise$$internal$$reject(promise, reason);
+ return promise;
+ }
+ var lib$es6$promise$promise$reject$$default = lib$es6$promise$promise$reject$$reject;
+
+ var lib$es6$promise$promise$$counter = 0;
+
+ function lib$es6$promise$promise$$needsResolver() {
+ throw new TypeError('You must pass a resolver function as the first argument to the promise constructor');
+ }
+
+ function lib$es6$promise$promise$$needsNew() {
+ throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.");
+ }
+
+ var lib$es6$promise$promise$$default = lib$es6$promise$promise$$Promise;
+ /**
+ Promise objects represent the eventual result of an asynchronous operation. The
+ primary way of interacting with a promise is through its `then` method, which
+ registers callbacks to receive either a promise’s eventual value or the reason
+ why the promise cannot be fulfilled.
+
+ Terminology
+ -----------
+
+ - `promise` is an object or function with a `then` method whose behavior conforms to this specification.
+ - `thenable` is an object or function that defines a `then` method.
+ - `value` is any legal JavaScript value (including undefined, a thenable, or a promise).
+ - `exception` is a value that is thrown using the throw statement.
+ - `reason` is a value that indicates why a promise was rejected.
+ - `settled` the final resting state of a promise, fulfilled or rejected.
+
+ A promise can be in one of three states: pending, fulfilled, or rejected.
+
+ Promises that are fulfilled have a fulfillment value and are in the fulfilled
+ state. Promises that are rejected have a rejection reason and are in the
+ rejected state. A fulfillment value is never a thenable.
+
+ Promises can also be said to *resolve* a value. If this value is also a
+ promise, then the original promise's settled state will match the value's
+ settled state. So a promise that *resolves* a promise that rejects will
+ itself reject, and a promise that *resolves* a promise that fulfills will
+ itself fulfill.
+
+
+ Basic Usage:
+ ------------
+
+ ```js
+ var promise = new Promise(function(resolve, reject) {
+ // on success
+ resolve(value);
+
+ // on failure
+ reject(reason);
+ });
+
+ promise.then(function(value) {
+ // on fulfillment
+ }, function(reason) {
+ // on rejection
+ });
+ ```
+
+ Advanced Usage:
+ ---------------
+
+ Promises shine when abstracting away asynchronous interactions such as
+ `XMLHttpRequest`s.
+
+ ```js
+ function getJSON(url) {
+ return new Promise(function(resolve, reject){
+ var xhr = new XMLHttpRequest();
+
+ xhr.open('GET', url);
+ xhr.onreadystatechange = handler;
+ xhr.responseType = 'json';
+ xhr.setRequestHeader('Accept', 'application/json');
+ xhr.send();
+
+ function handler() {
+ if (this.readyState === this.DONE) {
+ if (this.status === 200) {
+ resolve(this.response);
+ } else {
+ reject(new Error('getJSON: `' + url + '` failed with status: [' + this.status + ']'));
+ }
+ }
+ };
+ });
+ }
+
+ getJSON('/posts.json').then(function(json) {
+ // on fulfillment
+ }, function(reason) {
+ // on rejection
+ });
+ ```
+
+ Unlike callbacks, promises are great composable primitives.
+
+ ```js
+ Promise.all([
+ getJSON('/posts'),
+ getJSON('/comments')
+ ]).then(function(values){
+ values[0] // => postsJSON
+ values[1] // => commentsJSON
+
+ return values;
+ });
+ ```
+
+ @class Promise
+ @param {function} resolver
+ Useful for tooling.
+ @constructor
+ */
+ function lib$es6$promise$promise$$Promise(resolver) {
+ this._id = lib$es6$promise$promise$$counter++;
+ this._state = undefined;
+ this._result = undefined;
+ this._subscribers = [];
+
+ if (lib$es6$promise$$internal$$noop !== resolver) {
+ if (!lib$es6$promise$utils$$isFunction(resolver)) {
+ lib$es6$promise$promise$$needsResolver();
+ }
+
+ if (!(this instanceof lib$es6$promise$promise$$Promise)) {
+ lib$es6$promise$promise$$needsNew();
+ }
+
+ lib$es6$promise$$internal$$initializePromise(this, resolver);
+ }
+ }
+
+ lib$es6$promise$promise$$Promise.all = lib$es6$promise$promise$all$$default;
+ lib$es6$promise$promise$$Promise.race = lib$es6$promise$promise$race$$default;
+ lib$es6$promise$promise$$Promise.resolve = lib$es6$promise$promise$resolve$$default;
+ lib$es6$promise$promise$$Promise.reject = lib$es6$promise$promise$reject$$default;
+
+ lib$es6$promise$promise$$Promise.prototype = {
+ constructor: lib$es6$promise$promise$$Promise,
+
+ /**
+ The primary way of interacting with a promise is through its `then` method,
+ which registers callbacks to receive either a promise's eventual value or the
+ reason why the promise cannot be fulfilled.
+
+ ```js
+ findUser().then(function(user){
+ // user is available
+ }, function(reason){
+ // user is unavailable, and you are given the reason why
+ });
+ ```
+
+ Chaining
+ --------
+
+ The return value of `then` is itself a promise. This second, 'downstream'
+ promise is resolved with the return value of the first promise's fulfillment
+ or rejection handler, or rejected if the handler throws an exception.
+
+ ```js
+ findUser().then(function (user) {
+ return user.name;
+ }, function (reason) {
+ return 'default name';
+ }).then(function (userName) {
+ // If `findUser` fulfilled, `userName` will be the user's name, otherwise it
+ // will be `'default name'`
+ });
+
+ findUser().then(function (user) {
+ throw new Error('Found user, but still unhappy');
+ }, function (reason) {
+ throw new Error('`findUser` rejected and we're unhappy');
+ }).then(function (value) {
+ // never reached
+ }, function (reason) {
+ // if `findUser` fulfilled, `reason` will be 'Found user, but still unhappy'.
+ // If `findUser` rejected, `reason` will be '`findUser` rejected and we're unhappy'.
+ });
+ ```
+ If the downstream promise does not specify a rejection handler, rejection reasons will be propagated further downstream.
+
+ ```js
+ findUser().then(function (user) {
+ throw new PedagogicalException('Upstream error');
+ }).then(function (value) {
+ // never reached
+ }).then(function (value) {
+ // never reached
+ }, function (reason) {
+ // The `PedgagocialException` is propagated all the way down to here
+ });
+ ```
+
+ Assimilation
+ ------------
+
+ Sometimes the value you want to propagate to a downstream promise can only be
+ retrieved asynchronously. This can be achieved by returning a promise in the
+ fulfillment or rejection handler. The downstream promise will then be pending
+ until the returned promise is settled. This is called *assimilation*.
+
+ ```js
+ findUser().then(function (user) {
+ return findCommentsByAuthor(user);
+ }).then(function (comments) {
+ // The user's comments are now available
+ });
+ ```
+
+ If the assimliated promise rejects, then the downstream promise will also reject.
+
+ ```js
+ findUser().then(function (user) {
+ return findCommentsByAuthor(user);
+ }).then(function (comments) {
+ // If `findCommentsByAuthor` fulfills, we'll have the value here
+ }, function (reason) {
+ // If `findCommentsByAuthor` rejects, we'll have the reason here
+ });
+ ```
+
+ Simple Example
+ --------------
+
+ Synchronous Example
+
+ ```javascript
+ var result;
+
+ try {
+ result = findResult();
+ // success
+ } catch(reason) {
+ // failure
+ }
+ ```
+
+ Errback Example
+
+ ```js
+ findResult(function(result, err){
+ if (err) {
+ // failure
+ } else {
+ // success
+ }
+ });
+ ```
+
+ Promise Example;
+
+ ```javascript
+ findResult().then(function(result){
+ // success
+ }, function(reason){
+ // failure
+ });
+ ```
+
+ Advanced Example
+ --------------
+
+ Synchronous Example
+
+ ```javascript
+ var author, books;
+
+ try {
+ author = findAuthor();
+ books = findBooksByAuthor(author);
+ // success
+ } catch(reason) {
+ // failure
+ }
+ ```
+
+ Errback Example
+
+ ```js
+
+ function foundBooks(books) {
+
+ }
+
+ function failure(reason) {
+
+ }
+
+ findAuthor(function(author, err){
+ if (err) {
+ failure(err);
+ // failure
+ } else {
+ try {
+ findBoooksByAuthor(author, function(books, err) {
+ if (err) {
+ failure(err);
+ } else {
+ try {
+ foundBooks(books);
+ } catch(reason) {
+ failure(reason);
+ }
+ }
+ });
+ } catch(error) {
+ failure(err);
+ }
+ // success
+ }
+ });
+ ```
+
+ Promise Example;
+
+ ```javascript
+ findAuthor().
+ then(findBooksByAuthor).
+ then(function(books){
+ // found books
+ }).catch(function(reason){
+ // something went wrong
+ });
+ ```
+
+ @method then
+ @param {Function} onFulfilled
+ @param {Function} onRejected
+ Useful for tooling.
+ @return {Promise}
+ */
+ then: function(onFulfillment, onRejection) {
+ var parent = this;
+ var state = parent._state;
+
+ if (state === lib$es6$promise$$internal$$FULFILLED && !onFulfillment || state === lib$es6$promise$$internal$$REJECTED && !onRejection) {
+ return this;
+ }
+
+ var child = new this.constructor(lib$es6$promise$$internal$$noop);
+ var result = parent._result;
+
+ if (state) {
+ var callback = arguments[state - 1];
+ lib$es6$promise$asap$$default(function(){
+ lib$es6$promise$$internal$$invokeCallback(state, child, callback, result);
+ });
+ } else {
+ lib$es6$promise$$internal$$subscribe(parent, child, onFulfillment, onRejection);
+ }
+
+ return child;
+ },
+
+ /**
+ `catch` is simply sugar for `then(undefined, onRejection)` which makes it the same
+ as the catch block of a try/catch statement.
+
+ ```js
+ function findAuthor(){
+ throw new Error('couldn't find that author');
+ }
+
+ // synchronous
+ try {
+ findAuthor();
+ } catch(reason) {
+ // something went wrong
+ }
+
+ // async with promises
+ findAuthor().catch(function(reason){
+ // something went wrong
+ });
+ ```
+
+ @method catch
+ @param {Function} onRejection
+ Useful for tooling.
+ @return {Promise}
+ */
+ 'catch': function(onRejection) {
+ return this.then(null, onRejection);
+ }
+ };
+ function lib$es6$promise$polyfill$$polyfill() {
+ var local;
+
+ if (typeof global !== 'undefined') {
+ local = global;
+ } else if (typeof self !== 'undefined') {
+ local = self;
+ } else {
+ try {
+ local = Function('return this')();
+ } catch (e) {
+ throw new Error('polyfill failed because global object is unavailable in this environment');
+ }
+ }
+
+ var P = local.Promise;
+
+ if (P && Object.prototype.toString.call(P.resolve()) === '[object Promise]' && !P.cast) {
+ return;
+ }
+
+ local.Promise = lib$es6$promise$promise$$default;
+ }
+ var lib$es6$promise$polyfill$$default = lib$es6$promise$polyfill$$polyfill;
+
+ var lib$es6$promise$umd$$ES6Promise = {
+ 'Promise': lib$es6$promise$promise$$default,
+ 'polyfill': lib$es6$promise$polyfill$$default
+ };
+
+ /* global define:true module:true window: true */
+ if (typeof define === 'function' && define['amd']) {
+ define(function() { return lib$es6$promise$umd$$ES6Promise; });
+ } else if (typeof module !== 'undefined' && module['exports']) {
+ module['exports'] = lib$es6$promise$umd$$ES6Promise;
+ } else if (typeof this !== 'undefined') {
+ this['ES6Promise'] = lib$es6$promise$umd$$ES6Promise;
+ }
+
+ lib$es6$promise$polyfill$$default();
+}).call(this);
+
+//# sourceMappingURL=es6-promise.js.map
\ No newline at end of file
diff --git a/node_modules/es6-promise/dist/test/es6-promise.min.js b/node_modules/es6-promise/dist/test/es6-promise.min.js
new file mode 100644
index 0000000000..34a1f52b8c
--- /dev/null
+++ b/node_modules/es6-promise/dist/test/es6-promise.min.js
@@ -0,0 +1 @@
+(function(){"use strict";function lib$es6$promise$utils$$objectOrFunction(x){return typeof x==="function"||typeof x==="object"&&x!==null}function lib$es6$promise$utils$$isFunction(x){return typeof x==="function"}function lib$es6$promise$utils$$isMaybeThenable(x){return typeof x==="object"&&x!==null}var lib$es6$promise$utils$$_isArray;if(!Array.isArray){lib$es6$promise$utils$$_isArray=function(x){return Object.prototype.toString.call(x)==="[object Array]"}}else{lib$es6$promise$utils$$_isArray=Array.isArray}var lib$es6$promise$utils$$isArray=lib$es6$promise$utils$$_isArray;var lib$es6$promise$asap$$len=0;var lib$es6$promise$asap$$toString={}.toString;var lib$es6$promise$asap$$vertxNext;function lib$es6$promise$asap$$asap(callback,arg){lib$es6$promise$asap$$queue[lib$es6$promise$asap$$len]=callback;lib$es6$promise$asap$$queue[lib$es6$promise$asap$$len+1]=arg;lib$es6$promise$asap$$len+=2;if(lib$es6$promise$asap$$len===2){lib$es6$promise$asap$$scheduleFlush()}}var lib$es6$promise$asap$$default=lib$es6$promise$asap$$asap;var lib$es6$promise$asap$$browserWindow=typeof window!=="undefined"?window:undefined;var lib$es6$promise$asap$$browserGlobal=lib$es6$promise$asap$$browserWindow||{};var lib$es6$promise$asap$$BrowserMutationObserver=lib$es6$promise$asap$$browserGlobal.MutationObserver||lib$es6$promise$asap$$browserGlobal.WebKitMutationObserver;var lib$es6$promise$asap$$isNode=typeof process!=="undefined"&&{}.toString.call(process)==="[object process]";var lib$es6$promise$asap$$isWorker=typeof Uint8ClampedArray!=="undefined"&&typeof importScripts!=="undefined"&&typeof MessageChannel!=="undefined";function lib$es6$promise$asap$$useNextTick(){var nextTick=process.nextTick;var version=process.versions.node.match(/^(?:(\d+)\.)?(?:(\d+)\.)?(\*|\d+)$/);if(Array.isArray(version)&&version[1]==="0"&&version[2]==="10"){nextTick=setImmediate}return function(){nextTick(lib$es6$promise$asap$$flush)}}function lib$es6$promise$asap$$useVertxTimer(){return function(){lib$es6$promise$asap$$vertxNext(lib$es6$promise$asap$$flush)}}function lib$es6$promise$asap$$useMutationObserver(){var iterations=0;var observer=new lib$es6$promise$asap$$BrowserMutationObserver(lib$es6$promise$asap$$flush);var node=document.createTextNode("");observer.observe(node,{characterData:true});return function(){node.data=iterations=++iterations%2}}function lib$es6$promise$asap$$useMessageChannel(){var channel=new MessageChannel;channel.port1.onmessage=lib$es6$promise$asap$$flush;return function(){channel.port2.postMessage(0)}}function lib$es6$promise$asap$$useSetTimeout(){return function(){setTimeout(lib$es6$promise$asap$$flush,1)}}var lib$es6$promise$asap$$queue=new Array(1e3);function lib$es6$promise$asap$$flush(){for(var i=0;i
+
+
+ rsvp.js Tests
+
+
+
+
+
+
+
+
+
+
+
+