From c7faec45104b3d2d823db894e0f768d978eec800 Mon Sep 17 00:00:00 2001 From: aamadeo27 Date: Sat, 25 Aug 2018 19:28:05 -0400 Subject: [PATCH 1/9] Use Promises. Reconnect. Hashinator. Volttables as Params. More Tests. --- examples/voter/voter/.gitignore | 2 + examples/voter/voter/app.js | 22 +- examples/voter/voter/jsons/votes.js | 12 +- examples/voter/voter/models/volt.js | 128 +- examples/voter/voter/package.json | 16 +- .../public/javascripts/jquery-1.7.1.min.js | 6 +- .../jquery-ui-1.8.17.custom.min.js | 54 +- examples/voter/voter/routes/index.js | 6 +- lib/client.js | 237 +- lib/configuration.js | 16 +- lib/connection.js | 269 +- lib/ctio.js | 1263 +++--- lib/ctype.js | 270 +- lib/hashinator.js | 115 + lib/message.js | 33 +- lib/parser.js | 380 +- lib/query.js | 20 +- lib/voltconstants.js | 229 +- lib/volttable.js | 236 + package-lock.json | 3852 ----------------- package.json | 11 +- test/cases/bufferTest.js | 206 +- test/cases/clientaffinity.js | 109 + test/cases/connections.js | 167 +- test/cases/typestest.js | 154 +- test/cases/updateClassesTest.js | 105 + test/cases/volttableTest.js | 165 + test/config.js | 15 + test/testrunner.js | 39 +- test/util/docker-util.js | 8 +- test/util/test-context.js | 2 +- tools/testdb/run.sh | 4 +- .../test/typetest/proc/InitTestType.java | 4 +- .../com/voltdb/test/typetest/proc/Insert.java | 4 +- .../volttabletest/proc/VoltTableTest.java | 70 + voternoui.js | 396 +- writer.js | 138 +- 37 files changed, 3061 insertions(+), 5702 deletions(-) create mode 100644 examples/voter/voter/.gitignore create mode 100644 lib/hashinator.js create mode 100644 lib/volttable.js delete mode 100644 package-lock.json create mode 100644 test/cases/clientaffinity.js create mode 100644 test/cases/updateClassesTest.js create mode 100644 test/cases/volttableTest.js create mode 100644 test/config.js create mode 100644 tools/testdb/src/com/voltdb/test/volttabletest/proc/VoltTableTest.java diff --git a/examples/voter/voter/.gitignore b/examples/voter/voter/.gitignore new file mode 100644 index 0000000..d502512 --- /dev/null +++ b/examples/voter/voter/.gitignore @@ -0,0 +1,2 @@ +/node_modules +/package-lock.json diff --git a/examples/voter/voter/app.js b/examples/voter/voter/app.js index e079c04..79434ca 100644 --- a/examples/voter/voter/app.js +++ b/examples/voter/voter/app.js @@ -33,10 +33,10 @@ * client code. */ -var express = require('express'), -routes = require('./routes'), volt = require('./models/volt'), -votes = require('./jsons/votes'), util = require('util'), -cluster = require('cluster'), numCPUs = require('os').cpus().length; +var express = require("express"), + routes = require("./routes"), volt = require("./models/volt"), + votes = require("./jsons/votes"), util = require("util"), + cluster = require("cluster"), numCPUs = require("os").cpus().length; function webserverProcess() { var app = module.exports = express.createServer(); @@ -44,27 +44,27 @@ function webserverProcess() { // Configuration app.configure(function() { - app.set('views', __dirname + '/views'); - app.set('view engine', 'jade'); + app.set("views", __dirname + "/views"); + app.set("view engine", "jade"); app.use(express.bodyParser()); app.use(express.methodOverride()); app.use(app.router); - app.use(express.static(__dirname + '/public')); + app.use(express.static(__dirname + "/public")); }); - app.configure('production', function() { + app.configure("production", function() { app.use(express.errorHandler({ dumpExceptions : true, showStack : true })); }); - app.configure('production', function() { + app.configure("production", function() { app.use(express.errorHandler()); }); // Routes - app.get('/', routes.index); - app.get('/results', votes.votes); + app.get("/", routes.index); + app.get("/results", votes.votes); app.listen(3000); diff --git a/examples/voter/voter/jsons/votes.js b/examples/voter/voter/jsons/votes.js index 87ea59d..1138161 100644 --- a/examples/voter/voter/jsons/votes.js +++ b/examples/voter/voter/jsons/votes.js @@ -22,18 +22,18 @@ */ var volt = require("../models/volt"), -VoltConstants = require(__dirname + '/../../../../lib/voltconstants'); + VoltConstants = require(__dirname + "/../../../../lib/voltconstants"); exports.votes = function(req, res) { - return volt.getVoteResults(function displayResults(code, event, results) { - if(code == VoltConstants.STATUS_CODES.SUCCESS) { + return volt.getVoteResults().then(function displayResults({code, results}) { + if(code === VoltConstants.STATUS_CODES.SUCCESS && results.status === VoltConstants.RESULT_STATUS.SUCCESS) { res.json({ - 'rows' : results.table[0] + "rows" : results.table[0].data.map( row => Object.assign(row, { TOTAL_VOTES : row.TOTAL_VOTES.toString()}) ) }); } else { res.json({ - 'critical fault, database down': 500 + "critical fault, database down": 500 }); } }); -} \ No newline at end of file +}; \ No newline at end of file diff --git a/examples/voter/voter/models/volt.js b/examples/voter/voter/models/volt.js index c49fc5d..0614f21 100644 --- a/examples/voter/voter/models/volt.js +++ b/examples/voter/voter/models/volt.js @@ -30,37 +30,37 @@ * 3. Invokes stored procedures and processes the results. */ -var util = require('util'); -var cluster = require('cluster'); +var util = require("util"); +require("cluster"); // VoltClient manages all communication with VoltDB -var VoltClient = require(__dirname + '/../../../../lib/client'); +var VoltClient = require(__dirname + "/../../../../lib/client"); // VoltConstants has all the event types, codes and other constants // that the client and your code will rely upon -var VoltConstants = require(__dirname + '/../../../../lib/voltconstants'); +var VoltConstants = require(__dirname + "/../../../../lib/voltconstants"); // VoltConfiguration sets up the configuration for each VoltDB server // in your cluster. If you have ten Volt nodes in the cluster, then you should // create ten configurations. These configurations are used in the construction // of the client. -var VoltConfiguration = require(__dirname + '/../../../../lib/configuration'); +var VoltConfiguration = require(__dirname + "/../../../../lib/configuration"); // VoltProcedure is a static representation of the stored procedure and // specifies the procedure's name and the parameter types. The parameter types // are especially important since they define how the client will marshal the // the parameters. -var VoltProcedure = require(__dirname + '/../../../../lib/query'); +var VoltProcedure = require(__dirname + "/../../../../lib/query"); // VoltQuery is a specific instance of a VoltProcedure. Your code will // always call stored procedures using a VoltQuery object. -var VoltQuery = require(__dirname + '/../../../../lib/query'); +//var VoltQuery = require(__dirname + "/../../../../lib/query"); // These are a set of stored procedure definitions. // See VoltConstants to see the data types supported by the driver. -var resultsProc = new VoltProcedure('Results'); -var initProc = new VoltProcedure('Initialize', ['int', 'string']); -var voteProc = new VoltProcedure('Vote', ['long', 'int', 'long']); +var resultsProc = new VoltProcedure("Results"); +var initProc = new VoltProcedure("Initialize", ["int", "string"]); +var voteProc = new VoltProcedure("Vote", ["long", "int", "long"]); // The following is just application specific data var client = null; @@ -69,29 +69,29 @@ var transactionCounter = 0; var statsLoggingInterval = 10000; var area_codes = [907, 205, 256, 334, 251, 870, 501, 479, 480, 602, 623, 928, -520, 341, 764, 628, 831, 925, 909, 562, 661, 510, 650, 949, 760, 415, 951, 209, -669, 408, 559, 626, 442, 530, 916, 627, 714, 707, 310, 323, 213, 424, 747, 818, -858, 935, 619, 805, 369, 720, 303, 970, 719, 860, 203, 959, 475, 202, 302, 689, -407, 239, 850, 727, 321, 754, 954, 927, 352, 863, 386, 904, 561, 772, 786, 305, -941, 813, 478, 770, 470, 404, 762, 706, 678, 912, 229, 808, 515, 319, 563, 641, -712, 208, 217, 872, 312, 773, 464, 708, 224, 847, 779, 815, 618, 309, 331, 630, -317, 765, 574, 260, 219, 812, 913, 785, 316, 620, 606, 859, 502, 270, 504, 985, -225, 318, 337, 774, 508, 339, 781, 857, 617, 978, 351, 413, 443, 410, 301, 240, -207, 517, 810, 278, 679, 313, 586, 947, 248, 734, 269, 989, 906, 616, 231, 612, -320, 651, 763, 952, 218, 507, 636, 660, 975, 816, 573, 314, 557, 417, 769, 601, -662, 228, 406, 336, 252, 984, 919, 980, 910, 828, 704, 701, 402, 308, 603, 908, -848, 732, 551, 201, 862, 973, 609, 856, 575, 957, 505, 775, 702, 315, 518, 646, -347, 212, 718, 516, 917, 845, 631, 716, 585, 607, 914, 216, 330, 234, 567, 419, -440, 380, 740, 614, 283, 513, 937, 918, 580, 405, 503, 541, 971, 814, 717, 570, -878, 835, 484, 610, 267, 215, 724, 412, 401, 843, 864, 803, 605, 423, 865, 931, -615, 901, 731, 254, 325, 713, 940, 817, 430, 903, 806, 737, 512, 361, 210, 979, -936, 409, 972, 469, 214, 682, 832, 281, 830, 956, 432, 915, 435, 801, 385, 434, -804, 757, 703, 571, 276, 236, 540, 802, 509, 360, 564, 206, 425, 253, 715, 920, -262, 414, 608, 304, 307]; - -var voteCandidates = 'Edwina Burnam,Tabatha Gehling,Kelly Clauss,' + -'Jessie Alloway,Alana Bregman,Jessie Eichman,Allie Rogalski,Nita Coster,' + -'Kurt Walser,Ericka Dieter,Loraine NygrenTania Mattioli'; + 520, 341, 764, 628, 831, 925, 909, 562, 661, 510, 650, 949, 760, 415, 951, 209, + 669, 408, 559, 626, 442, 530, 916, 627, 714, 707, 310, 323, 213, 424, 747, 818, + 858, 935, 619, 805, 369, 720, 303, 970, 719, 860, 203, 959, 475, 202, 302, 689, + 407, 239, 850, 727, 321, 754, 954, 927, 352, 863, 386, 904, 561, 772, 786, 305, + 941, 813, 478, 770, 470, 404, 762, 706, 678, 912, 229, 808, 515, 319, 563, 641, + 712, 208, 217, 872, 312, 773, 464, 708, 224, 847, 779, 815, 618, 309, 331, 630, + 317, 765, 574, 260, 219, 812, 913, 785, 316, 620, 606, 859, 502, 270, 504, 985, + 225, 318, 337, 774, 508, 339, 781, 857, 617, 978, 351, 413, 443, 410, 301, 240, + 207, 517, 810, 278, 679, 313, 586, 947, 248, 734, 269, 989, 906, 616, 231, 612, + 320, 651, 763, 952, 218, 507, 636, 660, 975, 816, 573, 314, 557, 417, 769, 601, + 662, 228, 406, 336, 252, 984, 919, 980, 910, 828, 704, 701, 402, 308, 603, 908, + 848, 732, 551, 201, 862, 973, 609, 856, 575, 957, 505, 775, 702, 315, 518, 646, + 347, 212, 718, 516, 917, 845, 631, 716, 585, 607, 914, 216, 330, 234, 567, 419, + 440, 380, 740, 614, 283, 513, 937, 918, 580, 405, 503, 541, 971, 814, 717, 570, + 878, 835, 484, 610, 267, 215, 724, 412, 401, 843, 864, 803, 605, 423, 865, 931, + 615, 901, 731, 254, 325, 713, 940, 817, 430, 903, 806, 737, 512, 361, 210, 979, + 936, 409, 972, 469, 214, 682, 832, 281, 830, 956, 432, 915, 435, 801, 385, 434, + 804, 757, 703, 571, 276, 236, 540, 802, 509, 360, 564, 206, 425, 253, 715, 920, + 262, 414, 608, 304, 307]; + +var voteCandidates = "Edwina Burnam,Tabatha Gehling,Kelly Clauss," + +"Jessie Alloway,Alana Bregman,Jessie Eichman,Allie Rogalski,Nita Coster," + +"Kurt Walser,Ericka Dieter,Loraine NygrenTania Mattioli"; function getCandidate() { return Math.floor(Math.random() * 6) + 1; @@ -105,7 +105,7 @@ function getAreaCode() { // This will initialize the Voter database by invoking a stored procedure. function voltInit() { - util.log('voltInit'); + util.log("voltInit"); // Start by creating a query instance from the VoltProcedure var query = initProc.getQuery(); @@ -121,10 +121,12 @@ function voltInit() { // VoltConstant source to see the possible values. // The result object depends on the operation. Queries will always return a // VoltTable array - client.callProcedure(query, function initVoter(code, event, results) { - var val = results.table[0][0]; - util.log('Initialized app for ' + val[''] + ' candidates.'); - }); + client.callProcedure(query).read.then( function initVoter({ results }) { + if ( results.status !== VoltConstants.RESULT_STATUS.SUCCESS ) return console.error( results.status.string ); + + const val = results.table[0].data[0]; + util.log("Initialized app for " + val[""] + " candidates."); + }).catch( console.error ); } @@ -133,14 +135,16 @@ function voltInit() { // for trapping all the various error conditions, like connections being // dropped. function eventListener(code, event, message) { - util.log(util.format( 'Event %s\tcode: %d\tMessage: %s', event, code, + util.log(util.format( "Event %s\tcode: %d\tMessage: %s", event, code, message)); } // This is a generic configuration object factory. -function getConfiguration(host) { +function getConfiguration(host,user,password) { var cfg = new VoltConfiguration(); cfg.host = host; + cfg.username = user; + cfg.password = password; // The messageQueueSize sets how many messages to buffer before dispatching // them to the server. The messages are dispatched when either a timeout is // reached or the queue fills up. It is best to keep this number @@ -155,9 +159,9 @@ function getConfiguration(host) { // Connect to the server exports.initClient = function(startLoop) { if(client == null) { - var configs = [] + var configs = []; - configs.push(getConfiguration('localhost')); + configs.push(getConfiguration("produccion","operator","mech")); // The client is only configured at this point. The connection // is not made until the call to client.connect(). client = new VoltClient(configs); @@ -178,9 +182,9 @@ exports.initClient = function(startLoop) { // a success, though it is possible for one of the connections to the // volt cluster to fail. // The second handler is more for catastrophic failures. - client.connect(function startup(code, event,results) { - if(code == VoltConstants.STATUS_CODES.SUCCESS) { - util.log('Node connected to VoltDB'); + client.connect().then(function startup({ connected, errors }) { + if( connected ) { + util.log("Node connected to VoltDB"); if(startLoop) { setInterval(logResults, statsLoggingInterval); voteInsertLoop(); @@ -188,14 +192,12 @@ exports.initClient = function(startLoop) { voltInit(); } } else { - util.log(`Unexpected status while initClient: ${VoltConstants.STATUS_CODE_STRINGS[code]}`); + util.log("Unexpected status while initClient:", errors.map( e => VoltConstants.LOGIN_ERRORS[e]) ); process.exit(1); } - }, function loginError(code, event, results) { - util.log('Node did not connect to VoltDB'); }); } -} +}; // This method will vote several times and will run in the background. function voteInsertLoop() { @@ -218,15 +220,13 @@ function voteInsertLoop() { // readyToWrite() callback gives you a way to interrupt looping type // operations so that the socket.read events can be processed by the // connection. - client.callProcedure(query, - function displayResults(code, event, results) { - transactionCounter++; - }, function readyToWrite(code, event, results) { - - }); + let call = client.callProcedure(query); + call.read.then(function displayResults() { + transactionCounter++; + }).catch( console.error ); } - setImmediate(innerLoop); - } + setImmediate(innerLoop); + }; process.nextTick(innerLoop); } @@ -239,13 +239,13 @@ function logResults() { } function logTime(operation, totalTime, count) { - util.log(util.format('%d: %s %d times in %d milliseconds. %d TPS', - process.pid, operation, count, totalTime, - Math.floor((count / totalTime) * 1000))); + util.log(util.format("%d: %s %d times in %d milliseconds. %d TPS", + process.pid, operation, count, totalTime, + Math.floor((count / totalTime) * 1000))); } // Call the stored proc to collect all votes. -exports.getVoteResults = function(callback) { - var query = resultsProc.getQuery(); - client.callProcedure(query, callback); -} +exports.getVoteResults = function() { + var query = resultsProc.getQuery(); + return client.callProcedure(query).read; +}; diff --git a/examples/voter/voter/package.json b/examples/voter/voter/package.json index e3cfe64..4768548 100644 --- a/examples/voter/voter/package.json +++ b/examples/voter/voter/package.json @@ -1,9 +1,9 @@ { - "name": "Voterjs" - , "version": "0.0.1" - , "private": true - , "dependencies": { - "express": "2.5.8" - , "jade": ">= 0.0.1" - } -} \ No newline at end of file + "name": "Voterjs", + "version": "0.0.1", + "private": true, + "dependencies": { + "express": "2.5.8", + "jade": ">= 0.0.1" + } +} diff --git a/examples/voter/voter/public/javascripts/jquery-1.7.1.min.js b/examples/voter/voter/public/javascripts/jquery-1.7.1.min.js index 198b3ff..474b4eb 100644 --- a/examples/voter/voter/public/javascripts/jquery-1.7.1.min.js +++ b/examples/voter/voter/public/javascripts/jquery-1.7.1.min.js @@ -1,4 +1,4 @@ /*! jQuery v1.7.1 jquery.com | jquery.org/license */ -(function(a,b){function cy(a){return f.isWindow(a)?a:a.nodeType===9?a.defaultView||a.parentWindow:!1}function cv(a){if(!ck[a]){var b=c.body,d=f("<"+a+">").appendTo(b),e=d.css("display");d.remove();if(e==="none"||e===""){cl||(cl=c.createElement("iframe"),cl.frameBorder=cl.width=cl.height=0),b.appendChild(cl);if(!cm||!cl.createElement)cm=(cl.contentWindow||cl.contentDocument).document,cm.write((c.compatMode==="CSS1Compat"?"":"")+""),cm.close();d=cm.createElement(a),cm.body.appendChild(d),e=f.css(d,"display"),b.removeChild(cl)}ck[a]=e}return ck[a]}function cu(a,b){var c={};f.each(cq.concat.apply([],cq.slice(0,b)),function(){c[this]=a});return c}function ct(){cr=b}function cs(){setTimeout(ct,0);return cr=f.now()}function cj(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}function ci(){try{return new a.XMLHttpRequest}catch(b){}}function cc(a,c){a.dataFilter&&(c=a.dataFilter(c,a.dataType));var d=a.dataTypes,e={},g,h,i=d.length,j,k=d[0],l,m,n,o,p;for(g=1;g0){if(c!=="border")for(;g=0===c})}function S(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function K(){return!0}function J(){return!1}function n(a,b,c){var d=b+"defer",e=b+"queue",g=b+"mark",h=f._data(a,d);h&&(c==="queue"||!f._data(a,e))&&(c==="mark"||!f._data(a,g))&&setTimeout(function(){!f._data(a,e)&&!f._data(a,g)&&(f.removeData(a,d,!0),h.fire())},0)}function m(a){for(var b in a){if(b==="data"&&f.isEmptyObject(a[b]))continue;if(b!=="toJSON")return!1}return!0}function l(a,c,d){if(d===b&&a.nodeType===1){var e="data-"+c.replace(k,"-$1").toLowerCase();d=a.getAttribute(e);if(typeof d=="string"){try{d=d==="true"?!0:d==="false"?!1:d==="null"?null:f.isNumeric(d)?parseFloat(d):j.test(d)?f.parseJSON(d):d}catch(g){}f.data(a,c,d)}else d=b}return d}function h(a){var b=g[a]={},c,d;a=a.split(/\s+/);for(c=0,d=a.length;c)[^>]*$|#([\w\-]*)$)/,j=/\S/,k=/^\s+/,l=/\s+$/,m=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,n=/^[\],:{}\s]*$/,o=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,p=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,q=/(?:^|:|,)(?:\s*\[)+/g,r=/(webkit)[ \/]([\w.]+)/,s=/(opera)(?:.*version)?[ \/]([\w.]+)/,t=/(msie) ([\w.]+)/,u=/(mozilla)(?:.*? rv:([\w.]+))?/,v=/-([a-z]|[0-9])/ig,w=/^-ms-/,x=function(a,b){return(b+"").toUpperCase()},y=d.userAgent,z,A,B,C=Object.prototype.toString,D=Object.prototype.hasOwnProperty,E=Array.prototype.push,F=Array.prototype.slice,G=String.prototype.trim,H=Array.prototype.indexOf,I={};e.fn=e.prototype={constructor:e,init:function(a,d,f){var g,h,j,k;if(!a)return this;if(a.nodeType){this.context=this[0]=a,this.length=1;return this}if(a==="body"&&!d&&c.body){this.context=c,this[0]=c.body,this.selector=a,this.length=1;return this}if(typeof a=="string"){a.charAt(0)!=="<"||a.charAt(a.length-1)!==">"||a.length<3?g=i.exec(a):g=[null,a,null];if(g&&(g[1]||!d)){if(g[1]){d=d instanceof e?d[0]:d,k=d?d.ownerDocument||d:c,j=m.exec(a),j?e.isPlainObject(d)?(a=[c.createElement(j[1])],e.fn.attr.call(a,d,!0)):a=[k.createElement(j[1])]:(j=e.buildFragment([g[1]],[k]),a=(j.cacheable?e.clone(j.fragment):j.fragment).childNodes);return e.merge(this,a)}h=c.getElementById(g[2]);if(h&&h.parentNode){if(h.id!==g[2])return f.find(a);this.length=1,this[0]=h}this.context=c,this.selector=a;return this}return!d||d.jquery?(d||f).find(a):this.constructor(d).find(a)}if(e.isFunction(a))return f.ready(a);a.selector!==b&&(this.selector=a.selector,this.context=a.context);return e.makeArray(a,this)},selector:"",jquery:"1.7.1",length:0,size:function(){return this.length},toArray:function(){return F.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this[this.length+a]:this[a]},pushStack:function(a,b,c){var d=this.constructor();e.isArray(a)?E.apply(d,a):e.merge(d,a),d.prevObject=this,d.context=this.context,b==="find"?d.selector=this.selector+(this.selector?" ":"")+c:b&&(d.selector=this.selector+"."+b+"("+c+")");return d},each:function(a,b){return e.each(this,a,b)},ready:function(a){e.bindReady(),A.add(a);return this},eq:function(a){a=+a;return a===-1?this.slice(a):this.slice(a,a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(F.apply(this,arguments),"slice",F.call(arguments).join(","))},map:function(a){return this.pushStack(e.map(this,function(b,c){return a.call(b,c,b)}))},end:function(){return this.prevObject||this.constructor(null)},push:E,sort:[].sort,splice:[].splice},e.fn.init.prototype=e.fn,e.extend=e.fn.extend=function(){var a,c,d,f,g,h,i=arguments[0]||{},j=1,k=arguments.length,l=!1;typeof i=="boolean"&&(l=i,i=arguments[1]||{},j=2),typeof i!="object"&&!e.isFunction(i)&&(i={}),k===j&&(i=this,--j);for(;j0)return;A.fireWith(c,[e]),e.fn.trigger&&e(c).trigger("ready").off("ready")}},bindReady:function(){if(!A){A=e.Callbacks("once memory");if(c.readyState==="complete")return setTimeout(e.ready,1);if(c.addEventListener)c.addEventListener("DOMContentLoaded",B,!1),a.addEventListener("load",e.ready,!1);else if(c.attachEvent){c.attachEvent("onreadystatechange",B),a.attachEvent("onload",e.ready);var b=!1;try{b=a.frameElement==null}catch(d){}c.documentElement.doScroll&&b&&J()}}},isFunction:function(a){return e.type(a)==="function"},isArray:Array.isArray||function(a){return e.type(a)==="array"},isWindow:function(a){return a&&typeof a=="object"&&"setInterval"in a},isNumeric:function(a){return!isNaN(parseFloat(a))&&isFinite(a)},type:function(a){return a==null?String(a):I[C.call(a)]||"object"},isPlainObject:function(a){if(!a||e.type(a)!=="object"||a.nodeType||e.isWindow(a))return!1;try{if(a.constructor&&!D.call(a,"constructor")&&!D.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(c){return!1}var d;for(d in a);return d===b||D.call(a,d)},isEmptyObject:function(a){for(var b in a)return!1;return!0},error:function(a){throw new Error(a)},parseJSON:function(b){if(typeof b!="string"||!b)return null;b=e.trim(b);if(a.JSON&&a.JSON.parse)return a.JSON.parse(b);if(n.test(b.replace(o,"@").replace(p,"]").replace(q,"")))return(new Function("return "+b))();e.error("Invalid JSON: "+b)},parseXML:function(c){var d,f;try{a.DOMParser?(f=new DOMParser,d=f.parseFromString(c,"text/xml")):(d=new ActiveXObject("Microsoft.XMLDOM"),d.async="false",d.loadXML(c))}catch(g){d=b}(!d||!d.documentElement||d.getElementsByTagName("parsererror").length)&&e.error("Invalid XML: "+c);return d},noop:function(){},globalEval:function(b){b&&j.test(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(w,"ms-").replace(v,x)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,c,d){var f,g=0,h=a.length,i=h===b||e.isFunction(a);if(d){if(i){for(f in a)if(c.apply(a[f],d)===!1)break}else for(;g0&&a[0]&&a[j-1]||j===0||e.isArray(a));if(k)for(;i1?i.call(arguments,0):b,j.notifyWith(k,e)}}function l(a){return function(c){b[a]=arguments.length>1?i.call(arguments,0):c,--g||j.resolveWith(j,b)}}var b=i.call(arguments,0),c=0,d=b.length,e=Array(d),g=d,h=d,j=d<=1&&a&&f.isFunction(a.promise)?a:f.Deferred(),k=j.promise();if(d>1){for(;c
a",d=q.getElementsByTagName("*"),e=q.getElementsByTagName("a")[0];if(!d||!d.length||!e)return{};g=c.createElement("select"),h=g.appendChild(c.createElement("option")),i=q.getElementsByTagName("input")[0],b={leadingWhitespace:q.firstChild.nodeType===3,tbody:!q.getElementsByTagName("tbody").length,htmlSerialize:!!q.getElementsByTagName("link").length,style:/top/.test(e.getAttribute("style")),hrefNormalized:e.getAttribute("href")==="/a",opacity:/^0.55/.test(e.style.opacity),cssFloat:!!e.style.cssFloat,checkOn:i.value==="on",optSelected:h.selected,getSetAttribute:q.className!=="t",enctype:!!c.createElement("form").enctype,html5Clone:c.createElement("nav").cloneNode(!0).outerHTML!=="<:nav>",submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0},i.checked=!0,b.noCloneChecked=i.cloneNode(!0).checked,g.disabled=!0,b.optDisabled=!h.disabled;try{delete q.test}catch(s){b.deleteExpando=!1}!q.addEventListener&&q.attachEvent&&q.fireEvent&&(q.attachEvent("onclick",function(){b.noCloneEvent=!1}),q.cloneNode(!0).fireEvent("onclick")),i=c.createElement("input"),i.value="t",i.setAttribute("type","radio"),b.radioValue=i.value==="t",i.setAttribute("checked","checked"),q.appendChild(i),k=c.createDocumentFragment(),k.appendChild(q.lastChild),b.checkClone=k.cloneNode(!0).cloneNode(!0).lastChild.checked,b.appendChecked=i.checked,k.removeChild(i),k.appendChild(q),q.innerHTML="",a.getComputedStyle&&(j=c.createElement("div"),j.style.width="0",j.style.marginRight="0",q.style.width="2px",q.appendChild(j),b.reliableMarginRight=(parseInt((a.getComputedStyle(j,null)||{marginRight:0}).marginRight,10)||0)===0);if(q.attachEvent)for(o in{submit:1,change:1,focusin:1})n="on"+o,p=n in q,p||(q.setAttribute(n,"return;"),p=typeof q[n]=="function"),b[o+"Bubbles"]=p;k.removeChild(q),k=g=h=j=q=i=null,f(function(){var a,d,e,g,h,i,j,k,m,n,o,r=c.getElementsByTagName("body")[0];!r||(j=1,k="position:absolute;top:0;left:0;width:1px;height:1px;margin:0;",m="visibility:hidden;border:0;",n="style='"+k+"border:5px solid #000;padding:0;'",o="
"+""+"
",a=c.createElement("div"),a.style.cssText=m+"width:0;height:0;position:static;top:0;margin-top:"+j+"px",r.insertBefore(a,r.firstChild),q=c.createElement("div"),a.appendChild(q),q.innerHTML="
t
",l=q.getElementsByTagName("td"),p=l[0].offsetHeight===0,l[0].style.display="",l[1].style.display="none",b.reliableHiddenOffsets=p&&l[0].offsetHeight===0,q.innerHTML="",q.style.width=q.style.paddingLeft="1px",f.boxModel=b.boxModel=q.offsetWidth===2,typeof q.style.zoom!="undefined"&&(q.style.display="inline",q.style.zoom=1,b.inlineBlockNeedsLayout=q.offsetWidth===2,q.style.display="",q.innerHTML="
",b.shrinkWrapBlocks=q.offsetWidth!==2),q.style.cssText=k+m,q.innerHTML=o,d=q.firstChild,e=d.firstChild,h=d.nextSibling.firstChild.firstChild,i={doesNotAddBorder:e.offsetTop!==5,doesAddBorderForTableAndCells:h.offsetTop===5},e.style.position="fixed",e.style.top="20px",i.fixedPosition=e.offsetTop===20||e.offsetTop===15,e.style.position=e.style.top="",d.style.overflow="hidden",d.style.position="relative",i.subtractsBorderForOverflowNotVisible=e.offsetTop===-5,i.doesNotIncludeMarginInBodyOffset=r.offsetTop!==j,r.removeChild(a),q=a=null,f.extend(b,i))});return b}();var j=/^(?:\{.*\}|\[.*\])$/,k=/([A-Z])/g;f.extend({cache:{},uuid:0,expando:"jQuery"+(f.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(a){a=a.nodeType?f.cache[a[f.expando]]:a[f.expando];return!!a&&!m(a)},data:function(a,c,d,e){if(!!f.acceptData(a)){var g,h,i,j=f.expando,k=typeof c=="string",l=a.nodeType,m=l?f.cache:a,n=l?a[j]:a[j]&&j,o=c==="events";if((!n||!m[n]||!o&&!e&&!m[n].data)&&k&&d===b)return;n||(l?a[j]=n=++f.uuid:n=j),m[n]||(m[n]={},l||(m[n].toJSON=f.noop));if(typeof c=="object"||typeof c=="function")e?m[n]=f.extend(m[n],c):m[n].data=f.extend(m[n].data,c);g=h=m[n],e||(h.data||(h.data={}),h=h.data),d!==b&&(h[f.camelCase(c)]=d);if(o&&!h[c])return g.events;k?(i=h[c],i==null&&(i=h[f.camelCase(c)])):i=h;return i}},removeData:function(a,b,c){if(!!f.acceptData(a)){var d,e,g,h=f.expando,i=a.nodeType,j=i?f.cache:a,k=i?a[h]:h;if(!j[k])return;if(b){d=c?j[k]:j[k].data;if(d){f.isArray(b)||(b in d?b=[b]:(b=f.camelCase(b),b in d?b=[b]:b=b.split(" ")));for(e=0,g=b.length;e-1)return!0;return!1},val:function(a){var c,d,e,g=this[0];{if(!!arguments.length){e=f.isFunction(a);return this.each(function(d){var g=f(this),h;if(this.nodeType===1){e?h=a.call(this,d,g.val()):h=a,h==null?h="":typeof h=="number"?h+="":f.isArray(h)&&(h=f.map(h,function(a){return a==null?"":a+""})),c=f.valHooks[this.nodeName.toLowerCase()]||f.valHooks[this.type];if(!c||!("set"in c)||c.set(this,h,"value")===b)this.value=h}})}if(g){c=f.valHooks[g.nodeName.toLowerCase()]||f.valHooks[g.type];if(c&&"get"in c&&(d=c.get(g,"value"))!==b)return d;d=g.value;return typeof d=="string"?d.replace(q,""):d==null?"":d}}}}),f.extend({valHooks:{option:{get:function(a){var b=a.attributes.value;return!b||b.specified?a.value:a.text}},select:{get:function(a){var b,c,d,e,g=a.selectedIndex,h=[],i=a.options,j=a.type==="select-one";if(g<0)return null;c=j?g:0,d=j?g+1:i.length;for(;c=0}),c.length||(a.selectedIndex=-1);return c}}},attrFn:{val:!0,css:!0,html:!0,text:!0,data:!0,width:!0,height:!0,offset:!0},attr:function(a,c,d,e){var g,h,i,j=a.nodeType;if(!!a&&j!==3&&j!==8&&j!==2){if(e&&c in f.attrFn)return f(a)[c](d);if(typeof a.getAttribute=="undefined")return f.prop(a,c,d);i=j!==1||!f.isXMLDoc(a),i&&(c=c.toLowerCase(),h=f.attrHooks[c]||(u.test(c)?x:w));if(d!==b){if(d===null){f.removeAttr(a,c);return}if(h&&"set"in h&&i&&(g=h.set(a,d,c))!==b)return g;a.setAttribute(c,""+d);return d}if(h&&"get"in h&&i&&(g=h.get(a,c))!==null)return g;g=a.getAttribute(c);return g===null?b:g}},removeAttr:function(a,b){var c,d,e,g,h=0;if(b&&a.nodeType===1){d=b.toLowerCase().split(p),g=d.length;for(;h=0}})});var z=/^(?:textarea|input|select)$/i,A=/^([^\.]*)?(?:\.(.+))?$/,B=/\bhover(\.\S+)?\b/,C=/^key/,D=/^(?:mouse|contextmenu)|click/,E=/^(?:focusinfocus|focusoutblur)$/,F=/^(\w*)(?:#([\w\-]+))?(?:\.([\w\-]+))?$/,G=function(a){var b=F.exec(a);b&&(b[1]=(b[1]||"").toLowerCase(),b[3]=b[3]&&new RegExp("(?:^|\\s)"+b[3]+"(?:\\s|$)"));return b},H=function(a,b){var c=a.attributes||{};return(!b[1]||a.nodeName.toLowerCase()===b[1])&&(!b[2]||(c.id||{}).value===b[2])&&(!b[3]||b[3].test((c["class"]||{}).value))},I=function(a){return f.event.special.hover?a:a.replace(B,"mouseenter$1 mouseleave$1")}; -f.event={add:function(a,c,d,e,g){var h,i,j,k,l,m,n,o,p,q,r,s;if(!(a.nodeType===3||a.nodeType===8||!c||!d||!(h=f._data(a)))){d.handler&&(p=d,d=p.handler),d.guid||(d.guid=f.guid++),j=h.events,j||(h.events=j={}),i=h.handle,i||(h.handle=i=function(a){return typeof f!="undefined"&&(!a||f.event.triggered!==a.type)?f.event.dispatch.apply(i.elem,arguments):b},i.elem=a),c=f.trim(I(c)).split(" ");for(k=0;k=0&&(h=h.slice(0,-1),k=!0),h.indexOf(".")>=0&&(i=h.split("."),h=i.shift(),i.sort());if((!e||f.event.customEvent[h])&&!f.event.global[h])return;c=typeof c=="object"?c[f.expando]?c:new f.Event(h,c):new f.Event(h),c.type=h,c.isTrigger=!0,c.exclusive=k,c.namespace=i.join("."),c.namespace_re=c.namespace?new RegExp("(^|\\.)"+i.join("\\.(?:.*\\.)?")+"(\\.|$)"):null,o=h.indexOf(":")<0?"on"+h:"";if(!e){j=f.cache;for(l in j)j[l].events&&j[l].events[h]&&f.event.trigger(c,d,j[l].handle.elem,!0);return}c.result=b,c.target||(c.target=e),d=d!=null?f.makeArray(d):[],d.unshift(c),p=f.event.special[h]||{};if(p.trigger&&p.trigger.apply(e,d)===!1)return;r=[[e,p.bindType||h]];if(!g&&!p.noBubble&&!f.isWindow(e)){s=p.delegateType||h,m=E.test(s+h)?e:e.parentNode,n=null;for(;m;m=m.parentNode)r.push([m,s]),n=m;n&&n===e.ownerDocument&&r.push([n.defaultView||n.parentWindow||a,s])}for(l=0;le&&i.push({elem:this,matches:d.slice(e)});for(j=0;j0?this.on(b,null,a,c):this.trigger(b)},f.attrFn&&(f.attrFn[b]=!0),C.test(b)&&(f.event.fixHooks[b]=f.event.keyHooks),D.test(b)&&(f.event.fixHooks[b]=f.event.mouseHooks)}),function(){function x(a,b,c,e,f,g){for(var h=0,i=e.length;h0){k=j;break}}j=j[a]}e[h]=k}}}function w(a,b,c,e,f,g){for(var h=0,i=e.length;h+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,d="sizcache"+(Math.random()+"").replace(".",""),e=0,g=Object.prototype.toString,h=!1,i=!0,j=/\\/g,k=/\r\n/g,l=/\W/;[0,0].sort(function(){i=!1;return 0});var m=function(b,d,e,f){e=e||[],d=d||c;var h=d;if(d.nodeType!==1&&d.nodeType!==9)return[];if(!b||typeof b!="string")return e;var i,j,k,l,n,q,r,t,u=!0,v=m.isXML(d),w=[],x=b;do{a.exec(""),i=a.exec(x);if(i){x=i[3],w.push(i[1]);if(i[2]){l=i[3];break}}}while(i);if(w.length>1&&p.exec(b))if(w.length===2&&o.relative[w[0]])j=y(w[0]+w[1],d,f);else{j=o.relative[w[0]]?[d]:m(w.shift(),d);while(w.length)b=w.shift(),o.relative[b]&&(b+=w.shift()),j=y(b,j,f)}else{!f&&w.length>1&&d.nodeType===9&&!v&&o.match.ID.test(w[0])&&!o.match.ID.test(w[w.length-1])&&(n=m.find(w.shift(),d,v),d=n.expr?m.filter(n.expr,n.set)[0]:n.set[0]);if(d){n=f?{expr:w.pop(),set:s(f)}:m.find(w.pop(),w.length===1&&(w[0]==="~"||w[0]==="+")&&d.parentNode?d.parentNode:d,v),j=n.expr?m.filter(n.expr,n.set):n.set,w.length>0?k=s(j):u=!1;while(w.length)q=w.pop(),r=q,o.relative[q]?r=w.pop():q="",r==null&&(r=d),o.relative[q](k,r,v)}else k=w=[]}k||(k=j),k||m.error(q||b);if(g.call(k)==="[object Array]")if(!u)e.push.apply(e,k);else if(d&&d.nodeType===1)for(t=0;k[t]!=null;t++)k[t]&&(k[t]===!0||k[t].nodeType===1&&m.contains(d,k[t]))&&e.push(j[t]);else for(t=0;k[t]!=null;t++)k[t]&&k[t].nodeType===1&&e.push(j[t]);else s(k,e);l&&(m(l,h,e,f),m.uniqueSort(e));return e};m.uniqueSort=function(a){if(u){h=i,a.sort(u);if(h)for(var b=1;b0},m.find=function(a,b,c){var d,e,f,g,h,i;if(!a)return[];for(e=0,f=o.order.length;e":function(a,b){var c,d=typeof b=="string",e=0,f=a.length;if(d&&!l.test(b)){b=b.toLowerCase();for(;e=0)?c||d.push(h):c&&(b[g]=!1));return!1},ID:function(a){return a[1].replace(j,"")},TAG:function(a,b){return a[1].replace(j,"").toLowerCase()},CHILD:function(a){if(a[1]==="nth"){a[2]||m.error(a[0]),a[2]=a[2].replace(/^\+|\s*/g,"");var b=/(-?)(\d*)(?:n([+\-]?\d*))?/.exec(a[2]==="even"&&"2n"||a[2]==="odd"&&"2n+1"||!/\D/.test(a[2])&&"0n+"+a[2]||a[2]);a[2]=b[1]+(b[2]||1)-0,a[3]=b[3]-0}else a[2]&&m.error(a[0]);a[0]=e++;return a},ATTR:function(a,b,c,d,e,f){var g=a[1]=a[1].replace(j,"");!f&&o.attrMap[g]&&(a[1]=o.attrMap[g]),a[4]=(a[4]||a[5]||"").replace(j,""),a[2]==="~="&&(a[4]=" "+a[4]+" ");return a},PSEUDO:function(b,c,d,e,f){if(b[1]==="not")if((a.exec(b[3])||"").length>1||/^\w/.test(b[3]))b[3]=m(b[3],null,null,c);else{var g=m.filter(b[3],c,d,!0^f);d||e.push.apply(e,g);return!1}else if(o.match.POS.test(b[0])||o.match.CHILD.test(b[0]))return!0;return b},POS:function(a){a.unshift(!0);return a}},filters:{enabled:function(a){return a.disabled===!1&&a.type!=="hidden"},disabled:function(a){return a.disabled===!0},checked:function(a){return a.checked===!0},selected:function(a){a.parentNode&&a.parentNode.selectedIndex;return a.selected===!0},parent:function(a){return!!a.firstChild},empty:function(a){return!a.firstChild},has:function(a,b,c){return!!m(c[3],a).length},header:function(a){return/h\d/i.test(a.nodeName)},text:function(a){var b=a.getAttribute("type"),c=a.type;return a.nodeName.toLowerCase()==="input"&&"text"===c&&(b===c||b===null)},radio:function(a){return a.nodeName.toLowerCase()==="input"&&"radio"===a.type},checkbox:function(a){return a.nodeName.toLowerCase()==="input"&&"checkbox"===a.type},file:function(a){return a.nodeName.toLowerCase()==="input"&&"file"===a.type},password:function(a){return a.nodeName.toLowerCase()==="input"&&"password"===a.type},submit:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"submit"===a.type},image:function(a){return a.nodeName.toLowerCase()==="input"&&"image"===a.type},reset:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"reset"===a.type},button:function(a){var b=a.nodeName.toLowerCase();return b==="input"&&"button"===a.type||b==="button"},input:function(a){return/input|select|textarea|button/i.test(a.nodeName)},focus:function(a){return a===a.ownerDocument.activeElement}},setFilters:{first:function(a,b){return b===0},last:function(a,b,c,d){return b===d.length-1},even:function(a,b){return b%2===0},odd:function(a,b){return b%2===1},lt:function(a,b,c){return bc[3]-0},nth:function(a,b,c){return c[3]-0===b},eq:function(a,b,c){return c[3]-0===b}},filter:{PSEUDO:function(a,b,c,d){var e=b[1],f=o.filters[e];if(f)return f(a,c,b,d);if(e==="contains")return(a.textContent||a.innerText||n([a])||"").indexOf(b[3])>=0;if(e==="not"){var g=b[3];for(var h=0,i=g.length;h=0}},ID:function(a,b){return a.nodeType===1&&a.getAttribute("id")===b},TAG:function(a,b){return b==="*"&&a.nodeType===1||!!a.nodeName&&a.nodeName.toLowerCase()===b},CLASS:function(a,b){return(" "+(a.className||a.getAttribute("class"))+" ").indexOf(b)>-1},ATTR:function(a,b){var c=b[1],d=m.attr?m.attr(a,c):o.attrHandle[c]?o.attrHandle[c](a):a[c]!=null?a[c]:a.getAttribute(c),e=d+"",f=b[2],g=b[4];return d==null?f==="!=":!f&&m.attr?d!=null:f==="="?e===g:f==="*="?e.indexOf(g)>=0:f==="~="?(" "+e+" ").indexOf(g)>=0:g?f==="!="?e!==g:f==="^="?e.indexOf(g)===0:f==="$="?e.substr(e.length-g.length)===g:f==="|="?e===g||e.substr(0,g.length+1)===g+"-":!1:e&&d!==!1},POS:function(a,b,c,d){var e=b[2],f=o.setFilters[e];if(f)return f(a,c,b,d)}}},p=o.match.POS,q=function(a,b){return"\\"+(b-0+1)};for(var r in o.match)o.match[r]=new RegExp(o.match[r].source+/(?![^\[]*\])(?![^\(]*\))/.source),o.leftMatch[r]=new RegExp(/(^(?:.|\r|\n)*?)/.source+o.match[r].source.replace(/\\(\d+)/g,q));var s=function(a,b){a=Array.prototype.slice.call(a,0);if(b){b.push.apply(b,a);return b}return a};try{Array.prototype.slice.call(c.documentElement.childNodes,0)[0].nodeType}catch(t){s=function(a,b){var c=0,d=b||[];if(g.call(a)==="[object Array]")Array.prototype.push.apply(d,a);else if(typeof a.length=="number")for(var e=a.length;c",e.insertBefore(a,e.firstChild),c.getElementById(d)&&(o.find.ID=function(a,c,d){if(typeof c.getElementById!="undefined"&&!d){var e=c.getElementById(a[1]);return e?e.id===a[1]||typeof e.getAttributeNode!="undefined"&&e.getAttributeNode("id").nodeValue===a[1]?[e]:b:[]}},o.filter.ID=function(a,b){var c=typeof a.getAttributeNode!="undefined"&&a.getAttributeNode("id");return a.nodeType===1&&c&&c.nodeValue===b}),e.removeChild(a),e=a=null}(),function(){var a=c.createElement("div");a.appendChild(c.createComment("")),a.getElementsByTagName("*").length>0&&(o.find.TAG=function(a,b){var c=b.getElementsByTagName(a[1]);if(a[1]==="*"){var d=[];for(var e=0;c[e];e++)c[e].nodeType===1&&d.push(c[e]);c=d}return c}),a.innerHTML="",a.firstChild&&typeof a.firstChild.getAttribute!="undefined"&&a.firstChild.getAttribute("href")!=="#"&&(o.attrHandle.href=function(a){return a.getAttribute("href",2)}),a=null}(),c.querySelectorAll&&function(){var a=m,b=c.createElement("div"),d="__sizzle__";b.innerHTML="

";if(!b.querySelectorAll||b.querySelectorAll(".TEST").length!==0){m=function(b,e,f,g){e=e||c;if(!g&&!m.isXML(e)){var h=/^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec(b);if(h&&(e.nodeType===1||e.nodeType===9)){if(h[1])return s(e.getElementsByTagName(b),f);if(h[2]&&o.find.CLASS&&e.getElementsByClassName)return s(e.getElementsByClassName(h[2]),f)}if(e.nodeType===9){if(b==="body"&&e.body)return s([e.body],f);if(h&&h[3]){var i=e.getElementById(h[3]);if(!i||!i.parentNode)return s([],f);if(i.id===h[3])return s([i],f)}try{return s(e.querySelectorAll(b),f)}catch(j){}}else if(e.nodeType===1&&e.nodeName.toLowerCase()!=="object"){var k=e,l=e.getAttribute("id"),n=l||d,p=e.parentNode,q=/^\s*[+~]/.test(b);l?n=n.replace(/'/g,"\\$&"):e.setAttribute("id",n),q&&p&&(e=e.parentNode);try{if(!q||p)return s(e.querySelectorAll("[id='"+n+"'] "+b),f)}catch(r){}finally{l||k.removeAttribute("id")}}}return a(b,e,f,g)};for(var e in a)m[e]=a[e];b=null}}(),function(){var a=c.documentElement,b=a.matchesSelector||a.mozMatchesSelector||a.webkitMatchesSelector||a.msMatchesSelector;if(b){var d=!b.call(c.createElement("div"),"div"),e=!1;try{b.call(c.documentElement,"[test!='']:sizzle")}catch(f){e=!0}m.matchesSelector=function(a,c){c=c.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!m.isXML(a))try{if(e||!o.match.PSEUDO.test(c)&&!/!=/.test(c)){var f=b.call(a,c);if(f||!d||a.document&&a.document.nodeType!==11)return f}}catch(g){}return m(c,null,null,[a]).length>0}}}(),function(){var a=c.createElement("div");a.innerHTML="
";if(!!a.getElementsByClassName&&a.getElementsByClassName("e").length!==0){a.lastChild.className="e";if(a.getElementsByClassName("e").length===1)return;o.order.splice(1,0,"CLASS"),o.find.CLASS=function(a,b,c){if(typeof b.getElementsByClassName!="undefined"&&!c)return b.getElementsByClassName(a[1])},a=null}}(),c.documentElement.contains?m.contains=function(a,b){return a!==b&&(a.contains?a.contains(b):!0)}:c.documentElement.compareDocumentPosition?m.contains=function(a,b){return!!(a.compareDocumentPosition(b)&16)}:m.contains=function(){return!1},m.isXML=function(a){var b=(a?a.ownerDocument||a:0).documentElement;return b?b.nodeName!=="HTML":!1};var y=function(a,b,c){var d,e=[],f="",g=b.nodeType?[b]:b;while(d=o.match.PSEUDO.exec(a))f+=d[0],a=a.replace(o.match.PSEUDO,"");a=o.relative[a]?a+"*":a;for(var h=0,i=g.length;h0)for(h=g;h=0:f.filter(a,this).length>0:this.filter(a).length>0)},closest:function(a,b){var c=[],d,e,g=this[0];if(f.isArray(a)){var h=1;while(g&&g.ownerDocument&&g!==b){for(d=0;d-1:f.find.matchesSelector(g,a)){c.push(g);break}g=g.parentNode;if(!g||!g.ownerDocument||g===b||g.nodeType===11)break}}c=c.length>1?f.unique(c):c;return this.pushStack(c,"closest",a)},index:function(a){if(!a)return this[0]&&this[0].parentNode?this.prevAll().length:-1;if(typeof a=="string")return f.inArray(this[0],f(a));return f.inArray(a.jquery?a[0]:a,this)},add:function(a,b){var c=typeof a=="string"?f(a,b):f.makeArray(a&&a.nodeType?[a]:a),d=f.merge(this.get(),c);return this.pushStack(S(c[0])||S(d[0])?d:f.unique(d))},andSelf:function(){return this.add(this.prevObject)}}),f.each({parent:function(a){var b=a.parentNode;return b&&b.nodeType!==11?b:null},parents:function(a){return f.dir(a,"parentNode")},parentsUntil:function(a,b,c){return f.dir(a,"parentNode",c)},next:function(a){return f.nth(a,2,"nextSibling")},prev:function(a){return f.nth(a,2,"previousSibling")},nextAll:function(a){return f.dir(a,"nextSibling")},prevAll:function(a){return f.dir(a,"previousSibling")},nextUntil:function(a,b,c){return f.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return f.dir(a,"previousSibling",c)},siblings:function(a){return f.sibling(a.parentNode.firstChild,a)},children:function(a){return f.sibling(a.firstChild)},contents:function(a){return f.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:f.makeArray(a.childNodes)}},function(a,b){f.fn[a]=function(c,d){var e=f.map(this,b,c);L.test(a)||(d=c),d&&typeof d=="string"&&(e=f.filter(d,e)),e=this.length>1&&!R[a]?f.unique(e):e,(this.length>1||N.test(d))&&M.test(a)&&(e=e.reverse());return this.pushStack(e,a,P.call(arguments).join(","))}}),f.extend({filter:function(a,b,c){c&&(a=":not("+a+")");return b.length===1?f.find.matchesSelector(b[0],a)?[b[0]]:[]:f.find.matches(a,b)},dir:function(a,c,d){var e=[],g=a[c];while(g&&g.nodeType!==9&&(d===b||g.nodeType!==1||!f(g).is(d)))g.nodeType===1&&e.push(g),g=g[c];return e},nth:function(a,b,c,d){b=b||1;var e=0;for(;a;a=a[c])if(a.nodeType===1&&++e===b)break;return a},sibling:function(a,b){var c=[];for(;a;a=a.nextSibling)a.nodeType===1&&a!==b&&c.push(a);return c}});var V="abbr|article|aside|audio|canvas|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",W=/ jQuery\d+="(?:\d+|null)"/g,X=/^\s+/,Y=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,Z=/<([\w:]+)/,$=/",""],legend:[1,"
","
"],thead:[1,"","
"],tr:[2,"","
"],td:[3,"","
"],col:[2,"","
"],area:[1,"",""],_default:[0,"",""]},bh=U(c);bg.optgroup=bg.option,bg.tbody=bg.tfoot=bg.colgroup=bg.caption=bg.thead,bg.th=bg.td,f.support.htmlSerialize||(bg._default=[1,"div
","
"]),f.fn.extend({text:function(a){if(f.isFunction(a))return this.each(function(b){var c=f(this);c.text(a.call(this,b,c.text()))});if(typeof a!="object"&&a!==b)return this.empty().append((this[0]&&this[0].ownerDocument||c).createTextNode(a));return f.text(this)},wrapAll:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapAll(a.call(this,b))});if(this[0]){var b=f(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstChild&&a.firstChild.nodeType===1)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapInner(a.call(this,b))});return this.each(function(){var b=f(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=f.isFunction(a);return this.each(function(c){f(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(){return this.parent().each(function(){f.nodeName(this,"body")||f(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.appendChild(a)})},prepend:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this)});if(arguments.length){var a=f.clean(arguments);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this.nextSibling)});if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,f.clean(arguments));return a}},remove:function(a,b){for(var c=0,d;(d=this[c])!=null;c++)if(!a||f.filter(a,[d]).length)!b&&d.nodeType===1&&(f.cleanData(d.getElementsByTagName("*")),f.cleanData([d])),d.parentNode&&d.parentNode.removeChild(d);return this},empty:function() -{for(var a=0,b;(b=this[a])!=null;a++){b.nodeType===1&&f.cleanData(b.getElementsByTagName("*"));while(b.firstChild)b.removeChild(b.firstChild)}return this},clone:function(a,b){a=a==null?!1:a,b=b==null?a:b;return this.map(function(){return f.clone(this,a,b)})},html:function(a){if(a===b)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(W,""):null;if(typeof a=="string"&&!ba.test(a)&&(f.support.leadingWhitespace||!X.test(a))&&!bg[(Z.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(Y,"<$1>");try{for(var c=0,d=this.length;c1&&l0?this.clone(!0):this).get();f(e[h])[b](j),d=d.concat(j)}return this.pushStack(d,a,e.selector)}}),f.extend({clone:function(a,b,c){var d,e,g,h=f.support.html5Clone||!bc.test("<"+a.nodeName)?a.cloneNode(!0):bo(a);if((!f.support.noCloneEvent||!f.support.noCloneChecked)&&(a.nodeType===1||a.nodeType===11)&&!f.isXMLDoc(a)){bk(a,h),d=bl(a),e=bl(h);for(g=0;d[g];++g)e[g]&&bk(d[g],e[g])}if(b){bj(a,h);if(c){d=bl(a),e=bl(h);for(g=0;d[g];++g)bj(d[g],e[g])}}d=e=null;return h},clean:function(a,b,d,e){var g;b=b||c,typeof b.createElement=="undefined"&&(b=b.ownerDocument||b[0]&&b[0].ownerDocument||c);var h=[],i;for(var j=0,k;(k=a[j])!=null;j++){typeof k=="number"&&(k+="");if(!k)continue;if(typeof k=="string")if(!_.test(k))k=b.createTextNode(k);else{k=k.replace(Y,"<$1>");var l=(Z.exec(k)||["",""])[1].toLowerCase(),m=bg[l]||bg._default,n=m[0],o=b.createElement("div");b===c?bh.appendChild(o):U(b).appendChild(o),o.innerHTML=m[1]+k+m[2];while(n--)o=o.lastChild;if(!f.support.tbody){var p=$.test(k),q=l==="table"&&!p?o.firstChild&&o.firstChild.childNodes:m[1]===""&&!p?o.childNodes:[];for(i=q.length-1;i>=0;--i)f.nodeName(q[i],"tbody")&&!q[i].childNodes.length&&q[i].parentNode.removeChild(q[i])}!f.support.leadingWhitespace&&X.test(k)&&o.insertBefore(b.createTextNode(X.exec(k)[0]),o.firstChild),k=o.childNodes}var r;if(!f.support.appendChecked)if(k[0]&&typeof (r=k.length)=="number")for(i=0;i=0)return b+"px"}}}),f.support.opacity||(f.cssHooks.opacity={get:function(a,b){return br.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?parseFloat(RegExp.$1)/100+"":b?"1":""},set:function(a,b){var c=a.style,d=a.currentStyle,e=f.isNumeric(b)?"alpha(opacity="+b*100+")":"",g=d&&d.filter||c.filter||"";c.zoom=1;if(b>=1&&f.trim(g.replace(bq,""))===""){c.removeAttribute("filter");if(d&&!d.filter)return}c.filter=bq.test(g)?g.replace(bq,e):g+" "+e}}),f(function(){f.support.reliableMarginRight||(f.cssHooks.marginRight={get:function(a,b){var c;f.swap(a,{display:"inline-block"},function(){b?c=bz(a,"margin-right","marginRight"):c=a.style.marginRight});return c}})}),c.defaultView&&c.defaultView.getComputedStyle&&(bA=function(a,b){var c,d,e;b=b.replace(bs,"-$1").toLowerCase(),(d=a.ownerDocument.defaultView)&&(e=d.getComputedStyle(a,null))&&(c=e.getPropertyValue(b),c===""&&!f.contains(a.ownerDocument.documentElement,a)&&(c=f.style(a,b)));return c}),c.documentElement.currentStyle&&(bB=function(a,b){var c,d,e,f=a.currentStyle&&a.currentStyle[b],g=a.style;f===null&&g&&(e=g[b])&&(f=e),!bt.test(f)&&bu.test(f)&&(c=g.left,d=a.runtimeStyle&&a.runtimeStyle.left,d&&(a.runtimeStyle.left=a.currentStyle.left),g.left=b==="fontSize"?"1em":f||0,f=g.pixelLeft+"px",g.left=c,d&&(a.runtimeStyle.left=d));return f===""?"auto":f}),bz=bA||bB,f.expr&&f.expr.filters&&(f.expr.filters.hidden=function(a){var b=a.offsetWidth,c=a.offsetHeight;return b===0&&c===0||!f.support.reliableHiddenOffsets&&(a.style&&a.style.display||f.css(a,"display"))==="none"},f.expr.filters.visible=function(a){return!f.expr.filters.hidden(a)});var bD=/%20/g,bE=/\[\]$/,bF=/\r?\n/g,bG=/#.*$/,bH=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,bI=/^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,bJ=/^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/,bK=/^(?:GET|HEAD)$/,bL=/^\/\//,bM=/\?/,bN=/)<[^<]*)*<\/script>/gi,bO=/^(?:select|textarea)/i,bP=/\s+/,bQ=/([?&])_=[^&]*/,bR=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/,bS=f.fn.load,bT={},bU={},bV,bW,bX=["*/"]+["*"];try{bV=e.href}catch(bY){bV=c.createElement("a"),bV.href="",bV=bV.href}bW=bR.exec(bV.toLowerCase())||[],f.fn.extend({load:function(a,c,d){if(typeof a!="string"&&bS)return bS.apply(this,arguments);if(!this.length)return this;var e=a.indexOf(" ");if(e>=0){var g=a.slice(e,a.length);a=a.slice(0,e)}var h="GET";c&&(f.isFunction(c)?(d=c,c=b):typeof c=="object"&&(c=f.param(c,f.ajaxSettings.traditional),h="POST"));var i=this;f.ajax({url:a,type:h,dataType:"html",data:c,complete:function(a,b,c){c=a.responseText,a.isResolved()&&(a.done(function(a){c=a}),i.html(g?f("
").append(c.replace(bN,"")).find(g):c)),d&&i.each(d,[c,b,a])}});return this},serialize:function(){return f.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?f.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||bO.test(this.nodeName)||bI.test(this.type))}).map(function(a,b){var c=f(this).val();return c==null?null:f.isArray(c)?f.map(c,function(a,c){return{name:b.name,value:a.replace(bF,"\r\n")}}):{name:b.name,value:c.replace(bF,"\r\n")}}).get()}}),f.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,b){f.fn[b]=function(a){return this.on(b,a)}}),f.each(["get","post"],function(a,c){f[c]=function(a,d,e,g){f.isFunction(d)&&(g=g||e,e=d,d=b);return f.ajax({type:c,url:a,data:d,success:e,dataType:g})}}),f.extend({getScript:function(a,c){return f.get(a,b,c,"script")},getJSON:function(a,b,c){return f.get(a,b,c,"json")},ajaxSetup:function(a,b){b?b_(a,f.ajaxSettings):(b=a,a=f.ajaxSettings),b_(a,b);return a},ajaxSettings:{url:bV,isLocal:bJ.test(bW[1]),global:!0,type:"GET",contentType:"application/x-www-form-urlencoded",processData:!0,async:!0,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":bX},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":a.String,"text html":!0,"text json":f.parseJSON,"text xml":f.parseXML},flatOptions:{context:!0,url:!0}},ajaxPrefilter:bZ(bT),ajaxTransport:bZ(bU),ajax:function(a,c){function w(a,c,l,m){if(s!==2){s=2,q&&clearTimeout(q),p=b,n=m||"",v.readyState=a>0?4:0;var o,r,u,w=c,x=l?cb(d,v,l):b,y,z;if(a>=200&&a<300||a===304){if(d.ifModified){if(y=v.getResponseHeader("Last-Modified"))f.lastModified[k]=y;if(z=v.getResponseHeader("Etag"))f.etag[k]=z}if(a===304)w="notmodified",o=!0;else try{r=cc(d,x),w="success",o=!0}catch(A){w="parsererror",u=A}}else{u=w;if(!w||a)w="error",a<0&&(a=0)}v.status=a,v.statusText=""+(c||w),o?h.resolveWith(e,[r,w,v]):h.rejectWith(e,[v,w,u]),v.statusCode(j),j=b,t&&g.trigger("ajax"+(o?"Success":"Error"),[v,d,o?r:u]),i.fireWith(e,[v,w]),t&&(g.trigger("ajaxComplete",[v,d]),--f.active||f.event.trigger("ajaxStop"))}}typeof a=="object"&&(c=a,a=b),c=c||{};var d=f.ajaxSetup({},c),e=d.context||d,g=e!==d&&(e.nodeType||e instanceof f)?f(e):f.event,h=f.Deferred(),i=f.Callbacks("once memory"),j=d.statusCode||{},k,l={},m={},n,o,p,q,r,s=0,t,u,v={readyState:0,setRequestHeader:function(a,b){if(!s){var c=a.toLowerCase();a=m[c]=m[c]||a,l[a]=b}return this},getAllResponseHeaders:function(){return s===2?n:null},getResponseHeader:function(a){var c;if(s===2){if(!o){o={};while(c=bH.exec(n))o[c[1].toLowerCase()]=c[2]}c=o[a.toLowerCase()]}return c===b?null:c},overrideMimeType:function(a){s||(d.mimeType=a);return this},abort:function(a){a=a||"abort",p&&p.abort(a),w(0,a);return this}};h.promise(v),v.success=v.done,v.error=v.fail,v.complete=i.add,v.statusCode=function(a){if(a){var b;if(s<2)for(b in a)j[b]=[j[b],a[b]];else b=a[v.status],v.then(b,b)}return this},d.url=((a||d.url)+"").replace(bG,"").replace(bL,bW[1]+"//"),d.dataTypes=f.trim(d.dataType||"*").toLowerCase().split(bP),d.crossDomain==null&&(r=bR.exec(d.url.toLowerCase()),d.crossDomain=!(!r||r[1]==bW[1]&&r[2]==bW[2]&&(r[3]||(r[1]==="http:"?80:443))==(bW[3]||(bW[1]==="http:"?80:443)))),d.data&&d.processData&&typeof d.data!="string"&&(d.data=f.param(d.data,d.traditional)),b$(bT,d,c,v);if(s===2)return!1;t=d.global,d.type=d.type.toUpperCase(),d.hasContent=!bK.test(d.type),t&&f.active++===0&&f.event.trigger("ajaxStart");if(!d.hasContent){d.data&&(d.url+=(bM.test(d.url)?"&":"?")+d.data,delete d.data),k=d.url;if(d.cache===!1){var x=f.now(),y=d.url.replace(bQ,"$1_="+x);d.url=y+(y===d.url?(bM.test(d.url)?"&":"?")+"_="+x:"")}}(d.data&&d.hasContent&&d.contentType!==!1||c.contentType)&&v.setRequestHeader("Content-Type",d.contentType),d.ifModified&&(k=k||d.url,f.lastModified[k]&&v.setRequestHeader("If-Modified-Since",f.lastModified[k]),f.etag[k]&&v.setRequestHeader("If-None-Match",f.etag[k])),v.setRequestHeader("Accept",d.dataTypes[0]&&d.accepts[d.dataTypes[0]]?d.accepts[d.dataTypes[0]]+(d.dataTypes[0]!=="*"?", "+bX+"; q=0.01":""):d.accepts["*"]);for(u in d.headers)v.setRequestHeader(u,d.headers[u]);if(d.beforeSend&&(d.beforeSend.call(e,v,d)===!1||s===2)){v.abort();return!1}for(u in{success:1,error:1,complete:1})v[u](d[u]);p=b$(bU,d,c,v);if(!p)w(-1,"No Transport");else{v.readyState=1,t&&g.trigger("ajaxSend",[v,d]),d.async&&d.timeout>0&&(q=setTimeout(function(){v.abort("timeout")},d.timeout));try{s=1,p.send(l,w)}catch(z){if(s<2)w(-1,z);else throw z}}return v},param:function(a,c){var d=[],e=function(a,b){b=f.isFunction(b)?b():b,d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};c===b&&(c=f.ajaxSettings.traditional);if(f.isArray(a)||a.jquery&&!f.isPlainObject(a))f.each(a,function(){e(this.name,this.value)});else for(var g in a)ca(g,a[g],c,e);return d.join("&").replace(bD,"+")}}),f.extend({active:0,lastModified:{},etag:{}});var cd=f.now(),ce=/(\=)\?(&|$)|\?\?/i;f.ajaxSetup({jsonp:"callback",jsonpCallback:function(){return f.expando+"_"+cd++}}),f.ajaxPrefilter("json jsonp",function(b,c,d){var e=b.contentType==="application/x-www-form-urlencoded"&&typeof b.data=="string";if(b.dataTypes[0]==="jsonp"||b.jsonp!==!1&&(ce.test(b.url)||e&&ce.test(b.data))){var g,h=b.jsonpCallback=f.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,i=a[h],j=b.url,k=b.data,l="$1"+h+"$2";b.jsonp!==!1&&(j=j.replace(ce,l),b.url===j&&(e&&(k=k.replace(ce,l)),b.data===k&&(j+=(/\?/.test(j)?"&":"?")+b.jsonp+"="+h))),b.url=j,b.data=k,a[h]=function(a){g=[a]},d.always(function(){a[h]=i,g&&f.isFunction(i)&&a[h](g[0])}),b.converters["script json"]=function(){g||f.error(h+" was not called");return g[0]},b.dataTypes[0]="json";return"script"}}),f.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(a){f.globalEval(a);return a}}}),f.ajaxPrefilter("script",function(a){a.cache===b&&(a.cache=!1),a.crossDomain&&(a.type="GET",a.global=!1)}),f.ajaxTransport("script",function(a){if(a.crossDomain){var d,e=c.head||c.getElementsByTagName("head")[0]||c.documentElement;return{send:function(f,g){d=c.createElement("script"),d.async="async",a.scriptCharset&&(d.charset=a.scriptCharset),d.src=a.url,d.onload=d.onreadystatechange=function(a,c){if(c||!d.readyState||/loaded|complete/.test(d.readyState))d.onload=d.onreadystatechange=null,e&&d.parentNode&&e.removeChild(d),d=b,c||g(200,"success")},e.insertBefore(d,e.firstChild)},abort:function(){d&&d.onload(0,1)}}}});var cf=a.ActiveXObject?function(){for(var a in ch)ch[a](0,1)}:!1,cg=0,ch;f.ajaxSettings.xhr=a.ActiveXObject?function(){return!this.isLocal&&ci()||cj()}:ci,function(a){f.extend(f.support,{ajax:!!a,cors:!!a&&"withCredentials"in a})}(f.ajaxSettings.xhr()),f.support.ajax&&f.ajaxTransport(function(c){if(!c.crossDomain||f.support.cors){var d;return{send:function(e,g){var h=c.xhr(),i,j;c.username?h.open(c.type,c.url,c.async,c.username,c.password):h.open(c.type,c.url,c.async);if(c.xhrFields)for(j in c.xhrFields)h[j]=c.xhrFields[j];c.mimeType&&h.overrideMimeType&&h.overrideMimeType(c.mimeType),!c.crossDomain&&!e["X-Requested-With"]&&(e["X-Requested-With"]="XMLHttpRequest");try{for(j in e)h.setRequestHeader(j,e[j])}catch(k){}h.send(c.hasContent&&c.data||null),d=function(a,e){var j,k,l,m,n;try{if(d&&(e||h.readyState===4)){d=b,i&&(h.onreadystatechange=f.noop,cf&&delete ch[i]);if(e)h.readyState!==4&&h.abort();else{j=h.status,l=h.getAllResponseHeaders(),m={},n=h.responseXML,n&&n.documentElement&&(m.xml=n),m.text=h.responseText;try{k=h.statusText}catch(o){k=""}!j&&c.isLocal&&!c.crossDomain?j=m.text?200:404:j===1223&&(j=204)}}}catch(p){e||g(-1,p)}m&&g(j,k,m,l)},!c.async||h.readyState===4?d():(i=++cg,cf&&(ch||(ch={},f(a).unload(cf)),ch[i]=d),h.onreadystatechange=d)},abort:function(){d&&d(0,1)}}}});var ck={},cl,cm,cn=/^(?:toggle|show|hide)$/,co=/^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,cp,cq=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]],cr;f.fn.extend({show:function(a,b,c){var d,e;if(a||a===0)return this.animate(cu("show",3),a,b,c);for(var g=0,h=this.length;g=i.duration+this.startTime){this.now=this.end,this.pos=this.state=1,this.update(),i.animatedProperties[this.prop]=!0;for(b in i.animatedProperties)i.animatedProperties[b]!==!0&&(g=!1);if(g){i.overflow!=null&&!f.support.shrinkWrapBlocks&&f.each(["","X","Y"],function(a,b){h.style["overflow"+b]=i.overflow[a]}),i.hide&&f(h).hide();if(i.hide||i.show)for(b in i.animatedProperties)f.style(h,b,i.orig[b]),f.removeData(h,"fxshow"+b,!0),f.removeData(h,"toggle"+b,!0);d=i.complete,d&&(i.complete=!1,d.call(h))}return!1}i.duration==Infinity?this.now=e:(c=e-this.startTime,this.state=c/i.duration,this.pos=f.easing[i.animatedProperties[this.prop]](this.state,c,0,1,i.duration),this.now=this.start+(this.end-this.start)*this.pos),this.update();return!0}},f.extend(f.fx,{tick:function(){var a,b=f.timers,c=0;for(;c-1,k={},l={},m,n;j?(l=e.position(),m=l.top,n=l.left):(m=parseFloat(h)||0,n=parseFloat(i)||0),f.isFunction(b)&&(b=b.call(a,c,g)),b.top!=null&&(k.top=b.top-g.top+m),b.left!=null&&(k.left=b.left-g.left+n),"using"in b?b.using.call(a,k):e.css(k)}},f.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),c=this.offset(),d=cx.test(b[0].nodeName)?{top:0,left:0}:b.offset();c.top-=parseFloat(f.css(a,"marginTop"))||0,c.left-=parseFloat(f.css(a,"marginLeft"))||0,d.top+=parseFloat(f.css(b[0],"borderTopWidth"))||0,d.left+=parseFloat(f.css(b[0],"borderLeftWidth"))||0;return{top:c.top-d.top,left:c.left-d.left}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||c.body;while(a&&!cx.test(a.nodeName)&&f.css(a,"position")==="static")a=a.offsetParent;return a})}}),f.each(["Left","Top"],function(a,c){var d="scroll"+c;f.fn[d]=function(c){var e,g;if(c===b){e=this[0];if(!e)return null;g=cy(e);return g?"pageXOffset"in g?g[a?"pageYOffset":"pageXOffset"]:f.support.boxModel&&g.document.documentElement[d]||g.document.body[d]:e[d]}return this.each(function(){g=cy(this),g?g.scrollTo(a?f(g).scrollLeft():c,a?c:f(g).scrollTop()):this[d]=c})}}),f.each(["Height","Width"],function(a,c){var d=c.toLowerCase();f.fn["inner"+c]=function(){var a=this[0];return a?a.style?parseFloat(f.css(a,d,"padding")):this[d]():null},f.fn["outer"+c]=function(a){var b=this[0];return b?b.style?parseFloat(f.css(b,d,a?"margin":"border")):this[d]():null},f.fn[d]=function(a){var e=this[0];if(!e)return a==null?null:this;if(f.isFunction(a))return this.each(function(b){var c=f(this);c[d](a.call(this,b,c[d]()))});if(f.isWindow(e)){var g=e.document.documentElement["client"+c],h=e.document.body;return e.document.compatMode==="CSS1Compat"&&g||h&&h["client"+c]||g}if(e.nodeType===9)return Math.max(e.documentElement["client"+c],e.body["scroll"+c],e.documentElement["scroll"+c],e.body["offset"+c],e.documentElement["offset"+c]);if(a===b){var i=f.css(e,d),j=parseFloat(i);return f.isNumeric(j)?j:i}return this.css(d,typeof a=="string"?a:a+"px")}}),a.jQuery=a.$=f,typeof define=="function"&&define.amd&&define.amd.jQuery&&define("jquery",[],function(){return f})})(window); \ No newline at end of file +(function(a,b){function cy(a){return f.isWindow(a)?a:a.nodeType===9?a.defaultView||a.parentWindow:!1;}function cv(a){if(!ck[a]){var b=c.body,d=f("<"+a+">").appendTo(b),e=d.css("display");d.remove();if(e==="none"||e===""){cl||(cl=c.createElement("iframe"),cl.frameBorder=cl.width=cl.height=0),b.appendChild(cl);if(!cm||!cl.createElement)cm=(cl.contentWindow||cl.contentDocument).document,cm.write((c.compatMode==="CSS1Compat"?"":"")+""),cm.close();d=cm.createElement(a),cm.body.appendChild(d),e=f.css(d,"display"),b.removeChild(cl);}ck[a]=e;}return ck[a];}function cu(a,b){var c={};f.each(cq.concat.apply([],cq.slice(0,b)),function(){c[this]=a;});return c;}function ct(){cr=b;}function cs(){setTimeout(ct,0);return cr=f.now();}function cj(){try{return new a.ActiveXObject("Microsoft.XMLHTTP");}catch(b){}}function ci(){try{return new a.XMLHttpRequest;}catch(b){}}function cc(a,c){a.dataFilter&&(c=a.dataFilter(c,a.dataType));var d=a.dataTypes,e={},g,h,i=d.length,j,k=d[0],l,m,n,o,p;for(g=1;g0){if(c!=="border")for(;g=0===c;});}function S(a){return!a||!a.parentNode||a.parentNode.nodeType===11;}function K(){return!0;}function J(){return!1;}function n(a,b,c){var d=b+"defer",e=b+"queue",g=b+"mark",h=f._data(a,d);h&&(c==="queue"||!f._data(a,e))&&(c==="mark"||!f._data(a,g))&&setTimeout(function(){!f._data(a,e)&&!f._data(a,g)&&(f.removeData(a,d,!0),h.fire());},0);}function m(a){for(var b in a){if(b==="data"&&f.isEmptyObject(a[b]))continue;if(b!=="toJSON")return!1;}return!0;}function l(a,c,d){if(d===b&&a.nodeType===1){var e="data-"+c.replace(k,"-$1").toLowerCase();d=a.getAttribute(e);if(typeof d=="string"){try{d=d==="true"?!0:d==="false"?!1:d==="null"?null:f.isNumeric(d)?parseFloat(d):j.test(d)?f.parseJSON(d):d;}catch(g){}f.data(a,c,d);}else d=b;}return d;}function h(a){var b=g[a]={},c,d;a=a.split(/\s+/);for(c=0,d=a.length;c)[^>]*$|#([\w\-]*)$)/,j=/\S/,k=/^\s+/,l=/\s+$/,m=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,n=/^[\],:{}\s]*$/,o=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,p=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,q=/(?:^|:|,)(?:\s*\[)+/g,r=/(webkit)[ \/]([\w.]+)/,s=/(opera)(?:.*version)?[ \/]([\w.]+)/,t=/(msie) ([\w.]+)/,u=/(mozilla)(?:.*? rv:([\w.]+))?/,v=/-([a-z]|[0-9])/ig,w=/^-ms-/,x=function(a,b){return(b+"").toUpperCase();},y=d.userAgent,z,A,B,C=Object.prototype.toString,D=Object.prototype.hasOwnProperty,E=Array.prototype.push,F=Array.prototype.slice,G=String.prototype.trim,H=Array.prototype.indexOf,I={};e.fn=e.prototype={constructor:e,init:function(a,d,f){var g,h,j,k;if(!a)return this;if(a.nodeType){this.context=this[0]=a,this.length=1;return this;}if(a==="body"&&!d&&c.body){this.context=c,this[0]=c.body,this.selector=a,this.length=1;return this;}if(typeof a=="string"){a.charAt(0)!=="<"||a.charAt(a.length-1)!==">"||a.length<3?g=i.exec(a):g=[null,a,null];if(g&&(g[1]||!d)){if(g[1]){d=d instanceof e?d[0]:d,k=d?d.ownerDocument||d:c,j=m.exec(a),j?e.isPlainObject(d)?(a=[c.createElement(j[1])],e.fn.attr.call(a,d,!0)):a=[k.createElement(j[1])]:(j=e.buildFragment([g[1]],[k]),a=(j.cacheable?e.clone(j.fragment):j.fragment).childNodes);return e.merge(this,a);}h=c.getElementById(g[2]);if(h&&h.parentNode){if(h.id!==g[2])return f.find(a);this.length=1,this[0]=h;}this.context=c,this.selector=a;return this;}return!d||d.jquery?(d||f).find(a):this.constructor(d).find(a);}if(e.isFunction(a))return f.ready(a);a.selector!==b&&(this.selector=a.selector,this.context=a.context);return e.makeArray(a,this);},selector:"",jquery:"1.7.1",length:0,size:function(){return this.length;},toArray:function(){return F.call(this,0);},get:function(a){return a==null?this.toArray():a<0?this[this.length+a]:this[a];},pushStack:function(a,b,c){var d=this.constructor();e.isArray(a)?E.apply(d,a):e.merge(d,a),d.prevObject=this,d.context=this.context,b==="find"?d.selector=this.selector+(this.selector?" ":"")+c:b&&(d.selector=this.selector+"."+b+"("+c+")");return d;},each:function(a,b){return e.each(this,a,b);},ready:function(a){e.bindReady(),A.add(a);return this;},eq:function(a){a=+a;return a===-1?this.slice(a):this.slice(a,a+1);},first:function(){return this.eq(0);},last:function(){return this.eq(-1);},slice:function(){return this.pushStack(F.apply(this,arguments),"slice",F.call(arguments).join(","));},map:function(a){return this.pushStack(e.map(this,function(b,c){return a.call(b,c,b);}));},end:function(){return this.prevObject||this.constructor(null);},push:E,sort:[].sort,splice:[].splice},e.fn.init.prototype=e.fn,e.extend=e.fn.extend=function(){var a,c,d,f,g,h,i=arguments[0]||{},j=1,k=arguments.length,l=!1;typeof i=="boolean"&&(l=i,i=arguments[1]||{},j=2),typeof i!="object"&&!e.isFunction(i)&&(i={}),k===j&&(i=this,--j);for(;j0)return;A.fireWith(c,[e]),e.fn.trigger&&e(c).trigger("ready").off("ready");}},bindReady:function(){if(!A){A=e.Callbacks("once memory");if(c.readyState==="complete")return setTimeout(e.ready,1);if(c.addEventListener)c.addEventListener("DOMContentLoaded",B,!1),a.addEventListener("load",e.ready,!1);else if(c.attachEvent){c.attachEvent("onreadystatechange",B),a.attachEvent("onload",e.ready);var b=!1;try{b=a.frameElement==null;}catch(d){}c.documentElement.doScroll&&b&&J();}}},isFunction:function(a){return e.type(a)==="function";},isArray:Array.isArray||function(a){return e.type(a)==="array";},isWindow:function(a){return a&&typeof a=="object"&&"setInterval"in a;},isNumeric:function(a){return!isNaN(parseFloat(a))&&isFinite(a);},type:function(a){return a==null?String(a):I[C.call(a)]||"object";},isPlainObject:function(a){if(!a||e.type(a)!=="object"||a.nodeType||e.isWindow(a))return!1;try{if(a.constructor&&!D.call(a,"constructor")&&!D.call(a.constructor.prototype,"isPrototypeOf"))return!1;}catch(c){return!1;}var d;for(d in a);return d===b||D.call(a,d);},isEmptyObject:function(a){for(var b in a)return!1;return!0;},error:function(a){throw new Error(a);},parseJSON:function(b){if(typeof b!="string"||!b)return null;b=e.trim(b);if(a.JSON&&a.JSON.parse)return a.JSON.parse(b);if(n.test(b.replace(o,"@").replace(p,"]").replace(q,"")))return(new Function("return "+b))();e.error("Invalid JSON: "+b);},parseXML:function(c){var d,f;try{a.DOMParser?(f=new DOMParser,d=f.parseFromString(c,"text/xml")):(d=new ActiveXObject("Microsoft.XMLDOM"),d.async="false",d.loadXML(c));}catch(g){d=b;}(!d||!d.documentElement||d.getElementsByTagName("parsererror").length)&&e.error("Invalid XML: "+c);return d;},noop:function(){},globalEval:function(b){b&&j.test(b)&&(a.execScript||function(b){a.eval.call(a,b);})(b);},camelCase:function(a){return a.replace(w,"ms-").replace(v,x);},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase();},each:function(a,c,d){var f,g=0,h=a.length,i=h===b||e.isFunction(a);if(d){if(i){for(f in a)if(c.apply(a[f],d)===!1)break;}else for(;g0&&a[0]&&a[j-1]||j===0||e.isArray(a));if(k)for(;i1?i.call(arguments,0):b,j.notifyWith(k,e);};}function l(a){return function(c){b[a]=arguments.length>1?i.call(arguments,0):c,--g||j.resolveWith(j,b);};}var b=i.call(arguments,0),c=0,d=b.length,e=Array(d),g=d,h=d,j=d<=1&&a&&f.isFunction(a.promise)?a:f.Deferred(),k=j.promise();if(d>1){for(;c
a",d=q.getElementsByTagName("*"),e=q.getElementsByTagName("a")[0];if(!d||!d.length||!e)return{};g=c.createElement("select"),h=g.appendChild(c.createElement("option")),i=q.getElementsByTagName("input")[0],b={leadingWhitespace:q.firstChild.nodeType===3,tbody:!q.getElementsByTagName("tbody").length,htmlSerialize:!!q.getElementsByTagName("link").length,style:/top/.test(e.getAttribute("style")),hrefNormalized:e.getAttribute("href")==="/a",opacity:/^0.55/.test(e.style.opacity),cssFloat:!!e.style.cssFloat,checkOn:i.value==="on",optSelected:h.selected,getSetAttribute:q.className!=="t",enctype:!!c.createElement("form").enctype,html5Clone:c.createElement("nav").cloneNode(!0).outerHTML!=="<:nav>",submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0},i.checked=!0,b.noCloneChecked=i.cloneNode(!0).checked,g.disabled=!0,b.optDisabled=!h.disabled;try{delete q.test;}catch(s){b.deleteExpando=!1;}!q.addEventListener&&q.attachEvent&&q.fireEvent&&(q.attachEvent("onclick",function(){b.noCloneEvent=!1;}),q.cloneNode(!0).fireEvent("onclick")),i=c.createElement("input"),i.value="t",i.setAttribute("type","radio"),b.radioValue=i.value==="t",i.setAttribute("checked","checked"),q.appendChild(i),k=c.createDocumentFragment(),k.appendChild(q.lastChild),b.checkClone=k.cloneNode(!0).cloneNode(!0).lastChild.checked,b.appendChecked=i.checked,k.removeChild(i),k.appendChild(q),q.innerHTML="",a.getComputedStyle&&(j=c.createElement("div"),j.style.width="0",j.style.marginRight="0",q.style.width="2px",q.appendChild(j),b.reliableMarginRight=(parseInt((a.getComputedStyle(j,null)||{marginRight:0}).marginRight,10)||0)===0);if(q.attachEvent)for(o in{submit:1,change:1,focusin:1})n="on"+o,p=n in q,p||(q.setAttribute(n,"return;"),p=typeof q[n]=="function"),b[o+"Bubbles"]=p;k.removeChild(q),k=g=h=j=q=i=null,f(function(){var a,d,e,g,h,i,j,k,m,n,o,r=c.getElementsByTagName("body")[0];!r||(j=1,k="position:absolute;top:0;left:0;width:1px;height:1px;margin:0;",m="visibility:hidden;border:0;",n="style='"+k+"border:5px solid #000;padding:0;'",o="
"+""+"
",a=c.createElement("div"),a.style.cssText=m+"width:0;height:0;position:static;top:0;margin-top:"+j+"px",r.insertBefore(a,r.firstChild),q=c.createElement("div"),a.appendChild(q),q.innerHTML="
t
",l=q.getElementsByTagName("td"),p=l[0].offsetHeight===0,l[0].style.display="",l[1].style.display="none",b.reliableHiddenOffsets=p&&l[0].offsetHeight===0,q.innerHTML="",q.style.width=q.style.paddingLeft="1px",f.boxModel=b.boxModel=q.offsetWidth===2,typeof q.style.zoom!="undefined"&&(q.style.display="inline",q.style.zoom=1,b.inlineBlockNeedsLayout=q.offsetWidth===2,q.style.display="",q.innerHTML="
",b.shrinkWrapBlocks=q.offsetWidth!==2),q.style.cssText=k+m,q.innerHTML=o,d=q.firstChild,e=d.firstChild,h=d.nextSibling.firstChild.firstChild,i={doesNotAddBorder:e.offsetTop!==5,doesAddBorderForTableAndCells:h.offsetTop===5},e.style.position="fixed",e.style.top="20px",i.fixedPosition=e.offsetTop===20||e.offsetTop===15,e.style.position=e.style.top="",d.style.overflow="hidden",d.style.position="relative",i.subtractsBorderForOverflowNotVisible=e.offsetTop===-5,i.doesNotIncludeMarginInBodyOffset=r.offsetTop!==j,r.removeChild(a),q=a=null,f.extend(b,i));});return b;}();var j=/^(?:\{.*\}|\[.*\])$/,k=/([A-Z])/g;f.extend({cache:{},uuid:0,expando:"jQuery"+(f.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(a){a=a.nodeType?f.cache[a[f.expando]]:a[f.expando];return!!a&&!m(a);},data:function(a,c,d,e){if(f.acceptData(a)){var g,h,i,j=f.expando,k=typeof c=="string",l=a.nodeType,m=l?f.cache:a,n=l?a[j]:a[j]&&j,o=c==="events";if((!n||!m[n]||!o&&!e&&!m[n].data)&&k&&d===b)return;n||(l?a[j]=n=++f.uuid:n=j),m[n]||(m[n]={},l||(m[n].toJSON=f.noop));if(typeof c=="object"||typeof c=="function")e?m[n]=f.extend(m[n],c):m[n].data=f.extend(m[n].data,c);g=h=m[n],e||(h.data||(h.data={}),h=h.data),d!==b&&(h[f.camelCase(c)]=d);if(o&&!h[c])return g.events;k?(i=h[c],i==null&&(i=h[f.camelCase(c)])):i=h;return i;}},removeData:function(a,b,c){if(f.acceptData(a)){var d,e,g,h=f.expando,i=a.nodeType,j=i?f.cache:a,k=i?a[h]:h;if(!j[k])return;if(b){d=c?j[k]:j[k].data;if(d){f.isArray(b)||(b in d?b=[b]:(b=f.camelCase(b),b in d?b=[b]:b=b.split(" ")));for(e=0,g=b.length;e-1)return!0;return!1;},val:function(a){var c,d,e,g=this[0];{if(arguments.length){e=f.isFunction(a);return this.each(function(d){var g=f(this),h;if(this.nodeType===1){e?h=a.call(this,d,g.val()):h=a,h==null?h="":typeof h=="number"?h+="":f.isArray(h)&&(h=f.map(h,function(a){return a==null?"":a+"";})),c=f.valHooks[this.nodeName.toLowerCase()]||f.valHooks[this.type];if(!c||!("set"in c)||c.set(this,h,"value")===b)this.value=h;}});}if(g){c=f.valHooks[g.nodeName.toLowerCase()]||f.valHooks[g.type];if(c&&"get"in c&&(d=c.get(g,"value"))!==b)return d;d=g.value;return typeof d=="string"?d.replace(q,""):d==null?"":d;}}}}),f.extend({valHooks:{option:{get:function(a){var b=a.attributes.value;return!b||b.specified?a.value:a.text;}},select:{get:function(a){var b,c,d,e,g=a.selectedIndex,h=[],i=a.options,j=a.type==="select-one";if(g<0)return null;c=j?g:0,d=j?g+1:i.length;for(;c=0;}),c.length||(a.selectedIndex=-1);return c;}}},attrFn:{val:!0,css:!0,html:!0,text:!0,data:!0,width:!0,height:!0,offset:!0},attr:function(a,c,d,e){var g,h,i,j=a.nodeType;if(!!a&&j!==3&&j!==8&&j!==2){if(e&&c in f.attrFn)return f(a)[c](d);if(typeof a.getAttribute=="undefined")return f.prop(a,c,d);i=j!==1||!f.isXMLDoc(a),i&&(c=c.toLowerCase(),h=f.attrHooks[c]||(u.test(c)?x:w));if(d!==b){if(d===null){f.removeAttr(a,c);return;}if(h&&"set"in h&&i&&(g=h.set(a,d,c))!==b)return g;a.setAttribute(c,""+d);return d;}if(h&&"get"in h&&i&&(g=h.get(a,c))!==null)return g;g=a.getAttribute(c);return g===null?b:g;}},removeAttr:function(a,b){var c,d,e,g,h=0;if(b&&a.nodeType===1){d=b.toLowerCase().split(p),g=d.length;for(;h=0;}});});var z=/^(?:textarea|input|select)$/i,A=/^([^\.]*)?(?:\.(.+))?$/,B=/\bhover(\.\S+)?\b/,C=/^key/,D=/^(?:mouse|contextmenu)|click/,E=/^(?:focusinfocus|focusoutblur)$/,F=/^(\w*)(?:#([\w\-]+))?(?:\.([\w\-]+))?$/,G=function(a){var b=F.exec(a);b&&(b[1]=(b[1]||"").toLowerCase(),b[3]=b[3]&&new RegExp("(?:^|\\s)"+b[3]+"(?:\\s|$)"));return b;},H=function(a,b){var c=a.attributes||{};return(!b[1]||a.nodeName.toLowerCase()===b[1])&&(!b[2]||(c.id||{}).value===b[2])&&(!b[3]||b[3].test((c["class"]||{}).value));},I=function(a){return f.event.special.hover?a:a.replace(B,"mouseenter$1 mouseleave$1");}; + f.event={add:function(a,c,d,e,g){var h,i,j,k,l,m,n,o,p,q,r,s;if(!(a.nodeType===3||a.nodeType===8||!c||!d||!(h=f._data(a)))){d.handler&&(p=d,d=p.handler),d.guid||(d.guid=f.guid++),j=h.events,j||(h.events=j={}),i=h.handle,i||(h.handle=i=function(a){return typeof f!="undefined"&&(!a||f.event.triggered!==a.type)?f.event.dispatch.apply(i.elem,arguments):b;},i.elem=a),c=f.trim(I(c)).split(" ");for(k=0;k=0&&(h=h.slice(0,-1),k=!0),h.indexOf(".")>=0&&(i=h.split("."),h=i.shift(),i.sort());if((!e||f.event.customEvent[h])&&!f.event.global[h])return;c=typeof c=="object"?c[f.expando]?c:new f.Event(h,c):new f.Event(h),c.type=h,c.isTrigger=!0,c.exclusive=k,c.namespace=i.join("."),c.namespace_re=c.namespace?new RegExp("(^|\\.)"+i.join("\\.(?:.*\\.)?")+"(\\.|$)"):null,o=h.indexOf(":")<0?"on"+h:"";if(!e){j=f.cache;for(l in j)j[l].events&&j[l].events[h]&&f.event.trigger(c,d,j[l].handle.elem,!0);return;}c.result=b,c.target||(c.target=e),d=d!=null?f.makeArray(d):[],d.unshift(c),p=f.event.special[h]||{};if(p.trigger&&p.trigger.apply(e,d)===!1)return;r=[[e,p.bindType||h]];if(!g&&!p.noBubble&&!f.isWindow(e)){s=p.delegateType||h,m=E.test(s+h)?e:e.parentNode,n=null;for(;m;m=m.parentNode)r.push([m,s]),n=m;n&&n===e.ownerDocument&&r.push([n.defaultView||n.parentWindow||a,s]);}for(l=0;le&&i.push({elem:this,matches:d.slice(e)});for(j=0;j0?this.on(b,null,a,c):this.trigger(b);},f.attrFn&&(f.attrFn[b]=!0),C.test(b)&&(f.event.fixHooks[b]=f.event.keyHooks),D.test(b)&&(f.event.fixHooks[b]=f.event.mouseHooks);}),function(){function x(a,b,c,e,f,g){for(var h=0,i=e.length;h0){k=j;break;}}j=j[a];}e[h]=k;}}}function w(a,b,c,e,f,g){for(var h=0,i=e.length;h+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,d="sizcache"+(Math.random()+"").replace(".",""),e=0,g=Object.prototype.toString,h=!1,i=!0,j=/\\/g,k=/\r\n/g,l=/\W/;[0,0].sort(function(){i=!1;return 0;});var m=function(b,d,e,f){e=e||[],d=d||c;var h=d;if(d.nodeType!==1&&d.nodeType!==9)return[];if(!b||typeof b!="string")return e;var i,j,k,l,n,q,r,t,u=!0,v=m.isXML(d),w=[],x=b;do{a.exec(""),i=a.exec(x);if(i){x=i[3],w.push(i[1]);if(i[2]){l=i[3];break;}}}while(i);if(w.length>1&&p.exec(b))if(w.length===2&&o.relative[w[0]])j=y(w[0]+w[1],d,f);else{j=o.relative[w[0]]?[d]:m(w.shift(),d);while(w.length)b=w.shift(),o.relative[b]&&(b+=w.shift()),j=y(b,j,f);}else{!f&&w.length>1&&d.nodeType===9&&!v&&o.match.ID.test(w[0])&&!o.match.ID.test(w[w.length-1])&&(n=m.find(w.shift(),d,v),d=n.expr?m.filter(n.expr,n.set)[0]:n.set[0]);if(d){n=f?{expr:w.pop(),set:s(f)}:m.find(w.pop(),w.length===1&&(w[0]==="~"||w[0]==="+")&&d.parentNode?d.parentNode:d,v),j=n.expr?m.filter(n.expr,n.set):n.set,w.length>0?k=s(j):u=!1;while(w.length)q=w.pop(),r=q,o.relative[q]?r=w.pop():q="",r==null&&(r=d),o.relative[q](k,r,v);}else k=w=[];}k||(k=j),k||m.error(q||b);if(g.call(k)==="[object Array]")if(!u)e.push.apply(e,k);else if(d&&d.nodeType===1)for(t=0;k[t]!=null;t++)k[t]&&(k[t]===!0||k[t].nodeType===1&&m.contains(d,k[t]))&&e.push(j[t]);else for(t=0;k[t]!=null;t++)k[t]&&k[t].nodeType===1&&e.push(j[t]);else s(k,e);l&&(m(l,h,e,f),m.uniqueSort(e));return e;};m.uniqueSort=function(a){if(u){h=i,a.sort(u);if(h)for(var b=1;b0;},m.find=function(a,b,c){var d,e,f,g,h,i;if(!a)return[];for(e=0,f=o.order.length;e":function(a,b){var c,d=typeof b=="string",e=0,f=a.length;if(d&&!l.test(b)){b=b.toLowerCase();for(;e=0)?c||d.push(h):c&&(b[g]=!1));return!1;},ID:function(a){return a[1].replace(j,"");},TAG:function(a,b){return a[1].replace(j,"").toLowerCase();},CHILD:function(a){if(a[1]==="nth"){a[2]||m.error(a[0]),a[2]=a[2].replace(/^\+|\s*/g,"");var b=/(-?)(\d*)(?:n([+\-]?\d*))?/.exec(a[2]==="even"&&"2n"||a[2]==="odd"&&"2n+1"||!/\D/.test(a[2])&&"0n+"+a[2]||a[2]);a[2]=b[1]+(b[2]||1)-0,a[3]=b[3]-0;}else a[2]&&m.error(a[0]);a[0]=e++;return a;},ATTR:function(a,b,c,d,e,f){var g=a[1]=a[1].replace(j,"");!f&&o.attrMap[g]&&(a[1]=o.attrMap[g]),a[4]=(a[4]||a[5]||"").replace(j,""),a[2]==="~="&&(a[4]=" "+a[4]+" ");return a;},PSEUDO:function(b,c,d,e,f){if(b[1]==="not")if((a.exec(b[3])||"").length>1||/^\w/.test(b[3]))b[3]=m(b[3],null,null,c);else{var g=m.filter(b[3],c,d,!0^f);d||e.push.apply(e,g);return!1;}else if(o.match.POS.test(b[0])||o.match.CHILD.test(b[0]))return!0;return b;},POS:function(a){a.unshift(!0);return a;}},filters:{enabled:function(a){return a.disabled===!1&&a.type!=="hidden";},disabled:function(a){return a.disabled===!0;},checked:function(a){return a.checked===!0;},selected:function(a){a.parentNode&&a.parentNode.selectedIndex;return a.selected===!0;},parent:function(a){return!!a.firstChild;},empty:function(a){return!a.firstChild;},has:function(a,b,c){return!!m(c[3],a).length;},header:function(a){return/h\d/i.test(a.nodeName);},text:function(a){var b=a.getAttribute("type"),c=a.type;return a.nodeName.toLowerCase()==="input"&&"text"===c&&(b===c||b===null);},radio:function(a){return a.nodeName.toLowerCase()==="input"&&"radio"===a.type;},checkbox:function(a){return a.nodeName.toLowerCase()==="input"&&"checkbox"===a.type;},file:function(a){return a.nodeName.toLowerCase()==="input"&&"file"===a.type;},password:function(a){return a.nodeName.toLowerCase()==="input"&&"password"===a.type;},submit:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"submit"===a.type;},image:function(a){return a.nodeName.toLowerCase()==="input"&&"image"===a.type;},reset:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"reset"===a.type;},button:function(a){var b=a.nodeName.toLowerCase();return b==="input"&&"button"===a.type||b==="button";},input:function(a){return/input|select|textarea|button/i.test(a.nodeName);},focus:function(a){return a===a.ownerDocument.activeElement;}},setFilters:{first:function(a,b){return b===0;},last:function(a,b,c,d){return b===d.length-1;},even:function(a,b){return b%2===0;},odd:function(a,b){return b%2===1;},lt:function(a,b,c){return bc[3]-0;},nth:function(a,b,c){return c[3]-0===b;},eq:function(a,b,c){return c[3]-0===b;}},filter:{PSEUDO:function(a,b,c,d){var e=b[1],f=o.filters[e];if(f)return f(a,c,b,d);if(e==="contains")return(a.textContent||a.innerText||n([a])||"").indexOf(b[3])>=0;if(e==="not"){var g=b[3];for(var h=0,i=g.length;h=0;}},ID:function(a,b){return a.nodeType===1&&a.getAttribute("id")===b;},TAG:function(a,b){return b==="*"&&a.nodeType===1||!!a.nodeName&&a.nodeName.toLowerCase()===b;},CLASS:function(a,b){return(" "+(a.className||a.getAttribute("class"))+" ").indexOf(b)>-1;},ATTR:function(a,b){var c=b[1],d=m.attr?m.attr(a,c):o.attrHandle[c]?o.attrHandle[c](a):a[c]!=null?a[c]:a.getAttribute(c),e=d+"",f=b[2],g=b[4];return d==null?f==="!=":!f&&m.attr?d!=null:f==="="?e===g:f==="*="?e.indexOf(g)>=0:f==="~="?(" "+e+" ").indexOf(g)>=0:g?f==="!="?e!==g:f==="^="?e.indexOf(g)===0:f==="$="?e.substr(e.length-g.length)===g:f==="|="?e===g||e.substr(0,g.length+1)===g+"-":!1:e&&d!==!1;},POS:function(a,b,c,d){var e=b[2],f=o.setFilters[e];if(f)return f(a,c,b,d);}}},p=o.match.POS,q=function(a,b){return"\\"+(b-0+1);};for(var r in o.match)o.match[r]=new RegExp(o.match[r].source+/(?![^\[]*\])(?![^\(]*\))/.source),o.leftMatch[r]=new RegExp(/(^(?:.|\r|\n)*?)/.source+o.match[r].source.replace(/\\(\d+)/g,q));var s=function(a,b){a=Array.prototype.slice.call(a,0);if(b){b.push.apply(b,a);return b;}return a;};try{Array.prototype.slice.call(c.documentElement.childNodes,0)[0].nodeType;}catch(t){s=function(a,b){var c=0,d=b||[];if(g.call(a)==="[object Array]")Array.prototype.push.apply(d,a);else if(typeof a.length=="number")for(var e=a.length;c",e.insertBefore(a,e.firstChild),c.getElementById(d)&&(o.find.ID=function(a,c,d){if(typeof c.getElementById!="undefined"&&!d){var e=c.getElementById(a[1]);return e?e.id===a[1]||typeof e.getAttributeNode!="undefined"&&e.getAttributeNode("id").nodeValue===a[1]?[e]:b:[];}},o.filter.ID=function(a,b){var c=typeof a.getAttributeNode!="undefined"&&a.getAttributeNode("id");return a.nodeType===1&&c&&c.nodeValue===b;}),e.removeChild(a),e=a=null;}(),function(){var a=c.createElement("div");a.appendChild(c.createComment("")),a.getElementsByTagName("*").length>0&&(o.find.TAG=function(a,b){var c=b.getElementsByTagName(a[1]);if(a[1]==="*"){var d=[];for(var e=0;c[e];e++)c[e].nodeType===1&&d.push(c[e]);c=d;}return c;}),a.innerHTML="",a.firstChild&&typeof a.firstChild.getAttribute!="undefined"&&a.firstChild.getAttribute("href")!=="#"&&(o.attrHandle.href=function(a){return a.getAttribute("href",2);}),a=null;}(),c.querySelectorAll&&function(){var a=m,b=c.createElement("div"),d="__sizzle__";b.innerHTML="

";if(!b.querySelectorAll||b.querySelectorAll(".TEST").length!==0){m=function(b,e,f,g){e=e||c;if(!g&&!m.isXML(e)){var h=/^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec(b);if(h&&(e.nodeType===1||e.nodeType===9)){if(h[1])return s(e.getElementsByTagName(b),f);if(h[2]&&o.find.CLASS&&e.getElementsByClassName)return s(e.getElementsByClassName(h[2]),f);}if(e.nodeType===9){if(b==="body"&&e.body)return s([e.body],f);if(h&&h[3]){var i=e.getElementById(h[3]);if(!i||!i.parentNode)return s([],f);if(i.id===h[3])return s([i],f);}try{return s(e.querySelectorAll(b),f);}catch(j){}}else if(e.nodeType===1&&e.nodeName.toLowerCase()!=="object"){var k=e,l=e.getAttribute("id"),n=l||d,p=e.parentNode,q=/^\s*[+~]/.test(b);l?n=n.replace(/'/g,"\\$&"):e.setAttribute("id",n),q&&p&&(e=e.parentNode);try{if(!q||p)return s(e.querySelectorAll("[id='"+n+"'] "+b),f);}catch(r){}finally{l||k.removeAttribute("id");}}}return a(b,e,f,g);};for(var e in a)m[e]=a[e];b=null;}}(),function(){var a=c.documentElement,b=a.matchesSelector||a.mozMatchesSelector||a.webkitMatchesSelector||a.msMatchesSelector;if(b){var d=!b.call(c.createElement("div"),"div"),e=!1;try{b.call(c.documentElement,"[test!='']:sizzle");}catch(f){e=!0;}m.matchesSelector=function(a,c){c=c.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!m.isXML(a))try{if(e||!o.match.PSEUDO.test(c)&&!/!=/.test(c)){var f=b.call(a,c);if(f||!d||a.document&&a.document.nodeType!==11)return f;}}catch(g){}return m(c,null,null,[a]).length>0;};}}(),function(){var a=c.createElement("div");a.innerHTML="
";if(!!a.getElementsByClassName&&a.getElementsByClassName("e").length!==0){a.lastChild.className="e";if(a.getElementsByClassName("e").length===1)return;o.order.splice(1,0,"CLASS"),o.find.CLASS=function(a,b,c){if(typeof b.getElementsByClassName!="undefined"&&!c)return b.getElementsByClassName(a[1]);},a=null;}}(),c.documentElement.contains?m.contains=function(a,b){return a!==b&&(a.contains?a.contains(b):!0);}:c.documentElement.compareDocumentPosition?m.contains=function(a,b){return!!(a.compareDocumentPosition(b)&16);}:m.contains=function(){return!1;},m.isXML=function(a){var b=(a?a.ownerDocument||a:0).documentElement;return b?b.nodeName!=="HTML":!1;};var y=function(a,b,c){var d,e=[],f="",g=b.nodeType?[b]:b;while(d=o.match.PSEUDO.exec(a))f+=d[0],a=a.replace(o.match.PSEUDO,"");a=o.relative[a]?a+"*":a;for(var h=0,i=g.length;h0)for(h=g;h=0:f.filter(a,this).length>0:this.filter(a).length>0);},closest:function(a,b){var c=[],d,e,g=this[0];if(f.isArray(a)){var h=1;while(g&&g.ownerDocument&&g!==b){for(d=0;d-1:f.find.matchesSelector(g,a)){c.push(g);break;}g=g.parentNode;if(!g||!g.ownerDocument||g===b||g.nodeType===11)break;}}c=c.length>1?f.unique(c):c;return this.pushStack(c,"closest",a);},index:function(a){if(!a)return this[0]&&this[0].parentNode?this.prevAll().length:-1;if(typeof a=="string")return f.inArray(this[0],f(a));return f.inArray(a.jquery?a[0]:a,this);},add:function(a,b){var c=typeof a=="string"?f(a,b):f.makeArray(a&&a.nodeType?[a]:a),d=f.merge(this.get(),c);return this.pushStack(S(c[0])||S(d[0])?d:f.unique(d));},andSelf:function(){return this.add(this.prevObject);}}),f.each({parent:function(a){var b=a.parentNode;return b&&b.nodeType!==11?b:null;},parents:function(a){return f.dir(a,"parentNode");},parentsUntil:function(a,b,c){return f.dir(a,"parentNode",c);},next:function(a){return f.nth(a,2,"nextSibling");},prev:function(a){return f.nth(a,2,"previousSibling");},nextAll:function(a){return f.dir(a,"nextSibling");},prevAll:function(a){return f.dir(a,"previousSibling");},nextUntil:function(a,b,c){return f.dir(a,"nextSibling",c);},prevUntil:function(a,b,c){return f.dir(a,"previousSibling",c);},siblings:function(a){return f.sibling(a.parentNode.firstChild,a);},children:function(a){return f.sibling(a.firstChild);},contents:function(a){return f.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:f.makeArray(a.childNodes);}},function(a,b){f.fn[a]=function(c,d){var e=f.map(this,b,c);L.test(a)||(d=c),d&&typeof d=="string"&&(e=f.filter(d,e)),e=this.length>1&&!R[a]?f.unique(e):e,(this.length>1||N.test(d))&&M.test(a)&&(e=e.reverse());return this.pushStack(e,a,P.call(arguments).join(","));};}),f.extend({filter:function(a,b,c){c&&(a=":not("+a+")");return b.length===1?f.find.matchesSelector(b[0],a)?[b[0]]:[]:f.find.matches(a,b);},dir:function(a,c,d){var e=[],g=a[c];while(g&&g.nodeType!==9&&(d===b||g.nodeType!==1||!f(g).is(d)))g.nodeType===1&&e.push(g),g=g[c];return e;},nth:function(a,b,c,d){b=b||1;var e=0;for(;a;a=a[c])if(a.nodeType===1&&++e===b)break;return a;},sibling:function(a,b){var c=[];for(;a;a=a.nextSibling)a.nodeType===1&&a!==b&&c.push(a);return c;}});var V="abbr|article|aside|audio|canvas|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",W=/ jQuery\d+="(?:\d+|null)"/g,X=/^\s+/,Y=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,Z=/<([\w:]+)/,$=/",""],legend:[1,"
","
"],thead:[1,"","
"],tr:[2,"","
"],td:[3,"","
"],col:[2,"","
"],area:[1,"",""],_default:[0,"",""]},bh=U(c);bg.optgroup=bg.option,bg.tbody=bg.tfoot=bg.colgroup=bg.caption=bg.thead,bg.th=bg.td,f.support.htmlSerialize||(bg._default=[1,"div
","
"]),f.fn.extend({text:function(a){if(f.isFunction(a))return this.each(function(b){var c=f(this);c.text(a.call(this,b,c.text()));});if(typeof a!="object"&&a!==b)return this.empty().append((this[0]&&this[0].ownerDocument||c).createTextNode(a));return f.text(this);},wrapAll:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapAll(a.call(this,b));});if(this[0]){var b=f(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstChild&&a.firstChild.nodeType===1)a=a.firstChild;return a;}).append(this);}return this;},wrapInner:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapInner(a.call(this,b));});return this.each(function(){var b=f(this),c=b.contents();c.length?c.wrapAll(a):b.append(a);});},wrap:function(a){var b=f.isFunction(a);return this.each(function(c){f(this).wrapAll(b?a.call(this,c):a);});},unwrap:function(){return this.parent().each(function(){f.nodeName(this,"body")||f(this).replaceWith(this.childNodes);}).end();},append:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.appendChild(a);});},prepend:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild);});},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this);});if(arguments.length){var a=f.clean(arguments);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments);}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this.nextSibling);});if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,f.clean(arguments));return a;}},remove:function(a,b){for(var c=0,d;(d=this[c])!=null;c++)if(!a||f.filter(a,[d]).length)!b&&d.nodeType===1&&(f.cleanData(d.getElementsByTagName("*")),f.cleanData([d])),d.parentNode&&d.parentNode.removeChild(d);return this;},empty:function() + {for(var a=0,b;(b=this[a])!=null;a++){b.nodeType===1&&f.cleanData(b.getElementsByTagName("*"));while(b.firstChild)b.removeChild(b.firstChild);}return this;},clone:function(a,b){a=a==null?!1:a,b=b==null?a:b;return this.map(function(){return f.clone(this,a,b);});},html:function(a){if(a===b)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(W,""):null;if(typeof a=="string"&&!ba.test(a)&&(f.support.leadingWhitespace||!X.test(a))&&!bg[(Z.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(Y,"<$1>");try{for(var c=0,d=this.length;c1&&l0?this.clone(!0):this).get();f(e[h])[b](j),d=d.concat(j);}return this.pushStack(d,a,e.selector);};}),f.extend({clone:function(a,b,c){var d,e,g,h=f.support.html5Clone||!bc.test("<"+a.nodeName)?a.cloneNode(!0):bo(a);if((!f.support.noCloneEvent||!f.support.noCloneChecked)&&(a.nodeType===1||a.nodeType===11)&&!f.isXMLDoc(a)){bk(a,h),d=bl(a),e=bl(h);for(g=0;d[g];++g)e[g]&&bk(d[g],e[g]);}if(b){bj(a,h);if(c){d=bl(a),e=bl(h);for(g=0;d[g];++g)bj(d[g],e[g]);}}d=e=null;return h;},clean:function(a,b,d,e){var g;b=b||c,typeof b.createElement=="undefined"&&(b=b.ownerDocument||b[0]&&b[0].ownerDocument||c);var h=[],i;for(var j=0,k;(k=a[j])!=null;j++){typeof k=="number"&&(k+="");if(!k)continue;if(typeof k=="string")if(!_.test(k))k=b.createTextNode(k);else{k=k.replace(Y,"<$1>");var l=(Z.exec(k)||["",""])[1].toLowerCase(),m=bg[l]||bg._default,n=m[0],o=b.createElement("div");b===c?bh.appendChild(o):U(b).appendChild(o),o.innerHTML=m[1]+k+m[2];while(n--)o=o.lastChild;if(!f.support.tbody){var p=$.test(k),q=l==="table"&&!p?o.firstChild&&o.firstChild.childNodes:m[1]===""&&!p?o.childNodes:[];for(i=q.length-1;i>=0;--i)f.nodeName(q[i],"tbody")&&!q[i].childNodes.length&&q[i].parentNode.removeChild(q[i]);}!f.support.leadingWhitespace&&X.test(k)&&o.insertBefore(b.createTextNode(X.exec(k)[0]),o.firstChild),k=o.childNodes;}var r;if(!f.support.appendChecked)if(k[0]&&typeof (r=k.length)=="number")for(i=0;i=0)return b+"px";}};}),f.support.opacity||(f.cssHooks.opacity={get:function(a,b){return br.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?parseFloat(RegExp.$1)/100+"":b?"1":"";},set:function(a,b){var c=a.style,d=a.currentStyle,e=f.isNumeric(b)?"alpha(opacity="+b*100+")":"",g=d&&d.filter||c.filter||"";c.zoom=1;if(b>=1&&f.trim(g.replace(bq,""))===""){c.removeAttribute("filter");if(d&&!d.filter)return;}c.filter=bq.test(g)?g.replace(bq,e):g+" "+e;}}),f(function(){f.support.reliableMarginRight||(f.cssHooks.marginRight={get:function(a,b){var c;f.swap(a,{display:"inline-block"},function(){b?c=bz(a,"margin-right","marginRight"):c=a.style.marginRight;});return c;}});}),c.defaultView&&c.defaultView.getComputedStyle&&(bA=function(a,b){var c,d,e;b=b.replace(bs,"-$1").toLowerCase(),(d=a.ownerDocument.defaultView)&&(e=d.getComputedStyle(a,null))&&(c=e.getPropertyValue(b),c===""&&!f.contains(a.ownerDocument.documentElement,a)&&(c=f.style(a,b)));return c;}),c.documentElement.currentStyle&&(bB=function(a,b){var c,d,e,f=a.currentStyle&&a.currentStyle[b],g=a.style;f===null&&g&&(e=g[b])&&(f=e),!bt.test(f)&&bu.test(f)&&(c=g.left,d=a.runtimeStyle&&a.runtimeStyle.left,d&&(a.runtimeStyle.left=a.currentStyle.left),g.left=b==="fontSize"?"1em":f||0,f=g.pixelLeft+"px",g.left=c,d&&(a.runtimeStyle.left=d));return f===""?"auto":f;}),bz=bA||bB,f.expr&&f.expr.filters&&(f.expr.filters.hidden=function(a){var b=a.offsetWidth,c=a.offsetHeight;return b===0&&c===0||!f.support.reliableHiddenOffsets&&(a.style&&a.style.display||f.css(a,"display"))==="none";},f.expr.filters.visible=function(a){return!f.expr.filters.hidden(a);});var bD=/%20/g,bE=/\[\]$/,bF=/\r?\n/g,bG=/#.*$/,bH=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,bI=/^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,bJ=/^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/,bK=/^(?:GET|HEAD)$/,bL=/^\/\//,bM=/\?/,bN=/)<[^<]*)*<\/script>/gi,bO=/^(?:select|textarea)/i,bP=/\s+/,bQ=/([?&])_=[^&]*/,bR=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/,bS=f.fn.load,bT={},bU={},bV,bW,bX=["*/"]+["*"];try{bV=e.href;}catch(bY){bV=c.createElement("a"),bV.href="",bV=bV.href;}bW=bR.exec(bV.toLowerCase())||[],f.fn.extend({load:function(a,c,d){if(typeof a!="string"&&bS)return bS.apply(this,arguments);if(!this.length)return this;var e=a.indexOf(" ");if(e>=0){var g=a.slice(e,a.length);a=a.slice(0,e);}var h="GET";c&&(f.isFunction(c)?(d=c,c=b):typeof c=="object"&&(c=f.param(c,f.ajaxSettings.traditional),h="POST"));var i=this;f.ajax({url:a,type:h,dataType:"html",data:c,complete:function(a,b,c){c=a.responseText,a.isResolved()&&(a.done(function(a){c=a;}),i.html(g?f("
").append(c.replace(bN,"")).find(g):c)),d&&i.each(d,[c,b,a]);}});return this;},serialize:function(){return f.param(this.serializeArray());},serializeArray:function(){return this.map(function(){return this.elements?f.makeArray(this.elements):this;}).filter(function(){return this.name&&!this.disabled&&(this.checked||bO.test(this.nodeName)||bI.test(this.type));}).map(function(a,b){var c=f(this).val();return c==null?null:f.isArray(c)?f.map(c,function(a,c){return{name:b.name,value:a.replace(bF,"\r\n")};}):{name:b.name,value:c.replace(bF,"\r\n")};}).get();}}),f.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,b){f.fn[b]=function(a){return this.on(b,a);};}),f.each(["get","post"],function(a,c){f[c]=function(a,d,e,g){f.isFunction(d)&&(g=g||e,e=d,d=b);return f.ajax({type:c,url:a,data:d,success:e,dataType:g});};}),f.extend({getScript:function(a,c){return f.get(a,b,c,"script");},getJSON:function(a,b,c){return f.get(a,b,c,"json");},ajaxSetup:function(a,b){b?b_(a,f.ajaxSettings):(b=a,a=f.ajaxSettings),b_(a,b);return a;},ajaxSettings:{url:bV,isLocal:bJ.test(bW[1]),global:!0,type:"GET",contentType:"application/x-www-form-urlencoded",processData:!0,async:!0,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":bX},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":a.String,"text html":!0,"text json":f.parseJSON,"text xml":f.parseXML},flatOptions:{context:!0,url:!0}},ajaxPrefilter:bZ(bT),ajaxTransport:bZ(bU),ajax:function(a,c){function w(a,c,l,m){if(s!==2){s=2,q&&clearTimeout(q),p=b,n=m||"",v.readyState=a>0?4:0;var o,r,u,w=c,x=l?cb(d,v,l):b,y,z;if(a>=200&&a<300||a===304){if(d.ifModified){if(y=v.getResponseHeader("Last-Modified"))f.lastModified[k]=y;if(z=v.getResponseHeader("Etag"))f.etag[k]=z;}if(a===304)w="notmodified",o=!0;else try{r=cc(d,x),w="success",o=!0;}catch(A){w="parsererror",u=A;}}else{u=w;if(!w||a)w="error",a<0&&(a=0);}v.status=a,v.statusText=""+(c||w),o?h.resolveWith(e,[r,w,v]):h.rejectWith(e,[v,w,u]),v.statusCode(j),j=b,t&&g.trigger("ajax"+(o?"Success":"Error"),[v,d,o?r:u]),i.fireWith(e,[v,w]),t&&(g.trigger("ajaxComplete",[v,d]),--f.active||f.event.trigger("ajaxStop"));}}typeof a=="object"&&(c=a,a=b),c=c||{};var d=f.ajaxSetup({},c),e=d.context||d,g=e!==d&&(e.nodeType||e instanceof f)?f(e):f.event,h=f.Deferred(),i=f.Callbacks("once memory"),j=d.statusCode||{},k,l={},m={},n,o,p,q,r,s=0,t,u,v={readyState:0,setRequestHeader:function(a,b){if(!s){var c=a.toLowerCase();a=m[c]=m[c]||a,l[a]=b;}return this;},getAllResponseHeaders:function(){return s===2?n:null;},getResponseHeader:function(a){var c;if(s===2){if(!o){o={};while(c=bH.exec(n))o[c[1].toLowerCase()]=c[2];}c=o[a.toLowerCase()];}return c===b?null:c;},overrideMimeType:function(a){s||(d.mimeType=a);return this;},abort:function(a){a=a||"abort",p&&p.abort(a),w(0,a);return this;}};h.promise(v),v.success=v.done,v.error=v.fail,v.complete=i.add,v.statusCode=function(a){if(a){var b;if(s<2)for(b in a)j[b]=[j[b],a[b]];else b=a[v.status],v.then(b,b);}return this;},d.url=((a||d.url)+"").replace(bG,"").replace(bL,bW[1]+"//"),d.dataTypes=f.trim(d.dataType||"*").toLowerCase().split(bP),d.crossDomain==null&&(r=bR.exec(d.url.toLowerCase()),d.crossDomain=!(!r||r[1]==bW[1]&&r[2]==bW[2]&&(r[3]||(r[1]==="http:"?80:443))==(bW[3]||(bW[1]==="http:"?80:443)))),d.data&&d.processData&&typeof d.data!="string"&&(d.data=f.param(d.data,d.traditional)),b$(bT,d,c,v);if(s===2)return!1;t=d.global,d.type=d.type.toUpperCase(),d.hasContent=!bK.test(d.type),t&&f.active++===0&&f.event.trigger("ajaxStart");if(!d.hasContent){d.data&&(d.url+=(bM.test(d.url)?"&":"?")+d.data,delete d.data),k=d.url;if(d.cache===!1){var x=f.now(),y=d.url.replace(bQ,"$1_="+x);d.url=y+(y===d.url?(bM.test(d.url)?"&":"?")+"_="+x:"");}}(d.data&&d.hasContent&&d.contentType!==!1||c.contentType)&&v.setRequestHeader("Content-Type",d.contentType),d.ifModified&&(k=k||d.url,f.lastModified[k]&&v.setRequestHeader("If-Modified-Since",f.lastModified[k]),f.etag[k]&&v.setRequestHeader("If-None-Match",f.etag[k])),v.setRequestHeader("Accept",d.dataTypes[0]&&d.accepts[d.dataTypes[0]]?d.accepts[d.dataTypes[0]]+(d.dataTypes[0]!=="*"?", "+bX+"; q=0.01":""):d.accepts["*"]);for(u in d.headers)v.setRequestHeader(u,d.headers[u]);if(d.beforeSend&&(d.beforeSend.call(e,v,d)===!1||s===2)){v.abort();return!1;}for(u in{success:1,error:1,complete:1})v[u](d[u]);p=b$(bU,d,c,v);if(!p)w(-1,"No Transport");else{v.readyState=1,t&&g.trigger("ajaxSend",[v,d]),d.async&&d.timeout>0&&(q=setTimeout(function(){v.abort("timeout");},d.timeout));try{s=1,p.send(l,w);}catch(z){if(s<2)w(-1,z);else throw z;}}return v;},param:function(a,c){var d=[],e=function(a,b){b=f.isFunction(b)?b():b,d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(b);};c===b&&(c=f.ajaxSettings.traditional);if(f.isArray(a)||a.jquery&&!f.isPlainObject(a))f.each(a,function(){e(this.name,this.value);});else for(var g in a)ca(g,a[g],c,e);return d.join("&").replace(bD,"+");}}),f.extend({active:0,lastModified:{},etag:{}});var cd=f.now(),ce=/(\=)\?(&|$)|\?\?/i;f.ajaxSetup({jsonp:"callback",jsonpCallback:function(){return f.expando+"_"+cd++;}}),f.ajaxPrefilter("json jsonp",function(b,c,d){var e=b.contentType==="application/x-www-form-urlencoded"&&typeof b.data=="string";if(b.dataTypes[0]==="jsonp"||b.jsonp!==!1&&(ce.test(b.url)||e&&ce.test(b.data))){var g,h=b.jsonpCallback=f.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,i=a[h],j=b.url,k=b.data,l="$1"+h+"$2";b.jsonp!==!1&&(j=j.replace(ce,l),b.url===j&&(e&&(k=k.replace(ce,l)),b.data===k&&(j+=(/\?/.test(j)?"&":"?")+b.jsonp+"="+h))),b.url=j,b.data=k,a[h]=function(a){g=[a];},d.always(function(){a[h]=i,g&&f.isFunction(i)&&a[h](g[0]);}),b.converters["script json"]=function(){g||f.error(h+" was not called");return g[0];},b.dataTypes[0]="json";return"script";}}),f.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(a){f.globalEval(a);return a;}}}),f.ajaxPrefilter("script",function(a){a.cache===b&&(a.cache=!1),a.crossDomain&&(a.type="GET",a.global=!1);}),f.ajaxTransport("script",function(a){if(a.crossDomain){var d,e=c.head||c.getElementsByTagName("head")[0]||c.documentElement;return{send:function(f,g){d=c.createElement("script"),d.async="async",a.scriptCharset&&(d.charset=a.scriptCharset),d.src=a.url,d.onload=d.onreadystatechange=function(a,c){if(c||!d.readyState||/loaded|complete/.test(d.readyState))d.onload=d.onreadystatechange=null,e&&d.parentNode&&e.removeChild(d),d=b,c||g(200,"success");},e.insertBefore(d,e.firstChild);},abort:function(){d&&d.onload(0,1);}};}});var cf=a.ActiveXObject?function(){for(var a in ch)ch[a](0,1);}:!1,cg=0,ch;f.ajaxSettings.xhr=a.ActiveXObject?function(){return!this.isLocal&&ci()||cj();}:ci,function(a){f.extend(f.support,{ajax:!!a,cors:!!a&&"withCredentials"in a});}(f.ajaxSettings.xhr()),f.support.ajax&&f.ajaxTransport(function(c){if(!c.crossDomain||f.support.cors){var d;return{send:function(e,g){var h=c.xhr(),i,j;c.username?h.open(c.type,c.url,c.async,c.username,c.password):h.open(c.type,c.url,c.async);if(c.xhrFields)for(j in c.xhrFields)h[j]=c.xhrFields[j];c.mimeType&&h.overrideMimeType&&h.overrideMimeType(c.mimeType),!c.crossDomain&&!e["X-Requested-With"]&&(e["X-Requested-With"]="XMLHttpRequest");try{for(j in e)h.setRequestHeader(j,e[j]);}catch(k){}h.send(c.hasContent&&c.data||null),d=function(a,e){var j,k,l,m,n;try{if(d&&(e||h.readyState===4)){d=b,i&&(h.onreadystatechange=f.noop,cf&&delete ch[i]);if(e)h.readyState!==4&&h.abort();else{j=h.status,l=h.getAllResponseHeaders(),m={},n=h.responseXML,n&&n.documentElement&&(m.xml=n),m.text=h.responseText;try{k=h.statusText;}catch(o){k="";}!j&&c.isLocal&&!c.crossDomain?j=m.text?200:404:j===1223&&(j=204);}}}catch(p){e||g(-1,p);}m&&g(j,k,m,l);},!c.async||h.readyState===4?d():(i=++cg,cf&&(ch||(ch={},f(a).unload(cf)),ch[i]=d),h.onreadystatechange=d);},abort:function(){d&&d(0,1);}};}});var ck={},cl,cm,cn=/^(?:toggle|show|hide)$/,co=/^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,cp,cq=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]],cr;f.fn.extend({show:function(a,b,c){var d,e;if(a||a===0)return this.animate(cu("show",3),a,b,c);for(var g=0,h=this.length;g=i.duration+this.startTime){this.now=this.end,this.pos=this.state=1,this.update(),i.animatedProperties[this.prop]=!0;for(b in i.animatedProperties)i.animatedProperties[b]!==!0&&(g=!1);if(g){i.overflow!=null&&!f.support.shrinkWrapBlocks&&f.each(["","X","Y"],function(a,b){h.style["overflow"+b]=i.overflow[a];}),i.hide&&f(h).hide();if(i.hide||i.show)for(b in i.animatedProperties)f.style(h,b,i.orig[b]),f.removeData(h,"fxshow"+b,!0),f.removeData(h,"toggle"+b,!0);d=i.complete,d&&(i.complete=!1,d.call(h));}return!1;}i.duration==Infinity?this.now=e:(c=e-this.startTime,this.state=c/i.duration,this.pos=f.easing[i.animatedProperties[this.prop]](this.state,c,0,1,i.duration),this.now=this.start+(this.end-this.start)*this.pos),this.update();return!0;}},f.extend(f.fx,{tick:function(){var a,b=f.timers,c=0;for(;c-1,k={},l={},m,n;j?(l=e.position(),m=l.top,n=l.left):(m=parseFloat(h)||0,n=parseFloat(i)||0),f.isFunction(b)&&(b=b.call(a,c,g)),b.top!=null&&(k.top=b.top-g.top+m),b.left!=null&&(k.left=b.left-g.left+n),"using"in b?b.using.call(a,k):e.css(k);}},f.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),c=this.offset(),d=cx.test(b[0].nodeName)?{top:0,left:0}:b.offset();c.top-=parseFloat(f.css(a,"marginTop"))||0,c.left-=parseFloat(f.css(a,"marginLeft"))||0,d.top+=parseFloat(f.css(b[0],"borderTopWidth"))||0,d.left+=parseFloat(f.css(b[0],"borderLeftWidth"))||0;return{top:c.top-d.top,left:c.left-d.left};},offsetParent:function(){return this.map(function(){var a=this.offsetParent||c.body;while(a&&!cx.test(a.nodeName)&&f.css(a,"position")==="static")a=a.offsetParent;return a;});}}),f.each(["Left","Top"],function(a,c){var d="scroll"+c;f.fn[d]=function(c){var e,g;if(c===b){e=this[0];if(!e)return null;g=cy(e);return g?"pageXOffset"in g?g[a?"pageYOffset":"pageXOffset"]:f.support.boxModel&&g.document.documentElement[d]||g.document.body[d]:e[d];}return this.each(function(){g=cy(this),g?g.scrollTo(a?f(g).scrollLeft():c,a?c:f(g).scrollTop()):this[d]=c;});};}),f.each(["Height","Width"],function(a,c){var d=c.toLowerCase();f.fn["inner"+c]=function(){var a=this[0];return a?a.style?parseFloat(f.css(a,d,"padding")):this[d]():null;},f.fn["outer"+c]=function(a){var b=this[0];return b?b.style?parseFloat(f.css(b,d,a?"margin":"border")):this[d]():null;},f.fn[d]=function(a){var e=this[0];if(!e)return a==null?null:this;if(f.isFunction(a))return this.each(function(b){var c=f(this);c[d](a.call(this,b,c[d]()));});if(f.isWindow(e)){var g=e.document.documentElement["client"+c],h=e.document.body;return e.document.compatMode==="CSS1Compat"&&g||h&&h["client"+c]||g;}if(e.nodeType===9)return Math.max(e.documentElement["client"+c],e.body["scroll"+c],e.documentElement["scroll"+c],e.body["offset"+c],e.documentElement["offset"+c]);if(a===b){var i=f.css(e,d),j=parseFloat(i);return f.isNumeric(j)?j:i;}return this.css(d,typeof a=="string"?a:a+"px");};}),a.jQuery=a.$=f,typeof define=="function"&&define.amd&&define.amd.jQuery&&define("jquery",[],function(){return f;});})(window); \ No newline at end of file diff --git a/examples/voter/voter/public/javascripts/jquery-ui-1.8.17.custom.min.js b/examples/voter/voter/public/javascripts/jquery-ui-1.8.17.custom.min.js index d5880b3..2439195 100644 --- a/examples/voter/voter/public/javascripts/jquery-ui-1.8.17.custom.min.js +++ b/examples/voter/voter/public/javascripts/jquery-ui-1.8.17.custom.min.js @@ -6,7 +6,7 @@ * http://jquery.org/license * * http://docs.jquery.com/UI - */(function(a,b){function d(b){return!a(b).parents().andSelf().filter(function(){return a.curCSS(this,"visibility")==="hidden"||a.expr.filters.hidden(this)}).length}function c(b,c){var e=b.nodeName.toLowerCase();if("area"===e){var f=b.parentNode,g=f.name,h;if(!b.href||!g||f.nodeName.toLowerCase()!=="map")return!1;h=a("img[usemap=#"+g+"]")[0];return!!h&&d(h)}return(/input|select|textarea|button|object/.test(e)?!b.disabled:"a"==e?b.href||c:c)&&d(b)}a.ui=a.ui||{};a.ui.version||(a.extend(a.ui,{version:"1.8.17",keyCode:{ALT:18,BACKSPACE:8,CAPS_LOCK:20,COMMA:188,COMMAND:91,COMMAND_LEFT:91,COMMAND_RIGHT:93,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,MENU:93,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SHIFT:16,SPACE:32,TAB:9,UP:38,WINDOWS:91}}),a.fn.extend({propAttr:a.fn.prop||a.fn.attr,_focus:a.fn.focus,focus:function(b,c){return typeof b=="number"?this.each(function(){var d=this;setTimeout(function(){a(d).focus(),c&&c.call(d)},b)}):this._focus.apply(this,arguments)},scrollParent:function(){var b;a.browser.msie&&/(static|relative)/.test(this.css("position"))||/absolute/.test(this.css("position"))?b=this.parents().filter(function(){return/(relative|absolute|fixed)/.test(a.curCSS(this,"position",1))&&/(auto|scroll)/.test(a.curCSS(this,"overflow",1)+a.curCSS(this,"overflow-y",1)+a.curCSS(this,"overflow-x",1))}).eq(0):b=this.parents().filter(function(){return/(auto|scroll)/.test(a.curCSS(this,"overflow",1)+a.curCSS(this,"overflow-y",1)+a.curCSS(this,"overflow-x",1))}).eq(0);return/fixed/.test(this.css("position"))||!b.length?a(document):b},zIndex:function(c){if(c!==b)return this.css("zIndex",c);if(this.length){var d=a(this[0]),e,f;while(d.length&&d[0]!==document){e=d.css("position");if(e==="absolute"||e==="relative"||e==="fixed"){f=parseInt(d.css("zIndex"),10);if(!isNaN(f)&&f!==0)return f}d=d.parent()}}return 0},disableSelection:function(){return this.bind((a.support.selectstart?"selectstart":"mousedown")+".ui-disableSelection",function(a){a.preventDefault()})},enableSelection:function(){return this.unbind(".ui-disableSelection")}}),a.each(["Width","Height"],function(c,d){function h(b,c,d,f){a.each(e,function(){c-=parseFloat(a.curCSS(b,"padding"+this,!0))||0,d&&(c-=parseFloat(a.curCSS(b,"border"+this+"Width",!0))||0),f&&(c-=parseFloat(a.curCSS(b,"margin"+this,!0))||0)});return c}var e=d==="Width"?["Left","Right"]:["Top","Bottom"],f=d.toLowerCase(),g={innerWidth:a.fn.innerWidth,innerHeight:a.fn.innerHeight,outerWidth:a.fn.outerWidth,outerHeight:a.fn.outerHeight};a.fn["inner"+d]=function(c){if(c===b)return g["inner"+d].call(this);return this.each(function(){a(this).css(f,h(this,c)+"px")})},a.fn["outer"+d]=function(b,c){if(typeof b!="number")return g["outer"+d].call(this,b);return this.each(function(){a(this).css(f,h(this,b,!0,c)+"px")})}}),a.extend(a.expr[":"],{data:function(b,c,d){return!!a.data(b,d[3])},focusable:function(b){return c(b,!isNaN(a.attr(b,"tabindex")))},tabbable:function(b){var d=a.attr(b,"tabindex"),e=isNaN(d);return(e||d>=0)&&c(b,!e)}}),a(function(){var b=document.body,c=b.appendChild(c=document.createElement("div"));a.extend(c.style,{minHeight:"100px",height:"auto",padding:0,borderWidth:0}),a.support.minHeight=c.offsetHeight===100,a.support.selectstart="onselectstart"in c,b.removeChild(c).style.display="none"}),a.extend(a.ui,{plugin:{add:function(b,c,d){var e=a.ui[b].prototype;for(var f in d)e.plugins[f]=e.plugins[f]||[],e.plugins[f].push([c,d[f]])},call:function(a,b,c){var d=a.plugins[b];if(!!d&&!!a.element[0].parentNode)for(var e=0;e0)return!0;b[d]=1,e=b[d]>0,b[d]=0;return e},isOverAxis:function(a,b,c){return a>b&&a=0)&&c(b,!e);}}),a(function(){var b=document.body,c=b.appendChild(c=document.createElement("div"));a.extend(c.style,{minHeight:"100px",height:"auto",padding:0,borderWidth:0}),a.support.minHeight=c.offsetHeight===100,a.support.selectstart="onselectstart"in c,b.removeChild(c).style.display="none";}),a.extend(a.ui,{plugin:{add:function(b,c,d){var e=a.ui[b].prototype;for(var f in d)e.plugins[f]=e.plugins[f]||[],e.plugins[f].push([c,d[f]]);},call:function(a,b,c){var d=a.plugins[b];if(!!d&&!!a.element[0].parentNode)for(var e=0;e0)return!0;b[d]=1,e=b[d]>0,b[d]=0;return e;},isOverAxis:function(a,b,c){return a>b&&a=9)&&!b.button)return this._mouseUp(b);if(this._mouseStarted){this._mouseDrag(b);return b.preventDefault()}this._mouseDistanceMet(b)&&this._mouseDelayMet(b)&&(this._mouseStarted=this._mouseStart(this._mouseDownEvent,b)!==!1,this._mouseStarted?this._mouseDrag(b):this._mouseUp(b));return!this._mouseStarted},_mouseUp:function(b){a(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate),this._mouseStarted&&(this._mouseStarted=!1,b.target==this._mouseDownEvent.target&&a.data(b.target,this.widgetName+".preventClickEvent",!0),this._mouseStop(b));return!1},_mouseDistanceMet:function(a){return Math.max(Math.abs(this._mouseDownEvent.pageX-a.pageX),Math.abs(this._mouseDownEvent.pageY-a.pageY))>=this.options.distance},_mouseDelayMet:function(a){return this.mouseDelayMet},_mouseStart:function(a){},_mouseDrag:function(a){},_mouseStop:function(a){},_mouseCapture:function(a){return!0}})})(jQuery);/* + */(function(a,b){var c=!1;a(document).mouseup(function(a){c=!1;}),a.widget("ui.mouse",{options:{cancel:":input,option",distance:1,delay:0},_mouseInit:function(){var b=this;this.element.bind("mousedown."+this.widgetName,function(a){return b._mouseDown(a);}).bind("click."+this.widgetName,function(c){if(!0===a.data(c.target,b.widgetName+".preventClickEvent")){a.removeData(c.target,b.widgetName+".preventClickEvent"),c.stopImmediatePropagation();return!1;}}),this.started=!1;},_mouseDestroy:function(){this.element.unbind("."+this.widgetName);},_mouseDown:function(b){if(!c){this._mouseStarted&&this._mouseUp(b),this._mouseDownEvent=b;var d=this,e=b.which==1,f=typeof this.options.cancel=="string"&&b.target.nodeName?a(b.target).closest(this.options.cancel).length:!1;if(!e||f||!this._mouseCapture(b))return!0;this.mouseDelayMet=!this.options.delay,this.mouseDelayMet||(this._mouseDelayTimer=setTimeout(function(){d.mouseDelayMet=!0;},this.options.delay));if(this._mouseDistanceMet(b)&&this._mouseDelayMet(b)){this._mouseStarted=this._mouseStart(b)!==!1;if(!this._mouseStarted){b.preventDefault();return!0;}}!0===a.data(b.target,this.widgetName+".preventClickEvent")&&a.removeData(b.target,this.widgetName+".preventClickEvent"),this._mouseMoveDelegate=function(a){return d._mouseMove(a);},this._mouseUpDelegate=function(a){return d._mouseUp(a);},a(document).bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate),b.preventDefault(),c=!0;return!0;}},_mouseMove:function(b){if(a.browser.msie&&!(document.documentMode>=9)&&!b.button)return this._mouseUp(b);if(this._mouseStarted){this._mouseDrag(b);return b.preventDefault();}this._mouseDistanceMet(b)&&this._mouseDelayMet(b)&&(this._mouseStarted=this._mouseStart(this._mouseDownEvent,b)!==!1,this._mouseStarted?this._mouseDrag(b):this._mouseUp(b));return!this._mouseStarted;},_mouseUp:function(b){a(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate),this._mouseStarted&&(this._mouseStarted=!1,b.target==this._mouseDownEvent.target&&a.data(b.target,this.widgetName+".preventClickEvent",!0),this._mouseStop(b));return!1;},_mouseDistanceMet:function(a){return Math.max(Math.abs(this._mouseDownEvent.pageX-a.pageX),Math.abs(this._mouseDownEvent.pageY-a.pageY))>=this.options.distance;},_mouseDelayMet:function(a){return this.mouseDelayMet;},_mouseStart:function(a){},_mouseDrag:function(a){},_mouseStop:function(a){},_mouseCapture:function(a){return!0;}});})(jQuery);/* * jQuery UI Position 1.8.17 * * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) @@ -33,7 +33,7 @@ * http://jquery.org/license * * http://docs.jquery.com/UI/Position - */(function(a,b){a.ui=a.ui||{};var c=/left|center|right/,d=/top|center|bottom/,e="center",f={},g=a.fn.position,h=a.fn.offset;a.fn.position=function(b){if(!b||!b.of)return g.apply(this,arguments);b=a.extend({},b);var h=a(b.of),i=h[0],j=(b.collision||"flip").split(" "),k=b.offset?b.offset.split(" "):[0,0],l,m,n;i.nodeType===9?(l=h.width(),m=h.height(),n={top:0,left:0}):i.setTimeout?(l=h.width(),m=h.height(),n={top:h.scrollTop(),left:h.scrollLeft()}):i.preventDefault?(b.at="left top",l=m=0,n={top:b.of.pageY,left:b.of.pageX}):(l=h.outerWidth(),m=h.outerHeight(),n=h.offset()),a.each(["my","at"],function(){var a=(b[this]||"").split(" ");a.length===1&&(a=c.test(a[0])?a.concat([e]):d.test(a[0])?[e].concat(a):[e,e]),a[0]=c.test(a[0])?a[0]:e,a[1]=d.test(a[1])?a[1]:e,b[this]=a}),j.length===1&&(j[1]=j[0]),k[0]=parseInt(k[0],10)||0,k.length===1&&(k[1]=k[0]),k[1]=parseInt(k[1],10)||0,b.at[0]==="right"?n.left+=l:b.at[0]===e&&(n.left+=l/2),b.at[1]==="bottom"?n.top+=m:b.at[1]===e&&(n.top+=m/2),n.left+=k[0],n.top+=k[1];return this.each(function(){var c=a(this),d=c.outerWidth(),g=c.outerHeight(),h=parseInt(a.curCSS(this,"marginLeft",!0))||0,i=parseInt(a.curCSS(this,"marginTop",!0))||0,o=d+h+(parseInt(a.curCSS(this,"marginRight",!0))||0),p=g+i+(parseInt(a.curCSS(this,"marginBottom",!0))||0),q=a.extend({},n),r;b.my[0]==="right"?q.left-=d:b.my[0]===e&&(q.left-=d/2),b.my[1]==="bottom"?q.top-=g:b.my[1]===e&&(q.top-=g/2),f.fractions||(q.left=Math.round(q.left),q.top=Math.round(q.top)),r={left:q.left-h,top:q.top-i},a.each(["left","top"],function(c,e){a.ui.position[j[c]]&&a.ui.position[j[c]][e](q,{targetWidth:l,targetHeight:m,elemWidth:d,elemHeight:g,collisionPosition:r,collisionWidth:o,collisionHeight:p,offset:k,my:b.my,at:b.at})}),a.fn.bgiframe&&c.bgiframe(),c.offset(a.extend(q,{using:b.using}))})},a.ui.position={fit:{left:function(b,c){var d=a(window),e=c.collisionPosition.left+c.collisionWidth-d.width()-d.scrollLeft();b.left=e>0?b.left-e:Math.max(b.left-c.collisionPosition.left,b.left)},top:function(b,c){var d=a(window),e=c.collisionPosition.top+c.collisionHeight-d.height()-d.scrollTop();b.top=e>0?b.top-e:Math.max(b.top-c.collisionPosition.top,b.top)}},flip:{left:function(b,c){if(c.at[0]!==e){var d=a(window),f=c.collisionPosition.left+c.collisionWidth-d.width()-d.scrollLeft(),g=c.my[0]==="left"?-c.elemWidth:c.my[0]==="right"?c.elemWidth:0,h=c.at[0]==="left"?c.targetWidth:-c.targetWidth,i=-2*c.offset[0];b.left+=c.collisionPosition.left<0?g+h+i:f>0?g+h+i:0}},top:function(b,c){if(c.at[1]!==e){var d=a(window),f=c.collisionPosition.top+c.collisionHeight-d.height()-d.scrollTop(),g=c.my[1]==="top"?-c.elemHeight:c.my[1]==="bottom"?c.elemHeight:0,h=c.at[1]==="top"?c.targetHeight:-c.targetHeight,i=-2*c.offset[1];b.top+=c.collisionPosition.top<0?g+h+i:f>0?g+h+i:0}}}},a.offset.setOffset||(a.offset.setOffset=function(b,c){/static/.test(a.curCSS(b,"position"))&&(b.style.position="relative");var d=a(b),e=d.offset(),f=parseInt(a.curCSS(b,"top",!0),10)||0,g=parseInt(a.curCSS(b,"left",!0),10)||0,h={top:c.top-e.top+f,left:c.left-e.left+g};"using"in c?c.using.call(b,h):d.css(h)},a.fn.offset=function(b){var c=this[0];if(!c||!c.ownerDocument)return null;if(b)return this.each(function(){a.offset.setOffset(this,b)});return h.call(this)}),function(){var b=document.getElementsByTagName("body")[0],c=document.createElement("div"),d,e,g,h,i;d=document.createElement(b?"div":"body"),g={visibility:"hidden",width:0,height:0,border:0,margin:0,background:"none"},b&&jQuery.extend(g,{position:"absolute",left:"-1000px",top:"-1000px"});for(var j in g)d.style[j]=g[j];d.appendChild(c),e=b||document.documentElement,e.insertBefore(d,e.firstChild),c.style.cssText="position: absolute; left: 10.7432222px; top: 10.432325px; height: 30px; width: 201px;",h=a(c).offset(function(a,b){return b}).offset(),d.innerHTML="",e.removeChild(d),i=h.top+h.left+(b?2e3:0),f.fractions=i>21&&i<22}()})(jQuery);/* + */(function(a,b){a.ui=a.ui||{};var c=/left|center|right/,d=/top|center|bottom/,e="center",f={},g=a.fn.position,h=a.fn.offset;a.fn.position=function(b){if(!b||!b.of)return g.apply(this,arguments);b=a.extend({},b);var h=a(b.of),i=h[0],j=(b.collision||"flip").split(" "),k=b.offset?b.offset.split(" "):[0,0],l,m,n;i.nodeType===9?(l=h.width(),m=h.height(),n={top:0,left:0}):i.setTimeout?(l=h.width(),m=h.height(),n={top:h.scrollTop(),left:h.scrollLeft()}):i.preventDefault?(b.at="left top",l=m=0,n={top:b.of.pageY,left:b.of.pageX}):(l=h.outerWidth(),m=h.outerHeight(),n=h.offset()),a.each(["my","at"],function(){var a=(b[this]||"").split(" ");a.length===1&&(a=c.test(a[0])?a.concat([e]):d.test(a[0])?[e].concat(a):[e,e]),a[0]=c.test(a[0])?a[0]:e,a[1]=d.test(a[1])?a[1]:e,b[this]=a;}),j.length===1&&(j[1]=j[0]),k[0]=parseInt(k[0],10)||0,k.length===1&&(k[1]=k[0]),k[1]=parseInt(k[1],10)||0,b.at[0]==="right"?n.left+=l:b.at[0]===e&&(n.left+=l/2),b.at[1]==="bottom"?n.top+=m:b.at[1]===e&&(n.top+=m/2),n.left+=k[0],n.top+=k[1];return this.each(function(){var c=a(this),d=c.outerWidth(),g=c.outerHeight(),h=parseInt(a.curCSS(this,"marginLeft",!0))||0,i=parseInt(a.curCSS(this,"marginTop",!0))||0,o=d+h+(parseInt(a.curCSS(this,"marginRight",!0))||0),p=g+i+(parseInt(a.curCSS(this,"marginBottom",!0))||0),q=a.extend({},n),r;b.my[0]==="right"?q.left-=d:b.my[0]===e&&(q.left-=d/2),b.my[1]==="bottom"?q.top-=g:b.my[1]===e&&(q.top-=g/2),f.fractions||(q.left=Math.round(q.left),q.top=Math.round(q.top)),r={left:q.left-h,top:q.top-i},a.each(["left","top"],function(c,e){a.ui.position[j[c]]&&a.ui.position[j[c]][e](q,{targetWidth:l,targetHeight:m,elemWidth:d,elemHeight:g,collisionPosition:r,collisionWidth:o,collisionHeight:p,offset:k,my:b.my,at:b.at});}),a.fn.bgiframe&&c.bgiframe(),c.offset(a.extend(q,{using:b.using}));});},a.ui.position={fit:{left:function(b,c){var d=a(window),e=c.collisionPosition.left+c.collisionWidth-d.width()-d.scrollLeft();b.left=e>0?b.left-e:Math.max(b.left-c.collisionPosition.left,b.left);},top:function(b,c){var d=a(window),e=c.collisionPosition.top+c.collisionHeight-d.height()-d.scrollTop();b.top=e>0?b.top-e:Math.max(b.top-c.collisionPosition.top,b.top);}},flip:{left:function(b,c){if(c.at[0]!==e){var d=a(window),f=c.collisionPosition.left+c.collisionWidth-d.width()-d.scrollLeft(),g=c.my[0]==="left"?-c.elemWidth:c.my[0]==="right"?c.elemWidth:0,h=c.at[0]==="left"?c.targetWidth:-c.targetWidth,i=-2*c.offset[0];b.left+=c.collisionPosition.left<0?g+h+i:f>0?g+h+i:0;}},top:function(b,c){if(c.at[1]!==e){var d=a(window),f=c.collisionPosition.top+c.collisionHeight-d.height()-d.scrollTop(),g=c.my[1]==="top"?-c.elemHeight:c.my[1]==="bottom"?c.elemHeight:0,h=c.at[1]==="top"?c.targetHeight:-c.targetHeight,i=-2*c.offset[1];b.top+=c.collisionPosition.top<0?g+h+i:f>0?g+h+i:0;}}}},a.offset.setOffset||(a.offset.setOffset=function(b,c){/static/.test(a.curCSS(b,"position"))&&(b.style.position="relative");var d=a(b),e=d.offset(),f=parseInt(a.curCSS(b,"top",!0),10)||0,g=parseInt(a.curCSS(b,"left",!0),10)||0,h={top:c.top-e.top+f,left:c.left-e.left+g};"using"in c?c.using.call(b,h):d.css(h);},a.fn.offset=function(b){var c=this[0];if(!c||!c.ownerDocument)return null;if(b)return this.each(function(){a.offset.setOffset(this,b);});return h.call(this);}),function(){var b=document.getElementsByTagName("body")[0],c=document.createElement("div"),d,e,g,h,i;d=document.createElement(b?"div":"body"),g={visibility:"hidden",width:0,height:0,border:0,margin:0,background:"none"},b&&jQuery.extend(g,{position:"absolute",left:"-1000px",top:"-1000px"});for(var j in g)d.style[j]=g[j];d.appendChild(c),e=b||document.documentElement,e.insertBefore(d,e.firstChild),c.style.cssText="position: absolute; left: 10.7432222px; top: 10.432325px; height: 30px; width: 201px;",h=a(c).offset(function(a,b){return b;}).offset(),d.innerHTML="",e.removeChild(d),i=h.top+h.left+(b?2e3:0),f.fractions=i>21&&i<22;}();})(jQuery);/* * jQuery UI Accordion 1.8.17 * * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) @@ -45,7 +45,7 @@ * Depends: * jquery.ui.core.js * jquery.ui.widget.js - */(function(a,b){a.widget("ui.accordion",{options:{active:0,animated:"slide",autoHeight:!0,clearStyle:!1,collapsible:!1,event:"click",fillSpace:!1,header:"> li > :first-child,> :not(li):even",icons:{header:"ui-icon-triangle-1-e",headerSelected:"ui-icon-triangle-1-s"},navigation:!1,navigationFilter:function(){return this.href.toLowerCase()===location.href.toLowerCase()}},_create:function(){var b=this,c=b.options;b.running=0,b.element.addClass("ui-accordion ui-widget ui-helper-reset").children("li").addClass("ui-accordion-li-fix"),b.headers=b.element.find(c.header).addClass("ui-accordion-header ui-helper-reset ui-state-default ui-corner-all").bind("mouseenter.accordion",function(){c.disabled||a(this).addClass("ui-state-hover")}).bind("mouseleave.accordion",function(){c.disabled||a(this).removeClass("ui-state-hover")}).bind("focus.accordion",function(){c.disabled||a(this).addClass("ui-state-focus")}).bind("blur.accordion",function(){c.disabled||a(this).removeClass("ui-state-focus")}),b.headers.next().addClass("ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom");if(c.navigation){var d=b.element.find("a").filter(c.navigationFilter).eq(0);if(d.length){var e=d.closest(".ui-accordion-header");e.length?b.active=e:b.active=d.closest(".ui-accordion-content").prev()}}b.active=b._findActive(b.active||c.active).addClass("ui-state-default ui-state-active").toggleClass("ui-corner-all").toggleClass("ui-corner-top"),b.active.next().addClass("ui-accordion-content-active"),b._createIcons(),b.resize(),b.element.attr("role","tablist"),b.headers.attr("role","tab").bind("keydown.accordion",function(a){return b._keydown(a)}).next().attr("role","tabpanel"),b.headers.not(b.active||"").attr({"aria-expanded":"false","aria-selected":"false",tabIndex:-1}).next().hide(),b.active.length?b.active.attr({"aria-expanded":"true","aria-selected":"true",tabIndex:0}):b.headers.eq(0).attr("tabIndex",0),a.browser.safari||b.headers.find("a").attr("tabIndex",-1),c.event&&b.headers.bind(c.event.split(" ").join(".accordion ")+".accordion",function(a){b._clickHandler.call(b,a,this),a.preventDefault()})},_createIcons:function(){var b=this.options;b.icons&&(a("").addClass("ui-icon "+b.icons.header).prependTo(this.headers),this.active.children(".ui-icon").toggleClass(b.icons.header).toggleClass(b.icons.headerSelected),this.element.addClass("ui-accordion-icons"))},_destroyIcons:function(){this.headers.children(".ui-icon").remove(),this.element.removeClass("ui-accordion-icons")},destroy:function(){var b=this.options;this.element.removeClass("ui-accordion ui-widget ui-helper-reset").removeAttr("role"),this.headers.unbind(".accordion").removeClass("ui-accordion-header ui-accordion-disabled ui-helper-reset ui-state-default ui-corner-all ui-state-active ui-state-disabled ui-corner-top").removeAttr("role").removeAttr("aria-expanded").removeAttr("aria-selected").removeAttr("tabIndex"),this.headers.find("a").removeAttr("tabIndex"),this._destroyIcons();var c=this.headers.next().css("display","").removeAttr("role").removeClass("ui-helper-reset ui-widget-content ui-corner-bottom ui-accordion-content ui-accordion-content-active ui-accordion-disabled ui-state-disabled");(b.autoHeight||b.fillHeight)&&c.css("height","");return a.Widget.prototype.destroy.call(this)},_setOption:function(b,c){a.Widget.prototype._setOption.apply(this,arguments),b=="active"&&this.activate(c),b=="icons"&&(this._destroyIcons(),c&&this._createIcons()),b=="disabled"&&this.headers.add(this.headers.next())[c?"addClass":"removeClass"]("ui-accordion-disabled ui-state-disabled")},_keydown:function(b){if(!(this.options.disabled||b.altKey||b.ctrlKey)){var c=a.ui.keyCode,d=this.headers.length,e=this.headers.index(b.target),f=!1;switch(b.keyCode){case c.RIGHT:case c.DOWN:f=this.headers[(e+1)%d];break;case c.LEFT:case c.UP:f=this.headers[(e-1+d)%d];break;case c.SPACE:case c.ENTER:this._clickHandler({target:b.target},b.target),b.preventDefault()}if(f){a(b.target).attr("tabIndex",-1),a(f).attr("tabIndex",0),f.focus();return!1}return!0}},resize:function(){var b=this.options,c;if(b.fillSpace){if(a.browser.msie){var d=this.element.parent().css("overflow");this.element.parent().css("overflow","hidden")}c=this.element.parent().height(),a.browser.msie&&this.element.parent().css("overflow",d),this.headers.each(function(){c-=a(this).outerHeight(!0)}),this.headers.next().each(function(){a(this).height(Math.max(0,c-a(this).innerHeight()+a(this).height()))}).css("overflow","auto")}else b.autoHeight&&(c=0,this.headers.next().each(function(){c=Math.max(c,a(this).height("").height())}).height(c));return this},activate:function(a){this.options.active=a;var b=this._findActive(a)[0];this._clickHandler({target:b},b);return this},_findActive:function(b){return b?typeof b=="number"?this.headers.filter(":eq("+b+")"):this.headers.not(this.headers.not(b)):b===!1?a([]):this.headers.filter(":eq(0)")},_clickHandler:function(b,c){var d=this.options;if(!d.disabled){if(!b.target){if(!d.collapsible)return;this.active.removeClass("ui-state-active ui-corner-top").addClass("ui-state-default ui-corner-all").children(".ui-icon").removeClass(d.icons.headerSelected).addClass(d.icons.header),this.active.next().addClass("ui-accordion-content-active");var e=this.active.next(),f={options:d,newHeader:a([]),oldHeader:d.active,newContent:a([]),oldContent:e},g=this.active=a([]);this._toggle(g,e,f);return}var h=a(b.currentTarget||c),i=h[0]===this.active[0];d.active=d.collapsible&&i?!1:this.headers.index(h);if(this.running||!d.collapsible&&i)return;var j=this.active,g=h.next(),e=this.active.next(),f={options:d,newHeader:i&&d.collapsible?a([]):h,oldHeader:this.active,newContent:i&&d.collapsible?a([]):g,oldContent:e},k=this.headers.index(this.active[0])>this.headers.index(h[0]);this.active=i?a([]):h,this._toggle(g,e,f,i,k),j.removeClass("ui-state-active ui-corner-top").addClass("ui-state-default ui-corner-all").children(".ui-icon").removeClass(d.icons.headerSelected).addClass(d.icons.header),i||(h.removeClass("ui-state-default ui-corner-all").addClass("ui-state-active ui-corner-top").children(".ui-icon").removeClass(d.icons.header).addClass(d.icons.headerSelected),h.next().addClass("ui-accordion-content-active"));return}},_toggle:function(b,c,d,e,f){var g=this,h=g.options;g.toShow=b,g.toHide=c,g.data=d;var i=function(){if(!!g)return g._completed.apply(g,arguments)};g._trigger("changestart",null,g.data),g.running=c.size()===0?b.size():c.size();if(h.animated){var j={};h.collapsible&&e?j={toShow:a([]),toHide:c,complete:i,down:f,autoHeight:h.autoHeight||h.fillSpace}:j={toShow:b,toHide:c,complete:i,down:f,autoHeight:h.autoHeight||h.fillSpace},h.proxied||(h.proxied=h.animated),h.proxiedDuration||(h.proxiedDuration=h.duration),h.animated=a.isFunction(h.proxied)?h.proxied(j):h.proxied,h.duration=a.isFunction(h.proxiedDuration)?h.proxiedDuration(j):h.proxiedDuration;var k=a.ui.accordion.animations,l=h.duration,m=h.animated;m&&!k[m]&&!a.easing[m]&&(m="slide"),k[m]||(k[m]=function(a){this.slide(a,{easing:m,duration:l||700})}),k[m](j)}else h.collapsible&&e?b.toggle():(c.hide(),b.show()),i(!0);c.prev().attr({"aria-expanded":"false","aria-selected":"false",tabIndex:-1}).blur(),b.prev().attr({"aria-expanded":"true","aria-selected":"true",tabIndex:0}).focus()},_completed:function(a){this.running=a?0:--this.running;this.running||(this.options.clearStyle&&this.toShow.add(this.toHide).css({height:"",overflow:""}),this.toHide.removeClass("ui-accordion-content-active"),this.toHide.length&&(this.toHide.parent()[0].className=this.toHide.parent()[0].className),this._trigger("change",null,this.data))}}),a.extend(a.ui.accordion,{version:"1.8.17",animations:{slide:function(b,c){b=a.extend({easing:"swing",duration:300},b,c);if(!b.toHide.size())b.toShow.animate({height:"show",paddingTop:"show",paddingBottom:"show"},b);else{if(!b.toShow.size()){b.toHide.animate({height:"hide",paddingTop:"hide",paddingBottom:"hide"},b);return}var d=b.toShow.css("overflow"),e=0,f={},g={},h=["height","paddingTop","paddingBottom"],i,j=b.toShow;i=j[0].style.width,j.width(j.parent().width()-parseFloat(j.css("paddingLeft"))-parseFloat(j.css("paddingRight"))-(parseFloat(j.css("borderLeftWidth"))||0)-(parseFloat(j.css("borderRightWidth"))||0)),a.each(h,function(c,d){g[d]="hide";var e=(""+a.css(b.toShow[0],d)).match(/^([\d+-.]+)(.*)$/);f[d]={value:e[1],unit:e[2]||"px"}}),b.toShow.css({height:0,overflow:"hidden"}).show(),b.toHide.filter(":hidden").each(b.complete).end().filter(":visible").animate(g,{step:function(a,c){c.prop=="height"&&(e=c.end-c.start===0?0:(c.now-c.start)/(c.end-c.start)),b.toShow[0].style[c.prop]=e*f[c.prop].value+f[c.prop].unit},duration:b.duration,easing:b.easing,complete:function(){b.autoHeight||b.toShow.css("height",""),b.toShow.css({width:i,overflow:d}),b.complete()}})}},bounceslide:function(a){this.slide(a,{easing:a.down?"easeOutBounce":"swing",duration:a.down?1e3:200})}}})})(jQuery);/* + */(function(a,b){a.widget("ui.accordion",{options:{active:0,animated:"slide",autoHeight:!0,clearStyle:!1,collapsible:!1,event:"click",fillSpace:!1,header:"> li > :first-child,> :not(li):even",icons:{header:"ui-icon-triangle-1-e",headerSelected:"ui-icon-triangle-1-s"},navigation:!1,navigationFilter:function(){return this.href.toLowerCase()===location.href.toLowerCase();}},_create:function(){var b=this,c=b.options;b.running=0,b.element.addClass("ui-accordion ui-widget ui-helper-reset").children("li").addClass("ui-accordion-li-fix"),b.headers=b.element.find(c.header).addClass("ui-accordion-header ui-helper-reset ui-state-default ui-corner-all").bind("mouseenter.accordion",function(){c.disabled||a(this).addClass("ui-state-hover");}).bind("mouseleave.accordion",function(){c.disabled||a(this).removeClass("ui-state-hover");}).bind("focus.accordion",function(){c.disabled||a(this).addClass("ui-state-focus");}).bind("blur.accordion",function(){c.disabled||a(this).removeClass("ui-state-focus");}),b.headers.next().addClass("ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom");if(c.navigation){var d=b.element.find("a").filter(c.navigationFilter).eq(0);if(d.length){var e=d.closest(".ui-accordion-header");e.length?b.active=e:b.active=d.closest(".ui-accordion-content").prev();}}b.active=b._findActive(b.active||c.active).addClass("ui-state-default ui-state-active").toggleClass("ui-corner-all").toggleClass("ui-corner-top"),b.active.next().addClass("ui-accordion-content-active"),b._createIcons(),b.resize(),b.element.attr("role","tablist"),b.headers.attr("role","tab").bind("keydown.accordion",function(a){return b._keydown(a);}).next().attr("role","tabpanel"),b.headers.not(b.active||"").attr({"aria-expanded":"false","aria-selected":"false",tabIndex:-1}).next().hide(),b.active.length?b.active.attr({"aria-expanded":"true","aria-selected":"true",tabIndex:0}):b.headers.eq(0).attr("tabIndex",0),a.browser.safari||b.headers.find("a").attr("tabIndex",-1),c.event&&b.headers.bind(c.event.split(" ").join(".accordion ")+".accordion",function(a){b._clickHandler.call(b,a,this),a.preventDefault();});},_createIcons:function(){var b=this.options;b.icons&&(a("").addClass("ui-icon "+b.icons.header).prependTo(this.headers),this.active.children(".ui-icon").toggleClass(b.icons.header).toggleClass(b.icons.headerSelected),this.element.addClass("ui-accordion-icons"));},_destroyIcons:function(){this.headers.children(".ui-icon").remove(),this.element.removeClass("ui-accordion-icons");},destroy:function(){var b=this.options;this.element.removeClass("ui-accordion ui-widget ui-helper-reset").removeAttr("role"),this.headers.unbind(".accordion").removeClass("ui-accordion-header ui-accordion-disabled ui-helper-reset ui-state-default ui-corner-all ui-state-active ui-state-disabled ui-corner-top").removeAttr("role").removeAttr("aria-expanded").removeAttr("aria-selected").removeAttr("tabIndex"),this.headers.find("a").removeAttr("tabIndex"),this._destroyIcons();var c=this.headers.next().css("display","").removeAttr("role").removeClass("ui-helper-reset ui-widget-content ui-corner-bottom ui-accordion-content ui-accordion-content-active ui-accordion-disabled ui-state-disabled");(b.autoHeight||b.fillHeight)&&c.css("height","");return a.Widget.prototype.destroy.call(this);},_setOption:function(b,c){a.Widget.prototype._setOption.apply(this,arguments),b=="active"&&this.activate(c),b=="icons"&&(this._destroyIcons(),c&&this._createIcons()),b=="disabled"&&this.headers.add(this.headers.next())[c?"addClass":"removeClass"]("ui-accordion-disabled ui-state-disabled");},_keydown:function(b){if(!(this.options.disabled||b.altKey||b.ctrlKey)){var c=a.ui.keyCode,d=this.headers.length,e=this.headers.index(b.target),f=!1;switch(b.keyCode){case c.RIGHT:case c.DOWN:f=this.headers[(e+1)%d];break;case c.LEFT:case c.UP:f=this.headers[(e-1+d)%d];break;case c.SPACE:case c.ENTER:this._clickHandler({target:b.target},b.target),b.preventDefault();}if(f){a(b.target).attr("tabIndex",-1),a(f).attr("tabIndex",0),f.focus();return!1;}return!0;}},resize:function(){var b=this.options,c;if(b.fillSpace){if(a.browser.msie){var d=this.element.parent().css("overflow");this.element.parent().css("overflow","hidden");}c=this.element.parent().height(),a.browser.msie&&this.element.parent().css("overflow",d),this.headers.each(function(){c-=a(this).outerHeight(!0);}),this.headers.next().each(function(){a(this).height(Math.max(0,c-a(this).innerHeight()+a(this).height()));}).css("overflow","auto");}else b.autoHeight&&(c=0,this.headers.next().each(function(){c=Math.max(c,a(this).height("").height());}).height(c));return this;},activate:function(a){this.options.active=a;var b=this._findActive(a)[0];this._clickHandler({target:b},b);return this;},_findActive:function(b){return b?typeof b=="number"?this.headers.filter(":eq("+b+")"):this.headers.not(this.headers.not(b)):b===!1?a([]):this.headers.filter(":eq(0)");},_clickHandler:function(b,c){var d=this.options;if(!d.disabled){if(!b.target){if(!d.collapsible)return;this.active.removeClass("ui-state-active ui-corner-top").addClass("ui-state-default ui-corner-all").children(".ui-icon").removeClass(d.icons.headerSelected).addClass(d.icons.header),this.active.next().addClass("ui-accordion-content-active");var e=this.active.next(),f={options:d,newHeader:a([]),oldHeader:d.active,newContent:a([]),oldContent:e},g=this.active=a([]);this._toggle(g,e,f);return;}var h=a(b.currentTarget||c),i=h[0]===this.active[0];d.active=d.collapsible&&i?!1:this.headers.index(h);if(this.running||!d.collapsible&&i)return;var j=this.active,g=h.next(),e=this.active.next(),f={options:d,newHeader:i&&d.collapsible?a([]):h,oldHeader:this.active,newContent:i&&d.collapsible?a([]):g,oldContent:e},k=this.headers.index(this.active[0])>this.headers.index(h[0]);this.active=i?a([]):h,this._toggle(g,e,f,i,k),j.removeClass("ui-state-active ui-corner-top").addClass("ui-state-default ui-corner-all").children(".ui-icon").removeClass(d.icons.headerSelected).addClass(d.icons.header),i||(h.removeClass("ui-state-default ui-corner-all").addClass("ui-state-active ui-corner-top").children(".ui-icon").removeClass(d.icons.header).addClass(d.icons.headerSelected),h.next().addClass("ui-accordion-content-active"));return;}},_toggle:function(b,c,d,e,f){var g=this,h=g.options;g.toShow=b,g.toHide=c,g.data=d;var i=function(){if(g)return g._completed.apply(g,arguments);};g._trigger("changestart",null,g.data),g.running=c.size()===0?b.size():c.size();if(h.animated){var j={};h.collapsible&&e?j={toShow:a([]),toHide:c,complete:i,down:f,autoHeight:h.autoHeight||h.fillSpace}:j={toShow:b,toHide:c,complete:i,down:f,autoHeight:h.autoHeight||h.fillSpace},h.proxied||(h.proxied=h.animated),h.proxiedDuration||(h.proxiedDuration=h.duration),h.animated=a.isFunction(h.proxied)?h.proxied(j):h.proxied,h.duration=a.isFunction(h.proxiedDuration)?h.proxiedDuration(j):h.proxiedDuration;var k=a.ui.accordion.animations,l=h.duration,m=h.animated;m&&!k[m]&&!a.easing[m]&&(m="slide"),k[m]||(k[m]=function(a){this.slide(a,{easing:m,duration:l||700});}),k[m](j);}else h.collapsible&&e?b.toggle():(c.hide(),b.show()),i(!0);c.prev().attr({"aria-expanded":"false","aria-selected":"false",tabIndex:-1}).blur(),b.prev().attr({"aria-expanded":"true","aria-selected":"true",tabIndex:0}).focus();},_completed:function(a){this.running=a?0:--this.running;this.running||(this.options.clearStyle&&this.toShow.add(this.toHide).css({height:"",overflow:""}),this.toHide.removeClass("ui-accordion-content-active"),this.toHide.length&&(this.toHide.parent()[0].className=this.toHide.parent()[0].className),this._trigger("change",null,this.data));}}),a.extend(a.ui.accordion,{version:"1.8.17",animations:{slide:function(b,c){b=a.extend({easing:"swing",duration:300},b,c);if(!b.toHide.size())b.toShow.animate({height:"show",paddingTop:"show",paddingBottom:"show"},b);else{if(!b.toShow.size()){b.toHide.animate({height:"hide",paddingTop:"hide",paddingBottom:"hide"},b);return;}var d=b.toShow.css("overflow"),e=0,f={},g={},h=["height","paddingTop","paddingBottom"],i,j=b.toShow;i=j[0].style.width,j.width(j.parent().width()-parseFloat(j.css("paddingLeft"))-parseFloat(j.css("paddingRight"))-(parseFloat(j.css("borderLeftWidth"))||0)-(parseFloat(j.css("borderRightWidth"))||0)),a.each(h,function(c,d){g[d]="hide";var e=(""+a.css(b.toShow[0],d)).match(/^([\d+-.]+)(.*)$/);f[d]={value:e[1],unit:e[2]||"px"};}),b.toShow.css({height:0,overflow:"hidden"}).show(),b.toHide.filter(":hidden").each(b.complete).end().filter(":visible").animate(g,{step:function(a,c){c.prop=="height"&&(e=c.end-c.start===0?0:(c.now-c.start)/(c.end-c.start)),b.toShow[0].style[c.prop]=e*f[c.prop].value+f[c.prop].unit;},duration:b.duration,easing:b.easing,complete:function(){b.autoHeight||b.toShow.css("height",""),b.toShow.css({width:i,overflow:d}),b.complete();}});}},bounceslide:function(a){this.slide(a,{easing:a.down?"easeOutBounce":"swing",duration:a.down?1e3:200});}}});})(jQuery);/* * jQuery UI Autocomplete 1.8.17 * * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) @@ -58,7 +58,7 @@ * jquery.ui.core.js * jquery.ui.widget.js * jquery.ui.position.js - */(function(a,b){var c=0;a.widget("ui.autocomplete",{options:{appendTo:"body",autoFocus:!1,delay:300,minLength:1,position:{my:"left top",at:"left bottom",collision:"none"},source:null},pending:0,_create:function(){var b=this,c=this.element[0].ownerDocument,d;this.element.addClass("ui-autocomplete-input").attr("autocomplete","off").attr({role:"textbox","aria-autocomplete":"list","aria-haspopup":"true"}).bind("keydown.autocomplete",function(c){if(!b.options.disabled&&!b.element.propAttr("readOnly")){d=!1;var e=a.ui.keyCode;switch(c.keyCode){case e.PAGE_UP:b._move("previousPage",c);break;case e.PAGE_DOWN:b._move("nextPage",c);break;case e.UP:b._move("previous",c),c.preventDefault();break;case e.DOWN:b._move("next",c),c.preventDefault();break;case e.ENTER:case e.NUMPAD_ENTER:b.menu.active&&(d=!0,c.preventDefault());case e.TAB:if(!b.menu.active)return;b.menu.select(c);break;case e.ESCAPE:b.element.val(b.term),b.close(c);break;default:clearTimeout(b.searching),b.searching=setTimeout(function(){b.term!=b.element.val()&&(b.selectedItem=null,b.search(null,c))},b.options.delay)}}}).bind("keypress.autocomplete",function(a){d&&(d=!1,a.preventDefault())}).bind("focus.autocomplete",function(){b.options.disabled||(b.selectedItem=null,b.previous=b.element.val())}).bind("blur.autocomplete",function(a){b.options.disabled||(clearTimeout(b.searching),b.closing=setTimeout(function(){b.close(a),b._change(a)},150))}),this._initSource(),this.response=function(){return b._response.apply(b,arguments)},this.menu=a("
    ").addClass("ui-autocomplete").appendTo(a(this.options.appendTo||"body",c)[0]).mousedown(function(c){var d=b.menu.element[0];a(c.target).closest(".ui-menu-item").length||setTimeout(function(){a(document).one("mousedown",function(c){c.target!==b.element[0]&&c.target!==d&&!a.ui.contains(d,c.target)&&b.close()})},1),setTimeout(function(){clearTimeout(b.closing)},13)}).menu({focus:function(a,c){var d=c.item.data("item.autocomplete");!1!==b._trigger("focus",a,{item:d})&&/^key/.test(a.originalEvent.type)&&b.element.val(d.value)},selected:function(a,d){var e=d.item.data("item.autocomplete"),f=b.previous;b.element[0]!==c.activeElement&&(b.element.focus(),b.previous=f,setTimeout(function(){b.previous=f,b.selectedItem=e},1)),!1!==b._trigger("select",a,{item:e})&&b.element.val(e.value),b.term=b.element.val(),b.close(a),b.selectedItem=e},blur:function(a,c){b.menu.element.is(":visible")&&b.element.val()!==b.term&&b.element.val(b.term)}}).zIndex(this.element.zIndex()+1).css({top:0,left:0}).hide().data("menu"),a.fn.bgiframe&&this.menu.element.bgiframe(),b.beforeunloadHandler=function(){b.element.removeAttr("autocomplete")},a(window).bind("beforeunload",b.beforeunloadHandler)},destroy:function(){this.element.removeClass("ui-autocomplete-input").removeAttr("autocomplete").removeAttr("role").removeAttr("aria-autocomplete").removeAttr("aria-haspopup"),this.menu.element.remove(),a(window).unbind("beforeunload",this.beforeunloadHandler),a.Widget.prototype.destroy.call(this)},_setOption:function(b,c){a.Widget.prototype._setOption.apply(this,arguments),b==="source"&&this._initSource(),b==="appendTo"&&this.menu.element.appendTo(a(c||"body",this.element[0].ownerDocument)[0]),b==="disabled"&&c&&this.xhr&&this.xhr.abort()},_initSource:function(){var b=this,d,e;a.isArray(this.options.source)?(d=this.options.source,this.source=function(b,c){c(a.ui.autocomplete.filter(d,b.term))}):typeof this.options.source=="string"?(e=this.options.source,this.source=function(d,f){b.xhr&&b.xhr.abort(),b.xhr=a.ajax({url:e,data:d,dataType:"json",autocompleteRequest:++c,success:function(a,b){this.autocompleteRequest===c&&f(a)},error:function(){this.autocompleteRequest===c&&f([])}})}):this.source=this.options.source},search:function(a,b){a=a!=null?a:this.element.val(),this.term=this.element.val();if(a.length").data("item.autocomplete",c).append(a("").text(c.label)).appendTo(b)},_move:function(a,b){if(!this.menu.element.is(":visible"))this.search(null,b);else{if(this.menu.first()&&/^previous/.test(a)||this.menu.last()&&/^next/.test(a)){this.element.val(this.term),this.menu.deactivate();return}this.menu[a](b)}},widget:function(){return this.menu.element}}),a.extend(a.ui.autocomplete,{escapeRegex:function(a){return a.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&")},filter:function(b,c){var d=new RegExp(a.ui.autocomplete.escapeRegex(c),"i");return a.grep(b,function(a){return d.test(a.label||a.value||a)})}})})(jQuery),function(a){a.widget("ui.menu",{_create:function(){var b=this;this.element.addClass("ui-menu ui-widget ui-widget-content ui-corner-all").attr({role:"listbox","aria-activedescendant":"ui-active-menuitem"}).click(function(c){!a(c.target).closest(".ui-menu-item a").length||(c.preventDefault(),b.select(c))}),this.refresh()},refresh:function(){var b=this,c=this.element.children("li:not(.ui-menu-item):has(a)").addClass("ui-menu-item").attr("role","menuitem");c.children("a").addClass("ui-corner-all").attr("tabindex",-1).mouseenter(function(c){b.activate(c,a(this).parent())}).mouseleave(function(){b.deactivate()})},activate:function(a,b){this.deactivate();if(this.hasScroll()){var c=b.offset().top-this.element.offset().top,d=this.element.scrollTop(),e=this.element.height();c<0?this.element.scrollTop(d+c):c>=e&&this.element.scrollTop(d+c-e+b.height())}this.active=b.eq(0).children("a").addClass("ui-state-hover").attr("id","ui-active-menuitem").end(),this._trigger("focus",a,{item:b})},deactivate:function(){!this.active||(this.active.children("a").removeClass("ui-state-hover").removeAttr("id"),this._trigger("blur"),this.active=null)},next:function(a){this.move("next",".ui-menu-item:first",a)},previous:function(a){this.move("prev",".ui-menu-item:last",a)},first:function(){return this.active&&!this.active.prevAll(".ui-menu-item").length},last:function(){return this.active&&!this.active.nextAll(".ui-menu-item").length},move:function(a,b,c){if(!this.active)this.activate(c,this.element.children(b));else{var d=this.active[a+"All"](".ui-menu-item").eq(0);d.length?this.activate(c,d):this.activate(c,this.element.children(b))}},nextPage:function(b){if(this.hasScroll()){if(!this.active||this.last()){this.activate(b,this.element.children(".ui-menu-item:first"));return}var c=this.active.offset().top,d=this.element.height(),e=this.element.children(".ui-menu-item").filter(function(){var b=a(this).offset().top-c-d+a(this).height();return b<10&&b>-10});e.length||(e=this.element.children(".ui-menu-item:last")),this.activate(b,e)}else this.activate(b,this.element.children(".ui-menu-item").filter(!this.active||this.last()?":first":":last"))},previousPage:function(b){if(this.hasScroll()){if(!this.active||this.first()){this.activate(b,this.element.children(".ui-menu-item:last"));return}var c=this.active.offset().top,d=this.element.height();result=this.element.children(".ui-menu-item").filter(function(){var b=a(this).offset().top-c+d-a(this).height();return b<10&&b>-10}),result.length||(result=this.element.children(".ui-menu-item:first")),this.activate(b,result)}else this.activate(b,this.element.children(".ui-menu-item").filter(!this.active||this.first()?":last":":first"))},hasScroll:function(){return this.element.height()").addClass("ui-autocomplete").appendTo(a(this.options.appendTo||"body",c)[0]).mousedown(function(c){var d=b.menu.element[0];a(c.target).closest(".ui-menu-item").length||setTimeout(function(){a(document).one("mousedown",function(c){c.target!==b.element[0]&&c.target!==d&&!a.ui.contains(d,c.target)&&b.close();});},1),setTimeout(function(){clearTimeout(b.closing);},13);}).menu({focus:function(a,c){var d=c.item.data("item.autocomplete");!1!==b._trigger("focus",a,{item:d})&&/^key/.test(a.originalEvent.type)&&b.element.val(d.value);},selected:function(a,d){var e=d.item.data("item.autocomplete"),f=b.previous;b.element[0]!==c.activeElement&&(b.element.focus(),b.previous=f,setTimeout(function(){b.previous=f,b.selectedItem=e;},1)),!1!==b._trigger("select",a,{item:e})&&b.element.val(e.value),b.term=b.element.val(),b.close(a),b.selectedItem=e;},blur:function(a,c){b.menu.element.is(":visible")&&b.element.val()!==b.term&&b.element.val(b.term);}}).zIndex(this.element.zIndex()+1).css({top:0,left:0}).hide().data("menu"),a.fn.bgiframe&&this.menu.element.bgiframe(),b.beforeunloadHandler=function(){b.element.removeAttr("autocomplete");},a(window).bind("beforeunload",b.beforeunloadHandler);},destroy:function(){this.element.removeClass("ui-autocomplete-input").removeAttr("autocomplete").removeAttr("role").removeAttr("aria-autocomplete").removeAttr("aria-haspopup"),this.menu.element.remove(),a(window).unbind("beforeunload",this.beforeunloadHandler),a.Widget.prototype.destroy.call(this);},_setOption:function(b,c){a.Widget.prototype._setOption.apply(this,arguments),b==="source"&&this._initSource(),b==="appendTo"&&this.menu.element.appendTo(a(c||"body",this.element[0].ownerDocument)[0]),b==="disabled"&&c&&this.xhr&&this.xhr.abort();},_initSource:function(){var b=this,d,e;a.isArray(this.options.source)?(d=this.options.source,this.source=function(b,c){c(a.ui.autocomplete.filter(d,b.term));}):typeof this.options.source=="string"?(e=this.options.source,this.source=function(d,f){b.xhr&&b.xhr.abort(),b.xhr=a.ajax({url:e,data:d,dataType:"json",autocompleteRequest:++c,success:function(a,b){this.autocompleteRequest===c&&f(a);},error:function(){this.autocompleteRequest===c&&f([]);}});}):this.source=this.options.source;},search:function(a,b){a=a!=null?a:this.element.val(),this.term=this.element.val();if(a.length").data("item.autocomplete",c).append(a("").text(c.label)).appendTo(b);},_move:function(a,b){if(!this.menu.element.is(":visible"))this.search(null,b);else{if(this.menu.first()&&/^previous/.test(a)||this.menu.last()&&/^next/.test(a)){this.element.val(this.term),this.menu.deactivate();return;}this.menu[a](b);}},widget:function(){return this.menu.element;}}),a.extend(a.ui.autocomplete,{escapeRegex:function(a){return a.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&");},filter:function(b,c){var d=new RegExp(a.ui.autocomplete.escapeRegex(c),"i");return a.grep(b,function(a){return d.test(a.label||a.value||a);});}});})(jQuery),function(a){a.widget("ui.menu",{_create:function(){var b=this;this.element.addClass("ui-menu ui-widget ui-widget-content ui-corner-all").attr({role:"listbox","aria-activedescendant":"ui-active-menuitem"}).click(function(c){!a(c.target).closest(".ui-menu-item a").length||(c.preventDefault(),b.select(c));}),this.refresh();},refresh:function(){var b=this,c=this.element.children("li:not(.ui-menu-item):has(a)").addClass("ui-menu-item").attr("role","menuitem");c.children("a").addClass("ui-corner-all").attr("tabindex",-1).mouseenter(function(c){b.activate(c,a(this).parent());}).mouseleave(function(){b.deactivate();});},activate:function(a,b){this.deactivate();if(this.hasScroll()){var c=b.offset().top-this.element.offset().top,d=this.element.scrollTop(),e=this.element.height();c<0?this.element.scrollTop(d+c):c>=e&&this.element.scrollTop(d+c-e+b.height());}this.active=b.eq(0).children("a").addClass("ui-state-hover").attr("id","ui-active-menuitem").end(),this._trigger("focus",a,{item:b});},deactivate:function(){!this.active||(this.active.children("a").removeClass("ui-state-hover").removeAttr("id"),this._trigger("blur"),this.active=null);},next:function(a){this.move("next",".ui-menu-item:first",a);},previous:function(a){this.move("prev",".ui-menu-item:last",a);},first:function(){return this.active&&!this.active.prevAll(".ui-menu-item").length;},last:function(){return this.active&&!this.active.nextAll(".ui-menu-item").length;},move:function(a,b,c){if(!this.active)this.activate(c,this.element.children(b));else{var d=this.active[a+"All"](".ui-menu-item").eq(0);d.length?this.activate(c,d):this.activate(c,this.element.children(b));}},nextPage:function(b){if(this.hasScroll()){if(!this.active||this.last()){this.activate(b,this.element.children(".ui-menu-item:first"));return;}var c=this.active.offset().top,d=this.element.height(),e=this.element.children(".ui-menu-item").filter(function(){var b=a(this).offset().top-c-d+a(this).height();return b<10&&b>-10;});e.length||(e=this.element.children(".ui-menu-item:last")),this.activate(b,e);}else this.activate(b,this.element.children(".ui-menu-item").filter(!this.active||this.last()?":first":":last"));},previousPage:function(b){if(this.hasScroll()){if(!this.active||this.first()){this.activate(b,this.element.children(".ui-menu-item:last"));return;}var c=this.active.offset().top,d=this.element.height();result=this.element.children(".ui-menu-item").filter(function(){var b=a(this).offset().top-c+d-a(this).height();return b<10&&b>-10;}),result.length||(result=this.element.children(".ui-menu-item:first")),this.activate(b,result);}else this.activate(b,this.element.children(".ui-menu-item").filter(!this.active||this.first()?":last":":first"));},hasScroll:function(){return this.element.height()",this.element[0].ownerDocument).addClass("ui-button-text").html(this.options.label).appendTo(b.empty()).text(),d=this.options.icons,e=d.primary&&d.secondary,f=[];d.primary||d.secondary?(this.options.text&&f.push("ui-button-text-icon"+(e?"s":d.primary?"-primary":"-secondary")),d.primary&&b.prepend(""),d.secondary&&b.append(""),this.options.text||(f.push(e?"ui-button-icons-only":"ui-button-icon-only"),this.hasTitle||b.attr("title",c))):f.push("ui-button-text-only"),b.addClass(f.join(" "))}}}),a.widget("ui.buttonset",{options:{items:":button, :submit, :reset, :checkbox, :radio, a, :data(button)"},_create:function(){this.element.addClass("ui-buttonset")},_init:function(){this.refresh()},_setOption:function(b,c){b==="disabled"&&this.buttons.button("option",b,c),a.Widget.prototype._setOption.apply(this,arguments)},refresh:function(){var b=this.element.css("direction")==="rtl";this.buttons=this.element.find(this.options.items).filter(":ui-button").button("refresh").end().not(":ui-button").button().end().map(function(){return a(this).button("widget")[0]}).removeClass("ui-corner-all ui-corner-left ui-corner-right").filter(":first").addClass(b?"ui-corner-right":"ui-corner-left").end().filter(":last").addClass(b?"ui-corner-left":"ui-corner-right").end().end()},destroy:function(){this.element.removeClass("ui-buttonset"),this.buttons.map(function(){return a(this).button("widget")[0]}).removeClass("ui-corner-left ui-corner-right").end().button("destroy"),a.Widget.prototype.destroy.call(this)}})})(jQuery);/* + */(function(a,b){var c,d,e,f,g="ui-button ui-widget ui-state-default ui-corner-all",h="ui-state-hover ui-state-active ",i="ui-button-icons-only ui-button-icon-only ui-button-text-icons ui-button-text-icon-primary ui-button-text-icon-secondary ui-button-text-only",j=function(){var b=a(this).find(":ui-button");setTimeout(function(){b.button("refresh");},1);},k=function(b){var c=b.name,d=b.form,e=a([]);c&&(d?e=a(d).find("[name='"+c+"']"):e=a("[name='"+c+"']",b.ownerDocument).filter(function(){return!this.form;}));return e;};a.widget("ui.button",{options:{disabled:null,text:!0,label:null,icons:{primary:null,secondary:null}},_create:function(){this.element.closest("form").unbind("reset.button").bind("reset.button",j),typeof this.options.disabled!="boolean"&&(this.options.disabled=this.element.propAttr("disabled")),this._determineButtonType(),this.hasTitle=!!this.buttonElement.attr("title");var b=this,h=this.options,i=this.type==="checkbox"||this.type==="radio",l="ui-state-hover"+(i?"":" ui-state-active"),m="ui-state-focus";h.label===null&&(h.label=this.buttonElement.html()),this.element.is(":disabled")&&(h.disabled=!0),this.buttonElement.addClass(g).attr("role","button").bind("mouseenter.button",function(){h.disabled||(a(this).addClass("ui-state-hover"),this===c&&a(this).addClass("ui-state-active"));}).bind("mouseleave.button",function(){h.disabled||a(this).removeClass(l);}).bind("click.button",function(a){h.disabled&&(a.preventDefault(),a.stopImmediatePropagation());}),this.element.bind("focus.button",function(){b.buttonElement.addClass(m);}).bind("blur.button",function(){b.buttonElement.removeClass(m);}),i&&(this.element.bind("change.button",function(){f||b.refresh();}),this.buttonElement.bind("mousedown.button",function(a){h.disabled||(f=!1,d=a.pageX,e=a.pageY);}).bind("mouseup.button",function(a){!h.disabled&&(d!==a.pageX||e!==a.pageY)&&(f=!0);})),this.type==="checkbox"?this.buttonElement.bind("click.button",function(){if(h.disabled||f)return!1;a(this).toggleClass("ui-state-active"),b.buttonElement.attr("aria-pressed",b.element[0].checked);}):this.type==="radio"?this.buttonElement.bind("click.button",function(){if(h.disabled||f)return!1;a(this).addClass("ui-state-active"),b.buttonElement.attr("aria-pressed","true");var c=b.element[0];k(c).not(c).map(function(){return a(this).button("widget")[0];}).removeClass("ui-state-active").attr("aria-pressed","false");}):(this.buttonElement.bind("mousedown.button",function(){if(h.disabled)return!1;a(this).addClass("ui-state-active"),c=this,a(document).one("mouseup",function(){c=null;});}).bind("mouseup.button",function(){if(h.disabled)return!1;a(this).removeClass("ui-state-active");}).bind("keydown.button",function(b){if(h.disabled)return!1;(b.keyCode==a.ui.keyCode.SPACE||b.keyCode==a.ui.keyCode.ENTER)&&a(this).addClass("ui-state-active");}).bind("keyup.button",function(){a(this).removeClass("ui-state-active");}),this.buttonElement.is("a")&&this.buttonElement.keyup(function(b){b.keyCode===a.ui.keyCode.SPACE&&a(this).click();})),this._setOption("disabled",h.disabled),this._resetButton();},_determineButtonType:function(){this.element.is(":checkbox")?this.type="checkbox":this.element.is(":radio")?this.type="radio":this.element.is("input")?this.type="input":this.type="button";if(this.type==="checkbox"||this.type==="radio"){var a=this.element.parents().filter(":last"),b="label[for='"+this.element.attr("id")+"']";this.buttonElement=a.find(b),this.buttonElement.length||(a=a.length?a.siblings():this.element.siblings(),this.buttonElement=a.filter(b),this.buttonElement.length||(this.buttonElement=a.find(b))),this.element.addClass("ui-helper-hidden-accessible");var c=this.element.is(":checked");c&&this.buttonElement.addClass("ui-state-active"),this.buttonElement.attr("aria-pressed",c);}else this.buttonElement=this.element;},widget:function(){return this.buttonElement;},destroy:function(){this.element.removeClass("ui-helper-hidden-accessible"),this.buttonElement.removeClass(g+" "+h+" "+i).removeAttr("role").removeAttr("aria-pressed").html(this.buttonElement.find(".ui-button-text").html()),this.hasTitle||this.buttonElement.removeAttr("title"),a.Widget.prototype.destroy.call(this);},_setOption:function(b,c){a.Widget.prototype._setOption.apply(this,arguments);b==="disabled"?c?this.element.propAttr("disabled",!0):this.element.propAttr("disabled",!1):this._resetButton();},refresh:function(){var b=this.element.is(":disabled");b!==this.options.disabled&&this._setOption("disabled",b),this.type==="radio"?k(this.element[0]).each(function(){a(this).is(":checked")?a(this).button("widget").addClass("ui-state-active").attr("aria-pressed","true"):a(this).button("widget").removeClass("ui-state-active").attr("aria-pressed","false");}):this.type==="checkbox"&&(this.element.is(":checked")?this.buttonElement.addClass("ui-state-active").attr("aria-pressed","true"):this.buttonElement.removeClass("ui-state-active").attr("aria-pressed","false"));},_resetButton:function(){if(this.type==="input")this.options.label&&this.element.val(this.options.label);else{var b=this.buttonElement.removeClass(i),c=a("",this.element[0].ownerDocument).addClass("ui-button-text").html(this.options.label).appendTo(b.empty()).text(),d=this.options.icons,e=d.primary&&d.secondary,f=[];d.primary||d.secondary?(this.options.text&&f.push("ui-button-text-icon"+(e?"s":d.primary?"-primary":"-secondary")),d.primary&&b.prepend(""),d.secondary&&b.append(""),this.options.text||(f.push(e?"ui-button-icons-only":"ui-button-icon-only"),this.hasTitle||b.attr("title",c))):f.push("ui-button-text-only"),b.addClass(f.join(" "));}}}),a.widget("ui.buttonset",{options:{items:":button, :submit, :reset, :checkbox, :radio, a, :data(button)"},_create:function(){this.element.addClass("ui-buttonset");},_init:function(){this.refresh();},_setOption:function(b,c){b==="disabled"&&this.buttons.button("option",b,c),a.Widget.prototype._setOption.apply(this,arguments);},refresh:function(){var b=this.element.css("direction")==="rtl";this.buttons=this.element.find(this.options.items).filter(":ui-button").button("refresh").end().not(":ui-button").button().end().map(function(){return a(this).button("widget")[0];}).removeClass("ui-corner-all ui-corner-left ui-corner-right").filter(":first").addClass(b?"ui-corner-right":"ui-corner-left").end().filter(":last").addClass(b?"ui-corner-left":"ui-corner-right").end().end();},destroy:function(){this.element.removeClass("ui-buttonset"),this.buttons.map(function(){return a(this).button("widget")[0];}).removeClass("ui-corner-left ui-corner-right").end().button("destroy"),a.Widget.prototype.destroy.call(this);}});})(jQuery);/* * jQuery UI Dialog 1.8.17 * * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) @@ -87,7 +87,7 @@ * jquery.ui.mouse.js * jquery.ui.position.js * jquery.ui.resizable.js - */(function(a,b){var c="ui-dialog ui-widget ui-widget-content ui-corner-all ",d={buttons:!0,height:!0,maxHeight:!0,maxWidth:!0,minHeight:!0,minWidth:!0,width:!0},e={maxHeight:!0,maxWidth:!0,minHeight:!0,minWidth:!0},f=a.attrFn||{val:!0,css:!0,html:!0,text:!0,data:!0,width:!0,height:!0,offset:!0,click:!0};a.widget("ui.dialog",{options:{autoOpen:!0,buttons:{},closeOnEscape:!0,closeText:"close",dialogClass:"",draggable:!0,hide:null,height:"auto",maxHeight:!1,maxWidth:!1,minHeight:150,minWidth:150,modal:!1,position:{my:"center",at:"center",collision:"fit",using:function(b){var c=a(this).css(b).offset().top;c<0&&a(this).css("top",b.top-c)}},resizable:!0,show:null,stack:!0,title:"",width:300,zIndex:1e3},_create:function(){this.originalTitle=this.element.attr("title"),typeof this.originalTitle!="string"&&(this.originalTitle=""),this.options.title=this.options.title||this.originalTitle;var b=this,d=b.options,e=d.title||" ",f=a.ui.dialog.getTitleId(b.element),g=(b.uiDialog=a("
    ")).appendTo(document.body).hide().addClass(c+d.dialogClass).css({zIndex:d.zIndex}).attr("tabIndex",-1).css("outline",0).keydown(function(c){d.closeOnEscape&&!c.isDefaultPrevented()&&c.keyCode&&c.keyCode===a.ui.keyCode.ESCAPE&&(b.close(c),c.preventDefault())}).attr({role:"dialog","aria-labelledby":f}).mousedown(function(a){b.moveToTop(!1,a)}),h=b.element.show().removeAttr("title").addClass("ui-dialog-content ui-widget-content").appendTo(g),i=(b.uiDialogTitlebar=a("
    ")).addClass("ui-dialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix").prependTo(g),j=a('').addClass("ui-dialog-titlebar-close ui-corner-all").attr("role","button").hover(function(){j.addClass("ui-state-hover")},function(){j.removeClass("ui-state-hover")}).focus(function(){j.addClass("ui-state-focus")}).blur(function(){j.removeClass("ui-state-focus")}).click(function(a){b.close(a);return!1}).appendTo(i),k=(b.uiDialogTitlebarCloseText=a("")).addClass("ui-icon ui-icon-closethick").text(d.closeText).appendTo(j),l=a("").addClass("ui-dialog-title").attr("id",f).html(e).prependTo(i);a.isFunction(d.beforeclose)&&!a.isFunction(d.beforeClose)&&(d.beforeClose=d.beforeclose),i.find("*").add(i).disableSelection(),d.draggable&&a.fn.draggable&&b._makeDraggable(),d.resizable&&a.fn.resizable&&b._makeResizable(),b._createButtons(d.buttons),b._isOpen=!1,a.fn.bgiframe&&g.bgiframe()},_init:function(){this.options.autoOpen&&this.open()},destroy:function(){var a=this;a.overlay&&a.overlay.destroy(),a.uiDialog.hide(),a.element.unbind(".dialog").removeData("dialog").removeClass("ui-dialog-content ui-widget-content").hide().appendTo("body"),a.uiDialog.remove(),a.originalTitle&&a.element.attr("title",a.originalTitle);return a},widget:function(){return this.uiDialog},close:function(b){var c=this,d,e;if(!1!==c._trigger("beforeClose",b)){c.overlay&&c.overlay.destroy(),c.uiDialog.unbind("keypress.ui-dialog"),c._isOpen=!1,c.options.hide?c.uiDialog.hide(c.options.hide,function(){c._trigger("close",b)}):(c.uiDialog.hide(),c._trigger("close",b)),a.ui.dialog.overlay.resize(),c.options.modal&&(d=0,a(".ui-dialog").each(function(){this!==c.uiDialog[0]&&(e=a(this).css("z-index"),isNaN(e)||(d=Math.max(d,e)))}),a.ui.dialog.maxZ=d);return c}},isOpen:function(){return this._isOpen},moveToTop:function(b,c){var d=this,e=d.options,f;if(e.modal&&!b||!e.stack&&!e.modal)return d._trigger("focus",c);e.zIndex>a.ui.dialog.maxZ&&(a.ui.dialog.maxZ=e.zIndex),d.overlay&&(a.ui.dialog.maxZ+=1,d.overlay.$el.css("z-index",a.ui.dialog.overlay.maxZ=a.ui.dialog.maxZ)),f={scrollTop:d.element.scrollTop(),scrollLeft:d.element.scrollLeft()},a.ui.dialog.maxZ+=1,d.uiDialog.css("z-index",a.ui.dialog.maxZ),d.element.attr(f),d._trigger("focus",c);return d},open:function(){if(!this._isOpen){var b=this,c=b.options,d=b.uiDialog;b.overlay=c.modal?new a.ui.dialog.overlay(b):null,b._size(),b._position(c.position),d.show(c.show),b.moveToTop(!0),c.modal&&d.bind("keydown.ui-dialog",function(b){if(b.keyCode===a.ui.keyCode.TAB){var c=a(":tabbable",this),d=c.filter(":first"),e=c.filter(":last");if(b.target===e[0]&&!b.shiftKey){d.focus(1);return!1}if(b.target===d[0]&&b.shiftKey){e.focus(1);return!1}}}),a(b.element.find(":tabbable").get().concat(d.find(".ui-dialog-buttonpane :tabbable").get().concat(d.get()))).eq(0).focus(),b._isOpen=!0,b._trigger("open");return b}},_createButtons:function(b){var c=this,d=!1,e=a("
    ").addClass("ui-dialog-buttonpane ui-widget-content ui-helper-clearfix"),g=a("
    ").addClass("ui-dialog-buttonset").appendTo(e);c.uiDialog.find(".ui-dialog-buttonpane").remove(),typeof b=="object"&&b!==null&&a.each(b,function(){return!(d=!0)}),d&&(a.each(b,function(b,d){d=a.isFunction(d)?{click:d,text:b}:d;var e=a('').click(function(){d.click.apply(c.element[0],arguments)}).appendTo(g);a.each(d,function(a,b){a!=="click"&&(a in f?e[a](b):e.attr(a,b))}),a.fn.button&&e.button()}),e.appendTo(c.uiDialog))},_makeDraggable:function(){function f(a){return{position:a.position,offset:a.offset}}var b=this,c=b.options,d=a(document),e;b.uiDialog.draggable({cancel:".ui-dialog-content, .ui-dialog-titlebar-close",handle:".ui-dialog-titlebar",containment:"document",start:function(d,g){e=c.height==="auto"?"auto":a(this).height(),a(this).height(a(this).height()).addClass("ui-dialog-dragging"),b._trigger("dragStart",d,f(g))},drag:function(a,c){b._trigger("drag",a,f(c))},stop:function(g,h){c.position=[h.position.left-d.scrollLeft(),h.position.top-d.scrollTop()],a(this).removeClass("ui-dialog-dragging").height(e),b._trigger("dragStop",g,f(h)),a.ui.dialog.overlay.resize()}})},_makeResizable:function(c){function h(a){return{originalPosition:a.originalPosition,originalSize:a.originalSize,position:a.position,size:a.size}}c=c===b?this.options.resizable:c;var d=this,e=d.options,f=d.uiDialog.css("position"),g=typeof c=="string"?c:"n,e,s,w,se,sw,ne,nw";d.uiDialog.resizable({cancel:".ui-dialog-content",containment:"document",alsoResize:d.element,maxWidth:e.maxWidth,maxHeight:e.maxHeight,minWidth:e.minWidth,minHeight:d._minHeight(),handles:g,start:function(b,c){a(this).addClass("ui-dialog-resizing"),d._trigger("resizeStart",b,h(c))},resize:function(a,b){d._trigger("resize",a,h(b))},stop:function(b,c){a(this).removeClass("ui-dialog-resizing"),e.height=a(this).height(),e.width=a(this).width(),d._trigger("resizeStop",b,h(c)),a.ui.dialog.overlay.resize()}}).css("position",f).find(".ui-resizable-se").addClass("ui-icon ui-icon-grip-diagonal-se")},_minHeight:function(){var a=this.options;return a.height==="auto"?a.minHeight:Math.min(a.minHeight,a.height)},_position:function(b){var c=[],d=[0,0],e;if(b){if(typeof b=="string"||typeof b=="object"&&"0"in b)c=b.split?b.split(" "):[b[0],b[1]],c.length===1&&(c[1]=c[0]),a.each(["left","top"],function(a,b){+c[a]===c[a]&&(d[a]=c[a],c[a]=b)}),b={my:c.join(" "),at:c.join(" "),offset:d.join(" ")};b=a.extend({},a.ui.dialog.prototype.options.position,b)}else b=a.ui.dialog.prototype.options.position;e=this.uiDialog.is(":visible"),e||this.uiDialog.show(),this.uiDialog.css({top:0,left:0}).position(a.extend({of:window},b)),e||this.uiDialog.hide()},_setOptions:function(b){var c=this,f={},g=!1;a.each(b,function(a,b){c._setOption(a,b),a in d&&(g=!0),a in e&&(f[a]=b)}),g&&this._size(),this.uiDialog.is(":data(resizable)")&&this.uiDialog.resizable("option",f)},_setOption:function(b,d){var e=this,f=e.uiDialog;switch(b){case"beforeclose":b="beforeClose";break;case"buttons":e._createButtons(d);break;case"closeText":e.uiDialogTitlebarCloseText.text(""+d);break;case"dialogClass":f.removeClass(e.options.dialogClass).addClass(c+d);break;case"disabled":d?f.addClass("ui-dialog-disabled"):f.removeClass("ui-dialog-disabled");break;case"draggable":var g=f.is(":data(draggable)");g&&!d&&f.draggable("destroy"),!g&&d&&e._makeDraggable();break;case"position":e._position(d);break;case"resizable":var h=f.is(":data(resizable)");h&&!d&&f.resizable("destroy"),h&&typeof d=="string"&&f.resizable("option","handles",d),!h&&d!==!1&&e._makeResizable(d);break;case"title":a(".ui-dialog-title",e.uiDialogTitlebar).html(""+(d||" "))}a.Widget.prototype._setOption.apply(e,arguments)},_size:function(){var b=this.options,c,d,e=this.uiDialog.is(":visible");this.element.show().css({width:"auto",minHeight:0,height:0}),b.minWidth>b.width&&(b.width=b.minWidth),c=this.uiDialog.css({height:"auto",width:b.width}).height(),d=Math.max(0,b.minHeight-c);if(b.height==="auto")if(a.support.minHeight)this.element.css({minHeight:d,height:"auto"});else{this.uiDialog.show();var f=this.element.css("height","auto").height();e||this.uiDialog.hide(),this.element.height(Math.max(f,d))}else this.element.height(Math.max(b.height-c,0));this.uiDialog.is(":data(resizable)")&&this.uiDialog.resizable("option","minHeight",this._minHeight())}}),a.extend(a.ui.dialog,{version:"1.8.17",uuid:0,maxZ:0,getTitleId:function(a){var b=a.attr("id");b||(this.uuid+=1,b=this.uuid);return"ui-dialog-title-"+b},overlay:function(b){this.$el=a.ui.dialog.overlay.create(b)}}),a.extend(a.ui.dialog.overlay,{instances:[],oldInstances:[],maxZ:0,events:a.map("focus,mousedown,mouseup,keydown,keypress,click".split(","),function(a){return a+".dialog-overlay"}).join(" "),create:function(b){this.instances.length===0&&(setTimeout(function(){a.ui.dialog.overlay.instances.length&&a(document).bind(a.ui.dialog.overlay.events,function(b){if(a(b.target).zIndex()
    ").addClass("ui-widget-overlay")).appendTo(document.body).css({width:this.width(),height:this.height()});a.fn.bgiframe&&c.bgiframe(),this.instances.push(c);return c},destroy:function(b){var c=a.inArray(b,this.instances);c!=-1&&this.oldInstances.push(this.instances.splice(c,1)[0]),this.instances.length===0&&a([document,window]).unbind(".dialog-overlay"),b.remove();var d=0;a.each(this.instances,function(){d=Math.max(d,this.css("z-index"))}),this.maxZ=d},height:function(){var b,c;if(a.browser.msie&&a.browser.version<7){b=Math.max(document.documentElement.scrollHeight,document.body.scrollHeight),c=Math.max(document.documentElement.offsetHeight,document.body.offsetHeight);return b")).appendTo(document.body).hide().addClass(c+d.dialogClass).css({zIndex:d.zIndex}).attr("tabIndex",-1).css("outline",0).keydown(function(c){d.closeOnEscape&&!c.isDefaultPrevented()&&c.keyCode&&c.keyCode===a.ui.keyCode.ESCAPE&&(b.close(c),c.preventDefault());}).attr({role:"dialog","aria-labelledby":f}).mousedown(function(a){b.moveToTop(!1,a);}),h=b.element.show().removeAttr("title").addClass("ui-dialog-content ui-widget-content").appendTo(g),i=(b.uiDialogTitlebar=a("
    ")).addClass("ui-dialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix").prependTo(g),j=a("").addClass("ui-dialog-titlebar-close ui-corner-all").attr("role","button").hover(function(){j.addClass("ui-state-hover");},function(){j.removeClass("ui-state-hover");}).focus(function(){j.addClass("ui-state-focus");}).blur(function(){j.removeClass("ui-state-focus");}).click(function(a){b.close(a);return!1;}).appendTo(i),k=(b.uiDialogTitlebarCloseText=a("")).addClass("ui-icon ui-icon-closethick").text(d.closeText).appendTo(j),l=a("").addClass("ui-dialog-title").attr("id",f).html(e).prependTo(i);a.isFunction(d.beforeclose)&&!a.isFunction(d.beforeClose)&&(d.beforeClose=d.beforeclose),i.find("*").add(i).disableSelection(),d.draggable&&a.fn.draggable&&b._makeDraggable(),d.resizable&&a.fn.resizable&&b._makeResizable(),b._createButtons(d.buttons),b._isOpen=!1,a.fn.bgiframe&&g.bgiframe();},_init:function(){this.options.autoOpen&&this.open();},destroy:function(){var a=this;a.overlay&&a.overlay.destroy(),a.uiDialog.hide(),a.element.unbind(".dialog").removeData("dialog").removeClass("ui-dialog-content ui-widget-content").hide().appendTo("body"),a.uiDialog.remove(),a.originalTitle&&a.element.attr("title",a.originalTitle);return a;},widget:function(){return this.uiDialog;},close:function(b){var c=this,d,e;if(!1!==c._trigger("beforeClose",b)){c.overlay&&c.overlay.destroy(),c.uiDialog.unbind("keypress.ui-dialog"),c._isOpen=!1,c.options.hide?c.uiDialog.hide(c.options.hide,function(){c._trigger("close",b);}):(c.uiDialog.hide(),c._trigger("close",b)),a.ui.dialog.overlay.resize(),c.options.modal&&(d=0,a(".ui-dialog").each(function(){this!==c.uiDialog[0]&&(e=a(this).css("z-index"),isNaN(e)||(d=Math.max(d,e)));}),a.ui.dialog.maxZ=d);return c;}},isOpen:function(){return this._isOpen;},moveToTop:function(b,c){var d=this,e=d.options,f;if(e.modal&&!b||!e.stack&&!e.modal)return d._trigger("focus",c);e.zIndex>a.ui.dialog.maxZ&&(a.ui.dialog.maxZ=e.zIndex),d.overlay&&(a.ui.dialog.maxZ+=1,d.overlay.$el.css("z-index",a.ui.dialog.overlay.maxZ=a.ui.dialog.maxZ)),f={scrollTop:d.element.scrollTop(),scrollLeft:d.element.scrollLeft()},a.ui.dialog.maxZ+=1,d.uiDialog.css("z-index",a.ui.dialog.maxZ),d.element.attr(f),d._trigger("focus",c);return d;},open:function(){if(!this._isOpen){var b=this,c=b.options,d=b.uiDialog;b.overlay=c.modal?new a.ui.dialog.overlay(b):null,b._size(),b._position(c.position),d.show(c.show),b.moveToTop(!0),c.modal&&d.bind("keydown.ui-dialog",function(b){if(b.keyCode===a.ui.keyCode.TAB){var c=a(":tabbable",this),d=c.filter(":first"),e=c.filter(":last");if(b.target===e[0]&&!b.shiftKey){d.focus(1);return!1;}if(b.target===d[0]&&b.shiftKey){e.focus(1);return!1;}}}),a(b.element.find(":tabbable").get().concat(d.find(".ui-dialog-buttonpane :tabbable").get().concat(d.get()))).eq(0).focus(),b._isOpen=!0,b._trigger("open");return b;}},_createButtons:function(b){var c=this,d=!1,e=a("
    ").addClass("ui-dialog-buttonpane ui-widget-content ui-helper-clearfix"),g=a("
    ").addClass("ui-dialog-buttonset").appendTo(e);c.uiDialog.find(".ui-dialog-buttonpane").remove(),typeof b=="object"&&b!==null&&a.each(b,function(){return!(d=!0);}),d&&(a.each(b,function(b,d){d=a.isFunction(d)?{click:d,text:b}:d;var e=a("").click(function(){d.click.apply(c.element[0],arguments);}).appendTo(g);a.each(d,function(a,b){a!=="click"&&(a in f?e[a](b):e.attr(a,b));}),a.fn.button&&e.button();}),e.appendTo(c.uiDialog));},_makeDraggable:function(){function f(a){return{position:a.position,offset:a.offset};}var b=this,c=b.options,d=a(document),e;b.uiDialog.draggable({cancel:".ui-dialog-content, .ui-dialog-titlebar-close",handle:".ui-dialog-titlebar",containment:"document",start:function(d,g){e=c.height==="auto"?"auto":a(this).height(),a(this).height(a(this).height()).addClass("ui-dialog-dragging"),b._trigger("dragStart",d,f(g));},drag:function(a,c){b._trigger("drag",a,f(c));},stop:function(g,h){c.position=[h.position.left-d.scrollLeft(),h.position.top-d.scrollTop()],a(this).removeClass("ui-dialog-dragging").height(e),b._trigger("dragStop",g,f(h)),a.ui.dialog.overlay.resize();}});},_makeResizable:function(c){function h(a){return{originalPosition:a.originalPosition,originalSize:a.originalSize,position:a.position,size:a.size};}c=c===b?this.options.resizable:c;var d=this,e=d.options,f=d.uiDialog.css("position"),g=typeof c=="string"?c:"n,e,s,w,se,sw,ne,nw";d.uiDialog.resizable({cancel:".ui-dialog-content",containment:"document",alsoResize:d.element,maxWidth:e.maxWidth,maxHeight:e.maxHeight,minWidth:e.minWidth,minHeight:d._minHeight(),handles:g,start:function(b,c){a(this).addClass("ui-dialog-resizing"),d._trigger("resizeStart",b,h(c));},resize:function(a,b){d._trigger("resize",a,h(b));},stop:function(b,c){a(this).removeClass("ui-dialog-resizing"),e.height=a(this).height(),e.width=a(this).width(),d._trigger("resizeStop",b,h(c)),a.ui.dialog.overlay.resize();}}).css("position",f).find(".ui-resizable-se").addClass("ui-icon ui-icon-grip-diagonal-se");},_minHeight:function(){var a=this.options;return a.height==="auto"?a.minHeight:Math.min(a.minHeight,a.height);},_position:function(b){var c=[],d=[0,0],e;if(b){if(typeof b=="string"||typeof b=="object"&&"0"in b)c=b.split?b.split(" "):[b[0],b[1]],c.length===1&&(c[1]=c[0]),a.each(["left","top"],function(a,b){+c[a]===c[a]&&(d[a]=c[a],c[a]=b);}),b={my:c.join(" "),at:c.join(" "),offset:d.join(" ")};b=a.extend({},a.ui.dialog.prototype.options.position,b);}else b=a.ui.dialog.prototype.options.position;e=this.uiDialog.is(":visible"),e||this.uiDialog.show(),this.uiDialog.css({top:0,left:0}).position(a.extend({of:window},b)),e||this.uiDialog.hide();},_setOptions:function(b){var c=this,f={},g=!1;a.each(b,function(a,b){c._setOption(a,b),a in d&&(g=!0),a in e&&(f[a]=b);}),g&&this._size(),this.uiDialog.is(":data(resizable)")&&this.uiDialog.resizable("option",f);},_setOption:function(b,d){var e=this,f=e.uiDialog;switch(b){case"beforeclose":b="beforeClose";break;case"buttons":e._createButtons(d);break;case"closeText":e.uiDialogTitlebarCloseText.text(""+d);break;case"dialogClass":f.removeClass(e.options.dialogClass).addClass(c+d);break;case"disabled":d?f.addClass("ui-dialog-disabled"):f.removeClass("ui-dialog-disabled");break;case"draggable":var g=f.is(":data(draggable)");g&&!d&&f.draggable("destroy"),!g&&d&&e._makeDraggable();break;case"position":e._position(d);break;case"resizable":var h=f.is(":data(resizable)");h&&!d&&f.resizable("destroy"),h&&typeof d=="string"&&f.resizable("option","handles",d),!h&&d!==!1&&e._makeResizable(d);break;case"title":a(".ui-dialog-title",e.uiDialogTitlebar).html(""+(d||" "));}a.Widget.prototype._setOption.apply(e,arguments);},_size:function(){var b=this.options,c,d,e=this.uiDialog.is(":visible");this.element.show().css({width:"auto",minHeight:0,height:0}),b.minWidth>b.width&&(b.width=b.minWidth),c=this.uiDialog.css({height:"auto",width:b.width}).height(),d=Math.max(0,b.minHeight-c);if(b.height==="auto")if(a.support.minHeight)this.element.css({minHeight:d,height:"auto"});else{this.uiDialog.show();var f=this.element.css("height","auto").height();e||this.uiDialog.hide(),this.element.height(Math.max(f,d));}else this.element.height(Math.max(b.height-c,0));this.uiDialog.is(":data(resizable)")&&this.uiDialog.resizable("option","minHeight",this._minHeight());}}),a.extend(a.ui.dialog,{version:"1.8.17",uuid:0,maxZ:0,getTitleId:function(a){var b=a.attr("id");b||(this.uuid+=1,b=this.uuid);return"ui-dialog-title-"+b;},overlay:function(b){this.$el=a.ui.dialog.overlay.create(b);}}),a.extend(a.ui.dialog.overlay,{instances:[],oldInstances:[],maxZ:0,events:a.map("focus,mousedown,mouseup,keydown,keypress,click".split(","),function(a){return a+".dialog-overlay";}).join(" "),create:function(b){this.instances.length===0&&(setTimeout(function(){a.ui.dialog.overlay.instances.length&&a(document).bind(a.ui.dialog.overlay.events,function(b){if(a(b.target).zIndex()").addClass("ui-widget-overlay")).appendTo(document.body).css({width:this.width(),height:this.height()});a.fn.bgiframe&&c.bgiframe(),this.instances.push(c);return c;},destroy:function(b){var c=a.inArray(b,this.instances);c!=-1&&this.oldInstances.push(this.instances.splice(c,1)[0]),this.instances.length===0&&a([document,window]).unbind(".dialog-overlay"),b.remove();var d=0;a.each(this.instances,function(){d=Math.max(d,this.css("z-index"));}),this.maxZ=d;},height:function(){var b,c;if(a.browser.msie&&a.browser.version<7){b=Math.max(document.documentElement.scrollHeight,document.body.scrollHeight),c=Math.max(document.documentElement.offsetHeight,document.body.offsetHeight);return b").appendTo(this.element).addClass("ui-slider-range ui-widget-header"+(d.range==="min"||d.range==="max"?" ui-slider-range-"+d.range:"")));for(var i=e.length;ic&&(f=c,g=a(this),i=b)}),c.range===!0&&this.values(1)===c.min&&(i+=1,g=a(this.handles[i])),j=this._start(b,i);if(j===!1)return!1;this._mouseSliding=!0,h._handleIndex=i,g.addClass("ui-state-active").focus(),k=g.offset(),l=!a(b.target).parents().andSelf().is(".ui-slider-handle"),this._clickOffset=l?{left:0,top:0}:{left:b.pageX-k.left-g.width()/2,top:b.pageY-k.top-g.height()/2-(parseInt(g.css("borderTopWidth"),10)||0)-(parseInt(g.css("borderBottomWidth"),10)||0)+(parseInt(g.css("marginTop"),10)||0)},this.handles.hasClass("ui-state-hover")||this._slide(b,i,e),this._animateOff=!0;return!0},_mouseStart:function(a){return!0},_mouseDrag:function(a){var b={x:a.pageX,y:a.pageY},c=this._normValueFromMouse(b);this._slide(a,this._handleIndex,c);return!1},_mouseStop:function(a){this.handles.removeClass("ui-state-active"),this._mouseSliding=!1,this._stop(a,this._handleIndex),this._change(a,this._handleIndex),this._handleIndex=null,this._clickOffset=null,this._animateOff=!1;return!1},_detectOrientation:function(){this.orientation=this.options.orientation==="vertical"?"vertical":"horizontal"},_normValueFromMouse:function(a){var b,c,d,e,f;this.orientation==="horizontal"?(b=this.elementSize.width,c=a.x-this.elementOffset.left-(this._clickOffset?this._clickOffset.left:0)):(b=this.elementSize.height,c=a.y-this.elementOffset.top-(this._clickOffset?this._clickOffset.top:0)),d=c/b,d>1&&(d=1),d<0&&(d=0),this.orientation==="vertical"&&(d=1-d),e=this._valueMax()-this._valueMin(),f=this._valueMin()+d*e;return this._trimAlignValue(f)},_start:function(a,b){var c={handle:this.handles[b],value:this.value()};this.options.values&&this.options.values.length&&(c.value=this.values(b),c.values=this.values());return this._trigger("start",a,c)},_slide:function(a,b,c){var d,e,f;this.options.values&&this.options.values.length?(d=this.values(b?0:1),this.options.values.length===2&&this.options.range===!0&&(b===0&&c>d||b===1&&c1)this.options.values[b]=this._trimAlignValue(c),this._refreshValue(),this._change(null,b);else{if(!arguments.length)return this._values();if(!a.isArray(arguments[0]))return this.options.values&&this.options.values.length?this._values(b):this.value();d=this.options.values,e=arguments[0];for(f=0;f=this._valueMax())return this._valueMax();var b=this.options.step>0?this.options.step:1,c=(a-this._valueMin())%b,d=a-c;Math.abs(c)*2>=b&&(d+=c>0?b:-b);return parseFloat(d.toFixed(5))},_valueMin:function(){return this.options.min},_valueMax:function(){return this.options.max},_refreshValue:function(){var b=this.options.range,c=this.options,d=this,e=this._animateOff?!1:c.animate,f,g={},h,i,j,k;this.options.values&&this.options.values.length?this.handles.each(function(b,i){f=(d.values(b)-d._valueMin())/(d._valueMax()-d._valueMin())*100,g[d.orientation==="horizontal"?"left":"bottom"]=f+"%",a(this).stop(1,1)[e?"animate":"css"](g,c.animate),d.options.range===!0&&(d.orientation==="horizontal"?(b===0&&d.range.stop(1,1)[e?"animate":"css"]({left:f+"%"},c.animate),b===1&&d.range[e?"animate":"css"]({width:f-h+"%"},{queue:!1,duration:c.animate})):(b===0&&d.range.stop(1,1)[e?"animate":"css"]({bottom:f+"%"},c.animate),b===1&&d.range[e?"animate":"css"]({height:f-h+"%"},{queue:!1,duration:c.animate}))),h=f}):(i=this.value(),j=this._valueMin(),k=this._valueMax(),f=k!==j?(i-j)/(k-j)*100:0,g[d.orientation==="horizontal"?"left":"bottom"]=f+"%",this.handle.stop(1,1)[e?"animate":"css"](g,c.animate),b==="min"&&this.orientation==="horizontal"&&this.range.stop(1,1)[e?"animate":"css"]({width:f+"%"},c.animate),b==="max"&&this.orientation==="horizontal"&&this.range[e?"animate":"css"]({width:100-f+"%"},{queue:!1,duration:c.animate}),b==="min"&&this.orientation==="vertical"&&this.range.stop(1,1)[e?"animate":"css"]({height:f+"%"},c.animate),b==="max"&&this.orientation==="vertical"&&this.range[e?"animate":"css"]({height:100-f+"%"},{queue:!1,duration:c.animate}))}}),a.extend(a.ui.slider,{version:"1.8.17"})})(jQuery);/* + */(function(a,b){var c=5;a.widget("ui.slider",a.ui.mouse,{widgetEventPrefix:"slide",options:{animate:!1,distance:0,max:100,min:0,orientation:"horizontal",range:!1,step:1,value:0,values:null},_create:function(){var b=this,d=this.options,e=this.element.find(".ui-slider-handle").addClass("ui-state-default ui-corner-all"),f="",g=d.values&&d.values.length||1,h=[];this._keySliding=!1,this._mouseSliding=!1,this._animateOff=!0,this._handleIndex=null,this._detectOrientation(),this._mouseInit(),this.element.addClass("ui-slider ui-slider-"+this.orientation+" ui-widget"+" ui-widget-content"+" ui-corner-all"+(d.disabled?" ui-slider-disabled ui-disabled":"")),this.range=a([]),d.range&&(d.range===!0&&(d.values||(d.values=[this._valueMin(),this._valueMin()]),d.values.length&&d.values.length!==2&&(d.values=[d.values[0],d.values[0]])),this.range=a("
    ").appendTo(this.element).addClass("ui-slider-range ui-widget-header"+(d.range==="min"||d.range==="max"?" ui-slider-range-"+d.range:"")));for(var i=e.length;ic&&(f=c,g=a(this),i=b);}),c.range===!0&&this.values(1)===c.min&&(i+=1,g=a(this.handles[i])),j=this._start(b,i);if(j===!1)return!1;this._mouseSliding=!0,h._handleIndex=i,g.addClass("ui-state-active").focus(),k=g.offset(),l=!a(b.target).parents().andSelf().is(".ui-slider-handle"),this._clickOffset=l?{left:0,top:0}:{left:b.pageX-k.left-g.width()/2,top:b.pageY-k.top-g.height()/2-(parseInt(g.css("borderTopWidth"),10)||0)-(parseInt(g.css("borderBottomWidth"),10)||0)+(parseInt(g.css("marginTop"),10)||0)},this.handles.hasClass("ui-state-hover")||this._slide(b,i,e),this._animateOff=!0;return!0;},_mouseStart:function(a){return!0;},_mouseDrag:function(a){var b={x:a.pageX,y:a.pageY},c=this._normValueFromMouse(b);this._slide(a,this._handleIndex,c);return!1;},_mouseStop:function(a){this.handles.removeClass("ui-state-active"),this._mouseSliding=!1,this._stop(a,this._handleIndex),this._change(a,this._handleIndex),this._handleIndex=null,this._clickOffset=null,this._animateOff=!1;return!1;},_detectOrientation:function(){this.orientation=this.options.orientation==="vertical"?"vertical":"horizontal";},_normValueFromMouse:function(a){var b,c,d,e,f;this.orientation==="horizontal"?(b=this.elementSize.width,c=a.x-this.elementOffset.left-(this._clickOffset?this._clickOffset.left:0)):(b=this.elementSize.height,c=a.y-this.elementOffset.top-(this._clickOffset?this._clickOffset.top:0)),d=c/b,d>1&&(d=1),d<0&&(d=0),this.orientation==="vertical"&&(d=1-d),e=this._valueMax()-this._valueMin(),f=this._valueMin()+d*e;return this._trimAlignValue(f);},_start:function(a,b){var c={handle:this.handles[b],value:this.value()};this.options.values&&this.options.values.length&&(c.value=this.values(b),c.values=this.values());return this._trigger("start",a,c);},_slide:function(a,b,c){var d,e,f;this.options.values&&this.options.values.length?(d=this.values(b?0:1),this.options.values.length===2&&this.options.range===!0&&(b===0&&c>d||b===1&&c1)this.options.values[b]=this._trimAlignValue(c),this._refreshValue(),this._change(null,b);else{if(!arguments.length)return this._values();if(!a.isArray(arguments[0]))return this.options.values&&this.options.values.length?this._values(b):this.value();d=this.options.values,e=arguments[0];for(f=0;f=this._valueMax())return this._valueMax();var b=this.options.step>0?this.options.step:1,c=(a-this._valueMin())%b,d=a-c;Math.abs(c)*2>=b&&(d+=c>0?b:-b);return parseFloat(d.toFixed(5));},_valueMin:function(){return this.options.min;},_valueMax:function(){return this.options.max;},_refreshValue:function(){var b=this.options.range,c=this.options,d=this,e=this._animateOff?!1:c.animate,f,g={},h,i,j,k;this.options.values&&this.options.values.length?this.handles.each(function(b,i){f=(d.values(b)-d._valueMin())/(d._valueMax()-d._valueMin())*100,g[d.orientation==="horizontal"?"left":"bottom"]=f+"%",a(this).stop(1,1)[e?"animate":"css"](g,c.animate),d.options.range===!0&&(d.orientation==="horizontal"?(b===0&&d.range.stop(1,1)[e?"animate":"css"]({left:f+"%"},c.animate),b===1&&d.range[e?"animate":"css"]({width:f-h+"%"},{queue:!1,duration:c.animate})):(b===0&&d.range.stop(1,1)[e?"animate":"css"]({bottom:f+"%"},c.animate),b===1&&d.range[e?"animate":"css"]({height:f-h+"%"},{queue:!1,duration:c.animate}))),h=f;}):(i=this.value(),j=this._valueMin(),k=this._valueMax(),f=k!==j?(i-j)/(k-j)*100:0,g[d.orientation==="horizontal"?"left":"bottom"]=f+"%",this.handle.stop(1,1)[e?"animate":"css"](g,c.animate),b==="min"&&this.orientation==="horizontal"&&this.range.stop(1,1)[e?"animate":"css"]({width:f+"%"},c.animate),b==="max"&&this.orientation==="horizontal"&&this.range[e?"animate":"css"]({width:100-f+"%"},{queue:!1,duration:c.animate}),b==="min"&&this.orientation==="vertical"&&this.range.stop(1,1)[e?"animate":"css"]({height:f+"%"},c.animate),b==="max"&&this.orientation==="vertical"&&this.range[e?"animate":"css"]({height:100-f+"%"},{queue:!1,duration:c.animate}));}}),a.extend(a.ui.slider,{version:"1.8.17"});})(jQuery);/* * jQuery UI Tabs 1.8.17 * * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) @@ -112,7 +112,7 @@ * Depends: * jquery.ui.core.js * jquery.ui.widget.js - */(function(a,b){function f(){return++d}function e(){return++c}var c=0,d=0;a.widget("ui.tabs",{options:{add:null,ajaxOptions:null,cache:!1,cookie:null,collapsible:!1,disable:null,disabled:[],enable:null,event:"click",fx:null,idPrefix:"ui-tabs-",load:null,panelTemplate:"
    ",remove:null,select:null,show:null,spinner:"Loading…",tabTemplate:"
  • #{label}
  • "},_create:function(){this._tabify(!0)},_setOption:function(a,b){if(a=="selected"){if(this.options.collapsible&&b==this.options.selected)return;this.select(b)}else this.options[a]=b,this._tabify()},_tabId:function(a){return a.title&&a.title.replace(/\s/g,"_").replace(/[^\w\u00c0-\uFFFF-]/g,"")||this.options.idPrefix+e()},_sanitizeSelector:function(a){return a.replace(/:/g,"\\:")},_cookie:function(){var b=this.cookie||(this.cookie=this.options.cookie.name||"ui-tabs-"+f());return a.cookie.apply(null,[b].concat(a.makeArray(arguments)))},_ui:function(a,b){return{tab:a,panel:b,index:this.anchors.index(a)}},_cleanup:function(){this.lis.filter(".ui-state-processing").removeClass("ui-state-processing").find("span:data(label.tabs)").each(function(){var b=a(this);b.html(b.data("label.tabs")).removeData("label.tabs")})},_tabify:function(c){function m(b,c){b.css("display",""),!a.support.opacity&&c.opacity&&b[0].style.removeAttribute("filter")}var d=this,e=this.options,f=/^#.+/;this.list=this.element.find("ol,ul").eq(0),this.lis=a(" > li:has(a[href])",this.list),this.anchors=this.lis.map(function(){return a("a",this)[0]}),this.panels=a([]),this.anchors.each(function(b,c){var g=a(c).attr("href"),h=g.split("#")[0],i;h&&(h===location.toString().split("#")[0]||(i=a("base")[0])&&h===i.href)&&(g=c.hash,c.href=g);if(f.test(g))d.panels=d.panels.add(d.element.find(d._sanitizeSelector(g)));else if(g&&g!=="#"){a.data(c,"href.tabs",g),a.data(c,"load.tabs",g.replace(/#.*$/,""));var j=d._tabId(c);c.href="#"+j;var k=d.element.find("#"+j);k.length||(k=a(e.panelTemplate).attr("id",j).addClass("ui-tabs-panel ui-widget-content ui-corner-bottom").insertAfter(d.panels[b-1]||d.list),k.data("destroy.tabs",!0)),d.panels=d.panels.add(k)}else e.disabled.push(b)}),c?(this.element.addClass("ui-tabs ui-widget ui-widget-content ui-corner-all"),this.list.addClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all"),this.lis.addClass("ui-state-default ui-corner-top"),this.panels.addClass("ui-tabs-panel ui-widget-content ui-corner-bottom"),e.selected===b?(location.hash&&this.anchors.each(function(a,b){if(b.hash==location.hash){e.selected=a;return!1}}),typeof e.selected!="number"&&e.cookie&&(e.selected=parseInt(d._cookie(),10)),typeof e.selected!="number"&&this.lis.filter(".ui-tabs-selected").length&&(e.selected=this.lis.index(this.lis.filter(".ui-tabs-selected"))),e.selected=e.selected||(this.lis.length?0:-1)):e.selected===null&&(e.selected=-1),e.selected=e.selected>=0&&this.anchors[e.selected]||e.selected<0?e.selected:0,e.disabled=a.unique(e.disabled.concat(a.map(this.lis.filter(".ui-state-disabled"),function(a,b){return d.lis.index(a)}))).sort(),a.inArray(e.selected,e.disabled)!=-1&&e.disabled.splice(a.inArray(e.selected,e.disabled),1),this.panels.addClass("ui-tabs-hide"),this.lis.removeClass("ui-tabs-selected ui-state-active"),e.selected>=0&&this.anchors.length&&(d.element.find(d._sanitizeSelector(d.anchors[e.selected].hash)).removeClass("ui-tabs-hide"),this.lis.eq(e.selected).addClass("ui-tabs-selected ui-state-active"),d.element.queue("tabs",function(){d._trigger("show",null,d._ui(d.anchors[e.selected],d.element.find(d._sanitizeSelector(d.anchors[e.selected].hash))[0]))}),this.load(e.selected)),a(window).bind("unload",function(){d.lis.add(d.anchors).unbind(".tabs"),d.lis=d.anchors=d.panels=null})):e.selected=this.lis.index(this.lis.filter(".ui-tabs-selected")),this.element[e.collapsible?"addClass":"removeClass"]("ui-tabs-collapsible"),e.cookie&&this._cookie(e.selected,e.cookie);for(var g=0,h;h=this.lis[g];g++)a(h)[a.inArray(g,e.disabled)!=-1&&!a(h).hasClass("ui-tabs-selected")?"addClass":"removeClass"]("ui-state-disabled");e.cache===!1&&this.anchors.removeData("cache.tabs"),this.lis.add(this.anchors).unbind(".tabs");if(e.event!=="mouseover"){var i=function(a,b){b.is(":not(.ui-state-disabled)")&&b.addClass("ui-state-"+a)},j=function(a,b){b.removeClass("ui-state-"+a)};this.lis.bind("mouseover.tabs",function(){i("hover",a(this))}),this.lis.bind("mouseout.tabs",function(){j("hover",a(this))}),this.anchors.bind("focus.tabs",function(){i("focus",a(this).closest("li"))}),this.anchors.bind("blur.tabs",function(){j("focus",a(this).closest("li"))})}var k,l;e.fx&&(a.isArray(e.fx)?(k=e.fx[0],l=e.fx[1]):k=l=e.fx);var n=l?function(b,c){a(b).closest("li").addClass("ui-tabs-selected ui-state-active"),c.hide().removeClass("ui-tabs-hide").animate(l,l.duration||"normal",function(){m(c,l),d._trigger("show",null,d._ui(b,c[0]))})}:function(b,c){a(b).closest("li").addClass("ui-tabs-selected ui-state-active"),c.removeClass("ui-tabs-hide"),d._trigger("show",null,d._ui(b,c[0]))},o=k?function(a,b){b.animate(k,k.duration||"normal",function(){d.lis.removeClass("ui-tabs-selected ui-state-active"),b.addClass("ui-tabs-hide"),m(b,k),d.element.dequeue("tabs")})}:function(a,b,c){d.lis.removeClass("ui-tabs-selected ui-state-active"),b.addClass("ui-tabs-hide"),d.element.dequeue("tabs")};this.anchors.bind(e.event+".tabs",function(){var b=this,c=a(b).closest("li"),f=d.panels.filter(":not(.ui-tabs-hide)"),g=d.element.find(d._sanitizeSelector(b.hash));if(c.hasClass("ui-tabs-selected")&&!e.collapsible||c.hasClass("ui-state-disabled")||c.hasClass("ui-state-processing")||d.panels.filter(":animated").length||d._trigger("select",null,d._ui(this,g[0]))===!1){this.blur();return!1}e.selected=d.anchors.index(this),d.abort();if(e.collapsible){if(c.hasClass("ui-tabs-selected")){e.selected=-1,e.cookie&&d._cookie(e.selected,e.cookie),d.element.queue("tabs",function(){o(b,f)}).dequeue("tabs"),this.blur();return!1}if(!f.length){e.cookie&&d._cookie(e.selected,e.cookie),d.element.queue("tabs",function(){n(b,g)}),d.load(d.anchors.index(this)),this.blur();return!1}}e.cookie&&d._cookie(e.selected,e.cookie);if(g.length)f.length&&d.element.queue("tabs",function(){o(b,f)}),d.element.queue("tabs",function(){n(b,g)}),d.load(d.anchors.index(this));else throw"jQuery UI Tabs: Mismatching fragment identifier.";a.browser.msie&&this.blur()}),this.anchors.bind("click.tabs",function(){return!1})},_getIndex:function(a){typeof a=="string"&&(a=this.anchors.index(this.anchors.filter("[href$="+a+"]")));return a},destroy:function(){var b=this.options;this.abort(),this.element.unbind(".tabs").removeClass("ui-tabs ui-widget ui-widget-content ui-corner-all ui-tabs-collapsible").removeData("tabs"),this.list.removeClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all"),this.anchors.each(function(){var b=a.data(this,"href.tabs");b&&(this.href=b);var c=a(this).unbind(".tabs");a.each(["href","load","cache"],function(a,b){c.removeData(b+".tabs")})}),this.lis.unbind(".tabs").add(this.panels).each(function(){a.data(this,"destroy.tabs")?a(this).remove():a(this).removeClass(["ui-state-default","ui-corner-top","ui-tabs-selected","ui-state-active","ui-state-hover","ui-state-focus","ui-state-disabled","ui-tabs-panel","ui-widget-content","ui-corner-bottom","ui-tabs-hide"].join(" "))}),b.cookie&&this._cookie(null,b.cookie);return this},add:function(c,d,e){e===b&&(e=this.anchors.length);var f=this,g=this.options,h=a(g.tabTemplate.replace(/#\{href\}/g,c).replace(/#\{label\}/g,d)),i=c.indexOf("#")?this._tabId(a("a",h)[0]):c.replace("#","");h.addClass("ui-state-default ui-corner-top").data("destroy.tabs",!0);var j=f.element.find("#"+i);j.length||(j=a(g.panelTemplate).attr("id",i).data("destroy.tabs",!0)),j.addClass("ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide"),e>=this.lis.length?(h.appendTo(this.list),j.appendTo(this.list[0].parentNode)):(h.insertBefore(this.lis[e]),j.insertBefore(this.panels[e])),g.disabled=a.map(g.disabled,function(a,b){return a>=e?++a:a}),this._tabify(),this.anchors.length==1&&(g.selected=0,h.addClass("ui-tabs-selected ui-state-active"),j.removeClass("ui-tabs-hide"),this.element.queue("tabs",function(){f._trigger("show",null,f._ui(f.anchors[0],f.panels[0]))}),this.load(0)),this._trigger("add",null,this._ui(this.anchors[e],this.panels[e]));return this},remove:function(b){b=this._getIndex(b);var c=this.options,d=this.lis.eq(b).remove(),e=this.panels.eq(b).remove();d.hasClass("ui-tabs-selected")&&this.anchors.length>1&&this.select(b+(b+1=b?--a:a}),this._tabify(),this._trigger("remove",null,this._ui(d.find("a")[0],e[0]));return this},enable:function(b){b=this._getIndex(b);var c=this.options;if(a.inArray(b,c.disabled)!=-1){this.lis.eq(b).removeClass("ui-state-disabled"),c.disabled=a.grep(c.disabled,function(a,c){return a!=b}),this._trigger("enable",null,this._ui(this.anchors[b],this.panels[b]));return this}},disable:function(a){a=this._getIndex(a);var b=this,c=this.options;a!=c.selected&&(this.lis.eq(a).addClass("ui-state-disabled"),c.disabled.push(a),c.disabled.sort(),this._trigger("disable",null,this._ui(this.anchors[a],this.panels[a])));return this},select:function(a){a=this._getIndex(a);if(a==-1)if(this.options.collapsible&&this.options.selected!=-1)a=this.options.selected;else return this;this.anchors.eq(a).trigger(this.options.event+".tabs");return this},load:function(b){b=this._getIndex(b);var c=this,d=this.options,e=this.anchors.eq(b)[0],f=a.data(e,"load.tabs");this.abort();if(!f||this.element.queue("tabs").length!==0&&a.data(e,"cache.tabs"))this.element.dequeue("tabs");else{this.lis.eq(b).addClass("ui-state-processing");if(d.spinner){var g=a("span",e);g.data("label.tabs",g.html()).html(d.spinner)}this.xhr=a.ajax(a.extend({},d.ajaxOptions,{url:f,success:function(f,g){c.element.find(c._sanitizeSelector(e.hash)).html(f),c._cleanup(),d.cache&&a.data(e,"cache.tabs",!0),c._trigger("load",null,c._ui(c.anchors[b],c.panels[b]));try{d.ajaxOptions.success(f,g)}catch(h){}},error:function(a,f,g){c._cleanup(),c._trigger("load",null,c._ui(c.anchors[b],c.panels[b]));try{d.ajaxOptions.error(a,f,b,e)}catch(g){}}})),c.element.dequeue("tabs");return this}},abort:function(){this.element.queue([]),this.panels.stop(!1,!0),this.element.queue("tabs",this.element.queue("tabs").splice(-2,2)),this.xhr&&(this.xhr.abort(),delete this.xhr),this._cleanup();return this},url:function(a,b){this.anchors.eq(a).removeData("cache.tabs").data("load.tabs",b);return this},length:function(){return this.anchors.length}}),a.extend(a.ui.tabs,{version:"1.8.17"}),a.extend(a.ui.tabs.prototype,{rotation:null,rotate:function(a,b){var c=this,d=this.options,e=c._rotate||(c._rotate=function(b){clearTimeout(c.rotation),c.rotation=setTimeout(function(){var a=d.selected;c.select(++a",remove:null,select:null,show:null,spinner:"Loading…",tabTemplate:"
  • #{label}
  • "},_create:function(){this._tabify(!0);},_setOption:function(a,b){if(a=="selected"){if(this.options.collapsible&&b==this.options.selected)return;this.select(b);}else this.options[a]=b,this._tabify();},_tabId:function(a){return a.title&&a.title.replace(/\s/g,"_").replace(/[^\w\u00c0-\uFFFF-]/g,"")||this.options.idPrefix+e();},_sanitizeSelector:function(a){return a.replace(/:/g,"\\:");},_cookie:function(){var b=this.cookie||(this.cookie=this.options.cookie.name||"ui-tabs-"+f());return a.cookie.apply(null,[b].concat(a.makeArray(arguments)));},_ui:function(a,b){return{tab:a,panel:b,index:this.anchors.index(a)};},_cleanup:function(){this.lis.filter(".ui-state-processing").removeClass("ui-state-processing").find("span:data(label.tabs)").each(function(){var b=a(this);b.html(b.data("label.tabs")).removeData("label.tabs");});},_tabify:function(c){function m(b,c){b.css("display",""),!a.support.opacity&&c.opacity&&b[0].style.removeAttribute("filter");}var d=this,e=this.options,f=/^#.+/;this.list=this.element.find("ol,ul").eq(0),this.lis=a(" > li:has(a[href])",this.list),this.anchors=this.lis.map(function(){return a("a",this)[0];}),this.panels=a([]),this.anchors.each(function(b,c){var g=a(c).attr("href"),h=g.split("#")[0],i;h&&(h===location.toString().split("#")[0]||(i=a("base")[0])&&h===i.href)&&(g=c.hash,c.href=g);if(f.test(g))d.panels=d.panels.add(d.element.find(d._sanitizeSelector(g)));else if(g&&g!=="#"){a.data(c,"href.tabs",g),a.data(c,"load.tabs",g.replace(/#.*$/,""));var j=d._tabId(c);c.href="#"+j;var k=d.element.find("#"+j);k.length||(k=a(e.panelTemplate).attr("id",j).addClass("ui-tabs-panel ui-widget-content ui-corner-bottom").insertAfter(d.panels[b-1]||d.list),k.data("destroy.tabs",!0)),d.panels=d.panels.add(k);}else e.disabled.push(b);}),c?(this.element.addClass("ui-tabs ui-widget ui-widget-content ui-corner-all"),this.list.addClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all"),this.lis.addClass("ui-state-default ui-corner-top"),this.panels.addClass("ui-tabs-panel ui-widget-content ui-corner-bottom"),e.selected===b?(location.hash&&this.anchors.each(function(a,b){if(b.hash==location.hash){e.selected=a;return!1;}}),typeof e.selected!="number"&&e.cookie&&(e.selected=parseInt(d._cookie(),10)),typeof e.selected!="number"&&this.lis.filter(".ui-tabs-selected").length&&(e.selected=this.lis.index(this.lis.filter(".ui-tabs-selected"))),e.selected=e.selected||(this.lis.length?0:-1)):e.selected===null&&(e.selected=-1),e.selected=e.selected>=0&&this.anchors[e.selected]||e.selected<0?e.selected:0,e.disabled=a.unique(e.disabled.concat(a.map(this.lis.filter(".ui-state-disabled"),function(a,b){return d.lis.index(a);}))).sort(),a.inArray(e.selected,e.disabled)!=-1&&e.disabled.splice(a.inArray(e.selected,e.disabled),1),this.panels.addClass("ui-tabs-hide"),this.lis.removeClass("ui-tabs-selected ui-state-active"),e.selected>=0&&this.anchors.length&&(d.element.find(d._sanitizeSelector(d.anchors[e.selected].hash)).removeClass("ui-tabs-hide"),this.lis.eq(e.selected).addClass("ui-tabs-selected ui-state-active"),d.element.queue("tabs",function(){d._trigger("show",null,d._ui(d.anchors[e.selected],d.element.find(d._sanitizeSelector(d.anchors[e.selected].hash))[0]));}),this.load(e.selected)),a(window).bind("unload",function(){d.lis.add(d.anchors).unbind(".tabs"),d.lis=d.anchors=d.panels=null;})):e.selected=this.lis.index(this.lis.filter(".ui-tabs-selected")),this.element[e.collapsible?"addClass":"removeClass"]("ui-tabs-collapsible"),e.cookie&&this._cookie(e.selected,e.cookie);for(var g=0,h;h=this.lis[g];g++)a(h)[a.inArray(g,e.disabled)!=-1&&!a(h).hasClass("ui-tabs-selected")?"addClass":"removeClass"]("ui-state-disabled");e.cache===!1&&this.anchors.removeData("cache.tabs"),this.lis.add(this.anchors).unbind(".tabs");if(e.event!=="mouseover"){var i=function(a,b){b.is(":not(.ui-state-disabled)")&&b.addClass("ui-state-"+a);},j=function(a,b){b.removeClass("ui-state-"+a);};this.lis.bind("mouseover.tabs",function(){i("hover",a(this));}),this.lis.bind("mouseout.tabs",function(){j("hover",a(this));}),this.anchors.bind("focus.tabs",function(){i("focus",a(this).closest("li"));}),this.anchors.bind("blur.tabs",function(){j("focus",a(this).closest("li"));});}var k,l;e.fx&&(a.isArray(e.fx)?(k=e.fx[0],l=e.fx[1]):k=l=e.fx);var n=l?function(b,c){a(b).closest("li").addClass("ui-tabs-selected ui-state-active"),c.hide().removeClass("ui-tabs-hide").animate(l,l.duration||"normal",function(){m(c,l),d._trigger("show",null,d._ui(b,c[0]));});}:function(b,c){a(b).closest("li").addClass("ui-tabs-selected ui-state-active"),c.removeClass("ui-tabs-hide"),d._trigger("show",null,d._ui(b,c[0]));},o=k?function(a,b){b.animate(k,k.duration||"normal",function(){d.lis.removeClass("ui-tabs-selected ui-state-active"),b.addClass("ui-tabs-hide"),m(b,k),d.element.dequeue("tabs");});}:function(a,b,c){d.lis.removeClass("ui-tabs-selected ui-state-active"),b.addClass("ui-tabs-hide"),d.element.dequeue("tabs");};this.anchors.bind(e.event+".tabs",function(){var b=this,c=a(b).closest("li"),f=d.panels.filter(":not(.ui-tabs-hide)"),g=d.element.find(d._sanitizeSelector(b.hash));if(c.hasClass("ui-tabs-selected")&&!e.collapsible||c.hasClass("ui-state-disabled")||c.hasClass("ui-state-processing")||d.panels.filter(":animated").length||d._trigger("select",null,d._ui(this,g[0]))===!1){this.blur();return!1;}e.selected=d.anchors.index(this),d.abort();if(e.collapsible){if(c.hasClass("ui-tabs-selected")){e.selected=-1,e.cookie&&d._cookie(e.selected,e.cookie),d.element.queue("tabs",function(){o(b,f);}).dequeue("tabs"),this.blur();return!1;}if(!f.length){e.cookie&&d._cookie(e.selected,e.cookie),d.element.queue("tabs",function(){n(b,g);}),d.load(d.anchors.index(this)),this.blur();return!1;}}e.cookie&&d._cookie(e.selected,e.cookie);if(g.length)f.length&&d.element.queue("tabs",function(){o(b,f);}),d.element.queue("tabs",function(){n(b,g);}),d.load(d.anchors.index(this));else throw"jQuery UI Tabs: Mismatching fragment identifier.";a.browser.msie&&this.blur();}),this.anchors.bind("click.tabs",function(){return!1;});},_getIndex:function(a){typeof a=="string"&&(a=this.anchors.index(this.anchors.filter("[href$="+a+"]")));return a;},destroy:function(){var b=this.options;this.abort(),this.element.unbind(".tabs").removeClass("ui-tabs ui-widget ui-widget-content ui-corner-all ui-tabs-collapsible").removeData("tabs"),this.list.removeClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all"),this.anchors.each(function(){var b=a.data(this,"href.tabs");b&&(this.href=b);var c=a(this).unbind(".tabs");a.each(["href","load","cache"],function(a,b){c.removeData(b+".tabs");});}),this.lis.unbind(".tabs").add(this.panels).each(function(){a.data(this,"destroy.tabs")?a(this).remove():a(this).removeClass(["ui-state-default","ui-corner-top","ui-tabs-selected","ui-state-active","ui-state-hover","ui-state-focus","ui-state-disabled","ui-tabs-panel","ui-widget-content","ui-corner-bottom","ui-tabs-hide"].join(" "));}),b.cookie&&this._cookie(null,b.cookie);return this;},add:function(c,d,e){e===b&&(e=this.anchors.length);var f=this,g=this.options,h=a(g.tabTemplate.replace(/#\{href\}/g,c).replace(/#\{label\}/g,d)),i=c.indexOf("#")?this._tabId(a("a",h)[0]):c.replace("#","");h.addClass("ui-state-default ui-corner-top").data("destroy.tabs",!0);var j=f.element.find("#"+i);j.length||(j=a(g.panelTemplate).attr("id",i).data("destroy.tabs",!0)),j.addClass("ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide"),e>=this.lis.length?(h.appendTo(this.list),j.appendTo(this.list[0].parentNode)):(h.insertBefore(this.lis[e]),j.insertBefore(this.panels[e])),g.disabled=a.map(g.disabled,function(a,b){return a>=e?++a:a;}),this._tabify(),this.anchors.length==1&&(g.selected=0,h.addClass("ui-tabs-selected ui-state-active"),j.removeClass("ui-tabs-hide"),this.element.queue("tabs",function(){f._trigger("show",null,f._ui(f.anchors[0],f.panels[0]));}),this.load(0)),this._trigger("add",null,this._ui(this.anchors[e],this.panels[e]));return this;},remove:function(b){b=this._getIndex(b);var c=this.options,d=this.lis.eq(b).remove(),e=this.panels.eq(b).remove();d.hasClass("ui-tabs-selected")&&this.anchors.length>1&&this.select(b+(b+1=b?--a:a;}),this._tabify(),this._trigger("remove",null,this._ui(d.find("a")[0],e[0]));return this;},enable:function(b){b=this._getIndex(b);var c=this.options;if(a.inArray(b,c.disabled)!=-1){this.lis.eq(b).removeClass("ui-state-disabled"),c.disabled=a.grep(c.disabled,function(a,c){return a!=b;}),this._trigger("enable",null,this._ui(this.anchors[b],this.panels[b]));return this;}},disable:function(a){a=this._getIndex(a);var b=this,c=this.options;a!=c.selected&&(this.lis.eq(a).addClass("ui-state-disabled"),c.disabled.push(a),c.disabled.sort(),this._trigger("disable",null,this._ui(this.anchors[a],this.panels[a])));return this;},select:function(a){a=this._getIndex(a);if(a==-1)if(this.options.collapsible&&this.options.selected!=-1)a=this.options.selected;else return this;this.anchors.eq(a).trigger(this.options.event+".tabs");return this;},load:function(b){b=this._getIndex(b);var c=this,d=this.options,e=this.anchors.eq(b)[0],f=a.data(e,"load.tabs");this.abort();if(!f||this.element.queue("tabs").length!==0&&a.data(e,"cache.tabs"))this.element.dequeue("tabs");else{this.lis.eq(b).addClass("ui-state-processing");if(d.spinner){var g=a("span",e);g.data("label.tabs",g.html()).html(d.spinner);}this.xhr=a.ajax(a.extend({},d.ajaxOptions,{url:f,success:function(f,g){c.element.find(c._sanitizeSelector(e.hash)).html(f),c._cleanup(),d.cache&&a.data(e,"cache.tabs",!0),c._trigger("load",null,c._ui(c.anchors[b],c.panels[b]));try{d.ajaxOptions.success(f,g);}catch(h){}},error:function(a,f,g){c._cleanup(),c._trigger("load",null,c._ui(c.anchors[b],c.panels[b]));try{d.ajaxOptions.error(a,f,b,e);}catch(g){}}})),c.element.dequeue("tabs");return this;}},abort:function(){this.element.queue([]),this.panels.stop(!1,!0),this.element.queue("tabs",this.element.queue("tabs").splice(-2,2)),this.xhr&&(this.xhr.abort(),delete this.xhr),this._cleanup();return this;},url:function(a,b){this.anchors.eq(a).removeData("cache.tabs").data("load.tabs",b);return this;},length:function(){return this.anchors.length;}}),a.extend(a.ui.tabs,{version:"1.8.17"}),a.extend(a.ui.tabs.prototype,{rotation:null,rotate:function(a,b){var c=this,d=this.options,e=c._rotate||(c._rotate=function(b){clearTimeout(c.rotation),c.rotation=setTimeout(function(){var a=d.selected;c.select(++a'))}$.extend($.ui,{datepicker:{version:"1.8.17"}});var PROP_NAME="datepicker",dpuuid=(new Date).getTime(),instActive;$.extend(Datepicker.prototype,{markerClassName:"hasDatepicker",maxRows:4,log:function(){this.debug&&console.log.apply("",arguments)},_widgetDatepicker:function(){return this.dpDiv},setDefaults:function(a){extendRemove(this._defaults,a||{});return this},_attachDatepicker:function(target,settings){var inlineSettings=null;for(var attrName in this._defaults){var attrValue=target.getAttribute("date:"+attrName);if(attrValue){inlineSettings=inlineSettings||{};try{inlineSettings[attrName]=eval(attrValue)}catch(err){inlineSettings[attrName]=attrValue}}}var nodeName=target.nodeName.toLowerCase(),inline=nodeName=="div"||nodeName=="span";target.id||(this.uuid+=1,target.id="dp"+this.uuid);var inst=this._newInst($(target),inline);inst.settings=$.extend({},settings||{},inlineSettings||{}),nodeName=="input"?this._connectDatepicker(target,inst):inline&&this._inlineDatepicker(target,inst)},_newInst:function(a,b){var c=a[0].id.replace(/([^A-Za-z0-9_-])/g,"\\\\$1");return{id:c,input:a,selectedDay:0,selectedMonth:0,selectedYear:0,drawMonth:0,drawYear:0,inline:b,dpDiv:b?bindHover($('
    ')):this.dpDiv}},_connectDatepicker:function(a,b){var c=$(a);b.append=$([]),b.trigger=$([]);c.hasClass(this.markerClassName)||(this._attachments(c,b),c.addClass(this.markerClassName).keydown(this._doKeyDown).keypress(this._doKeyPress).keyup(this._doKeyUp).bind("setData.datepicker",function(a,c,d){b.settings[c]=d}).bind("getData.datepicker",function(a,c){return this._get(b,c)}),this._autoSize(b),$.data(a,PROP_NAME,b),b.settings.disabled&&this._disableDatepicker(a))},_attachments:function(a,b){var c=this._get(b,"appendText"),d=this._get(b,"isRTL");b.append&&b.append.remove(),c&&(b.append=$(''+c+""),a[d?"before":"after"](b.append)),a.unbind("focus",this._showDatepicker),b.trigger&&b.trigger.remove();var e=this._get(b,"showOn");(e=="focus"||e=="both")&&a.focus(this._showDatepicker);if(e=="button"||e=="both"){var f=this._get(b,"buttonText"),g=this._get(b,"buttonImage");b.trigger=$(this._get(b,"buttonImageOnly")?$("").addClass(this._triggerClass).attr({src:g,alt:f,title:f}):$('').addClass(this._triggerClass).html(g==""?f:$("").attr({src:g,alt:f,title:f}))),a[d?"before":"after"](b.trigger),b.trigger.click(function(){$.datepicker._datepickerShowing&&$.datepicker._lastInput==a[0]?$.datepicker._hideDatepicker():$.datepicker._showDatepicker(a[0]);return!1})}},_autoSize:function(a){if(this._get(a,"autoSize")&&!a.inline){var b=new Date(2009,11,20),c=this._get(a,"dateFormat");if(c.match(/[DM]/)){var d=function(a){var b=0,c=0;for(var d=0;db&&(b=a[d].length,c=d);return c};b.setMonth(d(this._get(a,c.match(/MM/)?"monthNames":"monthNamesShort"))),b.setDate(d(this._get(a,c.match(/DD/)?"dayNames":"dayNamesShort"))+20-b.getDay())}a.input.attr("size",this._formatDate(a,b).length)}},_inlineDatepicker:function(a,b){var c=$(a);c.hasClass(this.markerClassName)||(c.addClass(this.markerClassName).append(b.dpDiv).bind("setData.datepicker",function(a,c,d){b.settings[c]=d}).bind("getData.datepicker",function(a,c){return this._get(b,c)}),$.data(a,PROP_NAME,b),this._setDate(b,this._getDefaultDate(b),!0),this._updateDatepicker(b),this._updateAlternate(b),b.settings.disabled&&this._disableDatepicker(a),b.dpDiv.css("display","block"))},_dialogDatepicker:function(a,b,c,d,e){var f=this._dialogInst;if(!f){this.uuid+=1;var g="dp"+this.uuid;this._dialogInput=$(''),this._dialogInput.keydown(this._doKeyDown),$("body").append(this._dialogInput),f=this._dialogInst=this._newInst(this._dialogInput,!1),f.settings={},$.data(this._dialogInput[0],PROP_NAME,f)}extendRemove(f.settings,d||{}),b=b&&b.constructor==Date?this._formatDate(f,b):b,this._dialogInput.val(b),this._pos=e?e.length?e:[e.pageX,e.pageY]:null;if(!this._pos){var h=document.documentElement.clientWidth,i=document.documentElement.clientHeight,j=document.documentElement.scrollLeft||document.body.scrollLeft,k=document.documentElement.scrollTop||document.body.scrollTop;this._pos=[h/2-100+j,i/2-150+k]}this._dialogInput.css("left",this._pos[0]+20+"px").css("top",this._pos[1]+"px"),f.settings.onSelect=c,this._inDialog=!0,this.dpDiv.addClass(this._dialogClass),this._showDatepicker(this._dialogInput[0]),$.blockUI&&$.blockUI(this.dpDiv),$.data(this._dialogInput[0],PROP_NAME,f);return this},_destroyDatepicker:function(a){var b=$(a),c=$.data(a,PROP_NAME);if(!!b.hasClass(this.markerClassName)){var d=a.nodeName.toLowerCase();$.removeData(a,PROP_NAME),d=="input"?(c.append.remove(),c.trigger.remove(),b.removeClass(this.markerClassName).unbind("focus",this._showDatepicker).unbind("keydown",this._doKeyDown).unbind("keypress",this._doKeyPress).unbind("keyup",this._doKeyUp)):(d=="div"||d=="span")&&b.removeClass(this.markerClassName).empty()}},_enableDatepicker:function(a){var b=$(a),c=$.data(a,PROP_NAME);if(!!b.hasClass(this.markerClassName)){var d=a.nodeName.toLowerCase();if(d=="input")a.disabled=!1,c.trigger.filter("button").each(function(){this.disabled=!1}).end().filter("img").css({opacity:"1.0",cursor:""});else if(d=="div"||d=="span"){var e=b.children("."+this._inlineClass);e.children().removeClass("ui-state-disabled"),e.find("select.ui-datepicker-month, select.ui-datepicker-year").removeAttr("disabled")}this._disabledInputs=$.map(this._disabledInputs,function(b){return b==a?null:b})}},_disableDatepicker:function(a){var b=$(a),c=$.data(a,PROP_NAME);if(!!b.hasClass(this.markerClassName)){var d=a.nodeName.toLowerCase();if(d=="input")a.disabled=!0,c.trigger.filter("button").each(function(){this.disabled=!0}).end().filter("img").css({opacity:"0.5",cursor:"default"});else if(d=="div"||d=="span"){var e=b.children("."+this._inlineClass);e.children().addClass("ui-state-disabled"),e.find("select.ui-datepicker-month, select.ui-datepicker-year").attr("disabled","disabled")}this._disabledInputs=$.map(this._disabledInputs,function(b){return b==a?null:b}),this._disabledInputs[this._disabledInputs.length]=a}},_isDisabledDatepicker:function(a){if(!a)return!1;for(var b=0;b-1}},_doKeyUp:function(a){var b=$.datepicker._getInst(a.target);if(b.input.val()!=b.lastVal)try{var c=$.datepicker.parseDate($.datepicker._get(b,"dateFormat"),b.input?b.input.val():null,$.datepicker._getFormatConfig(b));c&&($.datepicker._setDateFromField(b),$.datepicker._updateAlternate(b),$.datepicker._updateDatepicker(b))}catch(a){$.datepicker.log(a)}return!0},_showDatepicker:function(a){a=a.target||a,a.nodeName.toLowerCase()!="input"&&(a=$("input",a.parentNode)[0]);if(!$.datepicker._isDisabledDatepicker(a)&&$.datepicker._lastInput!=a){var b=$.datepicker._getInst(a);$.datepicker._curInst&&$.datepicker._curInst!=b&&($.datepicker._curInst.dpDiv.stop(!0,!0),b&&$.datepicker._datepickerShowing&&$.datepicker._hideDatepicker($.datepicker._curInst.input[0]));var c=$.datepicker._get(b,"beforeShow"),d=c?c.apply(a,[a,b]):{};if(d===!1)return;extendRemove(b.settings,d),b.lastVal=null,$.datepicker._lastInput=a,$.datepicker._setDateFromField(b),$.datepicker._inDialog&&(a.value=""),$.datepicker._pos||($.datepicker._pos=$.datepicker._findPos(a),$.datepicker._pos[1]+=a.offsetHeight);var e=!1;$(a).parents().each(function(){e|=$(this).css("position")=="fixed";return!e}),e&&$.browser.opera&&($.datepicker._pos[0]-=document.documentElement.scrollLeft,$.datepicker._pos[1]-=document.documentElement.scrollTop);var f={left:$.datepicker._pos[0],top:$.datepicker._pos[1]};$.datepicker._pos=null,b.dpDiv.empty(),b.dpDiv.css({position:"absolute",display:"block",top:"-1000px"}),$.datepicker._updateDatepicker(b),f=$.datepicker._checkOffset(b,f,e),b.dpDiv.css({position:$.datepicker._inDialog&&$.blockUI?"static":e?"fixed":"absolute",display:"none",left:f.left+"px",top:f.top+"px"});if(!b.inline){var g=$.datepicker._get(b,"showAnim"),h=$.datepicker._get(b,"duration"),i=function(){var a=b.dpDiv.find("iframe.ui-datepicker-cover");if(!!a.length){var c=$.datepicker._getBorders(b.dpDiv);a.css({left:-c[0],top:-c[1],width:b.dpDiv.outerWidth(),height:b.dpDiv.outerHeight()})}};b.dpDiv.zIndex($(a).zIndex()+1),$.datepicker._datepickerShowing=!0,$.effects&&$.effects[g]?b.dpDiv.show(g,$.datepicker._get(b,"showOptions"),h,i):b.dpDiv[g||"show"](g?h:null,i),(!g||!h)&&i(),b.input.is(":visible")&&!b.input.is(":disabled")&&b.input.focus(),$.datepicker._curInst=b}}},_updateDatepicker:function(a){var b=this;b.maxRows=4;var c=$.datepicker._getBorders(a.dpDiv);instActive=a,a.dpDiv.empty().append(this._generateHTML(a));var d=a.dpDiv.find("iframe.ui-datepicker-cover");!d.length||d.css({left:-c[0],top:-c[1],width:a.dpDiv.outerWidth(),height:a.dpDiv.outerHeight()}),a.dpDiv.find("."+this._dayOverClass+" a").mouseover();var e=this._getNumberOfMonths(a),f=e[1],g=17;a.dpDiv.removeClass("ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4").width(""),f>1&&a.dpDiv.addClass("ui-datepicker-multi-"+f).css("width",g*f+"em"),a.dpDiv[(e[0]!=1||e[1]!=1?"add":"remove")+"Class"]("ui-datepicker-multi"),a.dpDiv[(this._get(a,"isRTL")?"add":"remove")+"Class"]("ui-datepicker-rtl"),a==$.datepicker._curInst&&$.datepicker._datepickerShowing&&a.input&&a.input.is(":visible")&&!a.input.is(":disabled")&&a.input[0]!=document.activeElement&&a.input.focus();if(a.yearshtml){var h=a.yearshtml;setTimeout(function(){h===a.yearshtml&&a.yearshtml&&a.dpDiv.find("select.ui-datepicker-year:first").replaceWith(a.yearshtml),h=a.yearshtml=null},0)}},_getBorders:function(a){var b=function(a){return{thin:1,medium:2,thick:3}[a]||a};return[parseFloat(b(a.css("border-left-width"))),parseFloat(b(a.css("border-top-width")))]},_checkOffset:function(a,b,c){var d=a.dpDiv.outerWidth(),e=a.dpDiv.outerHeight(),f=a.input?a.input.outerWidth():0,g=a.input?a.input.outerHeight():0,h=document.documentElement.clientWidth+$(document).scrollLeft(),i=document.documentElement.clientHeight+$(document).scrollTop();b.left-=this._get(a,"isRTL")?d-f:0,b.left-=c&&b.left==a.input.offset().left?$(document).scrollLeft():0,b.top-=c&&b.top==a.input.offset().top+g?$(document).scrollTop():0,b.left-=Math.min(b.left,b.left+d>h&&h>d?Math.abs(b.left+d-h):0),b.top-=Math.min(b.top,b.top+e>i&&i>e?Math.abs(e+g):0);return b},_findPos:function(a){var b=this._getInst(a),c=this._get(b,"isRTL");while(a&&(a.type=="hidden"||a.nodeType!=1||$.expr.filters.hidden(a)))a=a[c?"previousSibling":"nextSibling"];var d=$(a).offset();return[d.left,d.top]},_hideDatepicker:function(a){var b=this._curInst;if(!(!b||a&&b!=$.data(a,PROP_NAME))&&this._datepickerShowing){var c=this._get(b,"showAnim"),d=this._get(b,"duration"),e=this,f=function(){$.datepicker._tidyDialog(b),e._curInst=null};$.effects&&$.effects[c]?b.dpDiv.hide(c,$.datepicker._get(b,"showOptions"),d,f):b.dpDiv[c=="slideDown"?"slideUp":c=="fadeIn"?"fadeOut":"hide"](c?d:null,f),c||f(),this._datepickerShowing=!1;var g=this._get(b,"onClose");g&&g.apply(b.input?b.input[0]:null,[b.input?b.input.val():"",b]),this._lastInput=null,this._inDialog&&(this._dialogInput.css({position:"absolute",left:"0",top:"-100px"}),$.blockUI&&($.unblockUI(),$("body").append(this.dpDiv))),this._inDialog=!1}},_tidyDialog:function(a){a.dpDiv.removeClass(this._dialogClass).unbind(".ui-datepicker-calendar")},_checkExternalClick:function(a){if(!!$.datepicker._curInst){var b=$(a.target),c=$.datepicker._getInst(b[0]);(b[0].id!=$.datepicker._mainDivId&&b.parents("#"+$.datepicker._mainDivId).length==0&&!b.hasClass($.datepicker.markerClassName)&&!b.hasClass($.datepicker._triggerClass)&&$.datepicker._datepickerShowing&&(!$.datepicker._inDialog||!$.blockUI)||b.hasClass($.datepicker.markerClassName)&&$.datepicker._curInst!=c)&&$.datepicker._hideDatepicker()}},_adjustDate:function(a,b,c){var d=$(a),e=this._getInst(d[0]);this._isDisabledDatepicker(d[0])||(this._adjustInstDate(e,b+(c=="M"?this._get(e,"showCurrentAtPos"):0),c),this._updateDatepicker(e))},_gotoToday:function(a){var b=$(a),c=this._getInst(b[0]);if(this._get(c,"gotoCurrent")&&c.currentDay)c.selectedDay=c.currentDay,c.drawMonth=c.selectedMonth=c.currentMonth,c.drawYear=c.selectedYear=c.currentYear;else{var d=new Date;c.selectedDay=d.getDate(),c.drawMonth=c.selectedMonth=d.getMonth(),c.drawYear=c.selectedYear=d.getFullYear()}this._notifyChange(c),this._adjustDate(b)},_selectMonthYear:function(a,b,c){var d=$(a),e=this._getInst(d[0]);e["selected"+(c=="M"?"Month":"Year")]=e["draw"+(c=="M"?"Month":"Year")]=parseInt(b.options[b.selectedIndex].value,10),this._notifyChange(e),this._adjustDate(d)},_selectDay:function(a,b,c,d){var e=$(a);if(!$(d).hasClass(this._unselectableClass)&&!this._isDisabledDatepicker(e[0])){var f=this._getInst(e[0]);f.selectedDay=f.currentDay=$("a",d).html(),f.selectedMonth=f.currentMonth=b,f.selectedYear=f.currentYear=c,this._selectDate(a,this._formatDate(f,f.currentDay,f.currentMonth,f.currentYear))}},_clearDate:function(a){var b=$(a),c=this._getInst(b[0]);this._selectDate(b,"")},_selectDate:function(a,b){var c=$(a),d=this._getInst(c[0]);b=b!=null?b:this._formatDate(d),d.input&&d.input.val(b),this._updateAlternate(d);var e=this._get(d,"onSelect");e?e.apply(d.input?d.input[0]:null,[b,d]):d.input&&d.input.trigger("change"),d.inline?this._updateDatepicker(d):(this._hideDatepicker(),this._lastInput=d.input[0],typeof d.input[0]!="object"&&d.input.focus(),this._lastInput=null)},_updateAlternate:function(a){var b=this._get(a,"altField");if(b){var c=this._get(a,"altFormat")||this._get(a,"dateFormat"),d=this._getDate(a),e=this.formatDate(c,d,this._getFormatConfig(a));$(b).each(function(){$(this).val(e)})}},noWeekends:function(a){var b=a.getDay();return[b>0&&b<6,""]},iso8601Week:function(a){var b=new Date(a.getTime());b.setDate(b.getDate()+4-(b.getDay()||7));var c=b.getTime();b.setMonth(0),b.setDate(1);return Math.floor(Math.round((c-b)/864e5)/7)+1},parseDate:function(a,b,c){if(a==null||b==null)throw"Invalid arguments";b=typeof b=="object"?b.toString():b+"";if(b=="")return null;var d=(c?c.shortYearCutoff:null)||this._defaults.shortYearCutoff;d=typeof d!="string"?d:(new Date).getFullYear()%100+parseInt(d,10);var e=(c?c.dayNamesShort:null)||this._defaults.dayNamesShort,f=(c?c.dayNames:null)||this._defaults.dayNames,g=(c?c.monthNamesShort:null)||this._defaults.monthNamesShort,h=(c?c.monthNames:null)||this._defaults.monthNames,i=-1,j=-1,k=-1,l=-1,m=!1,n=function(b){var c=s+1-1){j=1,k=l;for(;;){var u=this._getDaysInMonth(i,j-1);if(k<=u)break;j++,k-=u}}var t=this._daylightSavingAdjust(new Date(i,j-1,k));if(t.getFullYear()!=i||t.getMonth()+1!=j||t.getDate()!=k)throw"Invalid date";return t},ATOM:"yy-mm-dd",COOKIE:"D, dd M yy",ISO_8601:"yy-mm-dd",RFC_822:"D, d M y",RFC_850:"DD, dd-M-y",RFC_1036:"D, d M y",RFC_1123:"D, d M yy",RFC_2822:"D, d M yy",RSS:"D, d M y",TICKS:"!",TIMESTAMP:"@",W3C:"yy-mm-dd",_ticksTo1970:(718685+Math.floor(492.5)-Math.floor(19.7)+Math.floor(4.925))*24*60*60*1e7,formatDate:function(a,b,c){if(!b)return"";var d=(c?c.dayNamesShort:null)||this._defaults.dayNamesShort,e=(c?c.dayNames:null)||this._defaults.dayNames,f=(c?c.monthNamesShort:null)||this._defaults.monthNamesShort,g=(c?c.monthNames:null)||this._defaults.monthNames,h=function(b){var c=m+112?a.getHours()+2:0);return a},_setDate:function(a,b,c){var d=!b,e=a.selectedMonth,f=a.selectedYear,g=this._restrictMinMax(a,this._determineDate(a,b,new Date));a.selectedDay=a.currentDay=g.getDate(),a.drawMonth=a.selectedMonth=a.currentMonth=g.getMonth(),a.drawYear=a.selectedYear=a.currentYear=g.getFullYear(),(e!=a.selectedMonth||f!=a.selectedYear)&&!c&&this._notifyChange(a),this._adjustInstDate(a),a.input&&a.input.val(d?"":this._formatDate(a))},_getDate:function(a){var b=!a.currentYear||a.input&&a.input.val()==""?null:this._daylightSavingAdjust(new Date(a.currentYear,a.currentMonth,a.currentDay));return b},_generateHTML:function(a){var b=new Date;b=this._daylightSavingAdjust(new Date(b.getFullYear(),b.getMonth(),b.getDate()));var c=this._get(a,"isRTL"),d=this._get(a,"showButtonPanel"),e=this._get(a,"hideIfNoPrevNext"),f=this._get(a,"navigationAsDateFormat"),g=this._getNumberOfMonths(a),h=this._get(a,"showCurrentAtPos"),i=this._get(a,"stepMonths"),j=g[0]!=1||g[1]!=1,k=this._daylightSavingAdjust(a.currentDay?new Date(a.currentYear,a.currentMonth,a.currentDay):new Date(9999,9,9)),l=this._getMinMaxDate(a,"min"),m=this._getMinMaxDate(a,"max"),n=a.drawMonth-h,o=a.drawYear;n<0&&(n+=12,o--);if(m){var p=this._daylightSavingAdjust(new Date(m.getFullYear(),m.getMonth()-g[0]*g[1]+1,m.getDate()));p=l&&pp)n--,n<0&&(n=11,o--)}a.drawMonth=n,a.drawYear=o;var q=this._get(a,"prevText");q=f?this.formatDate(q,this._daylightSavingAdjust(new Date(o,n-i,1)),this._getFormatConfig(a)):q;var r=this._canAdjustMonth(a,-1,o,n)?''+q+"":e?"":''+q+"",s=this._get(a,"nextText");s=f?this.formatDate(s,this._daylightSavingAdjust(new Date(o,n+i,1)),this._getFormatConfig(a)):s;var t=this._canAdjustMonth(a,1,o,n)?''+s+"":e?"":''+s+"",u=this._get(a,"currentText"),v=this._get(a,"gotoCurrent")&&a.currentDay?k:b;u=f?this.formatDate(u,v,this._getFormatConfig(a)):u;var w=a.inline?"":'",x=d?'
    '+(c?w:"")+(this._isInRange(a,v)?'":"")+(c?"":w)+"
    ":"",y=parseInt(this._get(a,"firstDay"),10);y=isNaN(y)?0:y;var z=this._get(a,"showWeek"),A=this._get(a,"dayNames"),B=this._get(a,"dayNamesShort"),C=this._get(a,"dayNamesMin"),D=this._get(a,"monthNames"),E=this._get(a,"monthNamesShort"),F=this._get(a,"beforeShowDay"),G=this._get(a,"showOtherMonths"),H=this._get(a,"selectOtherMonths"),I=this._get(a,"calculateWeek")||this.iso8601Week,J=this._getDefaultDate(a),K="";for(var L=0;L1)switch(N){case 0:Q+=" ui-datepicker-group-first",P=" ui-corner-"+(c?"right":"left");break;case g[1]-1:Q+=" ui-datepicker-group-last",P=" ui-corner-"+(c?"left":"right");break;default:Q+=" ui-datepicker-group-middle",P=""}Q+='">'}Q+='
    '+(/all|left/.test(P)&&L==0?c?t:r:"")+(/all|right/.test(P)&&L==0?c?r:t:"")+this._generateMonthYearHeader(a,n,o,l,m,L>0||N>0,D,E)+'
    '+"";var R=z?'":"";for(var S=0;S<7;S++){var T=(S+y)%7;R+="=5?' class="ui-datepicker-week-end"':"")+">"+''+C[T]+""}Q+=R+"";var U=this._getDaysInMonth(o,n);o==a.selectedYear&&n==a.selectedMonth&&(a.selectedDay=Math.min(a.selectedDay,U));var V=(this._getFirstDayOfMonth(o,n)-y+7)%7,W=Math.ceil((V+U)/7),X=j?this.maxRows>W?this.maxRows:W:W;this.maxRows=X;var Y=this._daylightSavingAdjust(new Date(o,n,1-V));for(var Z=0;Z";var _=z?'":"";for(var S=0;S<7;S++){var ba=F?F.apply(a.input?a.input[0]:null,[Y]):[!0,""],bb=Y.getMonth()!=n,bc=bb&&!H||!ba[0]||l&&Ym;_+='",Y.setDate(Y.getDate()+1),Y=this._daylightSavingAdjust(Y)}Q+=_+""}n++,n>11&&(n=0,o++),Q+="
    '+this._get(a,"weekHeader")+"
    '+this._get(a,"calculateWeek")(Y)+""+(bb&&!G?" ":bc?''+Y.getDate()+"":''+Y.getDate()+"")+"
    "+(j?""+(g[0]>0&&N==g[1]-1?'
    ':""):""),M+=Q}K+=M}K+=x+($.browser.msie&&parseInt($.browser.version,10)<7&&!a.inline?'':""),a._keyEvent=!1;return K},_generateMonthYearHeader:function(a,b,c,d,e,f,g,h){var i=this._get(a,"changeMonth"),j=this._get(a,"changeYear"),k=this -._get(a,"showMonthAfterYear"),l='
    ',m="";if(f||!i)m+=''+g[b]+"";else{var n=d&&d.getFullYear()==c,o=e&&e.getFullYear()==c;m+='"}k||(l+=m+(f||!i||!j?" ":""));if(!a.yearshtml){a.yearshtml="";if(f||!j)l+=''+c+"";else{var q=this._get(a,"yearRange").split(":"),r=(new Date).getFullYear(),s=function(a){var b=a.match(/c[+-].*/)?c+parseInt(a.substring(1),10):a.match(/[+-].*/)?r+parseInt(a,10):parseInt(a,10);return isNaN(b)?r:b},t=s(q[0]),u=Math.max(t,s(q[1]||""));t=d?Math.max(t,d.getFullYear()):t,u=e?Math.min(u,e.getFullYear()):u,a.yearshtml+='",l+=a.yearshtml,a.yearshtml=null}}l+=this._get(a,"yearSuffix"),k&&(l+=(f||!i||!j?" ":"")+m),l+="
    ";return l},_adjustInstDate:function(a,b,c){var d=a.drawYear+(c=="Y"?b:0),e=a.drawMonth+(c=="M"?b:0),f=Math.min(a.selectedDay,this._getDaysInMonth(d,e))+(c=="D"?b:0),g=this._restrictMinMax(a,this._daylightSavingAdjust(new Date(d,e,f)));a.selectedDay=g.getDate(),a.drawMonth=a.selectedMonth=g.getMonth(),a.drawYear=a.selectedYear=g.getFullYear(),(c=="M"||c=="Y")&&this._notifyChange(a)},_restrictMinMax:function(a,b){var c=this._getMinMaxDate(a,"min"),d=this._getMinMaxDate(a,"max"),e=c&&bd?d:e;return e},_notifyChange:function(a){var b=this._get(a,"onChangeMonthYear");b&&b.apply(a.input?a.input[0]:null,[a.selectedYear,a.selectedMonth+1,a])},_getNumberOfMonths:function(a){var b=this._get(a,"numberOfMonths");return b==null?[1,1]:typeof b=="number"?[1,b]:b},_getMinMaxDate:function(a,b){return this._determineDate(a,this._get(a,b+"Date"),null)},_getDaysInMonth:function(a,b){return 32-this._daylightSavingAdjust(new Date(a,b,32)).getDate()},_getFirstDayOfMonth:function(a,b){return(new Date(a,b,1)).getDay()},_canAdjustMonth:function(a,b,c,d){var e=this._getNumberOfMonths(a),f=this._daylightSavingAdjust(new Date(c,d+(b<0?b:e[0]*e[1]),1));b<0&&f.setDate(this._getDaysInMonth(f.getFullYear(),f.getMonth()));return this._isInRange(a,f)},_isInRange:function(a,b){var c=this._getMinMaxDate(a,"min"),d=this._getMinMaxDate(a,"max");return(!c||b.getTime()>=c.getTime())&&(!d||b.getTime()<=d.getTime())},_getFormatConfig:function(a){var b=this._get(a,"shortYearCutoff");b=typeof b!="string"?b:(new Date).getFullYear()%100+parseInt(b,10);return{shortYearCutoff:b,dayNamesShort:this._get(a,"dayNamesShort"),dayNames:this._get(a,"dayNames"),monthNamesShort:this._get(a,"monthNamesShort"),monthNames:this._get(a,"monthNames")}},_formatDate:function(a,b,c,d){b||(a.currentDay=a.selectedDay,a.currentMonth=a.selectedMonth,a.currentYear=a.selectedYear);var e=b?typeof b=="object"?b:this._daylightSavingAdjust(new Date(d,c,b)):this._daylightSavingAdjust(new Date(a.currentYear,a.currentMonth,a.currentDay));return this.formatDate(this._get(a,"dateFormat"),e,this._getFormatConfig(a))}}),$.fn.datepicker=function(a){if(!this.length)return this;$.datepicker.initialized||($(document).mousedown($.datepicker._checkExternalClick).find("body").append($.datepicker.dpDiv),$.datepicker.initialized=!0);var b=Array.prototype.slice.call(arguments,1);if(typeof a=="string"&&(a=="isDisabled"||a=="getDate"||a=="widget"))return $.datepicker["_"+a+"Datepicker"].apply($.datepicker,[this[0]].concat(b));if(a=="option"&&arguments.length==2&&typeof arguments[1]=="string")return $.datepicker["_"+a+"Datepicker"].apply($.datepicker,[this[0]].concat(b));return this.each(function(){typeof a=="string"?$.datepicker["_"+a+"Datepicker"].apply($.datepicker,[this].concat(b)):$.datepicker._attachDatepicker(this,a)})},$.datepicker=new Datepicker,$.datepicker.initialized=!1,$.datepicker.uuid=(new Date).getTime(),$.datepicker.version="1.8.17",window["DP_jQuery_"+dpuuid]=$})(jQuery);/* + */(function($,undefined){function isArray(a){return a&&($.browser.safari&&typeof a=="object"&&a.length||a.constructor&&a.constructor.toString().match(/\Array\(\)/));}function extendRemove(a,b){$.extend(a,b);for(var c in b)if(b[c]==null||b[c]==undefined)a[c]=b[c];return a;}function bindHover(a){var b="button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a";return a.bind("mouseout",function(a){var c=$(a.target).closest(b);!c.length||c.removeClass("ui-state-hover ui-datepicker-prev-hover ui-datepicker-next-hover");}).bind("mouseover",function(c){var d=$(c.target).closest(b);!$.datepicker._isDisabledDatepicker(instActive.inline?a.parent()[0]:instActive.input[0])&&!!d.length&&(d.parents(".ui-datepicker-calendar").find("a").removeClass("ui-state-hover"),d.addClass("ui-state-hover"),d.hasClass("ui-datepicker-prev")&&d.addClass("ui-datepicker-prev-hover"),d.hasClass("ui-datepicker-next")&&d.addClass("ui-datepicker-next-hover"));});}function Datepicker(){this.debug=!1,this._curInst=null,this._keyEvent=!1,this._disabledInputs=[],this._datepickerShowing=!1,this._inDialog=!1,this._mainDivId="ui-datepicker-div",this._inlineClass="ui-datepicker-inline",this._appendClass="ui-datepicker-append",this._triggerClass="ui-datepicker-trigger",this._dialogClass="ui-datepicker-dialog",this._disableClass="ui-datepicker-disabled",this._unselectableClass="ui-datepicker-unselectable",this._currentClass="ui-datepicker-current-day",this._dayOverClass="ui-datepicker-days-cell-over",this.regional=[],this.regional[""]={closeText:"Done",prevText:"Prev",nextText:"Next",currentText:"Today",monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],monthNamesShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayNamesShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],dayNamesMin:["Su","Mo","Tu","We","Th","Fr","Sa"],weekHeader:"Wk",dateFormat:"mm/dd/yy",firstDay:0,isRTL:!1,showMonthAfterYear:!1,yearSuffix:""},this._defaults={showOn:"focus",showAnim:"fadeIn",showOptions:{},defaultDate:null,appendText:"",buttonText:"...",buttonImage:"",buttonImageOnly:!1,hideIfNoPrevNext:!1,navigationAsDateFormat:!1,gotoCurrent:!1,changeMonth:!1,changeYear:!1,yearRange:"c-10:c+10",showOtherMonths:!1,selectOtherMonths:!1,showWeek:!1,calculateWeek:this.iso8601Week,shortYearCutoff:"+10",minDate:null,maxDate:null,duration:"fast",beforeShowDay:null,beforeShow:null,onSelect:null,onChangeMonthYear:null,onClose:null,numberOfMonths:1,showCurrentAtPos:0,stepMonths:1,stepBigMonths:12,altField:"",altFormat:"",constrainInput:!0,showButtonPanel:!1,autoSize:!1,disabled:!1},$.extend(this._defaults,this.regional[""]),this.dpDiv=bindHover($("
    "));}$.extend($.ui,{datepicker:{version:"1.8.17"}});var PROP_NAME="datepicker",dpuuid=(new Date).getTime(),instActive;$.extend(Datepicker.prototype,{markerClassName:"hasDatepicker",maxRows:4,log:function(){this.debug&&console.log.apply("",arguments);},_widgetDatepicker:function(){return this.dpDiv;},setDefaults:function(a){extendRemove(this._defaults,a||{});return this;},_attachDatepicker:function(target,settings){var inlineSettings=null;for(var attrName in this._defaults){var attrValue=target.getAttribute("date:"+attrName);if(attrValue){inlineSettings=inlineSettings||{};try{inlineSettings[attrName]=eval(attrValue);}catch(err){inlineSettings[attrName]=attrValue;}}}var nodeName=target.nodeName.toLowerCase(),inline=nodeName=="div"||nodeName=="span";target.id||(this.uuid+=1,target.id="dp"+this.uuid);var inst=this._newInst($(target),inline);inst.settings=$.extend({},settings||{},inlineSettings||{}),nodeName=="input"?this._connectDatepicker(target,inst):inline&&this._inlineDatepicker(target,inst);},_newInst:function(a,b){var c=a[0].id.replace(/([^A-Za-z0-9_-])/g,"\\\\$1");return{id:c,input:a,selectedDay:0,selectedMonth:0,selectedYear:0,drawMonth:0,drawYear:0,inline:b,dpDiv:b?bindHover($("
    ")):this.dpDiv};},_connectDatepicker:function(a,b){var c=$(a);b.append=$([]),b.trigger=$([]);c.hasClass(this.markerClassName)||(this._attachments(c,b),c.addClass(this.markerClassName).keydown(this._doKeyDown).keypress(this._doKeyPress).keyup(this._doKeyUp).bind("setData.datepicker",function(a,c,d){b.settings[c]=d;}).bind("getData.datepicker",function(a,c){return this._get(b,c);}),this._autoSize(b),$.data(a,PROP_NAME,b),b.settings.disabled&&this._disableDatepicker(a));},_attachments:function(a,b){var c=this._get(b,"appendText"),d=this._get(b,"isRTL");b.append&&b.append.remove(),c&&(b.append=$(""+c+""),a[d?"before":"after"](b.append)),a.unbind("focus",this._showDatepicker),b.trigger&&b.trigger.remove();var e=this._get(b,"showOn");(e=="focus"||e=="both")&&a.focus(this._showDatepicker);if(e=="button"||e=="both"){var f=this._get(b,"buttonText"),g=this._get(b,"buttonImage");b.trigger=$(this._get(b,"buttonImageOnly")?$("").addClass(this._triggerClass).attr({src:g,alt:f,title:f}):$("").addClass(this._triggerClass).html(g==""?f:$("").attr({src:g,alt:f,title:f}))),a[d?"before":"after"](b.trigger),b.trigger.click(function(){$.datepicker._datepickerShowing&&$.datepicker._lastInput==a[0]?$.datepicker._hideDatepicker():$.datepicker._showDatepicker(a[0]);return!1;});}},_autoSize:function(a){if(this._get(a,"autoSize")&&!a.inline){var b=new Date(2009,11,20),c=this._get(a,"dateFormat");if(c.match(/[DM]/)){var d=function(a){var b=0,c=0;for(var d=0;db&&(b=a[d].length,c=d);return c;};b.setMonth(d(this._get(a,c.match(/MM/)?"monthNames":"monthNamesShort"))),b.setDate(d(this._get(a,c.match(/DD/)?"dayNames":"dayNamesShort"))+20-b.getDay());}a.input.attr("size",this._formatDate(a,b).length);}},_inlineDatepicker:function(a,b){var c=$(a);c.hasClass(this.markerClassName)||(c.addClass(this.markerClassName).append(b.dpDiv).bind("setData.datepicker",function(a,c,d){b.settings[c]=d;}).bind("getData.datepicker",function(a,c){return this._get(b,c);}),$.data(a,PROP_NAME,b),this._setDate(b,this._getDefaultDate(b),!0),this._updateDatepicker(b),this._updateAlternate(b),b.settings.disabled&&this._disableDatepicker(a),b.dpDiv.css("display","block"));},_dialogDatepicker:function(a,b,c,d,e){var f=this._dialogInst;if(!f){this.uuid+=1;var g="dp"+this.uuid;this._dialogInput=$(""),this._dialogInput.keydown(this._doKeyDown),$("body").append(this._dialogInput),f=this._dialogInst=this._newInst(this._dialogInput,!1),f.settings={},$.data(this._dialogInput[0],PROP_NAME,f);}extendRemove(f.settings,d||{}),b=b&&b.constructor==Date?this._formatDate(f,b):b,this._dialogInput.val(b),this._pos=e?e.length?e:[e.pageX,e.pageY]:null;if(!this._pos){var h=document.documentElement.clientWidth,i=document.documentElement.clientHeight,j=document.documentElement.scrollLeft||document.body.scrollLeft,k=document.documentElement.scrollTop||document.body.scrollTop;this._pos=[h/2-100+j,i/2-150+k];}this._dialogInput.css("left",this._pos[0]+20+"px").css("top",this._pos[1]+"px"),f.settings.onSelect=c,this._inDialog=!0,this.dpDiv.addClass(this._dialogClass),this._showDatepicker(this._dialogInput[0]),$.blockUI&&$.blockUI(this.dpDiv),$.data(this._dialogInput[0],PROP_NAME,f);return this;},_destroyDatepicker:function(a){var b=$(a),c=$.data(a,PROP_NAME);if(b.hasClass(this.markerClassName)){var d=a.nodeName.toLowerCase();$.removeData(a,PROP_NAME),d=="input"?(c.append.remove(),c.trigger.remove(),b.removeClass(this.markerClassName).unbind("focus",this._showDatepicker).unbind("keydown",this._doKeyDown).unbind("keypress",this._doKeyPress).unbind("keyup",this._doKeyUp)):(d=="div"||d=="span")&&b.removeClass(this.markerClassName).empty();}},_enableDatepicker:function(a){var b=$(a),c=$.data(a,PROP_NAME);if(b.hasClass(this.markerClassName)){var d=a.nodeName.toLowerCase();if(d=="input")a.disabled=!1,c.trigger.filter("button").each(function(){this.disabled=!1;}).end().filter("img").css({opacity:"1.0",cursor:""});else if(d=="div"||d=="span"){var e=b.children("."+this._inlineClass);e.children().removeClass("ui-state-disabled"),e.find("select.ui-datepicker-month, select.ui-datepicker-year").removeAttr("disabled");}this._disabledInputs=$.map(this._disabledInputs,function(b){return b==a?null:b;});}},_disableDatepicker:function(a){var b=$(a),c=$.data(a,PROP_NAME);if(b.hasClass(this.markerClassName)){var d=a.nodeName.toLowerCase();if(d=="input")a.disabled=!0,c.trigger.filter("button").each(function(){this.disabled=!0;}).end().filter("img").css({opacity:"0.5",cursor:"default"});else if(d=="div"||d=="span"){var e=b.children("."+this._inlineClass);e.children().addClass("ui-state-disabled"),e.find("select.ui-datepicker-month, select.ui-datepicker-year").attr("disabled","disabled");}this._disabledInputs=$.map(this._disabledInputs,function(b){return b==a?null:b;}),this._disabledInputs[this._disabledInputs.length]=a;}},_isDisabledDatepicker:function(a){if(!a)return!1;for(var b=0;b-1;}},_doKeyUp:function(a){var b=$.datepicker._getInst(a.target);if(b.input.val()!=b.lastVal)try{var c=$.datepicker.parseDate($.datepicker._get(b,"dateFormat"),b.input?b.input.val():null,$.datepicker._getFormatConfig(b));c&&($.datepicker._setDateFromField(b),$.datepicker._updateAlternate(b),$.datepicker._updateDatepicker(b));}catch(a){$.datepicker.log(a);}return!0;},_showDatepicker:function(a){a=a.target||a,a.nodeName.toLowerCase()!="input"&&(a=$("input",a.parentNode)[0]);if(!$.datepicker._isDisabledDatepicker(a)&&$.datepicker._lastInput!=a){var b=$.datepicker._getInst(a);$.datepicker._curInst&&$.datepicker._curInst!=b&&($.datepicker._curInst.dpDiv.stop(!0,!0),b&&$.datepicker._datepickerShowing&&$.datepicker._hideDatepicker($.datepicker._curInst.input[0]));var c=$.datepicker._get(b,"beforeShow"),d=c?c.apply(a,[a,b]):{};if(d===!1)return;extendRemove(b.settings,d),b.lastVal=null,$.datepicker._lastInput=a,$.datepicker._setDateFromField(b),$.datepicker._inDialog&&(a.value=""),$.datepicker._pos||($.datepicker._pos=$.datepicker._findPos(a),$.datepicker._pos[1]+=a.offsetHeight);var e=!1;$(a).parents().each(function(){e|=$(this).css("position")=="fixed";return!e;}),e&&$.browser.opera&&($.datepicker._pos[0]-=document.documentElement.scrollLeft,$.datepicker._pos[1]-=document.documentElement.scrollTop);var f={left:$.datepicker._pos[0],top:$.datepicker._pos[1]};$.datepicker._pos=null,b.dpDiv.empty(),b.dpDiv.css({position:"absolute",display:"block",top:"-1000px"}),$.datepicker._updateDatepicker(b),f=$.datepicker._checkOffset(b,f,e),b.dpDiv.css({position:$.datepicker._inDialog&&$.blockUI?"static":e?"fixed":"absolute",display:"none",left:f.left+"px",top:f.top+"px"});if(!b.inline){var g=$.datepicker._get(b,"showAnim"),h=$.datepicker._get(b,"duration"),i=function(){var a=b.dpDiv.find("iframe.ui-datepicker-cover");if(a.length){var c=$.datepicker._getBorders(b.dpDiv);a.css({left:-c[0],top:-c[1],width:b.dpDiv.outerWidth(),height:b.dpDiv.outerHeight()});}};b.dpDiv.zIndex($(a).zIndex()+1),$.datepicker._datepickerShowing=!0,$.effects&&$.effects[g]?b.dpDiv.show(g,$.datepicker._get(b,"showOptions"),h,i):b.dpDiv[g||"show"](g?h:null,i),(!g||!h)&&i(),b.input.is(":visible")&&!b.input.is(":disabled")&&b.input.focus(),$.datepicker._curInst=b;}}},_updateDatepicker:function(a){var b=this;b.maxRows=4;var c=$.datepicker._getBorders(a.dpDiv);instActive=a,a.dpDiv.empty().append(this._generateHTML(a));var d=a.dpDiv.find("iframe.ui-datepicker-cover");!d.length||d.css({left:-c[0],top:-c[1],width:a.dpDiv.outerWidth(),height:a.dpDiv.outerHeight()}),a.dpDiv.find("."+this._dayOverClass+" a").mouseover();var e=this._getNumberOfMonths(a),f=e[1],g=17;a.dpDiv.removeClass("ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4").width(""),f>1&&a.dpDiv.addClass("ui-datepicker-multi-"+f).css("width",g*f+"em"),a.dpDiv[(e[0]!=1||e[1]!=1?"add":"remove")+"Class"]("ui-datepicker-multi"),a.dpDiv[(this._get(a,"isRTL")?"add":"remove")+"Class"]("ui-datepicker-rtl"),a==$.datepicker._curInst&&$.datepicker._datepickerShowing&&a.input&&a.input.is(":visible")&&!a.input.is(":disabled")&&a.input[0]!=document.activeElement&&a.input.focus();if(a.yearshtml){var h=a.yearshtml;setTimeout(function(){h===a.yearshtml&&a.yearshtml&&a.dpDiv.find("select.ui-datepicker-year:first").replaceWith(a.yearshtml),h=a.yearshtml=null;},0);}},_getBorders:function(a){var b=function(a){return{thin:1,medium:2,thick:3}[a]||a;};return[parseFloat(b(a.css("border-left-width"))),parseFloat(b(a.css("border-top-width")))];},_checkOffset:function(a,b,c){var d=a.dpDiv.outerWidth(),e=a.dpDiv.outerHeight(),f=a.input?a.input.outerWidth():0,g=a.input?a.input.outerHeight():0,h=document.documentElement.clientWidth+$(document).scrollLeft(),i=document.documentElement.clientHeight+$(document).scrollTop();b.left-=this._get(a,"isRTL")?d-f:0,b.left-=c&&b.left==a.input.offset().left?$(document).scrollLeft():0,b.top-=c&&b.top==a.input.offset().top+g?$(document).scrollTop():0,b.left-=Math.min(b.left,b.left+d>h&&h>d?Math.abs(b.left+d-h):0),b.top-=Math.min(b.top,b.top+e>i&&i>e?Math.abs(e+g):0);return b;},_findPos:function(a){var b=this._getInst(a),c=this._get(b,"isRTL");while(a&&(a.type=="hidden"||a.nodeType!=1||$.expr.filters.hidden(a)))a=a[c?"previousSibling":"nextSibling"];var d=$(a).offset();return[d.left,d.top];},_hideDatepicker:function(a){var b=this._curInst;if(!(!b||a&&b!=$.data(a,PROP_NAME))&&this._datepickerShowing){var c=this._get(b,"showAnim"),d=this._get(b,"duration"),e=this,f=function(){$.datepicker._tidyDialog(b),e._curInst=null;};$.effects&&$.effects[c]?b.dpDiv.hide(c,$.datepicker._get(b,"showOptions"),d,f):b.dpDiv[c=="slideDown"?"slideUp":c=="fadeIn"?"fadeOut":"hide"](c?d:null,f),c||f(),this._datepickerShowing=!1;var g=this._get(b,"onClose");g&&g.apply(b.input?b.input[0]:null,[b.input?b.input.val():"",b]),this._lastInput=null,this._inDialog&&(this._dialogInput.css({position:"absolute",left:"0",top:"-100px"}),$.blockUI&&($.unblockUI(),$("body").append(this.dpDiv))),this._inDialog=!1;}},_tidyDialog:function(a){a.dpDiv.removeClass(this._dialogClass).unbind(".ui-datepicker-calendar");},_checkExternalClick:function(a){if($.datepicker._curInst){var b=$(a.target),c=$.datepicker._getInst(b[0]);(b[0].id!=$.datepicker._mainDivId&&b.parents("#"+$.datepicker._mainDivId).length==0&&!b.hasClass($.datepicker.markerClassName)&&!b.hasClass($.datepicker._triggerClass)&&$.datepicker._datepickerShowing&&(!$.datepicker._inDialog||!$.blockUI)||b.hasClass($.datepicker.markerClassName)&&$.datepicker._curInst!=c)&&$.datepicker._hideDatepicker();}},_adjustDate:function(a,b,c){var d=$(a),e=this._getInst(d[0]);this._isDisabledDatepicker(d[0])||(this._adjustInstDate(e,b+(c=="M"?this._get(e,"showCurrentAtPos"):0),c),this._updateDatepicker(e));},_gotoToday:function(a){var b=$(a),c=this._getInst(b[0]);if(this._get(c,"gotoCurrent")&&c.currentDay)c.selectedDay=c.currentDay,c.drawMonth=c.selectedMonth=c.currentMonth,c.drawYear=c.selectedYear=c.currentYear;else{var d=new Date;c.selectedDay=d.getDate(),c.drawMonth=c.selectedMonth=d.getMonth(),c.drawYear=c.selectedYear=d.getFullYear();}this._notifyChange(c),this._adjustDate(b);},_selectMonthYear:function(a,b,c){var d=$(a),e=this._getInst(d[0]);e["selected"+(c=="M"?"Month":"Year")]=e["draw"+(c=="M"?"Month":"Year")]=parseInt(b.options[b.selectedIndex].value,10),this._notifyChange(e),this._adjustDate(d);},_selectDay:function(a,b,c,d){var e=$(a);if(!$(d).hasClass(this._unselectableClass)&&!this._isDisabledDatepicker(e[0])){var f=this._getInst(e[0]);f.selectedDay=f.currentDay=$("a",d).html(),f.selectedMonth=f.currentMonth=b,f.selectedYear=f.currentYear=c,this._selectDate(a,this._formatDate(f,f.currentDay,f.currentMonth,f.currentYear));}},_clearDate:function(a){var b=$(a),c=this._getInst(b[0]);this._selectDate(b,"");},_selectDate:function(a,b){var c=$(a),d=this._getInst(c[0]);b=b!=null?b:this._formatDate(d),d.input&&d.input.val(b),this._updateAlternate(d);var e=this._get(d,"onSelect");e?e.apply(d.input?d.input[0]:null,[b,d]):d.input&&d.input.trigger("change"),d.inline?this._updateDatepicker(d):(this._hideDatepicker(),this._lastInput=d.input[0],typeof d.input[0]!="object"&&d.input.focus(),this._lastInput=null);},_updateAlternate:function(a){var b=this._get(a,"altField");if(b){var c=this._get(a,"altFormat")||this._get(a,"dateFormat"),d=this._getDate(a),e=this.formatDate(c,d,this._getFormatConfig(a));$(b).each(function(){$(this).val(e);});}},noWeekends:function(a){var b=a.getDay();return[b>0&&b<6,""];},iso8601Week:function(a){var b=new Date(a.getTime());b.setDate(b.getDate()+4-(b.getDay()||7));var c=b.getTime();b.setMonth(0),b.setDate(1);return Math.floor(Math.round((c-b)/864e5)/7)+1;},parseDate:function(a,b,c){if(a==null||b==null)throw"Invalid arguments";b=typeof b=="object"?b.toString():b+"";if(b=="")return null;var d=(c?c.shortYearCutoff:null)||this._defaults.shortYearCutoff;d=typeof d!="string"?d:(new Date).getFullYear()%100+parseInt(d,10);var e=(c?c.dayNamesShort:null)||this._defaults.dayNamesShort,f=(c?c.dayNames:null)||this._defaults.dayNames,g=(c?c.monthNamesShort:null)||this._defaults.monthNamesShort,h=(c?c.monthNames:null)||this._defaults.monthNames,i=-1,j=-1,k=-1,l=-1,m=!1,n=function(b){var c=s+1-1){j=1,k=l;for(;;){var u=this._getDaysInMonth(i,j-1);if(k<=u)break;j++,k-=u;}}var t=this._daylightSavingAdjust(new Date(i,j-1,k));if(t.getFullYear()!=i||t.getMonth()+1!=j||t.getDate()!=k)throw"Invalid date";return t;},ATOM:"yy-mm-dd",COOKIE:"D, dd M yy",ISO_8601:"yy-mm-dd",RFC_822:"D, d M y",RFC_850:"DD, dd-M-y",RFC_1036:"D, d M y",RFC_1123:"D, d M yy",RFC_2822:"D, d M yy",RSS:"D, d M y",TICKS:"!",TIMESTAMP:"@",W3C:"yy-mm-dd",_ticksTo1970:(718685+Math.floor(492.5)-Math.floor(19.7)+Math.floor(4.925))*24*60*60*1e7,formatDate:function(a,b,c){if(!b)return"";var d=(c?c.dayNamesShort:null)||this._defaults.dayNamesShort,e=(c?c.dayNames:null)||this._defaults.dayNames,f=(c?c.monthNamesShort:null)||this._defaults.monthNamesShort,g=(c?c.monthNames:null)||this._defaults.monthNames,h=function(b){var c=m+112?a.getHours()+2:0);return a;},_setDate:function(a,b,c){var d=!b,e=a.selectedMonth,f=a.selectedYear,g=this._restrictMinMax(a,this._determineDate(a,b,new Date));a.selectedDay=a.currentDay=g.getDate(),a.drawMonth=a.selectedMonth=a.currentMonth=g.getMonth(),a.drawYear=a.selectedYear=a.currentYear=g.getFullYear(),(e!=a.selectedMonth||f!=a.selectedYear)&&!c&&this._notifyChange(a),this._adjustInstDate(a),a.input&&a.input.val(d?"":this._formatDate(a));},_getDate:function(a){var b=!a.currentYear||a.input&&a.input.val()==""?null:this._daylightSavingAdjust(new Date(a.currentYear,a.currentMonth,a.currentDay));return b;},_generateHTML:function(a){var b=new Date;b=this._daylightSavingAdjust(new Date(b.getFullYear(),b.getMonth(),b.getDate()));var c=this._get(a,"isRTL"),d=this._get(a,"showButtonPanel"),e=this._get(a,"hideIfNoPrevNext"),f=this._get(a,"navigationAsDateFormat"),g=this._getNumberOfMonths(a),h=this._get(a,"showCurrentAtPos"),i=this._get(a,"stepMonths"),j=g[0]!=1||g[1]!=1,k=this._daylightSavingAdjust(a.currentDay?new Date(a.currentYear,a.currentMonth,a.currentDay):new Date(9999,9,9)),l=this._getMinMaxDate(a,"min"),m=this._getMinMaxDate(a,"max"),n=a.drawMonth-h,o=a.drawYear;n<0&&(n+=12,o--);if(m){var p=this._daylightSavingAdjust(new Date(m.getFullYear(),m.getMonth()-g[0]*g[1]+1,m.getDate()));p=l&&pp)n--,n<0&&(n=11,o--);}a.drawMonth=n,a.drawYear=o;var q=this._get(a,"prevText");q=f?this.formatDate(q,this._daylightSavingAdjust(new Date(o,n-i,1)),this._getFormatConfig(a)):q;var r=this._canAdjustMonth(a,-1,o,n)?""+q+"":e?"":""+q+"",s=this._get(a,"nextText");s=f?this.formatDate(s,this._daylightSavingAdjust(new Date(o,n+i,1)),this._getFormatConfig(a)):s;var t=this._canAdjustMonth(a,1,o,n)?""+s+"":e?"":""+s+"",u=this._get(a,"currentText"),v=this._get(a,"gotoCurrent")&&a.currentDay?k:b;u=f?this.formatDate(u,v,this._getFormatConfig(a)):u;var w=a.inline?"":"",x=d?"
    "+(c?w:"")+(this._isInRange(a,v)?"":"")+(c?"":w)+"
    ":"",y=parseInt(this._get(a,"firstDay"),10);y=isNaN(y)?0:y;var z=this._get(a,"showWeek"),A=this._get(a,"dayNames"),B=this._get(a,"dayNamesShort"),C=this._get(a,"dayNamesMin"),D=this._get(a,"monthNames"),E=this._get(a,"monthNamesShort"),F=this._get(a,"beforeShowDay"),G=this._get(a,"showOtherMonths"),H=this._get(a,"selectOtherMonths"),I=this._get(a,"calculateWeek")||this.iso8601Week,J=this._getDefaultDate(a),K="";for(var L=0;L1)switch(N){case 0:Q+=" ui-datepicker-group-first",P=" ui-corner-"+(c?"right":"left");break;case g[1]-1:Q+=" ui-datepicker-group-last",P=" ui-corner-"+(c?"left":"right");break;default:Q+=" ui-datepicker-group-middle",P="";}Q+="\">";}Q+="
    "+(/all|left/.test(P)&&L==0?c?t:r:"")+(/all|right/.test(P)&&L==0?c?r:t:"")+this._generateMonthYearHeader(a,n,o,l,m,L>0||N>0,D,E)+"
    "+"";var R=z?"":"";for(var S=0;S<7;S++){var T=(S+y)%7;R+="=5?" class=\"ui-datepicker-week-end\"":"")+">"+""+C[T]+"";}Q+=R+"";var U=this._getDaysInMonth(o,n);o==a.selectedYear&&n==a.selectedMonth&&(a.selectedDay=Math.min(a.selectedDay,U));var V=(this._getFirstDayOfMonth(o,n)-y+7)%7,W=Math.ceil((V+U)/7),X=j?this.maxRows>W?this.maxRows:W:W;this.maxRows=X;var Y=this._daylightSavingAdjust(new Date(o,n,1-V));for(var Z=0;Z";var _=z?"":"";for(var S=0;S<7;S++){var ba=F?F.apply(a.input?a.input[0]:null,[Y]):[!0,""],bb=Y.getMonth()!=n,bc=bb&&!H||!ba[0]||l&&Ym;_+="",Y.setDate(Y.getDate()+1),Y=this._daylightSavingAdjust(Y);}Q+=_+"";}n++,n>11&&(n=0,o++),Q+="
    "+this._get(a,"weekHeader")+"
    "+this._get(a,"calculateWeek")(Y)+"=5?" ui-datepicker-week-end":"")+(bb?" ui-datepicker-other-month":"")+(Y.getTime()==O.getTime()&&n==a.selectedMonth&&a._keyEvent||J.getTime()==Y.getTime()&&J.getTime()==O.getTime()?" "+this._dayOverClass:"")+(bc?" "+this._unselectableClass+" ui-state-disabled":"")+(bb&&!G?"":" "+ba[1]+(Y.getTime()==k.getTime()?" "+this._currentClass:"")+(Y.getTime()==b.getTime()?" ui-datepicker-today":""))+"\""+((!bb||G)&&ba[2]?" title=\""+ba[2]+"\"":"")+(bc?"":" onclick=\"DP_jQuery_"+dpuuid+".datepicker._selectDay('#"+a.id+"',"+Y.getMonth()+","+Y.getFullYear()+", this);return false;\"")+">"+(bb&&!G?" ":bc?""+Y.getDate()+"":""+Y.getDate()+"")+"
    "+(j?""+(g[0]>0&&N==g[1]-1?"
    ":""):""),M+=Q;}K+=M;}K+=x+($.browser.msie&&parseInt($.browser.version,10)<7&&!a.inline?"":""),a._keyEvent=!1;return K;},_generateMonthYearHeader:function(a,b,c,d,e,f,g,h){var i=this._get(a,"changeMonth"),j=this._get(a,"changeYear"),k=this + ._get(a,"showMonthAfterYear"),l="
    ",m="";if(f||!i)m+=""+g[b]+"";else{var n=d&&d.getFullYear()==c,o=e&&e.getFullYear()==c;m+="";}k||(l+=m+(f||!i||!j?" ":""));if(!a.yearshtml){a.yearshtml="";if(f||!j)l+=""+c+"";else{var q=this._get(a,"yearRange").split(":"),r=(new Date).getFullYear(),s=function(a){var b=a.match(/c[+-].*/)?c+parseInt(a.substring(1),10):a.match(/[+-].*/)?r+parseInt(a,10):parseInt(a,10);return isNaN(b)?r:b;},t=s(q[0]),u=Math.max(t,s(q[1]||""));t=d?Math.max(t,d.getFullYear()):t,u=e?Math.min(u,e.getFullYear()):u,a.yearshtml+="",l+=a.yearshtml,a.yearshtml=null;}}l+=this._get(a,"yearSuffix"),k&&(l+=(f||!i||!j?" ":"")+m),l+="
    ";return l;},_adjustInstDate:function(a,b,c){var d=a.drawYear+(c=="Y"?b:0),e=a.drawMonth+(c=="M"?b:0),f=Math.min(a.selectedDay,this._getDaysInMonth(d,e))+(c=="D"?b:0),g=this._restrictMinMax(a,this._daylightSavingAdjust(new Date(d,e,f)));a.selectedDay=g.getDate(),a.drawMonth=a.selectedMonth=g.getMonth(),a.drawYear=a.selectedYear=g.getFullYear(),(c=="M"||c=="Y")&&this._notifyChange(a);},_restrictMinMax:function(a,b){var c=this._getMinMaxDate(a,"min"),d=this._getMinMaxDate(a,"max"),e=c&&bd?d:e;return e;},_notifyChange:function(a){var b=this._get(a,"onChangeMonthYear");b&&b.apply(a.input?a.input[0]:null,[a.selectedYear,a.selectedMonth+1,a]);},_getNumberOfMonths:function(a){var b=this._get(a,"numberOfMonths");return b==null?[1,1]:typeof b=="number"?[1,b]:b;},_getMinMaxDate:function(a,b){return this._determineDate(a,this._get(a,b+"Date"),null);},_getDaysInMonth:function(a,b){return 32-this._daylightSavingAdjust(new Date(a,b,32)).getDate();},_getFirstDayOfMonth:function(a,b){return(new Date(a,b,1)).getDay();},_canAdjustMonth:function(a,b,c,d){var e=this._getNumberOfMonths(a),f=this._daylightSavingAdjust(new Date(c,d+(b<0?b:e[0]*e[1]),1));b<0&&f.setDate(this._getDaysInMonth(f.getFullYear(),f.getMonth()));return this._isInRange(a,f);},_isInRange:function(a,b){var c=this._getMinMaxDate(a,"min"),d=this._getMinMaxDate(a,"max");return(!c||b.getTime()>=c.getTime())&&(!d||b.getTime()<=d.getTime());},_getFormatConfig:function(a){var b=this._get(a,"shortYearCutoff");b=typeof b!="string"?b:(new Date).getFullYear()%100+parseInt(b,10);return{shortYearCutoff:b,dayNamesShort:this._get(a,"dayNamesShort"),dayNames:this._get(a,"dayNames"),monthNamesShort:this._get(a,"monthNamesShort"),monthNames:this._get(a,"monthNames")};},_formatDate:function(a,b,c,d){b||(a.currentDay=a.selectedDay,a.currentMonth=a.selectedMonth,a.currentYear=a.selectedYear);var e=b?typeof b=="object"?b:this._daylightSavingAdjust(new Date(d,c,b)):this._daylightSavingAdjust(new Date(a.currentYear,a.currentMonth,a.currentDay));return this.formatDate(this._get(a,"dateFormat"),e,this._getFormatConfig(a));}}),$.fn.datepicker=function(a){if(!this.length)return this;$.datepicker.initialized||($(document).mousedown($.datepicker._checkExternalClick).find("body").append($.datepicker.dpDiv),$.datepicker.initialized=!0);var b=Array.prototype.slice.call(arguments,1);if(typeof a=="string"&&(a=="isDisabled"||a=="getDate"||a=="widget"))return $.datepicker["_"+a+"Datepicker"].apply($.datepicker,[this[0]].concat(b));if(a=="option"&&arguments.length==2&&typeof arguments[1]=="string")return $.datepicker["_"+a+"Datepicker"].apply($.datepicker,[this[0]].concat(b));return this.each(function(){typeof a=="string"?$.datepicker["_"+a+"Datepicker"].apply($.datepicker,[this].concat(b)):$.datepicker._attachDatepicker(this,a);});},$.datepicker=new Datepicker,$.datepicker.initialized=!1,$.datepicker.uuid=(new Date).getTime(),$.datepicker.version="1.8.17",window["DP_jQuery_"+dpuuid]=$;})(jQuery);/* * jQuery UI Progressbar 1.8.17 * * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) @@ -136,7 +136,7 @@ * Depends: * jquery.ui.core.js * jquery.ui.widget.js - */(function(a,b){a.widget("ui.progressbar",{options:{value:0,max:100},min:0,_create:function(){this.element.addClass("ui-progressbar ui-widget ui-widget-content ui-corner-all").attr({role:"progressbar","aria-valuemin":this.min,"aria-valuemax":this.options.max,"aria-valuenow":this._value()}),this.valueDiv=a("
    ").appendTo(this.element),this.oldValue=this._value(),this._refreshValue()},destroy:function(){this.element.removeClass("ui-progressbar ui-widget ui-widget-content ui-corner-all").removeAttr("role").removeAttr("aria-valuemin").removeAttr("aria-valuemax").removeAttr("aria-valuenow"),this.valueDiv.remove(),a.Widget.prototype.destroy.apply(this,arguments)},value:function(a){if(a===b)return this._value();this._setOption("value",a);return this},_setOption:function(b,c){b==="value"&&(this.options.value=c,this._refreshValue(),this._value()===this.options.max&&this._trigger("complete")),a.Widget.prototype._setOption.apply(this,arguments)},_value:function(){var a=this.options.value;typeof a!="number"&&(a=0);return Math.min(this.options.max,Math.max(this.min,a))},_percentage:function(){return 100*this._value()/this.options.max},_refreshValue:function(){var a=this.value(),b=this._percentage();this.oldValue!==a&&(this.oldValue=a,this._trigger("change")),this.valueDiv.toggle(a>this.min).toggleClass("ui-corner-right",a===this.options.max).width(b.toFixed(0)+"%"),this.element.attr("aria-valuenow",a)}}),a.extend(a.ui.progressbar,{version:"1.8.17"})})(jQuery);/* + */(function(a,b){a.widget("ui.progressbar",{options:{value:0,max:100},min:0,_create:function(){this.element.addClass("ui-progressbar ui-widget ui-widget-content ui-corner-all").attr({role:"progressbar","aria-valuemin":this.min,"aria-valuemax":this.options.max,"aria-valuenow":this._value()}),this.valueDiv=a("
    ").appendTo(this.element),this.oldValue=this._value(),this._refreshValue();},destroy:function(){this.element.removeClass("ui-progressbar ui-widget ui-widget-content ui-corner-all").removeAttr("role").removeAttr("aria-valuemin").removeAttr("aria-valuemax").removeAttr("aria-valuenow"),this.valueDiv.remove(),a.Widget.prototype.destroy.apply(this,arguments);},value:function(a){if(a===b)return this._value();this._setOption("value",a);return this;},_setOption:function(b,c){b==="value"&&(this.options.value=c,this._refreshValue(),this._value()===this.options.max&&this._trigger("complete")),a.Widget.prototype._setOption.apply(this,arguments);},_value:function(){var a=this.options.value;typeof a!="number"&&(a=0);return Math.min(this.options.max,Math.max(this.min,a));},_percentage:function(){return 100*this._value()/this.options.max;},_refreshValue:function(){var a=this.value(),b=this._percentage();this.oldValue!==a&&(this.oldValue=a,this._trigger("change")),this.valueDiv.toggle(a>this.min).toggleClass("ui-corner-right",a===this.options.max).width(b.toFixed(0)+"%"),this.element.attr("aria-valuenow",a);}}),a.extend(a.ui.progressbar,{version:"1.8.17"});})(jQuery);/* * jQuery UI Effects 1.8.17 * * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) @@ -144,7 +144,7 @@ * http://jquery.org/license * * http://docs.jquery.com/UI/Effects/ - */jQuery.effects||function(a,b){function l(b){if(!b||typeof b=="number"||a.fx.speeds[b])return!0;if(typeof b=="string"&&!a.effects[b])return!0;return!1}function k(b,c,d,e){typeof b=="object"&&(e=c,d=null,c=b,b=c.effect),a.isFunction(c)&&(e=c,d=null,c={});if(typeof c=="number"||a.fx.speeds[c])e=d,d=c,c={};a.isFunction(d)&&(e=d,d=null),c=c||{},d=d||c.duration,d=a.fx.off?0:typeof d=="number"?d:d in a.fx.speeds?a.fx.speeds[d]:a.fx.speeds._default,e=e||c.complete;return[b,c,d,e]}function j(a,b){var c={_:0},d;for(d in b)a[d]!=b[d]&&(c[d]=b[d]);return c}function i(b){var c,d;for(c in b)d=b[c],(d==null||a.isFunction(d)||c in g||/scrollbar/.test(c)||!/color/i.test(c)&&isNaN(parseFloat(d)))&&delete b[c];return b}function h(){var a=document.defaultView?document.defaultView.getComputedStyle(this,null):this.currentStyle,b={},c,d;if(a&&a.length&&a[0]&&a[a[0]]){var e=a.length;while(e--)c=a[e],typeof a[c]=="string"&&(d=c.replace(/\-(\w)/g,function(a,b){return b.toUpperCase()}),b[d]=a[c])}else for(c in a)typeof a[c]=="string"&&(b[c]=a[c]);return b}function d(b,d){var e;do{e=a.curCSS(b,d);if(e!=""&&e!="transparent"||a.nodeName(b,"body"))break;d="backgroundColor"}while(b=b.parentNode);return c(e)}function c(b){var c;if(b&&b.constructor==Array&&b.length==3)return b;if(c=/rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(b))return[parseInt(c[1],10),parseInt(c[2],10),parseInt(c[3],10)];if(c=/rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(b))return[parseFloat(c[1])*2.55,parseFloat(c[2])*2.55,parseFloat(c[3])*2.55];if(c=/#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(b))return[parseInt(c[1],16),parseInt(c[2],16),parseInt(c[3],16)];if(c=/#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(b))return[parseInt(c[1]+c[1],16),parseInt(c[2]+c[2],16),parseInt(c[3]+c[3],16)];if(c=/rgba\(0, 0, 0, 0\)/.exec(b))return e.transparent;return e[a.trim(b).toLowerCase()]}a.effects={},a.each(["backgroundColor","borderBottomColor","borderLeftColor","borderRightColor","borderTopColor","borderColor","color","outlineColor"],function(b,e){a.fx.step[e]=function(a){a.colorInit||(a.start=d(a.elem,e),a.end=c(a.end),a.colorInit=!0),a.elem.style[e]="rgb("+Math.max(Math.min(parseInt(a.pos*(a.end[0]-a.start[0])+a.start[0],10),255),0)+","+Math.max(Math.min(parseInt(a.pos*(a.end[1]-a.start[1])+a.start[1],10),255),0)+","+Math.max(Math.min(parseInt(a.pos*(a.end[2]-a.start[2])+a.start[2],10),255),0)+")"}});var e={aqua:[0,255,255],azure:[240,255,255],beige:[245,245,220],black:[0,0,0],blue:[0,0,255],brown:[165,42,42],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgrey:[169,169,169],darkgreen:[0,100,0],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkviolet:[148,0,211],fuchsia:[255,0,255],gold:[255,215,0],green:[0,128,0],indigo:[75,0,130],khaki:[240,230,140],lightblue:[173,216,230],lightcyan:[224,255,255],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightyellow:[255,255,224],lime:[0,255,0],magenta:[255,0,255],maroon:[128,0,0],navy:[0,0,128],olive:[128,128,0],orange:[255,165,0],pink:[255,192,203],purple:[128,0,128],violet:[128,0,128],red:[255,0,0],silver:[192,192,192],white:[255,255,255],yellow:[255,255,0],transparent:[255,255,255]},f=["add","remove","toggle"],g={border:1,borderBottom:1,borderColor:1,borderLeft:1,borderRight:1,borderTop:1,borderWidth:1,margin:1,padding:1};a.effects.animateClass=function(b,c,d,e){a.isFunction(d)&&(e=d,d=null);return this.queue(function(){var g=a(this),k=g.attr("style")||" ",l=i(h.call(this)),m,n=g.attr("class");a.each(f,function(a,c){b[c]&&g[c+"Class"](b[c])}),m=i(h.call(this)),g.attr("class",n),g.animate(j(l,m),{queue:!1,duration:c,easing:d,complete:function(){a.each(f,function(a,c){b[c]&&g[c+"Class"](b[c])}),typeof g.attr("style")=="object"?(g.attr("style").cssText="",g.attr("style").cssText=k):g.attr("style",k),e&&e.apply(this,arguments),a.dequeue(this)}})})},a.fn.extend({_addClass:a.fn.addClass,addClass:function(b,c,d,e){return c?a.effects.animateClass.apply(this,[{add:b},c,d,e]):this._addClass(b)},_removeClass:a.fn.removeClass,removeClass:function(b,c,d,e){return c?a.effects.animateClass.apply(this,[{remove:b},c,d,e]):this._removeClass(b)},_toggleClass:a.fn.toggleClass,toggleClass:function(c,d,e,f,g){return typeof d=="boolean"||d===b?e?a.effects.animateClass.apply(this,[d?{add:c}:{remove:c},e,f,g]):this._toggleClass(c,d):a.effects.animateClass.apply(this,[{toggle:c},d,e,f])},switchClass:function(b,c,d,e,f){return a.effects.animateClass.apply(this,[{add:c,remove:b},d,e,f])}}),a.extend(a.effects,{version:"1.8.17",save:function(a,b){for(var c=0;c").addClass("ui-effects-wrapper").css({fontSize:"100%",background:"transparent",border:"none",margin:0,padding:0}),e=document.activeElement;b.wrap(d),(b[0]===e||a.contains(b[0],e))&&a(e).focus(),d=b.parent(),b.css("position")=="static"?(d.css({position:"relative"}),b.css({position:"relative"})):(a.extend(c,{position:b.css("position"),zIndex:b.css("z-index")}),a.each(["top","left","bottom","right"],function(a,d){c[d]=b.css(d),isNaN(parseInt(c[d],10))&&(c[d]="auto")}),b.css({position:"relative",top:0,left:0,right:"auto",bottom:"auto"}));return d.css(c).show()},removeWrapper:function(b){var c,d=document.activeElement;if(b.parent().is(".ui-effects-wrapper")){c=b.parent().replaceWith(b),(b[0]===d||a.contains(b[0],d))&&a(d).focus();return c}return b},setTransition:function(b,c,d,e){e=e||{},a.each(c,function(a,c){unit=b.cssUnit(c),unit[0]>0&&(e[c]=unit[0]*d+unit[1])});return e}}),a.fn.extend({effect:function(b,c,d,e){var f=k.apply(this,arguments),g={options:f[1],duration:f[2],callback:f[3]},h=g.options.mode,i=a.effects[b];if(a.fx.off||!i)return h?this[h](g.duration,g.callback):this.each(function(){g.callback&&g.callback.call(this)});return i.call(this,g)},_show:a.fn.show,show:function(a){if(l(a))return this._show.apply(this,arguments);var b=k.apply(this,arguments);b[1].mode="show";return this.effect.apply(this,b)},_hide:a.fn.hide,hide:function(a){if(l(a))return this._hide.apply(this,arguments);var b=k.apply(this,arguments);b[1].mode="hide";return this.effect.apply(this,b)},__toggle:a.fn.toggle,toggle:function(b){if(l(b)||typeof b=="boolean"||a.isFunction(b))return this.__toggle.apply(this,arguments);var c=k.apply(this,arguments);c[1].mode="toggle";return this.effect.apply(this,c)},cssUnit:function(b){var c=this.css(b),d=[];a.each(["em","px","%","pt"],function(a,b){c.indexOf(b)>0&&(d=[parseFloat(c),b])});return d}}),a.easing.jswing=a.easing.swing,a.extend(a.easing,{def:"easeOutQuad",swing:function(b,c,d,e,f){return a.easing[a.easing.def](b,c,d,e,f)},easeInQuad:function(a,b,c,d,e){return d*(b/=e)*b+c},easeOutQuad:function(a,b,c,d,e){return-d*(b/=e)*(b-2)+c},easeInOutQuad:function(a,b,c,d,e){if((b/=e/2)<1)return d/2*b*b+c;return-d/2*(--b*(b-2)-1)+c},easeInCubic:function(a,b,c,d,e){return d*(b/=e)*b*b+c},easeOutCubic:function(a,b,c,d,e){return d*((b=b/e-1)*b*b+1)+c},easeInOutCubic:function(a,b,c,d,e){if((b/=e/2)<1)return d/2*b*b*b+c;return d/2*((b-=2)*b*b+2)+c},easeInQuart:function(a,b,c,d,e){return d*(b/=e)*b*b*b+c},easeOutQuart:function(a,b,c,d,e){return-d*((b=b/e-1)*b*b*b-1)+c},easeInOutQuart:function(a,b,c,d,e){if((b/=e/2)<1)return d/2*b*b*b*b+c;return-d/2*((b-=2)*b*b*b-2)+c},easeInQuint:function(a,b,c,d,e){return d*(b/=e)*b*b*b*b+c},easeOutQuint:function(a,b,c,d,e){return d*((b=b/e-1)*b*b*b*b+1)+c},easeInOutQuint:function(a,b,c,d,e){if((b/=e/2)<1)return d/2*b*b*b*b*b+c;return d/2*((b-=2)*b*b*b*b+2)+c},easeInSine:function(a,b,c,d,e){return-d*Math.cos(b/e*(Math.PI/2))+d+c},easeOutSine:function(a,b,c,d,e){return d*Math.sin(b/e*(Math.PI/2))+c},easeInOutSine:function(a,b,c,d,e){return-d/2*(Math.cos(Math.PI*b/e)-1)+c},easeInExpo:function(a,b,c,d,e){return b==0?c:d*Math.pow(2,10*(b/e-1))+c},easeOutExpo:function(a,b,c,d,e){return b==e?c+d:d*(-Math.pow(2,-10*b/e)+1)+c},easeInOutExpo:function(a,b,c,d,e){if(b==0)return c;if(b==e)return c+d;if((b/=e/2)<1)return d/2*Math.pow(2,10*(b-1))+c;return d/2*(-Math.pow(2,-10*--b)+2)+c},easeInCirc:function(a,b,c,d,e){return-d*(Math.sqrt(1-(b/=e)*b)-1)+c},easeOutCirc:function(a,b,c,d,e){return d*Math.sqrt(1-(b=b/e-1)*b)+c},easeInOutCirc:function(a,b,c,d,e){if((b/=e/2)<1)return-d/2*(Math.sqrt(1-b*b)-1)+c;return d/2*(Math.sqrt(1-(b-=2)*b)+1)+c},easeInElastic:function(a,b,c,d,e){var f=1.70158,g=0,h=d;if(b==0)return c;if((b/=e)==1)return c+d;g||(g=e*.3);if(h").addClass("ui-effects-wrapper").css({fontSize:"100%",background:"transparent",border:"none",margin:0,padding:0}),e=document.activeElement;b.wrap(d),(b[0]===e||a.contains(b[0],e))&&a(e).focus(),d=b.parent(),b.css("position")=="static"?(d.css({position:"relative"}),b.css({position:"relative"})):(a.extend(c,{position:b.css("position"),zIndex:b.css("z-index")}),a.each(["top","left","bottom","right"],function(a,d){c[d]=b.css(d),isNaN(parseInt(c[d],10))&&(c[d]="auto");}),b.css({position:"relative",top:0,left:0,right:"auto",bottom:"auto"}));return d.css(c).show();},removeWrapper:function(b){var c,d=document.activeElement;if(b.parent().is(".ui-effects-wrapper")){c=b.parent().replaceWith(b),(b[0]===d||a.contains(b[0],d))&&a(d).focus();return c;}return b;},setTransition:function(b,c,d,e){e=e||{},a.each(c,function(a,c){unit=b.cssUnit(c),unit[0]>0&&(e[c]=unit[0]*d+unit[1]);});return e;}}),a.fn.extend({effect:function(b,c,d,e){var f=k.apply(this,arguments),g={options:f[1],duration:f[2],callback:f[3]},h=g.options.mode,i=a.effects[b];if(a.fx.off||!i)return h?this[h](g.duration,g.callback):this.each(function(){g.callback&&g.callback.call(this);});return i.call(this,g);},_show:a.fn.show,show:function(a){if(l(a))return this._show.apply(this,arguments);var b=k.apply(this,arguments);b[1].mode="show";return this.effect.apply(this,b);},_hide:a.fn.hide,hide:function(a){if(l(a))return this._hide.apply(this,arguments);var b=k.apply(this,arguments);b[1].mode="hide";return this.effect.apply(this,b);},__toggle:a.fn.toggle,toggle:function(b){if(l(b)||typeof b=="boolean"||a.isFunction(b))return this.__toggle.apply(this,arguments);var c=k.apply(this,arguments);c[1].mode="toggle";return this.effect.apply(this,c);},cssUnit:function(b){var c=this.css(b),d=[];a.each(["em","px","%","pt"],function(a,b){c.indexOf(b)>0&&(d=[parseFloat(c),b]);});return d;}}),a.easing.jswing=a.easing.swing,a.extend(a.easing,{def:"easeOutQuad",swing:function(b,c,d,e,f){return a.easing[a.easing.def](b,c,d,e,f);},easeInQuad:function(a,b,c,d,e){return d*(b/=e)*b+c;},easeOutQuad:function(a,b,c,d,e){return-d*(b/=e)*(b-2)+c;},easeInOutQuad:function(a,b,c,d,e){if((b/=e/2)<1)return d/2*b*b+c;return-d/2*(--b*(b-2)-1)+c;},easeInCubic:function(a,b,c,d,e){return d*(b/=e)*b*b+c;},easeOutCubic:function(a,b,c,d,e){return d*((b=b/e-1)*b*b+1)+c;},easeInOutCubic:function(a,b,c,d,e){if((b/=e/2)<1)return d/2*b*b*b+c;return d/2*((b-=2)*b*b+2)+c;},easeInQuart:function(a,b,c,d,e){return d*(b/=e)*b*b*b+c;},easeOutQuart:function(a,b,c,d,e){return-d*((b=b/e-1)*b*b*b-1)+c;},easeInOutQuart:function(a,b,c,d,e){if((b/=e/2)<1)return d/2*b*b*b*b+c;return-d/2*((b-=2)*b*b*b-2)+c;},easeInQuint:function(a,b,c,d,e){return d*(b/=e)*b*b*b*b+c;},easeOutQuint:function(a,b,c,d,e){return d*((b=b/e-1)*b*b*b*b+1)+c;},easeInOutQuint:function(a,b,c,d,e){if((b/=e/2)<1)return d/2*b*b*b*b*b+c;return d/2*((b-=2)*b*b*b*b+2)+c;},easeInSine:function(a,b,c,d,e){return-d*Math.cos(b/e*(Math.PI/2))+d+c;},easeOutSine:function(a,b,c,d,e){return d*Math.sin(b/e*(Math.PI/2))+c;},easeInOutSine:function(a,b,c,d,e){return-d/2*(Math.cos(Math.PI*b/e)-1)+c;},easeInExpo:function(a,b,c,d,e){return b==0?c:d*Math.pow(2,10*(b/e-1))+c;},easeOutExpo:function(a,b,c,d,e){return b==e?c+d:d*(-Math.pow(2,-10*b/e)+1)+c;},easeInOutExpo:function(a,b,c,d,e){if(b==0)return c;if(b==e)return c+d;if((b/=e/2)<1)return d/2*Math.pow(2,10*(b-1))+c;return d/2*(-Math.pow(2,-10*--b)+2)+c;},easeInCirc:function(a,b,c,d,e){return-d*(Math.sqrt(1-(b/=e)*b)-1)+c;},easeOutCirc:function(a,b,c,d,e){return d*Math.sqrt(1-(b=b/e-1)*b)+c;},easeInOutCirc:function(a,b,c,d,e){if((b/=e/2)<1)return-d/2*(Math.sqrt(1-b*b)-1)+c;return d/2*(Math.sqrt(1-(b-=2)*b)+1)+c;},easeInElastic:function(a,b,c,d,e){var f=1.70158,g=0,h=d;if(b==0)return c;if((b/=e)==1)return c+d;g||(g=e*.3);if(h").css({position:"absolute",visibility:"visible",left:-j*(g/d),top:-i*(h/c)}).parent().addClass("ui-effects-explode").css({position:"absolute",overflow:"hidden",width:g/d,height:h/c,left:f.left+j*(g/d)+(b.options.mode=="show"?(j-Math.floor(d/2))*(g/d):0),top:f.top+i*(h/c)+(b.options.mode=="show"?(i-Math.floor(c/2))*(h/c):0),opacity:b.options.mode=="show"?0:1}).animate({left:f.left+j*(g/d)+(b.options.mode=="show"?0:(j-Math.floor(d/2))*(g/d)),top:f.top+i*(h/c)+(b.options.mode=="show"?0:(i-Math.floor(c/2))*(h/c)),opacity:b.options.mode=="show"?1:0},b.duration||500);setTimeout(function(){b.options.mode=="show"?e.css({visibility:"visible"}):e.css({visibility:"visible"}).hide(),b.callback&&b.callback.apply(e[0]),e.dequeue(),a("div.ui-effects-explode").remove()},b.duration||500)})}})(jQuery);/* + */(function(a,b){a.effects.explode=function(b){return this.queue(function(){var c=b.options.pieces?Math.round(Math.sqrt(b.options.pieces)):3,d=b.options.pieces?Math.round(Math.sqrt(b.options.pieces)):3;b.options.mode=b.options.mode=="toggle"?a(this).is(":visible")?"hide":"show":b.options.mode;var e=a(this).show().css("visibility","hidden"),f=e.offset();f.top-=parseInt(e.css("marginTop"),10)||0,f.left-=parseInt(e.css("marginLeft"),10)||0;var g=e.outerWidth(!0),h=e.outerHeight(!0);for(var i=0;i").css({position:"absolute",visibility:"visible",left:-j*(g/d),top:-i*(h/c)}).parent().addClass("ui-effects-explode").css({position:"absolute",overflow:"hidden",width:g/d,height:h/c,left:f.left+j*(g/d)+(b.options.mode=="show"?(j-Math.floor(d/2))*(g/d):0),top:f.top+i*(h/c)+(b.options.mode=="show"?(i-Math.floor(c/2))*(h/c):0),opacity:b.options.mode=="show"?0:1}).animate({left:f.left+j*(g/d)+(b.options.mode=="show"?0:(j-Math.floor(d/2))*(g/d)),top:f.top+i*(h/c)+(b.options.mode=="show"?0:(i-Math.floor(c/2))*(h/c)),opacity:b.options.mode=="show"?1:0},b.duration||500);setTimeout(function(){b.options.mode=="show"?e.css({visibility:"visible"}):e.css({visibility:"visible"}).hide(),b.callback&&b.callback.apply(e[0]),e.dequeue(),a("div.ui-effects-explode").remove();},b.duration||500);});};})(jQuery);/* * jQuery UI Effects Fade 1.8.17 * * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) @@ -210,7 +210,7 @@ * * Depends: * jquery.effects.core.js - */(function(a,b){a.effects.fade=function(b){return this.queue(function(){var c=a(this),d=a.effects.setMode(c,b.options.mode||"hide");c.animate({opacity:d},{queue:!1,duration:b.duration,easing:b.options.easing,complete:function(){b.callback&&b.callback.apply(this,arguments),c.dequeue()}})})}})(jQuery);/* + */(function(a,b){a.effects.fade=function(b){return this.queue(function(){var c=a(this),d=a.effects.setMode(c,b.options.mode||"hide");c.animate({opacity:d},{queue:!1,duration:b.duration,easing:b.options.easing,complete:function(){b.callback&&b.callback.apply(this,arguments),c.dequeue();}});});};})(jQuery);/* * jQuery UI Effects Fold 1.8.17 * * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) @@ -221,7 +221,7 @@ * * Depends: * jquery.effects.core.js - */(function(a,b){a.effects.fold=function(b){return this.queue(function(){var c=a(this),d=["position","top","bottom","left","right"],e=a.effects.setMode(c,b.options.mode||"hide"),f=b.options.size||15,g=!!b.options.horizFirst,h=b.duration?b.duration/2:a.fx.speeds._default/2;a.effects.save(c,d),c.show();var i=a.effects.createWrapper(c).css({overflow:"hidden"}),j=e=="show"!=g,k=j?["width","height"]:["height","width"],l=j?[i.width(),i.height()]:[i.height(),i.width()],m=/([0-9]+)%/.exec(f);m&&(f=parseInt(m[1],10)/100*l[e=="hide"?0:1]),e=="show"&&i.css(g?{height:0,width:f}:{height:f,width:0});var n={},p={};n[k[0]]=e=="show"?l[0]:f,p[k[1]]=e=="show"?l[1]:0,i.animate(n,h,b.options.easing).animate(p,h,b.options.easing,function(){e=="hide"&&c.hide(),a.effects.restore(c,d),a.effects.removeWrapper(c),b.callback&&b.callback.apply(c[0],arguments),c.dequeue()})})}})(jQuery);/* + */(function(a,b){a.effects.fold=function(b){return this.queue(function(){var c=a(this),d=["position","top","bottom","left","right"],e=a.effects.setMode(c,b.options.mode||"hide"),f=b.options.size||15,g=!!b.options.horizFirst,h=b.duration?b.duration/2:a.fx.speeds._default/2;a.effects.save(c,d),c.show();var i=a.effects.createWrapper(c).css({overflow:"hidden"}),j=e=="show"!=g,k=j?["width","height"]:["height","width"],l=j?[i.width(),i.height()]:[i.height(),i.width()],m=/([0-9]+)%/.exec(f);m&&(f=parseInt(m[1],10)/100*l[e=="hide"?0:1]),e=="show"&&i.css(g?{height:0,width:f}:{height:f,width:0});var n={},p={};n[k[0]]=e=="show"?l[0]:f,p[k[1]]=e=="show"?l[1]:0,i.animate(n,h,b.options.easing).animate(p,h,b.options.easing,function(){e=="hide"&&c.hide(),a.effects.restore(c,d),a.effects.removeWrapper(c),b.callback&&b.callback.apply(c[0],arguments),c.dequeue();});});};})(jQuery);/* * jQuery UI Effects Highlight 1.8.17 * * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) @@ -232,7 +232,7 @@ * * Depends: * jquery.effects.core.js - */(function(a,b){a.effects.highlight=function(b){return this.queue(function(){var c=a(this),d=["backgroundImage","backgroundColor","opacity"],e=a.effects.setMode(c,b.options.mode||"show"),f={backgroundColor:c.css("backgroundColor")};e=="hide"&&(f.opacity=0),a.effects.save(c,d),c.show().css({backgroundImage:"none",backgroundColor:b.options.color||"#ffff99"}).animate(f,{queue:!1,duration:b.duration,easing:b.options.easing,complete:function(){e=="hide"&&c.hide(),a.effects.restore(c,d),e=="show"&&!a.support.opacity&&this.style.removeAttribute("filter"),b.callback&&b.callback.apply(this,arguments),c.dequeue()}})})}})(jQuery);/* + */(function(a,b){a.effects.highlight=function(b){return this.queue(function(){var c=a(this),d=["backgroundImage","backgroundColor","opacity"],e=a.effects.setMode(c,b.options.mode||"show"),f={backgroundColor:c.css("backgroundColor")};e=="hide"&&(f.opacity=0),a.effects.save(c,d),c.show().css({backgroundImage:"none",backgroundColor:b.options.color||"#ffff99"}).animate(f,{queue:!1,duration:b.duration,easing:b.options.easing,complete:function(){e=="hide"&&c.hide(),a.effects.restore(c,d),e=="show"&&!a.support.opacity&&this.style.removeAttribute("filter"),b.callback&&b.callback.apply(this,arguments),c.dequeue();}});});};})(jQuery);/* * jQuery UI Effects Pulsate 1.8.17 * * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) @@ -243,7 +243,7 @@ * * Depends: * jquery.effects.core.js - */(function(a,b){a.effects.pulsate=function(b){return this.queue(function(){var c=a(this),d=a.effects.setMode(c,b.options.mode||"show");times=(b.options.times||5)*2-1,duration=b.duration?b.duration/2:a.fx.speeds._default/2,isVisible=c.is(":visible"),animateTo=0,isVisible||(c.css("opacity",0).show(),animateTo=1),(d=="hide"&&isVisible||d=="show"&&!isVisible)&×--;for(var e=0;e').appendTo(document.body).addClass(b.options.className).css({top:g.top,left:g.left,height:c.innerHeight(),width:c.innerWidth(),position:"absolute"}).animate(f,b.duration,b.options.easing,function(){h.remove(),b.callback&&b.callback.apply(c[0],arguments),c.dequeue()})})}})(jQuery); \ No newline at end of file + */(function(a,b){a.effects.transfer=function(b){return this.queue(function(){var c=a(this),d=a(b.options.to),e=d.offset(),f={top:e.top,left:e.left,height:d.innerHeight(),width:d.innerWidth()},g=c.offset(),h=a("
    ").appendTo(document.body).addClass(b.options.className).css({top:g.top,left:g.left,height:c.innerHeight(),width:c.innerWidth(),position:"absolute"}).animate(f,b.duration,b.options.easing,function(){h.remove(),b.callback&&b.callback.apply(c[0],arguments),c.dequeue();});});};})(jQuery); \ No newline at end of file diff --git a/examples/voter/voter/routes/index.js b/examples/voter/voter/routes/index.js index 16b8a6a..f7194f0 100644 --- a/examples/voter/voter/routes/index.js +++ b/examples/voter/voter/routes/index.js @@ -22,7 +22,7 @@ */ exports.index = function(req, res) { - res.render('index', { - title : 'VoltDB Voter Example' - }) + res.render("index", { + title : "VoltDB Voter Example" + }); }; diff --git a/lib/client.js b/lib/client.js index e6d0830..f99b683 100644 --- a/lib/client.js +++ b/lib/client.js @@ -21,13 +21,23 @@ * OTHER DEALINGS IN THE SOFTWARE. */ -var EventEmitter = require('events').EventEmitter, -util = require('util'), -VoltConnection = require('./connection'), -VoltConstants = require('./voltconstants'); +var EventEmitter = require("events").EventEmitter, + util = require("util"), + VoltConnection = require("./connection"), + VoltConstants = require("./voltconstants"); + +const fs = require("fs"); const debug = require("debug")("voltdb-client-nodejs:VoltClient"); +const VoltProcedure = require("./query"); +const Hashinator = require("./hashinator"); + +const AdHoc = new VoltProcedure("@AdHoc",["string"]); +const UpdateClasses = new VoltProcedure("@UpdateClasses",["varbinary","string"]); +const Statistics = new VoltProcedure("@Statistics",["string","int"]); +const GetPartitionKeys = new VoltProcedure("@GetPartitionKeys",["string"]); +const SystemInformation = new VoltProcedure("@SystemInformation",["string"]); -VoltClient = function(configuration) { +const VoltClient = function(configuration) { EventEmitter.call(this); this.config = configuration; @@ -46,82 +56,182 @@ VoltClient = function(configuration) { this._queryDispatchErrorListener=this._queryDispatchErrorListener.bind(this); this._fatalErrorListener=this._fatalErrorListener.bind(this); + this._hashinator = null; this._connections = []; this._badConnections = []; this._connectionCounter = 0; -} +}; util.inherits(VoltClient, EventEmitter); -VoltClient.prototype.connect = function(callback) { - var self = this; +VoltClient.prototype.isConnected = function(){ + return this._connections.reduce( (r, c) => r || c.isValidConnection(), false ); +}; + +VoltClient.prototype.connect = function() { + const conPromises = []; - var connectionCount = this.config.length; - var connectionResults = []; for(var index = 0; index < this.config.length; index++) { - var con = new VoltConnection(this.config[index]); + var con = new VoltConnection(this.config[index], index); con.on(VoltConstants.SESSION_EVENT.CONNECTION,this._connectListener); - con.on(VoltConstants.SESSION_EVENT.CONNECTION, callback); - con.on(VoltConstants.SESSION_EVENT.CONNECTION_ERROR, callback); + con.on(VoltConstants.SESSION_EVENT.CONNECTION_ERROR, this._connectErrorListener); con.on(VoltConstants.SESSION_EVENT.QUERY_RESPONSE,this._queryResponseListener); con.on(VoltConstants.SESSION_EVENT.QUERY_RESPONSE_ERROR,this._queryResponseErrorListener); con.on(VoltConstants.SESSION_EVENT.QUERY_DISPATCH_ERROR,this._queryDispatchErrorListener); con.on(VoltConstants.SESSION_EVENT.FATAL_ERROR,this._fatalErrorListener); + con.onReconnect = () => { + this._connections.push(con); + this._badConnections = this._badConnections.filter( c => c.id !== con.id ); + }; /** * Need to register the connection even before the socket connects otherwise * it can't be torn down in the event of a socket failure. */ - this._connections.push(con); - - con.connect(); + conPromises.push(con.connect()); } -} -VoltClient.prototype._getConnection = function(callback) { - var length = this._connections.length; - var connection = null; - for(var index = 0; index < length; index++) { + const errors = []; - // creates round robin - this._connectionCounter++; - if(this._connectionCounter >= length) { - this._connectionCounter = 0; + return Promise.all(conPromises).then( connections => { + for(let i = 0 ; i < connections.length ; i++){ + const con = connections[i]; + + if ( con.isValidConnection() ) { + this._connections.push(con); + errors.push(null); + } else { + this._badConnections.push(con); + errors.push(con.loginError); + } } + + if ( this._connections.length > 0 ) this._updateHashinator(); + + return { connected: this.isConnected(), errors }; + } ); +}; + +VoltClient.prototype._updateHashinator = function(){ + let hashConfig = null; + let partitionKeys = null; + + const topoCall = this.statistics("TOPO",0); + + topoCall.read + .then( response => { + if ( response.code ) return; + if ( response.results.status !== 1 ) return; //Todo VoltConstants.RESULT_STATUS.SUCCESS + + hashConfig = response.results.table[1].data[0].HASHCONFIG; + + if ( partitionKeys ){ + this._hashinator = new Hashinator(hashConfig, partitionKeys); + } + }); + + topoCall.onQueryAllowed + .then( () => this.getPartitionKeys("string").read ) + .then( response => { + if ( response.code ) return; + if ( response.results.status !== 1 ) return; //Todo VoltConstants.RESULT_STATUS.SUCCESS + + partitionKeys = response.results.table[0].data; + + if ( hashConfig ){ + this._hashinator = new Hashinator(hashConfig, partitionKeys); + } + }); +}; + +VoltClient.prototype._getConnection = function() { + const length = this._connections.length; + let connection = null; + + for(let index = 0; index < length; index++) { + // creates round robin + this._connectionCounter = (this._connectionCounter + 1 ) % length; + connection = this._connections[this._connectionCounter]; + // validates that the connection is good and not blocked on reads - if(connection == null || connection.isValidConnection() == false) { + if(connection == null || !connection.isValidConnection() ) { this._badConnections.push(connection); this._connections[this._connectionCounter] = null; - } else if(connection.isBlocked() == false) { + + } else if( !connection.isBlocked()) { break; } } + + this._connections = this._connections.filter(c => !!c ); + return connection; -} +}; -VoltClient.prototype.callProcedure = function(query, readCallback, writeCallback) { - var con = this._getConnection(); - if(con) { - if(con.callProcedure(query, readCallback, writeCallback) == false) { - this.emit(VoltConstants.SESSION_EVENT.CONNECTION_ERROR, - VoltConstants.STATUS_CODES.CONNECTION_TIMEOUT, - VoltConstants.SESSION_EVENT.CONNECTION_ERROR, - 'Invalid connection in connection pool'); - } +VoltClient.prototype.callProcedure = function(query) { + const con = this._getConnection(); - } else { + if( !con || !con.isValidConnection()) { this.emit(VoltConstants.SESSION_EVENT.CONNECTION_ERROR, VoltConstants.STATUS_CODES.CONNECTION_TIMEOUT, VoltConstants.SESSION_EVENT.CONNECTION_ERROR, - 'No valid VoltDB connections, verify that the database is online'); + "No valid VoltDB connections, verify that the database is online"); + + const error = new Promise( (resolve,reject) => reject({ + code: VoltConstants.STATUS_CODES.CONNECTION_TIMEOUT, + event: VoltConstants.SESSION_EVENT.CONNECTION_ERROR, + results: { status: VoltConstants.STATUS_CODES.CONNECTION_LOST } + })); + + return { read: error, onQueryAllowed: () => null }; } -} -VoltClient.prototype.call = function(query, readCallback, writeCallback) { - this.callProcedure(query, readCallback, writeCallback); -} + return con.callProcedure(query); +}; + +VoltClient.prototype.call = function(query) { + this.callProcedure(query); +}; + +VoltClient.prototype.adHoc = function(query){ + const statement = AdHoc.getQuery(); + statement.setParameters([query]); + + return this.callProcedure(statement); +}; + +VoltClient.prototype.getPartitionKeys = function(type = "string"){ + const statement = GetPartitionKeys.getQuery(); + statement.setParameters([type]); + + return this.callProcedure(statement); +}; + +VoltClient.prototype.statistics = function(component, delta=0){ + const statement = Statistics.getQuery(); + statement.setParameters([component, delta]); + + return this.callProcedure(statement); +}; + +VoltClient.prototype.updateClasses = function(jarPath, removeClasses = ""){ + const statement = UpdateClasses.getQuery(); + const jarBin = jarPath ? fs.readFileSync(jarPath) : new Buffer("NULL"); + + statement.setParameters([jarBin, removeClasses]); + + return this.callProcedure(statement); +}; + +VoltClient.prototype.systemInformation = function(selector){ + const statement = SystemInformation.getQuery(); + + statement.setParameters([selector]); + + return this.callProcedure(statement); +}; VoltClient.prototype.exit = function(callback) { @@ -134,27 +244,28 @@ VoltClient.prototype.exit = function(callback) { } if(callback) callback(); -} +}; VoltClient.prototype.connectionStats = function() { - util.log('Good connections:'); + util.log("Good connections:"); this._displayConnectionArrayStats(this._connections); - util.log('Bad connections:'); + util.log("Bad connections:"); this._displayConnectionArrayStats(this._badConnections); -} +}; VoltClient.prototype._displayConnectionArrayStats = function(array) { for(var index = 0; index < array.length; index++) { - var connection = array[index]; + const connection = array[index]; + if(connection != null) { - util.log('Connection: ', - connection.config.host, ': ', - connection.invocations, ' Alive: ', - connection.isValidConnection()); + util.log("Connection: ", + connection.config.host, ": ", + connection.invocations, " Alive: ", + connection.isValidConnection()); } } -} +}; /** * TODO: Not sure why SUCCESS can be both null and 1. Will leave it as is until @@ -172,41 +283,49 @@ VoltClient.prototype._connectListener = function(code, event, connection) { code, event, connection.config.host); -} +}; VoltClient.prototype._connectErrorListener = function(code, event, message) { + debug("Connection Error | Code: %o, Event: %o", statusCodeToString(code), event); + this.emit(VoltConstants.SESSION_EVENT.CONNECTION_ERROR, code, event, message); -} +}; VoltClient.prototype._queryResponseListener = function(code,event, message) { this.emit(VoltConstants.SESSION_EVENT.QUERY_RESPONSE, code, event, message); -} +}; VoltClient.prototype._queryResponseErrorListener = function(code, event, message) { + debug("Query Response Error | Code: %o, Event: %o", statusCodeToString(code), event); + this.emit(VoltConstants.SESSION_EVENT.QUERY_RESPONSE_ERROR, code, event, message); -} +}; VoltClient.prototype._queryDispatchErrorListener = function(code, event, message) { + debug("Query Dispatch Error | Code: %o, Event: %o", statusCodeToString(code), event); + this.emit(VoltConstants.SESSION_EVENT.QUERY_DISPATCH_ERROR, code, event, message); -} +}; VoltClient.prototype._fatalErrorListener = function(code, event, message) { + debug("Fatal Error | Code: %o, Event: %o", statusCodeToString(code), event); + this.emit(VoltConstants.SESSION_EVENT.FATAL_ERROR, code, event, message); -} +}; module.exports = VoltClient; diff --git a/lib/configuration.js b/lib/configuration.js index a510225..ad6de52 100644 --- a/lib/configuration.js +++ b/lib/configuration.js @@ -20,19 +20,21 @@ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ -VoltConfiguration = function() { -} +const VoltConfiguration = function() {}; + VoltConfiguration.prototype = Object.create({ - host : 'localhost', + host : "localhost", port : 21212, - username : 'user', - password : 'password', - service : 'database', + username : "user", + password : "password", + service : "database", + hashAlgorithm : "sha1", queryTimeout : 600000, queryTimeoutInterval: 60000, flushInterval: 1000, messageQueueSize : 10, - maxConsecutiveWrites: 5000 + maxConsecutiveWrites: 5000, + reconnectInterval: 1000 }); module.exports = VoltConfiguration; diff --git a/lib/connection.js b/lib/connection.js index 0e193fb..662705b 100644 --- a/lib/connection.js +++ b/lib/connection.js @@ -25,13 +25,14 @@ * OTHER DEALINGS IN THE SOFTWARE. */ -var EventEmitter = require('events').EventEmitter, -Socket = require('net').Socket, -crypto = require('crypto'), -util = require('util'), -Message = require('./message').Message, -VoltConstants = require('./voltconstants'); +var EventEmitter = require("events").EventEmitter, + Socket = require("net").Socket, + crypto = require("crypto"), + util = require("util"), + VoltConstants = require("./voltconstants"); + const debug = require("debug")("voltdb-client-nodejs:VoltConnection"); +const { Message, LoginMessage, QueryMessage } = require("./message"); function VoltMessageManager(configuration) { EventEmitter.call(this); @@ -39,19 +40,21 @@ function VoltMessageManager(configuration) { this.message = configuration.message || null; this.error = false; this.time = null; - index = -1; + this.index = -1; } util.inherits(VoltMessageManager, EventEmitter); -function VoltConnection(configuration) { +function VoltConnection(configuration, id) { EventEmitter.call(this); this.config = configuration; + this.id = id; this.onConnect = this.onConnect.bind(this); this.onError = this.onError.bind(this); this.onRead = this.onRead.bind(this); + this.onReconnect = () => null; this._send = this._send.bind(this); this._flush = this._flush.bind(this); this.isValidConnection = this.isValidConnection.bind(this); @@ -62,6 +65,7 @@ function VoltConnection(configuration) { this.isWritable = true; this.isLoggedIn = false; this._sendQueue = []; + this._syncSendQueue = []; this._calls = {}; this._callIndex = []; this._id = 0; @@ -71,71 +75,120 @@ function VoltConnection(configuration) { this.invocations = 0; this.validConnection = true; this.blocked = false; + this.loginError = null; this.outstandingQueryManager = null; this.flusher = null; - } util.inherits(VoltConnection, EventEmitter); -VoltConnection.prototype.initSocket = function(socket) { +VoltConnection.prototype.initSocket = function(socket, resolve) { this.socket = socket; - this.socket.on('error', this.onError); - this.socket.on('data', this.onRead); - this.socket.on('connect', this.onConnect); -} + this.socket.on("error", (e,m,s) => { + if ( this.socket.destroyed ) this.close(); + + this.validConnection = false; + this.isLoggedIn = false; + + if ( resolve ){ + let loginStatus = VoltConstants.SOCKET_ERRORS[e.code]; + this.loginError = VoltConstants.LOGIN_STATUS[loginStatus]; + + resolve(this); + resolve=undefined; //only once will be called + + if ( loginStatus !== VoltConstants.SOCKET_ERRORS.HOST_UNKNOWN && this.config.reconnectInterval > 0){ + /** + * This will call reconnect() that will call connect() that will call again to + * this function to set this up if it fails again. + */ + setTimeout( () => this.reconnect(), this.config.reconnectInterval ); + } + + } else { + this.onError(e,m,s); + } + }); + + this.socket.setTimeout(10000, () => this.socket.end() ); + this.socket.once("connect", () => this.socket.setTimeout(0) ); + + this.socket.on("data", buffer => { + this.onRead(buffer, resolve); + }); + + this.socket.on("connect", this.onConnect); +}; + +VoltConnection.prototype.reconnect = function(){ + if ( !this.validConnection ){ + this.connect().then( + () => this.validConnection ? this.onReconnect(this) : null + ); + } +}; VoltConnection.prototype.connect = function() { - this.initSocket(new Socket()) - this.socket.connect(this.config.port, this.config.host); - this.outstandingQueryManager = setInterval(this._manageOustandingQueries, this.config.queryTimeoutInterval); - this.flusher = setInterval(this._flush, this.config.flushInterval); -} + + return new Promise( (resolve) => { + this.initSocket(new Socket(), resolve); + this.socket.connect(this.config.port, this.config.host); + this.outstandingQueryManager = setInterval(this._manageOustandingQueries, this.config.queryTimeoutInterval); + this.flusher = setInterval(this._flush, this.config.flushInterval); + }); +}; VoltConnection.prototype.isValidConnection = function() { return this.validConnection; -} +}; VoltConnection.prototype.isBlocked = function() { return this.blocked; -} - +}; // Deprecating call in favor of callProcedure -VoltConnection.prototype.call = function(query, readCallback, writeCallback) { - return this.callProcedure(query, readCallback, writeCallback); -} +VoltConnection.prototype.call = function(query, writeCallback) { + return this.callProcedure(query, writeCallback); +}; -VoltConnection.prototype.callProcedure = function(query, readCallback, writeCallback) { +VoltConnection.prototype.callProcedure = function(query) { this.invocations++; var uid = this._getUID(); query.setUID(uid); - var vmm = new VoltMessageManager({ + const vmm = new VoltMessageManager({ message: query.getMessage(), - uid: uid}); - - if (readCallback) { - vmm.on(VoltConstants.SESSION_EVENT.QUERY_RESPONSE, readCallback); - vmm.on(VoltConstants.SESSION_EVENT.QUERY_RESPONSE_ERROR, readCallback); - } - - if ( writeCallback ) { - vmm.on(VoltConstants.SESSION_EVENT.QUERY_ALLOWED, writeCallback); - } - return this._send(vmm, true); -} + uid: uid + }); + const onQueryAllowed = new Promise( (resolve) => { + vmm.on(VoltConstants.SESSION_EVENT.QUERY_ALLOWED, (code, event, results) => resolve({ code, event, results })); + }); + const read = new Promise ( (resolve,reject) => { + vmm.on(VoltConstants.SESSION_EVENT.QUERY_RESPONSE, (code, event, results) => resolve({ code, event, results })); + vmm.on(VoltConstants.SESSION_EVENT.QUERY_RESPONSE_ERROR, (code, event, results) => reject({ code, event, results })); + + try { + const error = this._send(vmm, true); + if ( error ) reject(error); + } catch (error) { + console.log("Error", error); + reject(error); + } + }); + + return { read, onQueryAllowed }; +}; VoltConnection.prototype._getUID = function() { var id = String(this._id < 99999999 ? this._id++ : this._id = 0); - var uid = this._zeros(8 - id.length).join('') + id; + var uid = this._zeros(8 - id.length).join("") + id; return uid; -} +}; VoltConnection.prototype._zeros = function(num) { var arr = new Array(num); @@ -143,7 +196,7 @@ VoltConnection.prototype._zeros = function(num) { arr[i] = 0; } return arr; -} +}; VoltConnection.prototype.close = function(callback) { @@ -154,16 +207,19 @@ VoltConnection.prototype.close = function(callback) { if(this.socket) this.socket.end(); + this.validConnection = false; + this.isLoggedIn = false; + if(callback) callback(); -} +}; + +VoltConnection.prototype.onConnect = function() { + var hashAlgorithm = crypto.createHash(this.config.hashAlgorithm); -VoltConnection.prototype.onConnect = function(results) { - var service = this.config.service; - var sha1 = crypto.createHash('sha1'); - sha1.update(this.config.password); - var password = new Buffer(sha1.digest('base64'), 'base64'); + hashAlgorithm.update(this.config.password); + var password = new Buffer(hashAlgorithm.digest("base64"), "base64"); - var message = this._getLoginMessage(password); + var message = this._getLoginMessage(password, this.config.hashAlgorithm); // you must connect and send login credentials immediately. var vmm = new VoltMessageManager({ @@ -171,24 +227,44 @@ VoltConnection.prototype.onConnect = function(results) { uid: this._getUID() }); - this._send(vmm, false); -} + const err = this._send(vmm, false); + + if (err){ + this.emit( err.event, + err.code, + err.event, + err.results + ); + } +}; -VoltConnection.prototype.onError = function(results) { +VoltConnection.prototype.onError = function(error) { this.emit( - VoltConstants.SESSION_EVENT.CONNECTION, - VoltConstants.STATUS_CODES.UNEXPECTED_FAILURE, - VoltConstants.SESSION_EVENT.CONNECTION, + VoltConstants.SESSION_EVENT.CONNECTION_ERROR, + error, + VoltConstants.STATUS_CODE_STRINGS[VoltConstants.STATUS_CODES.CONNECTION_LOST], this); -} +}; -VoltConnection.prototype.onRead = function(buffer) { +VoltConnection.prototype.onRead = function(buffer, resolveConnect) { var results = null; if(this.isLoggedIn == false) { results = this._decodeLoginResult(buffer); + + if ( results.error ) { + this.validConnection = false; + this.isLoggedIn = false; + this.loginError = results.status; + + return resolveConnect(this); + } + this.isLoggedIn = true; this.validConnection = true; + + if ( resolveConnect ) resolveConnect(this); + this.emit(VoltConstants.SESSION_EVENT.CONNECTION, VoltConstants.STATUS_CODES.SUCCESS, VoltConstants.SESSION_EVENT.CONNECTION, @@ -210,17 +286,17 @@ VoltConnection.prototype.onRead = function(buffer) { var vmm = this._calls[results.uid]; if(vmm) { delete this._calls[results.uid]; + this.sendCounter--; vmm.emit(VoltConstants.SESSION_EVENT.QUERY_RESPONSE, - VoltConstants.STATUS_CODES.SUCCESS, - VoltConstants.SESSION_EVENT.QUERY_RESPONSE, - results); + VoltConstants.STATUS_CODES.SUCCESS, + VoltConstants.SESSION_EVENT.QUERY_RESPONSE, + results); - if(this.blocked == true) { - this.blocked = false; - this._invokeWriteEventHandler(vmm); + if(this.blocked) { + this.blocked = false; + this._invokeWriteEventHandler(vmm); } - } else { this.emit( VoltConstants.SESSION_EVENT.QUERY_RESPONSE_ERROR, @@ -229,36 +305,35 @@ VoltConnection.prototype.onRead = function(buffer) { "Query completed after an extended period but query manager was deleted" ); } } + this._overflow = data; } -} +}; VoltConnection.prototype._send = function(vmm, track) { - var results = true; try { - if(track == true) { + if(track) { this._calls[vmm.uid] = vmm; this._callIndex.push(vmm.uid); vmm.time = Date.now(); } this._queue(vmm.message.toBuffer(), track); - this.sendCounter++; - if(this.blocked == false) { + if( !this.blocked ) { this._invokeWriteEventHandler(vmm); } } catch (err) { - this.emit(VoltConstants.SESSION_EVENT.QUERY_DISPATCH_ERROR, - VoltConstants.STATUS_CODES.UNEXPECTED_FAILURE, - VoltConstants.SESSION_EVENT.QUERY_DISPATCH_ERROR, - err.message); this.validConnection = false; - results = false; + + return { + code: VoltConstants.STATUS_CODES.UNEXPECTED_FAILURE, + event: VoltConstants.SESSION_EVENT.QUERY_DISPATCH_ERROR, + results: err.message + }; } - return results; -} +}; VoltConnection.prototype._queue = function(buffer, track) { this._sendQueue.push(buffer); @@ -270,6 +345,7 @@ VoltConnection.prototype._queue = function(buffer, track) { VoltConnection.prototype._flush = function() { debug("Flushing | Send Queue Length: %o", this._sendQueue.length); + var bytes = this._sendQueue.reduce(function(bytes, buffer) { return bytes + buffer.length; }, 0); @@ -281,14 +357,18 @@ VoltConnection.prototype._flush = function() { }, 0); try { + debug("Socket closed ? ", this.socket); + this.socket.write(combined); } catch (err) { + debug("Socket Write Error | ", err); + this.emit(VoltConstants.SESSION_EVENT.QUERY_DISPATCH_ERROR, VoltConstants.STATUS_CODES.UNEXPECTED_FAILURE, VoltConstants.SESSION_EVENT.QUERY_DISPATCH_ERROR, err.message + ": Connection dropped to server while dispatching query. Is VoltDB Server up?"); - throw err; + throw err; } this._sendQueue = []; @@ -298,6 +378,7 @@ VoltConnection.prototype._invokeWriteEventHandler = function(vmm) { // only allow more writes if the queue has not breached a limit if(this.sendCounter < this.config.maxConsecutiveWrites ) { this.blocked = false; + vmm.emit(VoltConstants.SESSION_EVENT.QUERY_ALLOWED, VoltConstants.STATUS_CODES.SUCCESS, VoltConstants.SESSION_EVENT.QUERY_ALLOWED, @@ -305,38 +386,44 @@ VoltConnection.prototype._invokeWriteEventHandler = function(vmm) { } else { this.blocked = true; } -} +}; -VoltConnection.prototype._getLoginMessage = function(password) { +VoltConnection.prototype._getLoginMessage = function(password, hashAlgorithm) { var message = new Message(); + if ( hashAlgorithm === VoltConstants.HASH_ALGORITHMS.SHA_256 ) message.writeBinary(new Buffer([1])); + message.writeString(this.config.service); message.writeString(this.config.username); message.writeBinary(password); message.type = VoltConstants.MESSAGE_TYPE.LOGIN; return message; -} +}; VoltConnection.prototype._decodeLoginResult = function(buffer) { return new LoginMessage(buffer); -} +}; VoltConnection.prototype._decodeQueryResult = function(buffer) { return new QueryMessage(buffer); -} +}; VoltConnection.prototype._manageOustandingQueries = function() { - var tmpCallIndex = []; - var time = Date.now(); - var uid = null; - while( uid = this._callIndex.pop()) { - vmm = this._calls[uid]; + const tmpCallIndex = []; + const time = Date.now(); + let uid = this._callIndex.pop(); + + while( uid ) { + let vmm = this._calls[uid]; + if(vmm && this._checkQueryTimeout(vmm, time) == false) { tmpCallIndex.push(vmm.uid); } + + uid = this._callIndex.pop(); } this._callIndex = tmpCallIndex; -} +}; VoltConnection.prototype._checkQueryTimeout = function(vmm, time) { var queryInvalidated = false; @@ -349,8 +436,8 @@ VoltConnection.prototype._checkQueryTimeout = function(vmm, time) { VoltConstants.SESSION_EVENT.QUERY_RESPONSE_ERROR, {error : true, status : VoltConstants.STATUS_CODES.CONNECTION_TIMEOUT, - statusString : 'Query timed out before server responded' - }); + statusString : "Query timed out before server responded" + }); vmm.emit(VoltConstants.SESSION_EVENT.QUERY_ALLOWED, VoltConstants.STATUS_CODES.SUCCESS, @@ -361,6 +448,6 @@ VoltConnection.prototype._checkQueryTimeout = function(vmm, time) { } return queryInvalidated; -} +}; module.exports = VoltConnection; diff --git a/lib/ctio.js b/lib/ctio.js index b2b129c..929c19f 100644 --- a/lib/ctio.js +++ b/lib/ctio.js @@ -100,22 +100,22 @@ */ function ruint8(buffer, endian, offset) { - if (endian === undefined) - throw (new Error('missing endian')); + if (endian === undefined) + throw (new Error("missing endian")); - if (buffer === undefined) - throw (new Error('missing buffer')); + if (buffer === undefined) + throw (new Error("missing buffer")); - if (offset === undefined) - throw (new Error('missing offset')); + if (offset === undefined) + throw (new Error("missing offset")); if(offset >= buffer.length) - throw (new Error('Trying to read beyond buffer length')); + throw (new Error("Trying to read beyond buffer length")); - return (buffer[offset]); + return (buffer[offset]); } /* @@ -123,29 +123,29 @@ function ruint8(buffer, endian, offset) */ function ruint16(buffer, endian, offset) { - var val = 0; + var val = 0; - if (endian === undefined) - throw (new Error('missing endian')); + if (endian === undefined) + throw (new Error("missing endian")); - if (buffer === undefined) - throw (new Error('missing buffer')); + if (buffer === undefined) + throw (new Error("missing buffer")); - if (offset === undefined) - throw (new Error('missing offset')); + if (offset === undefined) + throw (new Error("missing offset")); - if (offset + 1 >= buffer.length) - throw (new Error('Trying to read beyond buffer length')); + if (offset + 1 >= buffer.length) + throw (new Error("Trying to read beyond buffer length")); - if (endian == 'big') { - val = buffer[offset] << 8; - val |= buffer[offset+1]; - } else { - val = buffer[offset]; - val |= buffer[offset+1] << 8; - } + if (endian == "big") { + val = buffer[offset] << 8; + val |= buffer[offset+1]; + } else { + val = buffer[offset]; + val |= buffer[offset+1] << 8; + } - return (val); + return (val); } /* @@ -165,38 +165,38 @@ function ruint16(buffer, endian, offset) */ function fixu32(upper, lower) { - return ((upper * (1 << 24)) + lower); + return ((upper * (1 << 24)) + lower); } function ruint32(buffer, endian, offset) { - var val = 0; + var val = 0; - if (endian === undefined) - throw (new Error('missing endian')); + if (endian === undefined) + throw (new Error("missing endian")); - if (buffer === undefined) - throw (new Error('missing buffer')); + if (buffer === undefined) + throw (new Error("missing buffer")); - if (offset === undefined) - throw (new Error('missing offset')); + if (offset === undefined) + throw (new Error("missing offset")); - if (offset + 3 >= buffer.length) - throw (new Error('Trying to read beyond buffer length')); + if (offset + 3 >= buffer.length) + throw (new Error("Trying to read beyond buffer length")); - if (endian == 'big') { - val = buffer[offset+1] << 16; - val |= buffer[offset+2] << 8; - val |= buffer[offset+3]; - val = fixu32(buffer[offset], val); - } else { - val = buffer[offset+2] << 16; - val |= buffer[offset+1] << 8; - val |= buffer[offset]; - val = fixu32(buffer[offset+3], val); - } + if (endian == "big") { + val = buffer[offset+1] << 16; + val |= buffer[offset+2] << 8; + val |= buffer[offset+3]; + val = fixu32(buffer[offset], val); + } else { + val = buffer[offset+2] << 16; + val |= buffer[offset+1] << 8; + val |= buffer[offset]; + val = fixu32(buffer[offset+3], val); + } - return (val); + return (val); } /* @@ -217,29 +217,29 @@ function ruint32(buffer, endian, offset) */ function ruint64(buffer, endian, offset) { - var val = new Array(2); + var val = new Array(2); - if (endian === undefined) - throw (new Error('missing endian')); + if (endian === undefined) + throw (new Error("missing endian")); - if (buffer === undefined) - throw (new Error('missing buffer')); + if (buffer === undefined) + throw (new Error("missing buffer")); - if (offset === undefined) - throw (new Error('missing offset')); + if (offset === undefined) + throw (new Error("missing offset")); - if (offset + 7 >= buffer.length) - throw (new Error('Trying to read beyond buffer length')); + if (offset + 7 >= buffer.length) + throw (new Error("Trying to read beyond buffer length")); - if (endian == 'big') { - val[0] = ruint32(buffer, endian, offset); - val[1] = ruint32(buffer, endian, offset+4); - } else { - val[0] = ruint32(buffer, endian, offset+4); - val[1] = ruint32(buffer, endian, offset); - } + if (endian == "big") { + val[0] = ruint32(buffer, endian, offset); + val[1] = ruint32(buffer, endian, offset+4); + } else { + val[0] = ruint32(buffer, endian, offset+4); + val[1] = ruint32(buffer, endian, offset); + } - return (val); + return (val); } @@ -300,26 +300,26 @@ function ruint64(buffer, endian, offset) */ function rsint8(buffer, endian, offset) { - var neg; + var neg; - if (endian === undefined) - throw (new Error('missing endian')); + if (endian === undefined) + throw (new Error("missing endian")); - if (buffer === undefined) - throw (new Error('missing buffer')); + if (buffer === undefined) + throw (new Error("missing buffer")); - if (offset === undefined) - throw (new Error('missing offset')); + if (offset === undefined) + throw (new Error("missing offset")); - if (offset >= buffer.length) - throw (new Error('Trying to read beyond buffer length')); + if (offset >= buffer.length) + throw (new Error("Trying to read beyond buffer length")); - neg = buffer[offset] & 0x80; + neg = buffer[offset] & 0x80; - if (!neg) - return (buffer[offset]); + if (!neg) + return (buffer[offset]); - return ((0xff - buffer[offset] + 1) * -1); + return ((0xff - buffer[offset] + 1) * -1); } /* @@ -328,26 +328,26 @@ function rsint8(buffer, endian, offset) */ function rsint16(buffer, endian, offset) { - var neg, val; + var neg, val; - if (endian === undefined) - throw (new Error('missing endian')); + if (endian === undefined) + throw (new Error("missing endian")); - if (buffer === undefined) - throw (new Error('missing buffer')); + if (buffer === undefined) + throw (new Error("missing buffer")); - if (offset === undefined) - throw (new Error('missing offset')); + if (offset === undefined) + throw (new Error("missing offset")); - if (offset + 1 >= buffer.length) - throw (new Error('Trying to read beyond buffer length')); + if (offset + 1 >= buffer.length) + throw (new Error("Trying to read beyond buffer length")); - val = ruint16(buffer, endian, offset); - neg = val & 0x8000; - if (!neg) - return (val); + val = ruint16(buffer, endian, offset); + neg = val & 0x8000; + if (!neg) + return (val); - return ((0xffff - val + 1) * -1); + return ((0xffff - val + 1) * -1); } /* @@ -360,28 +360,28 @@ function rsint16(buffer, endian, offset) */ function rsint32(buffer, endian, offset) { - //console.log('(' + offset + ')'); + //console.log('(' + offset + ')'); - var neg, val; + var neg, val; - if (endian === undefined) - throw (new Error('missing endian')); + if (endian === undefined) + throw (new Error("missing endian")); - if (buffer === undefined) - throw (new Error('missing buffer')); + if (buffer === undefined) + throw (new Error("missing buffer")); - if (offset === undefined) - throw (new Error('missing offset')); + if (offset === undefined) + throw (new Error("missing offset")); - if (offset + 3 >= buffer.length) - throw (new Error('Trying to read beyond buffer length')); + if (offset + 3 >= buffer.length) + throw (new Error("Trying to read beyond buffer length")); - val = ruint32(buffer, endian, offset); - neg = val & 0x80000000; - if (!neg) - return (val); + val = ruint32(buffer, endian, offset); + neg = val & 0x80000000; + if (!neg) + return (val); - return ((0xffffffff - val + 1) * -1); + return ((0xffffffff - val + 1) * -1); } /* @@ -390,30 +390,30 @@ function rsint32(buffer, endian, offset) */ function rsint64(buffer, endian, offset) { - var neg, val; + var neg, val; - if (endian === undefined) - throw (new Error('missing endian')); + if (endian === undefined) + throw (new Error("missing endian")); - if (buffer === undefined) - throw (new Error('missing buffer')); + if (buffer === undefined) + throw (new Error("missing buffer")); - if (offset === undefined) - throw (new Error('missing offset')); + if (offset === undefined) + throw (new Error("missing offset")); - if (offset + 3 >= buffer.length) - throw (new Error('Trying to read beyond buffer length')); + if (offset + 3 >= buffer.length) + throw (new Error("Trying to read beyond buffer length")); - val = ruint64(buffer, endian, offset); - neg = val[0] & 0x80000000; + val = ruint64(buffer, endian, offset); + neg = val[0] & 0x80000000; - if (!neg) - return (val); + if (!neg) + return (val); - val[0] = (0xffffffff - val[0]) * -1; - val[1] = (0xffffffff - val[1] + 1) * -1; + val[0] = (0xffffffff - val[0]) * -1; + val[1] = (0xffffffff - val[1] + 1) * -1; - return (val); + return (val); } /* @@ -473,79 +473,79 @@ function rsint64(buffer, endian, offset) */ function rfloat(buffer, endian, offset) { - var bytes = []; - var sign, exponent, mantissa, val; - var bias = 127; - var maxexp = 0xff; - - if (endian === undefined) - throw (new Error('missing endian')); - - if (buffer === undefined) - throw (new Error('missing buffer')); - - if (offset === undefined) - throw (new Error('missing offset')); - - if (offset + 3 >= buffer.length) - throw (new Error('Trying to read beyond buffer length')); - - /* Normalize the bytes to be in endian order */ - if (endian == 'big') { - bytes[0] = buffer[offset]; - bytes[1] = buffer[offset+1]; - bytes[2] = buffer[offset+2]; - bytes[3] = buffer[offset+3]; - } else { - bytes[3] = buffer[offset]; - bytes[2] = buffer[offset+1]; - bytes[1] = buffer[offset+2]; - bytes[0] = buffer[offset+3]; - } - - sign = bytes[0] & 0x80; - exponent = (bytes[0] & 0x7f) << 1; - exponent |= (bytes[1] & 0x80) >>> 7; - mantissa = (bytes[1] & 0x7f) << 16; - mantissa |= bytes[2] << 8; - mantissa |= bytes[3]; - - /* Check for special cases before we do general parsing */ - if (!sign && exponent == maxexp && mantissa === 0) - return (Number.POSITIVE_INFINITY); - - if (sign && exponent == maxexp && mantissa === 0) - return (Number.NEGATIVE_INFINITY); - - if (exponent == maxexp && mantissa !== 0) - return (Number.NaN); - - /* + var bytes = []; + var sign, exponent, mantissa, val; + var bias = 127; + var maxexp = 0xff; + + if (endian === undefined) + throw (new Error("missing endian")); + + if (buffer === undefined) + throw (new Error("missing buffer")); + + if (offset === undefined) + throw (new Error("missing offset")); + + if (offset + 3 >= buffer.length) + throw (new Error("Trying to read beyond buffer length")); + + /* Normalize the bytes to be in endian order */ + if (endian == "big") { + bytes[0] = buffer[offset]; + bytes[1] = buffer[offset+1]; + bytes[2] = buffer[offset+2]; + bytes[3] = buffer[offset+3]; + } else { + bytes[3] = buffer[offset]; + bytes[2] = buffer[offset+1]; + bytes[1] = buffer[offset+2]; + bytes[0] = buffer[offset+3]; + } + + sign = bytes[0] & 0x80; + exponent = (bytes[0] & 0x7f) << 1; + exponent |= (bytes[1] & 0x80) >>> 7; + mantissa = (bytes[1] & 0x7f) << 16; + mantissa |= bytes[2] << 8; + mantissa |= bytes[3]; + + /* Check for special cases before we do general parsing */ + if (!sign && exponent == maxexp && mantissa === 0) + return (Number.POSITIVE_INFINITY); + + if (sign && exponent == maxexp && mantissa === 0) + return (Number.NEGATIVE_INFINITY); + + if (exponent == maxexp && mantissa !== 0) + return (Number.NaN); + + /* * Javascript really doesn't have support for positive or negative zero. * So we're not going to try and give it to you. That would be just * plain weird. Besides -0 == 0. */ - if (exponent === 0 && mantissa === 0) - return (0); + if (exponent === 0 && mantissa === 0) + return (0); - /* + /* * Now we can deal with the bias and the determine whether the mantissa * has the implicit one or not. */ - exponent -= bias; - if (exponent == -bias) { - exponent++; - val = 0; - } else { - val = 1; - } + exponent -= bias; + if (exponent == -bias) { + exponent++; + val = 0; + } else { + val = 1; + } - val = (val + mantissa * Math.pow(2, -23)) * Math.pow(2, exponent); + val = (val + mantissa * Math.pow(2, -23)) * Math.pow(2, exponent); - if (sign) - val *= -1; + if (sign) + val *= -1; - return (val); + return (val); } /* @@ -576,53 +576,53 @@ function rfloat(buffer, endian, offset) */ function rdouble(buffer, endian, offset) { - var bytes = []; - var sign, exponent, mantissa, val, lowmant; - var bias = 1023; - var maxexp = 0x7ff; - - if (endian === undefined) - throw (new Error('missing endian')); - - if (buffer === undefined) - throw (new Error('missing buffer')); - - if (offset === undefined) - throw (new Error('missing offset')); - - if (offset + 7 >= buffer.length) - throw (new Error('Trying to read beyond buffer length')); - - /* Normalize the bytes to be in endian order */ - if (endian == 'big') { - bytes[0] = buffer[offset]; - bytes[1] = buffer[offset+1]; - bytes[2] = buffer[offset+2]; - bytes[3] = buffer[offset+3]; - bytes[4] = buffer[offset+4]; - bytes[5] = buffer[offset+5]; - bytes[6] = buffer[offset+6]; - bytes[7] = buffer[offset+7]; - } else { - bytes[7] = buffer[offset]; - bytes[6] = buffer[offset+1]; - bytes[5] = buffer[offset+2]; - bytes[4] = buffer[offset+3]; - bytes[3] = buffer[offset+4]; - bytes[2] = buffer[offset+5]; - bytes[1] = buffer[offset+6]; - bytes[0] = buffer[offset+7]; - } - - /* + var bytes = []; + var sign, exponent, mantissa, val, lowmant; + var bias = 1023; + var maxexp = 0x7ff; + + if (endian === undefined) + throw (new Error("missing endian")); + + if (buffer === undefined) + throw (new Error("missing buffer")); + + if (offset === undefined) + throw (new Error("missing offset")); + + if (offset + 7 >= buffer.length) + throw (new Error("Trying to read beyond buffer length")); + + /* Normalize the bytes to be in endian order */ + if (endian == "big") { + bytes[0] = buffer[offset]; + bytes[1] = buffer[offset+1]; + bytes[2] = buffer[offset+2]; + bytes[3] = buffer[offset+3]; + bytes[4] = buffer[offset+4]; + bytes[5] = buffer[offset+5]; + bytes[6] = buffer[offset+6]; + bytes[7] = buffer[offset+7]; + } else { + bytes[7] = buffer[offset]; + bytes[6] = buffer[offset+1]; + bytes[5] = buffer[offset+2]; + bytes[4] = buffer[offset+3]; + bytes[3] = buffer[offset+4]; + bytes[2] = buffer[offset+5]; + bytes[1] = buffer[offset+6]; + bytes[0] = buffer[offset+7]; + } + + /* * We can construct the exponent and mantissa the same way as we did in * the case of a float, just increase the range of the exponent. */ - sign = bytes[0] & 0x80; - exponent = (bytes[0] & 0x7f) << 4; - exponent |= (bytes[1] & 0xf0) >>> 4; + sign = bytes[0] & 0x80; + exponent = (bytes[0] & 0x7f) << 4; + exponent |= (bytes[1] & 0xf0) >>> 4; - /* + /* * This is going to be ugly but then again, we're dealing with IEEE 754. * This could probably be done as a node add on in a few lines of C++, * but oh we'll, we've made it this far so let's be native the rest of @@ -634,52 +634,52 @@ function rdouble(buffer, endian, offset) * really that great. It's pretty much a giant kludge to deal with * Javascript eccentricities around numbers. */ - lowmant = bytes[7]; - lowmant |= bytes[6] << 8; - lowmant |= bytes[5] << 16; - mantissa = bytes[4]; - mantissa |= bytes[3] << 8; - mantissa |= bytes[2] << 16; - mantissa |= (bytes[1] & 0x0f) << 24; - mantissa *= Math.pow(2, 24); /* Equivalent to << 24, but JS compat */ - mantissa += lowmant; - - /* Check for special cases before we do general parsing */ - if (!sign && exponent == maxexp && mantissa === 0) - return (Number.POSITIVE_INFINITY); - - if (sign && exponent == maxexp && mantissa === 0) - return (Number.NEGATIVE_INFINITY); - - if (exponent == maxexp && mantissa !== 0) - return (Number.NaN); - - /* + lowmant = bytes[7]; + lowmant |= bytes[6] << 8; + lowmant |= bytes[5] << 16; + mantissa = bytes[4]; + mantissa |= bytes[3] << 8; + mantissa |= bytes[2] << 16; + mantissa |= (bytes[1] & 0x0f) << 24; + mantissa *= Math.pow(2, 24); /* Equivalent to << 24, but JS compat */ + mantissa += lowmant; + + /* Check for special cases before we do general parsing */ + if (!sign && exponent == maxexp && mantissa === 0) + return (Number.POSITIVE_INFINITY); + + if (sign && exponent == maxexp && mantissa === 0) + return (Number.NEGATIVE_INFINITY); + + if (exponent == maxexp && mantissa !== 0) + return (Number.NaN); + + /* * Javascript really doesn't have support for positive or negative zero. * So we're not going to try and give it to you. That would be just * plain weird. Besides -0 == 0. */ - if (exponent === 0 && mantissa === 0) - return (0); + if (exponent === 0 && mantissa === 0) + return (0); - /* + /* * Now we can deal with the bias and the determine whether the mantissa * has the implicit one or not. */ - exponent -= bias; - if (exponent == -bias) { - exponent++; - val = 0; - } else { - val = 1; - } + exponent -= bias; + if (exponent == -bias) { + exponent++; + val = 0; + } else { + val = 1; + } - val = (val + mantissa * Math.pow(2, -52)) * Math.pow(2, exponent); + val = (val + mantissa * Math.pow(2, -52)) * Math.pow(2, exponent); - if (sign) - val *= -1; + if (sign) + val *= -1; - return (val); + return (val); } /* @@ -710,21 +710,19 @@ function rdouble(buffer, endian, offset) */ function prepuint(value, max) { - if (typeof (value) != 'number') - throw (new (Error('cannot write a non-number as a number'))); + if (typeof (value) != "number") + throw (new (Error("cannot write a non-number as a number"))); - if (value < 0) - throw (new Error('specified a negative value for writing an ' + - 'unsigned value')); + if (value < 0) + throw (new Error("specified a negative value for writing an unsigned value")); - if (value > max) - throw (new Error('value is larger than maximum value for ' + - 'type')); + if (value > max) + throw (new Error("value is larger than maximum value for type")); - if (Math.floor(value) !== value) - throw (new Error('value has a fractional component')); + if (Math.floor(value) !== value) + throw (new Error("value has a fractional component")); - return (value); + return (value); } /* @@ -732,25 +730,25 @@ function prepuint(value, max) */ function wuint8(value, endian, buffer, offset) { - var val; + var val; - if (value === undefined) - throw (new Error('missing value')); + if (value === undefined) + throw (new Error("missing value")); - if (endian === undefined) - throw (new Error('missing endian')); + if (endian === undefined) + throw (new Error("missing endian")); - if (buffer === undefined) - throw (new Error('missing buffer')); + if (buffer === undefined) + throw (new Error("missing buffer")); - if (offset === undefined) - throw (new Error('missing offset')); + if (offset === undefined) + throw (new Error("missing offset")); - if (offset >= buffer.length && buffer instanceof Buffer) - throw (new Error('Trying to write beyond buffer length')); + if (offset >= buffer.length && buffer instanceof Buffer) + throw (new Error("Trying to write beyond buffer length")); - val = prepuint(value, 0xff); - buffer[offset] = val; + val = prepuint(value, 0xff); + buffer[offset] = val; } /* @@ -759,31 +757,31 @@ function wuint8(value, endian, buffer, offset) */ function wuint16(value, endian, buffer, offset) { - var val; + var val; - if (value === undefined) - throw (new Error('missing value')); + if (value === undefined) + throw (new Error("missing value")); - if (endian === undefined) - throw (new Error('missing endian')); + if (endian === undefined) + throw (new Error("missing endian")); - if (buffer === undefined) - throw (new Error('missing buffer')); + if (buffer === undefined) + throw (new Error("missing buffer")); - if (offset === undefined) - throw (new Error('missing offset')); + if (offset === undefined) + throw (new Error("missing offset")); - if (offset + 1 >= buffer.length && buffer instanceof Buffer) - throw (new Error('Trying to write beyond buffer length')); + if (offset + 1 >= buffer.length && buffer instanceof Buffer) + throw (new Error("Trying to write beyond buffer length")); - val = prepuint(value, 0xffff); - if (endian == 'big') { - buffer[offset] = (val & 0xff00) >>> 8; - buffer[offset+1] = val & 0x00ff; - } else { - buffer[offset+1] = (val & 0xff00) >>> 8; - buffer[offset] = val & 0x00ff; - } + val = prepuint(value, 0xffff); + if (endian == "big") { + buffer[offset] = (val & 0xff00) >>> 8; + buffer[offset+1] = val & 0x00ff; + } else { + buffer[offset+1] = (val & 0xff00) >>> 8; + buffer[offset] = val & 0x00ff; + } } /* @@ -799,36 +797,35 @@ function wuint16(value, endian, buffer, offset) */ function wuint32(value, endian, buffer, offset) { - var val; - - if (value === undefined) - throw (new Error('missing value')); - - if (endian === undefined) - throw (new Error('missing endian')); - - if (buffer === undefined) - throw (new Error('missing buffer')); - - if (offset === undefined) - throw (new Error('missing offset')); - - if (offset + 3 >= buffer.length && buffer instanceof Buffer) - throw (new Error('Trying to write beyond buffer length')); - - val = prepuint(value, 0xffffffff); - if (endian == 'big') { - buffer[offset] = (val - (val & 0x00ffffff)) / Math.pow(2, 24); - buffer[offset+1] = (val >>> 16) & 0xff; - buffer[offset+2] = (val >>> 8) & 0xff; - buffer[offset+3] = val & 0xff; - } else { - buffer[offset+3] = (val - (val & 0x00ffffff)) / - Math.pow(2, 24); - buffer[offset+2] = (val >>> 16) & 0xff; - buffer[offset+1] = (val >>> 8) & 0xff; - buffer[offset] = val & 0xff; - } + var val; + + if (value === undefined) + throw (new Error("missing value")); + + if (endian === undefined) + throw (new Error("missing endian")); + + if (buffer === undefined) + throw (new Error("missing buffer")); + + if (offset === undefined) + throw (new Error("missing offset")); + + if (offset + 3 >= buffer.length && buffer instanceof Buffer) + throw (new Error("Trying to write beyond buffer length")); + + val = prepuint(value, 0xffffffff); + if (endian == "big") { + buffer[offset] = (val - (val & 0x00ffffff)) / Math.pow(2, 24); + buffer[offset+1] = (val >>> 16) & 0xff; + buffer[offset+2] = (val >>> 8) & 0xff; + buffer[offset+3] = val & 0xff; + } else { + buffer[offset+3] = (val - (val & 0x00ffffff)) / Math.pow(2, 24); + buffer[offset+2] = (val >>> 16) & 0xff; + buffer[offset+1] = (val >>> 8) & 0xff; + buffer[offset] = val & 0xff; + } } /* @@ -838,37 +835,37 @@ function wuint32(value, endian, buffer, offset) */ function wuint64(value, endian, buffer, offset) { - if (value === undefined) - throw (new Error('missing value')); + if (value === undefined) + throw (new Error("missing value")); - if (!(value instanceof Array)) - throw (new Error('value must be an array')); + if (!(value instanceof Array)) + throw (new Error("value must be an array")); - if (value.length != 2) - throw (new Error('value must be an array of length 2')); + if (value.length != 2) + throw (new Error("value must be an array of length 2")); - if (endian === undefined) - throw (new Error('missing endian')); + if (endian === undefined) + throw (new Error("missing endian")); - if (buffer === undefined) - throw (new Error('missing buffer')); + if (buffer === undefined) + throw (new Error("missing buffer")); - if (offset === undefined) - throw (new Error('missing offset')); + if (offset === undefined) + throw (new Error("missing offset")); - if (offset + 7 >= buffer.length && buffer instanceof Buffer) - throw (new Error('Trying to write beyond buffer length')); + if (offset + 7 >= buffer.length && buffer instanceof Buffer) + throw (new Error("Trying to write beyond buffer length")); - prepuint(value[0], 0xffffffff); - prepuint(value[1], 0xffffffff); + prepuint(value[0], 0xffffffff); + prepuint(value[1], 0xffffffff); - if (endian == 'big') { - wuint32(value[0], endian, buffer, offset); - wuint32(value[1], endian, buffer, offset+3); - } else { - wuint32(value[0], endian, buffer, offset+3); - wuint32(value[1], endian, buffer, offset); - } + if (endian == "big") { + wuint32(value[0], endian, buffer, offset); + wuint32(value[1], endian, buffer, offset+3); + } else { + wuint32(value[0], endian, buffer, offset+3); + wuint32(value[1], endian, buffer, offset); + } } /* @@ -921,19 +918,19 @@ function wuint64(value, endian, buffer, offset) */ function prepsint(value, max, min) { - if (typeof (value) != 'number') - throw (new (Error('cannot write a non-number as a number'))); + if (typeof (value) != "number") + throw (new (Error("cannot write a non-number as a number"))); - if (value > max) - throw (new Error('value larger than maximum allowed value')); + if (value > max) + throw (new Error("value larger than maximum allowed value")); - if (value < min) - throw (new Error('value smaller than minimum allowed value')); + if (value < min) + throw (new Error("value smaller than minimum allowed value")); - if (Math.floor(value) !== value) - throw (new Error('value has a fractional component')); + if (Math.floor(value) !== value) + throw (new Error("value has a fractional component")); - return (value); + return (value); } /* @@ -941,28 +938,28 @@ function prepsint(value, max, min) */ function wsint8(value, endian, buffer, offset) { - var val; + var val; - if (value === undefined) - throw (new Error('missing value')); + if (value === undefined) + throw (new Error("missing value")); - if (endian === undefined) - throw (new Error('missing endian')); + if (endian === undefined) + throw (new Error("missing endian")); - if (buffer === undefined) - throw (new Error('missing buffer')); + if (buffer === undefined) + throw (new Error("missing buffer")); - if (offset === undefined) - throw (new Error('missing offset')); + if (offset === undefined) + throw (new Error("missing offset")); - if (offset >= buffer.length && buffer instanceof Buffer) - throw (new Error('Trying to write beyond buffer length')); + if (offset >= buffer.length && buffer instanceof Buffer) + throw (new Error("Trying to write beyond buffer length")); - val = prepsint(value, 0x7f, -0xf0); - if (val >= 0) - wuint8(val, endian, buffer, offset); - else - wuint8(0xff + val + 1, endian, buffer, offset); + val = prepsint(value, 0x7f, -0xf0); + if (val >= 0) + wuint8(val, endian, buffer, offset); + else + wuint8(0xff + val + 1, endian, buffer, offset); } /* @@ -970,28 +967,28 @@ function wsint8(value, endian, buffer, offset) */ function wsint16(value, endian, buffer, offset) { - var val; + var val; - if (value === undefined) - throw (new Error('missing value')); + if (value === undefined) + throw (new Error("missing value")); - if (endian === undefined) - throw (new Error('missing endian')); + if (endian === undefined) + throw (new Error("missing endian")); - if (buffer === undefined) - throw (new Error('missing buffer')); + if (buffer === undefined) + throw (new Error("missing buffer")); - if (offset === undefined) - throw (new Error('missing offset')); + if (offset === undefined) + throw (new Error("missing offset")); - if (offset + 1 >= buffer.length && buffer instanceof Buffer) - throw (new Error('Trying to write beyond buffer length')); + if (offset + 1 >= buffer.length && buffer instanceof Buffer) + throw (new Error("Trying to write beyond buffer length")); - val = prepsint(value, 0x7fff, -0xf000); - if (val >= 0) - wuint16(val, endian, buffer, offset); - else - wuint16(0xffff + val + 1, endian, buffer, offset); + val = prepsint(value, 0x7fff, -0xf000); + if (val >= 0) + wuint16(val, endian, buffer, offset); + else + wuint16(0xffff + val + 1, endian, buffer, offset); } @@ -1001,28 +998,28 @@ function wsint16(value, endian, buffer, offset) */ function wsint32(value, endian, buffer, offset) { - var val; + var val; - if (value === undefined) - throw (new Error('missing value')); + if (value === undefined) + throw (new Error("missing value")); - if (endian === undefined) - throw (new Error('missing endian')); + if (endian === undefined) + throw (new Error("missing endian")); - if (buffer === undefined) - throw (new Error('missing buffer')); + if (buffer === undefined) + throw (new Error("missing buffer")); - if (offset === undefined) - throw (new Error('missing offset')); + if (offset === undefined) + throw (new Error("missing offset")); - if (offset + 3 >= buffer.length && buffer instanceof Buffer) - throw (new Error('Trying to write beyond buffer length')); + if (offset + 3 >= buffer.length && buffer instanceof Buffer) + throw (new Error("Trying to write beyond buffer length")); - val = prepsint(value, 0x7fffffff, -0xf0000000); - if (val >= 0) - wuint32(val, endian, buffer, offset); - else - wuint32(0xffffffff + val + 1, endian, buffer, offset); + val = prepsint(value, 0x7fffffff, -0xf0000000); + if (val >= 0) + wuint32(val, endian, buffer, offset); + else + wuint32(0xffffffff + val + 1, endian, buffer, offset); } /* @@ -1032,52 +1029,52 @@ function wsint32(value, endian, buffer, offset) */ function wsint64(value, endian, buffer, offset) { - var vals = new Array(2); - - if (value === undefined) - throw (new Error('missing value')); - - if (!(value instanceof Array)) - throw (new Error('value must be an array')); - - if (value.length != 2) - throw (new Error('value must be an array of length 2')); - - if (endian === undefined) - throw (new Error('missing endian')); - - if (buffer === undefined) - throw (new Error('missing buffer')); - - if (offset === undefined) - throw (new Error('missing offset')); - - if (offset + 7 >= buffer.length && buffer instanceof Buffer) - throw (new Error('Trying to write beyond buffer length')); - - prepsint(value[0], 0x7fffffff, -0xf0000000); - prepsint(value[1], 0xffffffff, -0xffffffff); - - /* Fix negative numbers */ - if (value[0] < 0 || value[1] < 0) { - vals[0] = 0xffffffff - Math.abs(value[0]); - vals[1] = 0x100000000 - Math.abs(value[1]); - if (vals[1] == 0x100000000) { - vals[1] = 0; - vals[0]++; - } - } else { - vals[0] = value[0]; - vals[1] = value[1]; - } - - if (endian == 'big') { - wuint32(vals[0], endian, buffer, offset); - wuint32(vals[1], endian, buffer, offset+4); - } else { - wuint32(vals[0], endian, buffer, offset+4); - wuint32(vals[1], endian, buffer, offset); - } + var vals = new Array(2); + + if (value === undefined) + throw (new Error("missing value")); + + if (!(value instanceof Array)) + throw (new Error("value must be an array")); + + if (value.length != 2) + throw (new Error("value must be an array of length 2")); + + if (endian === undefined) + throw (new Error("missing endian")); + + if (buffer === undefined) + throw (new Error("missing buffer")); + + if (offset === undefined) + throw (new Error("missing offset")); + + if (offset + 7 >= buffer.length && buffer instanceof Buffer) + throw (new Error("Trying to write beyond buffer length")); + + prepsint(value[0], 0x7fffffff, -0xf0000000); + prepsint(value[1], 0xffffffff, -0xffffffff); + + /* Fix negative numbers */ + if (value[0] < 0 || value[1] < 0) { + vals[0] = 0xffffffff - Math.abs(value[0]); + vals[1] = 0x100000000 - Math.abs(value[1]); + if (vals[1] == 0x100000000) { + vals[1] = 0; + vals[0]++; + } + } else { + vals[0] = value[0]; + vals[1] = value[1]; + } + + if (endian == "big") { + wuint32(vals[0], endian, buffer, offset); + wuint32(vals[1], endian, buffer, offset+4); + } else { + wuint32(vals[0], endian, buffer, offset+4); + wuint32(vals[1], endian, buffer, offset); + } } /* @@ -1155,7 +1152,7 @@ function wsint64(value, endian, buffer, offset) */ function log2(value) { - return (Math.log(value) / Math.log(2)); + return (Math.log(value) / Math.log(2)); } /* @@ -1163,7 +1160,7 @@ function log2(value) */ function intexp(value) { - return (Math.floor(log2(value))); + return (Math.floor(log2(value))); } /* @@ -1171,86 +1168,86 @@ function intexp(value) */ function fracexp(value) { - return (Math.floor(log2(value))); + return (Math.floor(log2(value))); } function wfloat(value, endian, buffer, offset) { - var sign, exponent, mantissa, ebits; - var bytes = []; - - if (value === undefined) - throw (new Error('missing value')); - - if (endian === undefined) - throw (new Error('missing endian')); - - if (buffer === undefined) - throw (new Error('missing buffer')); - - if (offset === undefined) - throw (new Error('missing offset')); - - - if (offset + 3 >= buffer.length && buffer instanceof Buffer) - throw (new Error('Trying to write beyond buffer length')); - - if (isNaN(value)) { - sign = 0; - exponent = 0xff; - mantissa = 23; - } else if (value == Number.POSITIVE_INFINITY) { - sign = 0; - exponent = 0xff; - mantissa = 0; - } else if (value == Number.NEGATIVE_INFINITY) { - sign = 1; - exponent = 0xff; - mantissa = 0; - } else { - /* Well we have some work to do */ - - /* Thankfully the sign bit is trivial */ - if (value < 0) { - sign = 1; - value = Math.abs(value); - } else { - sign = 0; - } - - /* Use the correct function to determine number of bits */ - if (value < 1) - ebits = fracexp(value); - else - ebits = intexp(value); - - /* Time to deal with the issues surrounding normalization */ - if (ebits <= -127) { - exponent = 0; - mantissa = (value * Math.pow(2, 149)) & 0x7fffff; - } else { - exponent = 127 + ebits; - mantissa = value * Math.pow(2, 23 - ebits); - mantissa &= 0x7fffff; - } - } - - bytes[0] = sign << 7 | (exponent & 0xfe) >>> 1; - bytes[1] = (exponent & 0x01) << 7 | (mantissa & 0x7f0000) >>> 16; - bytes[2] = (mantissa & 0x00ff00) >>> 8; - bytes[3] = mantissa & 0x0000ff; - - if (endian == 'big') { - buffer[offset] = bytes[0]; - buffer[offset+1] = bytes[1]; - buffer[offset+2] = bytes[2]; - buffer[offset+3] = bytes[3]; - } else { - buffer[offset] = bytes[3]; - buffer[offset+1] = bytes[2]; - buffer[offset+2] = bytes[1]; - buffer[offset+3] = bytes[0]; - } + var sign, exponent, mantissa, ebits; + var bytes = []; + + if (value === undefined) + throw (new Error("missing value")); + + if (endian === undefined) + throw (new Error("missing endian")); + + if (buffer === undefined) + throw (new Error("missing buffer")); + + if (offset === undefined) + throw (new Error("missing offset")); + + + if (offset + 3 >= buffer.length && buffer instanceof Buffer) + throw (new Error("Trying to write beyond buffer length")); + + if (isNaN(value)) { + sign = 0; + exponent = 0xff; + mantissa = 23; + } else if (value == Number.POSITIVE_INFINITY) { + sign = 0; + exponent = 0xff; + mantissa = 0; + } else if (value == Number.NEGATIVE_INFINITY) { + sign = 1; + exponent = 0xff; + mantissa = 0; + } else { + /* Well we have some work to do */ + + /* Thankfully the sign bit is trivial */ + if (value < 0) { + sign = 1; + value = Math.abs(value); + } else { + sign = 0; + } + + /* Use the correct function to determine number of bits */ + if (value < 1) + ebits = fracexp(value); + else + ebits = intexp(value); + + /* Time to deal with the issues surrounding normalization */ + if (ebits <= -127) { + exponent = 0; + mantissa = (value * Math.pow(2, 149)) & 0x7fffff; + } else { + exponent = 127 + ebits; + mantissa = value * Math.pow(2, 23 - ebits); + mantissa &= 0x7fffff; + } + } + + bytes[0] = sign << 7 | (exponent & 0xfe) >>> 1; + bytes[1] = (exponent & 0x01) << 7 | (mantissa & 0x7f0000) >>> 16; + bytes[2] = (mantissa & 0x00ff00) >>> 8; + bytes[3] = mantissa & 0x0000ff; + + if (endian == "big") { + buffer[offset] = bytes[0]; + buffer[offset+1] = bytes[1]; + buffer[offset+2] = bytes[2]; + buffer[offset+3] = bytes[3]; + } else { + buffer[offset] = bytes[3]; + buffer[offset+1] = bytes[2]; + buffer[offset+2] = bytes[1]; + buffer[offset+3] = bytes[0]; + } } /* @@ -1315,55 +1312,55 @@ function wfloat(value, endian, buffer, offset) */ function wdouble(value, endian, buffer, offset) { - var sign, exponent, mantissa, ebits; - var bytes = []; - - if (value === undefined) - throw (new Error('missing value')); - - if (endian === undefined) - throw (new Error('missing endian')); - - if (buffer === undefined) - throw (new Error('missing buffer')); - - if (offset === undefined) - throw (new Error('missing offset')); - - - if (offset + 7 >= buffer.length && buffer instanceof Buffer) - throw (new Error('Trying to write beyond buffer length')); - - if (isNaN(value)) { - sign = 0; - exponent = 0x7ff; - mantissa = 23; - } else if (value == Number.POSITIVE_INFINITY) { - sign = 0; - exponent = 0x7ff; - mantissa = 0; - } else if (value == Number.NEGATIVE_INFINITY) { - sign = 1; - exponent = 0x7ff; - mantissa = 0; - } else { - /* Well we have some work to do */ - - /* Thankfully the sign bit is trivial */ - if (value < 0) { - sign = 1; - value = Math.abs(value); - } else { - sign = 0; - } - - /* Use the correct function to determine number of bits */ - if (value < 1) - ebits = fracexp(value); - else - ebits = intexp(value); - - /* + var sign, exponent, mantissa, ebits; + var bytes = []; + + if (value === undefined) + throw (new Error("missing value")); + + if (endian === undefined) + throw (new Error("missing endian")); + + if (buffer === undefined) + throw (new Error("missing buffer")); + + if (offset === undefined) + throw (new Error("missing offset")); + + + if (offset + 7 >= buffer.length && buffer instanceof Buffer) + throw (new Error("Trying to write beyond buffer length")); + + if (isNaN(value)) { + sign = 0; + exponent = 0x7ff; + mantissa = 23; + } else if (value == Number.POSITIVE_INFINITY) { + sign = 0; + exponent = 0x7ff; + mantissa = 0; + } else if (value == Number.NEGATIVE_INFINITY) { + sign = 1; + exponent = 0x7ff; + mantissa = 0; + } else { + /* Well we have some work to do */ + + /* Thankfully the sign bit is trivial */ + if (value < 0) { + sign = 1; + value = Math.abs(value); + } else { + sign = 0; + } + + /* Use the correct function to determine number of bits */ + if (value < 1) + ebits = fracexp(value); + else + ebits = intexp(value); + + /* * This is a total hack to determine a denormalized value. * Unfortunately, we sometimes do not get a proper value for * ebits, i.e. we lose the values that would get rounded off. @@ -1384,12 +1381,12 @@ function wdouble(value, endian, buffer, offset) * Does not cause us to overflow. Go figure. * */ - if (value <= 2.225073858507201e-308 || ebits <= -1023) { - exponent = 0; - mantissa = value * Math.pow(2, 1023) * Math.pow(2, 51); - mantissa %= Math.pow(2, 52); - } else { - /* + if (value <= 2.225073858507201e-308 || ebits <= -1023) { + exponent = 0; + mantissa = value * Math.pow(2, 1023) * Math.pow(2, 51); + mantissa %= Math.pow(2, 52); + } else { + /* * We might have gotten fucked by our floating point * logarithm magic. This is rather crappy, but that's * our luck. If we just had a log base 2 or access to @@ -1397,45 +1394,45 @@ function wdouble(value, endian, buffer, offset) * been much easier and we wouldn't have such stupid * kludges or hacks. */ - if (ebits > 1023) - ebits = 1023; - exponent = 1023 + ebits; - mantissa = value * Math.pow(2, -ebits); - mantissa *= Math.pow(2, 52); - mantissa %= Math.pow(2, 52); - } - } - - /* Fill the bytes in backwards to deal with the size issues */ - bytes[7] = mantissa & 0xff; - bytes[6] = (mantissa >>> 8) & 0xff; - bytes[5] = (mantissa >>> 16) & 0xff; - mantissa = (mantissa - (mantissa & 0xffffff)) / Math.pow(2, 24); - bytes[4] = mantissa & 0xff; - bytes[3] = (mantissa >>> 8) & 0xff; - bytes[2] = (mantissa >>> 16) & 0xff; - bytes[1] = (exponent & 0x00f) << 4 | mantissa >>> 24; - bytes[0] = (sign << 7) | (exponent & 0x7f0) >>> 4; - - if (endian == 'big') { - buffer[offset] = bytes[0]; - buffer[offset+1] = bytes[1]; - buffer[offset+2] = bytes[2]; - buffer[offset+3] = bytes[3]; - buffer[offset+4] = bytes[4]; - buffer[offset+5] = bytes[5]; - buffer[offset+6] = bytes[6]; - buffer[offset+7] = bytes[7]; - } else { - buffer[offset+7] = bytes[0]; - buffer[offset+6] = bytes[1]; - buffer[offset+5] = bytes[2]; - buffer[offset+4] = bytes[3]; - buffer[offset+3] = bytes[4]; - buffer[offset+2] = bytes[5]; - buffer[offset+1] = bytes[6]; - buffer[offset] = bytes[7]; - } + if (ebits > 1023) + ebits = 1023; + exponent = 1023 + ebits; + mantissa = value * Math.pow(2, -ebits); + mantissa *= Math.pow(2, 52); + mantissa %= Math.pow(2, 52); + } + } + + /* Fill the bytes in backwards to deal with the size issues */ + bytes[7] = mantissa & 0xff; + bytes[6] = (mantissa >>> 8) & 0xff; + bytes[5] = (mantissa >>> 16) & 0xff; + mantissa = (mantissa - (mantissa & 0xffffff)) / Math.pow(2, 24); + bytes[4] = mantissa & 0xff; + bytes[3] = (mantissa >>> 8) & 0xff; + bytes[2] = (mantissa >>> 16) & 0xff; + bytes[1] = (exponent & 0x00f) << 4 | mantissa >>> 24; + bytes[0] = (sign << 7) | (exponent & 0x7f0) >>> 4; + + if (endian == "big") { + buffer[offset] = bytes[0]; + buffer[offset+1] = bytes[1]; + buffer[offset+2] = bytes[2]; + buffer[offset+3] = bytes[3]; + buffer[offset+4] = bytes[4]; + buffer[offset+5] = bytes[5]; + buffer[offset+6] = bytes[6]; + buffer[offset+7] = bytes[7]; + } else { + buffer[offset+7] = bytes[0]; + buffer[offset+6] = bytes[1]; + buffer[offset+5] = bytes[2]; + buffer[offset+4] = bytes[3]; + buffer[offset+3] = bytes[4]; + buffer[offset+2] = bytes[5]; + buffer[offset+1] = bytes[6]; + buffer[offset] = bytes[7]; + } } /* diff --git a/lib/ctype.js b/lib/ctype.js index 4c5685c..34863b2 100644 --- a/lib/ctype.js +++ b/lib/ctype.js @@ -87,8 +87,8 @@ * */ -var mod_ctio = require('./ctio.js'); -var ASSERT = require('assert'); +var mod_ctio = require("./ctio.js"); +var ASSERT = require("assert"); /* * This is the set of basic types that we support. @@ -99,43 +99,43 @@ var ASSERT = require('assert'); * */ var deftypes = { - 'uint8_t' : { + "uint8_t" : { read : ctReadUint8, write : ctWriteUint8 }, - 'uint16_t' : { + "uint16_t" : { read : ctReadUint16, write : ctWriteUint16 }, - 'uint32_t' : { + "uint32_t" : { read : ctReadUint32, write : ctWriteUint32 }, - 'int8_t' : { + "int8_t" : { read : ctReadSint8, write : ctWriteSint8 }, - 'int16_t' : { + "int16_t" : { read : ctReadSint16, write : ctWriteSint16 }, - 'int32_t' : { + "int32_t" : { read : ctReadSint32, write : ctWriteSint32 }, - 'float' : { + "float" : { read : ctReadFloat, write : ctWriteFloat }, - 'double' : { + "double" : { read : ctReadDouble, write : ctWriteDouble }, - 'char' : { + "char" : { read : ctReadChar, write : ctWriteChar }, - 'char[]' : { + "char[]" : { read : ctReadCharArray, write : ctWriteCharArray } @@ -226,7 +226,7 @@ function ctReadCharArray(length, endian, buffer, offset) { var res = new Buffer(length); for( ii = 0; ii < length; ii++) - res[ii] = mod_ctio.ruint8(buffer, endian, offset + ii); + res[ii] = mod_ctio.ruint8(buffer, endian, offset + ii); return ( { value : res, @@ -279,7 +279,7 @@ function ctWriteDouble(value, endian, buffer, offset) { */ function ctWriteChar(value, endian, buffer, offset) { if(!( value instanceof Buffer)) - throw (new Error('Input must be a buffer')); + throw (new Error("Input must be a buffer")); mod_ctio.ruint8(value[0], endian, buffer, offset); return (1); @@ -293,16 +293,16 @@ function ctWriteCharArray(value, length, endian, buffer, offset) { var ii; if(!( value instanceof Buffer)) - throw (new Error('Input must be a buffer')); + throw (new Error("Input must be a buffer")); if(value.length > length) - throw (new Error('value length greater than array length')); + throw (new Error("value length greater than array length")); for( ii = 0; ii < value.length && ii < length; ii++) - mod_ctio.wuint8(value[ii], endian, buffer, offset + ii); + mod_ctio.wuint8(value[ii], endian, buffer, offset + ii); for(; ii < length; ii++) - mod_ctio.wuint8(0, endian, offset + ii); + mod_ctio.wuint8(0, endian, offset + ii); return (length); } @@ -316,7 +316,7 @@ function ctGetBasicTypes() { var ret = {}; var key; for(key in deftypes) - ret[key] = deftypes[key]; + ret[key] = deftypes[key]; return (ret); } @@ -331,23 +331,23 @@ function ctGetBasicTypes() { function ctParseType(str) { var begInd, endInd; var type, len; - if( typeof (str) != 'string') - throw (new Error('type must be a Javascript string')); - endInd = str.lastIndexOf(']'); + if( typeof (str) != "string") + throw (new Error("type must be a Javascript string")); + endInd = str.lastIndexOf("]"); if(endInd == -1) { - if(str.lastIndexOf('[') != -1) - throw (new Error('found invalid type with \'[\' but ' + 'no corresponding \']\'')); + if(str.lastIndexOf("[") != -1) + throw (new Error("found invalid type with '[' but " + "no corresponding ']'")); return ( { type : str }); } - begInd = str.lastIndexOf('['); + begInd = str.lastIndexOf("["); if(begInd == -1) - throw (new Error('found invalid type with \']\' but ' + 'no corresponding \'[\'')); + throw (new Error("found invalid type with ']' but " + "no corresponding '['")); if(begInd >= endInd) - throw (new Error('malformed type, \']\' appears before \'[\'')); + throw (new Error("malformed type, ']' appears before '['")); type = str.substring(0, begInd); len = str.substring(begInd + 1, endInd); @@ -368,29 +368,29 @@ function ctParseType(str) { */ function ctCheckReq(def, types, fields) { var ii, jj; - var req, keys, key, exists; + var req, keys, key; var found = {}; if(!( def instanceof Array)) - throw (new Error('definition is not an array')); + throw (new Error("definition is not an array")); if(def.length === 0) - throw (new Error('definition must have at least one element')); + throw (new Error("definition must have at least one element")); for( ii = 0; ii < def.length; ii++) { req = def[ii]; if(!( req instanceof Object)) - throw (new Error('definition must be an array of' + 'objects')); + throw (new Error("definition must be an array of" + "objects")); keys = Object.keys(req); if(keys.length != 1) - throw (new Error('definition entry must only have ' + 'one key')); + throw (new Error("definition entry must only have " + "one key")); if(keys[0] in found) - throw (new Error('Specified name already ' + 'specified: ' + keys[0])); + throw (new Error("Specified name already " + "specified: " + keys[0])); - if(!('type' in req[keys[0]])) - throw (new Error('missing required type definition')); - key = ctParseType(req[keys[0]]['type']); + if(!("type" in req[keys[0]])) + throw (new Error("missing required type definition")); + key = ctParseType(req[keys[0]]["type"]); /* * We may have nested arrays, we need to check the validity of @@ -398,25 +398,25 @@ function ctCheckReq(def, types, fields) { * each time len is defined we need to verify it is either an * integer or corresponds to an already seen key. */ - while(key['len'] !== undefined) { - if(isNaN(parseInt(key['len'], 10))) { - exists = false; - if(!(key['len'] in found)) - throw (new Error('Given an array ' + 'length without a matching type')); + while(key["len"] !== undefined) { + if(isNaN(parseInt(key["len"], 10))) { + + if(!(key["len"] in found)) + throw (new Error("Given an array " + "length without a matching type")); } - key = ctParseType(key['type']); + key = ctParseType(key["type"]); } /* Now we can validate if the type is valid */ - if(!(key['type'] in types)) - throw (new Error('type not found or typdefed: ' + key['type'])); + if(!(key["type"] in types)) + throw (new Error("type not found or typdefed: " + key["type"])); /* Check for any required fields */ if(fields !== undefined) { for( jj = 0; jj < fields.length; jj++) { if(!(fields[jj] in req[keys[0]])) - throw (new Error('Missing required ' + 'field: ' + fields[jj])); + throw (new Error("Missing required " + "field: " + fields[jj])); } } @@ -434,15 +434,15 @@ function ctCheckReq(def, types, fields) { */ function CTypeParser(conf) { if(!conf) - throw (new Error('missing required argument')); + throw (new Error("missing required argument")); - if(!('endian' in conf)) - throw (new Error('missing required endian value')); + if(!("endian" in conf)) + throw (new Error("missing required endian value")); - if(conf['endian'] != 'big' && conf['endian'] != 'little') - throw (new Error('Invalid endian type')); + if(conf["endian"] != "big" && conf["endian"] != "little") + throw (new Error("Invalid endian type")); - this.endian = conf['endian']; + this.endian = conf["endian"]; this.types = ctGetBasicTypes(); } @@ -455,8 +455,8 @@ function CTypeParser(conf) { * */ CTypeParser.prototype.setEndian = function(endian) { - if(endian != 'big' || endian != 'little') - throw (new Error('invalid endian type, must be big or ' + ' little')); + if(endian != "big" || endian != "little") + throw (new Error("invalid endian type, must be big or " + " little")); this.endian = endian; }; @@ -479,31 +479,31 @@ CTypeParser.prototype.typedef = function(name, value) { var type; if(name === undefined) - throw (new (Error('missing required typedef argument: name'))); + throw (new (Error("missing required typedef argument: name"))); if(value === undefined) - throw (new (Error('missing required typedef argument: value'))); + throw (new (Error("missing required typedef argument: value"))); - if( typeof (name) != 'string') - throw (new (Error('the name of a type must be a string'))); + if( typeof (name) != "string") + throw (new (Error("the name of a type must be a string"))); type = ctParseType(name); - if(type['len'] !== undefined) - throw (new Error('Cannot have an array in the typedef name')); + if(type["len"] !== undefined) + throw (new Error("Cannot have an array in the typedef name")); if( name in this.types) - throw (new Error('typedef name already present: ' + name)); + throw (new Error("typedef name already present: " + name)); - if( typeof (value) != 'string' && !( value instanceof Array)) - throw (new Error('typedef value must either be a string or ' + 'struct')); + if( typeof (value) != "string" && !( value instanceof Array)) + throw (new Error("typedef value must either be a string or " + "struct")); - if( typeof (value) == 'string') { + if( typeof (value) == "string") { type = ctParseType(value); - if(type['len'] !== undefined) { - if(isNaN(parseInt(type['len'], 10))) - throw (new (Error('typedef value must use ' + - 'fixed size array when outside of a ' + - 'struct'))); + if(type["len"] !== undefined) { + if(isNaN(parseInt(type["len"], 10))) + throw (new (Error("typedef value must use " + + "fixed size array when outside of a " + + "struct"))); } this.types[name] = value; @@ -539,20 +539,20 @@ CTypeParser.prototype.lstypes = function() { * values An object that can be used to fulfill type information */ function ctResolveArray(str, values) { - var ret = ''; + var ret = ""; var type = ctParseType(str); - while(type['len'] !== undefined) { - if(isNaN(parseInt(type['len'], 10))) { - if( typeof (values[type['len']]) != 'number') - throw (new Error('cannot sawp in non-number ' + 'for array value')); - ret = '[' + values[type['len']] + ']' + ret; + while(type["len"] !== undefined) { + if(isNaN(parseInt(type["len"], 10))) { + if( typeof (values[type["len"]]) != "number") + throw (new Error("cannot sawp in non-number " + "for array value")); + ret = "[" + values[type["len"]] + "]" + ret; } else { - ret = '[' + type['len'] + ']' + ret; + ret = "[" + type["len"] + "]" + ret; } - type = ctParseType(type['type']); + type = ctParseType(type["type"]); } - ret = type['type'] + ret; + ret = type["type"] + ret; return (ret); } @@ -566,22 +566,22 @@ CTypeParser.prototype.resolveTypedef = function(type, dispatch, buffer, offset, var pt; console.log(type); ASSERT.ok( type in this.types); - console.log(type + ':' + this.types[type]); - if( typeof (this.types[type]) == 'string') { + console.log(type + ":" + this.types[type]); + if( typeof (this.types[type]) == "string") { pt = ctParseType(this.types[type]); - if(dispatch == 'read') + if(dispatch == "read") return (this.readEntry(pt, buffer, offset)); - else if(dispatch == 'write') + else if(dispatch == "write") return (this.writeEntry(value, pt, buffer, offset)); else - throw (new Error('invalid dispatch type to ' + 'resolveTypedef')); + throw (new Error("invalid dispatch type to " + "resolveTypedef")); } else { - if(dispatch == 'read') + if(dispatch == "read") return (this.readStruct(this.types[type], buffer, offset)); - else if(dispatch == 'write') + else if(dispatch == "write") return (this.readStruct(value, this.types[type], buffer, offset)); else - throw (new Error('invalid dispatch type to ' + 'resolveTypedef')); + throw (new Error("invalid dispatch type to " + "resolveTypedef")); } }; @@ -605,20 +605,20 @@ CTypeParser.prototype.readEntry = function(type, buffer, offset) { * - Generic typedef handler * - Basic type handler */ - if(type['len'] !== undefined) { - len = parseInt(type['len'], 10); + if(type["len"] !== undefined) { + len = parseInt(type["len"], 10); if(isNaN(len)) - throw (new Error('somehow got a non-numeric length')); + throw (new Error("somehow got a non-numeric length")); - if(type['type'] == 'char') - parse = deftypes['char[]']['read'](len, this.endian, buffer, offset); + if(type["type"] == "char") + parse = deftypes["char[]"]["read"](len, this.endian, buffer, offset); else - parse = this.readArray(type['type'], len, buffer, offset); + parse = this.readArray(type["type"], len, buffer, offset); } else { - if(type['type'] in deftypes) - parse = deftypes[type['type']]['read'](this.endian, buffer, offset); + if(type["type"] in deftypes) + parse = deftypes[type["type"]]["read"](this.endian, buffer, offset); else - parse = this.resolveTypedef(type['type'], 'read', buffer, offset); + parse = this.resolveTypedef(type["type"], "read", buffer, offset); } return (parse); @@ -634,8 +634,8 @@ CTypeParser.prototype.readArray = function(type, length, buffer, offset) { for( ii = 0; ii < length; ii++) { ent = this.readEntry(pt, buffer, offset); - offset += ent['size']; - ret[ii] = ent['value']; + offset += ent["size"]; + ret[ii] = ent["value"]; } return ( { @@ -657,13 +657,13 @@ CTypeParser.prototype.readStruct = function(def, buffer, offset) { entry = def[ii][key]; /* Resolve all array values */ - type = ctParseType(ctResolveArray(entry['type'], ret)); + type = ctParseType(ctResolveArray(entry["type"], ret)); - if('offset' in entry) - offset = baseOffset + entry['offset']; + if("offset" in entry) + offset = baseOffset + entry["offset"]; parse = this.readEntry(type, buffer, offset); - offset += parse['size']; - ret[key] = parse['value']; + offset += parse["size"]; + ret[key] = parse["value"]; } return ( { @@ -687,18 +687,18 @@ CTypeParser.prototype.readStruct = function(def, buffer, offset) { CTypeParser.prototype.readData = function(def, buffer, offset) { /* Sanity check for arguments */ if(def === undefined) - throw (new Error('missing definition for what we should be' + 'parsing')); + throw (new Error("missing definition for what we should be" + "parsing")); if(buffer === undefined) - throw (new Error('missing buffer for what we should be' + 'parsing')); + throw (new Error("missing buffer for what we should be" + "parsing")); if(offset === undefined) - throw (new Error('missing offset for what we should be' + 'parsing')); + throw (new Error("missing offset for what we should be" + "parsing")); /* Sanity check the object definition */ ctCheckReq(def, this.types); - return (this.readStruct(def, buffer, offset)['values']); + return (this.readStruct(def, buffer, offset)["values"]); }; /* * [private] Write out an array of data @@ -707,13 +707,13 @@ CTypeParser.prototype.writeArray = function(value, type, length, buffer, offset) var ii, pt; var baseOffset = offset; if(!( value instanceof Array)) - throw (new Error('asked to write an array, but value is not ' + 'an array')); + throw (new Error("asked to write an array, but value is not " + "an array")); if(value.length != length) - throw (new Error('asked to write array of length ' + length + ' but that does not match value length: ' + value.length)); + throw (new Error("asked to write array of length " + length + " but that does not match value length: " + value.length)); pt = ctParseType(type); for( ii = 0; ii < length; ii++) - offset += this.writeEntry(value[ii], pt, buffer, offset); + offset += this.writeEntry(value[ii], pt, buffer, offset); return (offset - baseOffset); }; @@ -723,20 +723,20 @@ CTypeParser.prototype.writeArray = function(value, type, length, buffer, offset) CTypeParser.prototype.writeEntry = function(value, type, buffer, offset) { var len, ret; - if(type['len'] !== undefined) { - len = parseInt(type['len'], 10); + if(type["len"] !== undefined) { + len = parseInt(type["len"], 10); if(isNaN(len)) - throw (new Error('somehow got a non-numeric length')); + throw (new Error("somehow got a non-numeric length")); - if(type['type'] == 'char') - ret = deftypes['char[]']['write'](value, len, this.endian, buffer, offset); + if(type["type"] == "char") + ret = deftypes["char[]"]["write"](value, len, this.endian, buffer, offset); else - ret = this.writeArray(value, type['type'], len, buffer, offset); + ret = this.writeArray(value, type["type"], len, buffer, offset); } else { - if(type['type'] in deftypes) - ret = deftypes[type['type']]['write'](value, this.endian, buffer, offset); + if(type["type"] in deftypes) + ret = deftypes[type["type"]]["write"](value, this.endian, buffer, offset); else - ret = this.resolveTypedef(type['type'], 'write', buffer, offset, value); + ret = this.resolveTypedef(type["type"], "write", buffer, offset, value); } return (ret); @@ -752,14 +752,14 @@ CTypeParser.prototype.writeStruct = function(def, buffer, offset) { for( ii = 0; ii < def.length; ii++) { key = Object.keys(def[ii])[0]; entry = def[ii][key]; - type = ctParseType(ctResolveArray(entry['type'], vals)); + type = ctParseType(ctResolveArray(entry["type"], vals)); - if('offset' in entry) - offset = baseOffset + entry['offset']; - offset += this.writeEntry(entry['value'], type, buffer, offset); + if("offset" in entry) + offset = baseOffset + entry["offset"]; + offset += this.writeEntry(entry["value"], type, buffer, offset); /* Now that we've written it out, we can use it for arrays */ - vals[key] = entry['value']; + vals[key] = entry["value"]; } }; /* @@ -775,15 +775,15 @@ CTypeParser.prototype.writeStruct = function(def, buffer, offset) { */ CTypeParser.prototype.write = function(def, buffer, offset) { if(def === undefined) - throw (new Error('missing definition for what we should be' + 'parsing')); + throw (new Error("missing definition for what we should be" + "parsing")); if(buffer === undefined) - throw (new Error('missing buffer for what we should be' + 'parsing')); + throw (new Error("missing buffer for what we should be" + "parsing")); if(offset === undefined) - throw (new Error('missing offset for what we should be' + 'parsing')); + throw (new Error("missing offset for what we should be" + "parsing")); - ctCheckReq(def, this.types, ['value']); + ctCheckReq(def, this.types, ["value"]); this.writeStruct(def, buffer, offset); }; @@ -805,20 +805,21 @@ CTypeParser.prototype.write = function(def, buffer, offset) { */ function toAbs64(val) { if(val === undefined) - throw (new Error('missing required arg: value')); + throw (new Error("missing required arg: value")); if(!( val instanceof Array)) - throw (new Error('value must be an array')); + throw (new Error("value must be an array")); if(val.length != 2) - throw (new Error('value must be an array of length 2')); + throw (new Error("value must be an array of length 2")); /* We have 20 bits worth of precision in this range */ if(val[0] >= 0x100000) - throw (new Error('value would become approximated')); + throw (new Error("value would become approximated")); return (val[0] * Math.pow(2, 32) + val[1]); } +toAbs64([1,1]); //Not used apparently, said the linter. I don't know if this is used somewhere. /* * Will return the 64 bit value as returned in an array from rsint64 / ruint64 @@ -830,16 +831,17 @@ function toAbs64(val) { */ function toApprox64(val) { if(val === undefined) - throw (new Error('missing required arg: value')); + throw (new Error("missing required arg: value")); if(!( val instanceof Array)) - throw (new Error('value must be an array')); + throw (new Error("value must be an array")); if(val.length != 2) - throw (new Error('value must be an array of length 2')); + throw (new Error("value must be an array of length 2")); return (Math.pow(2, 32) * val[0] + val[1]); } +toApprox64([1,1]); //Not used apparently, said the linter. I don't know if this is used somewhere. /* * Export the few things we actually want to. Currently this is just the CType @@ -869,4 +871,4 @@ exports.rfloat = mod_ctio.rfloat; exports.rdouble = mod_ctio.rdouble; exports.wfloat = mod_ctio.wfloat; exports.wdouble = mod_ctio.wdouble; -exports.deftypes = deftypes \ No newline at end of file +exports.deftypes = deftypes; \ No newline at end of file diff --git a/lib/hashinator.js b/lib/hashinator.js new file mode 100644 index 0000000..21540e8 --- /dev/null +++ b/lib/hashinator.js @@ -0,0 +1,115 @@ +const Message = require("./message").Message; +const { NUMERIC_TYPES } = require("./voltconstants"); +const hash = require("murmurhash-native").murmurHash128x64; + +const toBytes = (type,value) => { + switch(type){ + case "varbinary": + return value; + case "string": + return new Buffer(value,"utf8"); + case "byte": + case "tinyint": + case "short": + case "smallint": + case "int": + case "integer": + case "long": + case "bigint": { + const message = new Message(new Buffer(8)); + message.position = 0; + message.writeLong(value, "little"); + + return message.buffer; + } + } +}; + +const getTokenPartition = (hashedValue, tokenCount, tokens) => { + let min = 0; + let max = tokenCount - 1; + + while (min <= max) { + let mid = (min + max) >>> 1; + let midPtr = mid * 8; + let midval = tokens.readInt32BE(midPtr); + + if (midval < hashedValue) { + min = mid + 1; + } else if (midval > hashedValue) { + max = mid - 1; + } else { + return midPtr; + } + } + + return 8*(min-1); +}; + +const hashinateBytes = (type, obj, tokenCount, tokens) => { + const bytes = toBytes(type,obj); + + if (bytes === null) { + return 0; + } + + //Todo: const outBuffer = new Buffer(16); + let hashedValue = hash(bytes, 0, bytes.length, 0); + var view = new DataView( new ArrayBuffer(4)); + view.setUint32(0, parseInt( hashedValue.substring(0,8), 16) ); + const hashInt = view.getInt32(); + + const tokenIdx = getTokenPartition(hashInt, tokenCount, tokens); + + return tokens.readInt32BE(tokenIdx+4); +}; + +const getPartitionForValue = ( type, value, tokenCount, tokens ) => { + // Special case: + // 1) if the user supplied a string for a number column, + // try to do the conversion. This makes it substantially easier to + // load CSV data or other untyped inputs that match DDL without + // requiring the loader to know precise the schema. + if (value !== null && !!NUMERIC_TYPES[type] ) { + if ( typeof value === "string") { + value = parseInt(value,10); + + if ( Number.isNaN(value) ) { + throw new Error("getHashedPartitionForParameter: Unable to convert string " + + value + " to a numeric value target parameter"); + } + } + } + + return hashinateBytes(type, value, tokenCount, tokens); +}; + +const Hashinator = function(hashConfig, partitionKeys){ + this.tokenCount = hashConfig.readInt32BE(); + this.tokens = hashConfig.slice(4); + this.partitionKeys = []; + + partitionKeys.forEach( ({ PARTITION_ID, PARTITION_KEY }) => this.partitionKeys[PARTITION_ID] = PARTITION_KEY ); +}; + +Hashinator.prototype.getPartitionKeyForValue = function(type, value){ + const partitionId = getPartitionForValue(type, value, this.tokenCount, this.tokens); + + return this.partitionKeys[partitionId]; +}; + +Hashinator.prototype.update = function(hashConfig, partitionKeys){ + + if ( hashConfig ){ + this.tokenCount = hashConfig.readInt32BE(); + this.tokens = hashConfig.slice(4); + } + + if ( partitionKeys ){ + this.partitionKeys = []; + + partitionKeys.forEach( ({ PARTITION_ID, PARTITION_KEY }) => this.partitionKeys[PARTITION_ID] = PARTITION_KEY ); + } +}; + +module.exports = Hashinator; \ No newline at end of file diff --git a/lib/message.js b/lib/message.js index ba6b1a0..e0ca0eb 100644 --- a/lib/message.js +++ b/lib/message.js @@ -24,12 +24,11 @@ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ -var Parser = require('./parser').Parser, -util = require('util'), -PRESENT = require('./voltconstants').PRESENT, -MESSAGE_TYPE = require('./voltconstants').MESSAGE_TYPE, -STATUS_CODE_STRINGS = require('./voltconstants').STATUS_CODE_STRINGS, -STATUS_CODES = require('./voltconstants').STATUS_CODES; +var Parser = require("./parser").Parser, + util = require("util"), + PRESENT = require("./voltconstants").PRESENT, + MESSAGE_TYPE = require("./voltconstants").MESSAGE_TYPE, + STATUS_CODE_STRINGS = require("./voltconstants").STATUS_CODE_STRINGS; function Message(buffer) { this.type = MESSAGE_TYPE.UNDEFINED; @@ -62,11 +61,13 @@ Message.prototype.toBuffer = function() { this.writeHeader(); return new Buffer(this.buffer); }; + // for getting lengths from incoming data Message.readInt = function(buffer, offset) { return Parser.readInt(buffer, offset); }; -LoginMessage = function(buffer) { + +const LoginMessage = function(buffer) { Message.call(this, buffer); this.type = MESSAGE_TYPE.LOGIN; this.status = this.readByte(); @@ -76,10 +77,10 @@ LoginMessage = function(buffer) { this.connectionId = this.readLong(); this.clusterStartTimestamp = new Date(parseInt(this.readLong().toString())); // not microseonds, milliseconds - this.leaderIP = this.readByte() + '.' + this.readByte() + '.' + this.readByte() + '.' + this.readByte(); + this.leaderIP = this.readByte() + "." + this.readByte() + "." + this.readByte() + "." + this.readByte(); this.build = this.readString(); } -} +}; util.inherits(LoginMessage, Message); @@ -96,8 +97,9 @@ lm.toString = function() { leaderIP : this.leaderIP, build : this.build }; -} -QueryMessage = function(buffer) { +}; + +const QueryMessage = function(buffer) { Message.call(this, buffer); this.type = MESSAGE_TYPE.QUERY; @@ -110,11 +112,11 @@ QueryMessage = function(buffer) { this.statusString = this.readString(); } this.appStatus = this.readByte(); - this.appStatusString = ''; + this.appStatusString = ""; if(this.fieldsPresent & PRESENT.APP_STATUS) { this.appStatusString = this.readString(); } - this.exception + this.exception; this.exceptionLength = this.readInt(); if(this.fieldsPresent & PRESENT.EXCEPTION) { this.exception = this.readException(1); @@ -129,7 +131,7 @@ QueryMessage = function(buffer) { } } -} +}; util.inherits(QueryMessage, Message); @@ -143,7 +145,6 @@ qm.toString = function() { error : this.error, uid : this.uid, fieldsPresent : this.fieldsPresent, - status : this.status, statusString : this.statusString, appStatus : this.appStatus, appStatusString : this.appStatusString, @@ -151,7 +152,7 @@ qm.toString = function() { exceptionLength : this.exceptionLength, results : this.results }; -} +}; exports.Message = Message; exports.LoginMessage = LoginMessage; exports.QueryMessage = QueryMessage; diff --git a/lib/parser.js b/lib/parser.js index 98f3b5f..cce0add 100644 --- a/lib/parser.js +++ b/lib/parser.js @@ -24,24 +24,43 @@ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ -var BigInteger = require('bignumber').BigInteger, - ctype = require('./ctype'), - endian = 'big'; +const VoltTable = require("./volttable"); + +var BigInteger = require("bignumber").BigInteger, + ctype = require("./ctype"), + PROTOCOL_ENDIAN = "big"; var NullValueOf = { byte: -128, short: -32768, int: -2147483648, - long: new BigInteger('-9223372036854775808'), + long: new BigInteger("-9223372036854775808"), double: -1.7E+308, - decimal: '-170141183460469231731687303715884105728' + decimal: "-170141183460469231731687303715884105728" }; +const { + TYPES_STRINGS, + TYPES_NUMBERS, + TYPES_READ, + TYPES_WRITE, + NUMERIC_TYPES, + STRING_TYPES, + BIGINT_TYPES +} = require("./voltconstants"); + function Parser(buffer) { this.buffer = buffer || []; this.position = 0; } +Parser.prototype.write = function(value, type){ + if ( !TYPES_WRITE[type] ) + throw new Error("No writer for type: ", type); + + this[TYPES_WRITE[type]](value); +}; + Parser.prototype.readBinary = function(length) { return this.buffer.slice(this.position, this.position += length); }; @@ -53,8 +72,8 @@ Parser.prototype.writeBinary = function(buffer) { }; Parser.prototype.readByte = function() { - var res = ctype.rsint8(this.buffer, endian, this.position++); - if (res === NullValueOf['byte']) { + var res = ctype.rsint8(this.buffer, PROTOCOL_ENDIAN, this.position++); + if (res === NullValueOf["byte"]) { return null; } else { return res; @@ -62,14 +81,14 @@ Parser.prototype.readByte = function() { }; Parser.prototype.writeByte = function(value) { if (value == null) { - value = NullValueOf['byte']; + value = NullValueOf["byte"]; } - ctype.wsint8(value, endian, this.buffer, this.position++); + ctype.wsint8(value, PROTOCOL_ENDIAN, this.buffer, this.position++); }; Parser.prototype.readShort = function() { - var res = ctype.rsint16(this.buffer, endian, (this.position += 2) - 2); - if (res === NullValueOf['short']) { + var res = ctype.rsint16(this.buffer, PROTOCOL_ENDIAN, (this.position += 2) - 2); + if (res === NullValueOf["short"]) { return null; } else { return res; @@ -77,14 +96,14 @@ Parser.prototype.readShort = function() { }; Parser.prototype.writeShort = function(value) { if (value == null) { - value = NullValueOf['short']; + value = NullValueOf["short"]; } - ctype.wsint16(value, endian, this.buffer, (this.position += 2) - 2); + ctype.wsint16(value, PROTOCOL_ENDIAN, this.buffer, (this.position += 2) - 2); }; Parser.prototype.readInt = function() { - var res = ctype.rsint32(this.buffer, endian, (this.position += 4) - 4); - if (res === NullValueOf['int']) { + var res = ctype.rsint32(this.buffer, PROTOCOL_ENDIAN, (this.position += 4) - 4); + if (res === NullValueOf["int"]) { return null; } else { return res; @@ -92,14 +111,14 @@ Parser.prototype.readInt = function() { }; Parser.prototype.writeInt = function(value) { if (value == null) { - value = NullValueOf['int']; + value = NullValueOf["int"]; } - ctype.wsint32(value, endian, this.buffer, (this.position += 4) - 4); + ctype.wsint32(value, PROTOCOL_ENDIAN, this.buffer, (this.position += 4) - 4); }; Parser.prototype.readDouble = function() { - var res = ctype.rdouble(this.buffer, endian, (this.position += 8) - 8); - if (res === NullValueOf['double']) { + var res = ctype.rdouble(this.buffer, PROTOCOL_ENDIAN, (this.position += 8) - 8); + if (res === NullValueOf["double"]) { return null; } else { return res; @@ -107,15 +126,15 @@ Parser.prototype.readDouble = function() { }; Parser.prototype.writeDouble = function(value) { if (value == null) { - value = NullValueOf['double']; + value = NullValueOf["double"]; } - ctype.wdouble(value, endian, this.buffer, (this.position += 8) - 8); + ctype.wdouble(value, PROTOCOL_ENDIAN, this.buffer, (this.position += 8) - 8); }; Parser.prototype.readLongBytes = function() { var bytes = [], numBytes = 8; for(var i = 0; i < numBytes; i++) { - bytes.push(ctype.ruint8(this.buffer, endian, this.position + i)); + bytes.push(ctype.ruint8(this.buffer, PROTOCOL_ENDIAN, this.position + i)); } this.position += numBytes; return (new BigInteger(bytes)); @@ -123,21 +142,21 @@ Parser.prototype.readLongBytes = function() { Parser.prototype.readLong = function() { var res = this.readLongBytes(); - if (res.equals(NullValueOf['long'])) { + if (res.equals(NullValueOf["long"])) { return null; } else { return res; } }; -Parser.prototype.writeLong = function(value) { +Parser.prototype.writeLong = function(value, endian = PROTOCOL_ENDIAN) { if (value == null) { - value = NullValueOf['long']; + value = NullValueOf["long"]; } var bytes, numBytes = 8; - if( typeof value === 'number') + if( typeof value === "number") value = new BigInteger(value.toString()); if(!( value instanceof BigInteger)) - throw new Error('Long type must be a BigInteger or Number'); + throw new Error("Long type must be a BigInteger or Number"); bytes = value.toByteArray(); if (bytes[0] >= 0) { while (bytes.length < numBytes) { @@ -149,22 +168,28 @@ Parser.prototype.writeLong = function(value) { } } - for(var i = 0; i < numBytes; i++) - ctype.wsint8(bytes[i], endian, this.buffer, this.position + i); + if ( endian === "big" ){ + for(let i = 0; i < numBytes; i++) + ctype.wsint8(bytes[i], endian, this.buffer, this.position + i); + } else { + for(let i = 0; i < numBytes; i++) + ctype.wsint8(bytes[i], endian, this.buffer, this.position + (numBytes-(i+1) )); + } + this.position += numBytes; }; Parser.prototype.readString = function() { var length = this.readInt(); if (length < 0) return null; - return this.buffer.toString('utf8', this.position, this.position += length); + return this.buffer.toString("utf8", this.position, this.position += length); }; Parser.prototype.writeString = function(value) { var length; if (value == null) { length = -1; } else { - var strBuf = new Buffer(value, 'utf8'); + var strBuf = new Buffer(value, "utf8"); length = strBuf.length; } this.writeInt(length); @@ -177,7 +202,7 @@ Parser.prototype.writeString = function(value) { Parser.prototype.readDate = function() { var bigInt = this.readLongBytes(); - if (bigInt.toString() === NullValueOf['long']) { + if (bigInt.toString() === NullValueOf["long"]) { return null; } else { var intStr = bigInt.divide(thousand).toString(); @@ -191,9 +216,9 @@ Parser.prototype.writeDate = function(value) { } else { var bigInt; if (value instanceof Date) - value = Date.getTime(); - else if (typeof value !== 'number') - throw new Error('Date type must be a Date or number'); + value = value.getTime(); + else if (typeof value !== "number") + throw new Error("Date type must be a Date or number"); bigInt = new BigInteger(value.toString()); this.writeLong(bigInt.multiply(thousand)); @@ -203,37 +228,37 @@ Parser.prototype.writeDate = function(value) { Parser.prototype.readDecimal = function() { var bytes = [], bigInt, numBytes = 16, decimalPlaces = 12; for(var i = 0; i < numBytes; i++) - bytes.push(ctype.ruint8(this.buffer, endian, this.position + i)); + bytes.push(ctype.ruint8(this.buffer, PROTOCOL_ENDIAN, this.position + i)); this.position += numBytes; bigInt = new BigInteger(bytes); var val = bigInt.toString(); // handle the null value case - if(val === NullValueOf['decimal']) { + if(val === NullValueOf["decimal"]) { val = null; } else if(val.length <= 12) { // add leading zeros (e.g. 123 to 0.000000000123) - val = zeros(decimalPlaces - val.length).join('') + val; - val = '0.' + val; + val = zeros(decimalPlaces - val.length).join("") + val; + val = "0." + val; } else { // put the decimal in the right place - val = val.slice(0, -decimalPlaces) + '.' + val.slice(-decimalPlaces); + val = val.slice(0, -decimalPlaces) + "." + val.slice(-decimalPlaces); } return val; }; Parser.prototype.writeDecimal = function(value) { var bytes, bigInt, numBytes = 16; if(value == null) { - bigInt = new BigInteger(NullValueOf['decimal']); + bigInt = new BigInteger(NullValueOf["decimal"]); } else { - if (typeof value === 'number') + if (typeof value === "number") value = value.toString(); - if (typeof value != 'string' || !(/^-?\d*\.?\d*$/).test(value)) - throw new Error('Decimal type must be a numerical string or Number:' + value); + if (typeof value != "string" || !(/^-?\d*\.?\d*$/).test(value)) + throw new Error("Decimal type must be a numerical string or Number:" + value); // add decimal and missing zeros - if (value.startsWith('.')) { - value = '0' + value; + if (value.startsWith(".")) { + value = "0" + value; } bigInt = new BigInteger(sanitizeDecimal(value)); } @@ -249,7 +274,7 @@ Parser.prototype.writeDecimal = function(value) { } for(var i = 0; i < numBytes; i++) - ctype.wsint8(bytes[i], endian, this.buffer, this.position + i); + ctype.wsint8(bytes[i], PROTOCOL_ENDIAN, this.buffer, this.position + i); this.position += numBytes; }; @@ -262,7 +287,7 @@ Parser.prototype.readVarbinary = function() { this.position += length; return binary; } -} +}; Parser.prototype.writeVarbinary = function(value) { if (value == null) { @@ -271,22 +296,22 @@ Parser.prototype.writeVarbinary = function(value) { this.writeInt(value.length); this.writeBinary(value); } -} +}; Parser.prototype.readNull = function() { // a no-op, no reading return null; }; -Parser.prototype.writeNull = function(value) { +Parser.prototype.writeNull = function() { // a no-op, no writing }; Parser.prototype.readArray = function(type, value) { type = TYPES_STRINGS[this.readByte()]; if(type == undefined) - throw new Error('Unsupported type, update driver'); + throw new Error("Unsupported type, update driver"); - var length = (type == 'byte' ? this.readInt() : this.readShort()); + var length = (type == "byte" ? this.readInt() : this.readShort()); var method = TYPES_READ[type]; value = new Array(length); for(var i = 0; i < length; i++) { @@ -296,16 +321,20 @@ Parser.prototype.readArray = function(type, value) { }; Parser.prototype.writeArray = function(type, value) { - if(type.slice(0, 5) != 'array' && !TYPES_NUMBERS.hasOwnProperty(type)) - throw new Error('Type must be one of: array, null tinyint, smallint,' + ' integer, bigint, float, string, timestamp, decimal'); + if(type.slice(0, 5) != "array" && !TYPES_NUMBERS.hasOwnProperty(type)) + throw new Error("Type must be one of: array, null tinyint, smallint," + " integer, bigint, float, string, timestamp, decimal"); if(!( value instanceof Array)) - throw new Error(('Array value must be an Array')); + throw new Error(("Array value must be an Array")); - var length = value.length, i, match; + const length = value.length; + let i = 0; + let match = null; + + match = type.match(arrExp); // if it's a subarray (e.g. type = array[string]) - if( match = type.match(arrExp)) { + if( match ) { this.writeByte(TYPES_NUMBERS.array); // write type 'array' -99 this.writeShort(length); @@ -313,13 +342,13 @@ Parser.prototype.writeArray = function(type, value) { // write sub-array values for( i = 0; i < length; i++) { - this.writeArray(arrType, value[i]) + this.writeArray(arrType, value[i]); } } else { this.writeByte(TYPES_NUMBERS[type]); // write type // write length - type == 'byte' ? this.writeInt(length) : this.writeShort(length); + type == "byte" ? this.writeInt(length) : this.writeShort(length); var method = TYPES_WRITE[type]; // write values @@ -330,72 +359,52 @@ Parser.prototype.writeArray = function(type, value) { }; Parser.prototype.readVoltTable = function() { - // header - var tableLength = this.readInt(); - var metaLength = this.readInt(); - var status = this.readByte(); - var columnCount = this.readShort(); - var columnTypes = new Array(columnCount); - var columnMethods = new Array(columnCount); - for(var i = 0; i < columnCount; i++) { - var typeByte = this.readByte(); - var type = TYPES_STRINGS[typeByte]; - columnTypes[i] = type; - columnMethods[i] = TYPES_READ[type]; + const volttable = new VoltTable(); - } - var columnNames = new Array(columnCount); - for( i = 0; i < columnCount; i++) { - columnNames[i] = this.readString(); - } - var rowCount = this.readInt(); - - // data - var rows = new Array(rowCount); - for( i = 0; i < rowCount; i++) { - var rowLength = this.readInt(); - var row = {}; - for(var j = 0; j < columnCount; j++) { - row[columnNames[j]] = this[columnMethods[j]](); - } - rows[i] = row; - } + volttable.readFromBuffer(this); + + return volttable; +}; - rows.status = status; - rows.columnNames = columnNames; - rows.columnTypes = columnTypes; - return rows; +Parser.prototype.writeVoltTable = function(vt) { + vt.writeToBuffer(this); }; Parser.prototype.readException = function(length) { if(length == 0) - new Error('An exception has occurred'); + new Error("An exception has occurred"); var ordinal = this.readByte(); // they don't have a spec for exceptions at this time, just skip it. - var theRest = this.readBinary(length - 1); - if(ordinal == 1) - return new Error('EEException'); - else if(ordinal == 2) - return new Error('SQLException'); - else if(ordinal == 3) - return new Error('ConstraintFailureException'); - return new Error('An exception has occurred'); + this.readBinary(length - 1); + switch(ordinal){ + case 1: + return new Error("EEException"); + case 2: + return new Error("SQLException"); + case 3: + return new Error("ConstraintFailureException"); + default: + return new Error("An exception has occurred"); + } }; Parser.prototype.writeParameterSet = function(types, values) { + if(types.length != values.length) - throw new Error('The number of parameters do not match the number of ' + 'types defined in the definition.'); + throw new Error("The number of parameters do not match the number of " + "types defined in the definition."); - var length = values.length, match; + const length = values.length; this.writeShort(length); for(var i = 0; i < length; i++) { var type = types[i]; var value = values[i]; + checkType(type, value); // handle the array type - if( match = type.match(arrExp)) { + let match = type.match(arrExp); + if( match ) { var arrType = match[1]; this.writeByte(TYPES_NUMBERS.array); this.writeArray(arrType, value); @@ -410,174 +419,87 @@ Parser.prototype.writeParameterSet = function(types, values) { Parser.readInt = function(buffer, offset) { if(offset == undefined) offset = 0; - return ctype.rsint32(buffer, endian, offset); + return ctype.rsint32(buffer, PROTOCOL_ENDIAN, offset); }; exports.Parser = Parser; var arrExp = /array\[(.*)\]/; -var TYPES_STRINGS = { - '-99' : 'array', - '1' : 'null', - '3' : 'byte', - '4' : 'short', - '5' : 'int', - '6' : 'long', - '8' : 'double', - '9' : 'string', - '11' : 'date', - '22' : 'decimal', - '25' : 'varbinary' -}; - -var TYPES_NUMBERS = { - 'array' : -99, - 'null' : 1, - 'byte' : 3, - 'tinyint' : 3, - 'short' : 4, - 'smallint' : 4, - 'int' : 5, - 'integer' : 5, - 'long' : 6, - 'bigint' : 6, - 'double' : 8, - 'float' : 8, - 'string' : 9, - 'date' : 11, - 'timestamp' : 11, - 'decimal' : 22, - 'varbinary' : 25 -}; - -var TYPES_READ = { - 'array' : 'readArray', - 'null' : 'readNull', - 'byte' : 'readByte', - 'tinyint' : 'readByte', - 'short' : 'readShort', - 'smallint' : 'readShort', - 'int' : 'readInt', - 'integer' : 'readInt', - 'long' : 'readLong', - 'bigint' : 'readLong', - 'double' : 'readDouble', - 'float' : 'readDouble', - 'string' : 'readString', - 'date' : 'readDate', - 'timestamp' : 'readDate', - 'decimal' : 'readDecimal', - 'varbinary' : 'readVarbinary' -}; -var TYPES_WRITE = { - 'array' : 'writeArray', - 'null' : 'writeNull', - 'byte' : 'writeByte', - 'tinyint' : 'writeByte', - 'short' : 'writeShort', - 'smallint' : 'writeShort', - 'int' : 'writeInt', - 'integer' : 'writeInt', - 'long' : 'writeLong', - 'bigint' : 'writeLong', - 'double' : 'writeDouble', - 'float' : 'writeDouble', - 'string' : 'writeString', - 'date' : 'writeDate', - 'timestamp' : 'writeDate', - 'decimal' : 'writeDecimal', - 'varbinary' : 'writeVarbinary' -}; - -var NUMERIC_TYPES = { - 'byte' : true, - 'tinyint' : true, - 'short' : true, - 'smallint' : true, - 'int' : true, - 'integer' : true, - 'long' : true, - 'bigint' : true, - 'double' : true, - 'float' : true, - 'date' : true, - 'timestamp' : true, - 'decimal' : true, - 'varbinary' : true -}; -var STRING_TYPES = { - 'string' : true, - 'decimal' : true -}; -var BIGINT_TYPES = { - 'long' : true, - 'bigint' : true -}; - -var thousand = new BigInteger('1000'); + + +var thousand = new BigInteger("1000"); function zeros(num) { var arr = new Array(num); for(var i = 0; i < num; i++) - arr[i] = 0; + arr[i] = 0; return arr; } +//it this used?? function ones(num) { var arr = new Array(num); for(var i = 0; i < num; i++) - arr[i] = 1; + arr[i] = 1; return arr; } +ones(1); //for linter function checkType(type, value) { - if(type == 'array') - throw new Error('Type array must have a subtype. E.g. array[string]'); + if(type == "array") + throw new Error("Type array must have a subtype. E.g. array[string]"); + + if(type.slice(0, 5) != "array" && !TYPES_NUMBERS.hasOwnProperty(type)) + throw new Error("Type must be one of: array, null tinyint, smallint, " + "integer, bigint, float, string, timestamp, decimal"); + + if( typeof value === "number" && !NUMERIC_TYPES[type]) + throw new Error("Providing a numeric type for a non-numeric field. " + value + " can not be a " + type); - if(type.slice(0, 5) != 'array' && !TYPES_NUMBERS.hasOwnProperty(type)) - throw new Error('Type must be one of: array, null tinyint, smallint, ' + 'integer, bigint, float, string, timestamp, decimal'); + if( typeof value === "string" && !STRING_TYPES[type]) + throw new Error("Providing a string type for a non-string field. " + value + " can not be a " + type); - if( typeof value === 'numeric' && !NUMERIC_TYPES[type]) - throw new Error('Providing a numeric type for a non-numeric field. ' + value + ' can not be a ' + type); + if( value instanceof VoltTable && type !== "volttable" ) + throw new Error("Providing a VoltTable type for a non-VoltTable field. " + value + " can not be a " + type); - if( typeof value === 'string' && !STRING_TYPES[type]) - throw new Error('Providing a string type for a non-string field. ' + value + ' can not be a ' + type); + if( !(value instanceof VoltTable) && type == "volttable" ) + throw new Error("Providing a non-VoltTable type for a VoltTable field. " + value + " can not be a " + type); - if( typeof value === 'object' && !( value instanceof Array) && !( value instanceof Uint8Array) && (value != null)) - throw new Error('Cannot provide custom objects as procedure parameters'); + if( typeof value === "object" && !( value instanceof Array) && !( value instanceof Uint8Array) && (value != null && !(value instanceof VoltTable))) + throw new Error("Cannot provide custom objects as procedure parameters"); - if( value instanceof Array && type.slice(0, 5) != 'array') - throw new Error('Providing an array type for a non-array field. ' + value + ' can not be a ' + type); + if( value instanceof Array && type.slice(0, 5) != "array") + throw new Error("Providing an array type for a non-array field. " + value + " can not be a " + type); - if(type.slice(0, 5) == 'array' && !( value instanceof Array)) - throw new Error('Providing a non-array value for an array field. ' + value + ' can not be a ' + type); + if(type.slice(0, 5) == "array" && !( value instanceof Array)) + throw new Error("Providing a non-array value for an array field. " + value + " can not be a " + type); if( value instanceof BigInteger && !BIGINT_TYPES[type]) - throw new Error('Providing a BigInteger type for a non-bigint field. ' + value + ' can not be a ' + type); + throw new Error("Providing a BigInteger type for a non-bigint field. " + value + " can not be a " + type); } function sanitizeDecimal(value) { var MAX_INT_DIGIT = 26, MAX_FRAC_DIGIT = 12; - var sign = ''; - if (value.startsWith('-')) { - sign = '-'; + var sign = ""; + if (value.startsWith("-")) { + sign = "-"; value = value.slice(1); } - var parts = value.split('.'); + + var parts = value.split("."); // first check if the given value is legal if (parts[0].length > MAX_INT_DIGIT) { - throw new Error('The integer part should not have more than' + MAX_INT_DIGIT + 'digits.'); + throw new Error("The integer part should not have more than" + MAX_INT_DIGIT + "digits."); } if (parts.length == 2 && parts[1].length > MAX_FRAC_DIGIT) { - throw new Error('The fractional part should not have more than' + MAX_FRAC_DIGIT + 'digits.'); + throw new Error("The fractional part should not have more than" + MAX_FRAC_DIGIT + "digits."); } // add trailing zeros if (parts.length == 1) { - return sign + parts[0] + zeros(MAX_FRAC_DIGIT).join(''); + return sign + parts[0] + zeros(MAX_FRAC_DIGIT).join(""); } else { - return sign + parts[0] + parts[1] + zeros(MAX_FRAC_DIGIT - parts[1].length).join(''); + return sign + parts[0] + parts[1] + zeros(MAX_FRAC_DIGIT - parts[1].length).join(""); } } \ No newline at end of file diff --git a/lib/query.js b/lib/query.js index 9d61434..13aaaae 100644 --- a/lib/query.js +++ b/lib/query.js @@ -25,22 +25,21 @@ * OTHER DEALINGS IN THE SOFTWARE. */ -var EventEmitter = require('events').EventEmitter; -var Message = require('./message').Message; -VoltQuery = function(procName, types) { +var Message = require("./message").Message; +const VoltQuery = function(procName, types) { this.procName = procName; this.types = types || []; this.parameters = []; this.uid = null; -} +}; VoltQuery.prototype.setParameters = function(params) { this.parameters = params; -} +}; VoltQuery.prototype.setUID = function(uid) { this.uid = uid; -} +}; VoltQuery.prototype.getMessage = function() { var message = new Message(); @@ -48,15 +47,16 @@ VoltQuery.prototype.getMessage = function() { message.writeBinary(new Buffer(this.uid)); message.writeParameterSet(this.types, this.parameters); return message; -} -VoltProcedure = function(name, types) { +}; + +const VoltProcedure = function(name, types) { this.name = name; this.types = types; -} +}; VoltProcedure.prototype.getQuery = function() { return new VoltQuery(this.name, this.types); -} +}; module.exports = VoltQuery; //remove diff --git a/lib/voltconstants.js b/lib/voltconstants.js index 40f8554..a495e3f 100644 --- a/lib/voltconstants.js +++ b/lib/voltconstants.js @@ -30,13 +30,13 @@ * between the client and server. * */ -var MESSAGE_TYPE = { +const MESSAGE_TYPE = { UNDEFINED : -1, LOGIN : 1, QUERY : 2 }; -var PRESENT = { +const PRESENT = { STATUS : 0x20, EXCEPTION : 0x40, APP_STATUS : 0x80 @@ -59,15 +59,15 @@ var PRESENT = { * FATAL_ERROR: A critical error occurred that was above and beyond all * other error conditions. */ -var SESSION_EVENT = { - CONNECTION : 'CONNECT', - CONNECTION_ERROR: 'CONNECT_ERROR', - QUERY_RESPONSE: 'QUERY_RESPONSE', - QUERY_ALLOWED: 'QUERY_ALLOWED', - QUERY_RESPONSE_ERROR: 'QUERY_RESPONSE_ERROR', - QUERY_DISPATCH_ERROR: 'QUERY_DISPATCH_ERROR', - FATAL_ERROR: 'FATAL_ERROR' -} +const SESSION_EVENT = { + CONNECTION : "CONNECT", + CONNECTION_ERROR: "CONNECT_ERROR", + QUERY_RESPONSE: "QUERY_RESPONSE", + QUERY_ALLOWED: "QUERY_ALLOWED", + QUERY_RESPONSE_ERROR: "QUERY_RESPONSE_ERROR", + QUERY_DISPATCH_ERROR: "QUERY_DISPATCH_ERROR", + FATAL_ERROR: "FATAL_ERROR" +}; /** * Each SESSION_EVENT has a STATUS_CODE giving some indication why the @@ -89,7 +89,7 @@ var SESSION_EVENT = { * QUERY_TOOK_TOO_LONG: Driver issued message indicating that the server * has taken too long to respond. */ -var STATUS_CODES = { +const STATUS_CODES = { SUCCESS : null, USER_ABORT : -1, GRACEFUL_FAILURE : -2, @@ -101,27 +101,192 @@ var STATUS_CODES = { QUERY_TOOK_TOO_LONG : -8 }; -var STATUS_CODE_STRINGS = { - 1 : 'SUCCESS', - '-1' : 'USER_ABORT', - '-2' : 'GRACEFUL_FAILURE', - '-3' : 'UNEXPECTED_FAILURE', - '-4' : 'CONNECTION_LOST', - '-5' : 'SERVER_UNAVAILABLE', - '-6' : 'CONNECTION_LOST', - '-7' : 'QUERY_TIMEOUT', - '-8' : 'QUERY_TOOK_TOO_LONG' +const STATUS_CODE_STRINGS = { + 1 : "SUCCESS", + "-1" : "USER_ABORT", + "-2" : "GRACEFUL_FAILURE", + "-3" : "UNEXPECTED_FAILURE", + "-4" : "CONNECTION_LOST", + "-5" : "SERVER_UNAVAILABLE", + "-6" : "CONNECTION_LOST", + "-7" : "QUERY_TIMEOUT", + "-8" : "QUERY_TOOK_TOO_LONG" +}; + +const LOGIN_ERRORS = { + 1 : "Too many connections", + 3 : "Corrupt or invalid login message", + 4 : "Can't resolve host", + 5 : "Authentication failed, client took too long to transmit credentials", + 6 : "Connection refused", + 7 : "Socket closed by other party", + 8 : "Connection timeout" +}; + +const SOCKET_ERRORS = { + ENOTFOUND: "HOST_UNKNOWN", + ECONNREFUSED: "CONNECTION_REFUSED", + EPIPE: "SOCKET_CLOSED" +}; + +const LOGIN_STATUS = { + TOO_MANY_CONNECTIONS: 1, + INVALID_LOGIN_MESSAGE: 3, + HOST_UNKNOWN: 4, + AUTHENTICATION_ERROR: 5, + CONNECTION_REFUSED: 6, + SOCKET_CLOSED: 7, + ETIMEDOUT: 8 +}; + +const HASH_ALGORITHMS = { + SHA_1: "sha1", + SHA_2: "sha256" +}; + +const RESULT_STATUS = { + SUCCESS: 1 +}; + +/**************** */ + +const TYPES_SIZES = { + "byte" : 1, + "tinyint" : 1, + "short" : 2, + "smallint" : 2, + "int" : 4, + "integer" : 4, + "long" : 8, + "bigint" : 8, + "double" : 8, + "float" : 8, + "date" : 8, + "timestamp" : 8, + "decimal" : 16 }; -var LOGIN_ERRORS = { - 1 : 'Too many connections', - 2 : 'Authentication failed, client took too long to transmit credentials', - 3 : 'Corrupt or invalid login message' +const TYPES_STRINGS = { + "-99" : "array", + "1" : "null", + "3" : "byte", + "4" : "short", + "5" : "int", + "6" : "long", + "8" : "double", + "9" : "string", + "11" : "date", + "22" : "decimal", + "25" : "constbinary" }; -exports.PRESENT = PRESENT; -exports.LOGIN_ERRORS = LOGIN_ERRORS; -exports.SESSION_EVENT = SESSION_EVENT; -exports.STATUS_CODE_STRINGS = STATUS_CODE_STRINGS; -exports.STATUS_CODES = STATUS_CODES; -exports.MESSAGE_TYPE = MESSAGE_TYPE; \ No newline at end of file +const TYPES_NUMBERS = { + "array" : -99, + "null" : 1, + "byte" : 3, + "tinyint" : 3, + "short" : 4, + "smallint" : 4, + "int" : 5, + "integer" : 5, + "long" : 6, + "bigint" : 6, + "double" : 8, + "float" : 8, + "string" : 9, + "date" : 11, + "timestamp" : 11, + "decimal" : 22, + "constbinary" : 25, + "volttable" : 21 +}; + +const TYPES_READ = { + "array" : "readArray", + "null" : "readNull", + "byte" : "readByte", + "tinyint" : "readByte", + "short" : "readShort", + "smallint" : "readShort", + "int" : "readInt", + "integer" : "readInt", + "long" : "readLong", + "bigint" : "readLong", + "double" : "readDouble", + "float" : "readDouble", + "string" : "readString", + "date" : "readDate", + "timestamp" : "readDate", + "decimal" : "readDecimal", + "constbinary" : "readVarbinary" +}; + +const TYPES_WRITE = { + "array" : "writeArray", + "null" : "writeNull", + "byte" : "writeByte", + "tinyint" : "writeByte", + "short" : "writeShort", + "smallint" : "writeShort", + "int" : "writeInt", + "integer" : "writeInt", + "long" : "writeLong", + "bigint" : "writeLong", + "double" : "writeDouble", + "float" : "writeDouble", + "string" : "writeString", + "date" : "writeDate", + "timestamp" : "writeDate", + "decimal" : "writeDecimal", + "constbinary" : "writeVarbinary", + "volttable" : "writeVoltTable" +}; + +const NUMERIC_TYPES = { + "byte" : true, + "tinyint" : true, + "short" : true, + "smallint" : true, + "int" : true, + "integer" : true, + "long" : true, + "bigint" : true, + "double" : true, + "float" : true, + "date" : true, + "timestamp" : true, + "decimal" : true, + "constbinary" : true +}; +const STRING_TYPES = { + "string" : true, + "decimal" : true +}; +const BIGINT_TYPES = { + "long" : true, + "bigint" : true +}; + + +module.exports = { + PRESENT, + LOGIN_ERRORS, + LOGIN_STATUS, + SOCKET_ERRORS, + SESSION_EVENT, + STATUS_CODE_STRINGS, + STATUS_CODES, + RESULT_STATUS, + MESSAGE_TYPE, + + TYPES_SIZES, + TYPES_STRINGS, + TYPES_NUMBERS, + TYPES_READ, + TYPES_WRITE, + STRING_TYPES, + NUMERIC_TYPES, + BIGINT_TYPES, + + HASH_ALGORITHMS +}; \ No newline at end of file diff --git a/lib/volttable.js b/lib/volttable.js new file mode 100644 index 0000000..1a5695e --- /dev/null +++ b/lib/volttable.js @@ -0,0 +1,236 @@ +/* This file is part of VoltDB. + * Copyright (C) 2008-2018 VoltDB Inc. + * + * 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. + */ + +const { TYPES_NUMBERS, TYPES_SIZES, TYPES_STRINGS, TYPES_READ } = require("./voltconstants"); + +const bufferSize = str => str !== null ? 4 + str.length : 4; + +const arrayEquals = (a,b) => { + if ( !a && !b ) return true; + + if ( !!a !== !!b || a.length !== b.length ) return false; + + return a.reduce( (result, aItem, aIdx) => result && aItem === b[aIdx] , true); +}; + +const bigNumberEquals = (a,b) => { + const trimZeroRegex = /^0+|0+$/gm; + return a.toString().replace(trimZeroRegex,"") === b.toString().replace(trimZeroRegex,""); +}; + +const sizeRow = (vt,i) => { + let size = 0; + + vt.columnTypes.forEach( (col, j) => { + switch(col){ + case "string": + case "varbinary": + size += bufferSize(vt.data[i][vt.columnNames[j]]); + break; + default: + size += TYPES_SIZES[col]; + } + }); + + return size; +}; + +function VoltTable(){ + this.data = []; + this.status = null; + this.columnNames = []; + this.columnTypes = []; + + this.addColumn = this.addColumn.bind(this); + this.addRow = this.addRow.bind(this); + this.writeToBuffer = this.writeToBuffer.bind(this); + this.readFromBuffer = this.readFromBuffer.bind(this); + this.length = 0; +} + +VoltTable.prototype.addColumn = function(name, type, defaultValue = null){ + type = type.toLowerCase(); + + if ( !TYPES_NUMBERS[type] ) + throw new Error(type + " is not a valid type. Valid types: " + JSON.stringify(Object.keys(TYPES_NUMBERS))); + + type = type === "tinyint" ? "byte" : type; + type = type === "smallint" ? "short" : type; + type = type === "integer" ? "int" : type; + type = type === "bigint" ? "long" : type; + type = type === "float" ? "double" : type; + type = type === "timestamp" ? "date" : type; + + name = name.toUpperCase(); + this.columnNames.push(name); + this.columnTypes.push(type.toLowerCase()); + + this.data.forEach( row => row[name] = defaultValue ); +}; + +VoltTable.prototype.addRow = function(...args){ + args = (args.length === 1 && args instanceof Array) ? args[0] : args; + args = args.map( e => e === undefined ? null : e); + + if (args.length !== this.columnNames.length){ + throw new Error( JSON.stringify(args) + " does not match table schema: " + JSON.stringify(this.columnTypes) ); + } + + let idx = this.data.length; + this.data[idx] = {}; + + this.columnNames.forEach((name,i) => this.data[idx][name] = args[i] || null); +}; + +VoltTable.prototype.writeToBuffer = function(parser){ + const { status, columnNames: names, columnTypes: types } = this; + + //status + colCount + typesLength + let headerSize = 1 + 2 + names.length; + + //+names.length + names.forEach( name => { + headerSize += bufferSize(name); + }); + + //rowCount + let dataSize = 4; + + //+rows.length + const rowSizes = []; + this.data.forEach( (row, i) => { + rowSizes[i] = sizeRow(this,i); + dataSize += 4 + rowSizes[i]; + }); + + //headerSize + header + data + const tableSize = 4 + headerSize + dataSize; + + parser.writeInt(tableSize); + parser.writeInt(headerSize); + parser.writeByte(status); + parser.writeShort(types.length); + + for( let i = 0 ; i < types.length ; i++){ + const type = TYPES_NUMBERS[types[i]]; + parser.writeByte(type); + } + + for( let i = 0 ; i < names.length ; i++){ + parser.writeString(names[i]); + } + + parser.writeInt(this.data.length); + + for(let i = 0 ; i < this.data.length ; i++){ + let size = rowSizes[i]; + parser.writeInt(size); + + for(let j = 0; j < names.length; j++){ + parser.write(this.data[i][names[j]], types[j]); + } + } +}; + +VoltTable.prototype.readFromBuffer = function(parser){ + parser.readInt(); //Volttable Length + parser.readInt(); //Column Header length + + this.status = parser.readByte(); + const columnCount = parser.readShort(); + + this.columnNames = new Array(columnCount); + for(let i = 0; i < columnCount; i++) { + let typeByte = parser.readByte(); + this.columnTypes[i] = TYPES_STRINGS[typeByte]; + } + + this.columnNames = new Array(columnCount); + for(let i = 0; i < columnCount; i++) { + this.columnNames[i] = parser.readString(); + } + + this.data = new Array(parser.readInt()); + + // data + for(let i = 0; i < this.data.length; i++) { + parser.readInt(); //Row Length + + + let row = {}; + + for(let j = 0; j < columnCount; j++) { + let read = TYPES_READ[this.columnTypes[j]]; + row[this.columnNames[j]] = parser[read](); + } + + this.data[i] = row; + } +}; + +VoltTable.prototype.equals = function(volttable){ + if (! arrayEquals(this.columnNames, volttable.columnNames) ) return false; + if (! arrayEquals(this.columnTypes, volttable.columnTypes) ) return false; + + if ( this.data.length !== volttable.data.length ) return false; + + const names = this.columnNames; + + for(let i = 0; i < this.data.length; i++){ + for(let j = 0; j < names.length; j++){ + + let a = this.data[i][names[j]]; + let b = volttable.data[i][names[j]]; + + switch(this.columnTypes[j]){ + case "string": + case "double": + case "float": + case "byte": + case "tiny": + case "smallint": + case "short": + case "integer": + case "int": + if ( a !== b ) return false; + break; + case "date": + case "timestamp": + if ( a.getTime() !== b.getTime()) return false; + break; + case "bigint": + case "long": + case "decimal": + if ( !bigNumberEquals(a, b) ) return false; + break; + case "varbinary": + if ( !a.equals(b) ) return false; + } + } + + } + + return true; +}; + +module.exports = VoltTable; \ No newline at end of file diff --git a/package-lock.json b/package-lock.json deleted file mode 100644 index c9f6995..0000000 --- a/package-lock.json +++ /dev/null @@ -1,3852 +0,0 @@ -{ - "name": "voltjs", - "version": "2.0.0", - "lockfileVersion": 1, - "requires": true, - "dependencies": { - "acorn": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-5.2.1.tgz", - "integrity": "sha512-jG0u7c4Ly+3QkkW18V+NRDN+4bWHdln30NL1ZL2AvFZZmQe/BfopYCtghCKKVBUSetZ4QKcyA0pY6/4Gw8Pv8w==", - "dev": true - }, - "acorn-jsx": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-3.0.1.tgz", - "integrity": "sha1-r9+UiPsezvyDSPb7IvRk4ypYs2s=", - "dev": true, - "requires": { - "acorn": "3.3.0" - }, - "dependencies": { - "acorn": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-3.3.0.tgz", - "integrity": "sha1-ReN/s56No/JbruP/U2niu18iAXo=", - "dev": true - } - } - }, - "ajv": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-5.3.0.tgz", - "integrity": "sha1-RBT/dKUIecII7l/cgm4ywwNUnto=", - "dev": true, - "requires": { - "co": "4.6.0", - "fast-deep-equal": "1.0.0", - "fast-json-stable-stringify": "2.0.0", - "json-schema-traverse": "0.3.1" - } - }, - "ajv-keywords": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-2.1.1.tgz", - "integrity": "sha1-YXmX/F9gV2iUxDX5QNgZ4TW4B2I=", - "dev": true - }, - "ansi-escapes": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-3.0.0.tgz", - "integrity": "sha512-O/klc27mWNUigtv0F8NJWbLF00OcegQalkqKURWdosW08YZKi4m6CnSUSvIZG1otNJbTWhN01Hhz389DW7mvDQ==", - "dev": true - }, - "ansi-regex": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", - "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", - "dev": true - }, - "ansi-styles": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", - "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=", - "dev": true - }, - "argparse": { - "version": "1.0.9", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.9.tgz", - "integrity": "sha1-c9g7wmP4bpf4zE9rrhsOkKfSLIY=", - "dev": true, - "requires": { - "sprintf-js": "1.0.3" - } - }, - "array-union": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/array-union/-/array-union-1.0.2.tgz", - "integrity": "sha1-mjRBDk9OPaI96jdb5b5w8kd47Dk=", - "dev": true, - "requires": { - "array-uniq": "1.0.3" - } - }, - "array-uniq": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/array-uniq/-/array-uniq-1.0.3.tgz", - "integrity": "sha1-r2rId6Jcx/dOBYiUdThY39sk/bY=", - "dev": true - }, - "arrify": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/arrify/-/arrify-1.0.1.tgz", - "integrity": "sha1-iYUI2iIm84DfkEcoRWhJwVAaSw0=", - "dev": true - }, - "asn1": { - "version": "0.2.3", - "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.3.tgz", - "integrity": "sha1-2sh4dxPJlmhJ/IGAd36+nB3fO4Y=", - "dev": true - }, - "assert-plus": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-0.2.0.tgz", - "integrity": "sha1-104bh+ev/A24qttwIfP+SBAasjQ=", - "dev": true - }, - "asynckit": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", - "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=", - "dev": true - }, - "aws-sign2": { - "version": "0.6.0", - "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.6.0.tgz", - "integrity": "sha1-FDQt0428yU0OW4fXY81jYSwOeU8=", - "dev": true - }, - "aws4": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.6.0.tgz", - "integrity": "sha1-g+9cqGCysy5KDe7e6MdxudtXRx4=", - "dev": true - }, - "babel-code-frame": { - "version": "6.26.0", - "resolved": "https://registry.npmjs.org/babel-code-frame/-/babel-code-frame-6.26.0.tgz", - "integrity": "sha1-Y/1D99weO7fONZR9uP42mj9Yx0s=", - "dev": true, - "requires": { - "chalk": "1.1.3", - "esutils": "2.0.2", - "js-tokens": "3.0.2" - } - }, - "balanced-match": { - "version": "0.4.2", - "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-0.4.2.tgz", - "integrity": "sha1-yz8+PHMtwPAe5wtAPzAuYddwmDg=" - }, - "bcrypt-pbkdf": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.1.tgz", - "integrity": "sha1-Y7xdy2EzG5K8Bf1SiVPDNGKgb40=", - "dev": true, - "optional": true, - "requires": { - "tweetnacl": "0.14.5" - } - }, - "bignumber": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/bignumber/-/bignumber-1.1.0.tgz", - "integrity": "sha1-5qsKdD2l8+oBjlwXWX0SH3howVk=" - }, - "bind-obj-methods": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/bind-obj-methods/-/bind-obj-methods-1.0.0.tgz", - "integrity": "sha1-T1l5ysFXk633DkiBYeRj4gnKUJw=", - "dev": true - }, - "bluebird": { - "version": "3.5.1", - "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.5.1.tgz", - "integrity": "sha512-MKiLiV+I1AA596t9w1sQJ8jkiSr5+ZKi0WKrYGUn6d1Fx+Ij4tIj+m2WMQSGczs5jZVxV339chE8iwk6F64wjA==", - "dev": true - }, - "boom": { - "version": "2.10.1", - "resolved": "https://registry.npmjs.org/boom/-/boom-2.10.1.tgz", - "integrity": "sha1-OciRjO/1eZ+D+UkqhI9iWt0Mdm8=", - "dev": true, - "requires": { - "hoek": "2.16.3" - } - }, - "brace-expansion": { - "version": "1.1.7", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.7.tgz", - "integrity": "sha1-Pv/DxQ4ABTH7cg6v+A8K6O8jz1k=", - "requires": { - "balanced-match": "0.4.2", - "concat-map": "0.0.1" - } - }, - "caller-path": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/caller-path/-/caller-path-0.1.0.tgz", - "integrity": "sha1-lAhe9jWB7NPaqSREqP6U6CV3dR8=", - "dev": true, - "requires": { - "callsites": "0.2.0" - } - }, - "callsites": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/callsites/-/callsites-0.2.0.tgz", - "integrity": "sha1-r6uWJikQp/M8GaV3WCXGnzTjUMo=", - "dev": true - }, - "camelcase": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-4.1.0.tgz", - "integrity": "sha1-1UVjW+HjPFQmScaRc+Xeas+uNN0=", - "dev": true - }, - "caseless": { - "version": "0.11.0", - "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.11.0.tgz", - "integrity": "sha1-cVuW6phBWTzDMGeSP17GDr2k99c=", - "dev": true - }, - "chalk": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", - "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", - "dev": true, - "requires": { - "ansi-styles": "2.2.1", - "escape-string-regexp": "1.0.5", - "has-ansi": "2.0.0", - "strip-ansi": "3.0.1", - "supports-color": "2.0.0" - }, - "dependencies": { - "supports-color": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", - "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=", - "dev": true - } - } - }, - "circular-json": { - "version": "0.3.3", - "resolved": "https://registry.npmjs.org/circular-json/-/circular-json-0.3.3.tgz", - "integrity": "sha512-UZK3NBx2Mca+b5LsG7bY183pHWt5Y1xts4P3Pz7ENTwGVnJOUWbRb3ocjvX7hx9tq/yTAdclXm9sZ38gNuem4A==", - "dev": true - }, - "clean-yaml-object": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/clean-yaml-object/-/clean-yaml-object-0.1.0.tgz", - "integrity": "sha1-Y/sRDcLOGoTcIfbZM0h20BCui2g=", - "dev": true - }, - "cli": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/cli/-/cli-1.0.1.tgz", - "integrity": "sha1-IoF1NPJL+klQw01TLUjsvGIbjBQ=", - "requires": { - "exit": "0.1.2", - "glob": "7.1.2" - } - }, - "cli-cursor": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-2.1.0.tgz", - "integrity": "sha1-s12sN2R5+sw+lHR9QdDQ9SOP/LU=", - "dev": true, - "requires": { - "restore-cursor": "2.0.0" - } - }, - "cli-width": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/cli-width/-/cli-width-2.2.0.tgz", - "integrity": "sha1-/xnt6Kml5XkyQUewwR8PvLq+1jk=", - "dev": true - }, - "cliui": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/cliui/-/cliui-3.2.0.tgz", - "integrity": "sha1-EgYBU3qRbSmUD5NNo7SNWFo5IT0=", - "dev": true, - "requires": { - "string-width": "1.0.2", - "strip-ansi": "3.0.1", - "wrap-ansi": "2.1.0" - }, - "dependencies": { - "string-width": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", - "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", - "dev": true, - "requires": { - "code-point-at": "1.1.0", - "is-fullwidth-code-point": "1.0.0", - "strip-ansi": "3.0.1" - } - } - } - }, - "co": { - "version": "4.6.0", - "resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz", - "integrity": "sha1-bqa989hTrlTMuOR7+gvz+QMfsYQ=", - "dev": true - }, - "code-point-at": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz", - "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=", - "dev": true - }, - "color-convert": { - "version": "1.9.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.1.tgz", - "integrity": "sha512-mjGanIiwQJskCC18rPR6OmrZ6fm2Lc7PeGFYwCmy5J34wC6F1PzdGL6xeMfmgicfYcNLGuVFA3WzXtIDCQSZxQ==", - "dev": true, - "requires": { - "color-name": "1.1.3" - } - }, - "color-name": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", - "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", - "dev": true - }, - "color-support": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/color-support/-/color-support-1.1.3.tgz", - "integrity": "sha512-qiBjkpbMLO/HL68y+lh4q0/O1MZFj2RX6X/KmMa3+gJD3z+WwI1ZzDHysvqHGS3mP6mznPckpXmw1nI9cJjyRg==", - "dev": true - }, - "combined-stream": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.5.tgz", - "integrity": "sha1-k4NwpXtKUd6ix3wV1cX9+JUWQAk=", - "dev": true, - "requires": { - "delayed-stream": "1.0.0" - } - }, - "commander": { - "version": "2.11.0", - "resolved": "https://registry.npmjs.org/commander/-/commander-2.11.0.tgz", - "integrity": "sha512-b0553uYA5YAEGgyYIGYROzKQ7X5RAqedkfjiZxwi0kL1g3bOaBNNZfYkzt/CL0umgD5wc9Jec2FbB98CjkMRvQ==", - "dev": true - }, - "concat-map": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", - "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=" - }, - "concat-stream": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-1.6.0.tgz", - "integrity": "sha1-CqxmL9Ur54lk1VMvaUeE5wEQrPc=", - "dev": true, - "requires": { - "inherits": "2.0.3", - "readable-stream": "2.3.3", - "typedarray": "0.0.6" - } - }, - "core-util-is": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", - "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=", - "dev": true - }, - "coveralls": { - "version": "2.13.3", - "resolved": "https://registry.npmjs.org/coveralls/-/coveralls-2.13.3.tgz", - "integrity": "sha512-iiAmn+l1XqRwNLXhW8Rs5qHZRFMYp9ZIPjEOVRpC/c4so6Y/f4/lFi0FfR5B9cCqgyhkJ5cZmbvcVRfP8MHchw==", - "dev": true, - "requires": { - "js-yaml": "3.6.1", - "lcov-parse": "0.0.10", - "log-driver": "1.2.5", - "minimist": "1.2.0", - "request": "2.79.0" - }, - "dependencies": { - "js-yaml": { - "version": "3.6.1", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.6.1.tgz", - "integrity": "sha1-bl/mfYsgXOTSL60Ft3geja3MSzA=", - "dev": true, - "requires": { - "argparse": "1.0.9", - "esprima": "2.7.3" - } - } - } - }, - "cross-spawn": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-4.0.2.tgz", - "integrity": "sha1-e5JHYhwjrf3ThWAEqCPL45dCTUE=", - "dev": true, - "requires": { - "lru-cache": "4.1.1", - "which": "1.2.14" - } - }, - "cryptiles": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/cryptiles/-/cryptiles-2.0.5.tgz", - "integrity": "sha1-O9/s3GCBR8HGcgL6KR59ylnqo7g=", - "dev": true, - "requires": { - "boom": "2.10.1" - } - }, - "ctype": { - "version": "0.5.5", - "resolved": "https://registry.npmjs.org/ctype/-/ctype-0.5.5.tgz", - "integrity": "sha1-nzjF4eiYQOsfWXKQ0SKuKXJqVvs=" - }, - "dashdash": { - "version": "1.14.1", - "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", - "integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA=", - "dev": true, - "requires": { - "assert-plus": "1.0.0" - }, - "dependencies": { - "assert-plus": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", - "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=", - "dev": true - } - } - }, - "debug": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", - "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", - "requires": { - "ms": "2.0.0" - } - }, - "decamelize": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", - "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=", - "dev": true - }, - "deep-is": { - "version": "0.1.3", - "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.3.tgz", - "integrity": "sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ=", - "dev": true - }, - "del": { - "version": "2.2.2", - "resolved": "https://registry.npmjs.org/del/-/del-2.2.2.tgz", - "integrity": "sha1-wSyYHQZ4RshLyvhiz/kw2Qf/0ag=", - "dev": true, - "requires": { - "globby": "5.0.0", - "is-path-cwd": "1.0.0", - "is-path-in-cwd": "1.0.0", - "object-assign": "4.1.1", - "pify": "2.3.0", - "pinkie-promise": "2.0.1", - "rimraf": "2.6.2" - } - }, - "delayed-stream": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", - "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=", - "dev": true - }, - "diff": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/diff/-/diff-1.4.0.tgz", - "integrity": "sha1-fyjS657nsVqX79ic5j3P2qPMur8=", - "dev": true - }, - "doctrine": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-2.0.0.tgz", - "integrity": "sha1-xz2NKQnSIpHhoAejlYBNqLZl/mM=", - "dev": true, - "requires": { - "esutils": "2.0.2", - "isarray": "1.0.0" - } - }, - "ecc-jsbn": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.1.tgz", - "integrity": "sha1-D8c6ntXw1Tw4GTOYUj735UN3dQU=", - "dev": true, - "optional": true, - "requires": { - "jsbn": "0.1.1" - } - }, - "ejs": { - "version": "2.5.7", - "resolved": "https://registry.npmjs.org/ejs/-/ejs-2.5.7.tgz", - "integrity": "sha1-zIcsFoiArjxxiXYv1f/ACJbJUYo=", - "dev": true - }, - "escape-string-regexp": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", - "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", - "dev": true - }, - "eslint": { - "version": "4.11.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-4.11.0.tgz", - "integrity": "sha512-UWbhQpaKlm8h5x/VLwm0S1kheMrDj8jPwhnBMjr/Dlo3qqT7MvcN/UfKAR3E1N4lr4YNtOvS4m3hwsrVc/ky7g==", - "dev": true, - "requires": { - "ajv": "5.3.0", - "babel-code-frame": "6.26.0", - "chalk": "2.3.0", - "concat-stream": "1.6.0", - "cross-spawn": "5.1.0", - "debug": "3.1.0", - "doctrine": "2.0.0", - "eslint-scope": "3.7.1", - "espree": "3.5.2", - "esquery": "1.0.0", - "estraverse": "4.2.0", - "esutils": "2.0.2", - "file-entry-cache": "2.0.0", - "functional-red-black-tree": "1.0.1", - "glob": "7.1.2", - "globals": "9.18.0", - "ignore": "3.3.7", - "imurmurhash": "0.1.4", - "inquirer": "3.3.0", - "is-resolvable": "1.0.0", - "js-yaml": "3.10.0", - "json-stable-stringify-without-jsonify": "1.0.1", - "levn": "0.3.0", - "lodash": "4.17.4", - "minimatch": "3.0.4", - "mkdirp": "0.5.1", - "natural-compare": "1.4.0", - "optionator": "0.8.2", - "path-is-inside": "1.0.2", - "pluralize": "7.0.0", - "progress": "2.0.0", - "require-uncached": "1.0.3", - "semver": "5.4.1", - "strip-ansi": "4.0.0", - "strip-json-comments": "2.0.1", - "table": "4.0.2", - "text-table": "0.2.0" - }, - "dependencies": { - "ansi-regex": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", - "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", - "dev": true - }, - "ansi-styles": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz", - "integrity": "sha512-NnSOmMEYtVR2JVMIGTzynRkkaxtiq1xnFBcdQD/DnNCYPoEPsVJhM98BDyaoNOQIi7p4okdi3E27eN7GQbsUug==", - "dev": true, - "requires": { - "color-convert": "1.9.1" - } - }, - "chalk": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.3.0.tgz", - "integrity": "sha512-Az5zJR2CBujap2rqXGaJKaPHyJ0IrUimvYNX+ncCy8PJP4ltOGTrHUIo097ZaL2zMeKYpiCdqDvS6zdrTFok3Q==", - "dev": true, - "requires": { - "ansi-styles": "3.2.0", - "escape-string-regexp": "1.0.5", - "supports-color": "4.5.0" - } - }, - "cross-spawn": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-5.1.0.tgz", - "integrity": "sha1-6L0O/uWPz/b4+UUQoKVUu/ojVEk=", - "dev": true, - "requires": { - "lru-cache": "4.1.1", - "shebang-command": "1.2.0", - "which": "1.2.14" - } - }, - "strip-ansi": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", - "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", - "dev": true, - "requires": { - "ansi-regex": "3.0.0" - } - } - } - }, - "eslint-scope": { - "version": "3.7.1", - "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-3.7.1.tgz", - "integrity": "sha1-PWPD7f2gLgbgGkUq2IyqzHzctug=", - "dev": true, - "requires": { - "esrecurse": "4.2.0", - "estraverse": "4.2.0" - } - }, - "espree": { - "version": "3.5.2", - "resolved": "https://registry.npmjs.org/espree/-/espree-3.5.2.tgz", - "integrity": "sha512-sadKeYwaR/aJ3stC2CdvgXu1T16TdYN+qwCpcWbMnGJ8s0zNWemzrvb2GbD4OhmJ/fwpJjudThAlLobGbWZbCQ==", - "dev": true, - "requires": { - "acorn": "5.2.1", - "acorn-jsx": "3.0.1" - } - }, - "esprima": { - "version": "2.7.3", - "resolved": "https://registry.npmjs.org/esprima/-/esprima-2.7.3.tgz", - "integrity": "sha1-luO3DVd59q1JzQMmc9HDEnZ7pYE=", - "dev": true - }, - "esquery": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.0.0.tgz", - "integrity": "sha1-z7qLV9f7qT8XKYqKAGoEzaE9gPo=", - "dev": true, - "requires": { - "estraverse": "4.2.0" - } - }, - "esrecurse": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.2.0.tgz", - "integrity": "sha1-+pVo2Y04I/mkHZHpAtyrnqblsWM=", - "dev": true, - "requires": { - "estraverse": "4.2.0", - "object-assign": "4.1.1" - } - }, - "estraverse": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.2.0.tgz", - "integrity": "sha1-De4/7TH81GlhjOc0IJn8GvoL2xM=", - "dev": true - }, - "esutils": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.2.tgz", - "integrity": "sha1-Cr9PHKpbyx96nYrMbepPqqBLrJs=", - "dev": true - }, - "events-to-array": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/events-to-array/-/events-to-array-1.1.2.tgz", - "integrity": "sha1-LUH1Y+H+QA7Uli/hpNXGp1Od9/Y=", - "dev": true - }, - "execa": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/execa/-/execa-0.7.0.tgz", - "integrity": "sha1-lEvs00zEHuMqY6n68nrVpl/Fl3c=", - "dev": true, - "requires": { - "cross-spawn": "5.1.0", - "get-stream": "3.0.0", - "is-stream": "1.1.0", - "npm-run-path": "2.0.2", - "p-finally": "1.0.0", - "signal-exit": "3.0.2", - "strip-eof": "1.0.0" - }, - "dependencies": { - "cross-spawn": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-5.1.0.tgz", - "integrity": "sha1-6L0O/uWPz/b4+UUQoKVUu/ojVEk=", - "dev": true, - "requires": { - "lru-cache": "4.1.1", - "shebang-command": "1.2.0", - "which": "1.2.14" - } - } - } - }, - "exit": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/exit/-/exit-0.1.2.tgz", - "integrity": "sha1-BjJjj42HfMghB9MKD/8aF8uhzQw=" - }, - "extend": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.1.tgz", - "integrity": "sha1-p1Xqe8Gt/MWjHOfnYtuq3F5jZEQ=", - "dev": true - }, - "external-editor": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/external-editor/-/external-editor-2.0.5.tgz", - "integrity": "sha512-Msjo64WT5W+NhOpQXh0nOHm+n0RfU1QUwDnKYvJ8dEJ8zlwLrqXNTv5mSUTJpepf41PDJGyhueTw2vNZW+Fr/w==", - "dev": true, - "requires": { - "iconv-lite": "0.4.19", - "jschardet": "1.6.0", - "tmp": "0.0.33" - } - }, - "extsprintf": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz", - "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=", - "dev": true - }, - "fast-deep-equal": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-1.0.0.tgz", - "integrity": "sha1-liVqO8l1WV6zbYLpkp0GDYk0Of8=", - "dev": true - }, - "fast-json-stable-stringify": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz", - "integrity": "sha1-1RQsDK7msRifh9OnYREGT4bIu/I=", - "dev": true - }, - "fast-levenshtein": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", - "integrity": "sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=", - "dev": true - }, - "figures": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/figures/-/figures-2.0.0.tgz", - "integrity": "sha1-OrGi0qYsi/tDGgyUy3l6L84nyWI=", - "dev": true, - "requires": { - "escape-string-regexp": "1.0.5" - } - }, - "file-entry-cache": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-2.0.0.tgz", - "integrity": "sha1-w5KZDD5oR4PYOLjISkXYoEhFg2E=", - "dev": true, - "requires": { - "flat-cache": "1.3.0", - "object-assign": "4.1.1" - } - }, - "find-up": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz", - "integrity": "sha1-RdG35QbHF93UgndaK3eSCjwMV6c=", - "dev": true, - "requires": { - "locate-path": "2.0.0" - } - }, - "flat-cache": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-1.3.0.tgz", - "integrity": "sha1-0wMLMrOBVPTjt+nHCfSQ9++XxIE=", - "dev": true, - "requires": { - "circular-json": "0.3.3", - "del": "2.2.2", - "graceful-fs": "4.1.11", - "write": "0.2.1" - } - }, - "foreground-child": { - "version": "1.5.6", - "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-1.5.6.tgz", - "integrity": "sha1-T9ca0t/elnibmApcCilZN8svXOk=", - "dev": true, - "requires": { - "cross-spawn": "4.0.2", - "signal-exit": "3.0.2" - } - }, - "forever-agent": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", - "integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=", - "dev": true - }, - "form-data": { - "version": "2.1.4", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.1.4.tgz", - "integrity": "sha1-M8GDrPGTJ27KqYFDpp6Uv+4XUNE=", - "dev": true, - "requires": { - "asynckit": "0.4.0", - "combined-stream": "1.0.5", - "mime-types": "2.1.17" - } - }, - "fs-exists-cached": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/fs-exists-cached/-/fs-exists-cached-1.0.0.tgz", - "integrity": "sha1-zyVVTKBQ3EmuZla0HeQiWJidy84=", - "dev": true - }, - "fs.realpath": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", - "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=" - }, - "function-loop": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/function-loop/-/function-loop-1.0.1.tgz", - "integrity": "sha1-gHa7MF6OajzO7ikgdl8zDRkPNAw=", - "dev": true - }, - "functional-red-black-tree": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz", - "integrity": "sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc=", - "dev": true - }, - "generate-function": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/generate-function/-/generate-function-2.0.0.tgz", - "integrity": "sha1-aFj+fAlpt9TpCTM3ZHrHn2DfvnQ=", - "dev": true - }, - "generate-object-property": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/generate-object-property/-/generate-object-property-1.2.0.tgz", - "integrity": "sha1-nA4cQDCM6AT0eDYYuTf6iPmdUNA=", - "dev": true, - "requires": { - "is-property": "1.0.2" - } - }, - "get-caller-file": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-1.0.2.tgz", - "integrity": "sha1-9wLmMSfn4jHBYKgMFVSstw1QR+U=", - "dev": true - }, - "get-stream": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-3.0.0.tgz", - "integrity": "sha1-jpQ9E1jcN1VQVOy+LtsFqhdO3hQ=", - "dev": true - }, - "getpass": { - "version": "0.1.7", - "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", - "integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=", - "dev": true, - "requires": { - "assert-plus": "1.0.0" - }, - "dependencies": { - "assert-plus": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", - "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=", - "dev": true - } - } - }, - "glob": { - "version": "7.1.2", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz", - "integrity": "sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ==", - "requires": { - "fs.realpath": "1.0.0", - "inflight": "1.0.6", - "inherits": "2.0.3", - "minimatch": "3.0.4", - "once": "1.4.0", - "path-is-absolute": "1.0.1" - } - }, - "globals": { - "version": "9.18.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-9.18.0.tgz", - "integrity": "sha512-S0nG3CLEQiY/ILxqtztTWH/3iRRdyBLw6KMDxnKMchrtbj2OFmehVh0WUCfW3DUrIgx/qFrJPICrq4Z4sTR9UQ==", - "dev": true - }, - "globby": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/globby/-/globby-5.0.0.tgz", - "integrity": "sha1-69hGZ8oNuzMLmbz8aOrCvFQ3Dg0=", - "dev": true, - "requires": { - "array-union": "1.0.2", - "arrify": "1.0.1", - "glob": "7.1.2", - "object-assign": "4.1.1", - "pify": "2.3.0", - "pinkie-promise": "2.0.1" - } - }, - "graceful-fs": { - "version": "4.1.11", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.11.tgz", - "integrity": "sha1-Dovf5NHduIVNZOBOp8AOKgJuVlg=", - "dev": true - }, - "har-validator": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-2.0.6.tgz", - "integrity": "sha1-zcvAgYgmWtEZtqWnyKtw7s+10n0=", - "dev": true, - "requires": { - "chalk": "1.1.3", - "commander": "2.11.0", - "is-my-json-valid": "2.16.1", - "pinkie-promise": "2.0.1" - } - }, - "has-ansi": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz", - "integrity": "sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE=", - "dev": true, - "requires": { - "ansi-regex": "2.1.1" - } - }, - "has-flag": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-2.0.0.tgz", - "integrity": "sha1-6CB68cx7MNRGzHC3NLXovhj4jVE=" - }, - "hawk": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/hawk/-/hawk-3.1.3.tgz", - "integrity": "sha1-B4REvXwWQLD+VA0sm3PVlnjo4cQ=", - "dev": true, - "requires": { - "boom": "2.10.1", - "cryptiles": "2.0.5", - "hoek": "2.16.3", - "sntp": "1.0.9" - } - }, - "hoek": { - "version": "2.16.3", - "resolved": "https://registry.npmjs.org/hoek/-/hoek-2.16.3.tgz", - "integrity": "sha1-ILt0A9POo5jpHcRxCo/xuCdKJe0=", - "dev": true - }, - "http-signature": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.1.1.tgz", - "integrity": "sha1-33LiZwZs0Kxn+3at+OE0qPvPkb8=", - "dev": true, - "requires": { - "assert-plus": "0.2.0", - "jsprim": "1.4.1", - "sshpk": "1.13.1" - } - }, - "iconv-lite": { - "version": "0.4.19", - "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.19.tgz", - "integrity": "sha512-oTZqweIP51xaGPI4uPa56/Pri/480R+mo7SeU+YETByQNhDG55ycFyNLIgta9vXhILrxXDmF7ZGhqZIcuN0gJQ==", - "dev": true - }, - "ignore": { - "version": "3.3.7", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-3.3.7.tgz", - "integrity": "sha512-YGG3ejvBNHRqu0559EOxxNFihD0AjpvHlC/pdGKd3X3ofe+CoJkYazwNJYTNebqpPKN+VVQbh4ZFn1DivMNuHA==", - "dev": true - }, - "imurmurhash": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", - "integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=", - "dev": true - }, - "inflight": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", - "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", - "requires": { - "once": "1.4.0", - "wrappy": "1.0.2" - } - }, - "inherits": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", - "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=" - }, - "inquirer": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-3.3.0.tgz", - "integrity": "sha512-h+xtnyk4EwKvFWHrUYsWErEVR+igKtLdchu+o0Z1RL7VU/jVMFbYir2bp6bAj8efFNxWqHX0dIss6fJQ+/+qeQ==", - "dev": true, - "requires": { - "ansi-escapes": "3.0.0", - "chalk": "2.3.0", - "cli-cursor": "2.1.0", - "cli-width": "2.2.0", - "external-editor": "2.0.5", - "figures": "2.0.0", - "lodash": "4.17.4", - "mute-stream": "0.0.7", - "run-async": "2.3.0", - "rx-lite": "4.0.8", - "rx-lite-aggregates": "4.0.8", - "string-width": "2.1.1", - "strip-ansi": "4.0.0", - "through": "2.3.8" - }, - "dependencies": { - "ansi-regex": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", - "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", - "dev": true - }, - "ansi-styles": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz", - "integrity": "sha512-NnSOmMEYtVR2JVMIGTzynRkkaxtiq1xnFBcdQD/DnNCYPoEPsVJhM98BDyaoNOQIi7p4okdi3E27eN7GQbsUug==", - "dev": true, - "requires": { - "color-convert": "1.9.1" - } - }, - "chalk": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.3.0.tgz", - "integrity": "sha512-Az5zJR2CBujap2rqXGaJKaPHyJ0IrUimvYNX+ncCy8PJP4ltOGTrHUIo097ZaL2zMeKYpiCdqDvS6zdrTFok3Q==", - "dev": true, - "requires": { - "ansi-styles": "3.2.0", - "escape-string-regexp": "1.0.5", - "supports-color": "4.5.0" - } - }, - "strip-ansi": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", - "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", - "dev": true, - "requires": { - "ansi-regex": "3.0.0" - } - } - } - }, - "invert-kv": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/invert-kv/-/invert-kv-1.0.0.tgz", - "integrity": "sha1-EEqOSqym09jNFXqO+L+rLXo//bY=", - "dev": true - }, - "is-fullwidth-code-point": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", - "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", - "dev": true, - "requires": { - "number-is-nan": "1.0.1" - } - }, - "is-my-json-valid": { - "version": "2.16.1", - "resolved": "https://registry.npmjs.org/is-my-json-valid/-/is-my-json-valid-2.16.1.tgz", - "integrity": "sha512-ochPsqWS1WXj8ZnMIV0vnNXooaMhp7cyL4FMSIPKTtnV0Ha/T19G2b9kkhcNsabV9bxYkze7/aLZJb/bYuFduQ==", - "dev": true, - "requires": { - "generate-function": "2.0.0", - "generate-object-property": "1.2.0", - "jsonpointer": "4.0.1", - "xtend": "4.0.1" - } - }, - "is-path-cwd": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-path-cwd/-/is-path-cwd-1.0.0.tgz", - "integrity": "sha1-0iXsIxMuie3Tj9p2dHLmLmXxEG0=", - "dev": true - }, - "is-path-in-cwd": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-path-in-cwd/-/is-path-in-cwd-1.0.0.tgz", - "integrity": "sha1-ZHdYK4IU1gI0YJRWcAO+ip6sBNw=", - "dev": true, - "requires": { - "is-path-inside": "1.0.0" - } - }, - "is-path-inside": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-1.0.0.tgz", - "integrity": "sha1-/AbloWg/vaE95mev9xe7wQpI838=", - "dev": true, - "requires": { - "path-is-inside": "1.0.2" - } - }, - "is-promise": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/is-promise/-/is-promise-2.1.0.tgz", - "integrity": "sha1-eaKp7OfwlugPNtKy87wWwf9L8/o=", - "dev": true - }, - "is-property": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/is-property/-/is-property-1.0.2.tgz", - "integrity": "sha1-V/4cTkhHTt1lsJkR8msc1Ald2oQ=", - "dev": true - }, - "is-resolvable": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-resolvable/-/is-resolvable-1.0.0.tgz", - "integrity": "sha1-jfV8YeouPFAUCNEA+wE8+NbgzGI=", - "dev": true, - "requires": { - "tryit": "1.0.3" - } - }, - "is-stream": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz", - "integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=", - "dev": true - }, - "is-typedarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", - "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=", - "dev": true - }, - "isarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", - "dev": true - }, - "isexe": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", - "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", - "dev": true - }, - "isstream": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", - "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=", - "dev": true - }, - "js-tokens": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-3.0.2.tgz", - "integrity": "sha1-mGbfOVECEw449/mWvOtlRDIJwls=", - "dev": true - }, - "js-yaml": { - "version": "3.10.0", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.10.0.tgz", - "integrity": "sha512-O2v52ffjLa9VeM43J4XocZE//WT9N0IiwDa3KSHH7Tu8CtH+1qM8SIZvnsTh6v+4yFy5KUY3BHUVwjpfAWsjIA==", - "dev": true, - "requires": { - "argparse": "1.0.9", - "esprima": "4.0.0" - }, - "dependencies": { - "esprima": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.0.tgz", - "integrity": "sha512-oftTcaMu/EGrEIu904mWteKIv8vMuOgGYo7EhVJJN00R/EED9DCua/xxHRdYnKtcECzVg7xOWhflvJMnqcFZjw==", - "dev": true - } - } - }, - "jsbn": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", - "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=", - "dev": true, - "optional": true - }, - "jschardet": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/jschardet/-/jschardet-1.6.0.tgz", - "integrity": "sha512-xYuhvQ7I9PDJIGBWev9xm0+SMSed3ZDBAmvVjbFR1ZRLAF+vlXcQu6cRI9uAlj81rzikElRVteehwV7DuX2ZmQ==", - "dev": true - }, - "json-schema": { - "version": "0.2.3", - "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz", - "integrity": "sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM=", - "dev": true - }, - "json-schema-traverse": { - "version": "0.3.1", - "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.3.1.tgz", - "integrity": "sha1-NJptRMU6Ud6JtAgFxdXlm0F9M0A=", - "dev": true - }, - "json-stable-stringify-without-jsonify": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", - "integrity": "sha1-nbe1lJatPzz+8wp1FC0tkwrXJlE=", - "dev": true - }, - "json-stringify-safe": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", - "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=", - "dev": true - }, - "jsonpointer": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/jsonpointer/-/jsonpointer-4.0.1.tgz", - "integrity": "sha1-T9kss04OnbPInIYi7PUfm5eMbLk=", - "dev": true - }, - "jsprim": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz", - "integrity": "sha1-MT5mvB5cwG5Di8G3SZwuXFastqI=", - "dev": true, - "requires": { - "assert-plus": "1.0.0", - "extsprintf": "1.3.0", - "json-schema": "0.2.3", - "verror": "1.10.0" - }, - "dependencies": { - "assert-plus": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", - "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=", - "dev": true - } - } - }, - "lcid": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/lcid/-/lcid-1.0.0.tgz", - "integrity": "sha1-MIrMr6C8SDo4Z7S28rlQYlHRuDU=", - "dev": true, - "requires": { - "invert-kv": "1.0.0" - } - }, - "lcov-parse": { - "version": "0.0.10", - "resolved": "https://registry.npmjs.org/lcov-parse/-/lcov-parse-0.0.10.tgz", - "integrity": "sha1-GwuP+ayceIklBYK3C3ExXZ2m2aM=", - "dev": true - }, - "levn": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/levn/-/levn-0.3.0.tgz", - "integrity": "sha1-OwmSTt+fCDwEkP3UwLxEIeBHZO4=", - "dev": true, - "requires": { - "prelude-ls": "1.1.2", - "type-check": "0.3.2" - } - }, - "locate-path": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-2.0.0.tgz", - "integrity": "sha1-K1aLJl7slExtnA3pw9u7ygNUzY4=", - "dev": true, - "requires": { - "p-locate": "2.0.0", - "path-exists": "3.0.0" - } - }, - "lodash": { - "version": "4.17.4", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.4.tgz", - "integrity": "sha1-eCA6TRwyiuHYbcpkYONptX9AVa4=", - "dev": true - }, - "log-driver": { - "version": "1.2.5", - "resolved": "https://registry.npmjs.org/log-driver/-/log-driver-1.2.5.tgz", - "integrity": "sha1-euTsJXMC/XkNVXyxDJcQDYV7AFY=", - "dev": true - }, - "lru-cache": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-4.1.1.tgz", - "integrity": "sha512-q4spe4KTfsAS1SUHLO0wz8Qiyf1+vMIAgpRYioFYDMNqKfHQbg+AVDH3i4fvpl71/P1L0dBl+fQi+P37UYf0ew==", - "dev": true, - "requires": { - "pseudomap": "1.0.2", - "yallist": "2.1.2" - } - }, - "mem": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/mem/-/mem-1.1.0.tgz", - "integrity": "sha1-Xt1StIXKHZAP5kiVUFOZoN+kX3Y=", - "dev": true, - "requires": { - "mimic-fn": "1.1.0" - } - }, - "mime-db": { - "version": "1.30.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.30.0.tgz", - "integrity": "sha1-dMZD2i3Z1qRTmZY0ZbJtXKfXHwE=", - "dev": true - }, - "mime-types": { - "version": "2.1.17", - "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.17.tgz", - "integrity": "sha1-Cdejk/A+mVp5+K+Fe3Cp4KsWVXo=", - "dev": true, - "requires": { - "mime-db": "1.30.0" - } - }, - "mimic-fn": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-1.1.0.tgz", - "integrity": "sha1-5md4PZLonb00KBi1IwudYqZyrRg=", - "dev": true - }, - "minimatch": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", - "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", - "requires": { - "brace-expansion": "1.1.7" - } - }, - "minimist": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", - "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=", - "dev": true - }, - "mkdirp": { - "version": "0.5.1", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", - "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", - "dev": true, - "requires": { - "minimist": "0.0.8" - }, - "dependencies": { - "minimist": { - "version": "0.0.8", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", - "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", - "dev": true - } - } - }, - "ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" - }, - "mute-stream": { - "version": "0.0.7", - "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.7.tgz", - "integrity": "sha1-MHXOk7whuPq0PhvE2n6BFe0ee6s=", - "dev": true - }, - "natural-compare": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", - "integrity": "sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=", - "dev": true - }, - "nodeunit": { - "version": "0.11.2", - "resolved": "https://registry.npmjs.org/nodeunit/-/nodeunit-0.11.2.tgz", - "integrity": "sha512-rlr0Fgd66nLmWwgVFj40TZp5jo47/YqaPQtoHG78mt+DVQhaLhA8EJJYCf2lozgYplPv+jJMLt8bCP34zo05mQ==", - "dev": true, - "requires": { - "ejs": "2.5.7", - "tap": "10.7.3" - } - }, - "npm-run-path": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-2.0.2.tgz", - "integrity": "sha1-NakjLfo11wZ7TLLd8jV7GHFTbF8=", - "dev": true, - "requires": { - "path-key": "2.0.1" - } - }, - "number-is-nan": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz", - "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=", - "dev": true - }, - "nyc": { - "version": "11.3.0", - "resolved": "https://registry.npmjs.org/nyc/-/nyc-11.3.0.tgz", - "integrity": "sha512-oUu0WHt1k/JMIODvAYXX6C50Mupw2GO34P/Jdg2ty9xrLufBthHiKR2gf08aF+9S0abW1fl24R7iKRBXzibZmg==", - "dev": true, - "requires": { - "archy": "1.0.0", - "arrify": "1.0.1", - "caching-transform": "1.0.1", - "convert-source-map": "1.5.0", - "debug-log": "1.0.1", - "default-require-extensions": "1.0.0", - "find-cache-dir": "0.1.1", - "find-up": "2.1.0", - "foreground-child": "1.5.6", - "glob": "7.1.2", - "istanbul-lib-coverage": "1.1.1", - "istanbul-lib-hook": "1.1.0", - "istanbul-lib-instrument": "1.9.1", - "istanbul-lib-report": "1.1.2", - "istanbul-lib-source-maps": "1.2.2", - "istanbul-reports": "1.1.3", - "md5-hex": "1.3.0", - "merge-source-map": "1.0.4", - "micromatch": "2.3.11", - "mkdirp": "0.5.1", - "resolve-from": "2.0.0", - "rimraf": "2.6.2", - "signal-exit": "3.0.2", - "spawn-wrap": "1.3.8", - "test-exclude": "4.1.1", - "yargs": "10.0.3", - "yargs-parser": "8.0.0" - }, - "dependencies": { - "align-text": { - "version": "0.1.4", - "bundled": true, - "dev": true, - "requires": { - "kind-of": "3.2.2", - "longest": "1.0.1", - "repeat-string": "1.6.1" - } - }, - "amdefine": { - "version": "1.0.1", - "bundled": true, - "dev": true - }, - "ansi-regex": { - "version": "2.1.1", - "bundled": true, - "dev": true - }, - "ansi-styles": { - "version": "2.2.1", - "bundled": true, - "dev": true - }, - "append-transform": { - "version": "0.4.0", - "bundled": true, - "dev": true, - "requires": { - "default-require-extensions": "1.0.0" - } - }, - "archy": { - "version": "1.0.0", - "bundled": true, - "dev": true - }, - "arr-diff": { - "version": "2.0.0", - "bundled": true, - "dev": true, - "requires": { - "arr-flatten": "1.1.0" - } - }, - "arr-flatten": { - "version": "1.1.0", - "bundled": true, - "dev": true - }, - "array-unique": { - "version": "0.2.1", - "bundled": true, - "dev": true - }, - "arrify": { - "version": "1.0.1", - "bundled": true, - "dev": true - }, - "async": { - "version": "1.5.2", - "bundled": true, - "dev": true - }, - "babel-code-frame": { - "version": "6.26.0", - "bundled": true, - "dev": true, - "requires": { - "chalk": "1.1.3", - "esutils": "2.0.2", - "js-tokens": "3.0.2" - } - }, - "babel-generator": { - "version": "6.26.0", - "bundled": true, - "dev": true, - "requires": { - "babel-messages": "6.23.0", - "babel-runtime": "6.26.0", - "babel-types": "6.26.0", - "detect-indent": "4.0.0", - "jsesc": "1.3.0", - "lodash": "4.17.4", - "source-map": "0.5.7", - "trim-right": "1.0.1" - } - }, - "babel-messages": { - "version": "6.23.0", - "bundled": true, - "dev": true, - "requires": { - "babel-runtime": "6.26.0" - } - }, - "babel-runtime": { - "version": "6.26.0", - "bundled": true, - "dev": true, - "requires": { - "core-js": "2.5.1", - "regenerator-runtime": "0.11.0" - } - }, - "babel-template": { - "version": "6.26.0", - "bundled": true, - "dev": true, - "requires": { - "babel-runtime": "6.26.0", - "babel-traverse": "6.26.0", - "babel-types": "6.26.0", - "babylon": "6.18.0", - "lodash": "4.17.4" - } - }, - "babel-traverse": { - "version": "6.26.0", - "bundled": true, - "dev": true, - "requires": { - "babel-code-frame": "6.26.0", - "babel-messages": "6.23.0", - "babel-runtime": "6.26.0", - "babel-types": "6.26.0", - "babylon": "6.18.0", - "debug": "2.6.9", - "globals": "9.18.0", - "invariant": "2.2.2", - "lodash": "4.17.4" - } - }, - "babel-types": { - "version": "6.26.0", - "bundled": true, - "dev": true, - "requires": { - "babel-runtime": "6.26.0", - "esutils": "2.0.2", - "lodash": "4.17.4", - "to-fast-properties": "1.0.3" - } - }, - "babylon": { - "version": "6.18.0", - "bundled": true, - "dev": true - }, - "balanced-match": { - "version": "1.0.0", - "bundled": true, - "dev": true - }, - "brace-expansion": { - "version": "1.1.8", - "bundled": true, - "dev": true, - "requires": { - "balanced-match": "1.0.0", - "concat-map": "0.0.1" - } - }, - "braces": { - "version": "1.8.5", - "bundled": true, - "dev": true, - "requires": { - "expand-range": "1.8.2", - "preserve": "0.2.0", - "repeat-element": "1.1.2" - } - }, - "builtin-modules": { - "version": "1.1.1", - "bundled": true, - "dev": true - }, - "caching-transform": { - "version": "1.0.1", - "bundled": true, - "dev": true, - "requires": { - "md5-hex": "1.3.0", - "mkdirp": "0.5.1", - "write-file-atomic": "1.3.4" - } - }, - "camelcase": { - "version": "1.2.1", - "bundled": true, - "dev": true, - "optional": true - }, - "center-align": { - "version": "0.1.3", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "align-text": "0.1.4", - "lazy-cache": "1.0.4" - } - }, - "chalk": { - "version": "1.1.3", - "bundled": true, - "dev": true, - "requires": { - "ansi-styles": "2.2.1", - "escape-string-regexp": "1.0.5", - "has-ansi": "2.0.0", - "strip-ansi": "3.0.1", - "supports-color": "2.0.0" - } - }, - "cliui": { - "version": "2.1.0", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "center-align": "0.1.3", - "right-align": "0.1.3", - "wordwrap": "0.0.2" - }, - "dependencies": { - "wordwrap": { - "version": "0.0.2", - "bundled": true, - "dev": true, - "optional": true - } - } - }, - "code-point-at": { - "version": "1.1.0", - "bundled": true, - "dev": true - }, - "commondir": { - "version": "1.0.1", - "bundled": true, - "dev": true - }, - "concat-map": { - "version": "0.0.1", - "bundled": true, - "dev": true - }, - "convert-source-map": { - "version": "1.5.0", - "bundled": true, - "dev": true - }, - "core-js": { - "version": "2.5.1", - "bundled": true, - "dev": true - }, - "cross-spawn": { - "version": "4.0.2", - "bundled": true, - "dev": true, - "requires": { - "lru-cache": "4.1.1", - "which": "1.3.0" - } - }, - "debug": { - "version": "2.6.9", - "bundled": true, - "dev": true, - "requires": { - "ms": "2.0.0" - } - }, - "debug-log": { - "version": "1.0.1", - "bundled": true, - "dev": true - }, - "decamelize": { - "version": "1.2.0", - "bundled": true, - "dev": true - }, - "default-require-extensions": { - "version": "1.0.0", - "bundled": true, - "dev": true, - "requires": { - "strip-bom": "2.0.0" - } - }, - "detect-indent": { - "version": "4.0.0", - "bundled": true, - "dev": true, - "requires": { - "repeating": "2.0.1" - } - }, - "error-ex": { - "version": "1.3.1", - "bundled": true, - "dev": true, - "requires": { - "is-arrayish": "0.2.1" - } - }, - "escape-string-regexp": { - "version": "1.0.5", - "bundled": true, - "dev": true - }, - "esutils": { - "version": "2.0.2", - "bundled": true, - "dev": true - }, - "execa": { - "version": "0.7.0", - "bundled": true, - "dev": true, - "requires": { - "cross-spawn": "5.1.0", - "get-stream": "3.0.0", - "is-stream": "1.1.0", - "npm-run-path": "2.0.2", - "p-finally": "1.0.0", - "signal-exit": "3.0.2", - "strip-eof": "1.0.0" - }, - "dependencies": { - "cross-spawn": { - "version": "5.1.0", - "bundled": true, - "dev": true, - "requires": { - "lru-cache": "4.1.1", - "shebang-command": "1.2.0", - "which": "1.3.0" - } - } - } - }, - "expand-brackets": { - "version": "0.1.5", - "bundled": true, - "dev": true, - "requires": { - "is-posix-bracket": "0.1.1" - } - }, - "expand-range": { - "version": "1.8.2", - "bundled": true, - "dev": true, - "requires": { - "fill-range": "2.2.3" - } - }, - "extglob": { - "version": "0.3.2", - "bundled": true, - "dev": true, - "requires": { - "is-extglob": "1.0.0" - } - }, - "filename-regex": { - "version": "2.0.1", - "bundled": true, - "dev": true - }, - "fill-range": { - "version": "2.2.3", - "bundled": true, - "dev": true, - "requires": { - "is-number": "2.1.0", - "isobject": "2.1.0", - "randomatic": "1.1.7", - "repeat-element": "1.1.2", - "repeat-string": "1.6.1" - } - }, - "find-cache-dir": { - "version": "0.1.1", - "bundled": true, - "dev": true, - "requires": { - "commondir": "1.0.1", - "mkdirp": "0.5.1", - "pkg-dir": "1.0.0" - } - }, - "find-up": { - "version": "2.1.0", - "bundled": true, - "dev": true, - "requires": { - "locate-path": "2.0.0" - } - }, - "for-in": { - "version": "1.0.2", - "bundled": true, - "dev": true - }, - "for-own": { - "version": "0.1.5", - "bundled": true, - "dev": true, - "requires": { - "for-in": "1.0.2" - } - }, - "foreground-child": { - "version": "1.5.6", - "bundled": true, - "dev": true, - "requires": { - "cross-spawn": "4.0.2", - "signal-exit": "3.0.2" - } - }, - "fs.realpath": { - "version": "1.0.0", - "bundled": true, - "dev": true - }, - "get-caller-file": { - "version": "1.0.2", - "bundled": true, - "dev": true - }, - "get-stream": { - "version": "3.0.0", - "bundled": true, - "dev": true - }, - "glob": { - "version": "7.1.2", - "bundled": true, - "dev": true, - "requires": { - "fs.realpath": "1.0.0", - "inflight": "1.0.6", - "inherits": "2.0.3", - "minimatch": "3.0.4", - "once": "1.4.0", - "path-is-absolute": "1.0.1" - } - }, - "glob-base": { - "version": "0.3.0", - "bundled": true, - "dev": true, - "requires": { - "glob-parent": "2.0.0", - "is-glob": "2.0.1" - } - }, - "glob-parent": { - "version": "2.0.0", - "bundled": true, - "dev": true, - "requires": { - "is-glob": "2.0.1" - } - }, - "globals": { - "version": "9.18.0", - "bundled": true, - "dev": true - }, - "graceful-fs": { - "version": "4.1.11", - "bundled": true, - "dev": true - }, - "handlebars": { - "version": "4.0.11", - "bundled": true, - "dev": true, - "requires": { - "async": "1.5.2", - "optimist": "0.6.1", - "source-map": "0.4.4", - "uglify-js": "2.8.29" - }, - "dependencies": { - "source-map": { - "version": "0.4.4", - "bundled": true, - "dev": true, - "requires": { - "amdefine": "1.0.1" - } - } - } - }, - "has-ansi": { - "version": "2.0.0", - "bundled": true, - "dev": true, - "requires": { - "ansi-regex": "2.1.1" - } - }, - "has-flag": { - "version": "1.0.0", - "bundled": true, - "dev": true - }, - "hosted-git-info": { - "version": "2.5.0", - "bundled": true, - "dev": true - }, - "imurmurhash": { - "version": "0.1.4", - "bundled": true, - "dev": true - }, - "inflight": { - "version": "1.0.6", - "bundled": true, - "dev": true, - "requires": { - "once": "1.4.0", - "wrappy": "1.0.2" - } - }, - "inherits": { - "version": "2.0.3", - "bundled": true, - "dev": true - }, - "invariant": { - "version": "2.2.2", - "bundled": true, - "dev": true, - "requires": { - "loose-envify": "1.3.1" - } - }, - "invert-kv": { - "version": "1.0.0", - "bundled": true, - "dev": true - }, - "is-arrayish": { - "version": "0.2.1", - "bundled": true, - "dev": true - }, - "is-buffer": { - "version": "1.1.5", - "bundled": true, - "dev": true - }, - "is-builtin-module": { - "version": "1.0.0", - "bundled": true, - "dev": true, - "requires": { - "builtin-modules": "1.1.1" - } - }, - "is-dotfile": { - "version": "1.0.3", - "bundled": true, - "dev": true - }, - "is-equal-shallow": { - "version": "0.1.3", - "bundled": true, - "dev": true, - "requires": { - "is-primitive": "2.0.0" - } - }, - "is-extendable": { - "version": "0.1.1", - "bundled": true, - "dev": true - }, - "is-extglob": { - "version": "1.0.0", - "bundled": true, - "dev": true - }, - "is-finite": { - "version": "1.0.2", - "bundled": true, - "dev": true, - "requires": { - "number-is-nan": "1.0.1" - } - }, - "is-fullwidth-code-point": { - "version": "1.0.0", - "bundled": true, - "dev": true, - "requires": { - "number-is-nan": "1.0.1" - } - }, - "is-glob": { - "version": "2.0.1", - "bundled": true, - "dev": true, - "requires": { - "is-extglob": "1.0.0" - } - }, - "is-number": { - "version": "2.1.0", - "bundled": true, - "dev": true, - "requires": { - "kind-of": "3.2.2" - } - }, - "is-posix-bracket": { - "version": "0.1.1", - "bundled": true, - "dev": true - }, - "is-primitive": { - "version": "2.0.0", - "bundled": true, - "dev": true - }, - "is-stream": { - "version": "1.1.0", - "bundled": true, - "dev": true - }, - "is-utf8": { - "version": "0.2.1", - "bundled": true, - "dev": true - }, - "isarray": { - "version": "1.0.0", - "bundled": true, - "dev": true - }, - "isexe": { - "version": "2.0.0", - "bundled": true, - "dev": true - }, - "isobject": { - "version": "2.1.0", - "bundled": true, - "dev": true, - "requires": { - "isarray": "1.0.0" - } - }, - "istanbul-lib-coverage": { - "version": "1.1.1", - "bundled": true, - "dev": true - }, - "istanbul-lib-hook": { - "version": "1.1.0", - "bundled": true, - "dev": true, - "requires": { - "append-transform": "0.4.0" - } - }, - "istanbul-lib-instrument": { - "version": "1.9.1", - "bundled": true, - "dev": true, - "requires": { - "babel-generator": "6.26.0", - "babel-template": "6.26.0", - "babel-traverse": "6.26.0", - "babel-types": "6.26.0", - "babylon": "6.18.0", - "istanbul-lib-coverage": "1.1.1", - "semver": "5.4.1" - } - }, - "istanbul-lib-report": { - "version": "1.1.2", - "bundled": true, - "dev": true, - "requires": { - "istanbul-lib-coverage": "1.1.1", - "mkdirp": "0.5.1", - "path-parse": "1.0.5", - "supports-color": "3.2.3" - }, - "dependencies": { - "supports-color": { - "version": "3.2.3", - "bundled": true, - "dev": true, - "requires": { - "has-flag": "1.0.0" - } - } - } - }, - "istanbul-lib-source-maps": { - "version": "1.2.2", - "bundled": true, - "dev": true, - "requires": { - "debug": "3.1.0", - "istanbul-lib-coverage": "1.1.1", - "mkdirp": "0.5.1", - "rimraf": "2.6.2", - "source-map": "0.5.7" - }, - "dependencies": { - "debug": { - "version": "3.1.0", - "bundled": true, - "dev": true, - "requires": { - "ms": "2.0.0" - } - } - } - }, - "istanbul-reports": { - "version": "1.1.3", - "bundled": true, - "dev": true, - "requires": { - "handlebars": "4.0.11" - } - }, - "js-tokens": { - "version": "3.0.2", - "bundled": true, - "dev": true - }, - "jsesc": { - "version": "1.3.0", - "bundled": true, - "dev": true - }, - "kind-of": { - "version": "3.2.2", - "bundled": true, - "dev": true, - "requires": { - "is-buffer": "1.1.5" - } - }, - "lazy-cache": { - "version": "1.0.4", - "bundled": true, - "dev": true, - "optional": true - }, - "lcid": { - "version": "1.0.0", - "bundled": true, - "dev": true, - "requires": { - "invert-kv": "1.0.0" - } - }, - "load-json-file": { - "version": "1.1.0", - "bundled": true, - "dev": true, - "requires": { - "graceful-fs": "4.1.11", - "parse-json": "2.2.0", - "pify": "2.3.0", - "pinkie-promise": "2.0.1", - "strip-bom": "2.0.0" - } - }, - "locate-path": { - "version": "2.0.0", - "bundled": true, - "dev": true, - "requires": { - "p-locate": "2.0.0", - "path-exists": "3.0.0" - }, - "dependencies": { - "path-exists": { - "version": "3.0.0", - "bundled": true, - "dev": true - } - } - }, - "lodash": { - "version": "4.17.4", - "bundled": true, - "dev": true - }, - "longest": { - "version": "1.0.1", - "bundled": true, - "dev": true - }, - "loose-envify": { - "version": "1.3.1", - "bundled": true, - "dev": true, - "requires": { - "js-tokens": "3.0.2" - } - }, - "lru-cache": { - "version": "4.1.1", - "bundled": true, - "dev": true, - "requires": { - "pseudomap": "1.0.2", - "yallist": "2.1.2" - } - }, - "md5-hex": { - "version": "1.3.0", - "bundled": true, - "dev": true, - "requires": { - "md5-o-matic": "0.1.1" - } - }, - "md5-o-matic": { - "version": "0.1.1", - "bundled": true, - "dev": true - }, - "mem": { - "version": "1.1.0", - "bundled": true, - "dev": true, - "requires": { - "mimic-fn": "1.1.0" - } - }, - "merge-source-map": { - "version": "1.0.4", - "bundled": true, - "dev": true, - "requires": { - "source-map": "0.5.7" - } - }, - "micromatch": { - "version": "2.3.11", - "bundled": true, - "dev": true, - "requires": { - "arr-diff": "2.0.0", - "array-unique": "0.2.1", - "braces": "1.8.5", - "expand-brackets": "0.1.5", - "extglob": "0.3.2", - "filename-regex": "2.0.1", - "is-extglob": "1.0.0", - "is-glob": "2.0.1", - "kind-of": "3.2.2", - "normalize-path": "2.1.1", - "object.omit": "2.0.1", - "parse-glob": "3.0.4", - "regex-cache": "0.4.4" - } - }, - "mimic-fn": { - "version": "1.1.0", - "bundled": true, - "dev": true - }, - "minimatch": { - "version": "3.0.4", - "bundled": true, - "dev": true, - "requires": { - "brace-expansion": "1.1.8" - } - }, - "minimist": { - "version": "0.0.8", - "bundled": true, - "dev": true - }, - "mkdirp": { - "version": "0.5.1", - "bundled": true, - "dev": true, - "requires": { - "minimist": "0.0.8" - } - }, - "ms": { - "version": "2.0.0", - "bundled": true, - "dev": true - }, - "normalize-package-data": { - "version": "2.4.0", - "bundled": true, - "dev": true, - "requires": { - "hosted-git-info": "2.5.0", - "is-builtin-module": "1.0.0", - "semver": "5.4.1", - "validate-npm-package-license": "3.0.1" - } - }, - "normalize-path": { - "version": "2.1.1", - "bundled": true, - "dev": true, - "requires": { - "remove-trailing-separator": "1.1.0" - } - }, - "npm-run-path": { - "version": "2.0.2", - "bundled": true, - "dev": true, - "requires": { - "path-key": "2.0.1" - } - }, - "number-is-nan": { - "version": "1.0.1", - "bundled": true, - "dev": true - }, - "object-assign": { - "version": "4.1.1", - "bundled": true, - "dev": true - }, - "object.omit": { - "version": "2.0.1", - "bundled": true, - "dev": true, - "requires": { - "for-own": "0.1.5", - "is-extendable": "0.1.1" - } - }, - "once": { - "version": "1.4.0", - "bundled": true, - "dev": true, - "requires": { - "wrappy": "1.0.2" - } - }, - "optimist": { - "version": "0.6.1", - "bundled": true, - "dev": true, - "requires": { - "minimist": "0.0.8", - "wordwrap": "0.0.3" - } - }, - "os-homedir": { - "version": "1.0.2", - "bundled": true, - "dev": true - }, - "os-locale": { - "version": "2.1.0", - "bundled": true, - "dev": true, - "requires": { - "execa": "0.7.0", - "lcid": "1.0.0", - "mem": "1.1.0" - } - }, - "p-finally": { - "version": "1.0.0", - "bundled": true, - "dev": true - }, - "p-limit": { - "version": "1.1.0", - "bundled": true, - "dev": true - }, - "p-locate": { - "version": "2.0.0", - "bundled": true, - "dev": true, - "requires": { - "p-limit": "1.1.0" - } - }, - "parse-glob": { - "version": "3.0.4", - "bundled": true, - "dev": true, - "requires": { - "glob-base": "0.3.0", - "is-dotfile": "1.0.3", - "is-extglob": "1.0.0", - "is-glob": "2.0.1" - } - }, - "parse-json": { - "version": "2.2.0", - "bundled": true, - "dev": true, - "requires": { - "error-ex": "1.3.1" - } - }, - "path-exists": { - "version": "2.1.0", - "bundled": true, - "dev": true, - "requires": { - "pinkie-promise": "2.0.1" - } - }, - "path-is-absolute": { - "version": "1.0.1", - "bundled": true, - "dev": true - }, - "path-key": { - "version": "2.0.1", - "bundled": true, - "dev": true - }, - "path-parse": { - "version": "1.0.5", - "bundled": true, - "dev": true - }, - "path-type": { - "version": "1.1.0", - "bundled": true, - "dev": true, - "requires": { - "graceful-fs": "4.1.11", - "pify": "2.3.0", - "pinkie-promise": "2.0.1" - } - }, - "pify": { - "version": "2.3.0", - "bundled": true, - "dev": true - }, - "pinkie": { - "version": "2.0.4", - "bundled": true, - "dev": true - }, - "pinkie-promise": { - "version": "2.0.1", - "bundled": true, - "dev": true, - "requires": { - "pinkie": "2.0.4" - } - }, - "pkg-dir": { - "version": "1.0.0", - "bundled": true, - "dev": true, - "requires": { - "find-up": "1.1.2" - }, - "dependencies": { - "find-up": { - "version": "1.1.2", - "bundled": true, - "dev": true, - "requires": { - "path-exists": "2.1.0", - "pinkie-promise": "2.0.1" - } - } - } - }, - "preserve": { - "version": "0.2.0", - "bundled": true, - "dev": true - }, - "pseudomap": { - "version": "1.0.2", - "bundled": true, - "dev": true - }, - "randomatic": { - "version": "1.1.7", - "bundled": true, - "dev": true, - "requires": { - "is-number": "3.0.0", - "kind-of": "4.0.0" - }, - "dependencies": { - "is-number": { - "version": "3.0.0", - "bundled": true, - "dev": true, - "requires": { - "kind-of": "3.2.2" - }, - "dependencies": { - "kind-of": { - "version": "3.2.2", - "bundled": true, - "dev": true, - "requires": { - "is-buffer": "1.1.5" - } - } - } - }, - "kind-of": { - "version": "4.0.0", - "bundled": true, - "dev": true, - "requires": { - "is-buffer": "1.1.5" - } - } - } - }, - "read-pkg": { - "version": "1.1.0", - "bundled": true, - "dev": true, - "requires": { - "load-json-file": "1.1.0", - "normalize-package-data": "2.4.0", - "path-type": "1.1.0" - } - }, - "read-pkg-up": { - "version": "1.0.1", - "bundled": true, - "dev": true, - "requires": { - "find-up": "1.1.2", - "read-pkg": "1.1.0" - }, - "dependencies": { - "find-up": { - "version": "1.1.2", - "bundled": true, - "dev": true, - "requires": { - "path-exists": "2.1.0", - "pinkie-promise": "2.0.1" - } - } - } - }, - "regenerator-runtime": { - "version": "0.11.0", - "bundled": true, - "dev": true - }, - "regex-cache": { - "version": "0.4.4", - "bundled": true, - "dev": true, - "requires": { - "is-equal-shallow": "0.1.3" - } - }, - "remove-trailing-separator": { - "version": "1.1.0", - "bundled": true, - "dev": true - }, - "repeat-element": { - "version": "1.1.2", - "bundled": true, - "dev": true - }, - "repeat-string": { - "version": "1.6.1", - "bundled": true, - "dev": true - }, - "repeating": { - "version": "2.0.1", - "bundled": true, - "dev": true, - "requires": { - "is-finite": "1.0.2" - } - }, - "require-directory": { - "version": "2.1.1", - "bundled": true, - "dev": true - }, - "require-main-filename": { - "version": "1.0.1", - "bundled": true, - "dev": true - }, - "resolve-from": { - "version": "2.0.0", - "bundled": true, - "dev": true - }, - "right-align": { - "version": "0.1.3", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "align-text": "0.1.4" - } - }, - "rimraf": { - "version": "2.6.2", - "bundled": true, - "dev": true, - "requires": { - "glob": "7.1.2" - } - }, - "semver": { - "version": "5.4.1", - "bundled": true, - "dev": true - }, - "set-blocking": { - "version": "2.0.0", - "bundled": true, - "dev": true - }, - "shebang-command": { - "version": "1.2.0", - "bundled": true, - "dev": true, - "requires": { - "shebang-regex": "1.0.0" - } - }, - "shebang-regex": { - "version": "1.0.0", - "bundled": true, - "dev": true - }, - "signal-exit": { - "version": "3.0.2", - "bundled": true, - "dev": true - }, - "slide": { - "version": "1.1.6", - "bundled": true, - "dev": true - }, - "source-map": { - "version": "0.5.7", - "bundled": true, - "dev": true - }, - "spawn-wrap": { - "version": "1.3.8", - "bundled": true, - "dev": true, - "requires": { - "foreground-child": "1.5.6", - "mkdirp": "0.5.1", - "os-homedir": "1.0.2", - "rimraf": "2.6.2", - "signal-exit": "3.0.2", - "which": "1.3.0" - } - }, - "spdx-correct": { - "version": "1.0.2", - "bundled": true, - "dev": true, - "requires": { - "spdx-license-ids": "1.2.2" - } - }, - "spdx-expression-parse": { - "version": "1.0.4", - "bundled": true, - "dev": true - }, - "spdx-license-ids": { - "version": "1.2.2", - "bundled": true, - "dev": true - }, - "string-width": { - "version": "2.1.1", - "bundled": true, - "dev": true, - "requires": { - "is-fullwidth-code-point": "2.0.0", - "strip-ansi": "4.0.0" - }, - "dependencies": { - "ansi-regex": { - "version": "3.0.0", - "bundled": true, - "dev": true - }, - "is-fullwidth-code-point": { - "version": "2.0.0", - "bundled": true, - "dev": true - }, - "strip-ansi": { - "version": "4.0.0", - "bundled": true, - "dev": true, - "requires": { - "ansi-regex": "3.0.0" - } - } - } - }, - "strip-ansi": { - "version": "3.0.1", - "bundled": true, - "dev": true, - "requires": { - "ansi-regex": "2.1.1" - } - }, - "strip-bom": { - "version": "2.0.0", - "bundled": true, - "dev": true, - "requires": { - "is-utf8": "0.2.1" - } - }, - "strip-eof": { - "version": "1.0.0", - "bundled": true, - "dev": true - }, - "supports-color": { - "version": "2.0.0", - "bundled": true, - "dev": true - }, - "test-exclude": { - "version": "4.1.1", - "bundled": true, - "dev": true, - "requires": { - "arrify": "1.0.1", - "micromatch": "2.3.11", - "object-assign": "4.1.1", - "read-pkg-up": "1.0.1", - "require-main-filename": "1.0.1" - } - }, - "to-fast-properties": { - "version": "1.0.3", - "bundled": true, - "dev": true - }, - "trim-right": { - "version": "1.0.1", - "bundled": true, - "dev": true - }, - "uglify-js": { - "version": "2.8.29", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "source-map": "0.5.7", - "uglify-to-browserify": "1.0.2", - "yargs": "3.10.0" - }, - "dependencies": { - "yargs": { - "version": "3.10.0", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "camelcase": "1.2.1", - "cliui": "2.1.0", - "decamelize": "1.2.0", - "window-size": "0.1.0" - } - } - } - }, - "uglify-to-browserify": { - "version": "1.0.2", - "bundled": true, - "dev": true, - "optional": true - }, - "validate-npm-package-license": { - "version": "3.0.1", - "bundled": true, - "dev": true, - "requires": { - "spdx-correct": "1.0.2", - "spdx-expression-parse": "1.0.4" - } - }, - "which": { - "version": "1.3.0", - "bundled": true, - "dev": true, - "requires": { - "isexe": "2.0.0" - } - }, - "which-module": { - "version": "2.0.0", - "bundled": true, - "dev": true - }, - "window-size": { - "version": "0.1.0", - "bundled": true, - "dev": true, - "optional": true - }, - "wordwrap": { - "version": "0.0.3", - "bundled": true, - "dev": true - }, - "wrap-ansi": { - "version": "2.1.0", - "bundled": true, - "dev": true, - "requires": { - "string-width": "1.0.2", - "strip-ansi": "3.0.1" - }, - "dependencies": { - "string-width": { - "version": "1.0.2", - "bundled": true, - "dev": true, - "requires": { - "code-point-at": "1.1.0", - "is-fullwidth-code-point": "1.0.0", - "strip-ansi": "3.0.1" - } - } - } - }, - "wrappy": { - "version": "1.0.2", - "bundled": true, - "dev": true - }, - "write-file-atomic": { - "version": "1.3.4", - "bundled": true, - "dev": true, - "requires": { - "graceful-fs": "4.1.11", - "imurmurhash": "0.1.4", - "slide": "1.1.6" - } - }, - "y18n": { - "version": "3.2.1", - "bundled": true, - "dev": true - }, - "yallist": { - "version": "2.1.2", - "bundled": true, - "dev": true - }, - "yargs": { - "version": "10.0.3", - "bundled": true, - "dev": true, - "requires": { - "cliui": "3.2.0", - "decamelize": "1.2.0", - "find-up": "2.1.0", - "get-caller-file": "1.0.2", - "os-locale": "2.1.0", - "require-directory": "2.1.1", - "require-main-filename": "1.0.1", - "set-blocking": "2.0.0", - "string-width": "2.1.1", - "which-module": "2.0.0", - "y18n": "3.2.1", - "yargs-parser": "8.0.0" - }, - "dependencies": { - "cliui": { - "version": "3.2.0", - "bundled": true, - "dev": true, - "requires": { - "string-width": "1.0.2", - "strip-ansi": "3.0.1", - "wrap-ansi": "2.1.0" - }, - "dependencies": { - "string-width": { - "version": "1.0.2", - "bundled": true, - "dev": true, - "requires": { - "code-point-at": "1.1.0", - "is-fullwidth-code-point": "1.0.0", - "strip-ansi": "3.0.1" - } - } - } - } - } - }, - "yargs-parser": { - "version": "8.0.0", - "bundled": true, - "dev": true, - "requires": { - "camelcase": "4.1.0" - }, - "dependencies": { - "camelcase": { - "version": "4.1.0", - "bundled": true, - "dev": true - } - } - } - } - }, - "oauth-sign": { - "version": "0.8.2", - "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.8.2.tgz", - "integrity": "sha1-Rqarfwrq2N6unsBWV4C31O/rnUM=", - "dev": true - }, - "object-assign": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", - "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=", - "dev": true - }, - "once": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", - "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", - "requires": { - "wrappy": "1.0.2" - } - }, - "onetime": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/onetime/-/onetime-2.0.1.tgz", - "integrity": "sha1-BnQoIw/WdEOyeUsiu6UotoZ5YtQ=", - "dev": true, - "requires": { - "mimic-fn": "1.1.0" - } - }, - "opener": { - "version": "1.4.3", - "resolved": "https://registry.npmjs.org/opener/-/opener-1.4.3.tgz", - "integrity": "sha1-XG2ixdflgx6P+jlklQ+NZnSskLg=", - "dev": true - }, - "optionator": { - "version": "0.8.2", - "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.8.2.tgz", - "integrity": "sha1-NkxeQJ0/TWMB1sC0wFu6UBgK62Q=", - "dev": true, - "requires": { - "deep-is": "0.1.3", - "fast-levenshtein": "2.0.6", - "levn": "0.3.0", - "prelude-ls": "1.1.2", - "type-check": "0.3.2", - "wordwrap": "1.0.0" - } - }, - "os-homedir": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz", - "integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M=", - "dev": true - }, - "os-locale": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/os-locale/-/os-locale-2.1.0.tgz", - "integrity": "sha512-3sslG3zJbEYcaC4YVAvDorjGxc7tv6KVATnLPZONiljsUncvihe9BQoVCEs0RZ1kmf4Hk9OBqlZfJZWI4GanKA==", - "dev": true, - "requires": { - "execa": "0.7.0", - "lcid": "1.0.0", - "mem": "1.1.0" - } - }, - "os-tmpdir": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", - "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=", - "dev": true - }, - "own-or": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/own-or/-/own-or-1.0.0.tgz", - "integrity": "sha1-Tod/vtqaLsgAD7wLyuOWRe6L+Nw=", - "dev": true - }, - "own-or-env": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/own-or-env/-/own-or-env-1.0.0.tgz", - "integrity": "sha1-nvkg/IHi5jz1nUEQElg2jPT8pPs=", - "dev": true - }, - "p-finally": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz", - "integrity": "sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4=", - "dev": true - }, - "p-limit": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-1.1.0.tgz", - "integrity": "sha1-sH/y2aXYi+yAYDWJWiurZqJ5iLw=", - "dev": true - }, - "p-locate": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-2.0.0.tgz", - "integrity": "sha1-IKAQOyIqcMj9OcwuWAaA893l7EM=", - "dev": true, - "requires": { - "p-limit": "1.1.0" - } - }, - "path-exists": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", - "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=", - "dev": true - }, - "path-is-absolute": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", - "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=" - }, - "path-is-inside": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/path-is-inside/-/path-is-inside-1.0.2.tgz", - "integrity": "sha1-NlQX3t5EQw0cEa9hAn+s8HS9/FM=", - "dev": true - }, - "path-key": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz", - "integrity": "sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A=", - "dev": true - }, - "pify": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", - "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", - "dev": true - }, - "pinkie": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/pinkie/-/pinkie-2.0.4.tgz", - "integrity": "sha1-clVrgM+g1IqXToDnckjoDtT3+HA=", - "dev": true - }, - "pinkie-promise": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/pinkie-promise/-/pinkie-promise-2.0.1.tgz", - "integrity": "sha1-ITXW36ejWMBprJsXh3YogihFD/o=", - "dev": true, - "requires": { - "pinkie": "2.0.4" - } - }, - "pluralize": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/pluralize/-/pluralize-7.0.0.tgz", - "integrity": "sha512-ARhBOdzS3e41FbkW/XWrTEtukqqLoK5+Z/4UeDaLuSW+39JPeFgs4gCGqsrJHVZX0fUrx//4OF0K1CUGwlIFow==", - "dev": true - }, - "prelude-ls": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.2.tgz", - "integrity": "sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ=", - "dev": true - }, - "process-nextick-args": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-1.0.7.tgz", - "integrity": "sha1-FQ4gt1ZZCtP5EJPyWk8q2L/zC6M=", - "dev": true - }, - "progress": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.0.tgz", - "integrity": "sha1-ihvjZr+Pwj2yvSPxDG/pILQ4nR8=", - "dev": true - }, - "pseudomap": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/pseudomap/-/pseudomap-1.0.2.tgz", - "integrity": "sha1-8FKijacOYYkX7wqKw0wa5aaChrM=", - "dev": true - }, - "punycode": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz", - "integrity": "sha1-wNWmOycYgArY4esPpSachN1BhF4=", - "dev": true - }, - "qs": { - "version": "6.3.2", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.3.2.tgz", - "integrity": "sha1-51vV9uJoEioqDgvaYwslUMFmUCw=", - "dev": true - }, - "readable-stream": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.3.tgz", - "integrity": "sha512-m+qzzcn7KUxEmd1gMbchF+Y2eIUbieUaxkWtptyHywrX0rE8QEYqPC07Vuy4Wm32/xE16NcdBctb8S0Xe/5IeQ==", - "dev": true, - "requires": { - "core-util-is": "1.0.2", - "inherits": "2.0.3", - "isarray": "1.0.0", - "process-nextick-args": "1.0.7", - "safe-buffer": "5.1.1", - "string_decoder": "1.0.3", - "util-deprecate": "1.0.2" - } - }, - "request": { - "version": "2.79.0", - "resolved": "https://registry.npmjs.org/request/-/request-2.79.0.tgz", - "integrity": "sha1-Tf5b9r6LjNw3/Pk+BLZVd3InEN4=", - "dev": true, - "requires": { - "aws-sign2": "0.6.0", - "aws4": "1.6.0", - "caseless": "0.11.0", - "combined-stream": "1.0.5", - "extend": "3.0.1", - "forever-agent": "0.6.1", - "form-data": "2.1.4", - "har-validator": "2.0.6", - "hawk": "3.1.3", - "http-signature": "1.1.1", - "is-typedarray": "1.0.0", - "isstream": "0.1.2", - "json-stringify-safe": "5.0.1", - "mime-types": "2.1.17", - "oauth-sign": "0.8.2", - "qs": "6.3.2", - "stringstream": "0.0.5", - "tough-cookie": "2.3.3", - "tunnel-agent": "0.4.3", - "uuid": "3.1.0" - } - }, - "require-directory": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", - "integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=", - "dev": true - }, - "require-main-filename": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-1.0.1.tgz", - "integrity": "sha1-l/cXtp1IeE9fUmpsWqj/3aBVpNE=", - "dev": true - }, - "require-uncached": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/require-uncached/-/require-uncached-1.0.3.tgz", - "integrity": "sha1-Tg1W1slmL9MeQwEcS5WqSZVUIdM=", - "dev": true, - "requires": { - "caller-path": "0.1.0", - "resolve-from": "1.0.1" - } - }, - "resolve-from": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-1.0.1.tgz", - "integrity": "sha1-Jsv+k10a7uq7Kbw/5a6wHpPUQiY=", - "dev": true - }, - "restore-cursor": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-2.0.0.tgz", - "integrity": "sha1-n37ih/gv0ybU/RYpI9YhKe7g368=", - "dev": true, - "requires": { - "onetime": "2.0.1", - "signal-exit": "3.0.2" - } - }, - "rimraf": { - "version": "2.6.2", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.2.tgz", - "integrity": "sha512-lreewLK/BlghmxtfH36YYVg1i8IAce4TI7oao75I1g245+6BctqTVQiBP3YUJ9C6DQOXJmkYR9X9fCLtCOJc5w==", - "dev": true, - "requires": { - "glob": "7.1.2" - } - }, - "run-async": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/run-async/-/run-async-2.3.0.tgz", - "integrity": "sha1-A3GrSuC91yDUFm19/aZP96RFpsA=", - "dev": true, - "requires": { - "is-promise": "2.1.0" - } - }, - "rx-lite": { - "version": "4.0.8", - "resolved": "https://registry.npmjs.org/rx-lite/-/rx-lite-4.0.8.tgz", - "integrity": "sha1-Cx4Rr4vESDbwSmQH6S2kJGe3lEQ=", - "dev": true - }, - "rx-lite-aggregates": { - "version": "4.0.8", - "resolved": "https://registry.npmjs.org/rx-lite-aggregates/-/rx-lite-aggregates-4.0.8.tgz", - "integrity": "sha1-dTuHqJoRyVRnxKwWJsTvxOBcZ74=", - "dev": true, - "requires": { - "rx-lite": "4.0.8" - } - }, - "safe-buffer": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.1.tgz", - "integrity": "sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg==", - "dev": true - }, - "semver": { - "version": "5.4.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.4.1.tgz", - "integrity": "sha512-WfG/X9+oATh81XtllIo/I8gOiY9EXRdv1cQdyykeXK17YcUW3EXUAi2To4pcH6nZtJPr7ZOpM5OMyWJZm+8Rsg==", - "dev": true - }, - "set-blocking": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", - "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=", - "dev": true - }, - "shebang-command": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz", - "integrity": "sha1-RKrGW2lbAzmJaMOfNj/uXer98eo=", - "dev": true, - "requires": { - "shebang-regex": "1.0.0" - } - }, - "shebang-regex": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz", - "integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=", - "dev": true - }, - "signal-exit": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz", - "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=", - "dev": true - }, - "slice-ansi": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-1.0.0.tgz", - "integrity": "sha512-POqxBK6Lb3q6s047D/XsDVNPnF9Dl8JSaqe9h9lURl0OdNqy/ujDrOiIHtsqXMGbWWTIomRzAMaTyawAU//Reg==", - "dev": true, - "requires": { - "is-fullwidth-code-point": "2.0.0" - }, - "dependencies": { - "is-fullwidth-code-point": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", - "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", - "dev": true - } - } - }, - "sntp": { - "version": "1.0.9", - "resolved": "https://registry.npmjs.org/sntp/-/sntp-1.0.9.tgz", - "integrity": "sha1-ZUEYTMkK7qbG57NeJlkIJEPGYZg=", - "dev": true, - "requires": { - "hoek": "2.16.3" - } - }, - "source-map": { - "version": "0.5.7", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", - "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=", - "dev": true - }, - "source-map-support": { - "version": "0.4.18", - "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.4.18.tgz", - "integrity": "sha512-try0/JqxPLF9nOjvSta7tVondkP5dwgyLDjVoyMDlmjugT2lRZ1OfsrYTkCd2hkDnJTKRbO/Rl3orm8vlsUzbA==", - "dev": true, - "requires": { - "source-map": "0.5.7" - } - }, - "sprintf-js": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", - "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=", - "dev": true - }, - "sshpk": { - "version": "1.13.1", - "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.13.1.tgz", - "integrity": "sha1-US322mKHFEMW3EwY/hzx2UBzm+M=", - "dev": true, - "requires": { - "asn1": "0.2.3", - "assert-plus": "1.0.0", - "bcrypt-pbkdf": "1.0.1", - "dashdash": "1.14.1", - "ecc-jsbn": "0.1.1", - "getpass": "0.1.7", - "jsbn": "0.1.1", - "tweetnacl": "0.14.5" - }, - "dependencies": { - "assert-plus": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", - "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=", - "dev": true - } - } - }, - "stack-utils": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/stack-utils/-/stack-utils-1.0.1.tgz", - "integrity": "sha1-1PM6tU6OOHeLDKXP07OvsS22hiA=", - "dev": true - }, - "string-width": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", - "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", - "dev": true, - "requires": { - "is-fullwidth-code-point": "2.0.0", - "strip-ansi": "4.0.0" - }, - "dependencies": { - "ansi-regex": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", - "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", - "dev": true - }, - "is-fullwidth-code-point": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", - "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", - "dev": true - }, - "strip-ansi": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", - "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", - "dev": true, - "requires": { - "ansi-regex": "3.0.0" - } - } - } - }, - "string_decoder": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.0.3.tgz", - "integrity": "sha512-4AH6Z5fzNNBcH+6XDMfA/BTt87skxqJlO0lAh3Dker5zThcAxG6mKz+iGu308UKoPPQ8Dcqx/4JhujzltRa+hQ==", - "dev": true, - "requires": { - "safe-buffer": "5.1.1" - } - }, - "stringstream": { - "version": "0.0.5", - "resolved": "https://registry.npmjs.org/stringstream/-/stringstream-0.0.5.tgz", - "integrity": "sha1-TkhM1N5aC7vuGORjB3EKioFiGHg=", - "dev": true - }, - "strip-ansi": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", - "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", - "dev": true, - "requires": { - "ansi-regex": "2.1.1" - } - }, - "strip-eof": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/strip-eof/-/strip-eof-1.0.0.tgz", - "integrity": "sha1-u0P/VZim6wXYm1n80SnJgzE2Br8=", - "dev": true - }, - "strip-json-comments": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", - "integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=", - "dev": true - }, - "supports-color": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.5.0.tgz", - "integrity": "sha1-vnoN5ITexcXN34s9WRJQRJEvY1s=", - "requires": { - "has-flag": "2.0.0" - } - }, - "table": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/table/-/table-4.0.2.tgz", - "integrity": "sha512-UUkEAPdSGxtRpiV9ozJ5cMTtYiqz7Ni1OGqLXRCynrvzdtR1p+cfOWe2RJLwvUG8hNanaSRjecIqwOjqeatDsA==", - "dev": true, - "requires": { - "ajv": "5.3.0", - "ajv-keywords": "2.1.1", - "chalk": "2.3.0", - "lodash": "4.17.4", - "slice-ansi": "1.0.0", - "string-width": "2.1.1" - }, - "dependencies": { - "ansi-styles": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz", - "integrity": "sha512-NnSOmMEYtVR2JVMIGTzynRkkaxtiq1xnFBcdQD/DnNCYPoEPsVJhM98BDyaoNOQIi7p4okdi3E27eN7GQbsUug==", - "dev": true, - "requires": { - "color-convert": "1.9.1" - } - }, - "chalk": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.3.0.tgz", - "integrity": "sha512-Az5zJR2CBujap2rqXGaJKaPHyJ0IrUimvYNX+ncCy8PJP4ltOGTrHUIo097ZaL2zMeKYpiCdqDvS6zdrTFok3Q==", - "dev": true, - "requires": { - "ansi-styles": "3.2.0", - "escape-string-regexp": "1.0.5", - "supports-color": "4.5.0" - } - } - } - }, - "tap": { - "version": "10.7.3", - "resolved": "https://registry.npmjs.org/tap/-/tap-10.7.3.tgz", - "integrity": "sha512-oS/FIq+tcmxVgYn5usKtLsX+sOHNEj+G7JIQE9SBjO5mVYB1rbaEJJiDbnYp8k0ZqY2Pe4HbYEpkvzm9jfLDyw==", - "dev": true, - "requires": { - "bind-obj-methods": "1.0.0", - "bluebird": "3.5.1", - "clean-yaml-object": "0.1.0", - "color-support": "1.1.3", - "coveralls": "2.13.3", - "foreground-child": "1.5.6", - "fs-exists-cached": "1.0.0", - "function-loop": "1.0.1", - "glob": "7.1.2", - "isexe": "2.0.0", - "js-yaml": "3.10.0", - "nyc": "11.3.0", - "opener": "1.4.3", - "os-homedir": "1.0.2", - "own-or": "1.0.0", - "own-or-env": "1.0.0", - "readable-stream": "2.3.3", - "signal-exit": "3.0.2", - "source-map-support": "0.4.18", - "stack-utils": "1.0.1", - "tap-mocha-reporter": "3.0.6", - "tap-parser": "5.4.0", - "tmatch": "3.1.0", - "trivial-deferred": "1.0.1", - "tsame": "1.1.2", - "yapool": "1.0.0" - } - }, - "tap-mocha-reporter": { - "version": "3.0.6", - "resolved": "https://registry.npmjs.org/tap-mocha-reporter/-/tap-mocha-reporter-3.0.6.tgz", - "integrity": "sha512-UImgw3etckDQCoqZIAIKcQDt0w1JLVs3v0yxLlmwvGLZl6MGFxF7JME5PElXjAoDklVDU42P3vVu5jgr37P4Yg==", - "dev": true, - "requires": { - "color-support": "1.1.3", - "debug": "2.6.9", - "diff": "1.4.0", - "escape-string-regexp": "1.0.5", - "glob": "7.1.2", - "js-yaml": "3.10.0", - "readable-stream": "2.3.3", - "tap-parser": "5.4.0", - "unicode-length": "1.0.3" - }, - "dependencies": { - "debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "dev": true, - "requires": { - "ms": "2.0.0" - } - } - } - }, - "tap-parser": { - "version": "5.4.0", - "resolved": "https://registry.npmjs.org/tap-parser/-/tap-parser-5.4.0.tgz", - "integrity": "sha512-BIsIaGqv7uTQgTW1KLTMNPSEQf4zDDPgYOBRdgOfuB+JFOLRBfEu6cLa/KvMvmqggu1FKXDfitjLwsq4827RvA==", - "dev": true, - "requires": { - "events-to-array": "1.1.2", - "js-yaml": "3.10.0", - "readable-stream": "2.3.3" - } - }, - "text-table": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", - "integrity": "sha1-f17oI66AUgfACvLfSoTsP8+lcLQ=", - "dev": true - }, - "through": { - "version": "2.3.8", - "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", - "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=", - "dev": true - }, - "tmatch": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/tmatch/-/tmatch-3.1.0.tgz", - "integrity": "sha512-W3MSATOCN4pVu2qFxmJLIArSifeSOFqnfx9hiUaVgOmeRoI2NbU7RNga+6G+L8ojlFeQge+ZPCclWyUpQ8UeNQ==", - "dev": true - }, - "tmp": { - "version": "0.0.33", - "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz", - "integrity": "sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==", - "dev": true, - "requires": { - "os-tmpdir": "1.0.2" - } - }, - "tough-cookie": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.3.3.tgz", - "integrity": "sha1-C2GKVWW23qkL80JdBNVe3EdadWE=", - "dev": true, - "requires": { - "punycode": "1.4.1" - } - }, - "trivial-deferred": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/trivial-deferred/-/trivial-deferred-1.0.1.tgz", - "integrity": "sha1-N21NKdlR1jaKb3oK6FwvTV4GWPM=", - "dev": true - }, - "tryit": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/tryit/-/tryit-1.0.3.tgz", - "integrity": "sha1-OTvnMKlEb9Hq1tpZoBQwjzbCics=", - "dev": true - }, - "tsame": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/tsame/-/tsame-1.1.2.tgz", - "integrity": "sha512-ovCs24PGjmByVPr9tSIOs/yjUX9sJl0grEmOsj9dZA/UknQkgPOKcUqM84aSCvt9awHuhc/boMzTg3BHFalxWw==", - "dev": true - }, - "tunnel-agent": { - "version": "0.4.3", - "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.4.3.tgz", - "integrity": "sha1-Y3PbdpCf5XDgjXNYM2Xtgop07us=", - "dev": true - }, - "tweetnacl": { - "version": "0.14.5", - "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", - "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=", - "dev": true, - "optional": true - }, - "type-check": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.3.2.tgz", - "integrity": "sha1-WITKtRLPHTVeP7eE8wgEsrUg23I=", - "dev": true, - "requires": { - "prelude-ls": "1.1.2" - } - }, - "typedarray": { - "version": "0.0.6", - "resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz", - "integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=", - "dev": true - }, - "unicode-length": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/unicode-length/-/unicode-length-1.0.3.tgz", - "integrity": "sha1-Wtp6f+1RhBpBijKM8UlHisg1irs=", - "dev": true, - "requires": { - "punycode": "1.4.1", - "strip-ansi": "3.0.1" - } - }, - "util-deprecate": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", - "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", - "dev": true - }, - "uuid": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.1.0.tgz", - "integrity": "sha512-DIWtzUkw04M4k3bf1IcpS2tngXEL26YUD2M0tMDUpnUrz2hgzUBlD55a4FjdLGPvfHxS6uluGWvaVEqgBcVa+g==", - "dev": true - }, - "verror": { - "version": "1.10.0", - "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", - "integrity": "sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=", - "dev": true, - "requires": { - "assert-plus": "1.0.0", - "core-util-is": "1.0.2", - "extsprintf": "1.3.0" - }, - "dependencies": { - "assert-plus": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", - "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=", - "dev": true - } - } - }, - "which": { - "version": "1.2.14", - "resolved": "https://registry.npmjs.org/which/-/which-1.2.14.tgz", - "integrity": "sha1-mofEN48D6CfOyvGs31bHNsAcFOU=", - "dev": true, - "requires": { - "isexe": "2.0.0" - }, - "dependencies": { - "isexe": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", - "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", - "dev": true - } - } - }, - "which-module": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz", - "integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=", - "dev": true - }, - "wordwrap": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz", - "integrity": "sha1-J1hIEIkUVqQXHI0CJkQa3pDLyus=", - "dev": true - }, - "wrap-ansi": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.1.0.tgz", - "integrity": "sha1-2Pw9KE3QV5T+hJc8rs3Rz4JP3YU=", - "dev": true, - "requires": { - "string-width": "1.0.2", - "strip-ansi": "3.0.1" - }, - "dependencies": { - "string-width": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", - "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", - "dev": true, - "requires": { - "code-point-at": "1.1.0", - "is-fullwidth-code-point": "1.0.0", - "strip-ansi": "3.0.1" - } - } - } - }, - "wrappy": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" - }, - "write": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/write/-/write-0.2.1.tgz", - "integrity": "sha1-X8A4KOJkzqP+kUVUdvejxWbLB1c=", - "dev": true, - "requires": { - "mkdirp": "0.5.1" - } - }, - "xtend": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.1.tgz", - "integrity": "sha1-pcbVMr5lbiPbgg77lDofBJmNY68=", - "dev": true - }, - "y18n": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/y18n/-/y18n-3.2.1.tgz", - "integrity": "sha1-bRX7qITAhnnA136I53WegR4H+kE=", - "dev": true - }, - "yallist": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-2.1.2.tgz", - "integrity": "sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI=", - "dev": true - }, - "yapool": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/yapool/-/yapool-1.0.0.tgz", - "integrity": "sha1-9pPymjFbUNmp2iZGp6ZkXJaYW2o=", - "dev": true - }, - "yargs": { - "version": "10.0.3", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-10.0.3.tgz", - "integrity": "sha512-DqBpQ8NAUX4GyPP/ijDGHsJya4tYqLQrjPr95HNsr1YwL3+daCfvBwg7+gIC6IdJhR2kATh3hb61vjzMWEtjdw==", - "dev": true, - "requires": { - "cliui": "3.2.0", - "decamelize": "1.2.0", - "find-up": "2.1.0", - "get-caller-file": "1.0.2", - "os-locale": "2.1.0", - "require-directory": "2.1.1", - "require-main-filename": "1.0.1", - "set-blocking": "2.0.0", - "string-width": "2.1.1", - "which-module": "2.0.0", - "y18n": "3.2.1", - "yargs-parser": "8.0.0" - } - }, - "yargs-parser": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-8.0.0.tgz", - "integrity": "sha1-IdR2Mw5agieaS4gTRb8GYQLiGcY=", - "dev": true, - "requires": { - "camelcase": "4.1.0" - } - } - } -} diff --git a/package.json b/package.json index 124e6c6..b6193eb 100644 --- a/package.json +++ b/package.json @@ -21,15 +21,16 @@ "type": "git", "url": "https://github.com/VoltDB/voltdb-client-nodejs.git" }, - "scripts": { - "lint": "eslint test/util", - "test": "node test/testrunner.js -i local" - }, + "scripts": { + "lint": "eslint test/util lib", + "test": "node test/testrunner.js -i local" + }, "dependencies": { "bignumber": "^1.1.0", - "ctype": "^0.5.0", "cli": "^1.0.0", + "ctype": "^0.5.0", "debug": "^3.0.1", + "murmurhash-native": "^3.2.4", "supports-color": "^4.4.0" }, "devDependencies": { diff --git a/test/cases/bufferTest.js b/test/cases/bufferTest.js index e80fe1e..9c880db 100644 --- a/test/cases/bufferTest.js +++ b/test/cases/bufferTest.js @@ -3,14 +3,11 @@ "use strict"; const VoltClient = require("../../lib/client"); - const VoltConfiguration = require("../../lib/configuration"); const VoltConstants = require("../../lib/voltconstants"); - const VoltProcedure = require("../../lib/query"); - - + require("nodeunit"); const testContext = require("../util/test-context"); - const debug = require("debug")("voltdb-client-nodejs:BufferTest"); + const debug = console.log; //require("debug")("voltdb-client-nodejs:BufferTest"); //Setup context testContext.setup(); @@ -18,119 +15,73 @@ /** * A "good" client config that points to a volt instance on localhost */ - function configs() { - - const configs = []; - - const config = new VoltConfiguration(); - config.host = "localhost"; - config.port = testContext.port(); - - configs.push(config); - - return configs; + function configs() { + return require("../config"); } - /** - * Promise style function for connecting to a Volt instance - */ - function connect(client){ - - const p = new Promise(function(resolve, reject) { - client.connect(function(code, event, results) { - if(code === VoltConstants.STATUS_CODES.SUCCESS){ - resolve({errorCode: code, eventCode: event, results: results}); - } - else{ - debug("Connect Failure | Code: %o, Event: %o", code, event); - reject({errorCode: code, eventCode: event, results: results}); - } - }); - }); - - return p; - } - /** * Promise style function for calling a procedure. An alternative to the old * callback style functions that returns both a write and a read promise. */ - function query(query, client){ + function query(call){ - var writeResolve = null; - var writeReject = null; - - const writePromise = new Promise(function(resolve, reject){ - writeResolve = resolve; - writeReject = reject; - }); + call.onQueryAllowed = call.onQueryAllowed.then( function write(response) { + if( !response.code ){ + return response; + } else { + debug("AdHocQuery Failure | Write Error. errorCode: %o, eventCode: %o, results: %O", + statusCodeToString(response.code), response.event, response.results + ); - const readPromise = new Promise(function(resolve, reject){ + this.emit(response); + } + }); - client.callProcedure(query, function read(code, event, results) { - // debug("AdHocQuery Complete | errorCode: %o, eventCode: %o, results: - // %O", code, event, results); - if(code === VoltConstants.STATUS_CODES.SUCCESS){ - // The results code is 1 for SUCCESS so can't use voltconstants - if(results.status === PROC_STATUS_CODE_SUCCESS){ - resolve({errorCode: code, eventCode: event, results: results}); - } - else{ - debug("AdHocQuery Failure | Read Error. errorCode: %o, eventCode: %o, results: %O", statusCodeToString(code), event, results); - reject({errorCode: code, eventCode: event, results: results}); - } - } - else{ - debug("AdHocQuery Failure | Read Error. errorCode: %o, eventCode: %o, results: %O", statusCodeToString(code), event, results); - reject({errorCode: code, eventCode: event, results: results}); - } - - }, function write(code, event, results) { - if(code === VoltConstants.STATUS_CODES.SUCCESS){ - writeResolve({errorCode: code, eventCode: event, results: results}); - } - else{ - debug("AdHocQuery Failure | Write Error. errorCode: %o, eventCode: %o, results: %O", statusCodeToString(code), event, results); - writeReject({errorCode: code, eventCode: event, results: results}); - } - }); + call.read = call.read.then( function read(response) { + if(response.results.status === PROC_STATUS_CODE_SUCCESS){ + return response; + } else { + debug("AdHocQuery Failure | Read Error. errorCode: %o, eventCode: %o, results: %O", statusCodeToString(response.code), response.event, response.results); + throw new Error(response); + } + }).catch( function(error){ + console.error("Error: ", error.toString()); + throw new Error(error); }); - return { writePromise: writePromise, readPromise: readPromise }; + return call; } /** * Sugar for running an adhoc query */ function adHocQuery(queryString, client){ - debug("Query | query: %o", queryString); - - const p = new VoltProcedure("@AdHoc", [ "string" ]); - - const q = p.getQuery(); - q.setParameters([queryString]); - - return query(q, client); + + return query(client.adHoc(queryString)); } /** * */ - function statusCodeToString(code){ - return code === null ? VoltConstants.STATUS_CODE_STRINGS[PROC_STATUS_CODE_SUCCESS] : VoltConstants.STATUS_CODE_STRINGS[code]; + function queryCollect(query, readPromises, client){ + return new Promise( (resolve, reject) => { + try { + const call = adHocQuery(query, client); + readPromises.push(call.read); + call.onQueryAllowed.then(resolve); + + } catch ( error ) { + reject(error); + } + }); } - + /** - * Utility method for volt queries that return a write and a read promise. - * Useful for when you want to fire off a bunch of writes and then wait on the - * read at the end. Executes the query and collects the read promises in the - * given array. Returns both the write and read promise. + * */ - function queryCollect(queryString, readPromises, client){ - const p = adHocQuery(queryString, client); - readPromises.push(p.readPromise); - return p; + function statusCodeToString(code){ + return code === null ? VoltConstants.STATUS_CODE_STRINGS[PROC_STATUS_CODE_SUCCESS] : VoltConstants.STATUS_CODE_STRINGS[code]; } /** @@ -154,22 +105,24 @@ debug("Connecting"); - connect(client) - .then(function(value){ - test.ok(value.errorCode === VoltConstants.STATUS_CODES.SUCCESS); + client.connect() + .then(function(){ + test.ok(client.isConnected()); + debug("Connection success"); return Promise.resolve(null); }) - .then(function(){ - return adHocQuery("DROP TABLE PLAYERS IF EXISTS;", client).readPromise; + .then(function(){ + debug("Dropping table"); + return adHocQuery("DROP TABLE PLAYERS IF EXISTS;", client).read; }) .then(function(){ return adHocQuery("CREATE TABLE PLAYERS (" + "playerID integer NOT NULL, " + "teamid varchar(100) NOT NULL " + - ");", client).readPromise; + ");", client).read; }) .then(function(){ - return adHocQuery("DROP TABLE TEAM_PLAYERS IF EXISTS;", client).readPromise; + return adHocQuery("DROP TABLE TEAM_PLAYERS IF EXISTS;", client).read; }) .then(function(){ return adHocQuery("CREATE TABLE TEAM_PLAYERS (" + @@ -177,23 +130,22 @@ "uid varchar(100) NOT NULL, " + "name varchar(100) NOT NULL, " + "avatar varbinary(12000) NOT NULL" + - ");", client).readPromise; + ");", client).read; }) .then(function(){ - const readPromises = []; return Promise.resolve() - .then(function() { return queryCollect("INSERT INTO PLAYERS VALUES (0, 'TeamA');", readPromises, client).writePromise; }) - .then(function() { return queryCollect("INSERT INTO PLAYERS VALUES (1, 'TeamA');", readPromises, client).writePromise; }) - .then(function() { return queryCollect("INSERT INTO PLAYERS VALUES (2, 'TeamA');", readPromises, client).writePromise; }) - .then(function() { return queryCollect("INSERT INTO PLAYERS VALUES (3, 'TeamA');", readPromises, client).writePromise; }) - .then(function() { return queryCollect("INSERT INTO PLAYERS VALUES (4, 'TeamA');", readPromises, client).writePromise; }) - .then(function() { return queryCollect("INSERT INTO PLAYERS VALUES (5, 'TeamB');", readPromises, client).writePromise; }) - .then(function() { return queryCollect("INSERT INTO PLAYERS VALUES (6, 'TeamB');", readPromises, client).writePromise; }) - .then(function() { return queryCollect("INSERT INTO PLAYERS VALUES (7, 'TeamB');", readPromises, client).writePromise; }) - .then(function() { return queryCollect("INSERT INTO PLAYERS VALUES (8, 'TeamB');", readPromises, client).writePromise; }) - .then(function() { return queryCollect("INSERT INTO PLAYERS VALUES (9, 'TeamB');", readPromises, client).writePromise; }) + .then(function() { return queryCollect("INSERT INTO PLAYERS VALUES (0, 'TeamA');", readPromises, client); }) + .then(function() { return queryCollect("INSERT INTO PLAYERS VALUES (1, 'TeamA');", readPromises, client); }) + .then(function() { return queryCollect("INSERT INTO PLAYERS VALUES (2, 'TeamA');", readPromises, client); }) + .then(function() { return queryCollect("INSERT INTO PLAYERS VALUES (3, 'TeamA');", readPromises, client); }) + .then(function() { return queryCollect("INSERT INTO PLAYERS VALUES (4, 'TeamA');", readPromises, client); }) + .then(function() { return queryCollect("INSERT INTO PLAYERS VALUES (5, 'TeamB');", readPromises, client); }) + .then(function() { return queryCollect("INSERT INTO PLAYERS VALUES (6, 'TeamB');", readPromises, client); }) + .then(function() { return queryCollect("INSERT INTO PLAYERS VALUES (7, 'TeamB');", readPromises, client); }) + .then(function() { return queryCollect("INSERT INTO PLAYERS VALUES (8, 'TeamB');", readPromises, client); }) + .then(function() { return queryCollect("INSERT INTO PLAYERS VALUES (9, 'TeamB');", readPromises, client); }) .then(function() { return Promise.all(readPromises); }); }) @@ -202,30 +154,36 @@ const readPromises = []; return Promise.resolve() - .then(function() { return queryCollect("INSERT INTO TEAM_PLAYERS VALUES (0, 'GameA', 'TeamA', 'ABCDEF');", readPromises, client).writePromise; }) - .then(function() { return queryCollect("INSERT INTO TEAM_PLAYERS VALUES (1, 'GameB', 'TeamA', 'ABCDEF');", readPromises, client).writePromise; }) - .then(function() { return queryCollect("INSERT INTO TEAM_PLAYERS VALUES (2, 'GameC', 'TeamA', 'ABCDEF');", readPromises, client).writePromise; }) - .then(function() { return queryCollect("INSERT INTO TEAM_PLAYERS VALUES (3, 'GameD', 'TeamA', 'ABCDEF');", readPromises, client).writePromise; }) - .then(function() { return queryCollect("INSERT INTO TEAM_PLAYERS VALUES (4, 'GameE', 'TeamA', 'ABCDEF');", readPromises, client).writePromise; }) - .then(function() { return queryCollect("INSERT INTO TEAM_PLAYERS VALUES (5, 'GameA', 'TeamB', 'ABCDEF');", readPromises, client).writePromise; }) - .then(function() { return queryCollect("INSERT INTO TEAM_PLAYERS VALUES (6, 'GameB', 'TeamB', 'ABCDEF');", readPromises, client).writePromise; }) - .then(function() { return queryCollect("INSERT INTO TEAM_PLAYERS VALUES (7, 'GameC', 'TeamB', 'ABCDEF');", readPromises, client).writePromise; }) - .then(function() { return queryCollect("INSERT INTO TEAM_PLAYERS VALUES (8, 'GameD', 'TeamB', 'ABCDEF');", readPromises, client).writePromise; }) - .then(function() { return queryCollect("INSERT INTO TEAM_PLAYERS VALUES (9, 'GameE', 'TeamB', 'ABCDEF');", readPromises, client).writePromise; }) + .then(function() { return queryCollect("INSERT INTO TEAM_PLAYERS VALUES (0, 'GameA', 'TeamA', 'ABCDEF');", readPromises, client); }) + .then(function() { return queryCollect("INSERT INTO TEAM_PLAYERS VALUES (1, 'GameB', 'TeamA', 'ABCDEF');", readPromises, client); }) + .then(function() { return queryCollect("INSERT INTO TEAM_PLAYERS VALUES (2, 'GameC', 'TeamA', 'ABCDEF');", readPromises, client); }) + .then(function() { return queryCollect("INSERT INTO TEAM_PLAYERS VALUES (3, 'GameD', 'TeamA', 'ABCDEF');", readPromises, client); }) + .then(function() { return queryCollect("INSERT INTO TEAM_PLAYERS VALUES (4, 'GameE', 'TeamA', 'ABCDEF');", readPromises, client); }) + .then(function() { return queryCollect("INSERT INTO TEAM_PLAYERS VALUES (5, 'GameA', 'TeamB', 'ABCDEF');", readPromises, client); }) + .then(function() { return queryCollect("INSERT INTO TEAM_PLAYERS VALUES (6, 'GameB', 'TeamB', 'ABCDEF');", readPromises, client); }) + .then(function() { return queryCollect("INSERT INTO TEAM_PLAYERS VALUES (7, 'GameC', 'TeamB', 'ABCDEF');", readPromises, client); }) + .then(function() { return queryCollect("INSERT INTO TEAM_PLAYERS VALUES (8, 'GameD', 'TeamB', 'ABCDEF');", readPromises, client); }) + .then(function() { return queryCollect("INSERT INTO TEAM_PLAYERS VALUES (9, 'GameE', 'TeamB', 'ABCDEF');", readPromises, client); }) .then(function() { return Promise.all(readPromises); }); - }) .then(function(){ return adHocQuery("select A.*, " + "B.name as name, " + "B.avatar as avatar " + "from PLAYERS as A left join TEAM_PLAYERS as B on A.playerID=B.id " + - "where uID='GameA' and A.teamID='TeamA';", client).readPromise; + "where uID='GameA' and A.teamID='TeamA';", client).read; }) .then(function(value){ debug("Result Count: %O", value.results.table.length); - debug("Results: %O", value.results.table[0][0]); + debug("Row Count: %O", value.results.table[0].data.length); + debug("Results: %O", value.results.table[0].data); client.exit(); + const table = value.results.table[0]; + test.equals(table.data.length,1, "Should return one row"); + test.equals(table.data[0].NAME,"TeamA", "Name should be TeamA"); + test.equals(table.data[0].TEAMID,"TeamA", "TeamId should be TeamA"); + test.equals(table.data[0].PLAYERID,0, "PlayerId should be TeamA"); + test.done(); return Promise.resolve(null); }) diff --git a/test/cases/clientaffinity.js b/test/cases/clientaffinity.js new file mode 100644 index 0000000..3999bac --- /dev/null +++ b/test/cases/clientaffinity.js @@ -0,0 +1,109 @@ +!(function (global) { // eslint-disable-line no-unused-vars + + "use strict"; + + const VoltClient = require("../../lib/client"); + + require("nodeunit"); + const testContext = require("../util/test-context"); + const debug = console.log; //require("debug")("voltdb-client-nodejs:BufferTest"); + + //Setup context + testContext.setup(); + + /** + * A "good" client config that points to a volt instance on localhost + */ + function configs() { + return require("../config"); + } + + function waitForHashinator(client){ + + return new Promise( (resolve, reject) => { + let iterations = 0; + + const checkHandle = setInterval( () => { + iterations++; + if ( client._hashinator ){ + clearInterval(checkHandle); + resolve(true); + } else if ( iterations === 10 ){ + clearInterval(checkHandle); + reject(false); + } + }, 300); + }); + } + + // Exports + module.exports = { + setUp : function(callback){ + callback(); + }, + tearDown : function(callback){ + callback(); + }, + getPartitionForValue : function(test){ + + //Cases for 8 partitions + const cases = [ + { value: "b", type: "string", expected: "1" }, + { value: "d", type: "string", expected: "2" }, + { value: "j", type: "string", expected: "3" }, + { value: "g", type: "string", expected: "0" }, + { value: "i", type: "string", expected: "5" }, + { value: "w", type: "string", expected: "6" }, + { value: "f", type: "string", expected: "16" }, + { value: "test", type: "string", expected: "26" }, + + { value: 7, type: "int", expected: "0" }, + { value: -2, type: "int", expected: "1" }, + { value: -1, type: "int", expected: "2" }, + { value: -4, type: "int", expected: "3" }, + { value: 0, type: "int", expected: "5" }, + { value: 2, type: "int", expected: "6" }, + { value: 11, type: "int", expected: "16" }, + { value: 1, type: "int", expected: "26" }, + + { value: Buffer.from([0x05]), type: "varbinary", expected: "0" }, + { value: Buffer.from([0x01]), type: "varbinary", expected: "1" }, + { value: Buffer.from([0x00]), type: "varbinary", expected: "2" }, + { value: Buffer.from([0x0C]), type: "varbinary", expected: "3" }, + { value: Buffer.from([0x06]), type: "varbinary", expected: "5" }, + { value: Buffer.from([0x04]), type: "varbinary", expected: "6" }, + { value: Buffer.from([0X0B]), type: "varbinary", expected: "16" }, + { value: Buffer.from([0x0E]), type: "varbinary", expected: "26" }, + ]; + + debug("getPartitionForValue"); + test.expect(cases.length); + + const client = new VoltClient(configs()); + debug("Connecting"); + + return client.connect() + .then( () => waitForHashinator(client) ) + .then( () => { + + cases.forEach( testCase => { + const actual = client._hashinator.getPartitionKeyForValue(testCase.type, testCase.value); + + test.equals(actual, testCase.expected, `Partition key for ${JSON.stringify(testCase.value)} should be ${testCase.expected}`); + + }); + + test.done(); + }) + .catch(function(value){ + //debug("Test Failed | Results: %O", value); + console.error(value); + client.exit(); + test.ok(false, "Test failed, see previous messages"); + test.done(); + }); + } + }; + +}(this)); + \ No newline at end of file diff --git a/test/cases/connections.js b/test/cases/connections.js index f38a6cb..316897d 100644 --- a/test/cases/connections.js +++ b/test/cases/connections.js @@ -21,63 +21,176 @@ * OTHER DEALINGS IN THE SOFTWARE. */ -var VoltClient = require('../../lib/client'); -var VoltConfiguration = require('../../lib/configuration'); -var util = require('util'); -var testCase = require('nodeunit'); +const VoltClient = require("../../lib/client"); +const VoltConfiguration = require("../../lib/configuration"); +const VoltConstants = require("../../lib/voltconstants"); + +require("nodeunit"); + const testContext = require("../util/test-context"); -const debug = require("debug")("voltdb-client-nodejs:ConnectionsTest"); +const debug = console.log; //require("debug")("voltdb-client-nodejs:ConnectionsTest"); // Setup context testContext.setup(); function goodConfig() { - return config('localhost'); + return require("../config"); } function badConfig() { - return config('idontexist'); -} + debug("using badConfig"); + const configs = []; -function config(host) { - debug('this config got called'); - var config = new VoltConfiguration(); - config.host = host; + let config = new VoltConfiguration(); + config.host = "idontexists"; config.port = testContext.port(); - var configs = []; + config.password = "12345"; + config.user = "operator"; + config.reconnectInterval = 0; //No reconnects + configs.push(config); + + //wrong port + config = Object.assign({}, goodConfig()[0]); + config.port = 8081; + config.reconnectInterval = 0; //No reconnects configs.push(config); + return configs; } +function badAuthConfig(){ + debug("using badAuthConfig"); + var config = Object.assign({},goodConfig()[0]); + config.password = "12345"; + config.reconnectInterval = 0; //No reconnects + + return [config]; +} + +const disconnect = client => { + client._connections.forEach( con => { + if ( con.validConnection ){ + console.log("Closing connection to " + con.config.host + ":" + con.config.port); + con.socket.end(); + } + }); + + const call = client.adHoc("select * from query_will_never_get_to_the_db;"); + + call.read.then( response => { + console.log("Query Response", response); + }); + + return call.onQueryAllowed; +}; + +const waitForReconnect = (client, retries, interval) => new Promise( resolve => { + let iteration = 0; + + const handle = setInterval( () => { + const resolved = client.isConnected(); + iteration++; + + debug("Reconnected yet?", resolved); + + if ( resolved || iteration === retries ) { + debug("So is connected?", resolved); + clearInterval(handle); + resolve(resolved); + } + }, interval); +}); + exports.connections = { setUp : function(callback) { - debug('connections setup called'); + debug("connections setup called"); callback(); }, tearDown : function(callback) { - debug('connections teardown called'); + debug("connections teardown called"); callback(); }, - 'Bad connection results' : function(test) { - debug('running bad connection test'); - var client = new VoltClient(badConfig()) - client.connect(function startup(code, event, results) { - debug('bad connection test'); - test.expect(1); - test.notEqual(code, null, 'There should not be a host named idontexists'); + "Bad connection results" : function(test) { + debug("running bad connection test"); + const config = badConfig(); + var client = new VoltClient(config); + + client.connect().then ( ({ connected, errors }) => { + debug("bad connection test "); + test.expect(3); + + test.ok(!connected); + test.equals(errors[0], VoltConstants.LOGIN_STATUS.HOST_UNKNOWN, "Login Error 0 should be host unknown"); + test.equals(errors[1], VoltConstants.LOGIN_STATUS.CONNECTION_REFUSED, "Login Error 0 should be connection refused"); + client.exit(); test.done(); + }).catch( error => { + console.error("BadConnectionError: ", error); }); }, - 'Good connection results' : function(test) { - debug('running good connection test'); - var client = new VoltClient(goodConfig()) - client.connect(function startup(code, event, results) { + "Good connection results" : function(test) { + debug("running good connection test"); + const client = new VoltClient(goodConfig()); + + client.connect().then ( connected => { test.expect(1); - test.equal(code, null, 'Should have been able to connect, is Volt running on localhost?'); + test.ok(connected, "Should have been able to connect, is Volt running on localhost?"); + client.exit(); + test.done(); + }); + + },"Mixed connection results" : function(test) { + debug("running mixed connection test"); + const mixedConfig = goodConfig().concat(badConfig()); + var client = new VoltClient(mixedConfig); + + client.connect().then ( ({ connected, errors }) => { + test.expect(6); + + test.ok(connected, "Should have been able to connect, is Volt running on localhost?"); + test.equals(client._connections.length,1, "Should have one good connection"); + test.equals(client._badConnections.length, 2, "Should have one bad connection"); + test.equals(errors[0], null, "Login Error 0 should be null"); + test.equals(errors[1], VoltConstants.LOGIN_STATUS.HOST_UNKNOWN, "Login Error 0 should be host unknown"); + test.equals(errors[2], VoltConstants.LOGIN_STATUS.CONNECTION_REFUSED, "Login Error 0 should be connection refused"); + client.exit(); test.done(); }); + },"Bad Auth connection results" : function(test) { + debug("running bad auth connection test"); + var client = new VoltClient(badAuthConfig()); + + client.connect().then ( ({ connected, errors }) => { + debug("bad auth connection test "); + test.expect(2); + + test.ok(!connected); + test.equals(errors[0], VoltConstants.LOGIN_STATUS.AUTHENTICATION_ERROR, "Login Error 0 should be authentication error"); + client.exit(); + test.done(); + }); + }, "Reconnect results" : function(test) { + debug("Reconnect connection test"); + + const configs = goodConfig(); + configs[0].reconnectInterval = 5 * 1000; //5s to really see it; + + const client = new VoltClient(configs); + + client.connect() + .then( () => disconnect(client) ) + .then( () => waitForReconnect(client, 20, 1000)) + .then( connected => { + console.log(" Client Connected: ", client.isConnected()); + + test.expect(1); + test.ok(connected, "Should have been able to connect, is Volt running on localhost?"); + test.done(); + client.exit(); + }); } + }; diff --git a/test/cases/typestest.js b/test/cases/typestest.js index b36a928..30d8321 100644 --- a/test/cases/typestest.js +++ b/test/cases/typestest.js @@ -24,97 +24,121 @@ // TODO: Remove a lot of the console/util logging statements being used for // debugging purposes. -var VoltClient = require('../../lib/client'); -var VoltConfiguration = require('../../lib/configuration'); -var VoltProcedure = require('../../lib/query'); -var VoltQuery = require('../../lib/query'); -const debug = require("debug")("voltdb-client-nodejs:TypeTest"); +var VoltClient = require("../../lib/client"); +var VoltProcedure = require("../../lib/query"); +const debug = console.log; //require("debug")("voltdb-client-nodejs:TypeTest"); -var util = require('util'); +var util = require("util"); const testContext = require("../util/test-context"); -var testCase = require('nodeunit'); +require("nodeunit"); //Setup context testContext.setup(); var client = null; -var initProc = new VoltProcedure('InitTestType', ['int']); function config() { - var config = new VoltConfiguration(); - config.host = 'localhost'; - const voltPort = testContext.port(); - config.port = voltPort; - var configs = []; - configs.push(config); - return configs; + return require("../config"); } -exports.typetest = { +const dropTableSQL = "drop table typetest if exists;"; +const createTableSQL =`CREATE TABLE typetest( + test_id integer NOT NULL, + test_tiny tinyint NOT NULL, + test_small smallint NOT NULL, + test_integer integer NOT NULL, + test_big bigint NOT NULL, + test_float float NOT NULL, + test_decimal decimal NOT NULL, + test_varchar varchar(100) NOT NULL, + test_varbinary varbinary(4) NOT NULL, + test_timestamp timestamp NOT NULL, + PRIMARY KEY (test_id) +);`; +const partitionTableSQL = "PARTITION TABLE typetest ON COLUMN test_id;"; + +function syncQuery(queryString){ + debug("Query | query: ", queryString); + return client.adHoc(queryString).read.then( function read(response){ + if ( response.code ) { + throw new Error(response.results.statusString); + } + + return response; + }); +} +const VAR_BINARY_VALUE = new Buffer([8,8,8,8]); +const TIMESTAMP_VALUE = new Date(1331310436605); + +exports.typetest = { setUp : function(callback) { - debug('typetest setup called'); + debug("typetest setup called"); client = new VoltClient(config()); - client.connect(function startup(code, event, results) { - debug('dasda connected'); + client.connect().then(function startup() { + if ( !client.isConnected() ) throw Error("Client not connected"); callback(); }); }, tearDown : function(callback) { - debug('typetest teardown called'); - client.exit(); - callback(); + if ( client ) { + debug("typetest teardown called"); + client.exit(); + callback(); + } }, - 'Init test' : function(test) { - debug('init test'); - test.expect(2); - - var initProc = new VoltProcedure('InitTestType', ['int']); - var query = initProc.getQuery(); - query.setParameters([0]); - - client.callProcedure(query, function read(code, event, results) { - debug('results %o', results); - test.equals(code, null , 'did I get called'); - test.done(); - }, function write(code, event, results) { - test.equals(code, null, 'Write didn\'t had an error'); - debug('write ok'); - }); + "Init test" : function(test) { + debug("init test"); + test.expect(1); + + return syncQuery(dropTableSQL) + .then ( () => syncQuery(createTableSQL)) + .then (() => syncQuery(partitionTableSQL)) + .then( () => { + //Using TYPETEST.insert instead of JavaStoredProcedure to skip the Java Source Compiling and Loading + const args = [0,1,2,3,4,5.1,6.000342,"seven",VAR_BINARY_VALUE,TIMESTAMP_VALUE.getTime()]; + const signature = ["integer","tinyint","smallint","integer","bigint","float","decimal","string","varbinary","timestamp"]; + const initProc = new VoltProcedure("TYPETEST.insert", signature); + const query = initProc.getQuery(); + query.setParameters(args); + + client.callProcedure(query).read.then( ({ results }) => { + debug("\nInit Test results %o", results); + test.equals(results.status, 1 , "did I get called"); + test.done(); + }); + }).catch(console.error); }, - 'select test' : function(test) { - debug('select test'); - test.expect(11); - var initProc = new VoltProcedure('TYPETEST.select', ['int']); + "select test" : function(test) { + debug("select test"); + test.expect(12); + + var initProc = new VoltProcedure("TYPETEST.select", ["int"]); var query = initProc.getQuery(); query.setParameters([0]); - client.callProcedure(query, function read(code, event, results) { - - var testBuffer = new Buffer(4); - debug('results inspection: %o', results.table[0][0].TEST_TIMESTAMP); - debug('inspect %s', util.inspect(results.table[0][0])); - - test.equals(code, null, 'Invalid status: ' + results.status + 'should be 1'); - - test.equals(results.table[0][0].TEST_ID, 0, 'Wrong row ID, should be 0'); - test.equals(results.table[0][0].TEST_TINY, 1, 'Wrong tiny, should be 1'); - test.equals(results.table[0][0].TEST_SMALL, 2, 'Wrong small, should be 2'); - test.equals(results.table[0][0].TEST_INTEGER, 3, 'Wrong integer, should be 3'); - test.equals(results.table[0][0].TEST_BIG, 4, 'Wrong integer, should be 4'); - test.equals(results.table[0][0].TEST_FLOAT, 5.1, 'Wrong float, should be 5.1'); - test.equals(results.table[0][0].TEST_DECIMAL, 6.000342, 'Wrong decimal, should be 6.000342'); - test.equals(results.table[0][0].TEST_VARCHAR, 'seven', 'Wrong varchar, should be seven'); - // TODO: Add varbinary buffer comparison code. - //test.equals(results.table[0][0].TEST_VARBINARY, 6.00034231, - // results.table[0][0].TEST_VARBINARY); - test.equals(results.table[0][0].TEST_TIMESTAMP.getTime(), (new Date(1331310436605)).getTime(), (new Date(1331310436605)).toString() + ": " + results.table[0][0].TEST_TIMESTAMP); + const call = client.callProcedure(query); + + call.read.then( function read({ results }) { + debug("Select test results:", results); + debug("results inspection: %o", results.table[0].data[0].TEST_TIMESTAMP); + debug("inspect %s", util.inspect(results.table[0].data[0])); + + test.equals(results.status, 1, "Invalid status: " + results.status + "should be 1"); + test.equals(results.table[0].data.length, 1, "Row count should be 1"); + test.equals(results.table[0].data[0].TEST_ID, 0, "Wrong row ID, should be 0"); + test.equals(results.table[0].data[0].TEST_TINY, 1, "Wrong tiny, should be 1"); + test.equals(results.table[0].data[0].TEST_SMALL, 2, "Wrong small, should be 2"); + test.equals(results.table[0].data[0].TEST_INTEGER, 3, "Wrong integer, should be 3"); + test.equals(results.table[0].data[0].TEST_BIG, 4, "Wrong integer, should be 4"); + test.equals(results.table[0].data[0].TEST_FLOAT, 5.1, "Wrong float, should be 5.1"); + test.equals(results.table[0].data[0].TEST_DECIMAL, 6.000342, "Wrong decimal, should be 6.000342"); + test.equals(results.table[0].data[0].TEST_VARCHAR, "seven", "Wrong varchar, should be seven"); + test.ok(results.table[0].data[0].TEST_VARBINARY.equals(VAR_BINARY_VALUE), "Wrong varbinary, should be " + VAR_BINARY_VALUE); + test.equals(results.table[0].data[0].TEST_TIMESTAMP.getTime(), TIMESTAMP_VALUE.getTime(), TIMESTAMP_VALUE.toString() + ": " + results.table[0].data[0].TEST_TIMESTAMP); test.done(); - }, function write(code, event, results) { - debug('write ok'); - test.ok(true, 'Write didn\'t get called'); }); } }; diff --git a/test/cases/updateClassesTest.js b/test/cases/updateClassesTest.js new file mode 100644 index 0000000..1b33c60 --- /dev/null +++ b/test/cases/updateClassesTest.js @@ -0,0 +1,105 @@ +/* This file is part of VoltDB. +* Copyright (C) 2008-2018 VoltDB Inc. +* +* 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. +*/ + +const VoltClient = require("../../lib/client"); +const debug = require("debug")("voltdb-client-nodejs:TypeTest"); + +const testContext = require("../util/test-context"); +testContext.setup(); + +require("nodeunit"); +const config = require("../config"); + +//Setup context + + +const client = new VoltClient(config); + +const procName = "VoltTableTest"; +const className = "com.voltdb.test.volttable.proc.VoltTableTest"; +const jarPath = __dirname + "/../../tools/testdb/typetest.jar"; + +const dropProc = `drop procedure ${procName} if exists;`; +const createProc = `create procedure from class ${className};`; + +function syncQuery(queryString){ + console.log("Query | query: ", queryString); + + return () => client.adHoc(queryString).read.then( function read(response){ + if ( response.code ) { + throw new Error(response.results.statusString); + } + + return response; + }); +} + +exports.updateClasses = { + setUp : function(callback) { + client.connect().then(function startup() { + if ( !client.isConnected() ) throw Error("Client not connected"); + + callback(); + }); + }, + tearDown : function(callback) { + if ( client ) { + debug("typetest teardown called"); + client.exit(); + callback(); + } + }, + "UpdateClasses remove" : function(test) { + test.expect(2); + + console.log("UpdateClasses(null,'" + className + "')"); + return syncQuery(dropProc)() + .then( () => client.updateClasses(null, className).read ) + .then( response => { + test.equals(response.results.status,1, "Command should succeed"); + + return syncQuery(createProc)(); + }) + .then( response => { + test.equals(response.results.status, -2, "Command should not succeed"); + test.done(); + }).catch(console.error); + + }, + + "UpdateClasses load" : function(test) { + test.expect(2); + + console.log(`UpdateClasses('${jarPath}', null)`); + return client.updateClasses(jarPath).read.then( response => { + console.log(response.code, response.results.statusString); + test.equals(response.results.status, 1, "Command should succeed"); + + return syncQuery(createProc)(); + }).then( response => { + console.log(response.code, response.results.statusString); + test.equals(response.results.status, 1, "Command should succeed"); + test.done(); + }).catch(console.error); + } +}; diff --git a/test/cases/volttableTest.js b/test/cases/volttableTest.js new file mode 100644 index 0000000..de16056 --- /dev/null +++ b/test/cases/volttableTest.js @@ -0,0 +1,165 @@ +/* This file is part of VoltDB. +* Copyright (C) 2008-2018 VoltDB Inc. +* +* 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. +*/ + +const VoltClient = require("../../lib/client"); +const VoltProcedure = require("../../lib/query"); +const debug = require("debug")("voltdb-client-nodejs:TypeTest"); +const VoltTable = require("../../lib/volttable"); + +const testContext = require("../util/test-context"); +testContext.setup(); + +require("nodeunit"); +const config = require("../config"); + +//Setup context + +const client = new VoltClient(config); + +const TIMESTAMP_VALUE = new Date("2002/07/25"); + +const className = "com.voltdb.test.volttable.proc.VoltTableTest"; +const jarPath = __dirname + "/../../tools/testdb/typetest.jar"; +const createProc = `create procedure from class ${className};`; +const dropProc = `drop procedure ${className} if exists;`; +const dropTable = "drop table typetest if exists;"; +const createTable =`CREATE TABLE typetest( + test_id integer NOT NULL, + test_tiny tinyint NOT NULL, + test_small smallint NOT NULL, + test_integer integer NOT NULL, + test_big bigint NOT NULL, + test_float float NOT NULL, + test_decimal decimal NOT NULL, + test_varchar varchar(100) NOT NULL, + test_varbinary varbinary(4) NOT NULL, + test_timestamp timestamp NOT NULL, + PRIMARY KEY (test_id) +);`; +const partitionTable = "PARTITION TABLE typetest ON COLUMN test_id;"; +const selectData = "select * from typetest;"; + +function getTypeTestVoltTable(){ + const vt = new VoltTable(); + + vt.addColumn("test_id","integer"); //2 + vt.addColumn("test_tiny","tinyint"); //3 + vt.addColumn("test_small","smallint"); //4 + vt.addColumn("test_integer","integer"); //5 + vt.addColumn("test_big","bigint"); //6 + vt.addColumn("test_float","float"); //7.7 + vt.addColumn("test_decimal","decimal"); //8.000008 + vt.addColumn("test_varchar","string"); //"nine" + vt.addColumn("test_varbinary","varbinary"); //"0A" = [10] + vt.addColumn("test_timestamp","timestamp"); //1902/07/25 + + vt.addRow(2,3,4,5,6,7.7,8.000008, "nine", new Buffer([10]), TIMESTAMP_VALUE); + + return vt; +} + +function syncExec(procedure, signature, args){ + const proc = new VoltProcedure(procedure, signature); + const statement = proc.getQuery(); + statement.setParameters(args); + + return () => client.callProcedure(statement).read.then( function read(response){ + if ( response.code ) { + throw new Error(response.results.statusString); + } + + return response; + }); +} + +function syncQuery(queryString){ + console.log("Query | query: ", queryString); + + return () => client.adHoc(queryString).read.then( function read(response){ + if ( response.code ) { + throw new Error(response.results.statusString); + } + + console.log(response.results.statusString); + + return response; + }); +} + +exports.volttableTest = { + setUp : function(callback) { + client.connect().then(function startup() { + if ( !client.isConnected() ) throw Error("Client not connected"); + + callback(); + }); + }, + tearDown : function(callback) { + if ( client ) { + debug("typetest teardown called"); + client.exit(); + callback(); + } + }, + "Init" : function(test){ + test.expect(1); + console.log(`UpdateClasses('${jarPath}', null)`); + return client.updateClasses(jarPath).read + .then( syncQuery(dropProc) ) + .then( syncQuery(dropTable) ) + .then( syncQuery(createTable) ) + .then( syncQuery(partitionTable) ) + .then( syncQuery(createProc) ) + .then( () => { + test.ok(true); + test.done(); + }) + .catch(console.error); + }, + "VoltTable" : function(test) { + const volttable = getTypeTestVoltTable(); + syncExec("VoltTableTest",["volttable"],[volttable])() + .then(({ code, results })=> { + console.log(results.statusString); + + test.equals(code, null, "Should not be an error code"); + test.equals(results.status, 1, "Status code should be SUCCESS"); + + return null; + }) + .then( syncQuery(selectData) ) + .then( response => { + const loadedVolttable = response.results.table[0]; + + console.log("Inserted", volttable.data ); + console.log("Selected", loadedVolttable.data ); + + test.ok(volttable.equals(loadedVolttable), "Inserted VoltTable should be the same that the one selected"); + test.done(); + }) + + /* */ + .catch(console.error); + + } +}; diff --git a/test/config.js b/test/config.js new file mode 100644 index 0000000..f9d5081 --- /dev/null +++ b/test/config.js @@ -0,0 +1,15 @@ +const configs = []; +const VoltConfiguration = require("../lib/configuration"); +const testContext = require("./util/test-context"); + +let config = null; +config = new VoltConfiguration(); +config.host = "192.168.0.51"; +config.username = "operator"; +config.password = "mech"; +config.hashAlgorithm = "sha1"; +config.port = testContext.port(); + +configs.push(config); + +module.exports = configs; \ No newline at end of file diff --git a/test/testrunner.js b/test/testrunner.js index 056b4cf..5cb60d9 100644 --- a/test/testrunner.js +++ b/test/testrunner.js @@ -21,40 +21,49 @@ * OTHER DEALINGS IN THE SOFTWARE. */ -var nodeunit = require('nodeunit'); -var fs = require('fs'); -var child_process = require('child_process'); -const path = require('path'); +var nodeunit = require("nodeunit"); +var fs = require("fs"); +require("child_process"); +const path = require("path"); const testCasesDirectory = path.resolve(__dirname, "cases"); var TestRunner = function() { this.testDirectories = [testCasesDirectory]; this.fileList = []; -} -tr = TestRunner.prototype; +}; + +const tr = TestRunner.prototype; +const TEST_NAME = 4; tr.loadTests = function() { - console.log(this.testDirectories.length); + const testName = process.argv[TEST_NAME]; + for(var index = 0; index < this.testDirectories.length; index++) { - var cases = fs.readdirSync(this.testDirectories[index]) || []; + let cases = fs.readdirSync(this.testDirectories[index]) || []; - for(var inner = 0; inner < cases.length; inner++) { - this.fileList = this.fileList.concat(this.testDirectories[index] + '/' + cases[inner]); + for(let inner = 0; inner < cases.length; inner++) { + if ( testName && cases[inner] !== `${testName}.js` ) continue; + this.fileList = this.fileList.concat(this.testDirectories[index] + "/" + cases[inner]); } } -} +}; tr.run = function() { - var reporter = nodeunit.reporters.default; + if (this.fileList.length === 0) { + console.error(`Test ${process.argv[TEST_NAME]} not found`); + process.exit(1); + } + + const reporter = nodeunit.reporters.default; reporter.run(this.fileList, null, function something() { process.exit(0); }); -} +}; function main() { var runner = new TestRunner(); runner.loadTests(); runner.run(); -}; +} -main(); +main(); \ No newline at end of file diff --git a/test/util/docker-util.js b/test/util/docker-util.js index a0db0a8..6d569a6 100644 --- a/test/util/docker-util.js +++ b/test/util/docker-util.js @@ -4,7 +4,7 @@ const childProcess = require("child_process"); const debug = require("debug")("voltdb-client-nodejs:DockerUtil"); - const os = require('os'); + const os = require("os"); /* * TODO: Should eventually go in VoltConstants. @@ -33,7 +33,7 @@ if(dockerPortResponse.status !== 0){ // Failure, log a warning and just fall through, returning the default port console.warn(`Docker port query failure | Will return default port '${VOLT_CLIENT_PORT}'. \ -Docker port query for container '${containerName}' and port '${VOLT_CLIENT_PORT}' failed, error was:${os.EOL} \ +Docker port query for container '${containerName}' and port '${VOLT_CLIENT_PORT}' failed, error was:${os.EOL} ${dockerPortResponse.stderr.toString()}`); } else{ @@ -46,8 +46,8 @@ ${dockerPortResponse.stderr.toString()}`); } else{ // Failure, log a warning and just fall through, returning the default port - console.warn(`Docker port query failure | Will return default port '${VOLT_CLIENT_PORT}'. \ -Docker port query for container '${containerName}' and port '${VOLT_CLIENT_PORT}' returned unrecognised response, response was:${os.EOL} \ + console.warn(`Docker port query failure | Will return default port '${VOLT_CLIENT_PORT}'. +Docker port query for container '${containerName}' and port '${VOLT_CLIENT_PORT}' returned unrecognised response, response was:${os.EOL} ${dockerPortResponseString}`); } } diff --git a/test/util/test-context.js b/test/util/test-context.js index 5a7176b..756cafb 100644 --- a/test/util/test-context.js +++ b/test/util/test-context.js @@ -27,11 +27,11 @@ function _setup(){ var argv = yargs + .usage("$0 -i instance [testname]") .alias("i", "instance") .demandOption(["i"]) .describe("i", "Specify the type of VoltDB instance the tests will be run against. " + "Can be a local instance [local] or a local instance running in a Docker container [docker]") - .choices("i", ["local", "docker"]) .argv; config.instance = argv.instance; diff --git a/tools/testdb/run.sh b/tools/testdb/run.sh index 0828bac..37c963d 100755 --- a/tools/testdb/run.sh +++ b/tools/testdb/run.sh @@ -28,7 +28,7 @@ function srccompile() { mkdir -p obj javac -classpath $CLASSPATH -d obj \ -sourcepath ./src \ - ./src/com/voltdb/test/typetest/proc/*.java + ./src/com/voltdb/test/*/proc/*.java jar cvf $APPNAME.jar -C obj . # stop if compilation fails if [ $? != 0 ]; then exit; fi @@ -67,4 +67,4 @@ function server() { # Run the target passed as the first arg on the command line # If no first arg, run server if [ $# -gt 1 ]; then help; exit; fi -if [ $# = 1 ]; then $1; else server; fi \ No newline at end of file +if [ $# = 1 ]; then $1; else server; fi diff --git a/tools/testdb/src/com/voltdb/test/typetest/proc/InitTestType.java b/tools/testdb/src/com/voltdb/test/typetest/proc/InitTestType.java index 08acdde..31b833b 100644 --- a/tools/testdb/src/com/voltdb/test/typetest/proc/InitTestType.java +++ b/tools/testdb/src/com/voltdb/test/typetest/proc/InitTestType.java @@ -26,9 +26,9 @@ import java.math.BigDecimal; import java.math.MathContext; -import org.voltdb.ProcInfo; +import org.voltdb.*; -@ProcInfo (partitionInfo = "typetest.test_id:0", singlePartition = true) +//@ProcInfo (partitionInfo = "typetest.test_id:0", singlePartition = true) public class InitTestType extends Insert { public long run(int blah) { diff --git a/tools/testdb/src/com/voltdb/test/typetest/proc/Insert.java b/tools/testdb/src/com/voltdb/test/typetest/proc/Insert.java index 3cfbf13..7764c74 100644 --- a/tools/testdb/src/com/voltdb/test/typetest/proc/Insert.java +++ b/tools/testdb/src/com/voltdb/test/typetest/proc/Insert.java @@ -27,9 +27,9 @@ import org.voltdb.*; import org.voltdb.types.TimestampType; -@ProcInfo ( +/*@ProcInfo ( partitionInfo = "typetest.test_id:0", - singlePartition = true) + singlePartition = true)*/ public class Insert extends VoltProcedure { public static final long SUCCESS = 0; diff --git a/tools/testdb/src/com/voltdb/test/volttabletest/proc/VoltTableTest.java b/tools/testdb/src/com/voltdb/test/volttabletest/proc/VoltTableTest.java new file mode 100644 index 0000000..5e9fe72 --- /dev/null +++ b/tools/testdb/src/com/voltdb/test/volttabletest/proc/VoltTableTest.java @@ -0,0 +1,70 @@ +/* This file is part of VoltDB. + * Copyright (C) 2008-2018 VoltDB Inc. + * + * 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. + */ +package com.voltdb.test.volttable.proc; + +import java.math.BigDecimal; + +import org.voltdb.*; +import org.voltdb.types.TimestampType; + +public class VoltTableTest extends VoltProcedure { + + public static final long SUCCESS = 0; + + public final SQLStmt insertStmt = new SQLStmt( + "insert into typetest " + /*+ " ( test_id" + + ",test_tiny" + + ",test_small" + + ",test_integer" + + ",test_big" + + ",test_float" + + ",test_decimal" + + ",test_varchar" + + ",test_varbinary" + + ",test_timestamp )" */ + + " values ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ? );"); + + public long run( VoltTable vt ) throws VoltAbortException { + + vt.resetRowPosition(); + vt.advanceRow(); + + voltQueueSQL( insertStmt, + vt.get(0,VoltType.INTEGER), + vt.get(1,VoltType.TINYINT), + vt.get(2,VoltType.SMALLINT), + vt.get(3,VoltType.INTEGER), + vt.get(4,VoltType.BIGINT), + vt.get(5,VoltType.FLOAT), + vt.get(6,VoltType.DECIMAL), + vt.get(7,VoltType.STRING), + vt.get(8,VoltType.VARBINARY), + vt.get(9,VoltType.TIMESTAMP) + ); + + voltExecuteSQL(); + + return VoltTableTest.SUCCESS; + } +} diff --git a/voternoui.js b/voternoui.js index c65e02f..9d22bcc 100644 --- a/voternoui.js +++ b/voternoui.js @@ -25,281 +25,279 @@ * OTHER DEALINGS IN THE SOFTWARE. */ -var cli = require('cli'); -var cluster = require ('cluster'); -var VoltClient = require('./lib/client'); -var VoltConfiguration = require('./lib/configuration'); -var VoltProcedure = require('./lib/query'); -var VoltQuery = require('./lib/query'); +var cli = require("cli"); +require ("cluster"); +var VoltClient = require("./lib/client"); +var VoltConfiguration = require("./lib/configuration"); +var VoltProcedure = require("./lib/query"); -var util = require('util'); +var util = require("util"); var client = null; -var resultsProc = new VoltProcedure('Results'); -var initProc = new VoltProcedure('Initialize', ['int', 'string']); -var voteProc = new VoltProcedure('Vote', ['long', 'int', 'long']); +var resultsProc = new VoltProcedure("Results"); +var initProc = new VoltProcedure("Initialize", ["int", "string"]); +var voteProc = new VoltProcedure("Vote", ["long", "int", "long"]); var options = cli.parse({ - voteCount : ['c', 'Number of votes to run', 'number', 10000], - clusterNode0 : ['h', 'VoltDB host (one of the cluster)', 'string', 'localhost'] + voteCount : ["c", "Number of votes to run", "number", 10000], + clusterNode0 : ["h", "VoltDB host (one of the cluster)", "string", "localhost"] }); var area_codes = [907, 205, 256, 334, 251, 870, 501, 479, 480, 602, 623, 928, -520, 341, 764, 628, 831, 925, 909, 562, 661, 510, 650, 949, 760, 415, 951, 209, - 669, 408, 559, 626, 442, 530, 916, 627, 714, 707, 310, 323, 213, 424, 747, - 818, 858, 935, 619, 805, 369, 720, 303, 970, 719, 860, 203, 959, 475, 202, - 302, 689, 407, 239, 850, 727, 321, 754, 954, 927, 352, 863, 386, 904, 561, - 772, 786, 305, 941, 813, 478, 770, 470, 404, 762, 706, 678, 912, 229, 808, - 515, 319, 563, 641, 712, 208, 217, 872, 312, 773, 464, 708, 224, 847, 779, - 815, 618, 309, 331, 630, 317, 765, 574, 260, 219, 812, 913, 785, 316, 620, - 606, 859, 502, 270, 504, 985, 225, 318, 337, 774, 508, 339, 781, 857, 617, - 978, 351, 413, 443, 410, 301, 240, 207, 517, 810, 278, 679, 313, 586, 947, - 248, 734, 269, 989, 906, 616, 231, 612, 320, 651, 763, 952, 218, 507, 636, - 660, 975, 816, 573, 314, 557, 417, 769, 601, 662, 228, 406, 336, 252, 984, - 919, 980, 910, 828, 704, 701, 402, 308, 603, 908, 848, 732, 551, 201, 862, - 973, 609, 856, 575, 957, 505, 775, 702, 315, 518, 646, 347, 212, 718, 516, - 917, 845, 631, 716, 585, 607, 914, 216, 330, 234, 567, 419, 440, 380, 740, - 614, 283, 513, 937, 918, 580, 405, 503, 541, 971, 814, 717, 570, 878, 835, - 484, 610, 267, 215, 724, 412, 401, 843, 864, 803, 605, 423, 865, 931, 615, - 901, 731, 254, 325, 713, 940, 817, 430, 903, 806, 737, 512, 361, 210, 979, - 936, 409, 972, 469, 214, 682, 832, 281, 830, 956, 432, 915, 435, 801, 385, - 434, 804, 757, 703, 571, 276, 236, 540, 802, 509, 360, 564, 206, 425, 253, - 715, 920, 262, 414, 608, 304, 307]; -var voteCandidates = 'Edwina Burnam,Tabatha Gehling,Kelly Clauss,' + -'Jessie Alloway,Alana Bregman,Jessie Eichman,Allie Rogalski,Nita Coster,' + -'Kurt Walser,Ericka Dieter,Loraine NygrenTania Mattioli'; + 520, 341, 764, 628, 831, 925, 909, 562, 661, 510, 650, 949, 760, 415, 951, 209, + 669, 408, 559, 626, 442, 530, 916, 627, 714, 707, 310, 323, 213, 424, 747, + 818, 858, 935, 619, 805, 369, 720, 303, 970, 719, 860, 203, 959, 475, 202, + 302, 689, 407, 239, 850, 727, 321, 754, 954, 927, 352, 863, 386, 904, 561, + 772, 786, 305, 941, 813, 478, 770, 470, 404, 762, 706, 678, 912, 229, 808, + 515, 319, 563, 641, 712, 208, 217, 872, 312, 773, 464, 708, 224, 847, 779, + 815, 618, 309, 331, 630, 317, 765, 574, 260, 219, 812, 913, 785, 316, 620, + 606, 859, 502, 270, 504, 985, 225, 318, 337, 774, 508, 339, 781, 857, 617, + 978, 351, 413, 443, 410, 301, 240, 207, 517, 810, 278, 679, 313, 586, 947, + 248, 734, 269, 989, 906, 616, 231, 612, 320, 651, 763, 952, 218, 507, 636, + 660, 975, 816, 573, 314, 557, 417, 769, 601, 662, 228, 406, 336, 252, 984, + 919, 980, 910, 828, 704, 701, 402, 308, 603, 908, 848, 732, 551, 201, 862, + 973, 609, 856, 575, 957, 505, 775, 702, 315, 518, 646, 347, 212, 718, 516, + 917, 845, 631, 716, 585, 607, 914, 216, 330, 234, 567, 419, 440, 380, 740, + 614, 283, 513, 937, 918, 580, 405, 503, 541, 971, 814, 717, 570, 878, 835, + 484, 610, 267, 215, 724, 412, 401, 843, 864, 803, 605, 423, 865, 931, 615, + 901, 731, 254, 325, 713, 940, 817, 430, 903, 806, 737, 512, 361, 210, 979, + 936, 409, 972, 469, 214, 682, 832, 281, 830, 956, 432, 915, 435, 801, 385, + 434, 804, 757, 703, 571, 276, 236, 540, 802, 509, 360, 564, 206, 425, 253, + 715, 920, 262, 414, 608, 304, 307]; +var voteCandidates = "Edwina Burnam,Tabatha Gehling,Kelly Clauss," + +"Jessie Alloway,Alana Bregman,Jessie Eichman,Allie Rogalski,Nita Coster," + +"Kurt Walser,Ericka Dieter,Loraine NygrenTania Mattioli"; function main() { - var clusterNodes = [options.clusterNode0]; - var configs = []; - for ( var index = 0; index < clusterNodes.length; index++ ) { - console.log("Host: " + clusterNodes[index]); - var vc = new VoltConfiguration(); - vc.host = clusterNodes[index]; - configs.push(vc); - } - var counter = 0; + var clusterNodes = [options.clusterNode0]; + var configs = []; + for ( var index = 0; index < clusterNodes.length; index++ ) { + console.log("Host: " + clusterNodes[index]); + var vc = new VoltConfiguration(); + vc.host = clusterNodes[index]; + configs.push(vc); + } - client = new VoltClient(configs); - client.connect(function startup(results) { - console.log('Node up'); - voltInit(); - }, function loginError(results) { - console.log("Error logging in: " + results); - }); + client = new VoltClient(configs); + client.connect(function startup(results) { + console.log("Node up"); + voltInit(); + }, function loginError(results) { + console.log("Error logging in: " + results); + }); } function voltInit() { - console.log('voltInit'); - var query = initProc.getQuery(); - query.setParameters([6, voteCandidates]); - client.callProcedure(query, function initVoter(event, code, results) { - if ( results.error == false ) { - var val = results.table[0][0]; - console.log( 'Initialized app for ' + val[''] + ' candidates.\n\n'); + console.log("voltInit"); + var query = initProc.getQuery(); + query.setParameters([6, voteCandidates]); + client.callProcedure(query, function initVoter(event, code, results) { + if ( results.error == false ) { + var val = results.table[0][0]; + console.log( "Initialized app for " + val[""] + " candidates.\n\n"); - var voteJob = {}; - voteJob.voteCount = options.voteCount; - voteJob.steps = getSteps(); + var voteJob = {}; + voteJob.voteCount = options.voteCount; + voteJob.steps = getSteps(); - runNextLink(voteJob); - } - }); + runNextLink(voteJob); + } + }); } function voteOften(voteJob) { - console.log('voteOften'); - voteInsertLoop(voteJob); + console.log("voteOften"); + voteInsertLoop(voteJob); } function voteResultsOften(voteJob) { - console.log('voteResultsOften'); - voteResultsLoop(voteJob); + console.log("voteResultsOften"); + voteResultsLoop(voteJob); } function voteResults(voteJob) { - console.log('voteResults'); - var query = resultsProc.getQuery(); - client.callProcedure(query, function displayResults(event, code, results) { - var mytotalVotes = 0; - - var msg = ''; - var longestString = 0; - var rows = results.table[0]; - for(var i = 0; i < rows.length; i++) { - mytotalVotes += rows[i].TOTAL_VOTES; - msg += util.format("%s\t%s\t%d\n", rows[i].CONTESTANT_NAME, - rows[i].CONTESTANT_NUMBER, rows[i].TOTAL_VOTES); - } - msg += util.format("%d votes\n\n", mytotalVotes); - console.log(msg); - runNextLink(voteJob); - }); + console.log("voteResults"); + var query = resultsProc.getQuery(); + client.callProcedure(query, function displayResults(event, code, results) { + var mytotalVotes = 0; + + var msg = ""; + var longestString = 0; + var rows = results.table[0]; + for(var i = 0; i < rows.length; i++) { + mytotalVotes += rows[i].TOTAL_VOTES; + msg += util.format("%s\t%s\t%d\n", rows[i].CONTESTANT_NAME, + rows[i].CONTESTANT_NUMBER, rows[i].TOTAL_VOTES); + } + msg += util.format("%d votes\n\n", mytotalVotes); + console.log(msg); + runNextLink(voteJob); + }); } function connectionStats() { - client.connectionStats(); + client.connectionStats(); } function voteEnd(voteJob) { - client.connectionStats(); - console.log('voteEnd'); - process.exit(); + client.connectionStats(); + console.log("voteEnd"); + process.exit(); } function getCandidate() { - return Math.floor(Math.random() * 6) + 1; + return Math.floor(Math.random() * 6) + 1; } function getAreaCode() { - return area_codes[Math.floor(Math.random() * area_codes.length)] * 10000000 + return area_codes[Math.floor(Math.random() * area_codes.length)] * 10000000 + Math.random() * 10000000; } function getSteps() { - var voltTestChain = []; - voltTestChain.push(voteResults); - // Not called because the query does a table scan and is not - // representative of VoltDB's performance - //voltTestChain.push(voteResultsOften); - voltTestChain.push(voteOften); - voltTestChain.push(voteResults); - voltTestChain.push(voteEnd); - - return voltTestChain; + var voltTestChain = []; + voltTestChain.push(voteResults); + // Not called because the query does a table scan and is not + // representative of VoltDB's performance + //voltTestChain.push(voteResultsOften); + voltTestChain.push(voteOften); + voltTestChain.push(voteResults); + voltTestChain.push(voteEnd); + + return voltTestChain; } function voteResultsLoop(voteJob) { - var index = 0; - var reads = voteJob.voteCount; - var startTime = new Date().getTime(); - var chunkTime = new Date().getTime(); - var readyToWriteCounter = 0; + var index = 0; + var reads = voteJob.voteCount; + var startTime = new Date().getTime(); + var chunkTime = new Date().getTime(); + var readyToWriteCounter = 0; - var innerResultsLoop = function() { - var query = resultsProc.getQuery(); - if(index < voteJob.voteCount) { - client.callProcedure(query, function displayVoteResults(event, code, results) { - reads--; - // results object is not always real - if ( results.status != 1) { - console.log(results); - } + var innerResultsLoop = function() { + var query = resultsProc.getQuery(); + if(index < voteJob.voteCount) { + client.callProcedure(query, function displayVoteResults(event, code, results) { + reads--; + // results object is not always real + if ( results.status != 1) { + console.log(results); + } - //console.log('reads left: ', reads); - if(reads == 0) { - logVoteResultsTime(startTime, voteJob.voteCount, "Results"); - runNextLink(voteJob); - } else { - // console.log("reads ", reads); - } - //console.log('read done'); - }, function readyToWrite() { - //console.log('writes left: ', voteJob.voteCount-index); - if(index < voteJob.voteCount) { - if ( index % 5000 == 0 ) { - console.log('Executed ', index, ' queries in ', - (new Date().getTime()) - chunkTime, 'ms ', - util.inspect(process.memoryUsage())); - chunkTime = new Date().getTime(); - } - index++; - if ( index % 20 == 0) { - process.nextTick(innerResultsLoop); - } - } else { - console.log('Time to stop querying: ', index); - } - //console.log('write done'); - }); + //console.log('reads left: ', reads); + if(reads == 0) { + logVoteResultsTime(startTime, voteJob.voteCount, "Results"); + runNextLink(voteJob); } else { - console.log(readyToWriteCounter++, 'Index is: ', index, ' and ', - voteJob.voteCount); + // console.log("reads ", reads); } - }; - process.nextTick(innerResultsLoop); + //console.log('read done'); + }, function readyToWrite() { + //console.log('writes left: ', voteJob.voteCount-index); + if(index < voteJob.voteCount) { + if ( index % 5000 == 0 ) { + console.log("Executed ", index, " queries in ", + (new Date().getTime()) - chunkTime, "ms ", + util.inspect(process.memoryUsage())); + chunkTime = new Date().getTime(); + } + index++; + if ( index % 20 == 0) { + process.nextTick(innerResultsLoop); + } + } else { + console.log("Time to stop querying: ", index); + } + //console.log('write done'); + }); + } else { + console.log(readyToWriteCounter++, "Index is: ", index, " and ", + voteJob.voteCount); + } + }; + process.nextTick(innerResultsLoop); } function voteInsertLoop(voteJob) { - var index = 0; - var reads = voteJob.voteCount; - var startTime = new Date().getTime(); - var chunkTime = new Date().getTime(); - var readyToWriteCounter = 0; - - var innerLoop = function() { - var query = voteProc.getQuery(); - if(index < voteJob.voteCount) { - query.setParameters([getAreaCode(), getCandidate(), 200000]); - client.callProcedure(query, function displayResults(event, code, results) { - //console.log("reads ", reads); - reads--; - if(reads == 0) { - logVoteInsertTime(startTime, voteJob.voteCount, "Results"); - runNextLink(voteJob); - } else { - //console.log("reads ", reads); - } - }, function readyToWrite() { - if( index < voteJob.voteCount ) { - if ( index % 5000 == 0 ) { - console.log('Executed ', index, ' votes in ', - (new Date().getTime()) - chunkTime, 'ms '/*, + var index = 0; + var reads = voteJob.voteCount; + var startTime = new Date().getTime(); + var chunkTime = new Date().getTime(); + var readyToWriteCounter = 0; + + var innerLoop = function() { + var query = voteProc.getQuery(); + if(index < voteJob.voteCount) { + query.setParameters([getAreaCode(), getCandidate(), 200000]); + client.callProcedure(query, function displayResults(event, code, results) { + //console.log("reads ", reads); + reads--; + if(reads == 0) { + logVoteInsertTime(startTime, voteJob.voteCount, "Results"); + runNextLink(voteJob); + } else { + //console.log("reads ", reads); + } + }, function readyToWrite() { + if( index < voteJob.voteCount ) { + if ( index % 5000 == 0 ) { + console.log("Executed ", index, " votes in ", + (new Date().getTime()) - chunkTime, "ms "/*, util.inspect(process.memoryUsage())*/); - chunkTime = new Date().getTime(); - } - index++; - } - }); - } - setImmediate(innerLoop); - }; - process.nextTick(innerLoop); + chunkTime = new Date().getTime(); + } + index++; + } + }); + } + setImmediate(innerLoop); + }; + process.nextTick(innerLoop); } function logVoteInsertTime(startTime, votes, typeString) { - logTime('Voted', startTime, votes, typeString); + logTime("Voted", startTime, votes, typeString); } function logVoteResultsTime(startTime, votes, typeString) { - logTime('Queried for results', startTime, votes, typeString); + logTime("Queried for results", startTime, votes, typeString); } function logTime(operation, startTime, votes, typeString) { - var endTimeMS = new Date().getTime() - startTime; - var endTimeSeconds = Math.floor(endTimeMS / 1000); - endTimeMS = (endTimeMS > 0 ? endTimeMS : 1 ); - endTimeSeconds = (endTimeSeconds > 0 ? endTimeSeconds : 1 ); - - console.log(util.format('%s %d times in %d milliseconds.\n' - + '%s %d times in %d seconds.\n%d milliseconds per transaction\n' - + '%d transactions per millisecond\n%d transactions per second\n\n', - operation, - votes, endTimeMS, - operation, votes, - endTimeSeconds, (endTimeMS / votes), - (votes / endTimeMS), (votes / endTimeSeconds))); + var endTimeMS = new Date().getTime() - startTime; + var endTimeSeconds = Math.floor(endTimeMS / 1000); + endTimeMS = (endTimeMS > 0 ? endTimeMS : 1 ); + endTimeSeconds = (endTimeSeconds > 0 ? endTimeSeconds : 1 ); + + console.log(util.format("%s %d times in %d milliseconds.\n" + + "%s %d times in %d seconds.\n%d milliseconds per transaction\n" + + "%d transactions per millisecond\n%d transactions per second\n\n", + operation, + votes, endTimeMS, + operation, votes, + endTimeSeconds, (endTimeMS / votes), + (votes / endTimeMS), (votes / endTimeSeconds))); } function isValidObject(object) { - return typeof object != 'undefined' && object != null; + return typeof object != "undefined" && object != null; } function runNextLink(voteJob) { - if(0 < voteJob.steps.length) { - var method = voteJob.steps.shift(); - if(isValidObject(method) == true) { - method(voteJob); - } + if(0 < voteJob.steps.length) { + var method = voteJob.steps.shift(); + if(isValidObject(method) == true) { + method(voteJob); } + } } main(); diff --git a/writer.js b/writer.js index 46b1d84..b2bec4d 100644 --- a/writer.js +++ b/writer.js @@ -32,37 +32,36 @@ * */ -var os = require('os') -var cli = require('cli'); -var util = require('util'); -var cluster = require('cluster'); -var VoltClient = require('./lib/client'); -var VoltProcedure = require('./lib/query'); -var VoltQuery = require('./lib/query'); +var os = require("os"); +var cli = require("cli"); +var util = require("util"); +var cluster = require("cluster"); +var VoltClient = require("./lib/client"); +var VoltProcedure = require("./lib/query"); -var numCPUs = os.cpus().length -var logTag = "master " +var numCPUs = os.cpus().length; +var logTag = "master "; var client = null; -var resultsProc = new VoltProcedure('Results'); -var initProc = new VoltProcedure('Initialize', ['int', 'string']); -var writeProc = new VoltProcedure('Vote', ['long', 'int', 'long']); +var resultsProc = new VoltProcedure("Results"); +var initProc = new VoltProcedure("Initialize", ["int", "string"]); +var writeProc = new VoltProcedure("Vote", ["long", "int", "long"]); var throughput = 0; var options = cli.parse({ - loops : ['c', 'Number of loops to run', 'number', 10000], - voltGate : ['h', 'VoltDB host (any if multi-node)', 'string', 'localhost'], - workers : ['f', 'client worker forks', 'number', numCPUs], - verbose : ['v', 'verbose output'], - debug : ['d', 'debug output'] + loops : ["c", "Number of loops to run", "number", 10000], + voltGate : ["h", "VoltDB host (any if multi-node)", "string", "localhost"], + workers : ["f", "client worker forks", "number", numCPUs], + verbose : ["v", "verbose output"], + debug : ["d", "debug output"] }); var workers = options.workers; var vlog = options.verbose || options.debug ? log : function() { -} +}; var vvlog = options.debug ? log : function() { -} -var cargos = 'a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z'; +}; +var cargos = "a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z"; if(cluster.isMaster) master_main(); @@ -71,68 +70,72 @@ else function master_main() { - log("-- Crude Forking Write Benchmark Client --") + log("-- Crude Forking Write Benchmark Client --"); log("VoltDB host: " + options.voltGate); log("worker forks: " + workers); // fork workers for(var i = 0; i < workers; i++) { - vvlog('forking worker #' + i) - var worker = cluster.fork() + vvlog("forking worker #" + i); + var worker = cluster.fork(); // result counter - worker.on('message', function(msg) { - if(msg.cmd && msg.cmd == 'result') { - throughput += msg.throughput + worker.on("message", function(msg) { + if(msg.cmd && msg.cmd == "result") { + throughput += msg.throughput; } }); } // track exits, print total var exited = 0; - cluster.on('death', function(worker) { - vlog('worker (pid ' + worker.pid + ') exits.') + cluster.on("death", function(worker) { + vlog("worker (pid " + worker.pid + ") exits."); exited++; if(exited == workers) { - log("Total: " + Math.round(throughput) + " TPS") + log("Total: " + Math.round(throughput) + " TPS"); } - }) + }); } function worker_main() { - logTag = 'worker ' + process.env.NODE_WORKER_ID - vvlog('worker main') + logTag = "worker " + process.env.NODE_WORKER_ID; + vvlog("worker main"); // define and start a Volt client client = new VoltClient([{ host : options.voltGate, port : 21212, - username : 'user', - password : 'password', - service : 'database', + username : "user", + password : "password", + service : "database", queryTimeout : 50000 }]); - client.connect(function startup(results) { - vvlog('Node up'); - voltInit(); - }, function loginError(results) { - vvlog('Node up (on Error)'); + client.connect().then(({ connected, errors }) => { + if ( connected ) { + vvlog("Node up"); + } else { + vvlog("Node up (on Error)", { errors }); + } + voltInit(); }); - vvlog('connected') + } function voltInit() { - vvlog('voltInit'); + vvlog("voltInit"); var query = initProc.getQuery(); query.setParameters([cargos.length, cargos]); - client.call(query, function initWriter(results) { - var job = { + + client.callProcedure(query).onQueryAllowed.then( () => { + const job = { loops : options.loops, steps : getSteps() }; + step(job); }); } @@ -147,30 +150,19 @@ function getSteps() { } function writeResults(job) { - vvlog('writeResults'); - var query = resultsProc.getQuery(); - client.call(query, function displayResults(results) { - var mytotalwrites = 0; - var msg = ''; - var longestString = 0; - var rows = results.table[0]; - for(var i = 0; i < rows.length; i++) { - mytotalwrites += rows[i].TOTAL_VOTES; - msg += util.format("%s\t%d", rows[i].CONTESTANT_NUMBER, rows[i].TOTAL_VOTES); - } - // msg += util.format("%d writes", mytotalwrites); - // log(msg); - step(job); - }); + vvlog("writeResults"); + const query = resultsProc.getQuery(); + client.callProcedure(query).read.then( () => step(job) ); } function connectionStats() { client.connectionStats(); } -function writeEnd(job) { - client.connectionStats(); - vvlog('writeEnd'); +function writeEnd() { + connectionStats(); + vvlog("writeEnd"); + process.exit(); } @@ -191,30 +183,34 @@ function writeInsertLoop(job) { if(index < job.loops) { query.setParameters([getRand(1E6), getCandidate(), 200000]); - client.call(query, function displayResults(results) { + const call = client.callProcedure(query); + + call.read.then( () => { vvlog("reads ", reads); reads--; + if(reads == 0) { logTime(startTime, job.loops, "Results"); step(job); } else { vvlog("reads ", reads); } - }, function readyToWrite() { + })< + call.onQueryAllowed.then ( () => { if(index < job.loops) { if(index && index % 5000 == 0) { - vlog('Executed ' + index + ' writes in ' + ((new Date().getTime()) - chunkTime) + 'ms ' + util.inspect(process.memoryUsage())); + vlog("Executed " + index + " writes in " + ((new Date().getTime()) - chunkTime) + "ms " + util.inspect(process.memoryUsage())); chunkTime = new Date().getTime(); } index++; process.nextTick(innerLoop); } else { - log(doneWith++, 'Time to stop voting: ', index); + log(doneWith++, "Time to stop voting: ", index); } }); } else { - vvlog('Index is: ' + index + ' and ' + job.loops); + vvlog("Index is: " + index + " and " + job.loops); } }; // void stack, yield @@ -222,15 +218,15 @@ function writeInsertLoop(job) { } -function logTime(startTime, writes, typeString) { +function logTime(startTime, writes) { var endTimeMS = Math.max(1, new Date().getTime() - startTime); var throughput = writes * 1000 / endTimeMS; - log(util.format('%d transactions in %d milliseconds.\n' + '%d transactions per second', writes, endTimeMS, throughput)); + log(util.format("%d transactions in %d milliseconds.\n" + "%d transactions per second", writes, endTimeMS, throughput)); process.send({ - cmd : 'result', + cmd : "result", throughput : throughput }); } @@ -250,4 +246,4 @@ function log(tx) { function getRand(max) { return Math.floor(Math.random() * max); -} \ No newline at end of file +} From a64162af3773865470c102c3c5013bae2b5e1f2c Mon Sep 17 00:00:00 2001 From: aamadeo27 Date: Sun, 26 Aug 2018 20:54:29 -0400 Subject: [PATCH 2/9] updateClasses. jar could be string filepath or Buffer --- lib/client.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/client.js b/lib/client.js index f99b683..e38c738 100644 --- a/lib/client.js +++ b/lib/client.js @@ -216,9 +216,15 @@ VoltClient.prototype.statistics = function(component, delta=0){ return this.callProcedure(statement); }; -VoltClient.prototype.updateClasses = function(jarPath, removeClasses = ""){ +VoltClient.prototype.updateClasses = function(jar, removeClasses = ""){ const statement = UpdateClasses.getQuery(); - const jarBin = jarPath ? fs.readFileSync(jarPath) : new Buffer("NULL"); + + let jarBin = null; + if ( jar instanceof Buffer) { + jarBin = jar; + } else { + jarBin = jar ? fs.readFileSync(jar) : new Buffer("NULL"); + } statement.setParameters([jarBin, removeClasses]); From 12e1291ad04e6f46bd79850fcb59c73909c52f76 Mon Sep 17 00:00:00 2001 From: aamadeo27 Date: Sun, 26 Aug 2018 21:12:25 -0400 Subject: [PATCH 3/9] Fix misreplacement of var for const --- lib/client.js | 2 +- lib/voltconstants.js | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/client.js b/lib/client.js index e38c738..3a12e10 100644 --- a/lib/client.js +++ b/lib/client.js @@ -220,7 +220,7 @@ VoltClient.prototype.updateClasses = function(jar, removeClasses = ""){ const statement = UpdateClasses.getQuery(); let jarBin = null; - if ( jar instanceof Buffer) { + if ( jar instanceof Buffer ) { jarBin = jar; } else { jarBin = jar ? fs.readFileSync(jar) : new Buffer("NULL"); diff --git a/lib/voltconstants.js b/lib/voltconstants.js index a495e3f..a67e62b 100644 --- a/lib/voltconstants.js +++ b/lib/voltconstants.js @@ -177,7 +177,7 @@ const TYPES_STRINGS = { "9" : "string", "11" : "date", "22" : "decimal", - "25" : "constbinary" + "25" : "varbinary" }; const TYPES_NUMBERS = { @@ -197,7 +197,7 @@ const TYPES_NUMBERS = { "date" : 11, "timestamp" : 11, "decimal" : 22, - "constbinary" : 25, + "varbinary" : 25, "volttable" : 21 }; @@ -218,7 +218,7 @@ const TYPES_READ = { "date" : "readDate", "timestamp" : "readDate", "decimal" : "readDecimal", - "constbinary" : "readVarbinary" + "varbinary" : "readVarbinary" }; const TYPES_WRITE = { @@ -238,7 +238,7 @@ const TYPES_WRITE = { "date" : "writeDate", "timestamp" : "writeDate", "decimal" : "writeDecimal", - "constbinary" : "writeVarbinary", + "varbinary" : "writeVarbinary", "volttable" : "writeVoltTable" }; @@ -256,7 +256,7 @@ const NUMERIC_TYPES = { "date" : true, "timestamp" : true, "decimal" : true, - "constbinary" : true + "varbinary" : true }; const STRING_TYPES = { "string" : true, From 83fe6b2f601e62cf8ae8867f52f011e0f228ed01 Mon Sep 17 00:00:00 2001 From: aamadeo27 Date: Wed, 5 Sep 2018 20:50:21 -0400 Subject: [PATCH 4/9] Change double quotes eslint rule to single quotes. Change Configuration to leave like the original to localhost --- .eslintrc.json | 2 +- examples/voter/voter/app.js | 26 +- examples/voter/voter/jsons/votes.js | 8 +- examples/voter/voter/models/volt.js | 47 ++-- .../public/javascripts/jquery-1.7.1.min.js | 6 +- .../jquery-ui-1.8.17.custom.min.js | 54 ++-- examples/voter/voter/routes/index.js | 4 +- lib/client.js | 64 ++--- lib/configuration.js | 10 +- lib/connection.js | 43 ++- lib/ctio.js | 230 ++++++++-------- lib/ctype.js | 252 +++++++++--------- lib/hashinator.js | 36 +-- lib/message.js | 14 +- lib/parser.js | 152 +++++------ lib/query.js | 2 +- lib/voltconstants.js | 250 ++++++++--------- lib/volttable.js | 54 ++-- test/cases/bufferTest.js | 122 ++++----- test/cases/clientaffinity.js | 68 ++--- test/cases/connections.js | 90 +++---- test/cases/typestest.js | 80 +++--- test/cases/updateClassesTest.js | 51 ++-- test/cases/volttableTest.js | 82 +++--- test/config.js | 12 +- test/testrunner.js | 14 +- test/util/docker-util.js | 20 +- test/util/test-context.js | 22 +- voternoui.js | 80 +++--- writer.js | 90 +++---- 30 files changed, 990 insertions(+), 995 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index 38ca1b8..1156811 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -18,7 +18,7 @@ ], "quotes": [ "warn", - "double" + "single" ], "semi": [ "error", diff --git a/examples/voter/voter/app.js b/examples/voter/voter/app.js index 79434ca..49fb43c 100644 --- a/examples/voter/voter/app.js +++ b/examples/voter/voter/app.js @@ -33,10 +33,10 @@ * client code. */ -var express = require("express"), - routes = require("./routes"), volt = require("./models/volt"), - votes = require("./jsons/votes"), util = require("util"), - cluster = require("cluster"), numCPUs = require("os").cpus().length; +var express = require('express'), + routes = require('./routes'), volt = require('./models/volt'), + votes = require('./jsons/votes'), util = require('util'), + cluster = require('cluster'), numCPUs = require('os').cpus().length; function webserverProcess() { var app = module.exports = express.createServer(); @@ -44,31 +44,31 @@ function webserverProcess() { // Configuration app.configure(function() { - app.set("views", __dirname + "/views"); - app.set("view engine", "jade"); + app.set('views', __dirname + '/views'); + app.set('view engine', 'jade'); app.use(express.bodyParser()); app.use(express.methodOverride()); app.use(app.router); - app.use(express.static(__dirname + "/public")); + app.use(express.static(__dirname + '/public')); }); - app.configure("production", function() { + app.configure('production', function() { app.use(express.errorHandler({ dumpExceptions : true, showStack : true })); }); - app.configure("production", function() { + app.configure('production', function() { app.use(express.errorHandler()); }); // Routes - app.get("/", routes.index); - app.get("/results", votes.votes); + app.get('/', routes.index); + app.get('/results', votes.votes); app.listen(3000); - util.log(util.format("Express server listening on port %d in %s mode", + util.log(util.format('Express server listening on port %d in %s mode', app.address().port, app.settings.env)); } @@ -77,7 +77,7 @@ function startup() { numCPUs /=2; // TODO: Add command line to override whatever numCPUs is set to so we don't // use all the cores. - util.log("Using CPUs: " + numCPUs); + util.log('Using CPUs: ' + numCPUs); for(var i = 0; i < (numCPUs); i++) { cluster.fork(); } diff --git a/examples/voter/voter/jsons/votes.js b/examples/voter/voter/jsons/votes.js index 1138161..3d65c2b 100644 --- a/examples/voter/voter/jsons/votes.js +++ b/examples/voter/voter/jsons/votes.js @@ -21,18 +21,18 @@ * OTHER DEALINGS IN THE SOFTWARE. */ -var volt = require("../models/volt"), - VoltConstants = require(__dirname + "/../../../../lib/voltconstants"); +var volt = require('../models/volt'), + VoltConstants = require(__dirname + '/../../../../lib/voltconstants'); exports.votes = function(req, res) { return volt.getVoteResults().then(function displayResults({code, results}) { if(code === VoltConstants.STATUS_CODES.SUCCESS && results.status === VoltConstants.RESULT_STATUS.SUCCESS) { res.json({ - "rows" : results.table[0].data.map( row => Object.assign(row, { TOTAL_VOTES : row.TOTAL_VOTES.toString()}) ) + 'rows' : results.table[0].data.map( row => Object.assign(row, { TOTAL_VOTES : row.TOTAL_VOTES.toString()}) ) }); } else { res.json({ - "critical fault, database down": 500 + 'critical fault, database down': 500 }); } }); diff --git a/examples/voter/voter/models/volt.js b/examples/voter/voter/models/volt.js index 0614f21..cefce90 100644 --- a/examples/voter/voter/models/volt.js +++ b/examples/voter/voter/models/volt.js @@ -29,28 +29,29 @@ * 2. Creates a connection * 3. Invokes stored procedures and processes the results. */ +const debug = require('debug')('voltdb-client-nodejs:voter'); -var util = require("util"); -require("cluster"); +var util = require('util'); +require('cluster'); // VoltClient manages all communication with VoltDB -var VoltClient = require(__dirname + "/../../../../lib/client"); +var VoltClient = require(__dirname + '/../../../../lib/client'); // VoltConstants has all the event types, codes and other constants // that the client and your code will rely upon -var VoltConstants = require(__dirname + "/../../../../lib/voltconstants"); +var VoltConstants = require(__dirname + '/../../../../lib/voltconstants'); // VoltConfiguration sets up the configuration for each VoltDB server // in your cluster. If you have ten Volt nodes in the cluster, then you should // create ten configurations. These configurations are used in the construction // of the client. -var VoltConfiguration = require(__dirname + "/../../../../lib/configuration"); +var VoltConfiguration = require(__dirname + '/../../../../lib/configuration'); // VoltProcedure is a static representation of the stored procedure and // specifies the procedure's name and the parameter types. The parameter types // are especially important since they define how the client will marshal the // the parameters. -var VoltProcedure = require(__dirname + "/../../../../lib/query"); +var VoltProcedure = require(__dirname + '/../../../../lib/query'); // VoltQuery is a specific instance of a VoltProcedure. Your code will // always call stored procedures using a VoltQuery object. @@ -58,9 +59,9 @@ var VoltProcedure = require(__dirname + "/../../../../lib/query"); // These are a set of stored procedure definitions. // See VoltConstants to see the data types supported by the driver. -var resultsProc = new VoltProcedure("Results"); -var initProc = new VoltProcedure("Initialize", ["int", "string"]); -var voteProc = new VoltProcedure("Vote", ["long", "int", "long"]); +var resultsProc = new VoltProcedure('Results'); +var initProc = new VoltProcedure('Initialize', ['int', 'string']); +var voteProc = new VoltProcedure('Vote', ['long', 'int', 'long']); // The following is just application specific data var client = null; @@ -89,9 +90,9 @@ var area_codes = [907, 205, 256, 334, 251, 870, 501, 479, 480, 602, 623, 928, 804, 757, 703, 571, 276, 236, 540, 802, 509, 360, 564, 206, 425, 253, 715, 920, 262, 414, 608, 304, 307]; -var voteCandidates = "Edwina Burnam,Tabatha Gehling,Kelly Clauss," + -"Jessie Alloway,Alana Bregman,Jessie Eichman,Allie Rogalski,Nita Coster," + -"Kurt Walser,Ericka Dieter,Loraine NygrenTania Mattioli"; +var voteCandidates = 'Edwina Burnam,Tabatha Gehling,Kelly Clauss,' + +'Jessie Alloway,Alana Bregman,Jessie Eichman,Allie Rogalski,Nita Coster,' + +'Kurt Walser,Ericka Dieter,Loraine NygrenTania Mattioli'; function getCandidate() { return Math.floor(Math.random() * 6) + 1; @@ -105,7 +106,7 @@ function getAreaCode() { // This will initialize the Voter database by invoking a stored procedure. function voltInit() { - util.log("voltInit"); + util.log('voltInit'); // Start by creating a query instance from the VoltProcedure var query = initProc.getQuery(); @@ -122,11 +123,11 @@ function voltInit() { // The result object depends on the operation. Queries will always return a // VoltTable array client.callProcedure(query).read.then( function initVoter({ results }) { - if ( results.status !== VoltConstants.RESULT_STATUS.SUCCESS ) return console.error( results.status.string ); + if ( results.status !== VoltConstants.RESULT_STATUS.SUCCESS ) return debug( results.status.string ); const val = results.table[0].data[0]; - util.log("Initialized app for " + val[""] + " candidates."); - }).catch( console.error ); + util.log('Initialized app for ' + val[''] + ' candidates.'); + }).catch( debug ); } @@ -135,7 +136,7 @@ function voltInit() { // for trapping all the various error conditions, like connections being // dropped. function eventListener(code, event, message) { - util.log(util.format( "Event %s\tcode: %d\tMessage: %s", event, code, + util.log(util.format( 'Event %s\tcode: %d\tMessage: %s', event, code, message)); } @@ -161,7 +162,7 @@ exports.initClient = function(startLoop) { if(client == null) { var configs = []; - configs.push(getConfiguration("produccion","operator","mech")); + configs.push(getConfiguration('localhost','operator','mech')); // The client is only configured at this point. The connection // is not made until the call to client.connect(). client = new VoltClient(configs); @@ -184,7 +185,7 @@ exports.initClient = function(startLoop) { // The second handler is more for catastrophic failures. client.connect().then(function startup({ connected, errors }) { if( connected ) { - util.log("Node connected to VoltDB"); + util.log('Node connected to VoltDB'); if(startLoop) { setInterval(logResults, statsLoggingInterval); voteInsertLoop(); @@ -192,7 +193,7 @@ exports.initClient = function(startLoop) { voltInit(); } } else { - util.log("Unexpected status while initClient:", errors.map( e => VoltConstants.LOGIN_ERRORS[e]) ); + util.log('Unexpected status while initClient:', errors.map( e => VoltConstants.LOGIN_ERRORS[e]) ); process.exit(1); } }); @@ -223,7 +224,7 @@ function voteInsertLoop() { let call = client.callProcedure(query); call.read.then(function displayResults() { transactionCounter++; - }).catch( console.error ); + }).catch( debug ); } setImmediate(innerLoop); }; @@ -234,12 +235,12 @@ function voteInsertLoop() { // This just displays how many votes we issued every 10 seconds, per node // instance function logResults() { - logTime("Voted", statsLoggingInterval, transactionCounter); + logTime('Voted', statsLoggingInterval, transactionCounter); transactionCounter = 0; } function logTime(operation, totalTime, count) { - util.log(util.format("%d: %s %d times in %d milliseconds. %d TPS", + util.log(util.format('%d: %s %d times in %d milliseconds. %d TPS', process.pid, operation, count, totalTime, Math.floor((count / totalTime) * 1000))); } diff --git a/examples/voter/voter/public/javascripts/jquery-1.7.1.min.js b/examples/voter/voter/public/javascripts/jquery-1.7.1.min.js index 474b4eb..df3895b 100644 --- a/examples/voter/voter/public/javascripts/jquery-1.7.1.min.js +++ b/examples/voter/voter/public/javascripts/jquery-1.7.1.min.js @@ -1,4 +1,4 @@ /*! jQuery v1.7.1 jquery.com | jquery.org/license */ -(function(a,b){function cy(a){return f.isWindow(a)?a:a.nodeType===9?a.defaultView||a.parentWindow:!1;}function cv(a){if(!ck[a]){var b=c.body,d=f("<"+a+">").appendTo(b),e=d.css("display");d.remove();if(e==="none"||e===""){cl||(cl=c.createElement("iframe"),cl.frameBorder=cl.width=cl.height=0),b.appendChild(cl);if(!cm||!cl.createElement)cm=(cl.contentWindow||cl.contentDocument).document,cm.write((c.compatMode==="CSS1Compat"?"":"")+""),cm.close();d=cm.createElement(a),cm.body.appendChild(d),e=f.css(d,"display"),b.removeChild(cl);}ck[a]=e;}return ck[a];}function cu(a,b){var c={};f.each(cq.concat.apply([],cq.slice(0,b)),function(){c[this]=a;});return c;}function ct(){cr=b;}function cs(){setTimeout(ct,0);return cr=f.now();}function cj(){try{return new a.ActiveXObject("Microsoft.XMLHTTP");}catch(b){}}function ci(){try{return new a.XMLHttpRequest;}catch(b){}}function cc(a,c){a.dataFilter&&(c=a.dataFilter(c,a.dataType));var d=a.dataTypes,e={},g,h,i=d.length,j,k=d[0],l,m,n,o,p;for(g=1;g0){if(c!=="border")for(;g=0===c;});}function S(a){return!a||!a.parentNode||a.parentNode.nodeType===11;}function K(){return!0;}function J(){return!1;}function n(a,b,c){var d=b+"defer",e=b+"queue",g=b+"mark",h=f._data(a,d);h&&(c==="queue"||!f._data(a,e))&&(c==="mark"||!f._data(a,g))&&setTimeout(function(){!f._data(a,e)&&!f._data(a,g)&&(f.removeData(a,d,!0),h.fire());},0);}function m(a){for(var b in a){if(b==="data"&&f.isEmptyObject(a[b]))continue;if(b!=="toJSON")return!1;}return!0;}function l(a,c,d){if(d===b&&a.nodeType===1){var e="data-"+c.replace(k,"-$1").toLowerCase();d=a.getAttribute(e);if(typeof d=="string"){try{d=d==="true"?!0:d==="false"?!1:d==="null"?null:f.isNumeric(d)?parseFloat(d):j.test(d)?f.parseJSON(d):d;}catch(g){}f.data(a,c,d);}else d=b;}return d;}function h(a){var b=g[a]={},c,d;a=a.split(/\s+/);for(c=0,d=a.length;c)[^>]*$|#([\w\-]*)$)/,j=/\S/,k=/^\s+/,l=/\s+$/,m=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,n=/^[\],:{}\s]*$/,o=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,p=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,q=/(?:^|:|,)(?:\s*\[)+/g,r=/(webkit)[ \/]([\w.]+)/,s=/(opera)(?:.*version)?[ \/]([\w.]+)/,t=/(msie) ([\w.]+)/,u=/(mozilla)(?:.*? rv:([\w.]+))?/,v=/-([a-z]|[0-9])/ig,w=/^-ms-/,x=function(a,b){return(b+"").toUpperCase();},y=d.userAgent,z,A,B,C=Object.prototype.toString,D=Object.prototype.hasOwnProperty,E=Array.prototype.push,F=Array.prototype.slice,G=String.prototype.trim,H=Array.prototype.indexOf,I={};e.fn=e.prototype={constructor:e,init:function(a,d,f){var g,h,j,k;if(!a)return this;if(a.nodeType){this.context=this[0]=a,this.length=1;return this;}if(a==="body"&&!d&&c.body){this.context=c,this[0]=c.body,this.selector=a,this.length=1;return this;}if(typeof a=="string"){a.charAt(0)!=="<"||a.charAt(a.length-1)!==">"||a.length<3?g=i.exec(a):g=[null,a,null];if(g&&(g[1]||!d)){if(g[1]){d=d instanceof e?d[0]:d,k=d?d.ownerDocument||d:c,j=m.exec(a),j?e.isPlainObject(d)?(a=[c.createElement(j[1])],e.fn.attr.call(a,d,!0)):a=[k.createElement(j[1])]:(j=e.buildFragment([g[1]],[k]),a=(j.cacheable?e.clone(j.fragment):j.fragment).childNodes);return e.merge(this,a);}h=c.getElementById(g[2]);if(h&&h.parentNode){if(h.id!==g[2])return f.find(a);this.length=1,this[0]=h;}this.context=c,this.selector=a;return this;}return!d||d.jquery?(d||f).find(a):this.constructor(d).find(a);}if(e.isFunction(a))return f.ready(a);a.selector!==b&&(this.selector=a.selector,this.context=a.context);return e.makeArray(a,this);},selector:"",jquery:"1.7.1",length:0,size:function(){return this.length;},toArray:function(){return F.call(this,0);},get:function(a){return a==null?this.toArray():a<0?this[this.length+a]:this[a];},pushStack:function(a,b,c){var d=this.constructor();e.isArray(a)?E.apply(d,a):e.merge(d,a),d.prevObject=this,d.context=this.context,b==="find"?d.selector=this.selector+(this.selector?" ":"")+c:b&&(d.selector=this.selector+"."+b+"("+c+")");return d;},each:function(a,b){return e.each(this,a,b);},ready:function(a){e.bindReady(),A.add(a);return this;},eq:function(a){a=+a;return a===-1?this.slice(a):this.slice(a,a+1);},first:function(){return this.eq(0);},last:function(){return this.eq(-1);},slice:function(){return this.pushStack(F.apply(this,arguments),"slice",F.call(arguments).join(","));},map:function(a){return this.pushStack(e.map(this,function(b,c){return a.call(b,c,b);}));},end:function(){return this.prevObject||this.constructor(null);},push:E,sort:[].sort,splice:[].splice},e.fn.init.prototype=e.fn,e.extend=e.fn.extend=function(){var a,c,d,f,g,h,i=arguments[0]||{},j=1,k=arguments.length,l=!1;typeof i=="boolean"&&(l=i,i=arguments[1]||{},j=2),typeof i!="object"&&!e.isFunction(i)&&(i={}),k===j&&(i=this,--j);for(;j0)return;A.fireWith(c,[e]),e.fn.trigger&&e(c).trigger("ready").off("ready");}},bindReady:function(){if(!A){A=e.Callbacks("once memory");if(c.readyState==="complete")return setTimeout(e.ready,1);if(c.addEventListener)c.addEventListener("DOMContentLoaded",B,!1),a.addEventListener("load",e.ready,!1);else if(c.attachEvent){c.attachEvent("onreadystatechange",B),a.attachEvent("onload",e.ready);var b=!1;try{b=a.frameElement==null;}catch(d){}c.documentElement.doScroll&&b&&J();}}},isFunction:function(a){return e.type(a)==="function";},isArray:Array.isArray||function(a){return e.type(a)==="array";},isWindow:function(a){return a&&typeof a=="object"&&"setInterval"in a;},isNumeric:function(a){return!isNaN(parseFloat(a))&&isFinite(a);},type:function(a){return a==null?String(a):I[C.call(a)]||"object";},isPlainObject:function(a){if(!a||e.type(a)!=="object"||a.nodeType||e.isWindow(a))return!1;try{if(a.constructor&&!D.call(a,"constructor")&&!D.call(a.constructor.prototype,"isPrototypeOf"))return!1;}catch(c){return!1;}var d;for(d in a);return d===b||D.call(a,d);},isEmptyObject:function(a){for(var b in a)return!1;return!0;},error:function(a){throw new Error(a);},parseJSON:function(b){if(typeof b!="string"||!b)return null;b=e.trim(b);if(a.JSON&&a.JSON.parse)return a.JSON.parse(b);if(n.test(b.replace(o,"@").replace(p,"]").replace(q,"")))return(new Function("return "+b))();e.error("Invalid JSON: "+b);},parseXML:function(c){var d,f;try{a.DOMParser?(f=new DOMParser,d=f.parseFromString(c,"text/xml")):(d=new ActiveXObject("Microsoft.XMLDOM"),d.async="false",d.loadXML(c));}catch(g){d=b;}(!d||!d.documentElement||d.getElementsByTagName("parsererror").length)&&e.error("Invalid XML: "+c);return d;},noop:function(){},globalEval:function(b){b&&j.test(b)&&(a.execScript||function(b){a.eval.call(a,b);})(b);},camelCase:function(a){return a.replace(w,"ms-").replace(v,x);},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase();},each:function(a,c,d){var f,g=0,h=a.length,i=h===b||e.isFunction(a);if(d){if(i){for(f in a)if(c.apply(a[f],d)===!1)break;}else for(;g0&&a[0]&&a[j-1]||j===0||e.isArray(a));if(k)for(;i1?i.call(arguments,0):b,j.notifyWith(k,e);};}function l(a){return function(c){b[a]=arguments.length>1?i.call(arguments,0):c,--g||j.resolveWith(j,b);};}var b=i.call(arguments,0),c=0,d=b.length,e=Array(d),g=d,h=d,j=d<=1&&a&&f.isFunction(a.promise)?a:f.Deferred(),k=j.promise();if(d>1){for(;c
    a",d=q.getElementsByTagName("*"),e=q.getElementsByTagName("a")[0];if(!d||!d.length||!e)return{};g=c.createElement("select"),h=g.appendChild(c.createElement("option")),i=q.getElementsByTagName("input")[0],b={leadingWhitespace:q.firstChild.nodeType===3,tbody:!q.getElementsByTagName("tbody").length,htmlSerialize:!!q.getElementsByTagName("link").length,style:/top/.test(e.getAttribute("style")),hrefNormalized:e.getAttribute("href")==="/a",opacity:/^0.55/.test(e.style.opacity),cssFloat:!!e.style.cssFloat,checkOn:i.value==="on",optSelected:h.selected,getSetAttribute:q.className!=="t",enctype:!!c.createElement("form").enctype,html5Clone:c.createElement("nav").cloneNode(!0).outerHTML!=="<:nav>",submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0},i.checked=!0,b.noCloneChecked=i.cloneNode(!0).checked,g.disabled=!0,b.optDisabled=!h.disabled;try{delete q.test;}catch(s){b.deleteExpando=!1;}!q.addEventListener&&q.attachEvent&&q.fireEvent&&(q.attachEvent("onclick",function(){b.noCloneEvent=!1;}),q.cloneNode(!0).fireEvent("onclick")),i=c.createElement("input"),i.value="t",i.setAttribute("type","radio"),b.radioValue=i.value==="t",i.setAttribute("checked","checked"),q.appendChild(i),k=c.createDocumentFragment(),k.appendChild(q.lastChild),b.checkClone=k.cloneNode(!0).cloneNode(!0).lastChild.checked,b.appendChecked=i.checked,k.removeChild(i),k.appendChild(q),q.innerHTML="",a.getComputedStyle&&(j=c.createElement("div"),j.style.width="0",j.style.marginRight="0",q.style.width="2px",q.appendChild(j),b.reliableMarginRight=(parseInt((a.getComputedStyle(j,null)||{marginRight:0}).marginRight,10)||0)===0);if(q.attachEvent)for(o in{submit:1,change:1,focusin:1})n="on"+o,p=n in q,p||(q.setAttribute(n,"return;"),p=typeof q[n]=="function"),b[o+"Bubbles"]=p;k.removeChild(q),k=g=h=j=q=i=null,f(function(){var a,d,e,g,h,i,j,k,m,n,o,r=c.getElementsByTagName("body")[0];!r||(j=1,k="position:absolute;top:0;left:0;width:1px;height:1px;margin:0;",m="visibility:hidden;border:0;",n="style='"+k+"border:5px solid #000;padding:0;'",o="
    "+""+"
    ",a=c.createElement("div"),a.style.cssText=m+"width:0;height:0;position:static;top:0;margin-top:"+j+"px",r.insertBefore(a,r.firstChild),q=c.createElement("div"),a.appendChild(q),q.innerHTML="
    t
    ",l=q.getElementsByTagName("td"),p=l[0].offsetHeight===0,l[0].style.display="",l[1].style.display="none",b.reliableHiddenOffsets=p&&l[0].offsetHeight===0,q.innerHTML="",q.style.width=q.style.paddingLeft="1px",f.boxModel=b.boxModel=q.offsetWidth===2,typeof q.style.zoom!="undefined"&&(q.style.display="inline",q.style.zoom=1,b.inlineBlockNeedsLayout=q.offsetWidth===2,q.style.display="",q.innerHTML="
    ",b.shrinkWrapBlocks=q.offsetWidth!==2),q.style.cssText=k+m,q.innerHTML=o,d=q.firstChild,e=d.firstChild,h=d.nextSibling.firstChild.firstChild,i={doesNotAddBorder:e.offsetTop!==5,doesAddBorderForTableAndCells:h.offsetTop===5},e.style.position="fixed",e.style.top="20px",i.fixedPosition=e.offsetTop===20||e.offsetTop===15,e.style.position=e.style.top="",d.style.overflow="hidden",d.style.position="relative",i.subtractsBorderForOverflowNotVisible=e.offsetTop===-5,i.doesNotIncludeMarginInBodyOffset=r.offsetTop!==j,r.removeChild(a),q=a=null,f.extend(b,i));});return b;}();var j=/^(?:\{.*\}|\[.*\])$/,k=/([A-Z])/g;f.extend({cache:{},uuid:0,expando:"jQuery"+(f.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(a){a=a.nodeType?f.cache[a[f.expando]]:a[f.expando];return!!a&&!m(a);},data:function(a,c,d,e){if(f.acceptData(a)){var g,h,i,j=f.expando,k=typeof c=="string",l=a.nodeType,m=l?f.cache:a,n=l?a[j]:a[j]&&j,o=c==="events";if((!n||!m[n]||!o&&!e&&!m[n].data)&&k&&d===b)return;n||(l?a[j]=n=++f.uuid:n=j),m[n]||(m[n]={},l||(m[n].toJSON=f.noop));if(typeof c=="object"||typeof c=="function")e?m[n]=f.extend(m[n],c):m[n].data=f.extend(m[n].data,c);g=h=m[n],e||(h.data||(h.data={}),h=h.data),d!==b&&(h[f.camelCase(c)]=d);if(o&&!h[c])return g.events;k?(i=h[c],i==null&&(i=h[f.camelCase(c)])):i=h;return i;}},removeData:function(a,b,c){if(f.acceptData(a)){var d,e,g,h=f.expando,i=a.nodeType,j=i?f.cache:a,k=i?a[h]:h;if(!j[k])return;if(b){d=c?j[k]:j[k].data;if(d){f.isArray(b)||(b in d?b=[b]:(b=f.camelCase(b),b in d?b=[b]:b=b.split(" ")));for(e=0,g=b.length;e-1)return!0;return!1;},val:function(a){var c,d,e,g=this[0];{if(arguments.length){e=f.isFunction(a);return this.each(function(d){var g=f(this),h;if(this.nodeType===1){e?h=a.call(this,d,g.val()):h=a,h==null?h="":typeof h=="number"?h+="":f.isArray(h)&&(h=f.map(h,function(a){return a==null?"":a+"";})),c=f.valHooks[this.nodeName.toLowerCase()]||f.valHooks[this.type];if(!c||!("set"in c)||c.set(this,h,"value")===b)this.value=h;}});}if(g){c=f.valHooks[g.nodeName.toLowerCase()]||f.valHooks[g.type];if(c&&"get"in c&&(d=c.get(g,"value"))!==b)return d;d=g.value;return typeof d=="string"?d.replace(q,""):d==null?"":d;}}}}),f.extend({valHooks:{option:{get:function(a){var b=a.attributes.value;return!b||b.specified?a.value:a.text;}},select:{get:function(a){var b,c,d,e,g=a.selectedIndex,h=[],i=a.options,j=a.type==="select-one";if(g<0)return null;c=j?g:0,d=j?g+1:i.length;for(;c=0;}),c.length||(a.selectedIndex=-1);return c;}}},attrFn:{val:!0,css:!0,html:!0,text:!0,data:!0,width:!0,height:!0,offset:!0},attr:function(a,c,d,e){var g,h,i,j=a.nodeType;if(!!a&&j!==3&&j!==8&&j!==2){if(e&&c in f.attrFn)return f(a)[c](d);if(typeof a.getAttribute=="undefined")return f.prop(a,c,d);i=j!==1||!f.isXMLDoc(a),i&&(c=c.toLowerCase(),h=f.attrHooks[c]||(u.test(c)?x:w));if(d!==b){if(d===null){f.removeAttr(a,c);return;}if(h&&"set"in h&&i&&(g=h.set(a,d,c))!==b)return g;a.setAttribute(c,""+d);return d;}if(h&&"get"in h&&i&&(g=h.get(a,c))!==null)return g;g=a.getAttribute(c);return g===null?b:g;}},removeAttr:function(a,b){var c,d,e,g,h=0;if(b&&a.nodeType===1){d=b.toLowerCase().split(p),g=d.length;for(;h=0;}});});var z=/^(?:textarea|input|select)$/i,A=/^([^\.]*)?(?:\.(.+))?$/,B=/\bhover(\.\S+)?\b/,C=/^key/,D=/^(?:mouse|contextmenu)|click/,E=/^(?:focusinfocus|focusoutblur)$/,F=/^(\w*)(?:#([\w\-]+))?(?:\.([\w\-]+))?$/,G=function(a){var b=F.exec(a);b&&(b[1]=(b[1]||"").toLowerCase(),b[3]=b[3]&&new RegExp("(?:^|\\s)"+b[3]+"(?:\\s|$)"));return b;},H=function(a,b){var c=a.attributes||{};return(!b[1]||a.nodeName.toLowerCase()===b[1])&&(!b[2]||(c.id||{}).value===b[2])&&(!b[3]||b[3].test((c["class"]||{}).value));},I=function(a){return f.event.special.hover?a:a.replace(B,"mouseenter$1 mouseleave$1");}; - f.event={add:function(a,c,d,e,g){var h,i,j,k,l,m,n,o,p,q,r,s;if(!(a.nodeType===3||a.nodeType===8||!c||!d||!(h=f._data(a)))){d.handler&&(p=d,d=p.handler),d.guid||(d.guid=f.guid++),j=h.events,j||(h.events=j={}),i=h.handle,i||(h.handle=i=function(a){return typeof f!="undefined"&&(!a||f.event.triggered!==a.type)?f.event.dispatch.apply(i.elem,arguments):b;},i.elem=a),c=f.trim(I(c)).split(" ");for(k=0;k=0&&(h=h.slice(0,-1),k=!0),h.indexOf(".")>=0&&(i=h.split("."),h=i.shift(),i.sort());if((!e||f.event.customEvent[h])&&!f.event.global[h])return;c=typeof c=="object"?c[f.expando]?c:new f.Event(h,c):new f.Event(h),c.type=h,c.isTrigger=!0,c.exclusive=k,c.namespace=i.join("."),c.namespace_re=c.namespace?new RegExp("(^|\\.)"+i.join("\\.(?:.*\\.)?")+"(\\.|$)"):null,o=h.indexOf(":")<0?"on"+h:"";if(!e){j=f.cache;for(l in j)j[l].events&&j[l].events[h]&&f.event.trigger(c,d,j[l].handle.elem,!0);return;}c.result=b,c.target||(c.target=e),d=d!=null?f.makeArray(d):[],d.unshift(c),p=f.event.special[h]||{};if(p.trigger&&p.trigger.apply(e,d)===!1)return;r=[[e,p.bindType||h]];if(!g&&!p.noBubble&&!f.isWindow(e)){s=p.delegateType||h,m=E.test(s+h)?e:e.parentNode,n=null;for(;m;m=m.parentNode)r.push([m,s]),n=m;n&&n===e.ownerDocument&&r.push([n.defaultView||n.parentWindow||a,s]);}for(l=0;le&&i.push({elem:this,matches:d.slice(e)});for(j=0;j0?this.on(b,null,a,c):this.trigger(b);},f.attrFn&&(f.attrFn[b]=!0),C.test(b)&&(f.event.fixHooks[b]=f.event.keyHooks),D.test(b)&&(f.event.fixHooks[b]=f.event.mouseHooks);}),function(){function x(a,b,c,e,f,g){for(var h=0,i=e.length;h0){k=j;break;}}j=j[a];}e[h]=k;}}}function w(a,b,c,e,f,g){for(var h=0,i=e.length;h+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,d="sizcache"+(Math.random()+"").replace(".",""),e=0,g=Object.prototype.toString,h=!1,i=!0,j=/\\/g,k=/\r\n/g,l=/\W/;[0,0].sort(function(){i=!1;return 0;});var m=function(b,d,e,f){e=e||[],d=d||c;var h=d;if(d.nodeType!==1&&d.nodeType!==9)return[];if(!b||typeof b!="string")return e;var i,j,k,l,n,q,r,t,u=!0,v=m.isXML(d),w=[],x=b;do{a.exec(""),i=a.exec(x);if(i){x=i[3],w.push(i[1]);if(i[2]){l=i[3];break;}}}while(i);if(w.length>1&&p.exec(b))if(w.length===2&&o.relative[w[0]])j=y(w[0]+w[1],d,f);else{j=o.relative[w[0]]?[d]:m(w.shift(),d);while(w.length)b=w.shift(),o.relative[b]&&(b+=w.shift()),j=y(b,j,f);}else{!f&&w.length>1&&d.nodeType===9&&!v&&o.match.ID.test(w[0])&&!o.match.ID.test(w[w.length-1])&&(n=m.find(w.shift(),d,v),d=n.expr?m.filter(n.expr,n.set)[0]:n.set[0]);if(d){n=f?{expr:w.pop(),set:s(f)}:m.find(w.pop(),w.length===1&&(w[0]==="~"||w[0]==="+")&&d.parentNode?d.parentNode:d,v),j=n.expr?m.filter(n.expr,n.set):n.set,w.length>0?k=s(j):u=!1;while(w.length)q=w.pop(),r=q,o.relative[q]?r=w.pop():q="",r==null&&(r=d),o.relative[q](k,r,v);}else k=w=[];}k||(k=j),k||m.error(q||b);if(g.call(k)==="[object Array]")if(!u)e.push.apply(e,k);else if(d&&d.nodeType===1)for(t=0;k[t]!=null;t++)k[t]&&(k[t]===!0||k[t].nodeType===1&&m.contains(d,k[t]))&&e.push(j[t]);else for(t=0;k[t]!=null;t++)k[t]&&k[t].nodeType===1&&e.push(j[t]);else s(k,e);l&&(m(l,h,e,f),m.uniqueSort(e));return e;};m.uniqueSort=function(a){if(u){h=i,a.sort(u);if(h)for(var b=1;b0;},m.find=function(a,b,c){var d,e,f,g,h,i;if(!a)return[];for(e=0,f=o.order.length;e":function(a,b){var c,d=typeof b=="string",e=0,f=a.length;if(d&&!l.test(b)){b=b.toLowerCase();for(;e=0)?c||d.push(h):c&&(b[g]=!1));return!1;},ID:function(a){return a[1].replace(j,"");},TAG:function(a,b){return a[1].replace(j,"").toLowerCase();},CHILD:function(a){if(a[1]==="nth"){a[2]||m.error(a[0]),a[2]=a[2].replace(/^\+|\s*/g,"");var b=/(-?)(\d*)(?:n([+\-]?\d*))?/.exec(a[2]==="even"&&"2n"||a[2]==="odd"&&"2n+1"||!/\D/.test(a[2])&&"0n+"+a[2]||a[2]);a[2]=b[1]+(b[2]||1)-0,a[3]=b[3]-0;}else a[2]&&m.error(a[0]);a[0]=e++;return a;},ATTR:function(a,b,c,d,e,f){var g=a[1]=a[1].replace(j,"");!f&&o.attrMap[g]&&(a[1]=o.attrMap[g]),a[4]=(a[4]||a[5]||"").replace(j,""),a[2]==="~="&&(a[4]=" "+a[4]+" ");return a;},PSEUDO:function(b,c,d,e,f){if(b[1]==="not")if((a.exec(b[3])||"").length>1||/^\w/.test(b[3]))b[3]=m(b[3],null,null,c);else{var g=m.filter(b[3],c,d,!0^f);d||e.push.apply(e,g);return!1;}else if(o.match.POS.test(b[0])||o.match.CHILD.test(b[0]))return!0;return b;},POS:function(a){a.unshift(!0);return a;}},filters:{enabled:function(a){return a.disabled===!1&&a.type!=="hidden";},disabled:function(a){return a.disabled===!0;},checked:function(a){return a.checked===!0;},selected:function(a){a.parentNode&&a.parentNode.selectedIndex;return a.selected===!0;},parent:function(a){return!!a.firstChild;},empty:function(a){return!a.firstChild;},has:function(a,b,c){return!!m(c[3],a).length;},header:function(a){return/h\d/i.test(a.nodeName);},text:function(a){var b=a.getAttribute("type"),c=a.type;return a.nodeName.toLowerCase()==="input"&&"text"===c&&(b===c||b===null);},radio:function(a){return a.nodeName.toLowerCase()==="input"&&"radio"===a.type;},checkbox:function(a){return a.nodeName.toLowerCase()==="input"&&"checkbox"===a.type;},file:function(a){return a.nodeName.toLowerCase()==="input"&&"file"===a.type;},password:function(a){return a.nodeName.toLowerCase()==="input"&&"password"===a.type;},submit:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"submit"===a.type;},image:function(a){return a.nodeName.toLowerCase()==="input"&&"image"===a.type;},reset:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"reset"===a.type;},button:function(a){var b=a.nodeName.toLowerCase();return b==="input"&&"button"===a.type||b==="button";},input:function(a){return/input|select|textarea|button/i.test(a.nodeName);},focus:function(a){return a===a.ownerDocument.activeElement;}},setFilters:{first:function(a,b){return b===0;},last:function(a,b,c,d){return b===d.length-1;},even:function(a,b){return b%2===0;},odd:function(a,b){return b%2===1;},lt:function(a,b,c){return bc[3]-0;},nth:function(a,b,c){return c[3]-0===b;},eq:function(a,b,c){return c[3]-0===b;}},filter:{PSEUDO:function(a,b,c,d){var e=b[1],f=o.filters[e];if(f)return f(a,c,b,d);if(e==="contains")return(a.textContent||a.innerText||n([a])||"").indexOf(b[3])>=0;if(e==="not"){var g=b[3];for(var h=0,i=g.length;h=0;}},ID:function(a,b){return a.nodeType===1&&a.getAttribute("id")===b;},TAG:function(a,b){return b==="*"&&a.nodeType===1||!!a.nodeName&&a.nodeName.toLowerCase()===b;},CLASS:function(a,b){return(" "+(a.className||a.getAttribute("class"))+" ").indexOf(b)>-1;},ATTR:function(a,b){var c=b[1],d=m.attr?m.attr(a,c):o.attrHandle[c]?o.attrHandle[c](a):a[c]!=null?a[c]:a.getAttribute(c),e=d+"",f=b[2],g=b[4];return d==null?f==="!=":!f&&m.attr?d!=null:f==="="?e===g:f==="*="?e.indexOf(g)>=0:f==="~="?(" "+e+" ").indexOf(g)>=0:g?f==="!="?e!==g:f==="^="?e.indexOf(g)===0:f==="$="?e.substr(e.length-g.length)===g:f==="|="?e===g||e.substr(0,g.length+1)===g+"-":!1:e&&d!==!1;},POS:function(a,b,c,d){var e=b[2],f=o.setFilters[e];if(f)return f(a,c,b,d);}}},p=o.match.POS,q=function(a,b){return"\\"+(b-0+1);};for(var r in o.match)o.match[r]=new RegExp(o.match[r].source+/(?![^\[]*\])(?![^\(]*\))/.source),o.leftMatch[r]=new RegExp(/(^(?:.|\r|\n)*?)/.source+o.match[r].source.replace(/\\(\d+)/g,q));var s=function(a,b){a=Array.prototype.slice.call(a,0);if(b){b.push.apply(b,a);return b;}return a;};try{Array.prototype.slice.call(c.documentElement.childNodes,0)[0].nodeType;}catch(t){s=function(a,b){var c=0,d=b||[];if(g.call(a)==="[object Array]")Array.prototype.push.apply(d,a);else if(typeof a.length=="number")for(var e=a.length;c",e.insertBefore(a,e.firstChild),c.getElementById(d)&&(o.find.ID=function(a,c,d){if(typeof c.getElementById!="undefined"&&!d){var e=c.getElementById(a[1]);return e?e.id===a[1]||typeof e.getAttributeNode!="undefined"&&e.getAttributeNode("id").nodeValue===a[1]?[e]:b:[];}},o.filter.ID=function(a,b){var c=typeof a.getAttributeNode!="undefined"&&a.getAttributeNode("id");return a.nodeType===1&&c&&c.nodeValue===b;}),e.removeChild(a),e=a=null;}(),function(){var a=c.createElement("div");a.appendChild(c.createComment("")),a.getElementsByTagName("*").length>0&&(o.find.TAG=function(a,b){var c=b.getElementsByTagName(a[1]);if(a[1]==="*"){var d=[];for(var e=0;c[e];e++)c[e].nodeType===1&&d.push(c[e]);c=d;}return c;}),a.innerHTML="",a.firstChild&&typeof a.firstChild.getAttribute!="undefined"&&a.firstChild.getAttribute("href")!=="#"&&(o.attrHandle.href=function(a){return a.getAttribute("href",2);}),a=null;}(),c.querySelectorAll&&function(){var a=m,b=c.createElement("div"),d="__sizzle__";b.innerHTML="

    ";if(!b.querySelectorAll||b.querySelectorAll(".TEST").length!==0){m=function(b,e,f,g){e=e||c;if(!g&&!m.isXML(e)){var h=/^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec(b);if(h&&(e.nodeType===1||e.nodeType===9)){if(h[1])return s(e.getElementsByTagName(b),f);if(h[2]&&o.find.CLASS&&e.getElementsByClassName)return s(e.getElementsByClassName(h[2]),f);}if(e.nodeType===9){if(b==="body"&&e.body)return s([e.body],f);if(h&&h[3]){var i=e.getElementById(h[3]);if(!i||!i.parentNode)return s([],f);if(i.id===h[3])return s([i],f);}try{return s(e.querySelectorAll(b),f);}catch(j){}}else if(e.nodeType===1&&e.nodeName.toLowerCase()!=="object"){var k=e,l=e.getAttribute("id"),n=l||d,p=e.parentNode,q=/^\s*[+~]/.test(b);l?n=n.replace(/'/g,"\\$&"):e.setAttribute("id",n),q&&p&&(e=e.parentNode);try{if(!q||p)return s(e.querySelectorAll("[id='"+n+"'] "+b),f);}catch(r){}finally{l||k.removeAttribute("id");}}}return a(b,e,f,g);};for(var e in a)m[e]=a[e];b=null;}}(),function(){var a=c.documentElement,b=a.matchesSelector||a.mozMatchesSelector||a.webkitMatchesSelector||a.msMatchesSelector;if(b){var d=!b.call(c.createElement("div"),"div"),e=!1;try{b.call(c.documentElement,"[test!='']:sizzle");}catch(f){e=!0;}m.matchesSelector=function(a,c){c=c.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!m.isXML(a))try{if(e||!o.match.PSEUDO.test(c)&&!/!=/.test(c)){var f=b.call(a,c);if(f||!d||a.document&&a.document.nodeType!==11)return f;}}catch(g){}return m(c,null,null,[a]).length>0;};}}(),function(){var a=c.createElement("div");a.innerHTML="
    ";if(!!a.getElementsByClassName&&a.getElementsByClassName("e").length!==0){a.lastChild.className="e";if(a.getElementsByClassName("e").length===1)return;o.order.splice(1,0,"CLASS"),o.find.CLASS=function(a,b,c){if(typeof b.getElementsByClassName!="undefined"&&!c)return b.getElementsByClassName(a[1]);},a=null;}}(),c.documentElement.contains?m.contains=function(a,b){return a!==b&&(a.contains?a.contains(b):!0);}:c.documentElement.compareDocumentPosition?m.contains=function(a,b){return!!(a.compareDocumentPosition(b)&16);}:m.contains=function(){return!1;},m.isXML=function(a){var b=(a?a.ownerDocument||a:0).documentElement;return b?b.nodeName!=="HTML":!1;};var y=function(a,b,c){var d,e=[],f="",g=b.nodeType?[b]:b;while(d=o.match.PSEUDO.exec(a))f+=d[0],a=a.replace(o.match.PSEUDO,"");a=o.relative[a]?a+"*":a;for(var h=0,i=g.length;h0)for(h=g;h=0:f.filter(a,this).length>0:this.filter(a).length>0);},closest:function(a,b){var c=[],d,e,g=this[0];if(f.isArray(a)){var h=1;while(g&&g.ownerDocument&&g!==b){for(d=0;d-1:f.find.matchesSelector(g,a)){c.push(g);break;}g=g.parentNode;if(!g||!g.ownerDocument||g===b||g.nodeType===11)break;}}c=c.length>1?f.unique(c):c;return this.pushStack(c,"closest",a);},index:function(a){if(!a)return this[0]&&this[0].parentNode?this.prevAll().length:-1;if(typeof a=="string")return f.inArray(this[0],f(a));return f.inArray(a.jquery?a[0]:a,this);},add:function(a,b){var c=typeof a=="string"?f(a,b):f.makeArray(a&&a.nodeType?[a]:a),d=f.merge(this.get(),c);return this.pushStack(S(c[0])||S(d[0])?d:f.unique(d));},andSelf:function(){return this.add(this.prevObject);}}),f.each({parent:function(a){var b=a.parentNode;return b&&b.nodeType!==11?b:null;},parents:function(a){return f.dir(a,"parentNode");},parentsUntil:function(a,b,c){return f.dir(a,"parentNode",c);},next:function(a){return f.nth(a,2,"nextSibling");},prev:function(a){return f.nth(a,2,"previousSibling");},nextAll:function(a){return f.dir(a,"nextSibling");},prevAll:function(a){return f.dir(a,"previousSibling");},nextUntil:function(a,b,c){return f.dir(a,"nextSibling",c);},prevUntil:function(a,b,c){return f.dir(a,"previousSibling",c);},siblings:function(a){return f.sibling(a.parentNode.firstChild,a);},children:function(a){return f.sibling(a.firstChild);},contents:function(a){return f.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:f.makeArray(a.childNodes);}},function(a,b){f.fn[a]=function(c,d){var e=f.map(this,b,c);L.test(a)||(d=c),d&&typeof d=="string"&&(e=f.filter(d,e)),e=this.length>1&&!R[a]?f.unique(e):e,(this.length>1||N.test(d))&&M.test(a)&&(e=e.reverse());return this.pushStack(e,a,P.call(arguments).join(","));};}),f.extend({filter:function(a,b,c){c&&(a=":not("+a+")");return b.length===1?f.find.matchesSelector(b[0],a)?[b[0]]:[]:f.find.matches(a,b);},dir:function(a,c,d){var e=[],g=a[c];while(g&&g.nodeType!==9&&(d===b||g.nodeType!==1||!f(g).is(d)))g.nodeType===1&&e.push(g),g=g[c];return e;},nth:function(a,b,c,d){b=b||1;var e=0;for(;a;a=a[c])if(a.nodeType===1&&++e===b)break;return a;},sibling:function(a,b){var c=[];for(;a;a=a.nextSibling)a.nodeType===1&&a!==b&&c.push(a);return c;}});var V="abbr|article|aside|audio|canvas|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",W=/ jQuery\d+="(?:\d+|null)"/g,X=/^\s+/,Y=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,Z=/<([\w:]+)/,$=/",""],legend:[1,"
    ","
    "],thead:[1,"","
    "],tr:[2,"","
    "],td:[3,"","
    "],col:[2,"","
    "],area:[1,"",""],_default:[0,"",""]},bh=U(c);bg.optgroup=bg.option,bg.tbody=bg.tfoot=bg.colgroup=bg.caption=bg.thead,bg.th=bg.td,f.support.htmlSerialize||(bg._default=[1,"div
    ","
    "]),f.fn.extend({text:function(a){if(f.isFunction(a))return this.each(function(b){var c=f(this);c.text(a.call(this,b,c.text()));});if(typeof a!="object"&&a!==b)return this.empty().append((this[0]&&this[0].ownerDocument||c).createTextNode(a));return f.text(this);},wrapAll:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapAll(a.call(this,b));});if(this[0]){var b=f(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstChild&&a.firstChild.nodeType===1)a=a.firstChild;return a;}).append(this);}return this;},wrapInner:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapInner(a.call(this,b));});return this.each(function(){var b=f(this),c=b.contents();c.length?c.wrapAll(a):b.append(a);});},wrap:function(a){var b=f.isFunction(a);return this.each(function(c){f(this).wrapAll(b?a.call(this,c):a);});},unwrap:function(){return this.parent().each(function(){f.nodeName(this,"body")||f(this).replaceWith(this.childNodes);}).end();},append:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.appendChild(a);});},prepend:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild);});},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this);});if(arguments.length){var a=f.clean(arguments);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments);}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this.nextSibling);});if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,f.clean(arguments));return a;}},remove:function(a,b){for(var c=0,d;(d=this[c])!=null;c++)if(!a||f.filter(a,[d]).length)!b&&d.nodeType===1&&(f.cleanData(d.getElementsByTagName("*")),f.cleanData([d])),d.parentNode&&d.parentNode.removeChild(d);return this;},empty:function() - {for(var a=0,b;(b=this[a])!=null;a++){b.nodeType===1&&f.cleanData(b.getElementsByTagName("*"));while(b.firstChild)b.removeChild(b.firstChild);}return this;},clone:function(a,b){a=a==null?!1:a,b=b==null?a:b;return this.map(function(){return f.clone(this,a,b);});},html:function(a){if(a===b)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(W,""):null;if(typeof a=="string"&&!ba.test(a)&&(f.support.leadingWhitespace||!X.test(a))&&!bg[(Z.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(Y,"<$1>");try{for(var c=0,d=this.length;c1&&l0?this.clone(!0):this).get();f(e[h])[b](j),d=d.concat(j);}return this.pushStack(d,a,e.selector);};}),f.extend({clone:function(a,b,c){var d,e,g,h=f.support.html5Clone||!bc.test("<"+a.nodeName)?a.cloneNode(!0):bo(a);if((!f.support.noCloneEvent||!f.support.noCloneChecked)&&(a.nodeType===1||a.nodeType===11)&&!f.isXMLDoc(a)){bk(a,h),d=bl(a),e=bl(h);for(g=0;d[g];++g)e[g]&&bk(d[g],e[g]);}if(b){bj(a,h);if(c){d=bl(a),e=bl(h);for(g=0;d[g];++g)bj(d[g],e[g]);}}d=e=null;return h;},clean:function(a,b,d,e){var g;b=b||c,typeof b.createElement=="undefined"&&(b=b.ownerDocument||b[0]&&b[0].ownerDocument||c);var h=[],i;for(var j=0,k;(k=a[j])!=null;j++){typeof k=="number"&&(k+="");if(!k)continue;if(typeof k=="string")if(!_.test(k))k=b.createTextNode(k);else{k=k.replace(Y,"<$1>");var l=(Z.exec(k)||["",""])[1].toLowerCase(),m=bg[l]||bg._default,n=m[0],o=b.createElement("div");b===c?bh.appendChild(o):U(b).appendChild(o),o.innerHTML=m[1]+k+m[2];while(n--)o=o.lastChild;if(!f.support.tbody){var p=$.test(k),q=l==="table"&&!p?o.firstChild&&o.firstChild.childNodes:m[1]===""&&!p?o.childNodes:[];for(i=q.length-1;i>=0;--i)f.nodeName(q[i],"tbody")&&!q[i].childNodes.length&&q[i].parentNode.removeChild(q[i]);}!f.support.leadingWhitespace&&X.test(k)&&o.insertBefore(b.createTextNode(X.exec(k)[0]),o.firstChild),k=o.childNodes;}var r;if(!f.support.appendChecked)if(k[0]&&typeof (r=k.length)=="number")for(i=0;i=0)return b+"px";}};}),f.support.opacity||(f.cssHooks.opacity={get:function(a,b){return br.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?parseFloat(RegExp.$1)/100+"":b?"1":"";},set:function(a,b){var c=a.style,d=a.currentStyle,e=f.isNumeric(b)?"alpha(opacity="+b*100+")":"",g=d&&d.filter||c.filter||"";c.zoom=1;if(b>=1&&f.trim(g.replace(bq,""))===""){c.removeAttribute("filter");if(d&&!d.filter)return;}c.filter=bq.test(g)?g.replace(bq,e):g+" "+e;}}),f(function(){f.support.reliableMarginRight||(f.cssHooks.marginRight={get:function(a,b){var c;f.swap(a,{display:"inline-block"},function(){b?c=bz(a,"margin-right","marginRight"):c=a.style.marginRight;});return c;}});}),c.defaultView&&c.defaultView.getComputedStyle&&(bA=function(a,b){var c,d,e;b=b.replace(bs,"-$1").toLowerCase(),(d=a.ownerDocument.defaultView)&&(e=d.getComputedStyle(a,null))&&(c=e.getPropertyValue(b),c===""&&!f.contains(a.ownerDocument.documentElement,a)&&(c=f.style(a,b)));return c;}),c.documentElement.currentStyle&&(bB=function(a,b){var c,d,e,f=a.currentStyle&&a.currentStyle[b],g=a.style;f===null&&g&&(e=g[b])&&(f=e),!bt.test(f)&&bu.test(f)&&(c=g.left,d=a.runtimeStyle&&a.runtimeStyle.left,d&&(a.runtimeStyle.left=a.currentStyle.left),g.left=b==="fontSize"?"1em":f||0,f=g.pixelLeft+"px",g.left=c,d&&(a.runtimeStyle.left=d));return f===""?"auto":f;}),bz=bA||bB,f.expr&&f.expr.filters&&(f.expr.filters.hidden=function(a){var b=a.offsetWidth,c=a.offsetHeight;return b===0&&c===0||!f.support.reliableHiddenOffsets&&(a.style&&a.style.display||f.css(a,"display"))==="none";},f.expr.filters.visible=function(a){return!f.expr.filters.hidden(a);});var bD=/%20/g,bE=/\[\]$/,bF=/\r?\n/g,bG=/#.*$/,bH=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,bI=/^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,bJ=/^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/,bK=/^(?:GET|HEAD)$/,bL=/^\/\//,bM=/\?/,bN=/)<[^<]*)*<\/script>/gi,bO=/^(?:select|textarea)/i,bP=/\s+/,bQ=/([?&])_=[^&]*/,bR=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/,bS=f.fn.load,bT={},bU={},bV,bW,bX=["*/"]+["*"];try{bV=e.href;}catch(bY){bV=c.createElement("a"),bV.href="",bV=bV.href;}bW=bR.exec(bV.toLowerCase())||[],f.fn.extend({load:function(a,c,d){if(typeof a!="string"&&bS)return bS.apply(this,arguments);if(!this.length)return this;var e=a.indexOf(" ");if(e>=0){var g=a.slice(e,a.length);a=a.slice(0,e);}var h="GET";c&&(f.isFunction(c)?(d=c,c=b):typeof c=="object"&&(c=f.param(c,f.ajaxSettings.traditional),h="POST"));var i=this;f.ajax({url:a,type:h,dataType:"html",data:c,complete:function(a,b,c){c=a.responseText,a.isResolved()&&(a.done(function(a){c=a;}),i.html(g?f("
    ").append(c.replace(bN,"")).find(g):c)),d&&i.each(d,[c,b,a]);}});return this;},serialize:function(){return f.param(this.serializeArray());},serializeArray:function(){return this.map(function(){return this.elements?f.makeArray(this.elements):this;}).filter(function(){return this.name&&!this.disabled&&(this.checked||bO.test(this.nodeName)||bI.test(this.type));}).map(function(a,b){var c=f(this).val();return c==null?null:f.isArray(c)?f.map(c,function(a,c){return{name:b.name,value:a.replace(bF,"\r\n")};}):{name:b.name,value:c.replace(bF,"\r\n")};}).get();}}),f.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,b){f.fn[b]=function(a){return this.on(b,a);};}),f.each(["get","post"],function(a,c){f[c]=function(a,d,e,g){f.isFunction(d)&&(g=g||e,e=d,d=b);return f.ajax({type:c,url:a,data:d,success:e,dataType:g});};}),f.extend({getScript:function(a,c){return f.get(a,b,c,"script");},getJSON:function(a,b,c){return f.get(a,b,c,"json");},ajaxSetup:function(a,b){b?b_(a,f.ajaxSettings):(b=a,a=f.ajaxSettings),b_(a,b);return a;},ajaxSettings:{url:bV,isLocal:bJ.test(bW[1]),global:!0,type:"GET",contentType:"application/x-www-form-urlencoded",processData:!0,async:!0,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":bX},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":a.String,"text html":!0,"text json":f.parseJSON,"text xml":f.parseXML},flatOptions:{context:!0,url:!0}},ajaxPrefilter:bZ(bT),ajaxTransport:bZ(bU),ajax:function(a,c){function w(a,c,l,m){if(s!==2){s=2,q&&clearTimeout(q),p=b,n=m||"",v.readyState=a>0?4:0;var o,r,u,w=c,x=l?cb(d,v,l):b,y,z;if(a>=200&&a<300||a===304){if(d.ifModified){if(y=v.getResponseHeader("Last-Modified"))f.lastModified[k]=y;if(z=v.getResponseHeader("Etag"))f.etag[k]=z;}if(a===304)w="notmodified",o=!0;else try{r=cc(d,x),w="success",o=!0;}catch(A){w="parsererror",u=A;}}else{u=w;if(!w||a)w="error",a<0&&(a=0);}v.status=a,v.statusText=""+(c||w),o?h.resolveWith(e,[r,w,v]):h.rejectWith(e,[v,w,u]),v.statusCode(j),j=b,t&&g.trigger("ajax"+(o?"Success":"Error"),[v,d,o?r:u]),i.fireWith(e,[v,w]),t&&(g.trigger("ajaxComplete",[v,d]),--f.active||f.event.trigger("ajaxStop"));}}typeof a=="object"&&(c=a,a=b),c=c||{};var d=f.ajaxSetup({},c),e=d.context||d,g=e!==d&&(e.nodeType||e instanceof f)?f(e):f.event,h=f.Deferred(),i=f.Callbacks("once memory"),j=d.statusCode||{},k,l={},m={},n,o,p,q,r,s=0,t,u,v={readyState:0,setRequestHeader:function(a,b){if(!s){var c=a.toLowerCase();a=m[c]=m[c]||a,l[a]=b;}return this;},getAllResponseHeaders:function(){return s===2?n:null;},getResponseHeader:function(a){var c;if(s===2){if(!o){o={};while(c=bH.exec(n))o[c[1].toLowerCase()]=c[2];}c=o[a.toLowerCase()];}return c===b?null:c;},overrideMimeType:function(a){s||(d.mimeType=a);return this;},abort:function(a){a=a||"abort",p&&p.abort(a),w(0,a);return this;}};h.promise(v),v.success=v.done,v.error=v.fail,v.complete=i.add,v.statusCode=function(a){if(a){var b;if(s<2)for(b in a)j[b]=[j[b],a[b]];else b=a[v.status],v.then(b,b);}return this;},d.url=((a||d.url)+"").replace(bG,"").replace(bL,bW[1]+"//"),d.dataTypes=f.trim(d.dataType||"*").toLowerCase().split(bP),d.crossDomain==null&&(r=bR.exec(d.url.toLowerCase()),d.crossDomain=!(!r||r[1]==bW[1]&&r[2]==bW[2]&&(r[3]||(r[1]==="http:"?80:443))==(bW[3]||(bW[1]==="http:"?80:443)))),d.data&&d.processData&&typeof d.data!="string"&&(d.data=f.param(d.data,d.traditional)),b$(bT,d,c,v);if(s===2)return!1;t=d.global,d.type=d.type.toUpperCase(),d.hasContent=!bK.test(d.type),t&&f.active++===0&&f.event.trigger("ajaxStart");if(!d.hasContent){d.data&&(d.url+=(bM.test(d.url)?"&":"?")+d.data,delete d.data),k=d.url;if(d.cache===!1){var x=f.now(),y=d.url.replace(bQ,"$1_="+x);d.url=y+(y===d.url?(bM.test(d.url)?"&":"?")+"_="+x:"");}}(d.data&&d.hasContent&&d.contentType!==!1||c.contentType)&&v.setRequestHeader("Content-Type",d.contentType),d.ifModified&&(k=k||d.url,f.lastModified[k]&&v.setRequestHeader("If-Modified-Since",f.lastModified[k]),f.etag[k]&&v.setRequestHeader("If-None-Match",f.etag[k])),v.setRequestHeader("Accept",d.dataTypes[0]&&d.accepts[d.dataTypes[0]]?d.accepts[d.dataTypes[0]]+(d.dataTypes[0]!=="*"?", "+bX+"; q=0.01":""):d.accepts["*"]);for(u in d.headers)v.setRequestHeader(u,d.headers[u]);if(d.beforeSend&&(d.beforeSend.call(e,v,d)===!1||s===2)){v.abort();return!1;}for(u in{success:1,error:1,complete:1})v[u](d[u]);p=b$(bU,d,c,v);if(!p)w(-1,"No Transport");else{v.readyState=1,t&&g.trigger("ajaxSend",[v,d]),d.async&&d.timeout>0&&(q=setTimeout(function(){v.abort("timeout");},d.timeout));try{s=1,p.send(l,w);}catch(z){if(s<2)w(-1,z);else throw z;}}return v;},param:function(a,c){var d=[],e=function(a,b){b=f.isFunction(b)?b():b,d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(b);};c===b&&(c=f.ajaxSettings.traditional);if(f.isArray(a)||a.jquery&&!f.isPlainObject(a))f.each(a,function(){e(this.name,this.value);});else for(var g in a)ca(g,a[g],c,e);return d.join("&").replace(bD,"+");}}),f.extend({active:0,lastModified:{},etag:{}});var cd=f.now(),ce=/(\=)\?(&|$)|\?\?/i;f.ajaxSetup({jsonp:"callback",jsonpCallback:function(){return f.expando+"_"+cd++;}}),f.ajaxPrefilter("json jsonp",function(b,c,d){var e=b.contentType==="application/x-www-form-urlencoded"&&typeof b.data=="string";if(b.dataTypes[0]==="jsonp"||b.jsonp!==!1&&(ce.test(b.url)||e&&ce.test(b.data))){var g,h=b.jsonpCallback=f.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,i=a[h],j=b.url,k=b.data,l="$1"+h+"$2";b.jsonp!==!1&&(j=j.replace(ce,l),b.url===j&&(e&&(k=k.replace(ce,l)),b.data===k&&(j+=(/\?/.test(j)?"&":"?")+b.jsonp+"="+h))),b.url=j,b.data=k,a[h]=function(a){g=[a];},d.always(function(){a[h]=i,g&&f.isFunction(i)&&a[h](g[0]);}),b.converters["script json"]=function(){g||f.error(h+" was not called");return g[0];},b.dataTypes[0]="json";return"script";}}),f.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(a){f.globalEval(a);return a;}}}),f.ajaxPrefilter("script",function(a){a.cache===b&&(a.cache=!1),a.crossDomain&&(a.type="GET",a.global=!1);}),f.ajaxTransport("script",function(a){if(a.crossDomain){var d,e=c.head||c.getElementsByTagName("head")[0]||c.documentElement;return{send:function(f,g){d=c.createElement("script"),d.async="async",a.scriptCharset&&(d.charset=a.scriptCharset),d.src=a.url,d.onload=d.onreadystatechange=function(a,c){if(c||!d.readyState||/loaded|complete/.test(d.readyState))d.onload=d.onreadystatechange=null,e&&d.parentNode&&e.removeChild(d),d=b,c||g(200,"success");},e.insertBefore(d,e.firstChild);},abort:function(){d&&d.onload(0,1);}};}});var cf=a.ActiveXObject?function(){for(var a in ch)ch[a](0,1);}:!1,cg=0,ch;f.ajaxSettings.xhr=a.ActiveXObject?function(){return!this.isLocal&&ci()||cj();}:ci,function(a){f.extend(f.support,{ajax:!!a,cors:!!a&&"withCredentials"in a});}(f.ajaxSettings.xhr()),f.support.ajax&&f.ajaxTransport(function(c){if(!c.crossDomain||f.support.cors){var d;return{send:function(e,g){var h=c.xhr(),i,j;c.username?h.open(c.type,c.url,c.async,c.username,c.password):h.open(c.type,c.url,c.async);if(c.xhrFields)for(j in c.xhrFields)h[j]=c.xhrFields[j];c.mimeType&&h.overrideMimeType&&h.overrideMimeType(c.mimeType),!c.crossDomain&&!e["X-Requested-With"]&&(e["X-Requested-With"]="XMLHttpRequest");try{for(j in e)h.setRequestHeader(j,e[j]);}catch(k){}h.send(c.hasContent&&c.data||null),d=function(a,e){var j,k,l,m,n;try{if(d&&(e||h.readyState===4)){d=b,i&&(h.onreadystatechange=f.noop,cf&&delete ch[i]);if(e)h.readyState!==4&&h.abort();else{j=h.status,l=h.getAllResponseHeaders(),m={},n=h.responseXML,n&&n.documentElement&&(m.xml=n),m.text=h.responseText;try{k=h.statusText;}catch(o){k="";}!j&&c.isLocal&&!c.crossDomain?j=m.text?200:404:j===1223&&(j=204);}}}catch(p){e||g(-1,p);}m&&g(j,k,m,l);},!c.async||h.readyState===4?d():(i=++cg,cf&&(ch||(ch={},f(a).unload(cf)),ch[i]=d),h.onreadystatechange=d);},abort:function(){d&&d(0,1);}};}});var ck={},cl,cm,cn=/^(?:toggle|show|hide)$/,co=/^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,cp,cq=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]],cr;f.fn.extend({show:function(a,b,c){var d,e;if(a||a===0)return this.animate(cu("show",3),a,b,c);for(var g=0,h=this.length;g=i.duration+this.startTime){this.now=this.end,this.pos=this.state=1,this.update(),i.animatedProperties[this.prop]=!0;for(b in i.animatedProperties)i.animatedProperties[b]!==!0&&(g=!1);if(g){i.overflow!=null&&!f.support.shrinkWrapBlocks&&f.each(["","X","Y"],function(a,b){h.style["overflow"+b]=i.overflow[a];}),i.hide&&f(h).hide();if(i.hide||i.show)for(b in i.animatedProperties)f.style(h,b,i.orig[b]),f.removeData(h,"fxshow"+b,!0),f.removeData(h,"toggle"+b,!0);d=i.complete,d&&(i.complete=!1,d.call(h));}return!1;}i.duration==Infinity?this.now=e:(c=e-this.startTime,this.state=c/i.duration,this.pos=f.easing[i.animatedProperties[this.prop]](this.state,c,0,1,i.duration),this.now=this.start+(this.end-this.start)*this.pos),this.update();return!0;}},f.extend(f.fx,{tick:function(){var a,b=f.timers,c=0;for(;c-1,k={},l={},m,n;j?(l=e.position(),m=l.top,n=l.left):(m=parseFloat(h)||0,n=parseFloat(i)||0),f.isFunction(b)&&(b=b.call(a,c,g)),b.top!=null&&(k.top=b.top-g.top+m),b.left!=null&&(k.left=b.left-g.left+n),"using"in b?b.using.call(a,k):e.css(k);}},f.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),c=this.offset(),d=cx.test(b[0].nodeName)?{top:0,left:0}:b.offset();c.top-=parseFloat(f.css(a,"marginTop"))||0,c.left-=parseFloat(f.css(a,"marginLeft"))||0,d.top+=parseFloat(f.css(b[0],"borderTopWidth"))||0,d.left+=parseFloat(f.css(b[0],"borderLeftWidth"))||0;return{top:c.top-d.top,left:c.left-d.left};},offsetParent:function(){return this.map(function(){var a=this.offsetParent||c.body;while(a&&!cx.test(a.nodeName)&&f.css(a,"position")==="static")a=a.offsetParent;return a;});}}),f.each(["Left","Top"],function(a,c){var d="scroll"+c;f.fn[d]=function(c){var e,g;if(c===b){e=this[0];if(!e)return null;g=cy(e);return g?"pageXOffset"in g?g[a?"pageYOffset":"pageXOffset"]:f.support.boxModel&&g.document.documentElement[d]||g.document.body[d]:e[d];}return this.each(function(){g=cy(this),g?g.scrollTo(a?f(g).scrollLeft():c,a?c:f(g).scrollTop()):this[d]=c;});};}),f.each(["Height","Width"],function(a,c){var d=c.toLowerCase();f.fn["inner"+c]=function(){var a=this[0];return a?a.style?parseFloat(f.css(a,d,"padding")):this[d]():null;},f.fn["outer"+c]=function(a){var b=this[0];return b?b.style?parseFloat(f.css(b,d,a?"margin":"border")):this[d]():null;},f.fn[d]=function(a){var e=this[0];if(!e)return a==null?null:this;if(f.isFunction(a))return this.each(function(b){var c=f(this);c[d](a.call(this,b,c[d]()));});if(f.isWindow(e)){var g=e.document.documentElement["client"+c],h=e.document.body;return e.document.compatMode==="CSS1Compat"&&g||h&&h["client"+c]||g;}if(e.nodeType===9)return Math.max(e.documentElement["client"+c],e.body["scroll"+c],e.documentElement["scroll"+c],e.body["offset"+c],e.documentElement["offset"+c]);if(a===b){var i=f.css(e,d),j=parseFloat(i);return f.isNumeric(j)?j:i;}return this.css(d,typeof a=="string"?a:a+"px");};}),a.jQuery=a.$=f,typeof define=="function"&&define.amd&&define.amd.jQuery&&define("jquery",[],function(){return f;});})(window); \ No newline at end of file +(function(a,b){function cy(a){return f.isWindow(a)?a:a.nodeType===9?a.defaultView||a.parentWindow:!1;}function cv(a){if(!ck[a]){var b=c.body,d=f('<'+a+'>').appendTo(b),e=d.css('display');d.remove();if(e==='none'||e===''){cl||(cl=c.createElement('iframe'),cl.frameBorder=cl.width=cl.height=0),b.appendChild(cl);if(!cm||!cl.createElement)cm=(cl.contentWindow||cl.contentDocument).document,cm.write((c.compatMode==='CSS1Compat'?'':'')+''),cm.close();d=cm.createElement(a),cm.body.appendChild(d),e=f.css(d,'display'),b.removeChild(cl);}ck[a]=e;}return ck[a];}function cu(a,b){var c={};f.each(cq.concat.apply([],cq.slice(0,b)),function(){c[this]=a;});return c;}function ct(){cr=b;}function cs(){setTimeout(ct,0);return cr=f.now();}function cj(){try{return new a.ActiveXObject('Microsoft.XMLHTTP');}catch(b){}}function ci(){try{return new a.XMLHttpRequest;}catch(b){}}function cc(a,c){a.dataFilter&&(c=a.dataFilter(c,a.dataType));var d=a.dataTypes,e={},g,h,i=d.length,j,k=d[0],l,m,n,o,p;for(g=1;g0){if(c!=='border')for(;g=0===c;});}function S(a){return!a||!a.parentNode||a.parentNode.nodeType===11;}function K(){return!0;}function J(){return!1;}function n(a,b,c){var d=b+'defer',e=b+'queue',g=b+'mark',h=f._data(a,d);h&&(c==='queue'||!f._data(a,e))&&(c==='mark'||!f._data(a,g))&&setTimeout(function(){!f._data(a,e)&&!f._data(a,g)&&(f.removeData(a,d,!0),h.fire());},0);}function m(a){for(var b in a){if(b==='data'&&f.isEmptyObject(a[b]))continue;if(b!=='toJSON')return!1;}return!0;}function l(a,c,d){if(d===b&&a.nodeType===1){var e='data-'+c.replace(k,'-$1').toLowerCase();d=a.getAttribute(e);if(typeof d=='string'){try{d=d==='true'?!0:d==='false'?!1:d==='null'?null:f.isNumeric(d)?parseFloat(d):j.test(d)?f.parseJSON(d):d;}catch(g){}f.data(a,c,d);}else d=b;}return d;}function h(a){var b=g[a]={},c,d;a=a.split(/\s+/);for(c=0,d=a.length;c)[^>]*$|#([\w\-]*)$)/,j=/\S/,k=/^\s+/,l=/\s+$/,m=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,n=/^[\],:{}\s]*$/,o=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,p=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,q=/(?:^|:|,)(?:\s*\[)+/g,r=/(webkit)[ \/]([\w.]+)/,s=/(opera)(?:.*version)?[ \/]([\w.]+)/,t=/(msie) ([\w.]+)/,u=/(mozilla)(?:.*? rv:([\w.]+))?/,v=/-([a-z]|[0-9])/ig,w=/^-ms-/,x=function(a,b){return(b+'').toUpperCase();},y=d.userAgent,z,A,B,C=Object.prototype.toString,D=Object.prototype.hasOwnProperty,E=Array.prototype.push,F=Array.prototype.slice,G=String.prototype.trim,H=Array.prototype.indexOf,I={};e.fn=e.prototype={constructor:e,init:function(a,d,f){var g,h,j,k;if(!a)return this;if(a.nodeType){this.context=this[0]=a,this.length=1;return this;}if(a==='body'&&!d&&c.body){this.context=c,this[0]=c.body,this.selector=a,this.length=1;return this;}if(typeof a=='string'){a.charAt(0)!=='<'||a.charAt(a.length-1)!=='>'||a.length<3?g=i.exec(a):g=[null,a,null];if(g&&(g[1]||!d)){if(g[1]){d=d instanceof e?d[0]:d,k=d?d.ownerDocument||d:c,j=m.exec(a),j?e.isPlainObject(d)?(a=[c.createElement(j[1])],e.fn.attr.call(a,d,!0)):a=[k.createElement(j[1])]:(j=e.buildFragment([g[1]],[k]),a=(j.cacheable?e.clone(j.fragment):j.fragment).childNodes);return e.merge(this,a);}h=c.getElementById(g[2]);if(h&&h.parentNode){if(h.id!==g[2])return f.find(a);this.length=1,this[0]=h;}this.context=c,this.selector=a;return this;}return!d||d.jquery?(d||f).find(a):this.constructor(d).find(a);}if(e.isFunction(a))return f.ready(a);a.selector!==b&&(this.selector=a.selector,this.context=a.context);return e.makeArray(a,this);},selector:'',jquery:'1.7.1',length:0,size:function(){return this.length;},toArray:function(){return F.call(this,0);},get:function(a){return a==null?this.toArray():a<0?this[this.length+a]:this[a];},pushStack:function(a,b,c){var d=this.constructor();e.isArray(a)?E.apply(d,a):e.merge(d,a),d.prevObject=this,d.context=this.context,b==='find'?d.selector=this.selector+(this.selector?' ':'')+c:b&&(d.selector=this.selector+'.'+b+'('+c+')');return d;},each:function(a,b){return e.each(this,a,b);},ready:function(a){e.bindReady(),A.add(a);return this;},eq:function(a){a=+a;return a===-1?this.slice(a):this.slice(a,a+1);},first:function(){return this.eq(0);},last:function(){return this.eq(-1);},slice:function(){return this.pushStack(F.apply(this,arguments),'slice',F.call(arguments).join(','));},map:function(a){return this.pushStack(e.map(this,function(b,c){return a.call(b,c,b);}));},end:function(){return this.prevObject||this.constructor(null);},push:E,sort:[].sort,splice:[].splice},e.fn.init.prototype=e.fn,e.extend=e.fn.extend=function(){var a,c,d,f,g,h,i=arguments[0]||{},j=1,k=arguments.length,l=!1;typeof i=='boolean'&&(l=i,i=arguments[1]||{},j=2),typeof i!='object'&&!e.isFunction(i)&&(i={}),k===j&&(i=this,--j);for(;j0)return;A.fireWith(c,[e]),e.fn.trigger&&e(c).trigger('ready').off('ready');}},bindReady:function(){if(!A){A=e.Callbacks('once memory');if(c.readyState==='complete')return setTimeout(e.ready,1);if(c.addEventListener)c.addEventListener('DOMContentLoaded',B,!1),a.addEventListener('load',e.ready,!1);else if(c.attachEvent){c.attachEvent('onreadystatechange',B),a.attachEvent('onload',e.ready);var b=!1;try{b=a.frameElement==null;}catch(d){}c.documentElement.doScroll&&b&&J();}}},isFunction:function(a){return e.type(a)==='function';},isArray:Array.isArray||function(a){return e.type(a)==='array';},isWindow:function(a){return a&&typeof a=='object'&&'setInterval'in a;},isNumeric:function(a){return!isNaN(parseFloat(a))&&isFinite(a);},type:function(a){return a==null?String(a):I[C.call(a)]||'object';},isPlainObject:function(a){if(!a||e.type(a)!=='object'||a.nodeType||e.isWindow(a))return!1;try{if(a.constructor&&!D.call(a,'constructor')&&!D.call(a.constructor.prototype,'isPrototypeOf'))return!1;}catch(c){return!1;}var d;for(d in a);return d===b||D.call(a,d);},isEmptyObject:function(a){for(var b in a)return!1;return!0;},error:function(a){throw new Error(a);},parseJSON:function(b){if(typeof b!='string'||!b)return null;b=e.trim(b);if(a.JSON&&a.JSON.parse)return a.JSON.parse(b);if(n.test(b.replace(o,'@').replace(p,']').replace(q,'')))return(new Function('return '+b))();e.error('Invalid JSON: '+b);},parseXML:function(c){var d,f;try{a.DOMParser?(f=new DOMParser,d=f.parseFromString(c,'text/xml')):(d=new ActiveXObject('Microsoft.XMLDOM'),d.async='false',d.loadXML(c));}catch(g){d=b;}(!d||!d.documentElement||d.getElementsByTagName('parsererror').length)&&e.error('Invalid XML: '+c);return d;},noop:function(){},globalEval:function(b){b&&j.test(b)&&(a.execScript||function(b){a.eval.call(a,b);})(b);},camelCase:function(a){return a.replace(w,'ms-').replace(v,x);},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase();},each:function(a,c,d){var f,g=0,h=a.length,i=h===b||e.isFunction(a);if(d){if(i){for(f in a)if(c.apply(a[f],d)===!1)break;}else for(;g0&&a[0]&&a[j-1]||j===0||e.isArray(a));if(k)for(;i1?i.call(arguments,0):b,j.notifyWith(k,e);};}function l(a){return function(c){b[a]=arguments.length>1?i.call(arguments,0):c,--g||j.resolveWith(j,b);};}var b=i.call(arguments,0),c=0,d=b.length,e=Array(d),g=d,h=d,j=d<=1&&a&&f.isFunction(a.promise)?a:f.Deferred(),k=j.promise();if(d>1){for(;c
    a',d=q.getElementsByTagName('*'),e=q.getElementsByTagName('a')[0];if(!d||!d.length||!e)return{};g=c.createElement('select'),h=g.appendChild(c.createElement('option')),i=q.getElementsByTagName('input')[0],b={leadingWhitespace:q.firstChild.nodeType===3,tbody:!q.getElementsByTagName('tbody').length,htmlSerialize:!!q.getElementsByTagName('link').length,style:/top/.test(e.getAttribute('style')),hrefNormalized:e.getAttribute('href')==='/a',opacity:/^0.55/.test(e.style.opacity),cssFloat:!!e.style.cssFloat,checkOn:i.value==='on',optSelected:h.selected,getSetAttribute:q.className!=='t',enctype:!!c.createElement('form').enctype,html5Clone:c.createElement('nav').cloneNode(!0).outerHTML!=='<:nav>',submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0},i.checked=!0,b.noCloneChecked=i.cloneNode(!0).checked,g.disabled=!0,b.optDisabled=!h.disabled;try{delete q.test;}catch(s){b.deleteExpando=!1;}!q.addEventListener&&q.attachEvent&&q.fireEvent&&(q.attachEvent('onclick',function(){b.noCloneEvent=!1;}),q.cloneNode(!0).fireEvent('onclick')),i=c.createElement('input'),i.value='t',i.setAttribute('type','radio'),b.radioValue=i.value==='t',i.setAttribute('checked','checked'),q.appendChild(i),k=c.createDocumentFragment(),k.appendChild(q.lastChild),b.checkClone=k.cloneNode(!0).cloneNode(!0).lastChild.checked,b.appendChecked=i.checked,k.removeChild(i),k.appendChild(q),q.innerHTML='',a.getComputedStyle&&(j=c.createElement('div'),j.style.width='0',j.style.marginRight='0',q.style.width='2px',q.appendChild(j),b.reliableMarginRight=(parseInt((a.getComputedStyle(j,null)||{marginRight:0}).marginRight,10)||0)===0);if(q.attachEvent)for(o in{submit:1,change:1,focusin:1})n='on'+o,p=n in q,p||(q.setAttribute(n,'return;'),p=typeof q[n]=='function'),b[o+'Bubbles']=p;k.removeChild(q),k=g=h=j=q=i=null,f(function(){var a,d,e,g,h,i,j,k,m,n,o,r=c.getElementsByTagName('body')[0];!r||(j=1,k='position:absolute;top:0;left:0;width:1px;height:1px;margin:0;',m='visibility:hidden;border:0;',n='style=\''+k+'border:5px solid #000;padding:0;\'',o='
    '+''+'
    ',a=c.createElement('div'),a.style.cssText=m+'width:0;height:0;position:static;top:0;margin-top:'+j+'px',r.insertBefore(a,r.firstChild),q=c.createElement('div'),a.appendChild(q),q.innerHTML='
    t
    ',l=q.getElementsByTagName('td'),p=l[0].offsetHeight===0,l[0].style.display='',l[1].style.display='none',b.reliableHiddenOffsets=p&&l[0].offsetHeight===0,q.innerHTML='',q.style.width=q.style.paddingLeft='1px',f.boxModel=b.boxModel=q.offsetWidth===2,typeof q.style.zoom!='undefined'&&(q.style.display='inline',q.style.zoom=1,b.inlineBlockNeedsLayout=q.offsetWidth===2,q.style.display='',q.innerHTML='
    ',b.shrinkWrapBlocks=q.offsetWidth!==2),q.style.cssText=k+m,q.innerHTML=o,d=q.firstChild,e=d.firstChild,h=d.nextSibling.firstChild.firstChild,i={doesNotAddBorder:e.offsetTop!==5,doesAddBorderForTableAndCells:h.offsetTop===5},e.style.position='fixed',e.style.top='20px',i.fixedPosition=e.offsetTop===20||e.offsetTop===15,e.style.position=e.style.top='',d.style.overflow='hidden',d.style.position='relative',i.subtractsBorderForOverflowNotVisible=e.offsetTop===-5,i.doesNotIncludeMarginInBodyOffset=r.offsetTop!==j,r.removeChild(a),q=a=null,f.extend(b,i));});return b;}();var j=/^(?:\{.*\}|\[.*\])$/,k=/([A-Z])/g;f.extend({cache:{},uuid:0,expando:'jQuery'+(f.fn.jquery+Math.random()).replace(/\D/g,''),noData:{embed:!0,object:'clsid:D27CDB6E-AE6D-11cf-96B8-444553540000',applet:!0},hasData:function(a){a=a.nodeType?f.cache[a[f.expando]]:a[f.expando];return!!a&&!m(a);},data:function(a,c,d,e){if(f.acceptData(a)){var g,h,i,j=f.expando,k=typeof c=='string',l=a.nodeType,m=l?f.cache:a,n=l?a[j]:a[j]&&j,o=c==='events';if((!n||!m[n]||!o&&!e&&!m[n].data)&&k&&d===b)return;n||(l?a[j]=n=++f.uuid:n=j),m[n]||(m[n]={},l||(m[n].toJSON=f.noop));if(typeof c=='object'||typeof c=='function')e?m[n]=f.extend(m[n],c):m[n].data=f.extend(m[n].data,c);g=h=m[n],e||(h.data||(h.data={}),h=h.data),d!==b&&(h[f.camelCase(c)]=d);if(o&&!h[c])return g.events;k?(i=h[c],i==null&&(i=h[f.camelCase(c)])):i=h;return i;}},removeData:function(a,b,c){if(f.acceptData(a)){var d,e,g,h=f.expando,i=a.nodeType,j=i?f.cache:a,k=i?a[h]:h;if(!j[k])return;if(b){d=c?j[k]:j[k].data;if(d){f.isArray(b)||(b in d?b=[b]:(b=f.camelCase(b),b in d?b=[b]:b=b.split(' ')));for(e=0,g=b.length;e-1)return!0;return!1;},val:function(a){var c,d,e,g=this[0];{if(arguments.length){e=f.isFunction(a);return this.each(function(d){var g=f(this),h;if(this.nodeType===1){e?h=a.call(this,d,g.val()):h=a,h==null?h='':typeof h=='number'?h+='':f.isArray(h)&&(h=f.map(h,function(a){return a==null?'':a+'';})),c=f.valHooks[this.nodeName.toLowerCase()]||f.valHooks[this.type];if(!c||!('set'in c)||c.set(this,h,'value')===b)this.value=h;}});}if(g){c=f.valHooks[g.nodeName.toLowerCase()]||f.valHooks[g.type];if(c&&'get'in c&&(d=c.get(g,'value'))!==b)return d;d=g.value;return typeof d=='string'?d.replace(q,''):d==null?'':d;}}}}),f.extend({valHooks:{option:{get:function(a){var b=a.attributes.value;return!b||b.specified?a.value:a.text;}},select:{get:function(a){var b,c,d,e,g=a.selectedIndex,h=[],i=a.options,j=a.type==='select-one';if(g<0)return null;c=j?g:0,d=j?g+1:i.length;for(;c=0;}),c.length||(a.selectedIndex=-1);return c;}}},attrFn:{val:!0,css:!0,html:!0,text:!0,data:!0,width:!0,height:!0,offset:!0},attr:function(a,c,d,e){var g,h,i,j=a.nodeType;if(!!a&&j!==3&&j!==8&&j!==2){if(e&&c in f.attrFn)return f(a)[c](d);if(typeof a.getAttribute=='undefined')return f.prop(a,c,d);i=j!==1||!f.isXMLDoc(a),i&&(c=c.toLowerCase(),h=f.attrHooks[c]||(u.test(c)?x:w));if(d!==b){if(d===null){f.removeAttr(a,c);return;}if(h&&'set'in h&&i&&(g=h.set(a,d,c))!==b)return g;a.setAttribute(c,''+d);return d;}if(h&&'get'in h&&i&&(g=h.get(a,c))!==null)return g;g=a.getAttribute(c);return g===null?b:g;}},removeAttr:function(a,b){var c,d,e,g,h=0;if(b&&a.nodeType===1){d=b.toLowerCase().split(p),g=d.length;for(;h=0;}});});var z=/^(?:textarea|input|select)$/i,A=/^([^\.]*)?(?:\.(.+))?$/,B=/\bhover(\.\S+)?\b/,C=/^key/,D=/^(?:mouse|contextmenu)|click/,E=/^(?:focusinfocus|focusoutblur)$/,F=/^(\w*)(?:#([\w\-]+))?(?:\.([\w\-]+))?$/,G=function(a){var b=F.exec(a);b&&(b[1]=(b[1]||'').toLowerCase(),b[3]=b[3]&&new RegExp('(?:^|\\s)'+b[3]+'(?:\\s|$)'));return b;},H=function(a,b){var c=a.attributes||{};return(!b[1]||a.nodeName.toLowerCase()===b[1])&&(!b[2]||(c.id||{}).value===b[2])&&(!b[3]||b[3].test((c['class']||{}).value));},I=function(a){return f.event.special.hover?a:a.replace(B,'mouseenter$1 mouseleave$1');}; + f.event={add:function(a,c,d,e,g){var h,i,j,k,l,m,n,o,p,q,r,s;if(!(a.nodeType===3||a.nodeType===8||!c||!d||!(h=f._data(a)))){d.handler&&(p=d,d=p.handler),d.guid||(d.guid=f.guid++),j=h.events,j||(h.events=j={}),i=h.handle,i||(h.handle=i=function(a){return typeof f!='undefined'&&(!a||f.event.triggered!==a.type)?f.event.dispatch.apply(i.elem,arguments):b;},i.elem=a),c=f.trim(I(c)).split(' ');for(k=0;k=0&&(h=h.slice(0,-1),k=!0),h.indexOf('.')>=0&&(i=h.split('.'),h=i.shift(),i.sort());if((!e||f.event.customEvent[h])&&!f.event.global[h])return;c=typeof c=='object'?c[f.expando]?c:new f.Event(h,c):new f.Event(h),c.type=h,c.isTrigger=!0,c.exclusive=k,c.namespace=i.join('.'),c.namespace_re=c.namespace?new RegExp('(^|\\.)'+i.join('\\.(?:.*\\.)?')+'(\\.|$)'):null,o=h.indexOf(':')<0?'on'+h:'';if(!e){j=f.cache;for(l in j)j[l].events&&j[l].events[h]&&f.event.trigger(c,d,j[l].handle.elem,!0);return;}c.result=b,c.target||(c.target=e),d=d!=null?f.makeArray(d):[],d.unshift(c),p=f.event.special[h]||{};if(p.trigger&&p.trigger.apply(e,d)===!1)return;r=[[e,p.bindType||h]];if(!g&&!p.noBubble&&!f.isWindow(e)){s=p.delegateType||h,m=E.test(s+h)?e:e.parentNode,n=null;for(;m;m=m.parentNode)r.push([m,s]),n=m;n&&n===e.ownerDocument&&r.push([n.defaultView||n.parentWindow||a,s]);}for(l=0;le&&i.push({elem:this,matches:d.slice(e)});for(j=0;j0?this.on(b,null,a,c):this.trigger(b);},f.attrFn&&(f.attrFn[b]=!0),C.test(b)&&(f.event.fixHooks[b]=f.event.keyHooks),D.test(b)&&(f.event.fixHooks[b]=f.event.mouseHooks);}),function(){function x(a,b,c,e,f,g){for(var h=0,i=e.length;h0){k=j;break;}}j=j[a];}e[h]=k;}}}function w(a,b,c,e,f,g){for(var h=0,i=e.length;h+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,d='sizcache'+(Math.random()+'').replace('.',''),e=0,g=Object.prototype.toString,h=!1,i=!0,j=/\\/g,k=/\r\n/g,l=/\W/;[0,0].sort(function(){i=!1;return 0;});var m=function(b,d,e,f){e=e||[],d=d||c;var h=d;if(d.nodeType!==1&&d.nodeType!==9)return[];if(!b||typeof b!='string')return e;var i,j,k,l,n,q,r,t,u=!0,v=m.isXML(d),w=[],x=b;do{a.exec(''),i=a.exec(x);if(i){x=i[3],w.push(i[1]);if(i[2]){l=i[3];break;}}}while(i);if(w.length>1&&p.exec(b))if(w.length===2&&o.relative[w[0]])j=y(w[0]+w[1],d,f);else{j=o.relative[w[0]]?[d]:m(w.shift(),d);while(w.length)b=w.shift(),o.relative[b]&&(b+=w.shift()),j=y(b,j,f);}else{!f&&w.length>1&&d.nodeType===9&&!v&&o.match.ID.test(w[0])&&!o.match.ID.test(w[w.length-1])&&(n=m.find(w.shift(),d,v),d=n.expr?m.filter(n.expr,n.set)[0]:n.set[0]);if(d){n=f?{expr:w.pop(),set:s(f)}:m.find(w.pop(),w.length===1&&(w[0]==='~'||w[0]==='+')&&d.parentNode?d.parentNode:d,v),j=n.expr?m.filter(n.expr,n.set):n.set,w.length>0?k=s(j):u=!1;while(w.length)q=w.pop(),r=q,o.relative[q]?r=w.pop():q='',r==null&&(r=d),o.relative[q](k,r,v);}else k=w=[];}k||(k=j),k||m.error(q||b);if(g.call(k)==='[object Array]')if(!u)e.push.apply(e,k);else if(d&&d.nodeType===1)for(t=0;k[t]!=null;t++)k[t]&&(k[t]===!0||k[t].nodeType===1&&m.contains(d,k[t]))&&e.push(j[t]);else for(t=0;k[t]!=null;t++)k[t]&&k[t].nodeType===1&&e.push(j[t]);else s(k,e);l&&(m(l,h,e,f),m.uniqueSort(e));return e;};m.uniqueSort=function(a){if(u){h=i,a.sort(u);if(h)for(var b=1;b0;},m.find=function(a,b,c){var d,e,f,g,h,i;if(!a)return[];for(e=0,f=o.order.length;e':function(a,b){var c,d=typeof b=='string',e=0,f=a.length;if(d&&!l.test(b)){b=b.toLowerCase();for(;e=0)?c||d.push(h):c&&(b[g]=!1));return!1;},ID:function(a){return a[1].replace(j,'');},TAG:function(a,b){return a[1].replace(j,'').toLowerCase();},CHILD:function(a){if(a[1]==='nth'){a[2]||m.error(a[0]),a[2]=a[2].replace(/^\+|\s*/g,'');var b=/(-?)(\d*)(?:n([+\-]?\d*))?/.exec(a[2]==='even'&&'2n'||a[2]==='odd'&&'2n+1'||!/\D/.test(a[2])&&'0n+'+a[2]||a[2]);a[2]=b[1]+(b[2]||1)-0,a[3]=b[3]-0;}else a[2]&&m.error(a[0]);a[0]=e++;return a;},ATTR:function(a,b,c,d,e,f){var g=a[1]=a[1].replace(j,'');!f&&o.attrMap[g]&&(a[1]=o.attrMap[g]),a[4]=(a[4]||a[5]||'').replace(j,''),a[2]==='~='&&(a[4]=' '+a[4]+' ');return a;},PSEUDO:function(b,c,d,e,f){if(b[1]==='not')if((a.exec(b[3])||'').length>1||/^\w/.test(b[3]))b[3]=m(b[3],null,null,c);else{var g=m.filter(b[3],c,d,!0^f);d||e.push.apply(e,g);return!1;}else if(o.match.POS.test(b[0])||o.match.CHILD.test(b[0]))return!0;return b;},POS:function(a){a.unshift(!0);return a;}},filters:{enabled:function(a){return a.disabled===!1&&a.type!=='hidden';},disabled:function(a){return a.disabled===!0;},checked:function(a){return a.checked===!0;},selected:function(a){a.parentNode&&a.parentNode.selectedIndex;return a.selected===!0;},parent:function(a){return!!a.firstChild;},empty:function(a){return!a.firstChild;},has:function(a,b,c){return!!m(c[3],a).length;},header:function(a){return/h\d/i.test(a.nodeName);},text:function(a){var b=a.getAttribute('type'),c=a.type;return a.nodeName.toLowerCase()==='input'&&'text'===c&&(b===c||b===null);},radio:function(a){return a.nodeName.toLowerCase()==='input'&&'radio'===a.type;},checkbox:function(a){return a.nodeName.toLowerCase()==='input'&&'checkbox'===a.type;},file:function(a){return a.nodeName.toLowerCase()==='input'&&'file'===a.type;},password:function(a){return a.nodeName.toLowerCase()==='input'&&'password'===a.type;},submit:function(a){var b=a.nodeName.toLowerCase();return(b==='input'||b==='button')&&'submit'===a.type;},image:function(a){return a.nodeName.toLowerCase()==='input'&&'image'===a.type;},reset:function(a){var b=a.nodeName.toLowerCase();return(b==='input'||b==='button')&&'reset'===a.type;},button:function(a){var b=a.nodeName.toLowerCase();return b==='input'&&'button'===a.type||b==='button';},input:function(a){return/input|select|textarea|button/i.test(a.nodeName);},focus:function(a){return a===a.ownerDocument.activeElement;}},setFilters:{first:function(a,b){return b===0;},last:function(a,b,c,d){return b===d.length-1;},even:function(a,b){return b%2===0;},odd:function(a,b){return b%2===1;},lt:function(a,b,c){return bc[3]-0;},nth:function(a,b,c){return c[3]-0===b;},eq:function(a,b,c){return c[3]-0===b;}},filter:{PSEUDO:function(a,b,c,d){var e=b[1],f=o.filters[e];if(f)return f(a,c,b,d);if(e==='contains')return(a.textContent||a.innerText||n([a])||'').indexOf(b[3])>=0;if(e==='not'){var g=b[3];for(var h=0,i=g.length;h=0;}},ID:function(a,b){return a.nodeType===1&&a.getAttribute('id')===b;},TAG:function(a,b){return b==='*'&&a.nodeType===1||!!a.nodeName&&a.nodeName.toLowerCase()===b;},CLASS:function(a,b){return(' '+(a.className||a.getAttribute('class'))+' ').indexOf(b)>-1;},ATTR:function(a,b){var c=b[1],d=m.attr?m.attr(a,c):o.attrHandle[c]?o.attrHandle[c](a):a[c]!=null?a[c]:a.getAttribute(c),e=d+'',f=b[2],g=b[4];return d==null?f==='!=':!f&&m.attr?d!=null:f==='='?e===g:f==='*='?e.indexOf(g)>=0:f==='~='?(' '+e+' ').indexOf(g)>=0:g?f==='!='?e!==g:f==='^='?e.indexOf(g)===0:f==='$='?e.substr(e.length-g.length)===g:f==='|='?e===g||e.substr(0,g.length+1)===g+'-':!1:e&&d!==!1;},POS:function(a,b,c,d){var e=b[2],f=o.setFilters[e];if(f)return f(a,c,b,d);}}},p=o.match.POS,q=function(a,b){return'\\'+(b-0+1);};for(var r in o.match)o.match[r]=new RegExp(o.match[r].source+/(?![^\[]*\])(?![^\(]*\))/.source),o.leftMatch[r]=new RegExp(/(^(?:.|\r|\n)*?)/.source+o.match[r].source.replace(/\\(\d+)/g,q));var s=function(a,b){a=Array.prototype.slice.call(a,0);if(b){b.push.apply(b,a);return b;}return a;};try{Array.prototype.slice.call(c.documentElement.childNodes,0)[0].nodeType;}catch(t){s=function(a,b){var c=0,d=b||[];if(g.call(a)==='[object Array]')Array.prototype.push.apply(d,a);else if(typeof a.length=='number')for(var e=a.length;c',e.insertBefore(a,e.firstChild),c.getElementById(d)&&(o.find.ID=function(a,c,d){if(typeof c.getElementById!='undefined'&&!d){var e=c.getElementById(a[1]);return e?e.id===a[1]||typeof e.getAttributeNode!='undefined'&&e.getAttributeNode('id').nodeValue===a[1]?[e]:b:[];}},o.filter.ID=function(a,b){var c=typeof a.getAttributeNode!='undefined'&&a.getAttributeNode('id');return a.nodeType===1&&c&&c.nodeValue===b;}),e.removeChild(a),e=a=null;}(),function(){var a=c.createElement('div');a.appendChild(c.createComment('')),a.getElementsByTagName('*').length>0&&(o.find.TAG=function(a,b){var c=b.getElementsByTagName(a[1]);if(a[1]==='*'){var d=[];for(var e=0;c[e];e++)c[e].nodeType===1&&d.push(c[e]);c=d;}return c;}),a.innerHTML='',a.firstChild&&typeof a.firstChild.getAttribute!='undefined'&&a.firstChild.getAttribute('href')!=='#'&&(o.attrHandle.href=function(a){return a.getAttribute('href',2);}),a=null;}(),c.querySelectorAll&&function(){var a=m,b=c.createElement('div'),d='__sizzle__';b.innerHTML='

    ';if(!b.querySelectorAll||b.querySelectorAll('.TEST').length!==0){m=function(b,e,f,g){e=e||c;if(!g&&!m.isXML(e)){var h=/^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec(b);if(h&&(e.nodeType===1||e.nodeType===9)){if(h[1])return s(e.getElementsByTagName(b),f);if(h[2]&&o.find.CLASS&&e.getElementsByClassName)return s(e.getElementsByClassName(h[2]),f);}if(e.nodeType===9){if(b==='body'&&e.body)return s([e.body],f);if(h&&h[3]){var i=e.getElementById(h[3]);if(!i||!i.parentNode)return s([],f);if(i.id===h[3])return s([i],f);}try{return s(e.querySelectorAll(b),f);}catch(j){}}else if(e.nodeType===1&&e.nodeName.toLowerCase()!=='object'){var k=e,l=e.getAttribute('id'),n=l||d,p=e.parentNode,q=/^\s*[+~]/.test(b);l?n=n.replace(/'/g,'\\$&'):e.setAttribute('id',n),q&&p&&(e=e.parentNode);try{if(!q||p)return s(e.querySelectorAll('[id=\''+n+'\'] '+b),f);}catch(r){}finally{l||k.removeAttribute('id');}}}return a(b,e,f,g);};for(var e in a)m[e]=a[e];b=null;}}(),function(){var a=c.documentElement,b=a.matchesSelector||a.mozMatchesSelector||a.webkitMatchesSelector||a.msMatchesSelector;if(b){var d=!b.call(c.createElement('div'),'div'),e=!1;try{b.call(c.documentElement,'[test!=\'\']:sizzle');}catch(f){e=!0;}m.matchesSelector=function(a,c){c=c.replace(/\=\s*([^'"\]]*)\s*\]/g,'=\'$1\']');if(!m.isXML(a))try{if(e||!o.match.PSEUDO.test(c)&&!/!=/.test(c)){var f=b.call(a,c);if(f||!d||a.document&&a.document.nodeType!==11)return f;}}catch(g){}return m(c,null,null,[a]).length>0;};}}(),function(){var a=c.createElement('div');a.innerHTML='
    ';if(!!a.getElementsByClassName&&a.getElementsByClassName('e').length!==0){a.lastChild.className='e';if(a.getElementsByClassName('e').length===1)return;o.order.splice(1,0,'CLASS'),o.find.CLASS=function(a,b,c){if(typeof b.getElementsByClassName!='undefined'&&!c)return b.getElementsByClassName(a[1]);},a=null;}}(),c.documentElement.contains?m.contains=function(a,b){return a!==b&&(a.contains?a.contains(b):!0);}:c.documentElement.compareDocumentPosition?m.contains=function(a,b){return!!(a.compareDocumentPosition(b)&16);}:m.contains=function(){return!1;},m.isXML=function(a){var b=(a?a.ownerDocument||a:0).documentElement;return b?b.nodeName!=='HTML':!1;};var y=function(a,b,c){var d,e=[],f='',g=b.nodeType?[b]:b;while(d=o.match.PSEUDO.exec(a))f+=d[0],a=a.replace(o.match.PSEUDO,'');a=o.relative[a]?a+'*':a;for(var h=0,i=g.length;h0)for(h=g;h=0:f.filter(a,this).length>0:this.filter(a).length>0);},closest:function(a,b){var c=[],d,e,g=this[0];if(f.isArray(a)){var h=1;while(g&&g.ownerDocument&&g!==b){for(d=0;d-1:f.find.matchesSelector(g,a)){c.push(g);break;}g=g.parentNode;if(!g||!g.ownerDocument||g===b||g.nodeType===11)break;}}c=c.length>1?f.unique(c):c;return this.pushStack(c,'closest',a);},index:function(a){if(!a)return this[0]&&this[0].parentNode?this.prevAll().length:-1;if(typeof a=='string')return f.inArray(this[0],f(a));return f.inArray(a.jquery?a[0]:a,this);},add:function(a,b){var c=typeof a=='string'?f(a,b):f.makeArray(a&&a.nodeType?[a]:a),d=f.merge(this.get(),c);return this.pushStack(S(c[0])||S(d[0])?d:f.unique(d));},andSelf:function(){return this.add(this.prevObject);}}),f.each({parent:function(a){var b=a.parentNode;return b&&b.nodeType!==11?b:null;},parents:function(a){return f.dir(a,'parentNode');},parentsUntil:function(a,b,c){return f.dir(a,'parentNode',c);},next:function(a){return f.nth(a,2,'nextSibling');},prev:function(a){return f.nth(a,2,'previousSibling');},nextAll:function(a){return f.dir(a,'nextSibling');},prevAll:function(a){return f.dir(a,'previousSibling');},nextUntil:function(a,b,c){return f.dir(a,'nextSibling',c);},prevUntil:function(a,b,c){return f.dir(a,'previousSibling',c);},siblings:function(a){return f.sibling(a.parentNode.firstChild,a);},children:function(a){return f.sibling(a.firstChild);},contents:function(a){return f.nodeName(a,'iframe')?a.contentDocument||a.contentWindow.document:f.makeArray(a.childNodes);}},function(a,b){f.fn[a]=function(c,d){var e=f.map(this,b,c);L.test(a)||(d=c),d&&typeof d=='string'&&(e=f.filter(d,e)),e=this.length>1&&!R[a]?f.unique(e):e,(this.length>1||N.test(d))&&M.test(a)&&(e=e.reverse());return this.pushStack(e,a,P.call(arguments).join(','));};}),f.extend({filter:function(a,b,c){c&&(a=':not('+a+')');return b.length===1?f.find.matchesSelector(b[0],a)?[b[0]]:[]:f.find.matches(a,b);},dir:function(a,c,d){var e=[],g=a[c];while(g&&g.nodeType!==9&&(d===b||g.nodeType!==1||!f(g).is(d)))g.nodeType===1&&e.push(g),g=g[c];return e;},nth:function(a,b,c,d){b=b||1;var e=0;for(;a;a=a[c])if(a.nodeType===1&&++e===b)break;return a;},sibling:function(a,b){var c=[];for(;a;a=a.nextSibling)a.nodeType===1&&a!==b&&c.push(a);return c;}});var V='abbr|article|aside|audio|canvas|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video',W=/ jQuery\d+="(?:\d+|null)"/g,X=/^\s+/,Y=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,Z=/<([\w:]+)/,$=/',''],legend:[1,'
    ','
    '],thead:[1,'','
    '],tr:[2,'','
    '],td:[3,'','
    '],col:[2,'','
    '],area:[1,'',''],_default:[0,'','']},bh=U(c);bg.optgroup=bg.option,bg.tbody=bg.tfoot=bg.colgroup=bg.caption=bg.thead,bg.th=bg.td,f.support.htmlSerialize||(bg._default=[1,'div
    ','
    ']),f.fn.extend({text:function(a){if(f.isFunction(a))return this.each(function(b){var c=f(this);c.text(a.call(this,b,c.text()));});if(typeof a!='object'&&a!==b)return this.empty().append((this[0]&&this[0].ownerDocument||c).createTextNode(a));return f.text(this);},wrapAll:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapAll(a.call(this,b));});if(this[0]){var b=f(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstChild&&a.firstChild.nodeType===1)a=a.firstChild;return a;}).append(this);}return this;},wrapInner:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapInner(a.call(this,b));});return this.each(function(){var b=f(this),c=b.contents();c.length?c.wrapAll(a):b.append(a);});},wrap:function(a){var b=f.isFunction(a);return this.each(function(c){f(this).wrapAll(b?a.call(this,c):a);});},unwrap:function(){return this.parent().each(function(){f.nodeName(this,'body')||f(this).replaceWith(this.childNodes);}).end();},append:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.appendChild(a);});},prepend:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild);});},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this);});if(arguments.length){var a=f.clean(arguments);a.push.apply(a,this.toArray());return this.pushStack(a,'before',arguments);}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this.nextSibling);});if(arguments.length){var a=this.pushStack(this,'after',arguments);a.push.apply(a,f.clean(arguments));return a;}},remove:function(a,b){for(var c=0,d;(d=this[c])!=null;c++)if(!a||f.filter(a,[d]).length)!b&&d.nodeType===1&&(f.cleanData(d.getElementsByTagName('*')),f.cleanData([d])),d.parentNode&&d.parentNode.removeChild(d);return this;},empty:function() + {for(var a=0,b;(b=this[a])!=null;a++){b.nodeType===1&&f.cleanData(b.getElementsByTagName('*'));while(b.firstChild)b.removeChild(b.firstChild);}return this;},clone:function(a,b){a=a==null?!1:a,b=b==null?a:b;return this.map(function(){return f.clone(this,a,b);});},html:function(a){if(a===b)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(W,''):null;if(typeof a=='string'&&!ba.test(a)&&(f.support.leadingWhitespace||!X.test(a))&&!bg[(Z.exec(a)||['',''])[1].toLowerCase()]){a=a.replace(Y,'<$1>');try{for(var c=0,d=this.length;c1&&l0?this.clone(!0):this).get();f(e[h])[b](j),d=d.concat(j);}return this.pushStack(d,a,e.selector);};}),f.extend({clone:function(a,b,c){var d,e,g,h=f.support.html5Clone||!bc.test('<'+a.nodeName)?a.cloneNode(!0):bo(a);if((!f.support.noCloneEvent||!f.support.noCloneChecked)&&(a.nodeType===1||a.nodeType===11)&&!f.isXMLDoc(a)){bk(a,h),d=bl(a),e=bl(h);for(g=0;d[g];++g)e[g]&&bk(d[g],e[g]);}if(b){bj(a,h);if(c){d=bl(a),e=bl(h);for(g=0;d[g];++g)bj(d[g],e[g]);}}d=e=null;return h;},clean:function(a,b,d,e){var g;b=b||c,typeof b.createElement=='undefined'&&(b=b.ownerDocument||b[0]&&b[0].ownerDocument||c);var h=[],i;for(var j=0,k;(k=a[j])!=null;j++){typeof k=='number'&&(k+='');if(!k)continue;if(typeof k=='string')if(!_.test(k))k=b.createTextNode(k);else{k=k.replace(Y,'<$1>');var l=(Z.exec(k)||['',''])[1].toLowerCase(),m=bg[l]||bg._default,n=m[0],o=b.createElement('div');b===c?bh.appendChild(o):U(b).appendChild(o),o.innerHTML=m[1]+k+m[2];while(n--)o=o.lastChild;if(!f.support.tbody){var p=$.test(k),q=l==='table'&&!p?o.firstChild&&o.firstChild.childNodes:m[1]===''&&!p?o.childNodes:[];for(i=q.length-1;i>=0;--i)f.nodeName(q[i],'tbody')&&!q[i].childNodes.length&&q[i].parentNode.removeChild(q[i]);}!f.support.leadingWhitespace&&X.test(k)&&o.insertBefore(b.createTextNode(X.exec(k)[0]),o.firstChild),k=o.childNodes;}var r;if(!f.support.appendChecked)if(k[0]&&typeof (r=k.length)=='number')for(i=0;i=0)return b+'px';}};}),f.support.opacity||(f.cssHooks.opacity={get:function(a,b){return br.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||'')?parseFloat(RegExp.$1)/100+'':b?'1':'';},set:function(a,b){var c=a.style,d=a.currentStyle,e=f.isNumeric(b)?'alpha(opacity='+b*100+')':'',g=d&&d.filter||c.filter||'';c.zoom=1;if(b>=1&&f.trim(g.replace(bq,''))===''){c.removeAttribute('filter');if(d&&!d.filter)return;}c.filter=bq.test(g)?g.replace(bq,e):g+' '+e;}}),f(function(){f.support.reliableMarginRight||(f.cssHooks.marginRight={get:function(a,b){var c;f.swap(a,{display:'inline-block'},function(){b?c=bz(a,'margin-right','marginRight'):c=a.style.marginRight;});return c;}});}),c.defaultView&&c.defaultView.getComputedStyle&&(bA=function(a,b){var c,d,e;b=b.replace(bs,'-$1').toLowerCase(),(d=a.ownerDocument.defaultView)&&(e=d.getComputedStyle(a,null))&&(c=e.getPropertyValue(b),c===''&&!f.contains(a.ownerDocument.documentElement,a)&&(c=f.style(a,b)));return c;}),c.documentElement.currentStyle&&(bB=function(a,b){var c,d,e,f=a.currentStyle&&a.currentStyle[b],g=a.style;f===null&&g&&(e=g[b])&&(f=e),!bt.test(f)&&bu.test(f)&&(c=g.left,d=a.runtimeStyle&&a.runtimeStyle.left,d&&(a.runtimeStyle.left=a.currentStyle.left),g.left=b==='fontSize'?'1em':f||0,f=g.pixelLeft+'px',g.left=c,d&&(a.runtimeStyle.left=d));return f===''?'auto':f;}),bz=bA||bB,f.expr&&f.expr.filters&&(f.expr.filters.hidden=function(a){var b=a.offsetWidth,c=a.offsetHeight;return b===0&&c===0||!f.support.reliableHiddenOffsets&&(a.style&&a.style.display||f.css(a,'display'))==='none';},f.expr.filters.visible=function(a){return!f.expr.filters.hidden(a);});var bD=/%20/g,bE=/\[\]$/,bF=/\r?\n/g,bG=/#.*$/,bH=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,bI=/^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,bJ=/^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/,bK=/^(?:GET|HEAD)$/,bL=/^\/\//,bM=/\?/,bN=/)<[^<]*)*<\/script>/gi,bO=/^(?:select|textarea)/i,bP=/\s+/,bQ=/([?&])_=[^&]*/,bR=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/,bS=f.fn.load,bT={},bU={},bV,bW,bX=['*/']+['*'];try{bV=e.href;}catch(bY){bV=c.createElement('a'),bV.href='',bV=bV.href;}bW=bR.exec(bV.toLowerCase())||[],f.fn.extend({load:function(a,c,d){if(typeof a!='string'&&bS)return bS.apply(this,arguments);if(!this.length)return this;var e=a.indexOf(' ');if(e>=0){var g=a.slice(e,a.length);a=a.slice(0,e);}var h='GET';c&&(f.isFunction(c)?(d=c,c=b):typeof c=='object'&&(c=f.param(c,f.ajaxSettings.traditional),h='POST'));var i=this;f.ajax({url:a,type:h,dataType:'html',data:c,complete:function(a,b,c){c=a.responseText,a.isResolved()&&(a.done(function(a){c=a;}),i.html(g?f('
    ').append(c.replace(bN,'')).find(g):c)),d&&i.each(d,[c,b,a]);}});return this;},serialize:function(){return f.param(this.serializeArray());},serializeArray:function(){return this.map(function(){return this.elements?f.makeArray(this.elements):this;}).filter(function(){return this.name&&!this.disabled&&(this.checked||bO.test(this.nodeName)||bI.test(this.type));}).map(function(a,b){var c=f(this).val();return c==null?null:f.isArray(c)?f.map(c,function(a,c){return{name:b.name,value:a.replace(bF,'\r\n')};}):{name:b.name,value:c.replace(bF,'\r\n')};}).get();}}),f.each('ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend'.split(' '),function(a,b){f.fn[b]=function(a){return this.on(b,a);};}),f.each(['get','post'],function(a,c){f[c]=function(a,d,e,g){f.isFunction(d)&&(g=g||e,e=d,d=b);return f.ajax({type:c,url:a,data:d,success:e,dataType:g});};}),f.extend({getScript:function(a,c){return f.get(a,b,c,'script');},getJSON:function(a,b,c){return f.get(a,b,c,'json');},ajaxSetup:function(a,b){b?b_(a,f.ajaxSettings):(b=a,a=f.ajaxSettings),b_(a,b);return a;},ajaxSettings:{url:bV,isLocal:bJ.test(bW[1]),global:!0,type:'GET',contentType:'application/x-www-form-urlencoded',processData:!0,async:!0,accepts:{xml:'application/xml, text/xml',html:'text/html',text:'text/plain',json:'application/json, text/javascript','*':bX},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:'responseXML',text:'responseText'},converters:{'* text':a.String,'text html':!0,'text json':f.parseJSON,'text xml':f.parseXML},flatOptions:{context:!0,url:!0}},ajaxPrefilter:bZ(bT),ajaxTransport:bZ(bU),ajax:function(a,c){function w(a,c,l,m){if(s!==2){s=2,q&&clearTimeout(q),p=b,n=m||'',v.readyState=a>0?4:0;var o,r,u,w=c,x=l?cb(d,v,l):b,y,z;if(a>=200&&a<300||a===304){if(d.ifModified){if(y=v.getResponseHeader('Last-Modified'))f.lastModified[k]=y;if(z=v.getResponseHeader('Etag'))f.etag[k]=z;}if(a===304)w='notmodified',o=!0;else try{r=cc(d,x),w='success',o=!0;}catch(A){w='parsererror',u=A;}}else{u=w;if(!w||a)w='error',a<0&&(a=0);}v.status=a,v.statusText=''+(c||w),o?h.resolveWith(e,[r,w,v]):h.rejectWith(e,[v,w,u]),v.statusCode(j),j=b,t&&g.trigger('ajax'+(o?'Success':'Error'),[v,d,o?r:u]),i.fireWith(e,[v,w]),t&&(g.trigger('ajaxComplete',[v,d]),--f.active||f.event.trigger('ajaxStop'));}}typeof a=='object'&&(c=a,a=b),c=c||{};var d=f.ajaxSetup({},c),e=d.context||d,g=e!==d&&(e.nodeType||e instanceof f)?f(e):f.event,h=f.Deferred(),i=f.Callbacks('once memory'),j=d.statusCode||{},k,l={},m={},n,o,p,q,r,s=0,t,u,v={readyState:0,setRequestHeader:function(a,b){if(!s){var c=a.toLowerCase();a=m[c]=m[c]||a,l[a]=b;}return this;},getAllResponseHeaders:function(){return s===2?n:null;},getResponseHeader:function(a){var c;if(s===2){if(!o){o={};while(c=bH.exec(n))o[c[1].toLowerCase()]=c[2];}c=o[a.toLowerCase()];}return c===b?null:c;},overrideMimeType:function(a){s||(d.mimeType=a);return this;},abort:function(a){a=a||'abort',p&&p.abort(a),w(0,a);return this;}};h.promise(v),v.success=v.done,v.error=v.fail,v.complete=i.add,v.statusCode=function(a){if(a){var b;if(s<2)for(b in a)j[b]=[j[b],a[b]];else b=a[v.status],v.then(b,b);}return this;},d.url=((a||d.url)+'').replace(bG,'').replace(bL,bW[1]+'//'),d.dataTypes=f.trim(d.dataType||'*').toLowerCase().split(bP),d.crossDomain==null&&(r=bR.exec(d.url.toLowerCase()),d.crossDomain=!(!r||r[1]==bW[1]&&r[2]==bW[2]&&(r[3]||(r[1]==='http:'?80:443))==(bW[3]||(bW[1]==='http:'?80:443)))),d.data&&d.processData&&typeof d.data!='string'&&(d.data=f.param(d.data,d.traditional)),b$(bT,d,c,v);if(s===2)return!1;t=d.global,d.type=d.type.toUpperCase(),d.hasContent=!bK.test(d.type),t&&f.active++===0&&f.event.trigger('ajaxStart');if(!d.hasContent){d.data&&(d.url+=(bM.test(d.url)?'&':'?')+d.data,delete d.data),k=d.url;if(d.cache===!1){var x=f.now(),y=d.url.replace(bQ,'$1_='+x);d.url=y+(y===d.url?(bM.test(d.url)?'&':'?')+'_='+x:'');}}(d.data&&d.hasContent&&d.contentType!==!1||c.contentType)&&v.setRequestHeader('Content-Type',d.contentType),d.ifModified&&(k=k||d.url,f.lastModified[k]&&v.setRequestHeader('If-Modified-Since',f.lastModified[k]),f.etag[k]&&v.setRequestHeader('If-None-Match',f.etag[k])),v.setRequestHeader('Accept',d.dataTypes[0]&&d.accepts[d.dataTypes[0]]?d.accepts[d.dataTypes[0]]+(d.dataTypes[0]!=='*'?', '+bX+'; q=0.01':''):d.accepts['*']);for(u in d.headers)v.setRequestHeader(u,d.headers[u]);if(d.beforeSend&&(d.beforeSend.call(e,v,d)===!1||s===2)){v.abort();return!1;}for(u in{success:1,error:1,complete:1})v[u](d[u]);p=b$(bU,d,c,v);if(!p)w(-1,'No Transport');else{v.readyState=1,t&&g.trigger('ajaxSend',[v,d]),d.async&&d.timeout>0&&(q=setTimeout(function(){v.abort('timeout');},d.timeout));try{s=1,p.send(l,w);}catch(z){if(s<2)w(-1,z);else throw z;}}return v;},param:function(a,c){var d=[],e=function(a,b){b=f.isFunction(b)?b():b,d[d.length]=encodeURIComponent(a)+'='+encodeURIComponent(b);};c===b&&(c=f.ajaxSettings.traditional);if(f.isArray(a)||a.jquery&&!f.isPlainObject(a))f.each(a,function(){e(this.name,this.value);});else for(var g in a)ca(g,a[g],c,e);return d.join('&').replace(bD,'+');}}),f.extend({active:0,lastModified:{},etag:{}});var cd=f.now(),ce=/(\=)\?(&|$)|\?\?/i;f.ajaxSetup({jsonp:'callback',jsonpCallback:function(){return f.expando+'_'+cd++;}}),f.ajaxPrefilter('json jsonp',function(b,c,d){var e=b.contentType==='application/x-www-form-urlencoded'&&typeof b.data=='string';if(b.dataTypes[0]==='jsonp'||b.jsonp!==!1&&(ce.test(b.url)||e&&ce.test(b.data))){var g,h=b.jsonpCallback=f.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,i=a[h],j=b.url,k=b.data,l='$1'+h+'$2';b.jsonp!==!1&&(j=j.replace(ce,l),b.url===j&&(e&&(k=k.replace(ce,l)),b.data===k&&(j+=(/\?/.test(j)?'&':'?')+b.jsonp+'='+h))),b.url=j,b.data=k,a[h]=function(a){g=[a];},d.always(function(){a[h]=i,g&&f.isFunction(i)&&a[h](g[0]);}),b.converters['script json']=function(){g||f.error(h+' was not called');return g[0];},b.dataTypes[0]='json';return'script';}}),f.ajaxSetup({accepts:{script:'text/javascript, application/javascript, application/ecmascript, application/x-ecmascript'},contents:{script:/javascript|ecmascript/},converters:{'text script':function(a){f.globalEval(a);return a;}}}),f.ajaxPrefilter('script',function(a){a.cache===b&&(a.cache=!1),a.crossDomain&&(a.type='GET',a.global=!1);}),f.ajaxTransport('script',function(a){if(a.crossDomain){var d,e=c.head||c.getElementsByTagName('head')[0]||c.documentElement;return{send:function(f,g){d=c.createElement('script'),d.async='async',a.scriptCharset&&(d.charset=a.scriptCharset),d.src=a.url,d.onload=d.onreadystatechange=function(a,c){if(c||!d.readyState||/loaded|complete/.test(d.readyState))d.onload=d.onreadystatechange=null,e&&d.parentNode&&e.removeChild(d),d=b,c||g(200,'success');},e.insertBefore(d,e.firstChild);},abort:function(){d&&d.onload(0,1);}};}});var cf=a.ActiveXObject?function(){for(var a in ch)ch[a](0,1);}:!1,cg=0,ch;f.ajaxSettings.xhr=a.ActiveXObject?function(){return!this.isLocal&&ci()||cj();}:ci,function(a){f.extend(f.support,{ajax:!!a,cors:!!a&&'withCredentials'in a});}(f.ajaxSettings.xhr()),f.support.ajax&&f.ajaxTransport(function(c){if(!c.crossDomain||f.support.cors){var d;return{send:function(e,g){var h=c.xhr(),i,j;c.username?h.open(c.type,c.url,c.async,c.username,c.password):h.open(c.type,c.url,c.async);if(c.xhrFields)for(j in c.xhrFields)h[j]=c.xhrFields[j];c.mimeType&&h.overrideMimeType&&h.overrideMimeType(c.mimeType),!c.crossDomain&&!e['X-Requested-With']&&(e['X-Requested-With']='XMLHttpRequest');try{for(j in e)h.setRequestHeader(j,e[j]);}catch(k){}h.send(c.hasContent&&c.data||null),d=function(a,e){var j,k,l,m,n;try{if(d&&(e||h.readyState===4)){d=b,i&&(h.onreadystatechange=f.noop,cf&&delete ch[i]);if(e)h.readyState!==4&&h.abort();else{j=h.status,l=h.getAllResponseHeaders(),m={},n=h.responseXML,n&&n.documentElement&&(m.xml=n),m.text=h.responseText;try{k=h.statusText;}catch(o){k='';}!j&&c.isLocal&&!c.crossDomain?j=m.text?200:404:j===1223&&(j=204);}}}catch(p){e||g(-1,p);}m&&g(j,k,m,l);},!c.async||h.readyState===4?d():(i=++cg,cf&&(ch||(ch={},f(a).unload(cf)),ch[i]=d),h.onreadystatechange=d);},abort:function(){d&&d(0,1);}};}});var ck={},cl,cm,cn=/^(?:toggle|show|hide)$/,co=/^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,cp,cq=[['height','marginTop','marginBottom','paddingTop','paddingBottom'],['width','marginLeft','marginRight','paddingLeft','paddingRight'],['opacity']],cr;f.fn.extend({show:function(a,b,c){var d,e;if(a||a===0)return this.animate(cu('show',3),a,b,c);for(var g=0,h=this.length;g=i.duration+this.startTime){this.now=this.end,this.pos=this.state=1,this.update(),i.animatedProperties[this.prop]=!0;for(b in i.animatedProperties)i.animatedProperties[b]!==!0&&(g=!1);if(g){i.overflow!=null&&!f.support.shrinkWrapBlocks&&f.each(['','X','Y'],function(a,b){h.style['overflow'+b]=i.overflow[a];}),i.hide&&f(h).hide();if(i.hide||i.show)for(b in i.animatedProperties)f.style(h,b,i.orig[b]),f.removeData(h,'fxshow'+b,!0),f.removeData(h,'toggle'+b,!0);d=i.complete,d&&(i.complete=!1,d.call(h));}return!1;}i.duration==Infinity?this.now=e:(c=e-this.startTime,this.state=c/i.duration,this.pos=f.easing[i.animatedProperties[this.prop]](this.state,c,0,1,i.duration),this.now=this.start+(this.end-this.start)*this.pos),this.update();return!0;}},f.extend(f.fx,{tick:function(){var a,b=f.timers,c=0;for(;c-1,k={},l={},m,n;j?(l=e.position(),m=l.top,n=l.left):(m=parseFloat(h)||0,n=parseFloat(i)||0),f.isFunction(b)&&(b=b.call(a,c,g)),b.top!=null&&(k.top=b.top-g.top+m),b.left!=null&&(k.left=b.left-g.left+n),'using'in b?b.using.call(a,k):e.css(k);}},f.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),c=this.offset(),d=cx.test(b[0].nodeName)?{top:0,left:0}:b.offset();c.top-=parseFloat(f.css(a,'marginTop'))||0,c.left-=parseFloat(f.css(a,'marginLeft'))||0,d.top+=parseFloat(f.css(b[0],'borderTopWidth'))||0,d.left+=parseFloat(f.css(b[0],'borderLeftWidth'))||0;return{top:c.top-d.top,left:c.left-d.left};},offsetParent:function(){return this.map(function(){var a=this.offsetParent||c.body;while(a&&!cx.test(a.nodeName)&&f.css(a,'position')==='static')a=a.offsetParent;return a;});}}),f.each(['Left','Top'],function(a,c){var d='scroll'+c;f.fn[d]=function(c){var e,g;if(c===b){e=this[0];if(!e)return null;g=cy(e);return g?'pageXOffset'in g?g[a?'pageYOffset':'pageXOffset']:f.support.boxModel&&g.document.documentElement[d]||g.document.body[d]:e[d];}return this.each(function(){g=cy(this),g?g.scrollTo(a?f(g).scrollLeft():c,a?c:f(g).scrollTop()):this[d]=c;});};}),f.each(['Height','Width'],function(a,c){var d=c.toLowerCase();f.fn['inner'+c]=function(){var a=this[0];return a?a.style?parseFloat(f.css(a,d,'padding')):this[d]():null;},f.fn['outer'+c]=function(a){var b=this[0];return b?b.style?parseFloat(f.css(b,d,a?'margin':'border')):this[d]():null;},f.fn[d]=function(a){var e=this[0];if(!e)return a==null?null:this;if(f.isFunction(a))return this.each(function(b){var c=f(this);c[d](a.call(this,b,c[d]()));});if(f.isWindow(e)){var g=e.document.documentElement['client'+c],h=e.document.body;return e.document.compatMode==='CSS1Compat'&&g||h&&h['client'+c]||g;}if(e.nodeType===9)return Math.max(e.documentElement['client'+c],e.body['scroll'+c],e.documentElement['scroll'+c],e.body['offset'+c],e.documentElement['offset'+c]);if(a===b){var i=f.css(e,d),j=parseFloat(i);return f.isNumeric(j)?j:i;}return this.css(d,typeof a=='string'?a:a+'px');};}),a.jQuery=a.$=f,typeof define=='function'&&define.amd&&define.amd.jQuery&&define('jquery',[],function(){return f;});})(window); \ No newline at end of file diff --git a/examples/voter/voter/public/javascripts/jquery-ui-1.8.17.custom.min.js b/examples/voter/voter/public/javascripts/jquery-ui-1.8.17.custom.min.js index 2439195..a1cdbf3 100644 --- a/examples/voter/voter/public/javascripts/jquery-ui-1.8.17.custom.min.js +++ b/examples/voter/voter/public/javascripts/jquery-ui-1.8.17.custom.min.js @@ -6,7 +6,7 @@ * http://jquery.org/license * * http://docs.jquery.com/UI - */(function(a,b){function d(b){return!a(b).parents().andSelf().filter(function(){return a.curCSS(this,"visibility")==="hidden"||a.expr.filters.hidden(this);}).length;}function c(b,c){var e=b.nodeName.toLowerCase();if("area"===e){var f=b.parentNode,g=f.name,h;if(!b.href||!g||f.nodeName.toLowerCase()!=="map")return!1;h=a("img[usemap=#"+g+"]")[0];return!!h&&d(h);}return(/input|select|textarea|button|object/.test(e)?!b.disabled:"a"==e?b.href||c:c)&&d(b);}a.ui=a.ui||{};a.ui.version||(a.extend(a.ui,{version:"1.8.17",keyCode:{ALT:18,BACKSPACE:8,CAPS_LOCK:20,COMMA:188,COMMAND:91,COMMAND_LEFT:91,COMMAND_RIGHT:93,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,MENU:93,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SHIFT:16,SPACE:32,TAB:9,UP:38,WINDOWS:91}}),a.fn.extend({propAttr:a.fn.prop||a.fn.attr,_focus:a.fn.focus,focus:function(b,c){return typeof b=="number"?this.each(function(){var d=this;setTimeout(function(){a(d).focus(),c&&c.call(d);},b);}):this._focus.apply(this,arguments);},scrollParent:function(){var b;a.browser.msie&&/(static|relative)/.test(this.css("position"))||/absolute/.test(this.css("position"))?b=this.parents().filter(function(){return/(relative|absolute|fixed)/.test(a.curCSS(this,"position",1))&&/(auto|scroll)/.test(a.curCSS(this,"overflow",1)+a.curCSS(this,"overflow-y",1)+a.curCSS(this,"overflow-x",1));}).eq(0):b=this.parents().filter(function(){return/(auto|scroll)/.test(a.curCSS(this,"overflow",1)+a.curCSS(this,"overflow-y",1)+a.curCSS(this,"overflow-x",1));}).eq(0);return/fixed/.test(this.css("position"))||!b.length?a(document):b;},zIndex:function(c){if(c!==b)return this.css("zIndex",c);if(this.length){var d=a(this[0]),e,f;while(d.length&&d[0]!==document){e=d.css("position");if(e==="absolute"||e==="relative"||e==="fixed"){f=parseInt(d.css("zIndex"),10);if(!isNaN(f)&&f!==0)return f;}d=d.parent();}}return 0;},disableSelection:function(){return this.bind((a.support.selectstart?"selectstart":"mousedown")+".ui-disableSelection",function(a){a.preventDefault();});},enableSelection:function(){return this.unbind(".ui-disableSelection");}}),a.each(["Width","Height"],function(c,d){function h(b,c,d,f){a.each(e,function(){c-=parseFloat(a.curCSS(b,"padding"+this,!0))||0,d&&(c-=parseFloat(a.curCSS(b,"border"+this+"Width",!0))||0),f&&(c-=parseFloat(a.curCSS(b,"margin"+this,!0))||0);});return c;}var e=d==="Width"?["Left","Right"]:["Top","Bottom"],f=d.toLowerCase(),g={innerWidth:a.fn.innerWidth,innerHeight:a.fn.innerHeight,outerWidth:a.fn.outerWidth,outerHeight:a.fn.outerHeight};a.fn["inner"+d]=function(c){if(c===b)return g["inner"+d].call(this);return this.each(function(){a(this).css(f,h(this,c)+"px");});},a.fn["outer"+d]=function(b,c){if(typeof b!="number")return g["outer"+d].call(this,b);return this.each(function(){a(this).css(f,h(this,b,!0,c)+"px");});};}),a.extend(a.expr[":"],{data:function(b,c,d){return!!a.data(b,d[3]);},focusable:function(b){return c(b,!isNaN(a.attr(b,"tabindex")));},tabbable:function(b){var d=a.attr(b,"tabindex"),e=isNaN(d);return(e||d>=0)&&c(b,!e);}}),a(function(){var b=document.body,c=b.appendChild(c=document.createElement("div"));a.extend(c.style,{minHeight:"100px",height:"auto",padding:0,borderWidth:0}),a.support.minHeight=c.offsetHeight===100,a.support.selectstart="onselectstart"in c,b.removeChild(c).style.display="none";}),a.extend(a.ui,{plugin:{add:function(b,c,d){var e=a.ui[b].prototype;for(var f in d)e.plugins[f]=e.plugins[f]||[],e.plugins[f].push([c,d[f]]);},call:function(a,b,c){var d=a.plugins[b];if(!!d&&!!a.element[0].parentNode)for(var e=0;e0)return!0;b[d]=1,e=b[d]>0,b[d]=0;return e;},isOverAxis:function(a,b,c){return a>b&&a=0)&&c(b,!e);}}),a(function(){var b=document.body,c=b.appendChild(c=document.createElement('div'));a.extend(c.style,{minHeight:'100px',height:'auto',padding:0,borderWidth:0}),a.support.minHeight=c.offsetHeight===100,a.support.selectstart='onselectstart'in c,b.removeChild(c).style.display='none';}),a.extend(a.ui,{plugin:{add:function(b,c,d){var e=a.ui[b].prototype;for(var f in d)e.plugins[f]=e.plugins[f]||[],e.plugins[f].push([c,d[f]]);},call:function(a,b,c){var d=a.plugins[b];if(!!d&&!!a.element[0].parentNode)for(var e=0;e0)return!0;b[d]=1,e=b[d]>0,b[d]=0;return e;},isOverAxis:function(a,b,c){return a>b&&a=9)&&!b.button)return this._mouseUp(b);if(this._mouseStarted){this._mouseDrag(b);return b.preventDefault();}this._mouseDistanceMet(b)&&this._mouseDelayMet(b)&&(this._mouseStarted=this._mouseStart(this._mouseDownEvent,b)!==!1,this._mouseStarted?this._mouseDrag(b):this._mouseUp(b));return!this._mouseStarted;},_mouseUp:function(b){a(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate),this._mouseStarted&&(this._mouseStarted=!1,b.target==this._mouseDownEvent.target&&a.data(b.target,this.widgetName+".preventClickEvent",!0),this._mouseStop(b));return!1;},_mouseDistanceMet:function(a){return Math.max(Math.abs(this._mouseDownEvent.pageX-a.pageX),Math.abs(this._mouseDownEvent.pageY-a.pageY))>=this.options.distance;},_mouseDelayMet:function(a){return this.mouseDelayMet;},_mouseStart:function(a){},_mouseDrag:function(a){},_mouseStop:function(a){},_mouseCapture:function(a){return!0;}});})(jQuery);/* + */(function(a,b){var c=!1;a(document).mouseup(function(a){c=!1;}),a.widget('ui.mouse',{options:{cancel:':input,option',distance:1,delay:0},_mouseInit:function(){var b=this;this.element.bind('mousedown.'+this.widgetName,function(a){return b._mouseDown(a);}).bind('click.'+this.widgetName,function(c){if(!0===a.data(c.target,b.widgetName+'.preventClickEvent')){a.removeData(c.target,b.widgetName+'.preventClickEvent'),c.stopImmediatePropagation();return!1;}}),this.started=!1;},_mouseDestroy:function(){this.element.unbind('.'+this.widgetName);},_mouseDown:function(b){if(!c){this._mouseStarted&&this._mouseUp(b),this._mouseDownEvent=b;var d=this,e=b.which==1,f=typeof this.options.cancel=='string'&&b.target.nodeName?a(b.target).closest(this.options.cancel).length:!1;if(!e||f||!this._mouseCapture(b))return!0;this.mouseDelayMet=!this.options.delay,this.mouseDelayMet||(this._mouseDelayTimer=setTimeout(function(){d.mouseDelayMet=!0;},this.options.delay));if(this._mouseDistanceMet(b)&&this._mouseDelayMet(b)){this._mouseStarted=this._mouseStart(b)!==!1;if(!this._mouseStarted){b.preventDefault();return!0;}}!0===a.data(b.target,this.widgetName+'.preventClickEvent')&&a.removeData(b.target,this.widgetName+'.preventClickEvent'),this._mouseMoveDelegate=function(a){return d._mouseMove(a);},this._mouseUpDelegate=function(a){return d._mouseUp(a);},a(document).bind('mousemove.'+this.widgetName,this._mouseMoveDelegate).bind('mouseup.'+this.widgetName,this._mouseUpDelegate),b.preventDefault(),c=!0;return!0;}},_mouseMove:function(b){if(a.browser.msie&&!(document.documentMode>=9)&&!b.button)return this._mouseUp(b);if(this._mouseStarted){this._mouseDrag(b);return b.preventDefault();}this._mouseDistanceMet(b)&&this._mouseDelayMet(b)&&(this._mouseStarted=this._mouseStart(this._mouseDownEvent,b)!==!1,this._mouseStarted?this._mouseDrag(b):this._mouseUp(b));return!this._mouseStarted;},_mouseUp:function(b){a(document).unbind('mousemove.'+this.widgetName,this._mouseMoveDelegate).unbind('mouseup.'+this.widgetName,this._mouseUpDelegate),this._mouseStarted&&(this._mouseStarted=!1,b.target==this._mouseDownEvent.target&&a.data(b.target,this.widgetName+'.preventClickEvent',!0),this._mouseStop(b));return!1;},_mouseDistanceMet:function(a){return Math.max(Math.abs(this._mouseDownEvent.pageX-a.pageX),Math.abs(this._mouseDownEvent.pageY-a.pageY))>=this.options.distance;},_mouseDelayMet:function(a){return this.mouseDelayMet;},_mouseStart:function(a){},_mouseDrag:function(a){},_mouseStop:function(a){},_mouseCapture:function(a){return!0;}});})(jQuery);/* * jQuery UI Position 1.8.17 * * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) @@ -33,7 +33,7 @@ * http://jquery.org/license * * http://docs.jquery.com/UI/Position - */(function(a,b){a.ui=a.ui||{};var c=/left|center|right/,d=/top|center|bottom/,e="center",f={},g=a.fn.position,h=a.fn.offset;a.fn.position=function(b){if(!b||!b.of)return g.apply(this,arguments);b=a.extend({},b);var h=a(b.of),i=h[0],j=(b.collision||"flip").split(" "),k=b.offset?b.offset.split(" "):[0,0],l,m,n;i.nodeType===9?(l=h.width(),m=h.height(),n={top:0,left:0}):i.setTimeout?(l=h.width(),m=h.height(),n={top:h.scrollTop(),left:h.scrollLeft()}):i.preventDefault?(b.at="left top",l=m=0,n={top:b.of.pageY,left:b.of.pageX}):(l=h.outerWidth(),m=h.outerHeight(),n=h.offset()),a.each(["my","at"],function(){var a=(b[this]||"").split(" ");a.length===1&&(a=c.test(a[0])?a.concat([e]):d.test(a[0])?[e].concat(a):[e,e]),a[0]=c.test(a[0])?a[0]:e,a[1]=d.test(a[1])?a[1]:e,b[this]=a;}),j.length===1&&(j[1]=j[0]),k[0]=parseInt(k[0],10)||0,k.length===1&&(k[1]=k[0]),k[1]=parseInt(k[1],10)||0,b.at[0]==="right"?n.left+=l:b.at[0]===e&&(n.left+=l/2),b.at[1]==="bottom"?n.top+=m:b.at[1]===e&&(n.top+=m/2),n.left+=k[0],n.top+=k[1];return this.each(function(){var c=a(this),d=c.outerWidth(),g=c.outerHeight(),h=parseInt(a.curCSS(this,"marginLeft",!0))||0,i=parseInt(a.curCSS(this,"marginTop",!0))||0,o=d+h+(parseInt(a.curCSS(this,"marginRight",!0))||0),p=g+i+(parseInt(a.curCSS(this,"marginBottom",!0))||0),q=a.extend({},n),r;b.my[0]==="right"?q.left-=d:b.my[0]===e&&(q.left-=d/2),b.my[1]==="bottom"?q.top-=g:b.my[1]===e&&(q.top-=g/2),f.fractions||(q.left=Math.round(q.left),q.top=Math.round(q.top)),r={left:q.left-h,top:q.top-i},a.each(["left","top"],function(c,e){a.ui.position[j[c]]&&a.ui.position[j[c]][e](q,{targetWidth:l,targetHeight:m,elemWidth:d,elemHeight:g,collisionPosition:r,collisionWidth:o,collisionHeight:p,offset:k,my:b.my,at:b.at});}),a.fn.bgiframe&&c.bgiframe(),c.offset(a.extend(q,{using:b.using}));});},a.ui.position={fit:{left:function(b,c){var d=a(window),e=c.collisionPosition.left+c.collisionWidth-d.width()-d.scrollLeft();b.left=e>0?b.left-e:Math.max(b.left-c.collisionPosition.left,b.left);},top:function(b,c){var d=a(window),e=c.collisionPosition.top+c.collisionHeight-d.height()-d.scrollTop();b.top=e>0?b.top-e:Math.max(b.top-c.collisionPosition.top,b.top);}},flip:{left:function(b,c){if(c.at[0]!==e){var d=a(window),f=c.collisionPosition.left+c.collisionWidth-d.width()-d.scrollLeft(),g=c.my[0]==="left"?-c.elemWidth:c.my[0]==="right"?c.elemWidth:0,h=c.at[0]==="left"?c.targetWidth:-c.targetWidth,i=-2*c.offset[0];b.left+=c.collisionPosition.left<0?g+h+i:f>0?g+h+i:0;}},top:function(b,c){if(c.at[1]!==e){var d=a(window),f=c.collisionPosition.top+c.collisionHeight-d.height()-d.scrollTop(),g=c.my[1]==="top"?-c.elemHeight:c.my[1]==="bottom"?c.elemHeight:0,h=c.at[1]==="top"?c.targetHeight:-c.targetHeight,i=-2*c.offset[1];b.top+=c.collisionPosition.top<0?g+h+i:f>0?g+h+i:0;}}}},a.offset.setOffset||(a.offset.setOffset=function(b,c){/static/.test(a.curCSS(b,"position"))&&(b.style.position="relative");var d=a(b),e=d.offset(),f=parseInt(a.curCSS(b,"top",!0),10)||0,g=parseInt(a.curCSS(b,"left",!0),10)||0,h={top:c.top-e.top+f,left:c.left-e.left+g};"using"in c?c.using.call(b,h):d.css(h);},a.fn.offset=function(b){var c=this[0];if(!c||!c.ownerDocument)return null;if(b)return this.each(function(){a.offset.setOffset(this,b);});return h.call(this);}),function(){var b=document.getElementsByTagName("body")[0],c=document.createElement("div"),d,e,g,h,i;d=document.createElement(b?"div":"body"),g={visibility:"hidden",width:0,height:0,border:0,margin:0,background:"none"},b&&jQuery.extend(g,{position:"absolute",left:"-1000px",top:"-1000px"});for(var j in g)d.style[j]=g[j];d.appendChild(c),e=b||document.documentElement,e.insertBefore(d,e.firstChild),c.style.cssText="position: absolute; left: 10.7432222px; top: 10.432325px; height: 30px; width: 201px;",h=a(c).offset(function(a,b){return b;}).offset(),d.innerHTML="",e.removeChild(d),i=h.top+h.left+(b?2e3:0),f.fractions=i>21&&i<22;}();})(jQuery);/* + */(function(a,b){a.ui=a.ui||{};var c=/left|center|right/,d=/top|center|bottom/,e='center',f={},g=a.fn.position,h=a.fn.offset;a.fn.position=function(b){if(!b||!b.of)return g.apply(this,arguments);b=a.extend({},b);var h=a(b.of),i=h[0],j=(b.collision||'flip').split(' '),k=b.offset?b.offset.split(' '):[0,0],l,m,n;i.nodeType===9?(l=h.width(),m=h.height(),n={top:0,left:0}):i.setTimeout?(l=h.width(),m=h.height(),n={top:h.scrollTop(),left:h.scrollLeft()}):i.preventDefault?(b.at='left top',l=m=0,n={top:b.of.pageY,left:b.of.pageX}):(l=h.outerWidth(),m=h.outerHeight(),n=h.offset()),a.each(['my','at'],function(){var a=(b[this]||'').split(' ');a.length===1&&(a=c.test(a[0])?a.concat([e]):d.test(a[0])?[e].concat(a):[e,e]),a[0]=c.test(a[0])?a[0]:e,a[1]=d.test(a[1])?a[1]:e,b[this]=a;}),j.length===1&&(j[1]=j[0]),k[0]=parseInt(k[0],10)||0,k.length===1&&(k[1]=k[0]),k[1]=parseInt(k[1],10)||0,b.at[0]==='right'?n.left+=l:b.at[0]===e&&(n.left+=l/2),b.at[1]==='bottom'?n.top+=m:b.at[1]===e&&(n.top+=m/2),n.left+=k[0],n.top+=k[1];return this.each(function(){var c=a(this),d=c.outerWidth(),g=c.outerHeight(),h=parseInt(a.curCSS(this,'marginLeft',!0))||0,i=parseInt(a.curCSS(this,'marginTop',!0))||0,o=d+h+(parseInt(a.curCSS(this,'marginRight',!0))||0),p=g+i+(parseInt(a.curCSS(this,'marginBottom',!0))||0),q=a.extend({},n),r;b.my[0]==='right'?q.left-=d:b.my[0]===e&&(q.left-=d/2),b.my[1]==='bottom'?q.top-=g:b.my[1]===e&&(q.top-=g/2),f.fractions||(q.left=Math.round(q.left),q.top=Math.round(q.top)),r={left:q.left-h,top:q.top-i},a.each(['left','top'],function(c,e){a.ui.position[j[c]]&&a.ui.position[j[c]][e](q,{targetWidth:l,targetHeight:m,elemWidth:d,elemHeight:g,collisionPosition:r,collisionWidth:o,collisionHeight:p,offset:k,my:b.my,at:b.at});}),a.fn.bgiframe&&c.bgiframe(),c.offset(a.extend(q,{using:b.using}));});},a.ui.position={fit:{left:function(b,c){var d=a(window),e=c.collisionPosition.left+c.collisionWidth-d.width()-d.scrollLeft();b.left=e>0?b.left-e:Math.max(b.left-c.collisionPosition.left,b.left);},top:function(b,c){var d=a(window),e=c.collisionPosition.top+c.collisionHeight-d.height()-d.scrollTop();b.top=e>0?b.top-e:Math.max(b.top-c.collisionPosition.top,b.top);}},flip:{left:function(b,c){if(c.at[0]!==e){var d=a(window),f=c.collisionPosition.left+c.collisionWidth-d.width()-d.scrollLeft(),g=c.my[0]==='left'?-c.elemWidth:c.my[0]==='right'?c.elemWidth:0,h=c.at[0]==='left'?c.targetWidth:-c.targetWidth,i=-2*c.offset[0];b.left+=c.collisionPosition.left<0?g+h+i:f>0?g+h+i:0;}},top:function(b,c){if(c.at[1]!==e){var d=a(window),f=c.collisionPosition.top+c.collisionHeight-d.height()-d.scrollTop(),g=c.my[1]==='top'?-c.elemHeight:c.my[1]==='bottom'?c.elemHeight:0,h=c.at[1]==='top'?c.targetHeight:-c.targetHeight,i=-2*c.offset[1];b.top+=c.collisionPosition.top<0?g+h+i:f>0?g+h+i:0;}}}},a.offset.setOffset||(a.offset.setOffset=function(b,c){/static/.test(a.curCSS(b,'position'))&&(b.style.position='relative');var d=a(b),e=d.offset(),f=parseInt(a.curCSS(b,'top',!0),10)||0,g=parseInt(a.curCSS(b,'left',!0),10)||0,h={top:c.top-e.top+f,left:c.left-e.left+g};'using'in c?c.using.call(b,h):d.css(h);},a.fn.offset=function(b){var c=this[0];if(!c||!c.ownerDocument)return null;if(b)return this.each(function(){a.offset.setOffset(this,b);});return h.call(this);}),function(){var b=document.getElementsByTagName('body')[0],c=document.createElement('div'),d,e,g,h,i;d=document.createElement(b?'div':'body'),g={visibility:'hidden',width:0,height:0,border:0,margin:0,background:'none'},b&&jQuery.extend(g,{position:'absolute',left:'-1000px',top:'-1000px'});for(var j in g)d.style[j]=g[j];d.appendChild(c),e=b||document.documentElement,e.insertBefore(d,e.firstChild),c.style.cssText='position: absolute; left: 10.7432222px; top: 10.432325px; height: 30px; width: 201px;',h=a(c).offset(function(a,b){return b;}).offset(),d.innerHTML='',e.removeChild(d),i=h.top+h.left+(b?2e3:0),f.fractions=i>21&&i<22;}();})(jQuery);/* * jQuery UI Accordion 1.8.17 * * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) @@ -45,7 +45,7 @@ * Depends: * jquery.ui.core.js * jquery.ui.widget.js - */(function(a,b){a.widget("ui.accordion",{options:{active:0,animated:"slide",autoHeight:!0,clearStyle:!1,collapsible:!1,event:"click",fillSpace:!1,header:"> li > :first-child,> :not(li):even",icons:{header:"ui-icon-triangle-1-e",headerSelected:"ui-icon-triangle-1-s"},navigation:!1,navigationFilter:function(){return this.href.toLowerCase()===location.href.toLowerCase();}},_create:function(){var b=this,c=b.options;b.running=0,b.element.addClass("ui-accordion ui-widget ui-helper-reset").children("li").addClass("ui-accordion-li-fix"),b.headers=b.element.find(c.header).addClass("ui-accordion-header ui-helper-reset ui-state-default ui-corner-all").bind("mouseenter.accordion",function(){c.disabled||a(this).addClass("ui-state-hover");}).bind("mouseleave.accordion",function(){c.disabled||a(this).removeClass("ui-state-hover");}).bind("focus.accordion",function(){c.disabled||a(this).addClass("ui-state-focus");}).bind("blur.accordion",function(){c.disabled||a(this).removeClass("ui-state-focus");}),b.headers.next().addClass("ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom");if(c.navigation){var d=b.element.find("a").filter(c.navigationFilter).eq(0);if(d.length){var e=d.closest(".ui-accordion-header");e.length?b.active=e:b.active=d.closest(".ui-accordion-content").prev();}}b.active=b._findActive(b.active||c.active).addClass("ui-state-default ui-state-active").toggleClass("ui-corner-all").toggleClass("ui-corner-top"),b.active.next().addClass("ui-accordion-content-active"),b._createIcons(),b.resize(),b.element.attr("role","tablist"),b.headers.attr("role","tab").bind("keydown.accordion",function(a){return b._keydown(a);}).next().attr("role","tabpanel"),b.headers.not(b.active||"").attr({"aria-expanded":"false","aria-selected":"false",tabIndex:-1}).next().hide(),b.active.length?b.active.attr({"aria-expanded":"true","aria-selected":"true",tabIndex:0}):b.headers.eq(0).attr("tabIndex",0),a.browser.safari||b.headers.find("a").attr("tabIndex",-1),c.event&&b.headers.bind(c.event.split(" ").join(".accordion ")+".accordion",function(a){b._clickHandler.call(b,a,this),a.preventDefault();});},_createIcons:function(){var b=this.options;b.icons&&(a("").addClass("ui-icon "+b.icons.header).prependTo(this.headers),this.active.children(".ui-icon").toggleClass(b.icons.header).toggleClass(b.icons.headerSelected),this.element.addClass("ui-accordion-icons"));},_destroyIcons:function(){this.headers.children(".ui-icon").remove(),this.element.removeClass("ui-accordion-icons");},destroy:function(){var b=this.options;this.element.removeClass("ui-accordion ui-widget ui-helper-reset").removeAttr("role"),this.headers.unbind(".accordion").removeClass("ui-accordion-header ui-accordion-disabled ui-helper-reset ui-state-default ui-corner-all ui-state-active ui-state-disabled ui-corner-top").removeAttr("role").removeAttr("aria-expanded").removeAttr("aria-selected").removeAttr("tabIndex"),this.headers.find("a").removeAttr("tabIndex"),this._destroyIcons();var c=this.headers.next().css("display","").removeAttr("role").removeClass("ui-helper-reset ui-widget-content ui-corner-bottom ui-accordion-content ui-accordion-content-active ui-accordion-disabled ui-state-disabled");(b.autoHeight||b.fillHeight)&&c.css("height","");return a.Widget.prototype.destroy.call(this);},_setOption:function(b,c){a.Widget.prototype._setOption.apply(this,arguments),b=="active"&&this.activate(c),b=="icons"&&(this._destroyIcons(),c&&this._createIcons()),b=="disabled"&&this.headers.add(this.headers.next())[c?"addClass":"removeClass"]("ui-accordion-disabled ui-state-disabled");},_keydown:function(b){if(!(this.options.disabled||b.altKey||b.ctrlKey)){var c=a.ui.keyCode,d=this.headers.length,e=this.headers.index(b.target),f=!1;switch(b.keyCode){case c.RIGHT:case c.DOWN:f=this.headers[(e+1)%d];break;case c.LEFT:case c.UP:f=this.headers[(e-1+d)%d];break;case c.SPACE:case c.ENTER:this._clickHandler({target:b.target},b.target),b.preventDefault();}if(f){a(b.target).attr("tabIndex",-1),a(f).attr("tabIndex",0),f.focus();return!1;}return!0;}},resize:function(){var b=this.options,c;if(b.fillSpace){if(a.browser.msie){var d=this.element.parent().css("overflow");this.element.parent().css("overflow","hidden");}c=this.element.parent().height(),a.browser.msie&&this.element.parent().css("overflow",d),this.headers.each(function(){c-=a(this).outerHeight(!0);}),this.headers.next().each(function(){a(this).height(Math.max(0,c-a(this).innerHeight()+a(this).height()));}).css("overflow","auto");}else b.autoHeight&&(c=0,this.headers.next().each(function(){c=Math.max(c,a(this).height("").height());}).height(c));return this;},activate:function(a){this.options.active=a;var b=this._findActive(a)[0];this._clickHandler({target:b},b);return this;},_findActive:function(b){return b?typeof b=="number"?this.headers.filter(":eq("+b+")"):this.headers.not(this.headers.not(b)):b===!1?a([]):this.headers.filter(":eq(0)");},_clickHandler:function(b,c){var d=this.options;if(!d.disabled){if(!b.target){if(!d.collapsible)return;this.active.removeClass("ui-state-active ui-corner-top").addClass("ui-state-default ui-corner-all").children(".ui-icon").removeClass(d.icons.headerSelected).addClass(d.icons.header),this.active.next().addClass("ui-accordion-content-active");var e=this.active.next(),f={options:d,newHeader:a([]),oldHeader:d.active,newContent:a([]),oldContent:e},g=this.active=a([]);this._toggle(g,e,f);return;}var h=a(b.currentTarget||c),i=h[0]===this.active[0];d.active=d.collapsible&&i?!1:this.headers.index(h);if(this.running||!d.collapsible&&i)return;var j=this.active,g=h.next(),e=this.active.next(),f={options:d,newHeader:i&&d.collapsible?a([]):h,oldHeader:this.active,newContent:i&&d.collapsible?a([]):g,oldContent:e},k=this.headers.index(this.active[0])>this.headers.index(h[0]);this.active=i?a([]):h,this._toggle(g,e,f,i,k),j.removeClass("ui-state-active ui-corner-top").addClass("ui-state-default ui-corner-all").children(".ui-icon").removeClass(d.icons.headerSelected).addClass(d.icons.header),i||(h.removeClass("ui-state-default ui-corner-all").addClass("ui-state-active ui-corner-top").children(".ui-icon").removeClass(d.icons.header).addClass(d.icons.headerSelected),h.next().addClass("ui-accordion-content-active"));return;}},_toggle:function(b,c,d,e,f){var g=this,h=g.options;g.toShow=b,g.toHide=c,g.data=d;var i=function(){if(g)return g._completed.apply(g,arguments);};g._trigger("changestart",null,g.data),g.running=c.size()===0?b.size():c.size();if(h.animated){var j={};h.collapsible&&e?j={toShow:a([]),toHide:c,complete:i,down:f,autoHeight:h.autoHeight||h.fillSpace}:j={toShow:b,toHide:c,complete:i,down:f,autoHeight:h.autoHeight||h.fillSpace},h.proxied||(h.proxied=h.animated),h.proxiedDuration||(h.proxiedDuration=h.duration),h.animated=a.isFunction(h.proxied)?h.proxied(j):h.proxied,h.duration=a.isFunction(h.proxiedDuration)?h.proxiedDuration(j):h.proxiedDuration;var k=a.ui.accordion.animations,l=h.duration,m=h.animated;m&&!k[m]&&!a.easing[m]&&(m="slide"),k[m]||(k[m]=function(a){this.slide(a,{easing:m,duration:l||700});}),k[m](j);}else h.collapsible&&e?b.toggle():(c.hide(),b.show()),i(!0);c.prev().attr({"aria-expanded":"false","aria-selected":"false",tabIndex:-1}).blur(),b.prev().attr({"aria-expanded":"true","aria-selected":"true",tabIndex:0}).focus();},_completed:function(a){this.running=a?0:--this.running;this.running||(this.options.clearStyle&&this.toShow.add(this.toHide).css({height:"",overflow:""}),this.toHide.removeClass("ui-accordion-content-active"),this.toHide.length&&(this.toHide.parent()[0].className=this.toHide.parent()[0].className),this._trigger("change",null,this.data));}}),a.extend(a.ui.accordion,{version:"1.8.17",animations:{slide:function(b,c){b=a.extend({easing:"swing",duration:300},b,c);if(!b.toHide.size())b.toShow.animate({height:"show",paddingTop:"show",paddingBottom:"show"},b);else{if(!b.toShow.size()){b.toHide.animate({height:"hide",paddingTop:"hide",paddingBottom:"hide"},b);return;}var d=b.toShow.css("overflow"),e=0,f={},g={},h=["height","paddingTop","paddingBottom"],i,j=b.toShow;i=j[0].style.width,j.width(j.parent().width()-parseFloat(j.css("paddingLeft"))-parseFloat(j.css("paddingRight"))-(parseFloat(j.css("borderLeftWidth"))||0)-(parseFloat(j.css("borderRightWidth"))||0)),a.each(h,function(c,d){g[d]="hide";var e=(""+a.css(b.toShow[0],d)).match(/^([\d+-.]+)(.*)$/);f[d]={value:e[1],unit:e[2]||"px"};}),b.toShow.css({height:0,overflow:"hidden"}).show(),b.toHide.filter(":hidden").each(b.complete).end().filter(":visible").animate(g,{step:function(a,c){c.prop=="height"&&(e=c.end-c.start===0?0:(c.now-c.start)/(c.end-c.start)),b.toShow[0].style[c.prop]=e*f[c.prop].value+f[c.prop].unit;},duration:b.duration,easing:b.easing,complete:function(){b.autoHeight||b.toShow.css("height",""),b.toShow.css({width:i,overflow:d}),b.complete();}});}},bounceslide:function(a){this.slide(a,{easing:a.down?"easeOutBounce":"swing",duration:a.down?1e3:200});}}});})(jQuery);/* + */(function(a,b){a.widget('ui.accordion',{options:{active:0,animated:'slide',autoHeight:!0,clearStyle:!1,collapsible:!1,event:'click',fillSpace:!1,header:'> li > :first-child,> :not(li):even',icons:{header:'ui-icon-triangle-1-e',headerSelected:'ui-icon-triangle-1-s'},navigation:!1,navigationFilter:function(){return this.href.toLowerCase()===location.href.toLowerCase();}},_create:function(){var b=this,c=b.options;b.running=0,b.element.addClass('ui-accordion ui-widget ui-helper-reset').children('li').addClass('ui-accordion-li-fix'),b.headers=b.element.find(c.header).addClass('ui-accordion-header ui-helper-reset ui-state-default ui-corner-all').bind('mouseenter.accordion',function(){c.disabled||a(this).addClass('ui-state-hover');}).bind('mouseleave.accordion',function(){c.disabled||a(this).removeClass('ui-state-hover');}).bind('focus.accordion',function(){c.disabled||a(this).addClass('ui-state-focus');}).bind('blur.accordion',function(){c.disabled||a(this).removeClass('ui-state-focus');}),b.headers.next().addClass('ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom');if(c.navigation){var d=b.element.find('a').filter(c.navigationFilter).eq(0);if(d.length){var e=d.closest('.ui-accordion-header');e.length?b.active=e:b.active=d.closest('.ui-accordion-content').prev();}}b.active=b._findActive(b.active||c.active).addClass('ui-state-default ui-state-active').toggleClass('ui-corner-all').toggleClass('ui-corner-top'),b.active.next().addClass('ui-accordion-content-active'),b._createIcons(),b.resize(),b.element.attr('role','tablist'),b.headers.attr('role','tab').bind('keydown.accordion',function(a){return b._keydown(a);}).next().attr('role','tabpanel'),b.headers.not(b.active||'').attr({'aria-expanded':'false','aria-selected':'false',tabIndex:-1}).next().hide(),b.active.length?b.active.attr({'aria-expanded':'true','aria-selected':'true',tabIndex:0}):b.headers.eq(0).attr('tabIndex',0),a.browser.safari||b.headers.find('a').attr('tabIndex',-1),c.event&&b.headers.bind(c.event.split(' ').join('.accordion ')+'.accordion',function(a){b._clickHandler.call(b,a,this),a.preventDefault();});},_createIcons:function(){var b=this.options;b.icons&&(a('').addClass('ui-icon '+b.icons.header).prependTo(this.headers),this.active.children('.ui-icon').toggleClass(b.icons.header).toggleClass(b.icons.headerSelected),this.element.addClass('ui-accordion-icons'));},_destroyIcons:function(){this.headers.children('.ui-icon').remove(),this.element.removeClass('ui-accordion-icons');},destroy:function(){var b=this.options;this.element.removeClass('ui-accordion ui-widget ui-helper-reset').removeAttr('role'),this.headers.unbind('.accordion').removeClass('ui-accordion-header ui-accordion-disabled ui-helper-reset ui-state-default ui-corner-all ui-state-active ui-state-disabled ui-corner-top').removeAttr('role').removeAttr('aria-expanded').removeAttr('aria-selected').removeAttr('tabIndex'),this.headers.find('a').removeAttr('tabIndex'),this._destroyIcons();var c=this.headers.next().css('display','').removeAttr('role').removeClass('ui-helper-reset ui-widget-content ui-corner-bottom ui-accordion-content ui-accordion-content-active ui-accordion-disabled ui-state-disabled');(b.autoHeight||b.fillHeight)&&c.css('height','');return a.Widget.prototype.destroy.call(this);},_setOption:function(b,c){a.Widget.prototype._setOption.apply(this,arguments),b=='active'&&this.activate(c),b=='icons'&&(this._destroyIcons(),c&&this._createIcons()),b=='disabled'&&this.headers.add(this.headers.next())[c?'addClass':'removeClass']('ui-accordion-disabled ui-state-disabled');},_keydown:function(b){if(!(this.options.disabled||b.altKey||b.ctrlKey)){var c=a.ui.keyCode,d=this.headers.length,e=this.headers.index(b.target),f=!1;switch(b.keyCode){case c.RIGHT:case c.DOWN:f=this.headers[(e+1)%d];break;case c.LEFT:case c.UP:f=this.headers[(e-1+d)%d];break;case c.SPACE:case c.ENTER:this._clickHandler({target:b.target},b.target),b.preventDefault();}if(f){a(b.target).attr('tabIndex',-1),a(f).attr('tabIndex',0),f.focus();return!1;}return!0;}},resize:function(){var b=this.options,c;if(b.fillSpace){if(a.browser.msie){var d=this.element.parent().css('overflow');this.element.parent().css('overflow','hidden');}c=this.element.parent().height(),a.browser.msie&&this.element.parent().css('overflow',d),this.headers.each(function(){c-=a(this).outerHeight(!0);}),this.headers.next().each(function(){a(this).height(Math.max(0,c-a(this).innerHeight()+a(this).height()));}).css('overflow','auto');}else b.autoHeight&&(c=0,this.headers.next().each(function(){c=Math.max(c,a(this).height('').height());}).height(c));return this;},activate:function(a){this.options.active=a;var b=this._findActive(a)[0];this._clickHandler({target:b},b);return this;},_findActive:function(b){return b?typeof b=='number'?this.headers.filter(':eq('+b+')'):this.headers.not(this.headers.not(b)):b===!1?a([]):this.headers.filter(':eq(0)');},_clickHandler:function(b,c){var d=this.options;if(!d.disabled){if(!b.target){if(!d.collapsible)return;this.active.removeClass('ui-state-active ui-corner-top').addClass('ui-state-default ui-corner-all').children('.ui-icon').removeClass(d.icons.headerSelected).addClass(d.icons.header),this.active.next().addClass('ui-accordion-content-active');var e=this.active.next(),f={options:d,newHeader:a([]),oldHeader:d.active,newContent:a([]),oldContent:e},g=this.active=a([]);this._toggle(g,e,f);return;}var h=a(b.currentTarget||c),i=h[0]===this.active[0];d.active=d.collapsible&&i?!1:this.headers.index(h);if(this.running||!d.collapsible&&i)return;var j=this.active,g=h.next(),e=this.active.next(),f={options:d,newHeader:i&&d.collapsible?a([]):h,oldHeader:this.active,newContent:i&&d.collapsible?a([]):g,oldContent:e},k=this.headers.index(this.active[0])>this.headers.index(h[0]);this.active=i?a([]):h,this._toggle(g,e,f,i,k),j.removeClass('ui-state-active ui-corner-top').addClass('ui-state-default ui-corner-all').children('.ui-icon').removeClass(d.icons.headerSelected).addClass(d.icons.header),i||(h.removeClass('ui-state-default ui-corner-all').addClass('ui-state-active ui-corner-top').children('.ui-icon').removeClass(d.icons.header).addClass(d.icons.headerSelected),h.next().addClass('ui-accordion-content-active'));return;}},_toggle:function(b,c,d,e,f){var g=this,h=g.options;g.toShow=b,g.toHide=c,g.data=d;var i=function(){if(g)return g._completed.apply(g,arguments);};g._trigger('changestart',null,g.data),g.running=c.size()===0?b.size():c.size();if(h.animated){var j={};h.collapsible&&e?j={toShow:a([]),toHide:c,complete:i,down:f,autoHeight:h.autoHeight||h.fillSpace}:j={toShow:b,toHide:c,complete:i,down:f,autoHeight:h.autoHeight||h.fillSpace},h.proxied||(h.proxied=h.animated),h.proxiedDuration||(h.proxiedDuration=h.duration),h.animated=a.isFunction(h.proxied)?h.proxied(j):h.proxied,h.duration=a.isFunction(h.proxiedDuration)?h.proxiedDuration(j):h.proxiedDuration;var k=a.ui.accordion.animations,l=h.duration,m=h.animated;m&&!k[m]&&!a.easing[m]&&(m='slide'),k[m]||(k[m]=function(a){this.slide(a,{easing:m,duration:l||700});}),k[m](j);}else h.collapsible&&e?b.toggle():(c.hide(),b.show()),i(!0);c.prev().attr({'aria-expanded':'false','aria-selected':'false',tabIndex:-1}).blur(),b.prev().attr({'aria-expanded':'true','aria-selected':'true',tabIndex:0}).focus();},_completed:function(a){this.running=a?0:--this.running;this.running||(this.options.clearStyle&&this.toShow.add(this.toHide).css({height:'',overflow:''}),this.toHide.removeClass('ui-accordion-content-active'),this.toHide.length&&(this.toHide.parent()[0].className=this.toHide.parent()[0].className),this._trigger('change',null,this.data));}}),a.extend(a.ui.accordion,{version:'1.8.17',animations:{slide:function(b,c){b=a.extend({easing:'swing',duration:300},b,c);if(!b.toHide.size())b.toShow.animate({height:'show',paddingTop:'show',paddingBottom:'show'},b);else{if(!b.toShow.size()){b.toHide.animate({height:'hide',paddingTop:'hide',paddingBottom:'hide'},b);return;}var d=b.toShow.css('overflow'),e=0,f={},g={},h=['height','paddingTop','paddingBottom'],i,j=b.toShow;i=j[0].style.width,j.width(j.parent().width()-parseFloat(j.css('paddingLeft'))-parseFloat(j.css('paddingRight'))-(parseFloat(j.css('borderLeftWidth'))||0)-(parseFloat(j.css('borderRightWidth'))||0)),a.each(h,function(c,d){g[d]='hide';var e=(''+a.css(b.toShow[0],d)).match(/^([\d+-.]+)(.*)$/);f[d]={value:e[1],unit:e[2]||'px'};}),b.toShow.css({height:0,overflow:'hidden'}).show(),b.toHide.filter(':hidden').each(b.complete).end().filter(':visible').animate(g,{step:function(a,c){c.prop=='height'&&(e=c.end-c.start===0?0:(c.now-c.start)/(c.end-c.start)),b.toShow[0].style[c.prop]=e*f[c.prop].value+f[c.prop].unit;},duration:b.duration,easing:b.easing,complete:function(){b.autoHeight||b.toShow.css('height',''),b.toShow.css({width:i,overflow:d}),b.complete();}});}},bounceslide:function(a){this.slide(a,{easing:a.down?'easeOutBounce':'swing',duration:a.down?1e3:200});}}});})(jQuery);/* * jQuery UI Autocomplete 1.8.17 * * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) @@ -58,7 +58,7 @@ * jquery.ui.core.js * jquery.ui.widget.js * jquery.ui.position.js - */(function(a,b){var c=0;a.widget("ui.autocomplete",{options:{appendTo:"body",autoFocus:!1,delay:300,minLength:1,position:{my:"left top",at:"left bottom",collision:"none"},source:null},pending:0,_create:function(){var b=this,c=this.element[0].ownerDocument,d;this.element.addClass("ui-autocomplete-input").attr("autocomplete","off").attr({role:"textbox","aria-autocomplete":"list","aria-haspopup":"true"}).bind("keydown.autocomplete",function(c){if(!b.options.disabled&&!b.element.propAttr("readOnly")){d=!1;var e=a.ui.keyCode;switch(c.keyCode){case e.PAGE_UP:b._move("previousPage",c);break;case e.PAGE_DOWN:b._move("nextPage",c);break;case e.UP:b._move("previous",c),c.preventDefault();break;case e.DOWN:b._move("next",c),c.preventDefault();break;case e.ENTER:case e.NUMPAD_ENTER:b.menu.active&&(d=!0,c.preventDefault());case e.TAB:if(!b.menu.active)return;b.menu.select(c);break;case e.ESCAPE:b.element.val(b.term),b.close(c);break;default:clearTimeout(b.searching),b.searching=setTimeout(function(){b.term!=b.element.val()&&(b.selectedItem=null,b.search(null,c));},b.options.delay);}}}).bind("keypress.autocomplete",function(a){d&&(d=!1,a.preventDefault());}).bind("focus.autocomplete",function(){b.options.disabled||(b.selectedItem=null,b.previous=b.element.val());}).bind("blur.autocomplete",function(a){b.options.disabled||(clearTimeout(b.searching),b.closing=setTimeout(function(){b.close(a),b._change(a);},150));}),this._initSource(),this.response=function(){return b._response.apply(b,arguments);},this.menu=a("
      ").addClass("ui-autocomplete").appendTo(a(this.options.appendTo||"body",c)[0]).mousedown(function(c){var d=b.menu.element[0];a(c.target).closest(".ui-menu-item").length||setTimeout(function(){a(document).one("mousedown",function(c){c.target!==b.element[0]&&c.target!==d&&!a.ui.contains(d,c.target)&&b.close();});},1),setTimeout(function(){clearTimeout(b.closing);},13);}).menu({focus:function(a,c){var d=c.item.data("item.autocomplete");!1!==b._trigger("focus",a,{item:d})&&/^key/.test(a.originalEvent.type)&&b.element.val(d.value);},selected:function(a,d){var e=d.item.data("item.autocomplete"),f=b.previous;b.element[0]!==c.activeElement&&(b.element.focus(),b.previous=f,setTimeout(function(){b.previous=f,b.selectedItem=e;},1)),!1!==b._trigger("select",a,{item:e})&&b.element.val(e.value),b.term=b.element.val(),b.close(a),b.selectedItem=e;},blur:function(a,c){b.menu.element.is(":visible")&&b.element.val()!==b.term&&b.element.val(b.term);}}).zIndex(this.element.zIndex()+1).css({top:0,left:0}).hide().data("menu"),a.fn.bgiframe&&this.menu.element.bgiframe(),b.beforeunloadHandler=function(){b.element.removeAttr("autocomplete");},a(window).bind("beforeunload",b.beforeunloadHandler);},destroy:function(){this.element.removeClass("ui-autocomplete-input").removeAttr("autocomplete").removeAttr("role").removeAttr("aria-autocomplete").removeAttr("aria-haspopup"),this.menu.element.remove(),a(window).unbind("beforeunload",this.beforeunloadHandler),a.Widget.prototype.destroy.call(this);},_setOption:function(b,c){a.Widget.prototype._setOption.apply(this,arguments),b==="source"&&this._initSource(),b==="appendTo"&&this.menu.element.appendTo(a(c||"body",this.element[0].ownerDocument)[0]),b==="disabled"&&c&&this.xhr&&this.xhr.abort();},_initSource:function(){var b=this,d,e;a.isArray(this.options.source)?(d=this.options.source,this.source=function(b,c){c(a.ui.autocomplete.filter(d,b.term));}):typeof this.options.source=="string"?(e=this.options.source,this.source=function(d,f){b.xhr&&b.xhr.abort(),b.xhr=a.ajax({url:e,data:d,dataType:"json",autocompleteRequest:++c,success:function(a,b){this.autocompleteRequest===c&&f(a);},error:function(){this.autocompleteRequest===c&&f([]);}});}):this.source=this.options.source;},search:function(a,b){a=a!=null?a:this.element.val(),this.term=this.element.val();if(a.length").data("item.autocomplete",c).append(a("").text(c.label)).appendTo(b);},_move:function(a,b){if(!this.menu.element.is(":visible"))this.search(null,b);else{if(this.menu.first()&&/^previous/.test(a)||this.menu.last()&&/^next/.test(a)){this.element.val(this.term),this.menu.deactivate();return;}this.menu[a](b);}},widget:function(){return this.menu.element;}}),a.extend(a.ui.autocomplete,{escapeRegex:function(a){return a.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&");},filter:function(b,c){var d=new RegExp(a.ui.autocomplete.escapeRegex(c),"i");return a.grep(b,function(a){return d.test(a.label||a.value||a);});}});})(jQuery),function(a){a.widget("ui.menu",{_create:function(){var b=this;this.element.addClass("ui-menu ui-widget ui-widget-content ui-corner-all").attr({role:"listbox","aria-activedescendant":"ui-active-menuitem"}).click(function(c){!a(c.target).closest(".ui-menu-item a").length||(c.preventDefault(),b.select(c));}),this.refresh();},refresh:function(){var b=this,c=this.element.children("li:not(.ui-menu-item):has(a)").addClass("ui-menu-item").attr("role","menuitem");c.children("a").addClass("ui-corner-all").attr("tabindex",-1).mouseenter(function(c){b.activate(c,a(this).parent());}).mouseleave(function(){b.deactivate();});},activate:function(a,b){this.deactivate();if(this.hasScroll()){var c=b.offset().top-this.element.offset().top,d=this.element.scrollTop(),e=this.element.height();c<0?this.element.scrollTop(d+c):c>=e&&this.element.scrollTop(d+c-e+b.height());}this.active=b.eq(0).children("a").addClass("ui-state-hover").attr("id","ui-active-menuitem").end(),this._trigger("focus",a,{item:b});},deactivate:function(){!this.active||(this.active.children("a").removeClass("ui-state-hover").removeAttr("id"),this._trigger("blur"),this.active=null);},next:function(a){this.move("next",".ui-menu-item:first",a);},previous:function(a){this.move("prev",".ui-menu-item:last",a);},first:function(){return this.active&&!this.active.prevAll(".ui-menu-item").length;},last:function(){return this.active&&!this.active.nextAll(".ui-menu-item").length;},move:function(a,b,c){if(!this.active)this.activate(c,this.element.children(b));else{var d=this.active[a+"All"](".ui-menu-item").eq(0);d.length?this.activate(c,d):this.activate(c,this.element.children(b));}},nextPage:function(b){if(this.hasScroll()){if(!this.active||this.last()){this.activate(b,this.element.children(".ui-menu-item:first"));return;}var c=this.active.offset().top,d=this.element.height(),e=this.element.children(".ui-menu-item").filter(function(){var b=a(this).offset().top-c-d+a(this).height();return b<10&&b>-10;});e.length||(e=this.element.children(".ui-menu-item:last")),this.activate(b,e);}else this.activate(b,this.element.children(".ui-menu-item").filter(!this.active||this.last()?":first":":last"));},previousPage:function(b){if(this.hasScroll()){if(!this.active||this.first()){this.activate(b,this.element.children(".ui-menu-item:last"));return;}var c=this.active.offset().top,d=this.element.height();result=this.element.children(".ui-menu-item").filter(function(){var b=a(this).offset().top-c+d-a(this).height();return b<10&&b>-10;}),result.length||(result=this.element.children(".ui-menu-item:first")),this.activate(b,result);}else this.activate(b,this.element.children(".ui-menu-item").filter(!this.active||this.first()?":last":":first"));},hasScroll:function(){return this.element.height()').addClass('ui-autocomplete').appendTo(a(this.options.appendTo||'body',c)[0]).mousedown(function(c){var d=b.menu.element[0];a(c.target).closest('.ui-menu-item').length||setTimeout(function(){a(document).one('mousedown',function(c){c.target!==b.element[0]&&c.target!==d&&!a.ui.contains(d,c.target)&&b.close();});},1),setTimeout(function(){clearTimeout(b.closing);},13);}).menu({focus:function(a,c){var d=c.item.data('item.autocomplete');!1!==b._trigger('focus',a,{item:d})&&/^key/.test(a.originalEvent.type)&&b.element.val(d.value);},selected:function(a,d){var e=d.item.data('item.autocomplete'),f=b.previous;b.element[0]!==c.activeElement&&(b.element.focus(),b.previous=f,setTimeout(function(){b.previous=f,b.selectedItem=e;},1)),!1!==b._trigger('select',a,{item:e})&&b.element.val(e.value),b.term=b.element.val(),b.close(a),b.selectedItem=e;},blur:function(a,c){b.menu.element.is(':visible')&&b.element.val()!==b.term&&b.element.val(b.term);}}).zIndex(this.element.zIndex()+1).css({top:0,left:0}).hide().data('menu'),a.fn.bgiframe&&this.menu.element.bgiframe(),b.beforeunloadHandler=function(){b.element.removeAttr('autocomplete');},a(window).bind('beforeunload',b.beforeunloadHandler);},destroy:function(){this.element.removeClass('ui-autocomplete-input').removeAttr('autocomplete').removeAttr('role').removeAttr('aria-autocomplete').removeAttr('aria-haspopup'),this.menu.element.remove(),a(window).unbind('beforeunload',this.beforeunloadHandler),a.Widget.prototype.destroy.call(this);},_setOption:function(b,c){a.Widget.prototype._setOption.apply(this,arguments),b==='source'&&this._initSource(),b==='appendTo'&&this.menu.element.appendTo(a(c||'body',this.element[0].ownerDocument)[0]),b==='disabled'&&c&&this.xhr&&this.xhr.abort();},_initSource:function(){var b=this,d,e;a.isArray(this.options.source)?(d=this.options.source,this.source=function(b,c){c(a.ui.autocomplete.filter(d,b.term));}):typeof this.options.source=='string'?(e=this.options.source,this.source=function(d,f){b.xhr&&b.xhr.abort(),b.xhr=a.ajax({url:e,data:d,dataType:'json',autocompleteRequest:++c,success:function(a,b){this.autocompleteRequest===c&&f(a);},error:function(){this.autocompleteRequest===c&&f([]);}});}):this.source=this.options.source;},search:function(a,b){a=a!=null?a:this.element.val(),this.term=this.element.val();if(a.length').data('item.autocomplete',c).append(a('').text(c.label)).appendTo(b);},_move:function(a,b){if(!this.menu.element.is(':visible'))this.search(null,b);else{if(this.menu.first()&&/^previous/.test(a)||this.menu.last()&&/^next/.test(a)){this.element.val(this.term),this.menu.deactivate();return;}this.menu[a](b);}},widget:function(){return this.menu.element;}}),a.extend(a.ui.autocomplete,{escapeRegex:function(a){return a.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,'\\$&');},filter:function(b,c){var d=new RegExp(a.ui.autocomplete.escapeRegex(c),'i');return a.grep(b,function(a){return d.test(a.label||a.value||a);});}});})(jQuery),function(a){a.widget('ui.menu',{_create:function(){var b=this;this.element.addClass('ui-menu ui-widget ui-widget-content ui-corner-all').attr({role:'listbox','aria-activedescendant':'ui-active-menuitem'}).click(function(c){!a(c.target).closest('.ui-menu-item a').length||(c.preventDefault(),b.select(c));}),this.refresh();},refresh:function(){var b=this,c=this.element.children('li:not(.ui-menu-item):has(a)').addClass('ui-menu-item').attr('role','menuitem');c.children('a').addClass('ui-corner-all').attr('tabindex',-1).mouseenter(function(c){b.activate(c,a(this).parent());}).mouseleave(function(){b.deactivate();});},activate:function(a,b){this.deactivate();if(this.hasScroll()){var c=b.offset().top-this.element.offset().top,d=this.element.scrollTop(),e=this.element.height();c<0?this.element.scrollTop(d+c):c>=e&&this.element.scrollTop(d+c-e+b.height());}this.active=b.eq(0).children('a').addClass('ui-state-hover').attr('id','ui-active-menuitem').end(),this._trigger('focus',a,{item:b});},deactivate:function(){!this.active||(this.active.children('a').removeClass('ui-state-hover').removeAttr('id'),this._trigger('blur'),this.active=null);},next:function(a){this.move('next','.ui-menu-item:first',a);},previous:function(a){this.move('prev','.ui-menu-item:last',a);},first:function(){return this.active&&!this.active.prevAll('.ui-menu-item').length;},last:function(){return this.active&&!this.active.nextAll('.ui-menu-item').length;},move:function(a,b,c){if(!this.active)this.activate(c,this.element.children(b));else{var d=this.active[a+'All']('.ui-menu-item').eq(0);d.length?this.activate(c,d):this.activate(c,this.element.children(b));}},nextPage:function(b){if(this.hasScroll()){if(!this.active||this.last()){this.activate(b,this.element.children('.ui-menu-item:first'));return;}var c=this.active.offset().top,d=this.element.height(),e=this.element.children('.ui-menu-item').filter(function(){var b=a(this).offset().top-c-d+a(this).height();return b<10&&b>-10;});e.length||(e=this.element.children('.ui-menu-item:last')),this.activate(b,e);}else this.activate(b,this.element.children('.ui-menu-item').filter(!this.active||this.last()?':first':':last'));},previousPage:function(b){if(this.hasScroll()){if(!this.active||this.first()){this.activate(b,this.element.children('.ui-menu-item:last'));return;}var c=this.active.offset().top,d=this.element.height();result=this.element.children('.ui-menu-item').filter(function(){var b=a(this).offset().top-c+d-a(this).height();return b<10&&b>-10;}),result.length||(result=this.element.children('.ui-menu-item:first')),this.activate(b,result);}else this.activate(b,this.element.children('.ui-menu-item').filter(!this.active||this.first()?':last':':first'));},hasScroll:function(){return this.element.height()",this.element[0].ownerDocument).addClass("ui-button-text").html(this.options.label).appendTo(b.empty()).text(),d=this.options.icons,e=d.primary&&d.secondary,f=[];d.primary||d.secondary?(this.options.text&&f.push("ui-button-text-icon"+(e?"s":d.primary?"-primary":"-secondary")),d.primary&&b.prepend(""),d.secondary&&b.append(""),this.options.text||(f.push(e?"ui-button-icons-only":"ui-button-icon-only"),this.hasTitle||b.attr("title",c))):f.push("ui-button-text-only"),b.addClass(f.join(" "));}}}),a.widget("ui.buttonset",{options:{items:":button, :submit, :reset, :checkbox, :radio, a, :data(button)"},_create:function(){this.element.addClass("ui-buttonset");},_init:function(){this.refresh();},_setOption:function(b,c){b==="disabled"&&this.buttons.button("option",b,c),a.Widget.prototype._setOption.apply(this,arguments);},refresh:function(){var b=this.element.css("direction")==="rtl";this.buttons=this.element.find(this.options.items).filter(":ui-button").button("refresh").end().not(":ui-button").button().end().map(function(){return a(this).button("widget")[0];}).removeClass("ui-corner-all ui-corner-left ui-corner-right").filter(":first").addClass(b?"ui-corner-right":"ui-corner-left").end().filter(":last").addClass(b?"ui-corner-left":"ui-corner-right").end().end();},destroy:function(){this.element.removeClass("ui-buttonset"),this.buttons.map(function(){return a(this).button("widget")[0];}).removeClass("ui-corner-left ui-corner-right").end().button("destroy"),a.Widget.prototype.destroy.call(this);}});})(jQuery);/* + */(function(a,b){var c,d,e,f,g='ui-button ui-widget ui-state-default ui-corner-all',h='ui-state-hover ui-state-active ',i='ui-button-icons-only ui-button-icon-only ui-button-text-icons ui-button-text-icon-primary ui-button-text-icon-secondary ui-button-text-only',j=function(){var b=a(this).find(':ui-button');setTimeout(function(){b.button('refresh');},1);},k=function(b){var c=b.name,d=b.form,e=a([]);c&&(d?e=a(d).find('[name=\''+c+'\']'):e=a('[name=\''+c+'\']',b.ownerDocument).filter(function(){return!this.form;}));return e;};a.widget('ui.button',{options:{disabled:null,text:!0,label:null,icons:{primary:null,secondary:null}},_create:function(){this.element.closest('form').unbind('reset.button').bind('reset.button',j),typeof this.options.disabled!='boolean'&&(this.options.disabled=this.element.propAttr('disabled')),this._determineButtonType(),this.hasTitle=!!this.buttonElement.attr('title');var b=this,h=this.options,i=this.type==='checkbox'||this.type==='radio',l='ui-state-hover'+(i?'':' ui-state-active'),m='ui-state-focus';h.label===null&&(h.label=this.buttonElement.html()),this.element.is(':disabled')&&(h.disabled=!0),this.buttonElement.addClass(g).attr('role','button').bind('mouseenter.button',function(){h.disabled||(a(this).addClass('ui-state-hover'),this===c&&a(this).addClass('ui-state-active'));}).bind('mouseleave.button',function(){h.disabled||a(this).removeClass(l);}).bind('click.button',function(a){h.disabled&&(a.preventDefault(),a.stopImmediatePropagation());}),this.element.bind('focus.button',function(){b.buttonElement.addClass(m);}).bind('blur.button',function(){b.buttonElement.removeClass(m);}),i&&(this.element.bind('change.button',function(){f||b.refresh();}),this.buttonElement.bind('mousedown.button',function(a){h.disabled||(f=!1,d=a.pageX,e=a.pageY);}).bind('mouseup.button',function(a){!h.disabled&&(d!==a.pageX||e!==a.pageY)&&(f=!0);})),this.type==='checkbox'?this.buttonElement.bind('click.button',function(){if(h.disabled||f)return!1;a(this).toggleClass('ui-state-active'),b.buttonElement.attr('aria-pressed',b.element[0].checked);}):this.type==='radio'?this.buttonElement.bind('click.button',function(){if(h.disabled||f)return!1;a(this).addClass('ui-state-active'),b.buttonElement.attr('aria-pressed','true');var c=b.element[0];k(c).not(c).map(function(){return a(this).button('widget')[0];}).removeClass('ui-state-active').attr('aria-pressed','false');}):(this.buttonElement.bind('mousedown.button',function(){if(h.disabled)return!1;a(this).addClass('ui-state-active'),c=this,a(document).one('mouseup',function(){c=null;});}).bind('mouseup.button',function(){if(h.disabled)return!1;a(this).removeClass('ui-state-active');}).bind('keydown.button',function(b){if(h.disabled)return!1;(b.keyCode==a.ui.keyCode.SPACE||b.keyCode==a.ui.keyCode.ENTER)&&a(this).addClass('ui-state-active');}).bind('keyup.button',function(){a(this).removeClass('ui-state-active');}),this.buttonElement.is('a')&&this.buttonElement.keyup(function(b){b.keyCode===a.ui.keyCode.SPACE&&a(this).click();})),this._setOption('disabled',h.disabled),this._resetButton();},_determineButtonType:function(){this.element.is(':checkbox')?this.type='checkbox':this.element.is(':radio')?this.type='radio':this.element.is('input')?this.type='input':this.type='button';if(this.type==='checkbox'||this.type==='radio'){var a=this.element.parents().filter(':last'),b='label[for=\''+this.element.attr('id')+'\']';this.buttonElement=a.find(b),this.buttonElement.length||(a=a.length?a.siblings():this.element.siblings(),this.buttonElement=a.filter(b),this.buttonElement.length||(this.buttonElement=a.find(b))),this.element.addClass('ui-helper-hidden-accessible');var c=this.element.is(':checked');c&&this.buttonElement.addClass('ui-state-active'),this.buttonElement.attr('aria-pressed',c);}else this.buttonElement=this.element;},widget:function(){return this.buttonElement;},destroy:function(){this.element.removeClass('ui-helper-hidden-accessible'),this.buttonElement.removeClass(g+' '+h+' '+i).removeAttr('role').removeAttr('aria-pressed').html(this.buttonElement.find('.ui-button-text').html()),this.hasTitle||this.buttonElement.removeAttr('title'),a.Widget.prototype.destroy.call(this);},_setOption:function(b,c){a.Widget.prototype._setOption.apply(this,arguments);b==='disabled'?c?this.element.propAttr('disabled',!0):this.element.propAttr('disabled',!1):this._resetButton();},refresh:function(){var b=this.element.is(':disabled');b!==this.options.disabled&&this._setOption('disabled',b),this.type==='radio'?k(this.element[0]).each(function(){a(this).is(':checked')?a(this).button('widget').addClass('ui-state-active').attr('aria-pressed','true'):a(this).button('widget').removeClass('ui-state-active').attr('aria-pressed','false');}):this.type==='checkbox'&&(this.element.is(':checked')?this.buttonElement.addClass('ui-state-active').attr('aria-pressed','true'):this.buttonElement.removeClass('ui-state-active').attr('aria-pressed','false'));},_resetButton:function(){if(this.type==='input')this.options.label&&this.element.val(this.options.label);else{var b=this.buttonElement.removeClass(i),c=a('',this.element[0].ownerDocument).addClass('ui-button-text').html(this.options.label).appendTo(b.empty()).text(),d=this.options.icons,e=d.primary&&d.secondary,f=[];d.primary||d.secondary?(this.options.text&&f.push('ui-button-text-icon'+(e?'s':d.primary?'-primary':'-secondary')),d.primary&&b.prepend(''),d.secondary&&b.append(''),this.options.text||(f.push(e?'ui-button-icons-only':'ui-button-icon-only'),this.hasTitle||b.attr('title',c))):f.push('ui-button-text-only'),b.addClass(f.join(' '));}}}),a.widget('ui.buttonset',{options:{items:':button, :submit, :reset, :checkbox, :radio, a, :data(button)'},_create:function(){this.element.addClass('ui-buttonset');},_init:function(){this.refresh();},_setOption:function(b,c){b==='disabled'&&this.buttons.button('option',b,c),a.Widget.prototype._setOption.apply(this,arguments);},refresh:function(){var b=this.element.css('direction')==='rtl';this.buttons=this.element.find(this.options.items).filter(':ui-button').button('refresh').end().not(':ui-button').button().end().map(function(){return a(this).button('widget')[0];}).removeClass('ui-corner-all ui-corner-left ui-corner-right').filter(':first').addClass(b?'ui-corner-right':'ui-corner-left').end().filter(':last').addClass(b?'ui-corner-left':'ui-corner-right').end().end();},destroy:function(){this.element.removeClass('ui-buttonset'),this.buttons.map(function(){return a(this).button('widget')[0];}).removeClass('ui-corner-left ui-corner-right').end().button('destroy'),a.Widget.prototype.destroy.call(this);}});})(jQuery);/* * jQuery UI Dialog 1.8.17 * * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) @@ -87,7 +87,7 @@ * jquery.ui.mouse.js * jquery.ui.position.js * jquery.ui.resizable.js - */(function(a,b){var c="ui-dialog ui-widget ui-widget-content ui-corner-all ",d={buttons:!0,height:!0,maxHeight:!0,maxWidth:!0,minHeight:!0,minWidth:!0,width:!0},e={maxHeight:!0,maxWidth:!0,minHeight:!0,minWidth:!0},f=a.attrFn||{val:!0,css:!0,html:!0,text:!0,data:!0,width:!0,height:!0,offset:!0,click:!0};a.widget("ui.dialog",{options:{autoOpen:!0,buttons:{},closeOnEscape:!0,closeText:"close",dialogClass:"",draggable:!0,hide:null,height:"auto",maxHeight:!1,maxWidth:!1,minHeight:150,minWidth:150,modal:!1,position:{my:"center",at:"center",collision:"fit",using:function(b){var c=a(this).css(b).offset().top;c<0&&a(this).css("top",b.top-c);}},resizable:!0,show:null,stack:!0,title:"",width:300,zIndex:1e3},_create:function(){this.originalTitle=this.element.attr("title"),typeof this.originalTitle!="string"&&(this.originalTitle=""),this.options.title=this.options.title||this.originalTitle;var b=this,d=b.options,e=d.title||" ",f=a.ui.dialog.getTitleId(b.element),g=(b.uiDialog=a("
      ")).appendTo(document.body).hide().addClass(c+d.dialogClass).css({zIndex:d.zIndex}).attr("tabIndex",-1).css("outline",0).keydown(function(c){d.closeOnEscape&&!c.isDefaultPrevented()&&c.keyCode&&c.keyCode===a.ui.keyCode.ESCAPE&&(b.close(c),c.preventDefault());}).attr({role:"dialog","aria-labelledby":f}).mousedown(function(a){b.moveToTop(!1,a);}),h=b.element.show().removeAttr("title").addClass("ui-dialog-content ui-widget-content").appendTo(g),i=(b.uiDialogTitlebar=a("
      ")).addClass("ui-dialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix").prependTo(g),j=a("").addClass("ui-dialog-titlebar-close ui-corner-all").attr("role","button").hover(function(){j.addClass("ui-state-hover");},function(){j.removeClass("ui-state-hover");}).focus(function(){j.addClass("ui-state-focus");}).blur(function(){j.removeClass("ui-state-focus");}).click(function(a){b.close(a);return!1;}).appendTo(i),k=(b.uiDialogTitlebarCloseText=a("")).addClass("ui-icon ui-icon-closethick").text(d.closeText).appendTo(j),l=a("").addClass("ui-dialog-title").attr("id",f).html(e).prependTo(i);a.isFunction(d.beforeclose)&&!a.isFunction(d.beforeClose)&&(d.beforeClose=d.beforeclose),i.find("*").add(i).disableSelection(),d.draggable&&a.fn.draggable&&b._makeDraggable(),d.resizable&&a.fn.resizable&&b._makeResizable(),b._createButtons(d.buttons),b._isOpen=!1,a.fn.bgiframe&&g.bgiframe();},_init:function(){this.options.autoOpen&&this.open();},destroy:function(){var a=this;a.overlay&&a.overlay.destroy(),a.uiDialog.hide(),a.element.unbind(".dialog").removeData("dialog").removeClass("ui-dialog-content ui-widget-content").hide().appendTo("body"),a.uiDialog.remove(),a.originalTitle&&a.element.attr("title",a.originalTitle);return a;},widget:function(){return this.uiDialog;},close:function(b){var c=this,d,e;if(!1!==c._trigger("beforeClose",b)){c.overlay&&c.overlay.destroy(),c.uiDialog.unbind("keypress.ui-dialog"),c._isOpen=!1,c.options.hide?c.uiDialog.hide(c.options.hide,function(){c._trigger("close",b);}):(c.uiDialog.hide(),c._trigger("close",b)),a.ui.dialog.overlay.resize(),c.options.modal&&(d=0,a(".ui-dialog").each(function(){this!==c.uiDialog[0]&&(e=a(this).css("z-index"),isNaN(e)||(d=Math.max(d,e)));}),a.ui.dialog.maxZ=d);return c;}},isOpen:function(){return this._isOpen;},moveToTop:function(b,c){var d=this,e=d.options,f;if(e.modal&&!b||!e.stack&&!e.modal)return d._trigger("focus",c);e.zIndex>a.ui.dialog.maxZ&&(a.ui.dialog.maxZ=e.zIndex),d.overlay&&(a.ui.dialog.maxZ+=1,d.overlay.$el.css("z-index",a.ui.dialog.overlay.maxZ=a.ui.dialog.maxZ)),f={scrollTop:d.element.scrollTop(),scrollLeft:d.element.scrollLeft()},a.ui.dialog.maxZ+=1,d.uiDialog.css("z-index",a.ui.dialog.maxZ),d.element.attr(f),d._trigger("focus",c);return d;},open:function(){if(!this._isOpen){var b=this,c=b.options,d=b.uiDialog;b.overlay=c.modal?new a.ui.dialog.overlay(b):null,b._size(),b._position(c.position),d.show(c.show),b.moveToTop(!0),c.modal&&d.bind("keydown.ui-dialog",function(b){if(b.keyCode===a.ui.keyCode.TAB){var c=a(":tabbable",this),d=c.filter(":first"),e=c.filter(":last");if(b.target===e[0]&&!b.shiftKey){d.focus(1);return!1;}if(b.target===d[0]&&b.shiftKey){e.focus(1);return!1;}}}),a(b.element.find(":tabbable").get().concat(d.find(".ui-dialog-buttonpane :tabbable").get().concat(d.get()))).eq(0).focus(),b._isOpen=!0,b._trigger("open");return b;}},_createButtons:function(b){var c=this,d=!1,e=a("
      ").addClass("ui-dialog-buttonpane ui-widget-content ui-helper-clearfix"),g=a("
      ").addClass("ui-dialog-buttonset").appendTo(e);c.uiDialog.find(".ui-dialog-buttonpane").remove(),typeof b=="object"&&b!==null&&a.each(b,function(){return!(d=!0);}),d&&(a.each(b,function(b,d){d=a.isFunction(d)?{click:d,text:b}:d;var e=a("").click(function(){d.click.apply(c.element[0],arguments);}).appendTo(g);a.each(d,function(a,b){a!=="click"&&(a in f?e[a](b):e.attr(a,b));}),a.fn.button&&e.button();}),e.appendTo(c.uiDialog));},_makeDraggable:function(){function f(a){return{position:a.position,offset:a.offset};}var b=this,c=b.options,d=a(document),e;b.uiDialog.draggable({cancel:".ui-dialog-content, .ui-dialog-titlebar-close",handle:".ui-dialog-titlebar",containment:"document",start:function(d,g){e=c.height==="auto"?"auto":a(this).height(),a(this).height(a(this).height()).addClass("ui-dialog-dragging"),b._trigger("dragStart",d,f(g));},drag:function(a,c){b._trigger("drag",a,f(c));},stop:function(g,h){c.position=[h.position.left-d.scrollLeft(),h.position.top-d.scrollTop()],a(this).removeClass("ui-dialog-dragging").height(e),b._trigger("dragStop",g,f(h)),a.ui.dialog.overlay.resize();}});},_makeResizable:function(c){function h(a){return{originalPosition:a.originalPosition,originalSize:a.originalSize,position:a.position,size:a.size};}c=c===b?this.options.resizable:c;var d=this,e=d.options,f=d.uiDialog.css("position"),g=typeof c=="string"?c:"n,e,s,w,se,sw,ne,nw";d.uiDialog.resizable({cancel:".ui-dialog-content",containment:"document",alsoResize:d.element,maxWidth:e.maxWidth,maxHeight:e.maxHeight,minWidth:e.minWidth,minHeight:d._minHeight(),handles:g,start:function(b,c){a(this).addClass("ui-dialog-resizing"),d._trigger("resizeStart",b,h(c));},resize:function(a,b){d._trigger("resize",a,h(b));},stop:function(b,c){a(this).removeClass("ui-dialog-resizing"),e.height=a(this).height(),e.width=a(this).width(),d._trigger("resizeStop",b,h(c)),a.ui.dialog.overlay.resize();}}).css("position",f).find(".ui-resizable-se").addClass("ui-icon ui-icon-grip-diagonal-se");},_minHeight:function(){var a=this.options;return a.height==="auto"?a.minHeight:Math.min(a.minHeight,a.height);},_position:function(b){var c=[],d=[0,0],e;if(b){if(typeof b=="string"||typeof b=="object"&&"0"in b)c=b.split?b.split(" "):[b[0],b[1]],c.length===1&&(c[1]=c[0]),a.each(["left","top"],function(a,b){+c[a]===c[a]&&(d[a]=c[a],c[a]=b);}),b={my:c.join(" "),at:c.join(" "),offset:d.join(" ")};b=a.extend({},a.ui.dialog.prototype.options.position,b);}else b=a.ui.dialog.prototype.options.position;e=this.uiDialog.is(":visible"),e||this.uiDialog.show(),this.uiDialog.css({top:0,left:0}).position(a.extend({of:window},b)),e||this.uiDialog.hide();},_setOptions:function(b){var c=this,f={},g=!1;a.each(b,function(a,b){c._setOption(a,b),a in d&&(g=!0),a in e&&(f[a]=b);}),g&&this._size(),this.uiDialog.is(":data(resizable)")&&this.uiDialog.resizable("option",f);},_setOption:function(b,d){var e=this,f=e.uiDialog;switch(b){case"beforeclose":b="beforeClose";break;case"buttons":e._createButtons(d);break;case"closeText":e.uiDialogTitlebarCloseText.text(""+d);break;case"dialogClass":f.removeClass(e.options.dialogClass).addClass(c+d);break;case"disabled":d?f.addClass("ui-dialog-disabled"):f.removeClass("ui-dialog-disabled");break;case"draggable":var g=f.is(":data(draggable)");g&&!d&&f.draggable("destroy"),!g&&d&&e._makeDraggable();break;case"position":e._position(d);break;case"resizable":var h=f.is(":data(resizable)");h&&!d&&f.resizable("destroy"),h&&typeof d=="string"&&f.resizable("option","handles",d),!h&&d!==!1&&e._makeResizable(d);break;case"title":a(".ui-dialog-title",e.uiDialogTitlebar).html(""+(d||" "));}a.Widget.prototype._setOption.apply(e,arguments);},_size:function(){var b=this.options,c,d,e=this.uiDialog.is(":visible");this.element.show().css({width:"auto",minHeight:0,height:0}),b.minWidth>b.width&&(b.width=b.minWidth),c=this.uiDialog.css({height:"auto",width:b.width}).height(),d=Math.max(0,b.minHeight-c);if(b.height==="auto")if(a.support.minHeight)this.element.css({minHeight:d,height:"auto"});else{this.uiDialog.show();var f=this.element.css("height","auto").height();e||this.uiDialog.hide(),this.element.height(Math.max(f,d));}else this.element.height(Math.max(b.height-c,0));this.uiDialog.is(":data(resizable)")&&this.uiDialog.resizable("option","minHeight",this._minHeight());}}),a.extend(a.ui.dialog,{version:"1.8.17",uuid:0,maxZ:0,getTitleId:function(a){var b=a.attr("id");b||(this.uuid+=1,b=this.uuid);return"ui-dialog-title-"+b;},overlay:function(b){this.$el=a.ui.dialog.overlay.create(b);}}),a.extend(a.ui.dialog.overlay,{instances:[],oldInstances:[],maxZ:0,events:a.map("focus,mousedown,mouseup,keydown,keypress,click".split(","),function(a){return a+".dialog-overlay";}).join(" "),create:function(b){this.instances.length===0&&(setTimeout(function(){a.ui.dialog.overlay.instances.length&&a(document).bind(a.ui.dialog.overlay.events,function(b){if(a(b.target).zIndex()
      ").addClass("ui-widget-overlay")).appendTo(document.body).css({width:this.width(),height:this.height()});a.fn.bgiframe&&c.bgiframe(),this.instances.push(c);return c;},destroy:function(b){var c=a.inArray(b,this.instances);c!=-1&&this.oldInstances.push(this.instances.splice(c,1)[0]),this.instances.length===0&&a([document,window]).unbind(".dialog-overlay"),b.remove();var d=0;a.each(this.instances,function(){d=Math.max(d,this.css("z-index"));}),this.maxZ=d;},height:function(){var b,c;if(a.browser.msie&&a.browser.version<7){b=Math.max(document.documentElement.scrollHeight,document.body.scrollHeight),c=Math.max(document.documentElement.offsetHeight,document.body.offsetHeight);return b')).appendTo(document.body).hide().addClass(c+d.dialogClass).css({zIndex:d.zIndex}).attr('tabIndex',-1).css('outline',0).keydown(function(c){d.closeOnEscape&&!c.isDefaultPrevented()&&c.keyCode&&c.keyCode===a.ui.keyCode.ESCAPE&&(b.close(c),c.preventDefault());}).attr({role:'dialog','aria-labelledby':f}).mousedown(function(a){b.moveToTop(!1,a);}),h=b.element.show().removeAttr('title').addClass('ui-dialog-content ui-widget-content').appendTo(g),i=(b.uiDialogTitlebar=a('
      ')).addClass('ui-dialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix').prependTo(g),j=a('').addClass('ui-dialog-titlebar-close ui-corner-all').attr('role','button').hover(function(){j.addClass('ui-state-hover');},function(){j.removeClass('ui-state-hover');}).focus(function(){j.addClass('ui-state-focus');}).blur(function(){j.removeClass('ui-state-focus');}).click(function(a){b.close(a);return!1;}).appendTo(i),k=(b.uiDialogTitlebarCloseText=a('')).addClass('ui-icon ui-icon-closethick').text(d.closeText).appendTo(j),l=a('').addClass('ui-dialog-title').attr('id',f).html(e).prependTo(i);a.isFunction(d.beforeclose)&&!a.isFunction(d.beforeClose)&&(d.beforeClose=d.beforeclose),i.find('*').add(i).disableSelection(),d.draggable&&a.fn.draggable&&b._makeDraggable(),d.resizable&&a.fn.resizable&&b._makeResizable(),b._createButtons(d.buttons),b._isOpen=!1,a.fn.bgiframe&&g.bgiframe();},_init:function(){this.options.autoOpen&&this.open();},destroy:function(){var a=this;a.overlay&&a.overlay.destroy(),a.uiDialog.hide(),a.element.unbind('.dialog').removeData('dialog').removeClass('ui-dialog-content ui-widget-content').hide().appendTo('body'),a.uiDialog.remove(),a.originalTitle&&a.element.attr('title',a.originalTitle);return a;},widget:function(){return this.uiDialog;},close:function(b){var c=this,d,e;if(!1!==c._trigger('beforeClose',b)){c.overlay&&c.overlay.destroy(),c.uiDialog.unbind('keypress.ui-dialog'),c._isOpen=!1,c.options.hide?c.uiDialog.hide(c.options.hide,function(){c._trigger('close',b);}):(c.uiDialog.hide(),c._trigger('close',b)),a.ui.dialog.overlay.resize(),c.options.modal&&(d=0,a('.ui-dialog').each(function(){this!==c.uiDialog[0]&&(e=a(this).css('z-index'),isNaN(e)||(d=Math.max(d,e)));}),a.ui.dialog.maxZ=d);return c;}},isOpen:function(){return this._isOpen;},moveToTop:function(b,c){var d=this,e=d.options,f;if(e.modal&&!b||!e.stack&&!e.modal)return d._trigger('focus',c);e.zIndex>a.ui.dialog.maxZ&&(a.ui.dialog.maxZ=e.zIndex),d.overlay&&(a.ui.dialog.maxZ+=1,d.overlay.$el.css('z-index',a.ui.dialog.overlay.maxZ=a.ui.dialog.maxZ)),f={scrollTop:d.element.scrollTop(),scrollLeft:d.element.scrollLeft()},a.ui.dialog.maxZ+=1,d.uiDialog.css('z-index',a.ui.dialog.maxZ),d.element.attr(f),d._trigger('focus',c);return d;},open:function(){if(!this._isOpen){var b=this,c=b.options,d=b.uiDialog;b.overlay=c.modal?new a.ui.dialog.overlay(b):null,b._size(),b._position(c.position),d.show(c.show),b.moveToTop(!0),c.modal&&d.bind('keydown.ui-dialog',function(b){if(b.keyCode===a.ui.keyCode.TAB){var c=a(':tabbable',this),d=c.filter(':first'),e=c.filter(':last');if(b.target===e[0]&&!b.shiftKey){d.focus(1);return!1;}if(b.target===d[0]&&b.shiftKey){e.focus(1);return!1;}}}),a(b.element.find(':tabbable').get().concat(d.find('.ui-dialog-buttonpane :tabbable').get().concat(d.get()))).eq(0).focus(),b._isOpen=!0,b._trigger('open');return b;}},_createButtons:function(b){var c=this,d=!1,e=a('
      ').addClass('ui-dialog-buttonpane ui-widget-content ui-helper-clearfix'),g=a('
      ').addClass('ui-dialog-buttonset').appendTo(e);c.uiDialog.find('.ui-dialog-buttonpane').remove(),typeof b=='object'&&b!==null&&a.each(b,function(){return!(d=!0);}),d&&(a.each(b,function(b,d){d=a.isFunction(d)?{click:d,text:b}:d;var e=a('').click(function(){d.click.apply(c.element[0],arguments);}).appendTo(g);a.each(d,function(a,b){a!=='click'&&(a in f?e[a](b):e.attr(a,b));}),a.fn.button&&e.button();}),e.appendTo(c.uiDialog));},_makeDraggable:function(){function f(a){return{position:a.position,offset:a.offset};}var b=this,c=b.options,d=a(document),e;b.uiDialog.draggable({cancel:'.ui-dialog-content, .ui-dialog-titlebar-close',handle:'.ui-dialog-titlebar',containment:'document',start:function(d,g){e=c.height==='auto'?'auto':a(this).height(),a(this).height(a(this).height()).addClass('ui-dialog-dragging'),b._trigger('dragStart',d,f(g));},drag:function(a,c){b._trigger('drag',a,f(c));},stop:function(g,h){c.position=[h.position.left-d.scrollLeft(),h.position.top-d.scrollTop()],a(this).removeClass('ui-dialog-dragging').height(e),b._trigger('dragStop',g,f(h)),a.ui.dialog.overlay.resize();}});},_makeResizable:function(c){function h(a){return{originalPosition:a.originalPosition,originalSize:a.originalSize,position:a.position,size:a.size};}c=c===b?this.options.resizable:c;var d=this,e=d.options,f=d.uiDialog.css('position'),g=typeof c=='string'?c:'n,e,s,w,se,sw,ne,nw';d.uiDialog.resizable({cancel:'.ui-dialog-content',containment:'document',alsoResize:d.element,maxWidth:e.maxWidth,maxHeight:e.maxHeight,minWidth:e.minWidth,minHeight:d._minHeight(),handles:g,start:function(b,c){a(this).addClass('ui-dialog-resizing'),d._trigger('resizeStart',b,h(c));},resize:function(a,b){d._trigger('resize',a,h(b));},stop:function(b,c){a(this).removeClass('ui-dialog-resizing'),e.height=a(this).height(),e.width=a(this).width(),d._trigger('resizeStop',b,h(c)),a.ui.dialog.overlay.resize();}}).css('position',f).find('.ui-resizable-se').addClass('ui-icon ui-icon-grip-diagonal-se');},_minHeight:function(){var a=this.options;return a.height==='auto'?a.minHeight:Math.min(a.minHeight,a.height);},_position:function(b){var c=[],d=[0,0],e;if(b){if(typeof b=='string'||typeof b=='object'&&'0'in b)c=b.split?b.split(' '):[b[0],b[1]],c.length===1&&(c[1]=c[0]),a.each(['left','top'],function(a,b){+c[a]===c[a]&&(d[a]=c[a],c[a]=b);}),b={my:c.join(' '),at:c.join(' '),offset:d.join(' ')};b=a.extend({},a.ui.dialog.prototype.options.position,b);}else b=a.ui.dialog.prototype.options.position;e=this.uiDialog.is(':visible'),e||this.uiDialog.show(),this.uiDialog.css({top:0,left:0}).position(a.extend({of:window},b)),e||this.uiDialog.hide();},_setOptions:function(b){var c=this,f={},g=!1;a.each(b,function(a,b){c._setOption(a,b),a in d&&(g=!0),a in e&&(f[a]=b);}),g&&this._size(),this.uiDialog.is(':data(resizable)')&&this.uiDialog.resizable('option',f);},_setOption:function(b,d){var e=this,f=e.uiDialog;switch(b){case'beforeclose':b='beforeClose';break;case'buttons':e._createButtons(d);break;case'closeText':e.uiDialogTitlebarCloseText.text(''+d);break;case'dialogClass':f.removeClass(e.options.dialogClass).addClass(c+d);break;case'disabled':d?f.addClass('ui-dialog-disabled'):f.removeClass('ui-dialog-disabled');break;case'draggable':var g=f.is(':data(draggable)');g&&!d&&f.draggable('destroy'),!g&&d&&e._makeDraggable();break;case'position':e._position(d);break;case'resizable':var h=f.is(':data(resizable)');h&&!d&&f.resizable('destroy'),h&&typeof d=='string'&&f.resizable('option','handles',d),!h&&d!==!1&&e._makeResizable(d);break;case'title':a('.ui-dialog-title',e.uiDialogTitlebar).html(''+(d||' '));}a.Widget.prototype._setOption.apply(e,arguments);},_size:function(){var b=this.options,c,d,e=this.uiDialog.is(':visible');this.element.show().css({width:'auto',minHeight:0,height:0}),b.minWidth>b.width&&(b.width=b.minWidth),c=this.uiDialog.css({height:'auto',width:b.width}).height(),d=Math.max(0,b.minHeight-c);if(b.height==='auto')if(a.support.minHeight)this.element.css({minHeight:d,height:'auto'});else{this.uiDialog.show();var f=this.element.css('height','auto').height();e||this.uiDialog.hide(),this.element.height(Math.max(f,d));}else this.element.height(Math.max(b.height-c,0));this.uiDialog.is(':data(resizable)')&&this.uiDialog.resizable('option','minHeight',this._minHeight());}}),a.extend(a.ui.dialog,{version:'1.8.17',uuid:0,maxZ:0,getTitleId:function(a){var b=a.attr('id');b||(this.uuid+=1,b=this.uuid);return'ui-dialog-title-'+b;},overlay:function(b){this.$el=a.ui.dialog.overlay.create(b);}}),a.extend(a.ui.dialog.overlay,{instances:[],oldInstances:[],maxZ:0,events:a.map('focus,mousedown,mouseup,keydown,keypress,click'.split(','),function(a){return a+'.dialog-overlay';}).join(' '),create:function(b){this.instances.length===0&&(setTimeout(function(){a.ui.dialog.overlay.instances.length&&a(document).bind(a.ui.dialog.overlay.events,function(b){if(a(b.target).zIndex()').addClass('ui-widget-overlay')).appendTo(document.body).css({width:this.width(),height:this.height()});a.fn.bgiframe&&c.bgiframe(),this.instances.push(c);return c;},destroy:function(b){var c=a.inArray(b,this.instances);c!=-1&&this.oldInstances.push(this.instances.splice(c,1)[0]),this.instances.length===0&&a([document,window]).unbind('.dialog-overlay'),b.remove();var d=0;a.each(this.instances,function(){d=Math.max(d,this.css('z-index'));}),this.maxZ=d;},height:function(){var b,c;if(a.browser.msie&&a.browser.version<7){b=Math.max(document.documentElement.scrollHeight,document.body.scrollHeight),c=Math.max(document.documentElement.offsetHeight,document.body.offsetHeight);return b").appendTo(this.element).addClass("ui-slider-range ui-widget-header"+(d.range==="min"||d.range==="max"?" ui-slider-range-"+d.range:"")));for(var i=e.length;ic&&(f=c,g=a(this),i=b);}),c.range===!0&&this.values(1)===c.min&&(i+=1,g=a(this.handles[i])),j=this._start(b,i);if(j===!1)return!1;this._mouseSliding=!0,h._handleIndex=i,g.addClass("ui-state-active").focus(),k=g.offset(),l=!a(b.target).parents().andSelf().is(".ui-slider-handle"),this._clickOffset=l?{left:0,top:0}:{left:b.pageX-k.left-g.width()/2,top:b.pageY-k.top-g.height()/2-(parseInt(g.css("borderTopWidth"),10)||0)-(parseInt(g.css("borderBottomWidth"),10)||0)+(parseInt(g.css("marginTop"),10)||0)},this.handles.hasClass("ui-state-hover")||this._slide(b,i,e),this._animateOff=!0;return!0;},_mouseStart:function(a){return!0;},_mouseDrag:function(a){var b={x:a.pageX,y:a.pageY},c=this._normValueFromMouse(b);this._slide(a,this._handleIndex,c);return!1;},_mouseStop:function(a){this.handles.removeClass("ui-state-active"),this._mouseSliding=!1,this._stop(a,this._handleIndex),this._change(a,this._handleIndex),this._handleIndex=null,this._clickOffset=null,this._animateOff=!1;return!1;},_detectOrientation:function(){this.orientation=this.options.orientation==="vertical"?"vertical":"horizontal";},_normValueFromMouse:function(a){var b,c,d,e,f;this.orientation==="horizontal"?(b=this.elementSize.width,c=a.x-this.elementOffset.left-(this._clickOffset?this._clickOffset.left:0)):(b=this.elementSize.height,c=a.y-this.elementOffset.top-(this._clickOffset?this._clickOffset.top:0)),d=c/b,d>1&&(d=1),d<0&&(d=0),this.orientation==="vertical"&&(d=1-d),e=this._valueMax()-this._valueMin(),f=this._valueMin()+d*e;return this._trimAlignValue(f);},_start:function(a,b){var c={handle:this.handles[b],value:this.value()};this.options.values&&this.options.values.length&&(c.value=this.values(b),c.values=this.values());return this._trigger("start",a,c);},_slide:function(a,b,c){var d,e,f;this.options.values&&this.options.values.length?(d=this.values(b?0:1),this.options.values.length===2&&this.options.range===!0&&(b===0&&c>d||b===1&&c1)this.options.values[b]=this._trimAlignValue(c),this._refreshValue(),this._change(null,b);else{if(!arguments.length)return this._values();if(!a.isArray(arguments[0]))return this.options.values&&this.options.values.length?this._values(b):this.value();d=this.options.values,e=arguments[0];for(f=0;f=this._valueMax())return this._valueMax();var b=this.options.step>0?this.options.step:1,c=(a-this._valueMin())%b,d=a-c;Math.abs(c)*2>=b&&(d+=c>0?b:-b);return parseFloat(d.toFixed(5));},_valueMin:function(){return this.options.min;},_valueMax:function(){return this.options.max;},_refreshValue:function(){var b=this.options.range,c=this.options,d=this,e=this._animateOff?!1:c.animate,f,g={},h,i,j,k;this.options.values&&this.options.values.length?this.handles.each(function(b,i){f=(d.values(b)-d._valueMin())/(d._valueMax()-d._valueMin())*100,g[d.orientation==="horizontal"?"left":"bottom"]=f+"%",a(this).stop(1,1)[e?"animate":"css"](g,c.animate),d.options.range===!0&&(d.orientation==="horizontal"?(b===0&&d.range.stop(1,1)[e?"animate":"css"]({left:f+"%"},c.animate),b===1&&d.range[e?"animate":"css"]({width:f-h+"%"},{queue:!1,duration:c.animate})):(b===0&&d.range.stop(1,1)[e?"animate":"css"]({bottom:f+"%"},c.animate),b===1&&d.range[e?"animate":"css"]({height:f-h+"%"},{queue:!1,duration:c.animate}))),h=f;}):(i=this.value(),j=this._valueMin(),k=this._valueMax(),f=k!==j?(i-j)/(k-j)*100:0,g[d.orientation==="horizontal"?"left":"bottom"]=f+"%",this.handle.stop(1,1)[e?"animate":"css"](g,c.animate),b==="min"&&this.orientation==="horizontal"&&this.range.stop(1,1)[e?"animate":"css"]({width:f+"%"},c.animate),b==="max"&&this.orientation==="horizontal"&&this.range[e?"animate":"css"]({width:100-f+"%"},{queue:!1,duration:c.animate}),b==="min"&&this.orientation==="vertical"&&this.range.stop(1,1)[e?"animate":"css"]({height:f+"%"},c.animate),b==="max"&&this.orientation==="vertical"&&this.range[e?"animate":"css"]({height:100-f+"%"},{queue:!1,duration:c.animate}));}}),a.extend(a.ui.slider,{version:"1.8.17"});})(jQuery);/* + */(function(a,b){var c=5;a.widget('ui.slider',a.ui.mouse,{widgetEventPrefix:'slide',options:{animate:!1,distance:0,max:100,min:0,orientation:'horizontal',range:!1,step:1,value:0,values:null},_create:function(){var b=this,d=this.options,e=this.element.find('.ui-slider-handle').addClass('ui-state-default ui-corner-all'),f='',g=d.values&&d.values.length||1,h=[];this._keySliding=!1,this._mouseSliding=!1,this._animateOff=!0,this._handleIndex=null,this._detectOrientation(),this._mouseInit(),this.element.addClass('ui-slider ui-slider-'+this.orientation+' ui-widget'+' ui-widget-content'+' ui-corner-all'+(d.disabled?' ui-slider-disabled ui-disabled':'')),this.range=a([]),d.range&&(d.range===!0&&(d.values||(d.values=[this._valueMin(),this._valueMin()]),d.values.length&&d.values.length!==2&&(d.values=[d.values[0],d.values[0]])),this.range=a('
      ').appendTo(this.element).addClass('ui-slider-range ui-widget-header'+(d.range==='min'||d.range==='max'?' ui-slider-range-'+d.range:'')));for(var i=e.length;ic&&(f=c,g=a(this),i=b);}),c.range===!0&&this.values(1)===c.min&&(i+=1,g=a(this.handles[i])),j=this._start(b,i);if(j===!1)return!1;this._mouseSliding=!0,h._handleIndex=i,g.addClass('ui-state-active').focus(),k=g.offset(),l=!a(b.target).parents().andSelf().is('.ui-slider-handle'),this._clickOffset=l?{left:0,top:0}:{left:b.pageX-k.left-g.width()/2,top:b.pageY-k.top-g.height()/2-(parseInt(g.css('borderTopWidth'),10)||0)-(parseInt(g.css('borderBottomWidth'),10)||0)+(parseInt(g.css('marginTop'),10)||0)},this.handles.hasClass('ui-state-hover')||this._slide(b,i,e),this._animateOff=!0;return!0;},_mouseStart:function(a){return!0;},_mouseDrag:function(a){var b={x:a.pageX,y:a.pageY},c=this._normValueFromMouse(b);this._slide(a,this._handleIndex,c);return!1;},_mouseStop:function(a){this.handles.removeClass('ui-state-active'),this._mouseSliding=!1,this._stop(a,this._handleIndex),this._change(a,this._handleIndex),this._handleIndex=null,this._clickOffset=null,this._animateOff=!1;return!1;},_detectOrientation:function(){this.orientation=this.options.orientation==='vertical'?'vertical':'horizontal';},_normValueFromMouse:function(a){var b,c,d,e,f;this.orientation==='horizontal'?(b=this.elementSize.width,c=a.x-this.elementOffset.left-(this._clickOffset?this._clickOffset.left:0)):(b=this.elementSize.height,c=a.y-this.elementOffset.top-(this._clickOffset?this._clickOffset.top:0)),d=c/b,d>1&&(d=1),d<0&&(d=0),this.orientation==='vertical'&&(d=1-d),e=this._valueMax()-this._valueMin(),f=this._valueMin()+d*e;return this._trimAlignValue(f);},_start:function(a,b){var c={handle:this.handles[b],value:this.value()};this.options.values&&this.options.values.length&&(c.value=this.values(b),c.values=this.values());return this._trigger('start',a,c);},_slide:function(a,b,c){var d,e,f;this.options.values&&this.options.values.length?(d=this.values(b?0:1),this.options.values.length===2&&this.options.range===!0&&(b===0&&c>d||b===1&&c1)this.options.values[b]=this._trimAlignValue(c),this._refreshValue(),this._change(null,b);else{if(!arguments.length)return this._values();if(!a.isArray(arguments[0]))return this.options.values&&this.options.values.length?this._values(b):this.value();d=this.options.values,e=arguments[0];for(f=0;f=this._valueMax())return this._valueMax();var b=this.options.step>0?this.options.step:1,c=(a-this._valueMin())%b,d=a-c;Math.abs(c)*2>=b&&(d+=c>0?b:-b);return parseFloat(d.toFixed(5));},_valueMin:function(){return this.options.min;},_valueMax:function(){return this.options.max;},_refreshValue:function(){var b=this.options.range,c=this.options,d=this,e=this._animateOff?!1:c.animate,f,g={},h,i,j,k;this.options.values&&this.options.values.length?this.handles.each(function(b,i){f=(d.values(b)-d._valueMin())/(d._valueMax()-d._valueMin())*100,g[d.orientation==='horizontal'?'left':'bottom']=f+'%',a(this).stop(1,1)[e?'animate':'css'](g,c.animate),d.options.range===!0&&(d.orientation==='horizontal'?(b===0&&d.range.stop(1,1)[e?'animate':'css']({left:f+'%'},c.animate),b===1&&d.range[e?'animate':'css']({width:f-h+'%'},{queue:!1,duration:c.animate})):(b===0&&d.range.stop(1,1)[e?'animate':'css']({bottom:f+'%'},c.animate),b===1&&d.range[e?'animate':'css']({height:f-h+'%'},{queue:!1,duration:c.animate}))),h=f;}):(i=this.value(),j=this._valueMin(),k=this._valueMax(),f=k!==j?(i-j)/(k-j)*100:0,g[d.orientation==='horizontal'?'left':'bottom']=f+'%',this.handle.stop(1,1)[e?'animate':'css'](g,c.animate),b==='min'&&this.orientation==='horizontal'&&this.range.stop(1,1)[e?'animate':'css']({width:f+'%'},c.animate),b==='max'&&this.orientation==='horizontal'&&this.range[e?'animate':'css']({width:100-f+'%'},{queue:!1,duration:c.animate}),b==='min'&&this.orientation==='vertical'&&this.range.stop(1,1)[e?'animate':'css']({height:f+'%'},c.animate),b==='max'&&this.orientation==='vertical'&&this.range[e?'animate':'css']({height:100-f+'%'},{queue:!1,duration:c.animate}));}}),a.extend(a.ui.slider,{version:'1.8.17'});})(jQuery);/* * jQuery UI Tabs 1.8.17 * * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) @@ -112,7 +112,7 @@ * Depends: * jquery.ui.core.js * jquery.ui.widget.js - */(function(a,b){function f(){return++d;}function e(){return++c;}var c=0,d=0;a.widget("ui.tabs",{options:{add:null,ajaxOptions:null,cache:!1,cookie:null,collapsible:!1,disable:null,disabled:[],enable:null,event:"click",fx:null,idPrefix:"ui-tabs-",load:null,panelTemplate:"
      ",remove:null,select:null,show:null,spinner:"Loading…",tabTemplate:"
    • #{label}
    • "},_create:function(){this._tabify(!0);},_setOption:function(a,b){if(a=="selected"){if(this.options.collapsible&&b==this.options.selected)return;this.select(b);}else this.options[a]=b,this._tabify();},_tabId:function(a){return a.title&&a.title.replace(/\s/g,"_").replace(/[^\w\u00c0-\uFFFF-]/g,"")||this.options.idPrefix+e();},_sanitizeSelector:function(a){return a.replace(/:/g,"\\:");},_cookie:function(){var b=this.cookie||(this.cookie=this.options.cookie.name||"ui-tabs-"+f());return a.cookie.apply(null,[b].concat(a.makeArray(arguments)));},_ui:function(a,b){return{tab:a,panel:b,index:this.anchors.index(a)};},_cleanup:function(){this.lis.filter(".ui-state-processing").removeClass("ui-state-processing").find("span:data(label.tabs)").each(function(){var b=a(this);b.html(b.data("label.tabs")).removeData("label.tabs");});},_tabify:function(c){function m(b,c){b.css("display",""),!a.support.opacity&&c.opacity&&b[0].style.removeAttribute("filter");}var d=this,e=this.options,f=/^#.+/;this.list=this.element.find("ol,ul").eq(0),this.lis=a(" > li:has(a[href])",this.list),this.anchors=this.lis.map(function(){return a("a",this)[0];}),this.panels=a([]),this.anchors.each(function(b,c){var g=a(c).attr("href"),h=g.split("#")[0],i;h&&(h===location.toString().split("#")[0]||(i=a("base")[0])&&h===i.href)&&(g=c.hash,c.href=g);if(f.test(g))d.panels=d.panels.add(d.element.find(d._sanitizeSelector(g)));else if(g&&g!=="#"){a.data(c,"href.tabs",g),a.data(c,"load.tabs",g.replace(/#.*$/,""));var j=d._tabId(c);c.href="#"+j;var k=d.element.find("#"+j);k.length||(k=a(e.panelTemplate).attr("id",j).addClass("ui-tabs-panel ui-widget-content ui-corner-bottom").insertAfter(d.panels[b-1]||d.list),k.data("destroy.tabs",!0)),d.panels=d.panels.add(k);}else e.disabled.push(b);}),c?(this.element.addClass("ui-tabs ui-widget ui-widget-content ui-corner-all"),this.list.addClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all"),this.lis.addClass("ui-state-default ui-corner-top"),this.panels.addClass("ui-tabs-panel ui-widget-content ui-corner-bottom"),e.selected===b?(location.hash&&this.anchors.each(function(a,b){if(b.hash==location.hash){e.selected=a;return!1;}}),typeof e.selected!="number"&&e.cookie&&(e.selected=parseInt(d._cookie(),10)),typeof e.selected!="number"&&this.lis.filter(".ui-tabs-selected").length&&(e.selected=this.lis.index(this.lis.filter(".ui-tabs-selected"))),e.selected=e.selected||(this.lis.length?0:-1)):e.selected===null&&(e.selected=-1),e.selected=e.selected>=0&&this.anchors[e.selected]||e.selected<0?e.selected:0,e.disabled=a.unique(e.disabled.concat(a.map(this.lis.filter(".ui-state-disabled"),function(a,b){return d.lis.index(a);}))).sort(),a.inArray(e.selected,e.disabled)!=-1&&e.disabled.splice(a.inArray(e.selected,e.disabled),1),this.panels.addClass("ui-tabs-hide"),this.lis.removeClass("ui-tabs-selected ui-state-active"),e.selected>=0&&this.anchors.length&&(d.element.find(d._sanitizeSelector(d.anchors[e.selected].hash)).removeClass("ui-tabs-hide"),this.lis.eq(e.selected).addClass("ui-tabs-selected ui-state-active"),d.element.queue("tabs",function(){d._trigger("show",null,d._ui(d.anchors[e.selected],d.element.find(d._sanitizeSelector(d.anchors[e.selected].hash))[0]));}),this.load(e.selected)),a(window).bind("unload",function(){d.lis.add(d.anchors).unbind(".tabs"),d.lis=d.anchors=d.panels=null;})):e.selected=this.lis.index(this.lis.filter(".ui-tabs-selected")),this.element[e.collapsible?"addClass":"removeClass"]("ui-tabs-collapsible"),e.cookie&&this._cookie(e.selected,e.cookie);for(var g=0,h;h=this.lis[g];g++)a(h)[a.inArray(g,e.disabled)!=-1&&!a(h).hasClass("ui-tabs-selected")?"addClass":"removeClass"]("ui-state-disabled");e.cache===!1&&this.anchors.removeData("cache.tabs"),this.lis.add(this.anchors).unbind(".tabs");if(e.event!=="mouseover"){var i=function(a,b){b.is(":not(.ui-state-disabled)")&&b.addClass("ui-state-"+a);},j=function(a,b){b.removeClass("ui-state-"+a);};this.lis.bind("mouseover.tabs",function(){i("hover",a(this));}),this.lis.bind("mouseout.tabs",function(){j("hover",a(this));}),this.anchors.bind("focus.tabs",function(){i("focus",a(this).closest("li"));}),this.anchors.bind("blur.tabs",function(){j("focus",a(this).closest("li"));});}var k,l;e.fx&&(a.isArray(e.fx)?(k=e.fx[0],l=e.fx[1]):k=l=e.fx);var n=l?function(b,c){a(b).closest("li").addClass("ui-tabs-selected ui-state-active"),c.hide().removeClass("ui-tabs-hide").animate(l,l.duration||"normal",function(){m(c,l),d._trigger("show",null,d._ui(b,c[0]));});}:function(b,c){a(b).closest("li").addClass("ui-tabs-selected ui-state-active"),c.removeClass("ui-tabs-hide"),d._trigger("show",null,d._ui(b,c[0]));},o=k?function(a,b){b.animate(k,k.duration||"normal",function(){d.lis.removeClass("ui-tabs-selected ui-state-active"),b.addClass("ui-tabs-hide"),m(b,k),d.element.dequeue("tabs");});}:function(a,b,c){d.lis.removeClass("ui-tabs-selected ui-state-active"),b.addClass("ui-tabs-hide"),d.element.dequeue("tabs");};this.anchors.bind(e.event+".tabs",function(){var b=this,c=a(b).closest("li"),f=d.panels.filter(":not(.ui-tabs-hide)"),g=d.element.find(d._sanitizeSelector(b.hash));if(c.hasClass("ui-tabs-selected")&&!e.collapsible||c.hasClass("ui-state-disabled")||c.hasClass("ui-state-processing")||d.panels.filter(":animated").length||d._trigger("select",null,d._ui(this,g[0]))===!1){this.blur();return!1;}e.selected=d.anchors.index(this),d.abort();if(e.collapsible){if(c.hasClass("ui-tabs-selected")){e.selected=-1,e.cookie&&d._cookie(e.selected,e.cookie),d.element.queue("tabs",function(){o(b,f);}).dequeue("tabs"),this.blur();return!1;}if(!f.length){e.cookie&&d._cookie(e.selected,e.cookie),d.element.queue("tabs",function(){n(b,g);}),d.load(d.anchors.index(this)),this.blur();return!1;}}e.cookie&&d._cookie(e.selected,e.cookie);if(g.length)f.length&&d.element.queue("tabs",function(){o(b,f);}),d.element.queue("tabs",function(){n(b,g);}),d.load(d.anchors.index(this));else throw"jQuery UI Tabs: Mismatching fragment identifier.";a.browser.msie&&this.blur();}),this.anchors.bind("click.tabs",function(){return!1;});},_getIndex:function(a){typeof a=="string"&&(a=this.anchors.index(this.anchors.filter("[href$="+a+"]")));return a;},destroy:function(){var b=this.options;this.abort(),this.element.unbind(".tabs").removeClass("ui-tabs ui-widget ui-widget-content ui-corner-all ui-tabs-collapsible").removeData("tabs"),this.list.removeClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all"),this.anchors.each(function(){var b=a.data(this,"href.tabs");b&&(this.href=b);var c=a(this).unbind(".tabs");a.each(["href","load","cache"],function(a,b){c.removeData(b+".tabs");});}),this.lis.unbind(".tabs").add(this.panels).each(function(){a.data(this,"destroy.tabs")?a(this).remove():a(this).removeClass(["ui-state-default","ui-corner-top","ui-tabs-selected","ui-state-active","ui-state-hover","ui-state-focus","ui-state-disabled","ui-tabs-panel","ui-widget-content","ui-corner-bottom","ui-tabs-hide"].join(" "));}),b.cookie&&this._cookie(null,b.cookie);return this;},add:function(c,d,e){e===b&&(e=this.anchors.length);var f=this,g=this.options,h=a(g.tabTemplate.replace(/#\{href\}/g,c).replace(/#\{label\}/g,d)),i=c.indexOf("#")?this._tabId(a("a",h)[0]):c.replace("#","");h.addClass("ui-state-default ui-corner-top").data("destroy.tabs",!0);var j=f.element.find("#"+i);j.length||(j=a(g.panelTemplate).attr("id",i).data("destroy.tabs",!0)),j.addClass("ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide"),e>=this.lis.length?(h.appendTo(this.list),j.appendTo(this.list[0].parentNode)):(h.insertBefore(this.lis[e]),j.insertBefore(this.panels[e])),g.disabled=a.map(g.disabled,function(a,b){return a>=e?++a:a;}),this._tabify(),this.anchors.length==1&&(g.selected=0,h.addClass("ui-tabs-selected ui-state-active"),j.removeClass("ui-tabs-hide"),this.element.queue("tabs",function(){f._trigger("show",null,f._ui(f.anchors[0],f.panels[0]));}),this.load(0)),this._trigger("add",null,this._ui(this.anchors[e],this.panels[e]));return this;},remove:function(b){b=this._getIndex(b);var c=this.options,d=this.lis.eq(b).remove(),e=this.panels.eq(b).remove();d.hasClass("ui-tabs-selected")&&this.anchors.length>1&&this.select(b+(b+1=b?--a:a;}),this._tabify(),this._trigger("remove",null,this._ui(d.find("a")[0],e[0]));return this;},enable:function(b){b=this._getIndex(b);var c=this.options;if(a.inArray(b,c.disabled)!=-1){this.lis.eq(b).removeClass("ui-state-disabled"),c.disabled=a.grep(c.disabled,function(a,c){return a!=b;}),this._trigger("enable",null,this._ui(this.anchors[b],this.panels[b]));return this;}},disable:function(a){a=this._getIndex(a);var b=this,c=this.options;a!=c.selected&&(this.lis.eq(a).addClass("ui-state-disabled"),c.disabled.push(a),c.disabled.sort(),this._trigger("disable",null,this._ui(this.anchors[a],this.panels[a])));return this;},select:function(a){a=this._getIndex(a);if(a==-1)if(this.options.collapsible&&this.options.selected!=-1)a=this.options.selected;else return this;this.anchors.eq(a).trigger(this.options.event+".tabs");return this;},load:function(b){b=this._getIndex(b);var c=this,d=this.options,e=this.anchors.eq(b)[0],f=a.data(e,"load.tabs");this.abort();if(!f||this.element.queue("tabs").length!==0&&a.data(e,"cache.tabs"))this.element.dequeue("tabs");else{this.lis.eq(b).addClass("ui-state-processing");if(d.spinner){var g=a("span",e);g.data("label.tabs",g.html()).html(d.spinner);}this.xhr=a.ajax(a.extend({},d.ajaxOptions,{url:f,success:function(f,g){c.element.find(c._sanitizeSelector(e.hash)).html(f),c._cleanup(),d.cache&&a.data(e,"cache.tabs",!0),c._trigger("load",null,c._ui(c.anchors[b],c.panels[b]));try{d.ajaxOptions.success(f,g);}catch(h){}},error:function(a,f,g){c._cleanup(),c._trigger("load",null,c._ui(c.anchors[b],c.panels[b]));try{d.ajaxOptions.error(a,f,b,e);}catch(g){}}})),c.element.dequeue("tabs");return this;}},abort:function(){this.element.queue([]),this.panels.stop(!1,!0),this.element.queue("tabs",this.element.queue("tabs").splice(-2,2)),this.xhr&&(this.xhr.abort(),delete this.xhr),this._cleanup();return this;},url:function(a,b){this.anchors.eq(a).removeData("cache.tabs").data("load.tabs",b);return this;},length:function(){return this.anchors.length;}}),a.extend(a.ui.tabs,{version:"1.8.17"}),a.extend(a.ui.tabs.prototype,{rotation:null,rotate:function(a,b){var c=this,d=this.options,e=c._rotate||(c._rotate=function(b){clearTimeout(c.rotation),c.rotation=setTimeout(function(){var a=d.selected;c.select(++a',remove:null,select:null,show:null,spinner:'Loading…',tabTemplate:'
    • #{label}
    • '},_create:function(){this._tabify(!0);},_setOption:function(a,b){if(a=='selected'){if(this.options.collapsible&&b==this.options.selected)return;this.select(b);}else this.options[a]=b,this._tabify();},_tabId:function(a){return a.title&&a.title.replace(/\s/g,'_').replace(/[^\w\u00c0-\uFFFF-]/g,'')||this.options.idPrefix+e();},_sanitizeSelector:function(a){return a.replace(/:/g,'\\:');},_cookie:function(){var b=this.cookie||(this.cookie=this.options.cookie.name||'ui-tabs-'+f());return a.cookie.apply(null,[b].concat(a.makeArray(arguments)));},_ui:function(a,b){return{tab:a,panel:b,index:this.anchors.index(a)};},_cleanup:function(){this.lis.filter('.ui-state-processing').removeClass('ui-state-processing').find('span:data(label.tabs)').each(function(){var b=a(this);b.html(b.data('label.tabs')).removeData('label.tabs');});},_tabify:function(c){function m(b,c){b.css('display',''),!a.support.opacity&&c.opacity&&b[0].style.removeAttribute('filter');}var d=this,e=this.options,f=/^#.+/;this.list=this.element.find('ol,ul').eq(0),this.lis=a(' > li:has(a[href])',this.list),this.anchors=this.lis.map(function(){return a('a',this)[0];}),this.panels=a([]),this.anchors.each(function(b,c){var g=a(c).attr('href'),h=g.split('#')[0],i;h&&(h===location.toString().split('#')[0]||(i=a('base')[0])&&h===i.href)&&(g=c.hash,c.href=g);if(f.test(g))d.panels=d.panels.add(d.element.find(d._sanitizeSelector(g)));else if(g&&g!=='#'){a.data(c,'href.tabs',g),a.data(c,'load.tabs',g.replace(/#.*$/,''));var j=d._tabId(c);c.href='#'+j;var k=d.element.find('#'+j);k.length||(k=a(e.panelTemplate).attr('id',j).addClass('ui-tabs-panel ui-widget-content ui-corner-bottom').insertAfter(d.panels[b-1]||d.list),k.data('destroy.tabs',!0)),d.panels=d.panels.add(k);}else e.disabled.push(b);}),c?(this.element.addClass('ui-tabs ui-widget ui-widget-content ui-corner-all'),this.list.addClass('ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all'),this.lis.addClass('ui-state-default ui-corner-top'),this.panels.addClass('ui-tabs-panel ui-widget-content ui-corner-bottom'),e.selected===b?(location.hash&&this.anchors.each(function(a,b){if(b.hash==location.hash){e.selected=a;return!1;}}),typeof e.selected!='number'&&e.cookie&&(e.selected=parseInt(d._cookie(),10)),typeof e.selected!='number'&&this.lis.filter('.ui-tabs-selected').length&&(e.selected=this.lis.index(this.lis.filter('.ui-tabs-selected'))),e.selected=e.selected||(this.lis.length?0:-1)):e.selected===null&&(e.selected=-1),e.selected=e.selected>=0&&this.anchors[e.selected]||e.selected<0?e.selected:0,e.disabled=a.unique(e.disabled.concat(a.map(this.lis.filter('.ui-state-disabled'),function(a,b){return d.lis.index(a);}))).sort(),a.inArray(e.selected,e.disabled)!=-1&&e.disabled.splice(a.inArray(e.selected,e.disabled),1),this.panels.addClass('ui-tabs-hide'),this.lis.removeClass('ui-tabs-selected ui-state-active'),e.selected>=0&&this.anchors.length&&(d.element.find(d._sanitizeSelector(d.anchors[e.selected].hash)).removeClass('ui-tabs-hide'),this.lis.eq(e.selected).addClass('ui-tabs-selected ui-state-active'),d.element.queue('tabs',function(){d._trigger('show',null,d._ui(d.anchors[e.selected],d.element.find(d._sanitizeSelector(d.anchors[e.selected].hash))[0]));}),this.load(e.selected)),a(window).bind('unload',function(){d.lis.add(d.anchors).unbind('.tabs'),d.lis=d.anchors=d.panels=null;})):e.selected=this.lis.index(this.lis.filter('.ui-tabs-selected')),this.element[e.collapsible?'addClass':'removeClass']('ui-tabs-collapsible'),e.cookie&&this._cookie(e.selected,e.cookie);for(var g=0,h;h=this.lis[g];g++)a(h)[a.inArray(g,e.disabled)!=-1&&!a(h).hasClass('ui-tabs-selected')?'addClass':'removeClass']('ui-state-disabled');e.cache===!1&&this.anchors.removeData('cache.tabs'),this.lis.add(this.anchors).unbind('.tabs');if(e.event!=='mouseover'){var i=function(a,b){b.is(':not(.ui-state-disabled)')&&b.addClass('ui-state-'+a);},j=function(a,b){b.removeClass('ui-state-'+a);};this.lis.bind('mouseover.tabs',function(){i('hover',a(this));}),this.lis.bind('mouseout.tabs',function(){j('hover',a(this));}),this.anchors.bind('focus.tabs',function(){i('focus',a(this).closest('li'));}),this.anchors.bind('blur.tabs',function(){j('focus',a(this).closest('li'));});}var k,l;e.fx&&(a.isArray(e.fx)?(k=e.fx[0],l=e.fx[1]):k=l=e.fx);var n=l?function(b,c){a(b).closest('li').addClass('ui-tabs-selected ui-state-active'),c.hide().removeClass('ui-tabs-hide').animate(l,l.duration||'normal',function(){m(c,l),d._trigger('show',null,d._ui(b,c[0]));});}:function(b,c){a(b).closest('li').addClass('ui-tabs-selected ui-state-active'),c.removeClass('ui-tabs-hide'),d._trigger('show',null,d._ui(b,c[0]));},o=k?function(a,b){b.animate(k,k.duration||'normal',function(){d.lis.removeClass('ui-tabs-selected ui-state-active'),b.addClass('ui-tabs-hide'),m(b,k),d.element.dequeue('tabs');});}:function(a,b,c){d.lis.removeClass('ui-tabs-selected ui-state-active'),b.addClass('ui-tabs-hide'),d.element.dequeue('tabs');};this.anchors.bind(e.event+'.tabs',function(){var b=this,c=a(b).closest('li'),f=d.panels.filter(':not(.ui-tabs-hide)'),g=d.element.find(d._sanitizeSelector(b.hash));if(c.hasClass('ui-tabs-selected')&&!e.collapsible||c.hasClass('ui-state-disabled')||c.hasClass('ui-state-processing')||d.panels.filter(':animated').length||d._trigger('select',null,d._ui(this,g[0]))===!1){this.blur();return!1;}e.selected=d.anchors.index(this),d.abort();if(e.collapsible){if(c.hasClass('ui-tabs-selected')){e.selected=-1,e.cookie&&d._cookie(e.selected,e.cookie),d.element.queue('tabs',function(){o(b,f);}).dequeue('tabs'),this.blur();return!1;}if(!f.length){e.cookie&&d._cookie(e.selected,e.cookie),d.element.queue('tabs',function(){n(b,g);}),d.load(d.anchors.index(this)),this.blur();return!1;}}e.cookie&&d._cookie(e.selected,e.cookie);if(g.length)f.length&&d.element.queue('tabs',function(){o(b,f);}),d.element.queue('tabs',function(){n(b,g);}),d.load(d.anchors.index(this));else throw'jQuery UI Tabs: Mismatching fragment identifier.';a.browser.msie&&this.blur();}),this.anchors.bind('click.tabs',function(){return!1;});},_getIndex:function(a){typeof a=='string'&&(a=this.anchors.index(this.anchors.filter('[href$='+a+']')));return a;},destroy:function(){var b=this.options;this.abort(),this.element.unbind('.tabs').removeClass('ui-tabs ui-widget ui-widget-content ui-corner-all ui-tabs-collapsible').removeData('tabs'),this.list.removeClass('ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all'),this.anchors.each(function(){var b=a.data(this,'href.tabs');b&&(this.href=b);var c=a(this).unbind('.tabs');a.each(['href','load','cache'],function(a,b){c.removeData(b+'.tabs');});}),this.lis.unbind('.tabs').add(this.panels).each(function(){a.data(this,'destroy.tabs')?a(this).remove():a(this).removeClass(['ui-state-default','ui-corner-top','ui-tabs-selected','ui-state-active','ui-state-hover','ui-state-focus','ui-state-disabled','ui-tabs-panel','ui-widget-content','ui-corner-bottom','ui-tabs-hide'].join(' '));}),b.cookie&&this._cookie(null,b.cookie);return this;},add:function(c,d,e){e===b&&(e=this.anchors.length);var f=this,g=this.options,h=a(g.tabTemplate.replace(/#\{href\}/g,c).replace(/#\{label\}/g,d)),i=c.indexOf('#')?this._tabId(a('a',h)[0]):c.replace('#','');h.addClass('ui-state-default ui-corner-top').data('destroy.tabs',!0);var j=f.element.find('#'+i);j.length||(j=a(g.panelTemplate).attr('id',i).data('destroy.tabs',!0)),j.addClass('ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide'),e>=this.lis.length?(h.appendTo(this.list),j.appendTo(this.list[0].parentNode)):(h.insertBefore(this.lis[e]),j.insertBefore(this.panels[e])),g.disabled=a.map(g.disabled,function(a,b){return a>=e?++a:a;}),this._tabify(),this.anchors.length==1&&(g.selected=0,h.addClass('ui-tabs-selected ui-state-active'),j.removeClass('ui-tabs-hide'),this.element.queue('tabs',function(){f._trigger('show',null,f._ui(f.anchors[0],f.panels[0]));}),this.load(0)),this._trigger('add',null,this._ui(this.anchors[e],this.panels[e]));return this;},remove:function(b){b=this._getIndex(b);var c=this.options,d=this.lis.eq(b).remove(),e=this.panels.eq(b).remove();d.hasClass('ui-tabs-selected')&&this.anchors.length>1&&this.select(b+(b+1=b?--a:a;}),this._tabify(),this._trigger('remove',null,this._ui(d.find('a')[0],e[0]));return this;},enable:function(b){b=this._getIndex(b);var c=this.options;if(a.inArray(b,c.disabled)!=-1){this.lis.eq(b).removeClass('ui-state-disabled'),c.disabled=a.grep(c.disabled,function(a,c){return a!=b;}),this._trigger('enable',null,this._ui(this.anchors[b],this.panels[b]));return this;}},disable:function(a){a=this._getIndex(a);var b=this,c=this.options;a!=c.selected&&(this.lis.eq(a).addClass('ui-state-disabled'),c.disabled.push(a),c.disabled.sort(),this._trigger('disable',null,this._ui(this.anchors[a],this.panels[a])));return this;},select:function(a){a=this._getIndex(a);if(a==-1)if(this.options.collapsible&&this.options.selected!=-1)a=this.options.selected;else return this;this.anchors.eq(a).trigger(this.options.event+'.tabs');return this;},load:function(b){b=this._getIndex(b);var c=this,d=this.options,e=this.anchors.eq(b)[0],f=a.data(e,'load.tabs');this.abort();if(!f||this.element.queue('tabs').length!==0&&a.data(e,'cache.tabs'))this.element.dequeue('tabs');else{this.lis.eq(b).addClass('ui-state-processing');if(d.spinner){var g=a('span',e);g.data('label.tabs',g.html()).html(d.spinner);}this.xhr=a.ajax(a.extend({},d.ajaxOptions,{url:f,success:function(f,g){c.element.find(c._sanitizeSelector(e.hash)).html(f),c._cleanup(),d.cache&&a.data(e,'cache.tabs',!0),c._trigger('load',null,c._ui(c.anchors[b],c.panels[b]));try{d.ajaxOptions.success(f,g);}catch(h){}},error:function(a,f,g){c._cleanup(),c._trigger('load',null,c._ui(c.anchors[b],c.panels[b]));try{d.ajaxOptions.error(a,f,b,e);}catch(g){}}})),c.element.dequeue('tabs');return this;}},abort:function(){this.element.queue([]),this.panels.stop(!1,!0),this.element.queue('tabs',this.element.queue('tabs').splice(-2,2)),this.xhr&&(this.xhr.abort(),delete this.xhr),this._cleanup();return this;},url:function(a,b){this.anchors.eq(a).removeData('cache.tabs').data('load.tabs',b);return this;},length:function(){return this.anchors.length;}}),a.extend(a.ui.tabs,{version:'1.8.17'}),a.extend(a.ui.tabs.prototype,{rotation:null,rotate:function(a,b){var c=this,d=this.options,e=c._rotate||(c._rotate=function(b){clearTimeout(c.rotation),c.rotation=setTimeout(function(){var a=d.selected;c.select(++a"));}$.extend($.ui,{datepicker:{version:"1.8.17"}});var PROP_NAME="datepicker",dpuuid=(new Date).getTime(),instActive;$.extend(Datepicker.prototype,{markerClassName:"hasDatepicker",maxRows:4,log:function(){this.debug&&console.log.apply("",arguments);},_widgetDatepicker:function(){return this.dpDiv;},setDefaults:function(a){extendRemove(this._defaults,a||{});return this;},_attachDatepicker:function(target,settings){var inlineSettings=null;for(var attrName in this._defaults){var attrValue=target.getAttribute("date:"+attrName);if(attrValue){inlineSettings=inlineSettings||{};try{inlineSettings[attrName]=eval(attrValue);}catch(err){inlineSettings[attrName]=attrValue;}}}var nodeName=target.nodeName.toLowerCase(),inline=nodeName=="div"||nodeName=="span";target.id||(this.uuid+=1,target.id="dp"+this.uuid);var inst=this._newInst($(target),inline);inst.settings=$.extend({},settings||{},inlineSettings||{}),nodeName=="input"?this._connectDatepicker(target,inst):inline&&this._inlineDatepicker(target,inst);},_newInst:function(a,b){var c=a[0].id.replace(/([^A-Za-z0-9_-])/g,"\\\\$1");return{id:c,input:a,selectedDay:0,selectedMonth:0,selectedYear:0,drawMonth:0,drawYear:0,inline:b,dpDiv:b?bindHover($("
      ")):this.dpDiv};},_connectDatepicker:function(a,b){var c=$(a);b.append=$([]),b.trigger=$([]);c.hasClass(this.markerClassName)||(this._attachments(c,b),c.addClass(this.markerClassName).keydown(this._doKeyDown).keypress(this._doKeyPress).keyup(this._doKeyUp).bind("setData.datepicker",function(a,c,d){b.settings[c]=d;}).bind("getData.datepicker",function(a,c){return this._get(b,c);}),this._autoSize(b),$.data(a,PROP_NAME,b),b.settings.disabled&&this._disableDatepicker(a));},_attachments:function(a,b){var c=this._get(b,"appendText"),d=this._get(b,"isRTL");b.append&&b.append.remove(),c&&(b.append=$(""+c+""),a[d?"before":"after"](b.append)),a.unbind("focus",this._showDatepicker),b.trigger&&b.trigger.remove();var e=this._get(b,"showOn");(e=="focus"||e=="both")&&a.focus(this._showDatepicker);if(e=="button"||e=="both"){var f=this._get(b,"buttonText"),g=this._get(b,"buttonImage");b.trigger=$(this._get(b,"buttonImageOnly")?$("").addClass(this._triggerClass).attr({src:g,alt:f,title:f}):$("").addClass(this._triggerClass).html(g==""?f:$("").attr({src:g,alt:f,title:f}))),a[d?"before":"after"](b.trigger),b.trigger.click(function(){$.datepicker._datepickerShowing&&$.datepicker._lastInput==a[0]?$.datepicker._hideDatepicker():$.datepicker._showDatepicker(a[0]);return!1;});}},_autoSize:function(a){if(this._get(a,"autoSize")&&!a.inline){var b=new Date(2009,11,20),c=this._get(a,"dateFormat");if(c.match(/[DM]/)){var d=function(a){var b=0,c=0;for(var d=0;db&&(b=a[d].length,c=d);return c;};b.setMonth(d(this._get(a,c.match(/MM/)?"monthNames":"monthNamesShort"))),b.setDate(d(this._get(a,c.match(/DD/)?"dayNames":"dayNamesShort"))+20-b.getDay());}a.input.attr("size",this._formatDate(a,b).length);}},_inlineDatepicker:function(a,b){var c=$(a);c.hasClass(this.markerClassName)||(c.addClass(this.markerClassName).append(b.dpDiv).bind("setData.datepicker",function(a,c,d){b.settings[c]=d;}).bind("getData.datepicker",function(a,c){return this._get(b,c);}),$.data(a,PROP_NAME,b),this._setDate(b,this._getDefaultDate(b),!0),this._updateDatepicker(b),this._updateAlternate(b),b.settings.disabled&&this._disableDatepicker(a),b.dpDiv.css("display","block"));},_dialogDatepicker:function(a,b,c,d,e){var f=this._dialogInst;if(!f){this.uuid+=1;var g="dp"+this.uuid;this._dialogInput=$(""),this._dialogInput.keydown(this._doKeyDown),$("body").append(this._dialogInput),f=this._dialogInst=this._newInst(this._dialogInput,!1),f.settings={},$.data(this._dialogInput[0],PROP_NAME,f);}extendRemove(f.settings,d||{}),b=b&&b.constructor==Date?this._formatDate(f,b):b,this._dialogInput.val(b),this._pos=e?e.length?e:[e.pageX,e.pageY]:null;if(!this._pos){var h=document.documentElement.clientWidth,i=document.documentElement.clientHeight,j=document.documentElement.scrollLeft||document.body.scrollLeft,k=document.documentElement.scrollTop||document.body.scrollTop;this._pos=[h/2-100+j,i/2-150+k];}this._dialogInput.css("left",this._pos[0]+20+"px").css("top",this._pos[1]+"px"),f.settings.onSelect=c,this._inDialog=!0,this.dpDiv.addClass(this._dialogClass),this._showDatepicker(this._dialogInput[0]),$.blockUI&&$.blockUI(this.dpDiv),$.data(this._dialogInput[0],PROP_NAME,f);return this;},_destroyDatepicker:function(a){var b=$(a),c=$.data(a,PROP_NAME);if(b.hasClass(this.markerClassName)){var d=a.nodeName.toLowerCase();$.removeData(a,PROP_NAME),d=="input"?(c.append.remove(),c.trigger.remove(),b.removeClass(this.markerClassName).unbind("focus",this._showDatepicker).unbind("keydown",this._doKeyDown).unbind("keypress",this._doKeyPress).unbind("keyup",this._doKeyUp)):(d=="div"||d=="span")&&b.removeClass(this.markerClassName).empty();}},_enableDatepicker:function(a){var b=$(a),c=$.data(a,PROP_NAME);if(b.hasClass(this.markerClassName)){var d=a.nodeName.toLowerCase();if(d=="input")a.disabled=!1,c.trigger.filter("button").each(function(){this.disabled=!1;}).end().filter("img").css({opacity:"1.0",cursor:""});else if(d=="div"||d=="span"){var e=b.children("."+this._inlineClass);e.children().removeClass("ui-state-disabled"),e.find("select.ui-datepicker-month, select.ui-datepicker-year").removeAttr("disabled");}this._disabledInputs=$.map(this._disabledInputs,function(b){return b==a?null:b;});}},_disableDatepicker:function(a){var b=$(a),c=$.data(a,PROP_NAME);if(b.hasClass(this.markerClassName)){var d=a.nodeName.toLowerCase();if(d=="input")a.disabled=!0,c.trigger.filter("button").each(function(){this.disabled=!0;}).end().filter("img").css({opacity:"0.5",cursor:"default"});else if(d=="div"||d=="span"){var e=b.children("."+this._inlineClass);e.children().addClass("ui-state-disabled"),e.find("select.ui-datepicker-month, select.ui-datepicker-year").attr("disabled","disabled");}this._disabledInputs=$.map(this._disabledInputs,function(b){return b==a?null:b;}),this._disabledInputs[this._disabledInputs.length]=a;}},_isDisabledDatepicker:function(a){if(!a)return!1;for(var b=0;b-1;}},_doKeyUp:function(a){var b=$.datepicker._getInst(a.target);if(b.input.val()!=b.lastVal)try{var c=$.datepicker.parseDate($.datepicker._get(b,"dateFormat"),b.input?b.input.val():null,$.datepicker._getFormatConfig(b));c&&($.datepicker._setDateFromField(b),$.datepicker._updateAlternate(b),$.datepicker._updateDatepicker(b));}catch(a){$.datepicker.log(a);}return!0;},_showDatepicker:function(a){a=a.target||a,a.nodeName.toLowerCase()!="input"&&(a=$("input",a.parentNode)[0]);if(!$.datepicker._isDisabledDatepicker(a)&&$.datepicker._lastInput!=a){var b=$.datepicker._getInst(a);$.datepicker._curInst&&$.datepicker._curInst!=b&&($.datepicker._curInst.dpDiv.stop(!0,!0),b&&$.datepicker._datepickerShowing&&$.datepicker._hideDatepicker($.datepicker._curInst.input[0]));var c=$.datepicker._get(b,"beforeShow"),d=c?c.apply(a,[a,b]):{};if(d===!1)return;extendRemove(b.settings,d),b.lastVal=null,$.datepicker._lastInput=a,$.datepicker._setDateFromField(b),$.datepicker._inDialog&&(a.value=""),$.datepicker._pos||($.datepicker._pos=$.datepicker._findPos(a),$.datepicker._pos[1]+=a.offsetHeight);var e=!1;$(a).parents().each(function(){e|=$(this).css("position")=="fixed";return!e;}),e&&$.browser.opera&&($.datepicker._pos[0]-=document.documentElement.scrollLeft,$.datepicker._pos[1]-=document.documentElement.scrollTop);var f={left:$.datepicker._pos[0],top:$.datepicker._pos[1]};$.datepicker._pos=null,b.dpDiv.empty(),b.dpDiv.css({position:"absolute",display:"block",top:"-1000px"}),$.datepicker._updateDatepicker(b),f=$.datepicker._checkOffset(b,f,e),b.dpDiv.css({position:$.datepicker._inDialog&&$.blockUI?"static":e?"fixed":"absolute",display:"none",left:f.left+"px",top:f.top+"px"});if(!b.inline){var g=$.datepicker._get(b,"showAnim"),h=$.datepicker._get(b,"duration"),i=function(){var a=b.dpDiv.find("iframe.ui-datepicker-cover");if(a.length){var c=$.datepicker._getBorders(b.dpDiv);a.css({left:-c[0],top:-c[1],width:b.dpDiv.outerWidth(),height:b.dpDiv.outerHeight()});}};b.dpDiv.zIndex($(a).zIndex()+1),$.datepicker._datepickerShowing=!0,$.effects&&$.effects[g]?b.dpDiv.show(g,$.datepicker._get(b,"showOptions"),h,i):b.dpDiv[g||"show"](g?h:null,i),(!g||!h)&&i(),b.input.is(":visible")&&!b.input.is(":disabled")&&b.input.focus(),$.datepicker._curInst=b;}}},_updateDatepicker:function(a){var b=this;b.maxRows=4;var c=$.datepicker._getBorders(a.dpDiv);instActive=a,a.dpDiv.empty().append(this._generateHTML(a));var d=a.dpDiv.find("iframe.ui-datepicker-cover");!d.length||d.css({left:-c[0],top:-c[1],width:a.dpDiv.outerWidth(),height:a.dpDiv.outerHeight()}),a.dpDiv.find("."+this._dayOverClass+" a").mouseover();var e=this._getNumberOfMonths(a),f=e[1],g=17;a.dpDiv.removeClass("ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4").width(""),f>1&&a.dpDiv.addClass("ui-datepicker-multi-"+f).css("width",g*f+"em"),a.dpDiv[(e[0]!=1||e[1]!=1?"add":"remove")+"Class"]("ui-datepicker-multi"),a.dpDiv[(this._get(a,"isRTL")?"add":"remove")+"Class"]("ui-datepicker-rtl"),a==$.datepicker._curInst&&$.datepicker._datepickerShowing&&a.input&&a.input.is(":visible")&&!a.input.is(":disabled")&&a.input[0]!=document.activeElement&&a.input.focus();if(a.yearshtml){var h=a.yearshtml;setTimeout(function(){h===a.yearshtml&&a.yearshtml&&a.dpDiv.find("select.ui-datepicker-year:first").replaceWith(a.yearshtml),h=a.yearshtml=null;},0);}},_getBorders:function(a){var b=function(a){return{thin:1,medium:2,thick:3}[a]||a;};return[parseFloat(b(a.css("border-left-width"))),parseFloat(b(a.css("border-top-width")))];},_checkOffset:function(a,b,c){var d=a.dpDiv.outerWidth(),e=a.dpDiv.outerHeight(),f=a.input?a.input.outerWidth():0,g=a.input?a.input.outerHeight():0,h=document.documentElement.clientWidth+$(document).scrollLeft(),i=document.documentElement.clientHeight+$(document).scrollTop();b.left-=this._get(a,"isRTL")?d-f:0,b.left-=c&&b.left==a.input.offset().left?$(document).scrollLeft():0,b.top-=c&&b.top==a.input.offset().top+g?$(document).scrollTop():0,b.left-=Math.min(b.left,b.left+d>h&&h>d?Math.abs(b.left+d-h):0),b.top-=Math.min(b.top,b.top+e>i&&i>e?Math.abs(e+g):0);return b;},_findPos:function(a){var b=this._getInst(a),c=this._get(b,"isRTL");while(a&&(a.type=="hidden"||a.nodeType!=1||$.expr.filters.hidden(a)))a=a[c?"previousSibling":"nextSibling"];var d=$(a).offset();return[d.left,d.top];},_hideDatepicker:function(a){var b=this._curInst;if(!(!b||a&&b!=$.data(a,PROP_NAME))&&this._datepickerShowing){var c=this._get(b,"showAnim"),d=this._get(b,"duration"),e=this,f=function(){$.datepicker._tidyDialog(b),e._curInst=null;};$.effects&&$.effects[c]?b.dpDiv.hide(c,$.datepicker._get(b,"showOptions"),d,f):b.dpDiv[c=="slideDown"?"slideUp":c=="fadeIn"?"fadeOut":"hide"](c?d:null,f),c||f(),this._datepickerShowing=!1;var g=this._get(b,"onClose");g&&g.apply(b.input?b.input[0]:null,[b.input?b.input.val():"",b]),this._lastInput=null,this._inDialog&&(this._dialogInput.css({position:"absolute",left:"0",top:"-100px"}),$.blockUI&&($.unblockUI(),$("body").append(this.dpDiv))),this._inDialog=!1;}},_tidyDialog:function(a){a.dpDiv.removeClass(this._dialogClass).unbind(".ui-datepicker-calendar");},_checkExternalClick:function(a){if($.datepicker._curInst){var b=$(a.target),c=$.datepicker._getInst(b[0]);(b[0].id!=$.datepicker._mainDivId&&b.parents("#"+$.datepicker._mainDivId).length==0&&!b.hasClass($.datepicker.markerClassName)&&!b.hasClass($.datepicker._triggerClass)&&$.datepicker._datepickerShowing&&(!$.datepicker._inDialog||!$.blockUI)||b.hasClass($.datepicker.markerClassName)&&$.datepicker._curInst!=c)&&$.datepicker._hideDatepicker();}},_adjustDate:function(a,b,c){var d=$(a),e=this._getInst(d[0]);this._isDisabledDatepicker(d[0])||(this._adjustInstDate(e,b+(c=="M"?this._get(e,"showCurrentAtPos"):0),c),this._updateDatepicker(e));},_gotoToday:function(a){var b=$(a),c=this._getInst(b[0]);if(this._get(c,"gotoCurrent")&&c.currentDay)c.selectedDay=c.currentDay,c.drawMonth=c.selectedMonth=c.currentMonth,c.drawYear=c.selectedYear=c.currentYear;else{var d=new Date;c.selectedDay=d.getDate(),c.drawMonth=c.selectedMonth=d.getMonth(),c.drawYear=c.selectedYear=d.getFullYear();}this._notifyChange(c),this._adjustDate(b);},_selectMonthYear:function(a,b,c){var d=$(a),e=this._getInst(d[0]);e["selected"+(c=="M"?"Month":"Year")]=e["draw"+(c=="M"?"Month":"Year")]=parseInt(b.options[b.selectedIndex].value,10),this._notifyChange(e),this._adjustDate(d);},_selectDay:function(a,b,c,d){var e=$(a);if(!$(d).hasClass(this._unselectableClass)&&!this._isDisabledDatepicker(e[0])){var f=this._getInst(e[0]);f.selectedDay=f.currentDay=$("a",d).html(),f.selectedMonth=f.currentMonth=b,f.selectedYear=f.currentYear=c,this._selectDate(a,this._formatDate(f,f.currentDay,f.currentMonth,f.currentYear));}},_clearDate:function(a){var b=$(a),c=this._getInst(b[0]);this._selectDate(b,"");},_selectDate:function(a,b){var c=$(a),d=this._getInst(c[0]);b=b!=null?b:this._formatDate(d),d.input&&d.input.val(b),this._updateAlternate(d);var e=this._get(d,"onSelect");e?e.apply(d.input?d.input[0]:null,[b,d]):d.input&&d.input.trigger("change"),d.inline?this._updateDatepicker(d):(this._hideDatepicker(),this._lastInput=d.input[0],typeof d.input[0]!="object"&&d.input.focus(),this._lastInput=null);},_updateAlternate:function(a){var b=this._get(a,"altField");if(b){var c=this._get(a,"altFormat")||this._get(a,"dateFormat"),d=this._getDate(a),e=this.formatDate(c,d,this._getFormatConfig(a));$(b).each(function(){$(this).val(e);});}},noWeekends:function(a){var b=a.getDay();return[b>0&&b<6,""];},iso8601Week:function(a){var b=new Date(a.getTime());b.setDate(b.getDate()+4-(b.getDay()||7));var c=b.getTime();b.setMonth(0),b.setDate(1);return Math.floor(Math.round((c-b)/864e5)/7)+1;},parseDate:function(a,b,c){if(a==null||b==null)throw"Invalid arguments";b=typeof b=="object"?b.toString():b+"";if(b=="")return null;var d=(c?c.shortYearCutoff:null)||this._defaults.shortYearCutoff;d=typeof d!="string"?d:(new Date).getFullYear()%100+parseInt(d,10);var e=(c?c.dayNamesShort:null)||this._defaults.dayNamesShort,f=(c?c.dayNames:null)||this._defaults.dayNames,g=(c?c.monthNamesShort:null)||this._defaults.monthNamesShort,h=(c?c.monthNames:null)||this._defaults.monthNames,i=-1,j=-1,k=-1,l=-1,m=!1,n=function(b){var c=s+1-1){j=1,k=l;for(;;){var u=this._getDaysInMonth(i,j-1);if(k<=u)break;j++,k-=u;}}var t=this._daylightSavingAdjust(new Date(i,j-1,k));if(t.getFullYear()!=i||t.getMonth()+1!=j||t.getDate()!=k)throw"Invalid date";return t;},ATOM:"yy-mm-dd",COOKIE:"D, dd M yy",ISO_8601:"yy-mm-dd",RFC_822:"D, d M y",RFC_850:"DD, dd-M-y",RFC_1036:"D, d M y",RFC_1123:"D, d M yy",RFC_2822:"D, d M yy",RSS:"D, d M y",TICKS:"!",TIMESTAMP:"@",W3C:"yy-mm-dd",_ticksTo1970:(718685+Math.floor(492.5)-Math.floor(19.7)+Math.floor(4.925))*24*60*60*1e7,formatDate:function(a,b,c){if(!b)return"";var d=(c?c.dayNamesShort:null)||this._defaults.dayNamesShort,e=(c?c.dayNames:null)||this._defaults.dayNames,f=(c?c.monthNamesShort:null)||this._defaults.monthNamesShort,g=(c?c.monthNames:null)||this._defaults.monthNames,h=function(b){var c=m+112?a.getHours()+2:0);return a;},_setDate:function(a,b,c){var d=!b,e=a.selectedMonth,f=a.selectedYear,g=this._restrictMinMax(a,this._determineDate(a,b,new Date));a.selectedDay=a.currentDay=g.getDate(),a.drawMonth=a.selectedMonth=a.currentMonth=g.getMonth(),a.drawYear=a.selectedYear=a.currentYear=g.getFullYear(),(e!=a.selectedMonth||f!=a.selectedYear)&&!c&&this._notifyChange(a),this._adjustInstDate(a),a.input&&a.input.val(d?"":this._formatDate(a));},_getDate:function(a){var b=!a.currentYear||a.input&&a.input.val()==""?null:this._daylightSavingAdjust(new Date(a.currentYear,a.currentMonth,a.currentDay));return b;},_generateHTML:function(a){var b=new Date;b=this._daylightSavingAdjust(new Date(b.getFullYear(),b.getMonth(),b.getDate()));var c=this._get(a,"isRTL"),d=this._get(a,"showButtonPanel"),e=this._get(a,"hideIfNoPrevNext"),f=this._get(a,"navigationAsDateFormat"),g=this._getNumberOfMonths(a),h=this._get(a,"showCurrentAtPos"),i=this._get(a,"stepMonths"),j=g[0]!=1||g[1]!=1,k=this._daylightSavingAdjust(a.currentDay?new Date(a.currentYear,a.currentMonth,a.currentDay):new Date(9999,9,9)),l=this._getMinMaxDate(a,"min"),m=this._getMinMaxDate(a,"max"),n=a.drawMonth-h,o=a.drawYear;n<0&&(n+=12,o--);if(m){var p=this._daylightSavingAdjust(new Date(m.getFullYear(),m.getMonth()-g[0]*g[1]+1,m.getDate()));p=l&&pp)n--,n<0&&(n=11,o--);}a.drawMonth=n,a.drawYear=o;var q=this._get(a,"prevText");q=f?this.formatDate(q,this._daylightSavingAdjust(new Date(o,n-i,1)),this._getFormatConfig(a)):q;var r=this._canAdjustMonth(a,-1,o,n)?""+q+"":e?"":""+q+"",s=this._get(a,"nextText");s=f?this.formatDate(s,this._daylightSavingAdjust(new Date(o,n+i,1)),this._getFormatConfig(a)):s;var t=this._canAdjustMonth(a,1,o,n)?""+s+"":e?"":""+s+"",u=this._get(a,"currentText"),v=this._get(a,"gotoCurrent")&&a.currentDay?k:b;u=f?this.formatDate(u,v,this._getFormatConfig(a)):u;var w=a.inline?"":"",x=d?"
      "+(c?w:"")+(this._isInRange(a,v)?"":"")+(c?"":w)+"
      ":"",y=parseInt(this._get(a,"firstDay"),10);y=isNaN(y)?0:y;var z=this._get(a,"showWeek"),A=this._get(a,"dayNames"),B=this._get(a,"dayNamesShort"),C=this._get(a,"dayNamesMin"),D=this._get(a,"monthNames"),E=this._get(a,"monthNamesShort"),F=this._get(a,"beforeShowDay"),G=this._get(a,"showOtherMonths"),H=this._get(a,"selectOtherMonths"),I=this._get(a,"calculateWeek")||this.iso8601Week,J=this._getDefaultDate(a),K="";for(var L=0;L1)switch(N){case 0:Q+=" ui-datepicker-group-first",P=" ui-corner-"+(c?"right":"left");break;case g[1]-1:Q+=" ui-datepicker-group-last",P=" ui-corner-"+(c?"left":"right");break;default:Q+=" ui-datepicker-group-middle",P="";}Q+="\">";}Q+="
      "+(/all|left/.test(P)&&L==0?c?t:r:"")+(/all|right/.test(P)&&L==0?c?r:t:"")+this._generateMonthYearHeader(a,n,o,l,m,L>0||N>0,D,E)+"
      "+"";var R=z?"":"";for(var S=0;S<7;S++){var T=(S+y)%7;R+="=5?" class=\"ui-datepicker-week-end\"":"")+">"+""+C[T]+"";}Q+=R+"";var U=this._getDaysInMonth(o,n);o==a.selectedYear&&n==a.selectedMonth&&(a.selectedDay=Math.min(a.selectedDay,U));var V=(this._getFirstDayOfMonth(o,n)-y+7)%7,W=Math.ceil((V+U)/7),X=j?this.maxRows>W?this.maxRows:W:W;this.maxRows=X;var Y=this._daylightSavingAdjust(new Date(o,n,1-V));for(var Z=0;Z";var _=z?"":"";for(var S=0;S<7;S++){var ba=F?F.apply(a.input?a.input[0]:null,[Y]):[!0,""],bb=Y.getMonth()!=n,bc=bb&&!H||!ba[0]||l&&Ym;_+="",Y.setDate(Y.getDate()+1),Y=this._daylightSavingAdjust(Y);}Q+=_+"";}n++,n>11&&(n=0,o++),Q+="
      "+this._get(a,"weekHeader")+"
      "+this._get(a,"calculateWeek")(Y)+"=5?" ui-datepicker-week-end":"")+(bb?" ui-datepicker-other-month":"")+(Y.getTime()==O.getTime()&&n==a.selectedMonth&&a._keyEvent||J.getTime()==Y.getTime()&&J.getTime()==O.getTime()?" "+this._dayOverClass:"")+(bc?" "+this._unselectableClass+" ui-state-disabled":"")+(bb&&!G?"":" "+ba[1]+(Y.getTime()==k.getTime()?" "+this._currentClass:"")+(Y.getTime()==b.getTime()?" ui-datepicker-today":""))+"\""+((!bb||G)&&ba[2]?" title=\""+ba[2]+"\"":"")+(bc?"":" onclick=\"DP_jQuery_"+dpuuid+".datepicker._selectDay('#"+a.id+"',"+Y.getMonth()+","+Y.getFullYear()+", this);return false;\"")+">"+(bb&&!G?" ":bc?""+Y.getDate()+"":""+Y.getDate()+"")+"
      "+(j?""+(g[0]>0&&N==g[1]-1?"
      ":""):""),M+=Q;}K+=M;}K+=x+($.browser.msie&&parseInt($.browser.version,10)<7&&!a.inline?"":""),a._keyEvent=!1;return K;},_generateMonthYearHeader:function(a,b,c,d,e,f,g,h){var i=this._get(a,"changeMonth"),j=this._get(a,"changeYear"),k=this - ._get(a,"showMonthAfterYear"),l="
      ",m="";if(f||!i)m+=""+g[b]+"";else{var n=d&&d.getFullYear()==c,o=e&&e.getFullYear()==c;m+="";}k||(l+=m+(f||!i||!j?" ":""));if(!a.yearshtml){a.yearshtml="";if(f||!j)l+=""+c+"";else{var q=this._get(a,"yearRange").split(":"),r=(new Date).getFullYear(),s=function(a){var b=a.match(/c[+-].*/)?c+parseInt(a.substring(1),10):a.match(/[+-].*/)?r+parseInt(a,10):parseInt(a,10);return isNaN(b)?r:b;},t=s(q[0]),u=Math.max(t,s(q[1]||""));t=d?Math.max(t,d.getFullYear()):t,u=e?Math.min(u,e.getFullYear()):u,a.yearshtml+="",l+=a.yearshtml,a.yearshtml=null;}}l+=this._get(a,"yearSuffix"),k&&(l+=(f||!i||!j?" ":"")+m),l+="
      ";return l;},_adjustInstDate:function(a,b,c){var d=a.drawYear+(c=="Y"?b:0),e=a.drawMonth+(c=="M"?b:0),f=Math.min(a.selectedDay,this._getDaysInMonth(d,e))+(c=="D"?b:0),g=this._restrictMinMax(a,this._daylightSavingAdjust(new Date(d,e,f)));a.selectedDay=g.getDate(),a.drawMonth=a.selectedMonth=g.getMonth(),a.drawYear=a.selectedYear=g.getFullYear(),(c=="M"||c=="Y")&&this._notifyChange(a);},_restrictMinMax:function(a,b){var c=this._getMinMaxDate(a,"min"),d=this._getMinMaxDate(a,"max"),e=c&&bd?d:e;return e;},_notifyChange:function(a){var b=this._get(a,"onChangeMonthYear");b&&b.apply(a.input?a.input[0]:null,[a.selectedYear,a.selectedMonth+1,a]);},_getNumberOfMonths:function(a){var b=this._get(a,"numberOfMonths");return b==null?[1,1]:typeof b=="number"?[1,b]:b;},_getMinMaxDate:function(a,b){return this._determineDate(a,this._get(a,b+"Date"),null);},_getDaysInMonth:function(a,b){return 32-this._daylightSavingAdjust(new Date(a,b,32)).getDate();},_getFirstDayOfMonth:function(a,b){return(new Date(a,b,1)).getDay();},_canAdjustMonth:function(a,b,c,d){var e=this._getNumberOfMonths(a),f=this._daylightSavingAdjust(new Date(c,d+(b<0?b:e[0]*e[1]),1));b<0&&f.setDate(this._getDaysInMonth(f.getFullYear(),f.getMonth()));return this._isInRange(a,f);},_isInRange:function(a,b){var c=this._getMinMaxDate(a,"min"),d=this._getMinMaxDate(a,"max");return(!c||b.getTime()>=c.getTime())&&(!d||b.getTime()<=d.getTime());},_getFormatConfig:function(a){var b=this._get(a,"shortYearCutoff");b=typeof b!="string"?b:(new Date).getFullYear()%100+parseInt(b,10);return{shortYearCutoff:b,dayNamesShort:this._get(a,"dayNamesShort"),dayNames:this._get(a,"dayNames"),monthNamesShort:this._get(a,"monthNamesShort"),monthNames:this._get(a,"monthNames")};},_formatDate:function(a,b,c,d){b||(a.currentDay=a.selectedDay,a.currentMonth=a.selectedMonth,a.currentYear=a.selectedYear);var e=b?typeof b=="object"?b:this._daylightSavingAdjust(new Date(d,c,b)):this._daylightSavingAdjust(new Date(a.currentYear,a.currentMonth,a.currentDay));return this.formatDate(this._get(a,"dateFormat"),e,this._getFormatConfig(a));}}),$.fn.datepicker=function(a){if(!this.length)return this;$.datepicker.initialized||($(document).mousedown($.datepicker._checkExternalClick).find("body").append($.datepicker.dpDiv),$.datepicker.initialized=!0);var b=Array.prototype.slice.call(arguments,1);if(typeof a=="string"&&(a=="isDisabled"||a=="getDate"||a=="widget"))return $.datepicker["_"+a+"Datepicker"].apply($.datepicker,[this[0]].concat(b));if(a=="option"&&arguments.length==2&&typeof arguments[1]=="string")return $.datepicker["_"+a+"Datepicker"].apply($.datepicker,[this[0]].concat(b));return this.each(function(){typeof a=="string"?$.datepicker["_"+a+"Datepicker"].apply($.datepicker,[this].concat(b)):$.datepicker._attachDatepicker(this,a);});},$.datepicker=new Datepicker,$.datepicker.initialized=!1,$.datepicker.uuid=(new Date).getTime(),$.datepicker.version="1.8.17",window["DP_jQuery_"+dpuuid]=$;})(jQuery);/* + */(function($,undefined){function isArray(a){return a&&($.browser.safari&&typeof a=='object'&&a.length||a.constructor&&a.constructor.toString().match(/\Array\(\)/));}function extendRemove(a,b){$.extend(a,b);for(var c in b)if(b[c]==null||b[c]==undefined)a[c]=b[c];return a;}function bindHover(a){var b='button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a';return a.bind('mouseout',function(a){var c=$(a.target).closest(b);!c.length||c.removeClass('ui-state-hover ui-datepicker-prev-hover ui-datepicker-next-hover');}).bind('mouseover',function(c){var d=$(c.target).closest(b);!$.datepicker._isDisabledDatepicker(instActive.inline?a.parent()[0]:instActive.input[0])&&!!d.length&&(d.parents('.ui-datepicker-calendar').find('a').removeClass('ui-state-hover'),d.addClass('ui-state-hover'),d.hasClass('ui-datepicker-prev')&&d.addClass('ui-datepicker-prev-hover'),d.hasClass('ui-datepicker-next')&&d.addClass('ui-datepicker-next-hover'));});}function Datepicker(){this.debug=!1,this._curInst=null,this._keyEvent=!1,this._disabledInputs=[],this._datepickerShowing=!1,this._inDialog=!1,this._mainDivId='ui-datepicker-div',this._inlineClass='ui-datepicker-inline',this._appendClass='ui-datepicker-append',this._triggerClass='ui-datepicker-trigger',this._dialogClass='ui-datepicker-dialog',this._disableClass='ui-datepicker-disabled',this._unselectableClass='ui-datepicker-unselectable',this._currentClass='ui-datepicker-current-day',this._dayOverClass='ui-datepicker-days-cell-over',this.regional=[],this.regional['']={closeText:'Done',prevText:'Prev',nextText:'Next',currentText:'Today',monthNames:['January','February','March','April','May','June','July','August','September','October','November','December'],monthNamesShort:['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'],dayNames:['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],dayNamesShort:['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],dayNamesMin:['Su','Mo','Tu','We','Th','Fr','Sa'],weekHeader:'Wk',dateFormat:'mm/dd/yy',firstDay:0,isRTL:!1,showMonthAfterYear:!1,yearSuffix:''},this._defaults={showOn:'focus',showAnim:'fadeIn',showOptions:{},defaultDate:null,appendText:'',buttonText:'...',buttonImage:'',buttonImageOnly:!1,hideIfNoPrevNext:!1,navigationAsDateFormat:!1,gotoCurrent:!1,changeMonth:!1,changeYear:!1,yearRange:'c-10:c+10',showOtherMonths:!1,selectOtherMonths:!1,showWeek:!1,calculateWeek:this.iso8601Week,shortYearCutoff:'+10',minDate:null,maxDate:null,duration:'fast',beforeShowDay:null,beforeShow:null,onSelect:null,onChangeMonthYear:null,onClose:null,numberOfMonths:1,showCurrentAtPos:0,stepMonths:1,stepBigMonths:12,altField:'',altFormat:'',constrainInput:!0,showButtonPanel:!1,autoSize:!1,disabled:!1},$.extend(this._defaults,this.regional['']),this.dpDiv=bindHover($('
      '));}$.extend($.ui,{datepicker:{version:'1.8.17'}});var PROP_NAME='datepicker',dpuuid=(new Date).getTime(),instActive;$.extend(Datepicker.prototype,{markerClassName:'hasDatepicker',maxRows:4,log:function(){this.debug&&console.log.apply('',arguments);},_widgetDatepicker:function(){return this.dpDiv;},setDefaults:function(a){extendRemove(this._defaults,a||{});return this;},_attachDatepicker:function(target,settings){var inlineSettings=null;for(var attrName in this._defaults){var attrValue=target.getAttribute('date:'+attrName);if(attrValue){inlineSettings=inlineSettings||{};try{inlineSettings[attrName]=eval(attrValue);}catch(err){inlineSettings[attrName]=attrValue;}}}var nodeName=target.nodeName.toLowerCase(),inline=nodeName=='div'||nodeName=='span';target.id||(this.uuid+=1,target.id='dp'+this.uuid);var inst=this._newInst($(target),inline);inst.settings=$.extend({},settings||{},inlineSettings||{}),nodeName=='input'?this._connectDatepicker(target,inst):inline&&this._inlineDatepicker(target,inst);},_newInst:function(a,b){var c=a[0].id.replace(/([^A-Za-z0-9_-])/g,'\\\\$1');return{id:c,input:a,selectedDay:0,selectedMonth:0,selectedYear:0,drawMonth:0,drawYear:0,inline:b,dpDiv:b?bindHover($('
      ')):this.dpDiv};},_connectDatepicker:function(a,b){var c=$(a);b.append=$([]),b.trigger=$([]);c.hasClass(this.markerClassName)||(this._attachments(c,b),c.addClass(this.markerClassName).keydown(this._doKeyDown).keypress(this._doKeyPress).keyup(this._doKeyUp).bind('setData.datepicker',function(a,c,d){b.settings[c]=d;}).bind('getData.datepicker',function(a,c){return this._get(b,c);}),this._autoSize(b),$.data(a,PROP_NAME,b),b.settings.disabled&&this._disableDatepicker(a));},_attachments:function(a,b){var c=this._get(b,'appendText'),d=this._get(b,'isRTL');b.append&&b.append.remove(),c&&(b.append=$(''+c+''),a[d?'before':'after'](b.append)),a.unbind('focus',this._showDatepicker),b.trigger&&b.trigger.remove();var e=this._get(b,'showOn');(e=='focus'||e=='both')&&a.focus(this._showDatepicker);if(e=='button'||e=='both'){var f=this._get(b,'buttonText'),g=this._get(b,'buttonImage');b.trigger=$(this._get(b,'buttonImageOnly')?$('').addClass(this._triggerClass).attr({src:g,alt:f,title:f}):$('').addClass(this._triggerClass).html(g==''?f:$('').attr({src:g,alt:f,title:f}))),a[d?'before':'after'](b.trigger),b.trigger.click(function(){$.datepicker._datepickerShowing&&$.datepicker._lastInput==a[0]?$.datepicker._hideDatepicker():$.datepicker._showDatepicker(a[0]);return!1;});}},_autoSize:function(a){if(this._get(a,'autoSize')&&!a.inline){var b=new Date(2009,11,20),c=this._get(a,'dateFormat');if(c.match(/[DM]/)){var d=function(a){var b=0,c=0;for(var d=0;db&&(b=a[d].length,c=d);return c;};b.setMonth(d(this._get(a,c.match(/MM/)?'monthNames':'monthNamesShort'))),b.setDate(d(this._get(a,c.match(/DD/)?'dayNames':'dayNamesShort'))+20-b.getDay());}a.input.attr('size',this._formatDate(a,b).length);}},_inlineDatepicker:function(a,b){var c=$(a);c.hasClass(this.markerClassName)||(c.addClass(this.markerClassName).append(b.dpDiv).bind('setData.datepicker',function(a,c,d){b.settings[c]=d;}).bind('getData.datepicker',function(a,c){return this._get(b,c);}),$.data(a,PROP_NAME,b),this._setDate(b,this._getDefaultDate(b),!0),this._updateDatepicker(b),this._updateAlternate(b),b.settings.disabled&&this._disableDatepicker(a),b.dpDiv.css('display','block'));},_dialogDatepicker:function(a,b,c,d,e){var f=this._dialogInst;if(!f){this.uuid+=1;var g='dp'+this.uuid;this._dialogInput=$(''),this._dialogInput.keydown(this._doKeyDown),$('body').append(this._dialogInput),f=this._dialogInst=this._newInst(this._dialogInput,!1),f.settings={},$.data(this._dialogInput[0],PROP_NAME,f);}extendRemove(f.settings,d||{}),b=b&&b.constructor==Date?this._formatDate(f,b):b,this._dialogInput.val(b),this._pos=e?e.length?e:[e.pageX,e.pageY]:null;if(!this._pos){var h=document.documentElement.clientWidth,i=document.documentElement.clientHeight,j=document.documentElement.scrollLeft||document.body.scrollLeft,k=document.documentElement.scrollTop||document.body.scrollTop;this._pos=[h/2-100+j,i/2-150+k];}this._dialogInput.css('left',this._pos[0]+20+'px').css('top',this._pos[1]+'px'),f.settings.onSelect=c,this._inDialog=!0,this.dpDiv.addClass(this._dialogClass),this._showDatepicker(this._dialogInput[0]),$.blockUI&&$.blockUI(this.dpDiv),$.data(this._dialogInput[0],PROP_NAME,f);return this;},_destroyDatepicker:function(a){var b=$(a),c=$.data(a,PROP_NAME);if(b.hasClass(this.markerClassName)){var d=a.nodeName.toLowerCase();$.removeData(a,PROP_NAME),d=='input'?(c.append.remove(),c.trigger.remove(),b.removeClass(this.markerClassName).unbind('focus',this._showDatepicker).unbind('keydown',this._doKeyDown).unbind('keypress',this._doKeyPress).unbind('keyup',this._doKeyUp)):(d=='div'||d=='span')&&b.removeClass(this.markerClassName).empty();}},_enableDatepicker:function(a){var b=$(a),c=$.data(a,PROP_NAME);if(b.hasClass(this.markerClassName)){var d=a.nodeName.toLowerCase();if(d=='input')a.disabled=!1,c.trigger.filter('button').each(function(){this.disabled=!1;}).end().filter('img').css({opacity:'1.0',cursor:''});else if(d=='div'||d=='span'){var e=b.children('.'+this._inlineClass);e.children().removeClass('ui-state-disabled'),e.find('select.ui-datepicker-month, select.ui-datepicker-year').removeAttr('disabled');}this._disabledInputs=$.map(this._disabledInputs,function(b){return b==a?null:b;});}},_disableDatepicker:function(a){var b=$(a),c=$.data(a,PROP_NAME);if(b.hasClass(this.markerClassName)){var d=a.nodeName.toLowerCase();if(d=='input')a.disabled=!0,c.trigger.filter('button').each(function(){this.disabled=!0;}).end().filter('img').css({opacity:'0.5',cursor:'default'});else if(d=='div'||d=='span'){var e=b.children('.'+this._inlineClass);e.children().addClass('ui-state-disabled'),e.find('select.ui-datepicker-month, select.ui-datepicker-year').attr('disabled','disabled');}this._disabledInputs=$.map(this._disabledInputs,function(b){return b==a?null:b;}),this._disabledInputs[this._disabledInputs.length]=a;}},_isDisabledDatepicker:function(a){if(!a)return!1;for(var b=0;b-1;}},_doKeyUp:function(a){var b=$.datepicker._getInst(a.target);if(b.input.val()!=b.lastVal)try{var c=$.datepicker.parseDate($.datepicker._get(b,'dateFormat'),b.input?b.input.val():null,$.datepicker._getFormatConfig(b));c&&($.datepicker._setDateFromField(b),$.datepicker._updateAlternate(b),$.datepicker._updateDatepicker(b));}catch(a){$.datepicker.log(a);}return!0;},_showDatepicker:function(a){a=a.target||a,a.nodeName.toLowerCase()!='input'&&(a=$('input',a.parentNode)[0]);if(!$.datepicker._isDisabledDatepicker(a)&&$.datepicker._lastInput!=a){var b=$.datepicker._getInst(a);$.datepicker._curInst&&$.datepicker._curInst!=b&&($.datepicker._curInst.dpDiv.stop(!0,!0),b&&$.datepicker._datepickerShowing&&$.datepicker._hideDatepicker($.datepicker._curInst.input[0]));var c=$.datepicker._get(b,'beforeShow'),d=c?c.apply(a,[a,b]):{};if(d===!1)return;extendRemove(b.settings,d),b.lastVal=null,$.datepicker._lastInput=a,$.datepicker._setDateFromField(b),$.datepicker._inDialog&&(a.value=''),$.datepicker._pos||($.datepicker._pos=$.datepicker._findPos(a),$.datepicker._pos[1]+=a.offsetHeight);var e=!1;$(a).parents().each(function(){e|=$(this).css('position')=='fixed';return!e;}),e&&$.browser.opera&&($.datepicker._pos[0]-=document.documentElement.scrollLeft,$.datepicker._pos[1]-=document.documentElement.scrollTop);var f={left:$.datepicker._pos[0],top:$.datepicker._pos[1]};$.datepicker._pos=null,b.dpDiv.empty(),b.dpDiv.css({position:'absolute',display:'block',top:'-1000px'}),$.datepicker._updateDatepicker(b),f=$.datepicker._checkOffset(b,f,e),b.dpDiv.css({position:$.datepicker._inDialog&&$.blockUI?'static':e?'fixed':'absolute',display:'none',left:f.left+'px',top:f.top+'px'});if(!b.inline){var g=$.datepicker._get(b,'showAnim'),h=$.datepicker._get(b,'duration'),i=function(){var a=b.dpDiv.find('iframe.ui-datepicker-cover');if(a.length){var c=$.datepicker._getBorders(b.dpDiv);a.css({left:-c[0],top:-c[1],width:b.dpDiv.outerWidth(),height:b.dpDiv.outerHeight()});}};b.dpDiv.zIndex($(a).zIndex()+1),$.datepicker._datepickerShowing=!0,$.effects&&$.effects[g]?b.dpDiv.show(g,$.datepicker._get(b,'showOptions'),h,i):b.dpDiv[g||'show'](g?h:null,i),(!g||!h)&&i(),b.input.is(':visible')&&!b.input.is(':disabled')&&b.input.focus(),$.datepicker._curInst=b;}}},_updateDatepicker:function(a){var b=this;b.maxRows=4;var c=$.datepicker._getBorders(a.dpDiv);instActive=a,a.dpDiv.empty().append(this._generateHTML(a));var d=a.dpDiv.find('iframe.ui-datepicker-cover');!d.length||d.css({left:-c[0],top:-c[1],width:a.dpDiv.outerWidth(),height:a.dpDiv.outerHeight()}),a.dpDiv.find('.'+this._dayOverClass+' a').mouseover();var e=this._getNumberOfMonths(a),f=e[1],g=17;a.dpDiv.removeClass('ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4').width(''),f>1&&a.dpDiv.addClass('ui-datepicker-multi-'+f).css('width',g*f+'em'),a.dpDiv[(e[0]!=1||e[1]!=1?'add':'remove')+'Class']('ui-datepicker-multi'),a.dpDiv[(this._get(a,'isRTL')?'add':'remove')+'Class']('ui-datepicker-rtl'),a==$.datepicker._curInst&&$.datepicker._datepickerShowing&&a.input&&a.input.is(':visible')&&!a.input.is(':disabled')&&a.input[0]!=document.activeElement&&a.input.focus();if(a.yearshtml){var h=a.yearshtml;setTimeout(function(){h===a.yearshtml&&a.yearshtml&&a.dpDiv.find('select.ui-datepicker-year:first').replaceWith(a.yearshtml),h=a.yearshtml=null;},0);}},_getBorders:function(a){var b=function(a){return{thin:1,medium:2,thick:3}[a]||a;};return[parseFloat(b(a.css('border-left-width'))),parseFloat(b(a.css('border-top-width')))];},_checkOffset:function(a,b,c){var d=a.dpDiv.outerWidth(),e=a.dpDiv.outerHeight(),f=a.input?a.input.outerWidth():0,g=a.input?a.input.outerHeight():0,h=document.documentElement.clientWidth+$(document).scrollLeft(),i=document.documentElement.clientHeight+$(document).scrollTop();b.left-=this._get(a,'isRTL')?d-f:0,b.left-=c&&b.left==a.input.offset().left?$(document).scrollLeft():0,b.top-=c&&b.top==a.input.offset().top+g?$(document).scrollTop():0,b.left-=Math.min(b.left,b.left+d>h&&h>d?Math.abs(b.left+d-h):0),b.top-=Math.min(b.top,b.top+e>i&&i>e?Math.abs(e+g):0);return b;},_findPos:function(a){var b=this._getInst(a),c=this._get(b,'isRTL');while(a&&(a.type=='hidden'||a.nodeType!=1||$.expr.filters.hidden(a)))a=a[c?'previousSibling':'nextSibling'];var d=$(a).offset();return[d.left,d.top];},_hideDatepicker:function(a){var b=this._curInst;if(!(!b||a&&b!=$.data(a,PROP_NAME))&&this._datepickerShowing){var c=this._get(b,'showAnim'),d=this._get(b,'duration'),e=this,f=function(){$.datepicker._tidyDialog(b),e._curInst=null;};$.effects&&$.effects[c]?b.dpDiv.hide(c,$.datepicker._get(b,'showOptions'),d,f):b.dpDiv[c=='slideDown'?'slideUp':c=='fadeIn'?'fadeOut':'hide'](c?d:null,f),c||f(),this._datepickerShowing=!1;var g=this._get(b,'onClose');g&&g.apply(b.input?b.input[0]:null,[b.input?b.input.val():'',b]),this._lastInput=null,this._inDialog&&(this._dialogInput.css({position:'absolute',left:'0',top:'-100px'}),$.blockUI&&($.unblockUI(),$('body').append(this.dpDiv))),this._inDialog=!1;}},_tidyDialog:function(a){a.dpDiv.removeClass(this._dialogClass).unbind('.ui-datepicker-calendar');},_checkExternalClick:function(a){if($.datepicker._curInst){var b=$(a.target),c=$.datepicker._getInst(b[0]);(b[0].id!=$.datepicker._mainDivId&&b.parents('#'+$.datepicker._mainDivId).length==0&&!b.hasClass($.datepicker.markerClassName)&&!b.hasClass($.datepicker._triggerClass)&&$.datepicker._datepickerShowing&&(!$.datepicker._inDialog||!$.blockUI)||b.hasClass($.datepicker.markerClassName)&&$.datepicker._curInst!=c)&&$.datepicker._hideDatepicker();}},_adjustDate:function(a,b,c){var d=$(a),e=this._getInst(d[0]);this._isDisabledDatepicker(d[0])||(this._adjustInstDate(e,b+(c=='M'?this._get(e,'showCurrentAtPos'):0),c),this._updateDatepicker(e));},_gotoToday:function(a){var b=$(a),c=this._getInst(b[0]);if(this._get(c,'gotoCurrent')&&c.currentDay)c.selectedDay=c.currentDay,c.drawMonth=c.selectedMonth=c.currentMonth,c.drawYear=c.selectedYear=c.currentYear;else{var d=new Date;c.selectedDay=d.getDate(),c.drawMonth=c.selectedMonth=d.getMonth(),c.drawYear=c.selectedYear=d.getFullYear();}this._notifyChange(c),this._adjustDate(b);},_selectMonthYear:function(a,b,c){var d=$(a),e=this._getInst(d[0]);e['selected'+(c=='M'?'Month':'Year')]=e['draw'+(c=='M'?'Month':'Year')]=parseInt(b.options[b.selectedIndex].value,10),this._notifyChange(e),this._adjustDate(d);},_selectDay:function(a,b,c,d){var e=$(a);if(!$(d).hasClass(this._unselectableClass)&&!this._isDisabledDatepicker(e[0])){var f=this._getInst(e[0]);f.selectedDay=f.currentDay=$('a',d).html(),f.selectedMonth=f.currentMonth=b,f.selectedYear=f.currentYear=c,this._selectDate(a,this._formatDate(f,f.currentDay,f.currentMonth,f.currentYear));}},_clearDate:function(a){var b=$(a),c=this._getInst(b[0]);this._selectDate(b,'');},_selectDate:function(a,b){var c=$(a),d=this._getInst(c[0]);b=b!=null?b:this._formatDate(d),d.input&&d.input.val(b),this._updateAlternate(d);var e=this._get(d,'onSelect');e?e.apply(d.input?d.input[0]:null,[b,d]):d.input&&d.input.trigger('change'),d.inline?this._updateDatepicker(d):(this._hideDatepicker(),this._lastInput=d.input[0],typeof d.input[0]!='object'&&d.input.focus(),this._lastInput=null);},_updateAlternate:function(a){var b=this._get(a,'altField');if(b){var c=this._get(a,'altFormat')||this._get(a,'dateFormat'),d=this._getDate(a),e=this.formatDate(c,d,this._getFormatConfig(a));$(b).each(function(){$(this).val(e);});}},noWeekends:function(a){var b=a.getDay();return[b>0&&b<6,''];},iso8601Week:function(a){var b=new Date(a.getTime());b.setDate(b.getDate()+4-(b.getDay()||7));var c=b.getTime();b.setMonth(0),b.setDate(1);return Math.floor(Math.round((c-b)/864e5)/7)+1;},parseDate:function(a,b,c){if(a==null||b==null)throw'Invalid arguments';b=typeof b=='object'?b.toString():b+'';if(b=='')return null;var d=(c?c.shortYearCutoff:null)||this._defaults.shortYearCutoff;d=typeof d!='string'?d:(new Date).getFullYear()%100+parseInt(d,10);var e=(c?c.dayNamesShort:null)||this._defaults.dayNamesShort,f=(c?c.dayNames:null)||this._defaults.dayNames,g=(c?c.monthNamesShort:null)||this._defaults.monthNamesShort,h=(c?c.monthNames:null)||this._defaults.monthNames,i=-1,j=-1,k=-1,l=-1,m=!1,n=function(b){var c=s+1-1){j=1,k=l;for(;;){var u=this._getDaysInMonth(i,j-1);if(k<=u)break;j++,k-=u;}}var t=this._daylightSavingAdjust(new Date(i,j-1,k));if(t.getFullYear()!=i||t.getMonth()+1!=j||t.getDate()!=k)throw'Invalid date';return t;},ATOM:'yy-mm-dd',COOKIE:'D, dd M yy',ISO_8601:'yy-mm-dd',RFC_822:'D, d M y',RFC_850:'DD, dd-M-y',RFC_1036:'D, d M y',RFC_1123:'D, d M yy',RFC_2822:'D, d M yy',RSS:'D, d M y',TICKS:'!',TIMESTAMP:'@',W3C:'yy-mm-dd',_ticksTo1970:(718685+Math.floor(492.5)-Math.floor(19.7)+Math.floor(4.925))*24*60*60*1e7,formatDate:function(a,b,c){if(!b)return'';var d=(c?c.dayNamesShort:null)||this._defaults.dayNamesShort,e=(c?c.dayNames:null)||this._defaults.dayNames,f=(c?c.monthNamesShort:null)||this._defaults.monthNamesShort,g=(c?c.monthNames:null)||this._defaults.monthNames,h=function(b){var c=m+112?a.getHours()+2:0);return a;},_setDate:function(a,b,c){var d=!b,e=a.selectedMonth,f=a.selectedYear,g=this._restrictMinMax(a,this._determineDate(a,b,new Date));a.selectedDay=a.currentDay=g.getDate(),a.drawMonth=a.selectedMonth=a.currentMonth=g.getMonth(),a.drawYear=a.selectedYear=a.currentYear=g.getFullYear(),(e!=a.selectedMonth||f!=a.selectedYear)&&!c&&this._notifyChange(a),this._adjustInstDate(a),a.input&&a.input.val(d?'':this._formatDate(a));},_getDate:function(a){var b=!a.currentYear||a.input&&a.input.val()==''?null:this._daylightSavingAdjust(new Date(a.currentYear,a.currentMonth,a.currentDay));return b;},_generateHTML:function(a){var b=new Date;b=this._daylightSavingAdjust(new Date(b.getFullYear(),b.getMonth(),b.getDate()));var c=this._get(a,'isRTL'),d=this._get(a,'showButtonPanel'),e=this._get(a,'hideIfNoPrevNext'),f=this._get(a,'navigationAsDateFormat'),g=this._getNumberOfMonths(a),h=this._get(a,'showCurrentAtPos'),i=this._get(a,'stepMonths'),j=g[0]!=1||g[1]!=1,k=this._daylightSavingAdjust(a.currentDay?new Date(a.currentYear,a.currentMonth,a.currentDay):new Date(9999,9,9)),l=this._getMinMaxDate(a,'min'),m=this._getMinMaxDate(a,'max'),n=a.drawMonth-h,o=a.drawYear;n<0&&(n+=12,o--);if(m){var p=this._daylightSavingAdjust(new Date(m.getFullYear(),m.getMonth()-g[0]*g[1]+1,m.getDate()));p=l&&pp)n--,n<0&&(n=11,o--);}a.drawMonth=n,a.drawYear=o;var q=this._get(a,'prevText');q=f?this.formatDate(q,this._daylightSavingAdjust(new Date(o,n-i,1)),this._getFormatConfig(a)):q;var r=this._canAdjustMonth(a,-1,o,n)?''+q+'':e?'':''+q+'',s=this._get(a,'nextText');s=f?this.formatDate(s,this._daylightSavingAdjust(new Date(o,n+i,1)),this._getFormatConfig(a)):s;var t=this._canAdjustMonth(a,1,o,n)?''+s+'':e?'':''+s+'',u=this._get(a,'currentText'),v=this._get(a,'gotoCurrent')&&a.currentDay?k:b;u=f?this.formatDate(u,v,this._getFormatConfig(a)):u;var w=a.inline?'':'',x=d?'
      '+(c?w:'')+(this._isInRange(a,v)?'':'')+(c?'':w)+'
      ':'',y=parseInt(this._get(a,'firstDay'),10);y=isNaN(y)?0:y;var z=this._get(a,'showWeek'),A=this._get(a,'dayNames'),B=this._get(a,'dayNamesShort'),C=this._get(a,'dayNamesMin'),D=this._get(a,'monthNames'),E=this._get(a,'monthNamesShort'),F=this._get(a,'beforeShowDay'),G=this._get(a,'showOtherMonths'),H=this._get(a,'selectOtherMonths'),I=this._get(a,'calculateWeek')||this.iso8601Week,J=this._getDefaultDate(a),K='';for(var L=0;L1)switch(N){case 0:Q+=' ui-datepicker-group-first',P=' ui-corner-'+(c?'right':'left');break;case g[1]-1:Q+=' ui-datepicker-group-last',P=' ui-corner-'+(c?'left':'right');break;default:Q+=' ui-datepicker-group-middle',P='';}Q+='">';}Q+='
      '+(/all|left/.test(P)&&L==0?c?t:r:'')+(/all|right/.test(P)&&L==0?c?r:t:'')+this._generateMonthYearHeader(a,n,o,l,m,L>0||N>0,D,E)+'
      '+'';var R=z?'':'';for(var S=0;S<7;S++){var T=(S+y)%7;R+='=5?' class="ui-datepicker-week-end"':'')+'>'+''+C[T]+'';}Q+=R+'';var U=this._getDaysInMonth(o,n);o==a.selectedYear&&n==a.selectedMonth&&(a.selectedDay=Math.min(a.selectedDay,U));var V=(this._getFirstDayOfMonth(o,n)-y+7)%7,W=Math.ceil((V+U)/7),X=j?this.maxRows>W?this.maxRows:W:W;this.maxRows=X;var Y=this._daylightSavingAdjust(new Date(o,n,1-V));for(var Z=0;Z';var _=z?'':'';for(var S=0;S<7;S++){var ba=F?F.apply(a.input?a.input[0]:null,[Y]):[!0,''],bb=Y.getMonth()!=n,bc=bb&&!H||!ba[0]||l&&Ym;_+='',Y.setDate(Y.getDate()+1),Y=this._daylightSavingAdjust(Y);}Q+=_+'';}n++,n>11&&(n=0,o++),Q+='
      '+this._get(a,'weekHeader')+'
      '+this._get(a,'calculateWeek')(Y)+''+(bb&&!G?' ':bc?''+Y.getDate()+'':''+Y.getDate()+'')+'
      '+(j?''+(g[0]>0&&N==g[1]-1?'
      ':''):''),M+=Q;}K+=M;}K+=x+($.browser.msie&&parseInt($.browser.version,10)<7&&!a.inline?'':''),a._keyEvent=!1;return K;},_generateMonthYearHeader:function(a,b,c,d,e,f,g,h){var i=this._get(a,'changeMonth'),j=this._get(a,'changeYear'),k=this + ._get(a,'showMonthAfterYear'),l='
      ',m='';if(f||!i)m+=''+g[b]+'';else{var n=d&&d.getFullYear()==c,o=e&&e.getFullYear()==c;m+='';}k||(l+=m+(f||!i||!j?' ':''));if(!a.yearshtml){a.yearshtml='';if(f||!j)l+=''+c+'';else{var q=this._get(a,'yearRange').split(':'),r=(new Date).getFullYear(),s=function(a){var b=a.match(/c[+-].*/)?c+parseInt(a.substring(1),10):a.match(/[+-].*/)?r+parseInt(a,10):parseInt(a,10);return isNaN(b)?r:b;},t=s(q[0]),u=Math.max(t,s(q[1]||''));t=d?Math.max(t,d.getFullYear()):t,u=e?Math.min(u,e.getFullYear()):u,a.yearshtml+='',l+=a.yearshtml,a.yearshtml=null;}}l+=this._get(a,'yearSuffix'),k&&(l+=(f||!i||!j?' ':'')+m),l+='
      ';return l;},_adjustInstDate:function(a,b,c){var d=a.drawYear+(c=='Y'?b:0),e=a.drawMonth+(c=='M'?b:0),f=Math.min(a.selectedDay,this._getDaysInMonth(d,e))+(c=='D'?b:0),g=this._restrictMinMax(a,this._daylightSavingAdjust(new Date(d,e,f)));a.selectedDay=g.getDate(),a.drawMonth=a.selectedMonth=g.getMonth(),a.drawYear=a.selectedYear=g.getFullYear(),(c=='M'||c=='Y')&&this._notifyChange(a);},_restrictMinMax:function(a,b){var c=this._getMinMaxDate(a,'min'),d=this._getMinMaxDate(a,'max'),e=c&&bd?d:e;return e;},_notifyChange:function(a){var b=this._get(a,'onChangeMonthYear');b&&b.apply(a.input?a.input[0]:null,[a.selectedYear,a.selectedMonth+1,a]);},_getNumberOfMonths:function(a){var b=this._get(a,'numberOfMonths');return b==null?[1,1]:typeof b=='number'?[1,b]:b;},_getMinMaxDate:function(a,b){return this._determineDate(a,this._get(a,b+'Date'),null);},_getDaysInMonth:function(a,b){return 32-this._daylightSavingAdjust(new Date(a,b,32)).getDate();},_getFirstDayOfMonth:function(a,b){return(new Date(a,b,1)).getDay();},_canAdjustMonth:function(a,b,c,d){var e=this._getNumberOfMonths(a),f=this._daylightSavingAdjust(new Date(c,d+(b<0?b:e[0]*e[1]),1));b<0&&f.setDate(this._getDaysInMonth(f.getFullYear(),f.getMonth()));return this._isInRange(a,f);},_isInRange:function(a,b){var c=this._getMinMaxDate(a,'min'),d=this._getMinMaxDate(a,'max');return(!c||b.getTime()>=c.getTime())&&(!d||b.getTime()<=d.getTime());},_getFormatConfig:function(a){var b=this._get(a,'shortYearCutoff');b=typeof b!='string'?b:(new Date).getFullYear()%100+parseInt(b,10);return{shortYearCutoff:b,dayNamesShort:this._get(a,'dayNamesShort'),dayNames:this._get(a,'dayNames'),monthNamesShort:this._get(a,'monthNamesShort'),monthNames:this._get(a,'monthNames')};},_formatDate:function(a,b,c,d){b||(a.currentDay=a.selectedDay,a.currentMonth=a.selectedMonth,a.currentYear=a.selectedYear);var e=b?typeof b=='object'?b:this._daylightSavingAdjust(new Date(d,c,b)):this._daylightSavingAdjust(new Date(a.currentYear,a.currentMonth,a.currentDay));return this.formatDate(this._get(a,'dateFormat'),e,this._getFormatConfig(a));}}),$.fn.datepicker=function(a){if(!this.length)return this;$.datepicker.initialized||($(document).mousedown($.datepicker._checkExternalClick).find('body').append($.datepicker.dpDiv),$.datepicker.initialized=!0);var b=Array.prototype.slice.call(arguments,1);if(typeof a=='string'&&(a=='isDisabled'||a=='getDate'||a=='widget'))return $.datepicker['_'+a+'Datepicker'].apply($.datepicker,[this[0]].concat(b));if(a=='option'&&arguments.length==2&&typeof arguments[1]=='string')return $.datepicker['_'+a+'Datepicker'].apply($.datepicker,[this[0]].concat(b));return this.each(function(){typeof a=='string'?$.datepicker['_'+a+'Datepicker'].apply($.datepicker,[this].concat(b)):$.datepicker._attachDatepicker(this,a);});},$.datepicker=new Datepicker,$.datepicker.initialized=!1,$.datepicker.uuid=(new Date).getTime(),$.datepicker.version='1.8.17',window['DP_jQuery_'+dpuuid]=$;})(jQuery);/* * jQuery UI Progressbar 1.8.17 * * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) @@ -136,7 +136,7 @@ * Depends: * jquery.ui.core.js * jquery.ui.widget.js - */(function(a,b){a.widget("ui.progressbar",{options:{value:0,max:100},min:0,_create:function(){this.element.addClass("ui-progressbar ui-widget ui-widget-content ui-corner-all").attr({role:"progressbar","aria-valuemin":this.min,"aria-valuemax":this.options.max,"aria-valuenow":this._value()}),this.valueDiv=a("
      ").appendTo(this.element),this.oldValue=this._value(),this._refreshValue();},destroy:function(){this.element.removeClass("ui-progressbar ui-widget ui-widget-content ui-corner-all").removeAttr("role").removeAttr("aria-valuemin").removeAttr("aria-valuemax").removeAttr("aria-valuenow"),this.valueDiv.remove(),a.Widget.prototype.destroy.apply(this,arguments);},value:function(a){if(a===b)return this._value();this._setOption("value",a);return this;},_setOption:function(b,c){b==="value"&&(this.options.value=c,this._refreshValue(),this._value()===this.options.max&&this._trigger("complete")),a.Widget.prototype._setOption.apply(this,arguments);},_value:function(){var a=this.options.value;typeof a!="number"&&(a=0);return Math.min(this.options.max,Math.max(this.min,a));},_percentage:function(){return 100*this._value()/this.options.max;},_refreshValue:function(){var a=this.value(),b=this._percentage();this.oldValue!==a&&(this.oldValue=a,this._trigger("change")),this.valueDiv.toggle(a>this.min).toggleClass("ui-corner-right",a===this.options.max).width(b.toFixed(0)+"%"),this.element.attr("aria-valuenow",a);}}),a.extend(a.ui.progressbar,{version:"1.8.17"});})(jQuery);/* + */(function(a,b){a.widget('ui.progressbar',{options:{value:0,max:100},min:0,_create:function(){this.element.addClass('ui-progressbar ui-widget ui-widget-content ui-corner-all').attr({role:'progressbar','aria-valuemin':this.min,'aria-valuemax':this.options.max,'aria-valuenow':this._value()}),this.valueDiv=a('
      ').appendTo(this.element),this.oldValue=this._value(),this._refreshValue();},destroy:function(){this.element.removeClass('ui-progressbar ui-widget ui-widget-content ui-corner-all').removeAttr('role').removeAttr('aria-valuemin').removeAttr('aria-valuemax').removeAttr('aria-valuenow'),this.valueDiv.remove(),a.Widget.prototype.destroy.apply(this,arguments);},value:function(a){if(a===b)return this._value();this._setOption('value',a);return this;},_setOption:function(b,c){b==='value'&&(this.options.value=c,this._refreshValue(),this._value()===this.options.max&&this._trigger('complete')),a.Widget.prototype._setOption.apply(this,arguments);},_value:function(){var a=this.options.value;typeof a!='number'&&(a=0);return Math.min(this.options.max,Math.max(this.min,a));},_percentage:function(){return 100*this._value()/this.options.max;},_refreshValue:function(){var a=this.value(),b=this._percentage();this.oldValue!==a&&(this.oldValue=a,this._trigger('change')),this.valueDiv.toggle(a>this.min).toggleClass('ui-corner-right',a===this.options.max).width(b.toFixed(0)+'%'),this.element.attr('aria-valuenow',a);}}),a.extend(a.ui.progressbar,{version:'1.8.17'});})(jQuery);/* * jQuery UI Effects 1.8.17 * * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) @@ -144,7 +144,7 @@ * http://jquery.org/license * * http://docs.jquery.com/UI/Effects/ - */jQuery.effects||function(a,b){function l(b){if(!b||typeof b=="number"||a.fx.speeds[b])return!0;if(typeof b=="string"&&!a.effects[b])return!0;return!1;}function k(b,c,d,e){typeof b=="object"&&(e=c,d=null,c=b,b=c.effect),a.isFunction(c)&&(e=c,d=null,c={});if(typeof c=="number"||a.fx.speeds[c])e=d,d=c,c={};a.isFunction(d)&&(e=d,d=null),c=c||{},d=d||c.duration,d=a.fx.off?0:typeof d=="number"?d:d in a.fx.speeds?a.fx.speeds[d]:a.fx.speeds._default,e=e||c.complete;return[b,c,d,e];}function j(a,b){var c={_:0},d;for(d in b)a[d]!=b[d]&&(c[d]=b[d]);return c;}function i(b){var c,d;for(c in b)d=b[c],(d==null||a.isFunction(d)||c in g||/scrollbar/.test(c)||!/color/i.test(c)&&isNaN(parseFloat(d)))&&delete b[c];return b;}function h(){var a=document.defaultView?document.defaultView.getComputedStyle(this,null):this.currentStyle,b={},c,d;if(a&&a.length&&a[0]&&a[a[0]]){var e=a.length;while(e--)c=a[e],typeof a[c]=="string"&&(d=c.replace(/\-(\w)/g,function(a,b){return b.toUpperCase();}),b[d]=a[c]);}else for(c in a)typeof a[c]=="string"&&(b[c]=a[c]);return b;}function d(b,d){var e;do{e=a.curCSS(b,d);if(e!=""&&e!="transparent"||a.nodeName(b,"body"))break;d="backgroundColor";}while(b=b.parentNode);return c(e);}function c(b){var c;if(b&&b.constructor==Array&&b.length==3)return b;if(c=/rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(b))return[parseInt(c[1],10),parseInt(c[2],10),parseInt(c[3],10)];if(c=/rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(b))return[parseFloat(c[1])*2.55,parseFloat(c[2])*2.55,parseFloat(c[3])*2.55];if(c=/#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(b))return[parseInt(c[1],16),parseInt(c[2],16),parseInt(c[3],16)];if(c=/#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(b))return[parseInt(c[1]+c[1],16),parseInt(c[2]+c[2],16),parseInt(c[3]+c[3],16)];if(c=/rgba\(0, 0, 0, 0\)/.exec(b))return e.transparent;return e[a.trim(b).toLowerCase()];}a.effects={},a.each(["backgroundColor","borderBottomColor","borderLeftColor","borderRightColor","borderTopColor","borderColor","color","outlineColor"],function(b,e){a.fx.step[e]=function(a){a.colorInit||(a.start=d(a.elem,e),a.end=c(a.end),a.colorInit=!0),a.elem.style[e]="rgb("+Math.max(Math.min(parseInt(a.pos*(a.end[0]-a.start[0])+a.start[0],10),255),0)+","+Math.max(Math.min(parseInt(a.pos*(a.end[1]-a.start[1])+a.start[1],10),255),0)+","+Math.max(Math.min(parseInt(a.pos*(a.end[2]-a.start[2])+a.start[2],10),255),0)+")";};});var e={aqua:[0,255,255],azure:[240,255,255],beige:[245,245,220],black:[0,0,0],blue:[0,0,255],brown:[165,42,42],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgrey:[169,169,169],darkgreen:[0,100,0],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkviolet:[148,0,211],fuchsia:[255,0,255],gold:[255,215,0],green:[0,128,0],indigo:[75,0,130],khaki:[240,230,140],lightblue:[173,216,230],lightcyan:[224,255,255],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightyellow:[255,255,224],lime:[0,255,0],magenta:[255,0,255],maroon:[128,0,0],navy:[0,0,128],olive:[128,128,0],orange:[255,165,0],pink:[255,192,203],purple:[128,0,128],violet:[128,0,128],red:[255,0,0],silver:[192,192,192],white:[255,255,255],yellow:[255,255,0],transparent:[255,255,255]},f=["add","remove","toggle"],g={border:1,borderBottom:1,borderColor:1,borderLeft:1,borderRight:1,borderTop:1,borderWidth:1,margin:1,padding:1};a.effects.animateClass=function(b,c,d,e){a.isFunction(d)&&(e=d,d=null);return this.queue(function(){var g=a(this),k=g.attr("style")||" ",l=i(h.call(this)),m,n=g.attr("class");a.each(f,function(a,c){b[c]&&g[c+"Class"](b[c]);}),m=i(h.call(this)),g.attr("class",n),g.animate(j(l,m),{queue:!1,duration:c,easing:d,complete:function(){a.each(f,function(a,c){b[c]&&g[c+"Class"](b[c]);}),typeof g.attr("style")=="object"?(g.attr("style").cssText="",g.attr("style").cssText=k):g.attr("style",k),e&&e.apply(this,arguments),a.dequeue(this);}});});},a.fn.extend({_addClass:a.fn.addClass,addClass:function(b,c,d,e){return c?a.effects.animateClass.apply(this,[{add:b},c,d,e]):this._addClass(b);},_removeClass:a.fn.removeClass,removeClass:function(b,c,d,e){return c?a.effects.animateClass.apply(this,[{remove:b},c,d,e]):this._removeClass(b);},_toggleClass:a.fn.toggleClass,toggleClass:function(c,d,e,f,g){return typeof d=="boolean"||d===b?e?a.effects.animateClass.apply(this,[d?{add:c}:{remove:c},e,f,g]):this._toggleClass(c,d):a.effects.animateClass.apply(this,[{toggle:c},d,e,f]);},switchClass:function(b,c,d,e,f){return a.effects.animateClass.apply(this,[{add:c,remove:b},d,e,f]);}}),a.extend(a.effects,{version:"1.8.17",save:function(a,b){for(var c=0;c").addClass("ui-effects-wrapper").css({fontSize:"100%",background:"transparent",border:"none",margin:0,padding:0}),e=document.activeElement;b.wrap(d),(b[0]===e||a.contains(b[0],e))&&a(e).focus(),d=b.parent(),b.css("position")=="static"?(d.css({position:"relative"}),b.css({position:"relative"})):(a.extend(c,{position:b.css("position"),zIndex:b.css("z-index")}),a.each(["top","left","bottom","right"],function(a,d){c[d]=b.css(d),isNaN(parseInt(c[d],10))&&(c[d]="auto");}),b.css({position:"relative",top:0,left:0,right:"auto",bottom:"auto"}));return d.css(c).show();},removeWrapper:function(b){var c,d=document.activeElement;if(b.parent().is(".ui-effects-wrapper")){c=b.parent().replaceWith(b),(b[0]===d||a.contains(b[0],d))&&a(d).focus();return c;}return b;},setTransition:function(b,c,d,e){e=e||{},a.each(c,function(a,c){unit=b.cssUnit(c),unit[0]>0&&(e[c]=unit[0]*d+unit[1]);});return e;}}),a.fn.extend({effect:function(b,c,d,e){var f=k.apply(this,arguments),g={options:f[1],duration:f[2],callback:f[3]},h=g.options.mode,i=a.effects[b];if(a.fx.off||!i)return h?this[h](g.duration,g.callback):this.each(function(){g.callback&&g.callback.call(this);});return i.call(this,g);},_show:a.fn.show,show:function(a){if(l(a))return this._show.apply(this,arguments);var b=k.apply(this,arguments);b[1].mode="show";return this.effect.apply(this,b);},_hide:a.fn.hide,hide:function(a){if(l(a))return this._hide.apply(this,arguments);var b=k.apply(this,arguments);b[1].mode="hide";return this.effect.apply(this,b);},__toggle:a.fn.toggle,toggle:function(b){if(l(b)||typeof b=="boolean"||a.isFunction(b))return this.__toggle.apply(this,arguments);var c=k.apply(this,arguments);c[1].mode="toggle";return this.effect.apply(this,c);},cssUnit:function(b){var c=this.css(b),d=[];a.each(["em","px","%","pt"],function(a,b){c.indexOf(b)>0&&(d=[parseFloat(c),b]);});return d;}}),a.easing.jswing=a.easing.swing,a.extend(a.easing,{def:"easeOutQuad",swing:function(b,c,d,e,f){return a.easing[a.easing.def](b,c,d,e,f);},easeInQuad:function(a,b,c,d,e){return d*(b/=e)*b+c;},easeOutQuad:function(a,b,c,d,e){return-d*(b/=e)*(b-2)+c;},easeInOutQuad:function(a,b,c,d,e){if((b/=e/2)<1)return d/2*b*b+c;return-d/2*(--b*(b-2)-1)+c;},easeInCubic:function(a,b,c,d,e){return d*(b/=e)*b*b+c;},easeOutCubic:function(a,b,c,d,e){return d*((b=b/e-1)*b*b+1)+c;},easeInOutCubic:function(a,b,c,d,e){if((b/=e/2)<1)return d/2*b*b*b+c;return d/2*((b-=2)*b*b+2)+c;},easeInQuart:function(a,b,c,d,e){return d*(b/=e)*b*b*b+c;},easeOutQuart:function(a,b,c,d,e){return-d*((b=b/e-1)*b*b*b-1)+c;},easeInOutQuart:function(a,b,c,d,e){if((b/=e/2)<1)return d/2*b*b*b*b+c;return-d/2*((b-=2)*b*b*b-2)+c;},easeInQuint:function(a,b,c,d,e){return d*(b/=e)*b*b*b*b+c;},easeOutQuint:function(a,b,c,d,e){return d*((b=b/e-1)*b*b*b*b+1)+c;},easeInOutQuint:function(a,b,c,d,e){if((b/=e/2)<1)return d/2*b*b*b*b*b+c;return d/2*((b-=2)*b*b*b*b+2)+c;},easeInSine:function(a,b,c,d,e){return-d*Math.cos(b/e*(Math.PI/2))+d+c;},easeOutSine:function(a,b,c,d,e){return d*Math.sin(b/e*(Math.PI/2))+c;},easeInOutSine:function(a,b,c,d,e){return-d/2*(Math.cos(Math.PI*b/e)-1)+c;},easeInExpo:function(a,b,c,d,e){return b==0?c:d*Math.pow(2,10*(b/e-1))+c;},easeOutExpo:function(a,b,c,d,e){return b==e?c+d:d*(-Math.pow(2,-10*b/e)+1)+c;},easeInOutExpo:function(a,b,c,d,e){if(b==0)return c;if(b==e)return c+d;if((b/=e/2)<1)return d/2*Math.pow(2,10*(b-1))+c;return d/2*(-Math.pow(2,-10*--b)+2)+c;},easeInCirc:function(a,b,c,d,e){return-d*(Math.sqrt(1-(b/=e)*b)-1)+c;},easeOutCirc:function(a,b,c,d,e){return d*Math.sqrt(1-(b=b/e-1)*b)+c;},easeInOutCirc:function(a,b,c,d,e){if((b/=e/2)<1)return-d/2*(Math.sqrt(1-b*b)-1)+c;return d/2*(Math.sqrt(1-(b-=2)*b)+1)+c;},easeInElastic:function(a,b,c,d,e){var f=1.70158,g=0,h=d;if(b==0)return c;if((b/=e)==1)return c+d;g||(g=e*.3);if(h').addClass('ui-effects-wrapper').css({fontSize:'100%',background:'transparent',border:'none',margin:0,padding:0}),e=document.activeElement;b.wrap(d),(b[0]===e||a.contains(b[0],e))&&a(e).focus(),d=b.parent(),b.css('position')=='static'?(d.css({position:'relative'}),b.css({position:'relative'})):(a.extend(c,{position:b.css('position'),zIndex:b.css('z-index')}),a.each(['top','left','bottom','right'],function(a,d){c[d]=b.css(d),isNaN(parseInt(c[d],10))&&(c[d]='auto');}),b.css({position:'relative',top:0,left:0,right:'auto',bottom:'auto'}));return d.css(c).show();},removeWrapper:function(b){var c,d=document.activeElement;if(b.parent().is('.ui-effects-wrapper')){c=b.parent().replaceWith(b),(b[0]===d||a.contains(b[0],d))&&a(d).focus();return c;}return b;},setTransition:function(b,c,d,e){e=e||{},a.each(c,function(a,c){unit=b.cssUnit(c),unit[0]>0&&(e[c]=unit[0]*d+unit[1]);});return e;}}),a.fn.extend({effect:function(b,c,d,e){var f=k.apply(this,arguments),g={options:f[1],duration:f[2],callback:f[3]},h=g.options.mode,i=a.effects[b];if(a.fx.off||!i)return h?this[h](g.duration,g.callback):this.each(function(){g.callback&&g.callback.call(this);});return i.call(this,g);},_show:a.fn.show,show:function(a){if(l(a))return this._show.apply(this,arguments);var b=k.apply(this,arguments);b[1].mode='show';return this.effect.apply(this,b);},_hide:a.fn.hide,hide:function(a){if(l(a))return this._hide.apply(this,arguments);var b=k.apply(this,arguments);b[1].mode='hide';return this.effect.apply(this,b);},__toggle:a.fn.toggle,toggle:function(b){if(l(b)||typeof b=='boolean'||a.isFunction(b))return this.__toggle.apply(this,arguments);var c=k.apply(this,arguments);c[1].mode='toggle';return this.effect.apply(this,c);},cssUnit:function(b){var c=this.css(b),d=[];a.each(['em','px','%','pt'],function(a,b){c.indexOf(b)>0&&(d=[parseFloat(c),b]);});return d;}}),a.easing.jswing=a.easing.swing,a.extend(a.easing,{def:'easeOutQuad',swing:function(b,c,d,e,f){return a.easing[a.easing.def](b,c,d,e,f);},easeInQuad:function(a,b,c,d,e){return d*(b/=e)*b+c;},easeOutQuad:function(a,b,c,d,e){return-d*(b/=e)*(b-2)+c;},easeInOutQuad:function(a,b,c,d,e){if((b/=e/2)<1)return d/2*b*b+c;return-d/2*(--b*(b-2)-1)+c;},easeInCubic:function(a,b,c,d,e){return d*(b/=e)*b*b+c;},easeOutCubic:function(a,b,c,d,e){return d*((b=b/e-1)*b*b+1)+c;},easeInOutCubic:function(a,b,c,d,e){if((b/=e/2)<1)return d/2*b*b*b+c;return d/2*((b-=2)*b*b+2)+c;},easeInQuart:function(a,b,c,d,e){return d*(b/=e)*b*b*b+c;},easeOutQuart:function(a,b,c,d,e){return-d*((b=b/e-1)*b*b*b-1)+c;},easeInOutQuart:function(a,b,c,d,e){if((b/=e/2)<1)return d/2*b*b*b*b+c;return-d/2*((b-=2)*b*b*b-2)+c;},easeInQuint:function(a,b,c,d,e){return d*(b/=e)*b*b*b*b+c;},easeOutQuint:function(a,b,c,d,e){return d*((b=b/e-1)*b*b*b*b+1)+c;},easeInOutQuint:function(a,b,c,d,e){if((b/=e/2)<1)return d/2*b*b*b*b*b+c;return d/2*((b-=2)*b*b*b*b+2)+c;},easeInSine:function(a,b,c,d,e){return-d*Math.cos(b/e*(Math.PI/2))+d+c;},easeOutSine:function(a,b,c,d,e){return d*Math.sin(b/e*(Math.PI/2))+c;},easeInOutSine:function(a,b,c,d,e){return-d/2*(Math.cos(Math.PI*b/e)-1)+c;},easeInExpo:function(a,b,c,d,e){return b==0?c:d*Math.pow(2,10*(b/e-1))+c;},easeOutExpo:function(a,b,c,d,e){return b==e?c+d:d*(-Math.pow(2,-10*b/e)+1)+c;},easeInOutExpo:function(a,b,c,d,e){if(b==0)return c;if(b==e)return c+d;if((b/=e/2)<1)return d/2*Math.pow(2,10*(b-1))+c;return d/2*(-Math.pow(2,-10*--b)+2)+c;},easeInCirc:function(a,b,c,d,e){return-d*(Math.sqrt(1-(b/=e)*b)-1)+c;},easeOutCirc:function(a,b,c,d,e){return d*Math.sqrt(1-(b=b/e-1)*b)+c;},easeInOutCirc:function(a,b,c,d,e){if((b/=e/2)<1)return-d/2*(Math.sqrt(1-b*b)-1)+c;return d/2*(Math.sqrt(1-(b-=2)*b)+1)+c;},easeInElastic:function(a,b,c,d,e){var f=1.70158,g=0,h=d;if(b==0)return c;if((b/=e)==1)return c+d;g||(g=e*.3);if(h").css({position:"absolute",visibility:"visible",left:-j*(g/d),top:-i*(h/c)}).parent().addClass("ui-effects-explode").css({position:"absolute",overflow:"hidden",width:g/d,height:h/c,left:f.left+j*(g/d)+(b.options.mode=="show"?(j-Math.floor(d/2))*(g/d):0),top:f.top+i*(h/c)+(b.options.mode=="show"?(i-Math.floor(c/2))*(h/c):0),opacity:b.options.mode=="show"?0:1}).animate({left:f.left+j*(g/d)+(b.options.mode=="show"?0:(j-Math.floor(d/2))*(g/d)),top:f.top+i*(h/c)+(b.options.mode=="show"?0:(i-Math.floor(c/2))*(h/c)),opacity:b.options.mode=="show"?1:0},b.duration||500);setTimeout(function(){b.options.mode=="show"?e.css({visibility:"visible"}):e.css({visibility:"visible"}).hide(),b.callback&&b.callback.apply(e[0]),e.dequeue(),a("div.ui-effects-explode").remove();},b.duration||500);});};})(jQuery);/* + */(function(a,b){a.effects.explode=function(b){return this.queue(function(){var c=b.options.pieces?Math.round(Math.sqrt(b.options.pieces)):3,d=b.options.pieces?Math.round(Math.sqrt(b.options.pieces)):3;b.options.mode=b.options.mode=='toggle'?a(this).is(':visible')?'hide':'show':b.options.mode;var e=a(this).show().css('visibility','hidden'),f=e.offset();f.top-=parseInt(e.css('marginTop'),10)||0,f.left-=parseInt(e.css('marginLeft'),10)||0;var g=e.outerWidth(!0),h=e.outerHeight(!0);for(var i=0;i').css({position:'absolute',visibility:'visible',left:-j*(g/d),top:-i*(h/c)}).parent().addClass('ui-effects-explode').css({position:'absolute',overflow:'hidden',width:g/d,height:h/c,left:f.left+j*(g/d)+(b.options.mode=='show'?(j-Math.floor(d/2))*(g/d):0),top:f.top+i*(h/c)+(b.options.mode=='show'?(i-Math.floor(c/2))*(h/c):0),opacity:b.options.mode=='show'?0:1}).animate({left:f.left+j*(g/d)+(b.options.mode=='show'?0:(j-Math.floor(d/2))*(g/d)),top:f.top+i*(h/c)+(b.options.mode=='show'?0:(i-Math.floor(c/2))*(h/c)),opacity:b.options.mode=='show'?1:0},b.duration||500);setTimeout(function(){b.options.mode=='show'?e.css({visibility:'visible'}):e.css({visibility:'visible'}).hide(),b.callback&&b.callback.apply(e[0]),e.dequeue(),a('div.ui-effects-explode').remove();},b.duration||500);});};})(jQuery);/* * jQuery UI Effects Fade 1.8.17 * * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) @@ -210,7 +210,7 @@ * * Depends: * jquery.effects.core.js - */(function(a,b){a.effects.fade=function(b){return this.queue(function(){var c=a(this),d=a.effects.setMode(c,b.options.mode||"hide");c.animate({opacity:d},{queue:!1,duration:b.duration,easing:b.options.easing,complete:function(){b.callback&&b.callback.apply(this,arguments),c.dequeue();}});});};})(jQuery);/* + */(function(a,b){a.effects.fade=function(b){return this.queue(function(){var c=a(this),d=a.effects.setMode(c,b.options.mode||'hide');c.animate({opacity:d},{queue:!1,duration:b.duration,easing:b.options.easing,complete:function(){b.callback&&b.callback.apply(this,arguments),c.dequeue();}});});};})(jQuery);/* * jQuery UI Effects Fold 1.8.17 * * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) @@ -221,7 +221,7 @@ * * Depends: * jquery.effects.core.js - */(function(a,b){a.effects.fold=function(b){return this.queue(function(){var c=a(this),d=["position","top","bottom","left","right"],e=a.effects.setMode(c,b.options.mode||"hide"),f=b.options.size||15,g=!!b.options.horizFirst,h=b.duration?b.duration/2:a.fx.speeds._default/2;a.effects.save(c,d),c.show();var i=a.effects.createWrapper(c).css({overflow:"hidden"}),j=e=="show"!=g,k=j?["width","height"]:["height","width"],l=j?[i.width(),i.height()]:[i.height(),i.width()],m=/([0-9]+)%/.exec(f);m&&(f=parseInt(m[1],10)/100*l[e=="hide"?0:1]),e=="show"&&i.css(g?{height:0,width:f}:{height:f,width:0});var n={},p={};n[k[0]]=e=="show"?l[0]:f,p[k[1]]=e=="show"?l[1]:0,i.animate(n,h,b.options.easing).animate(p,h,b.options.easing,function(){e=="hide"&&c.hide(),a.effects.restore(c,d),a.effects.removeWrapper(c),b.callback&&b.callback.apply(c[0],arguments),c.dequeue();});});};})(jQuery);/* + */(function(a,b){a.effects.fold=function(b){return this.queue(function(){var c=a(this),d=['position','top','bottom','left','right'],e=a.effects.setMode(c,b.options.mode||'hide'),f=b.options.size||15,g=!!b.options.horizFirst,h=b.duration?b.duration/2:a.fx.speeds._default/2;a.effects.save(c,d),c.show();var i=a.effects.createWrapper(c).css({overflow:'hidden'}),j=e=='show'!=g,k=j?['width','height']:['height','width'],l=j?[i.width(),i.height()]:[i.height(),i.width()],m=/([0-9]+)%/.exec(f);m&&(f=parseInt(m[1],10)/100*l[e=='hide'?0:1]),e=='show'&&i.css(g?{height:0,width:f}:{height:f,width:0});var n={},p={};n[k[0]]=e=='show'?l[0]:f,p[k[1]]=e=='show'?l[1]:0,i.animate(n,h,b.options.easing).animate(p,h,b.options.easing,function(){e=='hide'&&c.hide(),a.effects.restore(c,d),a.effects.removeWrapper(c),b.callback&&b.callback.apply(c[0],arguments),c.dequeue();});});};})(jQuery);/* * jQuery UI Effects Highlight 1.8.17 * * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) @@ -232,7 +232,7 @@ * * Depends: * jquery.effects.core.js - */(function(a,b){a.effects.highlight=function(b){return this.queue(function(){var c=a(this),d=["backgroundImage","backgroundColor","opacity"],e=a.effects.setMode(c,b.options.mode||"show"),f={backgroundColor:c.css("backgroundColor")};e=="hide"&&(f.opacity=0),a.effects.save(c,d),c.show().css({backgroundImage:"none",backgroundColor:b.options.color||"#ffff99"}).animate(f,{queue:!1,duration:b.duration,easing:b.options.easing,complete:function(){e=="hide"&&c.hide(),a.effects.restore(c,d),e=="show"&&!a.support.opacity&&this.style.removeAttribute("filter"),b.callback&&b.callback.apply(this,arguments),c.dequeue();}});});};})(jQuery);/* + */(function(a,b){a.effects.highlight=function(b){return this.queue(function(){var c=a(this),d=['backgroundImage','backgroundColor','opacity'],e=a.effects.setMode(c,b.options.mode||'show'),f={backgroundColor:c.css('backgroundColor')};e=='hide'&&(f.opacity=0),a.effects.save(c,d),c.show().css({backgroundImage:'none',backgroundColor:b.options.color||'#ffff99'}).animate(f,{queue:!1,duration:b.duration,easing:b.options.easing,complete:function(){e=='hide'&&c.hide(),a.effects.restore(c,d),e=='show'&&!a.support.opacity&&this.style.removeAttribute('filter'),b.callback&&b.callback.apply(this,arguments),c.dequeue();}});});};})(jQuery);/* * jQuery UI Effects Pulsate 1.8.17 * * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) @@ -243,7 +243,7 @@ * * Depends: * jquery.effects.core.js - */(function(a,b){a.effects.pulsate=function(b){return this.queue(function(){var c=a(this),d=a.effects.setMode(c,b.options.mode||"show");times=(b.options.times||5)*2-1,duration=b.duration?b.duration/2:a.fx.speeds._default/2,isVisible=c.is(":visible"),animateTo=0,isVisible||(c.css("opacity",0).show(),animateTo=1),(d=="hide"&&isVisible||d=="show"&&!isVisible)&×--;for(var e=0;e").appendTo(document.body).addClass(b.options.className).css({top:g.top,left:g.left,height:c.innerHeight(),width:c.innerWidth(),position:"absolute"}).animate(f,b.duration,b.options.easing,function(){h.remove(),b.callback&&b.callback.apply(c[0],arguments),c.dequeue();});});};})(jQuery); \ No newline at end of file + */(function(a,b){a.effects.transfer=function(b){return this.queue(function(){var c=a(this),d=a(b.options.to),e=d.offset(),f={top:e.top,left:e.left,height:d.innerHeight(),width:d.innerWidth()},g=c.offset(),h=a('
      ').appendTo(document.body).addClass(b.options.className).css({top:g.top,left:g.left,height:c.innerHeight(),width:c.innerWidth(),position:'absolute'}).animate(f,b.duration,b.options.easing,function(){h.remove(),b.callback&&b.callback.apply(c[0],arguments),c.dequeue();});});};})(jQuery); \ No newline at end of file diff --git a/examples/voter/voter/routes/index.js b/examples/voter/voter/routes/index.js index f7194f0..ee9d4a9 100644 --- a/examples/voter/voter/routes/index.js +++ b/examples/voter/voter/routes/index.js @@ -22,7 +22,7 @@ */ exports.index = function(req, res) { - res.render("index", { - title : "VoltDB Voter Example" + res.render('index', { + title : 'VoltDB Voter Example' }); }; diff --git a/lib/client.js b/lib/client.js index 3a12e10..e7a4f8a 100644 --- a/lib/client.js +++ b/lib/client.js @@ -21,21 +21,21 @@ * OTHER DEALINGS IN THE SOFTWARE. */ -var EventEmitter = require("events").EventEmitter, - util = require("util"), - VoltConnection = require("./connection"), - VoltConstants = require("./voltconstants"); - -const fs = require("fs"); -const debug = require("debug")("voltdb-client-nodejs:VoltClient"); -const VoltProcedure = require("./query"); -const Hashinator = require("./hashinator"); - -const AdHoc = new VoltProcedure("@AdHoc",["string"]); -const UpdateClasses = new VoltProcedure("@UpdateClasses",["varbinary","string"]); -const Statistics = new VoltProcedure("@Statistics",["string","int"]); -const GetPartitionKeys = new VoltProcedure("@GetPartitionKeys",["string"]); -const SystemInformation = new VoltProcedure("@SystemInformation",["string"]); +var EventEmitter = require('events').EventEmitter, + util = require('util'), + VoltConnection = require('./connection'), + VoltConstants = require('./voltconstants'); + +const fs = require('fs'); +const debug = require('debug')('voltdb-client-nodejs:VoltClient'); +const VoltProcedure = require('./query'); +const Hashinator = require('./hashinator'); + +const AdHoc = new VoltProcedure('@AdHoc',['string']); +const UpdateClasses = new VoltProcedure('@UpdateClasses',['varbinary','string']); +const Statistics = new VoltProcedure('@Statistics',['string','int']); +const GetPartitionKeys = new VoltProcedure('@GetPartitionKeys',['string']); +const SystemInformation = new VoltProcedure('@SystemInformation',['string']); const VoltClient = function(configuration) { EventEmitter.call(this); @@ -117,7 +117,7 @@ VoltClient.prototype._updateHashinator = function(){ let hashConfig = null; let partitionKeys = null; - const topoCall = this.statistics("TOPO",0); + const topoCall = this.statistics('TOPO',0); topoCall.read .then( response => { @@ -132,7 +132,7 @@ VoltClient.prototype._updateHashinator = function(){ }); topoCall.onQueryAllowed - .then( () => this.getPartitionKeys("string").read ) + .then( () => this.getPartitionKeys('string').read ) .then( response => { if ( response.code ) return; if ( response.results.status !== 1 ) return; //Todo VoltConstants.RESULT_STATUS.SUCCESS @@ -177,7 +177,7 @@ VoltClient.prototype.callProcedure = function(query) { this.emit(VoltConstants.SESSION_EVENT.CONNECTION_ERROR, VoltConstants.STATUS_CODES.CONNECTION_TIMEOUT, VoltConstants.SESSION_EVENT.CONNECTION_ERROR, - "No valid VoltDB connections, verify that the database is online"); + 'No valid VoltDB connections, verify that the database is online'); const error = new Promise( (resolve,reject) => reject({ code: VoltConstants.STATUS_CODES.CONNECTION_TIMEOUT, @@ -202,7 +202,7 @@ VoltClient.prototype.adHoc = function(query){ return this.callProcedure(statement); }; -VoltClient.prototype.getPartitionKeys = function(type = "string"){ +VoltClient.prototype.getPartitionKeys = function(type = 'string'){ const statement = GetPartitionKeys.getQuery(); statement.setParameters([type]); @@ -216,14 +216,14 @@ VoltClient.prototype.statistics = function(component, delta=0){ return this.callProcedure(statement); }; -VoltClient.prototype.updateClasses = function(jar, removeClasses = ""){ +VoltClient.prototype.updateClasses = function(jar, removeClasses = ''){ const statement = UpdateClasses.getQuery(); let jarBin = null; if ( jar instanceof Buffer ) { jarBin = jar; } else { - jarBin = jar ? fs.readFileSync(jar) : new Buffer("NULL"); + jarBin = jar ? fs.readFileSync(jar) : new Buffer('NULL'); } statement.setParameters([jarBin, removeClasses]); @@ -241,7 +241,7 @@ VoltClient.prototype.systemInformation = function(selector){ VoltClient.prototype.exit = function(callback) { - debug("Exiting | Connections Length: %o", this._connections.length); + debug('Exiting | Connections Length: %o', this._connections.length); while(this._connections.length > 0){ var c = this._connections[0]; @@ -253,10 +253,10 @@ VoltClient.prototype.exit = function(callback) { }; VoltClient.prototype.connectionStats = function() { - util.log("Good connections:"); + util.log('Good connections:'); this._displayConnectionArrayStats(this._connections); - util.log("Bad connections:"); + util.log('Bad connections:'); this._displayConnectionArrayStats(this._badConnections); }; @@ -265,9 +265,9 @@ VoltClient.prototype._displayConnectionArrayStats = function(array) { const connection = array[index]; if(connection != null) { - util.log("Connection: ", - connection.config.host, ": ", - connection.invocations, " Alive: ", + util.log('Connection: ', + connection.config.host, ': ', + connection.invocations, ' Alive: ', connection.isValidConnection()); } } @@ -283,7 +283,7 @@ function statusCodeToString(code){ VoltClient.prototype._connectListener = function(code, event, connection) { - debug("Connected | Code: %o, Event: %o", statusCodeToString(code), event); + debug('Connected | Code: %o, Event: %o', statusCodeToString(code), event); this.emit(VoltConstants.SESSION_EVENT.CONNECTION, code, @@ -292,7 +292,7 @@ VoltClient.prototype._connectListener = function(code, event, connection) { }; VoltClient.prototype._connectErrorListener = function(code, event, message) { - debug("Connection Error | Code: %o, Event: %o", statusCodeToString(code), event); + debug('Connection Error | Code: %o, Event: %o', statusCodeToString(code), event); this.emit(VoltConstants.SESSION_EVENT.CONNECTION_ERROR, code, @@ -308,7 +308,7 @@ VoltClient.prototype._queryResponseListener = function(code,event, message) { }; VoltClient.prototype._queryResponseErrorListener = function(code, event, message) { - debug("Query Response Error | Code: %o, Event: %o", statusCodeToString(code), event); + debug('Query Response Error | Code: %o, Event: %o', statusCodeToString(code), event); this.emit(VoltConstants.SESSION_EVENT.QUERY_RESPONSE_ERROR, code, @@ -317,7 +317,7 @@ VoltClient.prototype._queryResponseErrorListener = function(code, event, message }; VoltClient.prototype._queryDispatchErrorListener = function(code, event, message) { - debug("Query Dispatch Error | Code: %o, Event: %o", statusCodeToString(code), event); + debug('Query Dispatch Error | Code: %o, Event: %o', statusCodeToString(code), event); this.emit(VoltConstants.SESSION_EVENT.QUERY_DISPATCH_ERROR, code, @@ -326,7 +326,7 @@ VoltClient.prototype._queryDispatchErrorListener = function(code, event, message }; VoltClient.prototype._fatalErrorListener = function(code, event, message) { - debug("Fatal Error | Code: %o, Event: %o", statusCodeToString(code), event); + debug('Fatal Error | Code: %o, Event: %o', statusCodeToString(code), event); this.emit(VoltConstants.SESSION_EVENT.FATAL_ERROR, code, diff --git a/lib/configuration.js b/lib/configuration.js index ad6de52..974a564 100644 --- a/lib/configuration.js +++ b/lib/configuration.js @@ -23,12 +23,12 @@ const VoltConfiguration = function() {}; VoltConfiguration.prototype = Object.create({ - host : "localhost", + host : 'localhost', port : 21212, - username : "user", - password : "password", - service : "database", - hashAlgorithm : "sha1", + username : 'user', + password : 'password', + service : 'database', + hashAlgorithm : 'sha1', queryTimeout : 600000, queryTimeoutInterval: 60000, flushInterval: 1000, diff --git a/lib/connection.js b/lib/connection.js index 662705b..96edd9d 100644 --- a/lib/connection.js +++ b/lib/connection.js @@ -25,14 +25,14 @@ * OTHER DEALINGS IN THE SOFTWARE. */ -var EventEmitter = require("events").EventEmitter, - Socket = require("net").Socket, - crypto = require("crypto"), - util = require("util"), - VoltConstants = require("./voltconstants"); +var EventEmitter = require('events').EventEmitter, + Socket = require('net').Socket, + crypto = require('crypto'), + util = require('util'), + VoltConstants = require('./voltconstants'); -const debug = require("debug")("voltdb-client-nodejs:VoltConnection"); -const { Message, LoginMessage, QueryMessage } = require("./message"); +const debug = require('debug')('voltdb-client-nodejs:VoltConnection'); +const { Message, LoginMessage, QueryMessage } = require('./message'); function VoltMessageManager(configuration) { EventEmitter.call(this); @@ -86,7 +86,7 @@ util.inherits(VoltConnection, EventEmitter); VoltConnection.prototype.initSocket = function(socket, resolve) { this.socket = socket; - this.socket.on("error", (e,m,s) => { + this.socket.on('error', (e,m,s) => { if ( this.socket.destroyed ) this.close(); this.validConnection = false; @@ -94,7 +94,7 @@ VoltConnection.prototype.initSocket = function(socket, resolve) { if ( resolve ){ let loginStatus = VoltConstants.SOCKET_ERRORS[e.code]; - this.loginError = VoltConstants.LOGIN_STATUS[loginStatus]; + this.loginError = VoltConstants.LOGIN_STATUS[loginStatus]; resolve(this); resolve=undefined; //only once will be called @@ -113,13 +113,13 @@ VoltConnection.prototype.initSocket = function(socket, resolve) { }); this.socket.setTimeout(10000, () => this.socket.end() ); - this.socket.once("connect", () => this.socket.setTimeout(0) ); + this.socket.once('connect', () => this.socket.setTimeout(0) ); - this.socket.on("data", buffer => { + this.socket.on('data', buffer => { this.onRead(buffer, resolve); }); - this.socket.on("connect", this.onConnect); + this.socket.on('connect', this.onConnect); }; VoltConnection.prototype.reconnect = function(){ @@ -176,7 +176,6 @@ VoltConnection.prototype.callProcedure = function(query) { const error = this._send(vmm, true); if ( error ) reject(error); } catch (error) { - console.log("Error", error); reject(error); } }); @@ -186,7 +185,7 @@ VoltConnection.prototype.callProcedure = function(query) { VoltConnection.prototype._getUID = function() { var id = String(this._id < 99999999 ? this._id++ : this._id = 0); - var uid = this._zeros(8 - id.length).join("") + id; + var uid = this._zeros(8 - id.length).join('') + id; return uid; }; @@ -200,7 +199,7 @@ VoltConnection.prototype._zeros = function(num) { VoltConnection.prototype.close = function(callback) { - debug("Closing"); + debug('Closing'); if(this.outstandingQueryManager) clearInterval(this.outstandingQueryManager); if(this.flusher) clearInterval(this.flusher); @@ -217,7 +216,7 @@ VoltConnection.prototype.onConnect = function() { var hashAlgorithm = crypto.createHash(this.config.hashAlgorithm); hashAlgorithm.update(this.config.password); - var password = new Buffer(hashAlgorithm.digest("base64"), "base64"); + var password = new Buffer(hashAlgorithm.digest('base64'), 'base64'); var message = this._getLoginMessage(password, this.config.hashAlgorithm); @@ -302,7 +301,7 @@ VoltConnection.prototype.onRead = function(buffer, resolveConnect) { VoltConstants.SESSION_EVENT.QUERY_RESPONSE_ERROR, VoltConstants.STATUS_CODES.QUERY_TOOK_TOO_LONG, VoltConstants.SESSION_EVENT.QUERY_RESPONSE_ERROR, - "Query completed after an extended period but query manager was deleted" ); + 'Query completed after an extended period but query manager was deleted' ); } } @@ -344,7 +343,7 @@ VoltConnection.prototype._queue = function(buffer, track) { }; VoltConnection.prototype._flush = function() { - debug("Flushing | Send Queue Length: %o", this._sendQueue.length); + debug('Flushing | Send Queue Length: %o', this._sendQueue.length); var bytes = this._sendQueue.reduce(function(bytes, buffer) { return bytes + buffer.length; @@ -357,17 +356,17 @@ VoltConnection.prototype._flush = function() { }, 0); try { - debug("Socket closed ? ", this.socket); + debug('Socket closed ? ', this.socket); this.socket.write(combined); } catch (err) { - debug("Socket Write Error | ", err); + debug('Socket Write Error | ', err); this.emit(VoltConstants.SESSION_EVENT.QUERY_DISPATCH_ERROR, VoltConstants.STATUS_CODES.UNEXPECTED_FAILURE, VoltConstants.SESSION_EVENT.QUERY_DISPATCH_ERROR, err.message - + ": Connection dropped to server while dispatching query. Is VoltDB Server up?"); + + ': Connection dropped to server while dispatching query. Is VoltDB Server up?'); throw err; } @@ -436,7 +435,7 @@ VoltConnection.prototype._checkQueryTimeout = function(vmm, time) { VoltConstants.SESSION_EVENT.QUERY_RESPONSE_ERROR, {error : true, status : VoltConstants.STATUS_CODES.CONNECTION_TIMEOUT, - statusString : "Query timed out before server responded" + statusString : 'Query timed out before server responded' }); vmm.emit(VoltConstants.SESSION_EVENT.QUERY_ALLOWED, diff --git a/lib/ctio.js b/lib/ctio.js index 929c19f..5612ccd 100644 --- a/lib/ctio.js +++ b/lib/ctio.js @@ -101,17 +101,17 @@ function ruint8(buffer, endian, offset) { if (endian === undefined) - throw (new Error("missing endian")); + throw (new Error('missing endian')); if (buffer === undefined) - throw (new Error("missing buffer")); + throw (new Error('missing buffer')); if (offset === undefined) - throw (new Error("missing offset")); + throw (new Error('missing offset')); if(offset >= buffer.length) - throw (new Error("Trying to read beyond buffer length")); + throw (new Error('Trying to read beyond buffer length')); @@ -126,18 +126,18 @@ function ruint16(buffer, endian, offset) var val = 0; if (endian === undefined) - throw (new Error("missing endian")); + throw (new Error('missing endian')); if (buffer === undefined) - throw (new Error("missing buffer")); + throw (new Error('missing buffer')); if (offset === undefined) - throw (new Error("missing offset")); + throw (new Error('missing offset')); if (offset + 1 >= buffer.length) - throw (new Error("Trying to read beyond buffer length")); + throw (new Error('Trying to read beyond buffer length')); - if (endian == "big") { + if (endian == 'big') { val = buffer[offset] << 8; val |= buffer[offset+1]; } else { @@ -173,18 +173,18 @@ function ruint32(buffer, endian, offset) var val = 0; if (endian === undefined) - throw (new Error("missing endian")); + throw (new Error('missing endian')); if (buffer === undefined) - throw (new Error("missing buffer")); + throw (new Error('missing buffer')); if (offset === undefined) - throw (new Error("missing offset")); + throw (new Error('missing offset')); if (offset + 3 >= buffer.length) - throw (new Error("Trying to read beyond buffer length")); + throw (new Error('Trying to read beyond buffer length')); - if (endian == "big") { + if (endian == 'big') { val = buffer[offset+1] << 16; val |= buffer[offset+2] << 8; val |= buffer[offset+3]; @@ -220,18 +220,18 @@ function ruint64(buffer, endian, offset) var val = new Array(2); if (endian === undefined) - throw (new Error("missing endian")); + throw (new Error('missing endian')); if (buffer === undefined) - throw (new Error("missing buffer")); + throw (new Error('missing buffer')); if (offset === undefined) - throw (new Error("missing offset")); + throw (new Error('missing offset')); if (offset + 7 >= buffer.length) - throw (new Error("Trying to read beyond buffer length")); + throw (new Error('Trying to read beyond buffer length')); - if (endian == "big") { + if (endian == 'big') { val[0] = ruint32(buffer, endian, offset); val[1] = ruint32(buffer, endian, offset+4); } else { @@ -303,16 +303,16 @@ function rsint8(buffer, endian, offset) var neg; if (endian === undefined) - throw (new Error("missing endian")); + throw (new Error('missing endian')); if (buffer === undefined) - throw (new Error("missing buffer")); + throw (new Error('missing buffer')); if (offset === undefined) - throw (new Error("missing offset")); + throw (new Error('missing offset')); if (offset >= buffer.length) - throw (new Error("Trying to read beyond buffer length")); + throw (new Error('Trying to read beyond buffer length')); neg = buffer[offset] & 0x80; @@ -331,16 +331,16 @@ function rsint16(buffer, endian, offset) var neg, val; if (endian === undefined) - throw (new Error("missing endian")); + throw (new Error('missing endian')); if (buffer === undefined) - throw (new Error("missing buffer")); + throw (new Error('missing buffer')); if (offset === undefined) - throw (new Error("missing offset")); + throw (new Error('missing offset')); if (offset + 1 >= buffer.length) - throw (new Error("Trying to read beyond buffer length")); + throw (new Error('Trying to read beyond buffer length')); val = ruint16(buffer, endian, offset); neg = val & 0x8000; @@ -365,16 +365,16 @@ function rsint32(buffer, endian, offset) var neg, val; if (endian === undefined) - throw (new Error("missing endian")); + throw (new Error('missing endian')); if (buffer === undefined) - throw (new Error("missing buffer")); + throw (new Error('missing buffer')); if (offset === undefined) - throw (new Error("missing offset")); + throw (new Error('missing offset')); if (offset + 3 >= buffer.length) - throw (new Error("Trying to read beyond buffer length")); + throw (new Error('Trying to read beyond buffer length')); val = ruint32(buffer, endian, offset); neg = val & 0x80000000; @@ -393,16 +393,16 @@ function rsint64(buffer, endian, offset) var neg, val; if (endian === undefined) - throw (new Error("missing endian")); + throw (new Error('missing endian')); if (buffer === undefined) - throw (new Error("missing buffer")); + throw (new Error('missing buffer')); if (offset === undefined) - throw (new Error("missing offset")); + throw (new Error('missing offset')); if (offset + 3 >= buffer.length) - throw (new Error("Trying to read beyond buffer length")); + throw (new Error('Trying to read beyond buffer length')); val = ruint64(buffer, endian, offset); neg = val[0] & 0x80000000; @@ -479,19 +479,19 @@ function rfloat(buffer, endian, offset) var maxexp = 0xff; if (endian === undefined) - throw (new Error("missing endian")); + throw (new Error('missing endian')); if (buffer === undefined) - throw (new Error("missing buffer")); + throw (new Error('missing buffer')); if (offset === undefined) - throw (new Error("missing offset")); + throw (new Error('missing offset')); if (offset + 3 >= buffer.length) - throw (new Error("Trying to read beyond buffer length")); + throw (new Error('Trying to read beyond buffer length')); /* Normalize the bytes to be in endian order */ - if (endian == "big") { + if (endian == 'big') { bytes[0] = buffer[offset]; bytes[1] = buffer[offset+1]; bytes[2] = buffer[offset+2]; @@ -582,19 +582,19 @@ function rdouble(buffer, endian, offset) var maxexp = 0x7ff; if (endian === undefined) - throw (new Error("missing endian")); + throw (new Error('missing endian')); if (buffer === undefined) - throw (new Error("missing buffer")); + throw (new Error('missing buffer')); if (offset === undefined) - throw (new Error("missing offset")); + throw (new Error('missing offset')); if (offset + 7 >= buffer.length) - throw (new Error("Trying to read beyond buffer length")); + throw (new Error('Trying to read beyond buffer length')); /* Normalize the bytes to be in endian order */ - if (endian == "big") { + if (endian == 'big') { bytes[0] = buffer[offset]; bytes[1] = buffer[offset+1]; bytes[2] = buffer[offset+2]; @@ -710,17 +710,17 @@ function rdouble(buffer, endian, offset) */ function prepuint(value, max) { - if (typeof (value) != "number") - throw (new (Error("cannot write a non-number as a number"))); + if (typeof (value) != 'number') + throw (new (Error('cannot write a non-number as a number'))); if (value < 0) - throw (new Error("specified a negative value for writing an unsigned value")); + throw (new Error('specified a negative value for writing an unsigned value')); if (value > max) - throw (new Error("value is larger than maximum value for type")); + throw (new Error('value is larger than maximum value for type')); if (Math.floor(value) !== value) - throw (new Error("value has a fractional component")); + throw (new Error('value has a fractional component')); return (value); } @@ -733,19 +733,19 @@ function wuint8(value, endian, buffer, offset) var val; if (value === undefined) - throw (new Error("missing value")); + throw (new Error('missing value')); if (endian === undefined) - throw (new Error("missing endian")); + throw (new Error('missing endian')); if (buffer === undefined) - throw (new Error("missing buffer")); + throw (new Error('missing buffer')); if (offset === undefined) - throw (new Error("missing offset")); + throw (new Error('missing offset')); if (offset >= buffer.length && buffer instanceof Buffer) - throw (new Error("Trying to write beyond buffer length")); + throw (new Error('Trying to write beyond buffer length')); val = prepuint(value, 0xff); buffer[offset] = val; @@ -760,22 +760,22 @@ function wuint16(value, endian, buffer, offset) var val; if (value === undefined) - throw (new Error("missing value")); + throw (new Error('missing value')); if (endian === undefined) - throw (new Error("missing endian")); + throw (new Error('missing endian')); if (buffer === undefined) - throw (new Error("missing buffer")); + throw (new Error('missing buffer')); if (offset === undefined) - throw (new Error("missing offset")); + throw (new Error('missing offset')); if (offset + 1 >= buffer.length && buffer instanceof Buffer) - throw (new Error("Trying to write beyond buffer length")); + throw (new Error('Trying to write beyond buffer length')); val = prepuint(value, 0xffff); - if (endian == "big") { + if (endian == 'big') { buffer[offset] = (val & 0xff00) >>> 8; buffer[offset+1] = val & 0x00ff; } else { @@ -800,22 +800,22 @@ function wuint32(value, endian, buffer, offset) var val; if (value === undefined) - throw (new Error("missing value")); + throw (new Error('missing value')); if (endian === undefined) - throw (new Error("missing endian")); + throw (new Error('missing endian')); if (buffer === undefined) - throw (new Error("missing buffer")); + throw (new Error('missing buffer')); if (offset === undefined) - throw (new Error("missing offset")); + throw (new Error('missing offset')); if (offset + 3 >= buffer.length && buffer instanceof Buffer) - throw (new Error("Trying to write beyond buffer length")); + throw (new Error('Trying to write beyond buffer length')); val = prepuint(value, 0xffffffff); - if (endian == "big") { + if (endian == 'big') { buffer[offset] = (val - (val & 0x00ffffff)) / Math.pow(2, 24); buffer[offset+1] = (val >>> 16) & 0xff; buffer[offset+2] = (val >>> 8) & 0xff; @@ -836,30 +836,30 @@ function wuint32(value, endian, buffer, offset) function wuint64(value, endian, buffer, offset) { if (value === undefined) - throw (new Error("missing value")); + throw (new Error('missing value')); if (!(value instanceof Array)) - throw (new Error("value must be an array")); + throw (new Error('value must be an array')); if (value.length != 2) - throw (new Error("value must be an array of length 2")); + throw (new Error('value must be an array of length 2')); if (endian === undefined) - throw (new Error("missing endian")); + throw (new Error('missing endian')); if (buffer === undefined) - throw (new Error("missing buffer")); + throw (new Error('missing buffer')); if (offset === undefined) - throw (new Error("missing offset")); + throw (new Error('missing offset')); if (offset + 7 >= buffer.length && buffer instanceof Buffer) - throw (new Error("Trying to write beyond buffer length")); + throw (new Error('Trying to write beyond buffer length')); prepuint(value[0], 0xffffffff); prepuint(value[1], 0xffffffff); - if (endian == "big") { + if (endian == 'big') { wuint32(value[0], endian, buffer, offset); wuint32(value[1], endian, buffer, offset+3); } else { @@ -918,17 +918,17 @@ function wuint64(value, endian, buffer, offset) */ function prepsint(value, max, min) { - if (typeof (value) != "number") - throw (new (Error("cannot write a non-number as a number"))); + if (typeof (value) != 'number') + throw (new (Error('cannot write a non-number as a number'))); if (value > max) - throw (new Error("value larger than maximum allowed value")); + throw (new Error('value larger than maximum allowed value')); if (value < min) - throw (new Error("value smaller than minimum allowed value")); + throw (new Error('value smaller than minimum allowed value')); if (Math.floor(value) !== value) - throw (new Error("value has a fractional component")); + throw (new Error('value has a fractional component')); return (value); } @@ -941,19 +941,19 @@ function wsint8(value, endian, buffer, offset) var val; if (value === undefined) - throw (new Error("missing value")); + throw (new Error('missing value')); if (endian === undefined) - throw (new Error("missing endian")); + throw (new Error('missing endian')); if (buffer === undefined) - throw (new Error("missing buffer")); + throw (new Error('missing buffer')); if (offset === undefined) - throw (new Error("missing offset")); + throw (new Error('missing offset')); if (offset >= buffer.length && buffer instanceof Buffer) - throw (new Error("Trying to write beyond buffer length")); + throw (new Error('Trying to write beyond buffer length')); val = prepsint(value, 0x7f, -0xf0); if (val >= 0) @@ -970,19 +970,19 @@ function wsint16(value, endian, buffer, offset) var val; if (value === undefined) - throw (new Error("missing value")); + throw (new Error('missing value')); if (endian === undefined) - throw (new Error("missing endian")); + throw (new Error('missing endian')); if (buffer === undefined) - throw (new Error("missing buffer")); + throw (new Error('missing buffer')); if (offset === undefined) - throw (new Error("missing offset")); + throw (new Error('missing offset')); if (offset + 1 >= buffer.length && buffer instanceof Buffer) - throw (new Error("Trying to write beyond buffer length")); + throw (new Error('Trying to write beyond buffer length')); val = prepsint(value, 0x7fff, -0xf000); if (val >= 0) @@ -1001,19 +1001,19 @@ function wsint32(value, endian, buffer, offset) var val; if (value === undefined) - throw (new Error("missing value")); + throw (new Error('missing value')); if (endian === undefined) - throw (new Error("missing endian")); + throw (new Error('missing endian')); if (buffer === undefined) - throw (new Error("missing buffer")); + throw (new Error('missing buffer')); if (offset === undefined) - throw (new Error("missing offset")); + throw (new Error('missing offset')); if (offset + 3 >= buffer.length && buffer instanceof Buffer) - throw (new Error("Trying to write beyond buffer length")); + throw (new Error('Trying to write beyond buffer length')); val = prepsint(value, 0x7fffffff, -0xf0000000); if (val >= 0) @@ -1032,25 +1032,25 @@ function wsint64(value, endian, buffer, offset) var vals = new Array(2); if (value === undefined) - throw (new Error("missing value")); + throw (new Error('missing value')); if (!(value instanceof Array)) - throw (new Error("value must be an array")); + throw (new Error('value must be an array')); if (value.length != 2) - throw (new Error("value must be an array of length 2")); + throw (new Error('value must be an array of length 2')); if (endian === undefined) - throw (new Error("missing endian")); + throw (new Error('missing endian')); if (buffer === undefined) - throw (new Error("missing buffer")); + throw (new Error('missing buffer')); if (offset === undefined) - throw (new Error("missing offset")); + throw (new Error('missing offset')); if (offset + 7 >= buffer.length && buffer instanceof Buffer) - throw (new Error("Trying to write beyond buffer length")); + throw (new Error('Trying to write beyond buffer length')); prepsint(value[0], 0x7fffffff, -0xf0000000); prepsint(value[1], 0xffffffff, -0xffffffff); @@ -1068,7 +1068,7 @@ function wsint64(value, endian, buffer, offset) vals[1] = value[1]; } - if (endian == "big") { + if (endian == 'big') { wuint32(vals[0], endian, buffer, offset); wuint32(vals[1], endian, buffer, offset+4); } else { @@ -1177,20 +1177,20 @@ function wfloat(value, endian, buffer, offset) var bytes = []; if (value === undefined) - throw (new Error("missing value")); + throw (new Error('missing value')); if (endian === undefined) - throw (new Error("missing endian")); + throw (new Error('missing endian')); if (buffer === undefined) - throw (new Error("missing buffer")); + throw (new Error('missing buffer')); if (offset === undefined) - throw (new Error("missing offset")); + throw (new Error('missing offset')); if (offset + 3 >= buffer.length && buffer instanceof Buffer) - throw (new Error("Trying to write beyond buffer length")); + throw (new Error('Trying to write beyond buffer length')); if (isNaN(value)) { sign = 0; @@ -1237,7 +1237,7 @@ function wfloat(value, endian, buffer, offset) bytes[2] = (mantissa & 0x00ff00) >>> 8; bytes[3] = mantissa & 0x0000ff; - if (endian == "big") { + if (endian == 'big') { buffer[offset] = bytes[0]; buffer[offset+1] = bytes[1]; buffer[offset+2] = bytes[2]; @@ -1316,20 +1316,20 @@ function wdouble(value, endian, buffer, offset) var bytes = []; if (value === undefined) - throw (new Error("missing value")); + throw (new Error('missing value')); if (endian === undefined) - throw (new Error("missing endian")); + throw (new Error('missing endian')); if (buffer === undefined) - throw (new Error("missing buffer")); + throw (new Error('missing buffer')); if (offset === undefined) - throw (new Error("missing offset")); + throw (new Error('missing offset')); if (offset + 7 >= buffer.length && buffer instanceof Buffer) - throw (new Error("Trying to write beyond buffer length")); + throw (new Error('Trying to write beyond buffer length')); if (isNaN(value)) { sign = 0; @@ -1414,7 +1414,7 @@ function wdouble(value, endian, buffer, offset) bytes[1] = (exponent & 0x00f) << 4 | mantissa >>> 24; bytes[0] = (sign << 7) | (exponent & 0x7f0) >>> 4; - if (endian == "big") { + if (endian == 'big') { buffer[offset] = bytes[0]; buffer[offset+1] = bytes[1]; buffer[offset+2] = bytes[2]; diff --git a/lib/ctype.js b/lib/ctype.js index 34863b2..acf0674 100644 --- a/lib/ctype.js +++ b/lib/ctype.js @@ -87,8 +87,8 @@ * */ -var mod_ctio = require("./ctio.js"); -var ASSERT = require("assert"); +var mod_ctio = require('./ctio.js'); +var ASSERT = require('assert'); /* * This is the set of basic types that we support. @@ -99,43 +99,43 @@ var ASSERT = require("assert"); * */ var deftypes = { - "uint8_t" : { + 'uint8_t' : { read : ctReadUint8, write : ctWriteUint8 }, - "uint16_t" : { + 'uint16_t' : { read : ctReadUint16, write : ctWriteUint16 }, - "uint32_t" : { + 'uint32_t' : { read : ctReadUint32, write : ctWriteUint32 }, - "int8_t" : { + 'int8_t' : { read : ctReadSint8, write : ctWriteSint8 }, - "int16_t" : { + 'int16_t' : { read : ctReadSint16, write : ctWriteSint16 }, - "int32_t" : { + 'int32_t' : { read : ctReadSint32, write : ctWriteSint32 }, - "float" : { + 'float' : { read : ctReadFloat, write : ctWriteFloat }, - "double" : { + 'double' : { read : ctReadDouble, write : ctWriteDouble }, - "char" : { + 'char' : { read : ctReadChar, write : ctWriteChar }, - "char[]" : { + 'char[]' : { read : ctReadCharArray, write : ctWriteCharArray } @@ -279,7 +279,7 @@ function ctWriteDouble(value, endian, buffer, offset) { */ function ctWriteChar(value, endian, buffer, offset) { if(!( value instanceof Buffer)) - throw (new Error("Input must be a buffer")); + throw (new Error('Input must be a buffer')); mod_ctio.ruint8(value[0], endian, buffer, offset); return (1); @@ -293,10 +293,10 @@ function ctWriteCharArray(value, length, endian, buffer, offset) { var ii; if(!( value instanceof Buffer)) - throw (new Error("Input must be a buffer")); + throw (new Error('Input must be a buffer')); if(value.length > length) - throw (new Error("value length greater than array length")); + throw (new Error('value length greater than array length')); for( ii = 0; ii < value.length && ii < length; ii++) mod_ctio.wuint8(value[ii], endian, buffer, offset + ii); @@ -331,23 +331,23 @@ function ctGetBasicTypes() { function ctParseType(str) { var begInd, endInd; var type, len; - if( typeof (str) != "string") - throw (new Error("type must be a Javascript string")); - endInd = str.lastIndexOf("]"); + if( typeof (str) != 'string') + throw (new Error('type must be a Javascript string')); + endInd = str.lastIndexOf(']'); if(endInd == -1) { - if(str.lastIndexOf("[") != -1) - throw (new Error("found invalid type with '[' but " + "no corresponding ']'")); + if(str.lastIndexOf('[') != -1) + throw (new Error('found invalid type with \'[\' but ' + 'no corresponding \']\'')); return ( { type : str }); } - begInd = str.lastIndexOf("["); + begInd = str.lastIndexOf('['); if(begInd == -1) - throw (new Error("found invalid type with ']' but " + "no corresponding '['")); + throw (new Error('found invalid type with \']\' but ' + 'no corresponding \'[\'')); if(begInd >= endInd) - throw (new Error("malformed type, ']' appears before '['")); + throw (new Error('malformed type, \']\' appears before \'[\'')); type = str.substring(0, begInd); len = str.substring(begInd + 1, endInd); @@ -372,25 +372,25 @@ function ctCheckReq(def, types, fields) { var found = {}; if(!( def instanceof Array)) - throw (new Error("definition is not an array")); + throw (new Error('definition is not an array')); if(def.length === 0) - throw (new Error("definition must have at least one element")); + throw (new Error('definition must have at least one element')); for( ii = 0; ii < def.length; ii++) { req = def[ii]; if(!( req instanceof Object)) - throw (new Error("definition must be an array of" + "objects")); + throw (new Error('definition must be an array of' + 'objects')); keys = Object.keys(req); if(keys.length != 1) - throw (new Error("definition entry must only have " + "one key")); + throw (new Error('definition entry must only have ' + 'one key')); if(keys[0] in found) - throw (new Error("Specified name already " + "specified: " + keys[0])); + throw (new Error('Specified name already ' + 'specified: ' + keys[0])); - if(!("type" in req[keys[0]])) - throw (new Error("missing required type definition")); - key = ctParseType(req[keys[0]]["type"]); + if(!('type' in req[keys[0]])) + throw (new Error('missing required type definition')); + key = ctParseType(req[keys[0]]['type']); /* * We may have nested arrays, we need to check the validity of @@ -398,25 +398,25 @@ function ctCheckReq(def, types, fields) { * each time len is defined we need to verify it is either an * integer or corresponds to an already seen key. */ - while(key["len"] !== undefined) { - if(isNaN(parseInt(key["len"], 10))) { + while(key['len'] !== undefined) { + if(isNaN(parseInt(key['len'], 10))) { - if(!(key["len"] in found)) - throw (new Error("Given an array " + "length without a matching type")); + if(!(key['len'] in found)) + throw (new Error('Given an array ' + 'length without a matching type')); } - key = ctParseType(key["type"]); + key = ctParseType(key['type']); } /* Now we can validate if the type is valid */ - if(!(key["type"] in types)) - throw (new Error("type not found or typdefed: " + key["type"])); + if(!(key['type'] in types)) + throw (new Error('type not found or typdefed: ' + key['type'])); /* Check for any required fields */ if(fields !== undefined) { for( jj = 0; jj < fields.length; jj++) { if(!(fields[jj] in req[keys[0]])) - throw (new Error("Missing required " + "field: " + fields[jj])); + throw (new Error('Missing required ' + 'field: ' + fields[jj])); } } @@ -434,15 +434,15 @@ function ctCheckReq(def, types, fields) { */ function CTypeParser(conf) { if(!conf) - throw (new Error("missing required argument")); + throw (new Error('missing required argument')); - if(!("endian" in conf)) - throw (new Error("missing required endian value")); + if(!('endian' in conf)) + throw (new Error('missing required endian value')); - if(conf["endian"] != "big" && conf["endian"] != "little") - throw (new Error("Invalid endian type")); + if(conf['endian'] != 'big' && conf['endian'] != 'little') + throw (new Error('Invalid endian type')); - this.endian = conf["endian"]; + this.endian = conf['endian']; this.types = ctGetBasicTypes(); } @@ -455,8 +455,8 @@ function CTypeParser(conf) { * */ CTypeParser.prototype.setEndian = function(endian) { - if(endian != "big" || endian != "little") - throw (new Error("invalid endian type, must be big or " + " little")); + if(endian != 'big' || endian != 'little') + throw (new Error('invalid endian type, must be big or ' + ' little')); this.endian = endian; }; @@ -479,31 +479,31 @@ CTypeParser.prototype.typedef = function(name, value) { var type; if(name === undefined) - throw (new (Error("missing required typedef argument: name"))); + throw (new (Error('missing required typedef argument: name'))); if(value === undefined) - throw (new (Error("missing required typedef argument: value"))); + throw (new (Error('missing required typedef argument: value'))); - if( typeof (name) != "string") - throw (new (Error("the name of a type must be a string"))); + if( typeof (name) != 'string') + throw (new (Error('the name of a type must be a string'))); type = ctParseType(name); - if(type["len"] !== undefined) - throw (new Error("Cannot have an array in the typedef name")); + if(type['len'] !== undefined) + throw (new Error('Cannot have an array in the typedef name')); if( name in this.types) - throw (new Error("typedef name already present: " + name)); + throw (new Error('typedef name already present: ' + name)); - if( typeof (value) != "string" && !( value instanceof Array)) - throw (new Error("typedef value must either be a string or " + "struct")); + if( typeof (value) != 'string' && !( value instanceof Array)) + throw (new Error('typedef value must either be a string or ' + 'struct')); - if( typeof (value) == "string") { + if( typeof (value) == 'string') { type = ctParseType(value); - if(type["len"] !== undefined) { - if(isNaN(parseInt(type["len"], 10))) - throw (new (Error("typedef value must use " + - "fixed size array when outside of a " + - "struct"))); + if(type['len'] !== undefined) { + if(isNaN(parseInt(type['len'], 10))) + throw (new (Error('typedef value must use ' + + 'fixed size array when outside of a ' + + 'struct'))); } this.types[name] = value; @@ -539,20 +539,20 @@ CTypeParser.prototype.lstypes = function() { * values An object that can be used to fulfill type information */ function ctResolveArray(str, values) { - var ret = ""; + var ret = ''; var type = ctParseType(str); - while(type["len"] !== undefined) { - if(isNaN(parseInt(type["len"], 10))) { - if( typeof (values[type["len"]]) != "number") - throw (new Error("cannot sawp in non-number " + "for array value")); - ret = "[" + values[type["len"]] + "]" + ret; + while(type['len'] !== undefined) { + if(isNaN(parseInt(type['len'], 10))) { + if( typeof (values[type['len']]) != 'number') + throw (new Error('cannot sawp in non-number ' + 'for array value')); + ret = '[' + values[type['len']] + ']' + ret; } else { - ret = "[" + type["len"] + "]" + ret; + ret = '[' + type['len'] + ']' + ret; } - type = ctParseType(type["type"]); + type = ctParseType(type['type']); } - ret = type["type"] + ret; + ret = type['type'] + ret; return (ret); } @@ -564,24 +564,22 @@ function ctResolveArray(str, values) { */ CTypeParser.prototype.resolveTypedef = function(type, dispatch, buffer, offset, value) { var pt; - console.log(type); ASSERT.ok( type in this.types); - console.log(type + ":" + this.types[type]); - if( typeof (this.types[type]) == "string") { + if( typeof (this.types[type]) == 'string') { pt = ctParseType(this.types[type]); - if(dispatch == "read") + if(dispatch == 'read') return (this.readEntry(pt, buffer, offset)); - else if(dispatch == "write") + else if(dispatch == 'write') return (this.writeEntry(value, pt, buffer, offset)); else - throw (new Error("invalid dispatch type to " + "resolveTypedef")); + throw (new Error('invalid dispatch type to ' + 'resolveTypedef')); } else { - if(dispatch == "read") + if(dispatch == 'read') return (this.readStruct(this.types[type], buffer, offset)); - else if(dispatch == "write") + else if(dispatch == 'write') return (this.readStruct(value, this.types[type], buffer, offset)); else - throw (new Error("invalid dispatch type to " + "resolveTypedef")); + throw (new Error('invalid dispatch type to ' + 'resolveTypedef')); } }; @@ -605,20 +603,20 @@ CTypeParser.prototype.readEntry = function(type, buffer, offset) { * - Generic typedef handler * - Basic type handler */ - if(type["len"] !== undefined) { - len = parseInt(type["len"], 10); + if(type['len'] !== undefined) { + len = parseInt(type['len'], 10); if(isNaN(len)) - throw (new Error("somehow got a non-numeric length")); + throw (new Error('somehow got a non-numeric length')); - if(type["type"] == "char") - parse = deftypes["char[]"]["read"](len, this.endian, buffer, offset); + if(type['type'] == 'char') + parse = deftypes['char[]']['read'](len, this.endian, buffer, offset); else - parse = this.readArray(type["type"], len, buffer, offset); + parse = this.readArray(type['type'], len, buffer, offset); } else { - if(type["type"] in deftypes) - parse = deftypes[type["type"]]["read"](this.endian, buffer, offset); + if(type['type'] in deftypes) + parse = deftypes[type['type']]['read'](this.endian, buffer, offset); else - parse = this.resolveTypedef(type["type"], "read", buffer, offset); + parse = this.resolveTypedef(type['type'], 'read', buffer, offset); } return (parse); @@ -634,8 +632,8 @@ CTypeParser.prototype.readArray = function(type, length, buffer, offset) { for( ii = 0; ii < length; ii++) { ent = this.readEntry(pt, buffer, offset); - offset += ent["size"]; - ret[ii] = ent["value"]; + offset += ent['size']; + ret[ii] = ent['value']; } return ( { @@ -657,13 +655,13 @@ CTypeParser.prototype.readStruct = function(def, buffer, offset) { entry = def[ii][key]; /* Resolve all array values */ - type = ctParseType(ctResolveArray(entry["type"], ret)); + type = ctParseType(ctResolveArray(entry['type'], ret)); - if("offset" in entry) - offset = baseOffset + entry["offset"]; + if('offset' in entry) + offset = baseOffset + entry['offset']; parse = this.readEntry(type, buffer, offset); - offset += parse["size"]; - ret[key] = parse["value"]; + offset += parse['size']; + ret[key] = parse['value']; } return ( { @@ -687,18 +685,18 @@ CTypeParser.prototype.readStruct = function(def, buffer, offset) { CTypeParser.prototype.readData = function(def, buffer, offset) { /* Sanity check for arguments */ if(def === undefined) - throw (new Error("missing definition for what we should be" + "parsing")); + throw (new Error('missing definition for what we should be' + 'parsing')); if(buffer === undefined) - throw (new Error("missing buffer for what we should be" + "parsing")); + throw (new Error('missing buffer for what we should be' + 'parsing')); if(offset === undefined) - throw (new Error("missing offset for what we should be" + "parsing")); + throw (new Error('missing offset for what we should be' + 'parsing')); /* Sanity check the object definition */ ctCheckReq(def, this.types); - return (this.readStruct(def, buffer, offset)["values"]); + return (this.readStruct(def, buffer, offset)['values']); }; /* * [private] Write out an array of data @@ -707,10 +705,10 @@ CTypeParser.prototype.writeArray = function(value, type, length, buffer, offset) var ii, pt; var baseOffset = offset; if(!( value instanceof Array)) - throw (new Error("asked to write an array, but value is not " + "an array")); + throw (new Error('asked to write an array, but value is not ' + 'an array')); if(value.length != length) - throw (new Error("asked to write array of length " + length + " but that does not match value length: " + value.length)); + throw (new Error('asked to write array of length ' + length + ' but that does not match value length: ' + value.length)); pt = ctParseType(type); for( ii = 0; ii < length; ii++) offset += this.writeEntry(value[ii], pt, buffer, offset); @@ -723,20 +721,20 @@ CTypeParser.prototype.writeArray = function(value, type, length, buffer, offset) CTypeParser.prototype.writeEntry = function(value, type, buffer, offset) { var len, ret; - if(type["len"] !== undefined) { - len = parseInt(type["len"], 10); + if(type['len'] !== undefined) { + len = parseInt(type['len'], 10); if(isNaN(len)) - throw (new Error("somehow got a non-numeric length")); + throw (new Error('somehow got a non-numeric length')); - if(type["type"] == "char") - ret = deftypes["char[]"]["write"](value, len, this.endian, buffer, offset); + if(type['type'] == 'char') + ret = deftypes['char[]']['write'](value, len, this.endian, buffer, offset); else - ret = this.writeArray(value, type["type"], len, buffer, offset); + ret = this.writeArray(value, type['type'], len, buffer, offset); } else { - if(type["type"] in deftypes) - ret = deftypes[type["type"]]["write"](value, this.endian, buffer, offset); + if(type['type'] in deftypes) + ret = deftypes[type['type']]['write'](value, this.endian, buffer, offset); else - ret = this.resolveTypedef(type["type"], "write", buffer, offset, value); + ret = this.resolveTypedef(type['type'], 'write', buffer, offset, value); } return (ret); @@ -752,14 +750,14 @@ CTypeParser.prototype.writeStruct = function(def, buffer, offset) { for( ii = 0; ii < def.length; ii++) { key = Object.keys(def[ii])[0]; entry = def[ii][key]; - type = ctParseType(ctResolveArray(entry["type"], vals)); + type = ctParseType(ctResolveArray(entry['type'], vals)); - if("offset" in entry) - offset = baseOffset + entry["offset"]; - offset += this.writeEntry(entry["value"], type, buffer, offset); + if('offset' in entry) + offset = baseOffset + entry['offset']; + offset += this.writeEntry(entry['value'], type, buffer, offset); /* Now that we've written it out, we can use it for arrays */ - vals[key] = entry["value"]; + vals[key] = entry['value']; } }; /* @@ -775,15 +773,15 @@ CTypeParser.prototype.writeStruct = function(def, buffer, offset) { */ CTypeParser.prototype.write = function(def, buffer, offset) { if(def === undefined) - throw (new Error("missing definition for what we should be" + "parsing")); + throw (new Error('missing definition for what we should be' + 'parsing')); if(buffer === undefined) - throw (new Error("missing buffer for what we should be" + "parsing")); + throw (new Error('missing buffer for what we should be' + 'parsing')); if(offset === undefined) - throw (new Error("missing offset for what we should be" + "parsing")); + throw (new Error('missing offset for what we should be' + 'parsing')); - ctCheckReq(def, this.types, ["value"]); + ctCheckReq(def, this.types, ['value']); this.writeStruct(def, buffer, offset); }; @@ -805,17 +803,17 @@ CTypeParser.prototype.write = function(def, buffer, offset) { */ function toAbs64(val) { if(val === undefined) - throw (new Error("missing required arg: value")); + throw (new Error('missing required arg: value')); if(!( val instanceof Array)) - throw (new Error("value must be an array")); + throw (new Error('value must be an array')); if(val.length != 2) - throw (new Error("value must be an array of length 2")); + throw (new Error('value must be an array of length 2')); /* We have 20 bits worth of precision in this range */ if(val[0] >= 0x100000) - throw (new Error("value would become approximated")); + throw (new Error('value would become approximated')); return (val[0] * Math.pow(2, 32) + val[1]); } @@ -831,13 +829,13 @@ toAbs64([1,1]); //Not used apparently, said the linter. I don't know if this is */ function toApprox64(val) { if(val === undefined) - throw (new Error("missing required arg: value")); + throw (new Error('missing required arg: value')); if(!( val instanceof Array)) - throw (new Error("value must be an array")); + throw (new Error('value must be an array')); if(val.length != 2) - throw (new Error("value must be an array of length 2")); + throw (new Error('value must be an array of length 2')); return (Math.pow(2, 32) * val[0] + val[1]); } diff --git a/lib/hashinator.js b/lib/hashinator.js index 21540e8..f2838d1 100644 --- a/lib/hashinator.js +++ b/lib/hashinator.js @@ -1,24 +1,24 @@ -const Message = require("./message").Message; -const { NUMERIC_TYPES } = require("./voltconstants"); -const hash = require("murmurhash-native").murmurHash128x64; +const Message = require('./message').Message; +const { NUMERIC_TYPES } = require('./voltconstants'); +const hash = require('murmurhash-native').murmurHash128x64; const toBytes = (type,value) => { switch(type){ - case "varbinary": + case 'varbinary': return value; - case "string": - return new Buffer(value,"utf8"); - case "byte": - case "tinyint": - case "short": - case "smallint": - case "int": - case "integer": - case "long": - case "bigint": { + case 'string': + return new Buffer(value,'utf8'); + case 'byte': + case 'tinyint': + case 'short': + case 'smallint': + case 'int': + case 'integer': + case 'long': + case 'bigint': { const message = new Message(new Buffer(8)); message.position = 0; - message.writeLong(value, "little"); + message.writeLong(value, 'little'); return message.buffer; } @@ -71,12 +71,12 @@ const getPartitionForValue = ( type, value, tokenCount, tokens ) => { // load CSV data or other untyped inputs that match DDL without // requiring the loader to know precise the schema. if (value !== null && !!NUMERIC_TYPES[type] ) { - if ( typeof value === "string") { + if ( typeof value === 'string') { value = parseInt(value,10); if ( Number.isNaN(value) ) { - throw new Error("getHashedPartitionForParameter: Unable to convert string " + - value + " to a numeric value target parameter"); + throw new Error('getHashedPartitionForParameter: Unable to convert string ' + + value + ' to a numeric value target parameter'); } } } diff --git a/lib/message.js b/lib/message.js index e0ca0eb..cce53a6 100644 --- a/lib/message.js +++ b/lib/message.js @@ -24,11 +24,11 @@ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ -var Parser = require("./parser").Parser, - util = require("util"), - PRESENT = require("./voltconstants").PRESENT, - MESSAGE_TYPE = require("./voltconstants").MESSAGE_TYPE, - STATUS_CODE_STRINGS = require("./voltconstants").STATUS_CODE_STRINGS; +var Parser = require('./parser').Parser, + util = require('util'), + PRESENT = require('./voltconstants').PRESENT, + MESSAGE_TYPE = require('./voltconstants').MESSAGE_TYPE, + STATUS_CODE_STRINGS = require('./voltconstants').STATUS_CODE_STRINGS; function Message(buffer) { this.type = MESSAGE_TYPE.UNDEFINED; @@ -77,7 +77,7 @@ const LoginMessage = function(buffer) { this.connectionId = this.readLong(); this.clusterStartTimestamp = new Date(parseInt(this.readLong().toString())); // not microseonds, milliseconds - this.leaderIP = this.readByte() + "." + this.readByte() + "." + this.readByte() + "." + this.readByte(); + this.leaderIP = this.readByte() + '.' + this.readByte() + '.' + this.readByte() + '.' + this.readByte(); this.build = this.readString(); } }; @@ -112,7 +112,7 @@ const QueryMessage = function(buffer) { this.statusString = this.readString(); } this.appStatus = this.readByte(); - this.appStatusString = ""; + this.appStatusString = ''; if(this.fieldsPresent & PRESENT.APP_STATUS) { this.appStatusString = this.readString(); } diff --git a/lib/parser.js b/lib/parser.js index cce0add..8effd3f 100644 --- a/lib/parser.js +++ b/lib/parser.js @@ -24,19 +24,19 @@ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ -const VoltTable = require("./volttable"); +const VoltTable = require('./volttable'); -var BigInteger = require("bignumber").BigInteger, - ctype = require("./ctype"), - PROTOCOL_ENDIAN = "big"; +var BigInteger = require('bignumber').BigInteger, + ctype = require('./ctype'), + PROTOCOL_ENDIAN = 'big'; var NullValueOf = { byte: -128, short: -32768, int: -2147483648, - long: new BigInteger("-9223372036854775808"), + long: new BigInteger('-9223372036854775808'), double: -1.7E+308, - decimal: "-170141183460469231731687303715884105728" + decimal: '-170141183460469231731687303715884105728' }; const { @@ -47,7 +47,7 @@ const { NUMERIC_TYPES, STRING_TYPES, BIGINT_TYPES -} = require("./voltconstants"); +} = require('./voltconstants'); function Parser(buffer) { this.buffer = buffer || []; @@ -56,7 +56,7 @@ function Parser(buffer) { Parser.prototype.write = function(value, type){ if ( !TYPES_WRITE[type] ) - throw new Error("No writer for type: ", type); + throw new Error('No writer for type: ', type); this[TYPES_WRITE[type]](value); }; @@ -73,7 +73,7 @@ Parser.prototype.writeBinary = function(buffer) { Parser.prototype.readByte = function() { var res = ctype.rsint8(this.buffer, PROTOCOL_ENDIAN, this.position++); - if (res === NullValueOf["byte"]) { + if (res === NullValueOf['byte']) { return null; } else { return res; @@ -81,14 +81,14 @@ Parser.prototype.readByte = function() { }; Parser.prototype.writeByte = function(value) { if (value == null) { - value = NullValueOf["byte"]; + value = NullValueOf['byte']; } ctype.wsint8(value, PROTOCOL_ENDIAN, this.buffer, this.position++); }; Parser.prototype.readShort = function() { var res = ctype.rsint16(this.buffer, PROTOCOL_ENDIAN, (this.position += 2) - 2); - if (res === NullValueOf["short"]) { + if (res === NullValueOf['short']) { return null; } else { return res; @@ -96,14 +96,14 @@ Parser.prototype.readShort = function() { }; Parser.prototype.writeShort = function(value) { if (value == null) { - value = NullValueOf["short"]; + value = NullValueOf['short']; } ctype.wsint16(value, PROTOCOL_ENDIAN, this.buffer, (this.position += 2) - 2); }; Parser.prototype.readInt = function() { var res = ctype.rsint32(this.buffer, PROTOCOL_ENDIAN, (this.position += 4) - 4); - if (res === NullValueOf["int"]) { + if (res === NullValueOf['int']) { return null; } else { return res; @@ -111,14 +111,14 @@ Parser.prototype.readInt = function() { }; Parser.prototype.writeInt = function(value) { if (value == null) { - value = NullValueOf["int"]; + value = NullValueOf['int']; } ctype.wsint32(value, PROTOCOL_ENDIAN, this.buffer, (this.position += 4) - 4); }; Parser.prototype.readDouble = function() { var res = ctype.rdouble(this.buffer, PROTOCOL_ENDIAN, (this.position += 8) - 8); - if (res === NullValueOf["double"]) { + if (res === NullValueOf['double']) { return null; } else { return res; @@ -126,7 +126,7 @@ Parser.prototype.readDouble = function() { }; Parser.prototype.writeDouble = function(value) { if (value == null) { - value = NullValueOf["double"]; + value = NullValueOf['double']; } ctype.wdouble(value, PROTOCOL_ENDIAN, this.buffer, (this.position += 8) - 8); }; @@ -142,7 +142,7 @@ Parser.prototype.readLongBytes = function() { Parser.prototype.readLong = function() { var res = this.readLongBytes(); - if (res.equals(NullValueOf["long"])) { + if (res.equals(NullValueOf['long'])) { return null; } else { return res; @@ -150,13 +150,13 @@ Parser.prototype.readLong = function() { }; Parser.prototype.writeLong = function(value, endian = PROTOCOL_ENDIAN) { if (value == null) { - value = NullValueOf["long"]; + value = NullValueOf['long']; } var bytes, numBytes = 8; - if( typeof value === "number") + if( typeof value === 'number') value = new BigInteger(value.toString()); if(!( value instanceof BigInteger)) - throw new Error("Long type must be a BigInteger or Number"); + throw new Error('Long type must be a BigInteger or Number'); bytes = value.toByteArray(); if (bytes[0] >= 0) { while (bytes.length < numBytes) { @@ -168,7 +168,7 @@ Parser.prototype.writeLong = function(value, endian = PROTOCOL_ENDIAN) { } } - if ( endian === "big" ){ + if ( endian === 'big' ){ for(let i = 0; i < numBytes; i++) ctype.wsint8(bytes[i], endian, this.buffer, this.position + i); } else { @@ -182,14 +182,14 @@ Parser.prototype.writeLong = function(value, endian = PROTOCOL_ENDIAN) { Parser.prototype.readString = function() { var length = this.readInt(); if (length < 0) return null; - return this.buffer.toString("utf8", this.position, this.position += length); + return this.buffer.toString('utf8', this.position, this.position += length); }; Parser.prototype.writeString = function(value) { var length; if (value == null) { length = -1; } else { - var strBuf = new Buffer(value, "utf8"); + var strBuf = new Buffer(value, 'utf8'); length = strBuf.length; } this.writeInt(length); @@ -202,7 +202,7 @@ Parser.prototype.writeString = function(value) { Parser.prototype.readDate = function() { var bigInt = this.readLongBytes(); - if (bigInt.toString() === NullValueOf["long"]) { + if (bigInt.toString() === NullValueOf['long']) { return null; } else { var intStr = bigInt.divide(thousand).toString(); @@ -217,8 +217,8 @@ Parser.prototype.writeDate = function(value) { var bigInt; if (value instanceof Date) value = value.getTime(); - else if (typeof value !== "number") - throw new Error("Date type must be a Date or number"); + else if (typeof value !== 'number') + throw new Error('Date type must be a Date or number'); bigInt = new BigInteger(value.toString()); this.writeLong(bigInt.multiply(thousand)); @@ -234,31 +234,31 @@ Parser.prototype.readDecimal = function() { var val = bigInt.toString(); // handle the null value case - if(val === NullValueOf["decimal"]) { + if(val === NullValueOf['decimal']) { val = null; } else if(val.length <= 12) { // add leading zeros (e.g. 123 to 0.000000000123) - val = zeros(decimalPlaces - val.length).join("") + val; - val = "0." + val; + val = zeros(decimalPlaces - val.length).join('') + val; + val = '0.' + val; } else { // put the decimal in the right place - val = val.slice(0, -decimalPlaces) + "." + val.slice(-decimalPlaces); + val = val.slice(0, -decimalPlaces) + '.' + val.slice(-decimalPlaces); } return val; }; Parser.prototype.writeDecimal = function(value) { var bytes, bigInt, numBytes = 16; if(value == null) { - bigInt = new BigInteger(NullValueOf["decimal"]); + bigInt = new BigInteger(NullValueOf['decimal']); } else { - if (typeof value === "number") + if (typeof value === 'number') value = value.toString(); - if (typeof value != "string" || !(/^-?\d*\.?\d*$/).test(value)) - throw new Error("Decimal type must be a numerical string or Number:" + value); + if (typeof value != 'string' || !(/^-?\d*\.?\d*$/).test(value)) + throw new Error('Decimal type must be a numerical string or Number:' + value); // add decimal and missing zeros - if (value.startsWith(".")) { - value = "0" + value; + if (value.startsWith('.')) { + value = '0' + value; } bigInt = new BigInteger(sanitizeDecimal(value)); } @@ -309,9 +309,9 @@ Parser.prototype.writeNull = function() { Parser.prototype.readArray = function(type, value) { type = TYPES_STRINGS[this.readByte()]; if(type == undefined) - throw new Error("Unsupported type, update driver"); + throw new Error('Unsupported type, update driver'); - var length = (type == "byte" ? this.readInt() : this.readShort()); + var length = (type == 'byte' ? this.readInt() : this.readShort()); var method = TYPES_READ[type]; value = new Array(length); for(var i = 0; i < length; i++) { @@ -321,11 +321,11 @@ Parser.prototype.readArray = function(type, value) { }; Parser.prototype.writeArray = function(type, value) { - if(type.slice(0, 5) != "array" && !TYPES_NUMBERS.hasOwnProperty(type)) - throw new Error("Type must be one of: array, null tinyint, smallint," + " integer, bigint, float, string, timestamp, decimal"); + if(type.slice(0, 5) != 'array' && !TYPES_NUMBERS.hasOwnProperty(type)) + throw new Error('Type must be one of: array, null tinyint, smallint,' + ' integer, bigint, float, string, timestamp, decimal'); if(!( value instanceof Array)) - throw new Error(("Array value must be an Array")); + throw new Error(('Array value must be an Array')); const length = value.length; let i = 0; @@ -348,7 +348,7 @@ Parser.prototype.writeArray = function(type, value) { this.writeByte(TYPES_NUMBERS[type]); // write type // write length - type == "byte" ? this.writeInt(length) : this.writeShort(length); + type == 'byte' ? this.writeInt(length) : this.writeShort(length); var method = TYPES_WRITE[type]; // write values @@ -372,26 +372,26 @@ Parser.prototype.writeVoltTable = function(vt) { Parser.prototype.readException = function(length) { if(length == 0) - new Error("An exception has occurred"); + new Error('An exception has occurred'); var ordinal = this.readByte(); // they don't have a spec for exceptions at this time, just skip it. this.readBinary(length - 1); switch(ordinal){ case 1: - return new Error("EEException"); + return new Error('EEException'); case 2: - return new Error("SQLException"); + return new Error('SQLException'); case 3: - return new Error("ConstraintFailureException"); + return new Error('ConstraintFailureException'); default: - return new Error("An exception has occurred"); + return new Error('An exception has occurred'); } }; Parser.prototype.writeParameterSet = function(types, values) { if(types.length != values.length) - throw new Error("The number of parameters do not match the number of " + "types defined in the definition."); + throw new Error('The number of parameters do not match the number of ' + 'types defined in the definition.'); const length = values.length; this.writeShort(length); @@ -428,7 +428,7 @@ var arrExp = /array\[(.*)\]/; -var thousand = new BigInteger("1000"); +var thousand = new BigInteger('1000'); function zeros(num) { var arr = new Array(num); @@ -447,59 +447,59 @@ function ones(num) { ones(1); //for linter function checkType(type, value) { - if(type == "array") - throw new Error("Type array must have a subtype. E.g. array[string]"); + if(type == 'array') + throw new Error('Type array must have a subtype. E.g. array[string]'); - if(type.slice(0, 5) != "array" && !TYPES_NUMBERS.hasOwnProperty(type)) - throw new Error("Type must be one of: array, null tinyint, smallint, " + "integer, bigint, float, string, timestamp, decimal"); + if(type.slice(0, 5) != 'array' && !TYPES_NUMBERS.hasOwnProperty(type)) + throw new Error('Type must be one of: array, null tinyint, smallint, ' + 'integer, bigint, float, string, timestamp, decimal'); - if( typeof value === "number" && !NUMERIC_TYPES[type]) - throw new Error("Providing a numeric type for a non-numeric field. " + value + " can not be a " + type); + if( typeof value === 'number' && !NUMERIC_TYPES[type]) + throw new Error('Providing a numeric type for a non-numeric field. ' + value + ' can not be a ' + type); - if( typeof value === "string" && !STRING_TYPES[type]) - throw new Error("Providing a string type for a non-string field. " + value + " can not be a " + type); + if( typeof value === 'string' && !STRING_TYPES[type]) + throw new Error('Providing a string type for a non-string field. ' + value + ' can not be a ' + type); - if( value instanceof VoltTable && type !== "volttable" ) - throw new Error("Providing a VoltTable type for a non-VoltTable field. " + value + " can not be a " + type); + if( value instanceof VoltTable && type !== 'volttable' ) + throw new Error('Providing a VoltTable type for a non-VoltTable field. ' + value + ' can not be a ' + type); - if( !(value instanceof VoltTable) && type == "volttable" ) - throw new Error("Providing a non-VoltTable type for a VoltTable field. " + value + " can not be a " + type); + if( !(value instanceof VoltTable) && type == 'volttable' ) + throw new Error('Providing a non-VoltTable type for a VoltTable field. ' + value + ' can not be a ' + type); - if( typeof value === "object" && !( value instanceof Array) && !( value instanceof Uint8Array) && (value != null && !(value instanceof VoltTable))) - throw new Error("Cannot provide custom objects as procedure parameters"); + if( typeof value === 'object' && !( value instanceof Array) && !( value instanceof Uint8Array) && (value != null && !(value instanceof VoltTable))) + throw new Error('Cannot provide custom objects as procedure parameters'); - if( value instanceof Array && type.slice(0, 5) != "array") - throw new Error("Providing an array type for a non-array field. " + value + " can not be a " + type); + if( value instanceof Array && type.slice(0, 5) != 'array') + throw new Error('Providing an array type for a non-array field. ' + value + ' can not be a ' + type); - if(type.slice(0, 5) == "array" && !( value instanceof Array)) - throw new Error("Providing a non-array value for an array field. " + value + " can not be a " + type); + if(type.slice(0, 5) == 'array' && !( value instanceof Array)) + throw new Error('Providing a non-array value for an array field. ' + value + ' can not be a ' + type); if( value instanceof BigInteger && !BIGINT_TYPES[type]) - throw new Error("Providing a BigInteger type for a non-bigint field. " + value + " can not be a " + type); + throw new Error('Providing a BigInteger type for a non-bigint field. ' + value + ' can not be a ' + type); } function sanitizeDecimal(value) { var MAX_INT_DIGIT = 26, MAX_FRAC_DIGIT = 12; - var sign = ""; - if (value.startsWith("-")) { - sign = "-"; + var sign = ''; + if (value.startsWith('-')) { + sign = '-'; value = value.slice(1); } - var parts = value.split("."); + var parts = value.split('.'); // first check if the given value is legal if (parts[0].length > MAX_INT_DIGIT) { - throw new Error("The integer part should not have more than" + MAX_INT_DIGIT + "digits."); + throw new Error('The integer part should not have more than' + MAX_INT_DIGIT + 'digits.'); } if (parts.length == 2 && parts[1].length > MAX_FRAC_DIGIT) { - throw new Error("The fractional part should not have more than" + MAX_FRAC_DIGIT + "digits."); + throw new Error('The fractional part should not have more than' + MAX_FRAC_DIGIT + 'digits.'); } // add trailing zeros if (parts.length == 1) { - return sign + parts[0] + zeros(MAX_FRAC_DIGIT).join(""); + return sign + parts[0] + zeros(MAX_FRAC_DIGIT).join(''); } else { - return sign + parts[0] + parts[1] + zeros(MAX_FRAC_DIGIT - parts[1].length).join(""); + return sign + parts[0] + parts[1] + zeros(MAX_FRAC_DIGIT - parts[1].length).join(''); } } \ No newline at end of file diff --git a/lib/query.js b/lib/query.js index 13aaaae..41e28e9 100644 --- a/lib/query.js +++ b/lib/query.js @@ -25,7 +25,7 @@ * OTHER DEALINGS IN THE SOFTWARE. */ -var Message = require("./message").Message; +var Message = require('./message').Message; const VoltQuery = function(procName, types) { this.procName = procName; this.types = types || []; diff --git a/lib/voltconstants.js b/lib/voltconstants.js index a67e62b..556c73f 100644 --- a/lib/voltconstants.js +++ b/lib/voltconstants.js @@ -60,13 +60,13 @@ const PRESENT = { * other error conditions. */ const SESSION_EVENT = { - CONNECTION : "CONNECT", - CONNECTION_ERROR: "CONNECT_ERROR", - QUERY_RESPONSE: "QUERY_RESPONSE", - QUERY_ALLOWED: "QUERY_ALLOWED", - QUERY_RESPONSE_ERROR: "QUERY_RESPONSE_ERROR", - QUERY_DISPATCH_ERROR: "QUERY_DISPATCH_ERROR", - FATAL_ERROR: "FATAL_ERROR" + CONNECTION : 'CONNECT', + CONNECTION_ERROR: 'CONNECT_ERROR', + QUERY_RESPONSE: 'QUERY_RESPONSE', + QUERY_ALLOWED: 'QUERY_ALLOWED', + QUERY_RESPONSE_ERROR: 'QUERY_RESPONSE_ERROR', + QUERY_DISPATCH_ERROR: 'QUERY_DISPATCH_ERROR', + FATAL_ERROR: 'FATAL_ERROR' }; /** @@ -102,31 +102,31 @@ const STATUS_CODES = { }; const STATUS_CODE_STRINGS = { - 1 : "SUCCESS", - "-1" : "USER_ABORT", - "-2" : "GRACEFUL_FAILURE", - "-3" : "UNEXPECTED_FAILURE", - "-4" : "CONNECTION_LOST", - "-5" : "SERVER_UNAVAILABLE", - "-6" : "CONNECTION_LOST", - "-7" : "QUERY_TIMEOUT", - "-8" : "QUERY_TOOK_TOO_LONG" + 1 : 'SUCCESS', + '-1' : 'USER_ABORT', + '-2' : 'GRACEFUL_FAILURE', + '-3' : 'UNEXPECTED_FAILURE', + '-4' : 'CONNECTION_LOST', + '-5' : 'SERVER_UNAVAILABLE', + '-6' : 'CONNECTION_LOST', + '-7' : 'QUERY_TIMEOUT', + '-8' : 'QUERY_TOOK_TOO_LONG' }; const LOGIN_ERRORS = { - 1 : "Too many connections", - 3 : "Corrupt or invalid login message", - 4 : "Can't resolve host", - 5 : "Authentication failed, client took too long to transmit credentials", - 6 : "Connection refused", - 7 : "Socket closed by other party", - 8 : "Connection timeout" + 1 : 'Too many connections', + 3 : 'Corrupt or invalid login message', + 4 : 'Can\'t resolve host', + 5 : 'Authentication failed, client took too long to transmit credentials', + 6 : 'Connection refused', + 7 : 'Socket closed by other party', + 8 : 'Connection timeout' }; const SOCKET_ERRORS = { - ENOTFOUND: "HOST_UNKNOWN", - ECONNREFUSED: "CONNECTION_REFUSED", - EPIPE: "SOCKET_CLOSED" + ENOTFOUND: 'HOST_UNKNOWN', + ECONNREFUSED: 'CONNECTION_REFUSED', + EPIPE: 'SOCKET_CLOSED' }; const LOGIN_STATUS = { @@ -140,8 +140,8 @@ const LOGIN_STATUS = { }; const HASH_ALGORITHMS = { - SHA_1: "sha1", - SHA_2: "sha256" + SHA_1: 'sha1', + SHA_2: 'sha256' }; const RESULT_STATUS = { @@ -151,120 +151,120 @@ const RESULT_STATUS = { /**************** */ const TYPES_SIZES = { - "byte" : 1, - "tinyint" : 1, - "short" : 2, - "smallint" : 2, - "int" : 4, - "integer" : 4, - "long" : 8, - "bigint" : 8, - "double" : 8, - "float" : 8, - "date" : 8, - "timestamp" : 8, - "decimal" : 16 + 'byte' : 1, + 'tinyint' : 1, + 'short' : 2, + 'smallint' : 2, + 'int' : 4, + 'integer' : 4, + 'long' : 8, + 'bigint' : 8, + 'double' : 8, + 'float' : 8, + 'date' : 8, + 'timestamp' : 8, + 'decimal' : 16 }; const TYPES_STRINGS = { - "-99" : "array", - "1" : "null", - "3" : "byte", - "4" : "short", - "5" : "int", - "6" : "long", - "8" : "double", - "9" : "string", - "11" : "date", - "22" : "decimal", - "25" : "varbinary" + '-99' : 'array', + '1' : 'null', + '3' : 'byte', + '4' : 'short', + '5' : 'int', + '6' : 'long', + '8' : 'double', + '9' : 'string', + '11' : 'date', + '22' : 'decimal', + '25' : 'varbinary' }; const TYPES_NUMBERS = { - "array" : -99, - "null" : 1, - "byte" : 3, - "tinyint" : 3, - "short" : 4, - "smallint" : 4, - "int" : 5, - "integer" : 5, - "long" : 6, - "bigint" : 6, - "double" : 8, - "float" : 8, - "string" : 9, - "date" : 11, - "timestamp" : 11, - "decimal" : 22, - "varbinary" : 25, - "volttable" : 21 + 'array' : -99, + 'null' : 1, + 'byte' : 3, + 'tinyint' : 3, + 'short' : 4, + 'smallint' : 4, + 'int' : 5, + 'integer' : 5, + 'long' : 6, + 'bigint' : 6, + 'double' : 8, + 'float' : 8, + 'string' : 9, + 'date' : 11, + 'timestamp' : 11, + 'decimal' : 22, + 'varbinary' : 25, + 'volttable' : 21 }; const TYPES_READ = { - "array" : "readArray", - "null" : "readNull", - "byte" : "readByte", - "tinyint" : "readByte", - "short" : "readShort", - "smallint" : "readShort", - "int" : "readInt", - "integer" : "readInt", - "long" : "readLong", - "bigint" : "readLong", - "double" : "readDouble", - "float" : "readDouble", - "string" : "readString", - "date" : "readDate", - "timestamp" : "readDate", - "decimal" : "readDecimal", - "varbinary" : "readVarbinary" + 'array' : 'readArray', + 'null' : 'readNull', + 'byte' : 'readByte', + 'tinyint' : 'readByte', + 'short' : 'readShort', + 'smallint' : 'readShort', + 'int' : 'readInt', + 'integer' : 'readInt', + 'long' : 'readLong', + 'bigint' : 'readLong', + 'double' : 'readDouble', + 'float' : 'readDouble', + 'string' : 'readString', + 'date' : 'readDate', + 'timestamp' : 'readDate', + 'decimal' : 'readDecimal', + 'varbinary' : 'readVarbinary' }; const TYPES_WRITE = { - "array" : "writeArray", - "null" : "writeNull", - "byte" : "writeByte", - "tinyint" : "writeByte", - "short" : "writeShort", - "smallint" : "writeShort", - "int" : "writeInt", - "integer" : "writeInt", - "long" : "writeLong", - "bigint" : "writeLong", - "double" : "writeDouble", - "float" : "writeDouble", - "string" : "writeString", - "date" : "writeDate", - "timestamp" : "writeDate", - "decimal" : "writeDecimal", - "varbinary" : "writeVarbinary", - "volttable" : "writeVoltTable" + 'array' : 'writeArray', + 'null' : 'writeNull', + 'byte' : 'writeByte', + 'tinyint' : 'writeByte', + 'short' : 'writeShort', + 'smallint' : 'writeShort', + 'int' : 'writeInt', + 'integer' : 'writeInt', + 'long' : 'writeLong', + 'bigint' : 'writeLong', + 'double' : 'writeDouble', + 'float' : 'writeDouble', + 'string' : 'writeString', + 'date' : 'writeDate', + 'timestamp' : 'writeDate', + 'decimal' : 'writeDecimal', + 'varbinary' : 'writeVarbinary', + 'volttable' : 'writeVoltTable' }; const NUMERIC_TYPES = { - "byte" : true, - "tinyint" : true, - "short" : true, - "smallint" : true, - "int" : true, - "integer" : true, - "long" : true, - "bigint" : true, - "double" : true, - "float" : true, - "date" : true, - "timestamp" : true, - "decimal" : true, - "varbinary" : true + 'byte' : true, + 'tinyint' : true, + 'short' : true, + 'smallint' : true, + 'int' : true, + 'integer' : true, + 'long' : true, + 'bigint' : true, + 'double' : true, + 'float' : true, + 'date' : true, + 'timestamp' : true, + 'decimal' : true, + 'varbinary' : true }; const STRING_TYPES = { - "string" : true, - "decimal" : true + 'string' : true, + 'decimal' : true }; const BIGINT_TYPES = { - "long" : true, - "bigint" : true + 'long' : true, + 'bigint' : true }; @@ -286,7 +286,7 @@ module.exports = { TYPES_WRITE, STRING_TYPES, NUMERIC_TYPES, - BIGINT_TYPES, + BIGINT_TYPES, - HASH_ALGORITHMS + HASH_ALGORITHMS }; \ No newline at end of file diff --git a/lib/volttable.js b/lib/volttable.js index 1a5695e..c9277e2 100644 --- a/lib/volttable.js +++ b/lib/volttable.js @@ -21,7 +21,7 @@ * OTHER DEALINGS IN THE SOFTWARE. */ -const { TYPES_NUMBERS, TYPES_SIZES, TYPES_STRINGS, TYPES_READ } = require("./voltconstants"); +const { TYPES_NUMBERS, TYPES_SIZES, TYPES_STRINGS, TYPES_READ } = require('./voltconstants'); const bufferSize = str => str !== null ? 4 + str.length : 4; @@ -35,7 +35,7 @@ const arrayEquals = (a,b) => { const bigNumberEquals = (a,b) => { const trimZeroRegex = /^0+|0+$/gm; - return a.toString().replace(trimZeroRegex,"") === b.toString().replace(trimZeroRegex,""); + return a.toString().replace(trimZeroRegex,'') === b.toString().replace(trimZeroRegex,''); }; const sizeRow = (vt,i) => { @@ -43,8 +43,8 @@ const sizeRow = (vt,i) => { vt.columnTypes.forEach( (col, j) => { switch(col){ - case "string": - case "varbinary": + case 'string': + case 'varbinary': size += bufferSize(vt.data[i][vt.columnNames[j]]); break; default: @@ -72,14 +72,14 @@ VoltTable.prototype.addColumn = function(name, type, defaultValue = null){ type = type.toLowerCase(); if ( !TYPES_NUMBERS[type] ) - throw new Error(type + " is not a valid type. Valid types: " + JSON.stringify(Object.keys(TYPES_NUMBERS))); + throw new Error(type + ' is not a valid type. Valid types: ' + JSON.stringify(Object.keys(TYPES_NUMBERS))); - type = type === "tinyint" ? "byte" : type; - type = type === "smallint" ? "short" : type; - type = type === "integer" ? "int" : type; - type = type === "bigint" ? "long" : type; - type = type === "float" ? "double" : type; - type = type === "timestamp" ? "date" : type; + type = type === 'tinyint' ? 'byte' : type; + type = type === 'smallint' ? 'short' : type; + type = type === 'integer' ? 'int' : type; + type = type === 'bigint' ? 'long' : type; + type = type === 'float' ? 'double' : type; + type = type === 'timestamp' ? 'date' : type; name = name.toUpperCase(); this.columnNames.push(name); @@ -93,7 +93,7 @@ VoltTable.prototype.addRow = function(...args){ args = args.map( e => e === undefined ? null : e); if (args.length !== this.columnNames.length){ - throw new Error( JSON.stringify(args) + " does not match table schema: " + JSON.stringify(this.columnTypes) ); + throw new Error( JSON.stringify(args) + ' does not match table schema: ' + JSON.stringify(this.columnTypes) ); } let idx = this.data.length; @@ -203,27 +203,27 @@ VoltTable.prototype.equals = function(volttable){ let b = volttable.data[i][names[j]]; switch(this.columnTypes[j]){ - case "string": - case "double": - case "float": - case "byte": - case "tiny": - case "smallint": - case "short": - case "integer": - case "int": + case 'string': + case 'double': + case 'float': + case 'byte': + case 'tiny': + case 'smallint': + case 'short': + case 'integer': + case 'int': if ( a !== b ) return false; break; - case "date": - case "timestamp": + case 'date': + case 'timestamp': if ( a.getTime() !== b.getTime()) return false; break; - case "bigint": - case "long": - case "decimal": + case 'bigint': + case 'long': + case 'decimal': if ( !bigNumberEquals(a, b) ) return false; break; - case "varbinary": + case 'varbinary': if ( !a.equals(b) ) return false; } } diff --git a/test/cases/bufferTest.js b/test/cases/bufferTest.js index 9c880db..c291004 100644 --- a/test/cases/bufferTest.js +++ b/test/cases/bufferTest.js @@ -1,13 +1,13 @@ !(function (global) { // eslint-disable-line no-unused-vars - "use strict"; + 'use strict'; - const VoltClient = require("../../lib/client"); - const VoltConstants = require("../../lib/voltconstants"); + const VoltClient = require('../../lib/client'); + const VoltConstants = require('../../lib/voltconstants'); - require("nodeunit"); - const testContext = require("../util/test-context"); - const debug = console.log; //require("debug")("voltdb-client-nodejs:BufferTest"); + require('nodeunit'); + const testContext = require('../util/test-context'); + const debug = require('debug')('voltdb-client-nodejs:BufferTest'); //Setup context testContext.setup(); @@ -16,7 +16,7 @@ * A "good" client config that points to a volt instance on localhost */ function configs() { - return require("../config"); + return require('../config'); } /** @@ -29,7 +29,7 @@ if( !response.code ){ return response; } else { - debug("AdHocQuery Failure | Write Error. errorCode: %o, eventCode: %o, results: %O", + debug('AdHocQuery Failure | Write Error. errorCode: %o, eventCode: %o, results: %O', statusCodeToString(response.code), response.event, response.results ); @@ -41,11 +41,11 @@ if(response.results.status === PROC_STATUS_CODE_SUCCESS){ return response; } else { - debug("AdHocQuery Failure | Read Error. errorCode: %o, eventCode: %o, results: %O", statusCodeToString(response.code), response.event, response.results); + debug('AdHocQuery Failure | Read Error. errorCode: %o, eventCode: %o, results: %O', statusCodeToString(response.code), response.event, response.results); throw new Error(response); } }).catch( function(error){ - console.error("Error: ", error.toString()); + debug('Error: ', error.toString()); throw new Error(error); }); @@ -56,7 +56,7 @@ * Sugar for running an adhoc query */ function adHocQuery(queryString, client){ - debug("Query | query: %o", queryString); + debug('Query | query: %o', queryString); return query(client.adHoc(queryString)); } @@ -99,53 +99,53 @@ }, readTest : function(test){ - debug("readTest"); + debug('readTest'); const client = new VoltClient(configs()); - debug("Connecting"); + debug('Connecting'); client.connect() .then(function(){ test.ok(client.isConnected()); - debug("Connection success"); + debug('Connection success'); return Promise.resolve(null); }) .then(function(){ - debug("Dropping table"); - return adHocQuery("DROP TABLE PLAYERS IF EXISTS;", client).read; + debug('Dropping table'); + return adHocQuery('DROP TABLE PLAYERS IF EXISTS;', client).read; }) .then(function(){ - return adHocQuery("CREATE TABLE PLAYERS (" + - "playerID integer NOT NULL, " + - "teamid varchar(100) NOT NULL " + - ");", client).read; + return adHocQuery('CREATE TABLE PLAYERS (' + + 'playerID integer NOT NULL, ' + + 'teamid varchar(100) NOT NULL ' + + ');', client).read; }) .then(function(){ - return adHocQuery("DROP TABLE TEAM_PLAYERS IF EXISTS;", client).read; + return adHocQuery('DROP TABLE TEAM_PLAYERS IF EXISTS;', client).read; }) .then(function(){ - return adHocQuery("CREATE TABLE TEAM_PLAYERS (" + - "id integer NOT NULL, " + - "uid varchar(100) NOT NULL, " + - "name varchar(100) NOT NULL, " + - "avatar varbinary(12000) NOT NULL" + - ");", client).read; + return adHocQuery('CREATE TABLE TEAM_PLAYERS (' + + 'id integer NOT NULL, ' + + 'uid varchar(100) NOT NULL, ' + + 'name varchar(100) NOT NULL, ' + + 'avatar varbinary(12000) NOT NULL' + + ');', client).read; }) .then(function(){ const readPromises = []; return Promise.resolve() - .then(function() { return queryCollect("INSERT INTO PLAYERS VALUES (0, 'TeamA');", readPromises, client); }) - .then(function() { return queryCollect("INSERT INTO PLAYERS VALUES (1, 'TeamA');", readPromises, client); }) - .then(function() { return queryCollect("INSERT INTO PLAYERS VALUES (2, 'TeamA');", readPromises, client); }) - .then(function() { return queryCollect("INSERT INTO PLAYERS VALUES (3, 'TeamA');", readPromises, client); }) - .then(function() { return queryCollect("INSERT INTO PLAYERS VALUES (4, 'TeamA');", readPromises, client); }) - .then(function() { return queryCollect("INSERT INTO PLAYERS VALUES (5, 'TeamB');", readPromises, client); }) - .then(function() { return queryCollect("INSERT INTO PLAYERS VALUES (6, 'TeamB');", readPromises, client); }) - .then(function() { return queryCollect("INSERT INTO PLAYERS VALUES (7, 'TeamB');", readPromises, client); }) - .then(function() { return queryCollect("INSERT INTO PLAYERS VALUES (8, 'TeamB');", readPromises, client); }) - .then(function() { return queryCollect("INSERT INTO PLAYERS VALUES (9, 'TeamB');", readPromises, client); }) + .then(function() { return queryCollect('INSERT INTO PLAYERS VALUES (0, \'TeamA\');', readPromises, client); }) + .then(function() { return queryCollect('INSERT INTO PLAYERS VALUES (1, \'TeamA\');', readPromises, client); }) + .then(function() { return queryCollect('INSERT INTO PLAYERS VALUES (2, \'TeamA\');', readPromises, client); }) + .then(function() { return queryCollect('INSERT INTO PLAYERS VALUES (3, \'TeamA\');', readPromises, client); }) + .then(function() { return queryCollect('INSERT INTO PLAYERS VALUES (4, \'TeamA\');', readPromises, client); }) + .then(function() { return queryCollect('INSERT INTO PLAYERS VALUES (5, \'TeamB\');', readPromises, client); }) + .then(function() { return queryCollect('INSERT INTO PLAYERS VALUES (6, \'TeamB\');', readPromises, client); }) + .then(function() { return queryCollect('INSERT INTO PLAYERS VALUES (7, \'TeamB\');', readPromises, client); }) + .then(function() { return queryCollect('INSERT INTO PLAYERS VALUES (8, \'TeamB\');', readPromises, client); }) + .then(function() { return queryCollect('INSERT INTO PLAYERS VALUES (9, \'TeamB\');', readPromises, client); }) .then(function() { return Promise.all(readPromises); }); }) @@ -154,43 +154,43 @@ const readPromises = []; return Promise.resolve() - .then(function() { return queryCollect("INSERT INTO TEAM_PLAYERS VALUES (0, 'GameA', 'TeamA', 'ABCDEF');", readPromises, client); }) - .then(function() { return queryCollect("INSERT INTO TEAM_PLAYERS VALUES (1, 'GameB', 'TeamA', 'ABCDEF');", readPromises, client); }) - .then(function() { return queryCollect("INSERT INTO TEAM_PLAYERS VALUES (2, 'GameC', 'TeamA', 'ABCDEF');", readPromises, client); }) - .then(function() { return queryCollect("INSERT INTO TEAM_PLAYERS VALUES (3, 'GameD', 'TeamA', 'ABCDEF');", readPromises, client); }) - .then(function() { return queryCollect("INSERT INTO TEAM_PLAYERS VALUES (4, 'GameE', 'TeamA', 'ABCDEF');", readPromises, client); }) - .then(function() { return queryCollect("INSERT INTO TEAM_PLAYERS VALUES (5, 'GameA', 'TeamB', 'ABCDEF');", readPromises, client); }) - .then(function() { return queryCollect("INSERT INTO TEAM_PLAYERS VALUES (6, 'GameB', 'TeamB', 'ABCDEF');", readPromises, client); }) - .then(function() { return queryCollect("INSERT INTO TEAM_PLAYERS VALUES (7, 'GameC', 'TeamB', 'ABCDEF');", readPromises, client); }) - .then(function() { return queryCollect("INSERT INTO TEAM_PLAYERS VALUES (8, 'GameD', 'TeamB', 'ABCDEF');", readPromises, client); }) - .then(function() { return queryCollect("INSERT INTO TEAM_PLAYERS VALUES (9, 'GameE', 'TeamB', 'ABCDEF');", readPromises, client); }) + .then(function() { return queryCollect('INSERT INTO TEAM_PLAYERS VALUES (0, \'GameA\', \'TeamA\', \'ABCDEF\');', readPromises, client); }) + .then(function() { return queryCollect('INSERT INTO TEAM_PLAYERS VALUES (1, \'GameB\', \'TeamA\', \'ABCDEF\');', readPromises, client); }) + .then(function() { return queryCollect('INSERT INTO TEAM_PLAYERS VALUES (2, \'GameC\', \'TeamA\', \'ABCDEF\');', readPromises, client); }) + .then(function() { return queryCollect('INSERT INTO TEAM_PLAYERS VALUES (3, \'GameD\', \'TeamA\', \'ABCDEF\');', readPromises, client); }) + .then(function() { return queryCollect('INSERT INTO TEAM_PLAYERS VALUES (4, \'GameE\', \'TeamA\', \'ABCDEF\');', readPromises, client); }) + .then(function() { return queryCollect('INSERT INTO TEAM_PLAYERS VALUES (5, \'GameA\', \'TeamB\', \'ABCDEF\');', readPromises, client); }) + .then(function() { return queryCollect('INSERT INTO TEAM_PLAYERS VALUES (6, \'GameB\', \'TeamB\', \'ABCDEF\');', readPromises, client); }) + .then(function() { return queryCollect('INSERT INTO TEAM_PLAYERS VALUES (7, \'GameC\', \'TeamB\', \'ABCDEF\');', readPromises, client); }) + .then(function() { return queryCollect('INSERT INTO TEAM_PLAYERS VALUES (8, \'GameD\', \'TeamB\', \'ABCDEF\');', readPromises, client); }) + .then(function() { return queryCollect('INSERT INTO TEAM_PLAYERS VALUES (9, \'GameE\', \'TeamB\', \'ABCDEF\');', readPromises, client); }) .then(function() { return Promise.all(readPromises); }); }) .then(function(){ - return adHocQuery("select A.*, " + - "B.name as name, " + - "B.avatar as avatar " + - "from PLAYERS as A left join TEAM_PLAYERS as B on A.playerID=B.id " + - "where uID='GameA' and A.teamID='TeamA';", client).read; + return adHocQuery('select A.*, ' + + 'B.name as name, ' + + 'B.avatar as avatar ' + + 'from PLAYERS as A left join TEAM_PLAYERS as B on A.playerID=B.id ' + + 'where uID=\'GameA\' and A.teamID=\'TeamA\';', client).read; }) .then(function(value){ - debug("Result Count: %O", value.results.table.length); - debug("Row Count: %O", value.results.table[0].data.length); - debug("Results: %O", value.results.table[0].data); + debug('Result Count: %O', value.results.table.length); + debug('Row Count: %O', value.results.table[0].data.length); + debug('Results: %O', value.results.table[0].data); client.exit(); const table = value.results.table[0]; - test.equals(table.data.length,1, "Should return one row"); - test.equals(table.data[0].NAME,"TeamA", "Name should be TeamA"); - test.equals(table.data[0].TEAMID,"TeamA", "TeamId should be TeamA"); - test.equals(table.data[0].PLAYERID,0, "PlayerId should be TeamA"); + test.equals(table.data.length,1, 'Should return one row'); + test.equals(table.data[0].NAME,'TeamA', 'Name should be TeamA'); + test.equals(table.data[0].TEAMID,'TeamA', 'TeamId should be TeamA'); + test.equals(table.data[0].PLAYERID,0, 'PlayerId should be TeamA'); test.done(); return Promise.resolve(null); }) .catch(function(value){ - debug("Test Failed | Results: %O", value); + debug('Test Failed | Results: %O', value); client.exit(); - test.ok(false, "Test failed, see previous messages"); + test.ok(false, 'Test failed, see previous messages'); test.done(); }); } diff --git a/test/cases/clientaffinity.js b/test/cases/clientaffinity.js index 3999bac..21544d5 100644 --- a/test/cases/clientaffinity.js +++ b/test/cases/clientaffinity.js @@ -1,12 +1,12 @@ !(function (global) { // eslint-disable-line no-unused-vars - "use strict"; + 'use strict'; - const VoltClient = require("../../lib/client"); + const VoltClient = require('../../lib/client'); - require("nodeunit"); - const testContext = require("../util/test-context"); - const debug = console.log; //require("debug")("voltdb-client-nodejs:BufferTest"); + require('nodeunit'); + const testContext = require('../util/test-context'); + const debug = require('debug')('voltdb-client-nodejs:ClientAffinityTest'); //Setup context testContext.setup(); @@ -15,7 +15,7 @@ * A "good" client config that points to a volt instance on localhost */ function configs() { - return require("../config"); + return require('../config'); } function waitForHashinator(client){ @@ -48,39 +48,39 @@ //Cases for 8 partitions const cases = [ - { value: "b", type: "string", expected: "1" }, - { value: "d", type: "string", expected: "2" }, - { value: "j", type: "string", expected: "3" }, - { value: "g", type: "string", expected: "0" }, - { value: "i", type: "string", expected: "5" }, - { value: "w", type: "string", expected: "6" }, - { value: "f", type: "string", expected: "16" }, - { value: "test", type: "string", expected: "26" }, + { value: 'b', type: 'string', expected: '1' }, + { value: 'd', type: 'string', expected: '2' }, + { value: 'j', type: 'string', expected: '3' }, + { value: 'g', type: 'string', expected: '0' }, + { value: 'i', type: 'string', expected: '5' }, + { value: 'w', type: 'string', expected: '6' }, + { value: 'f', type: 'string', expected: '16' }, + { value: 'test', type: 'string', expected: '26' }, - { value: 7, type: "int", expected: "0" }, - { value: -2, type: "int", expected: "1" }, - { value: -1, type: "int", expected: "2" }, - { value: -4, type: "int", expected: "3" }, - { value: 0, type: "int", expected: "5" }, - { value: 2, type: "int", expected: "6" }, - { value: 11, type: "int", expected: "16" }, - { value: 1, type: "int", expected: "26" }, + { value: 7, type: 'int', expected: '0' }, + { value: -2, type: 'int', expected: '1' }, + { value: -1, type: 'int', expected: '2' }, + { value: -4, type: 'int', expected: '3' }, + { value: 0, type: 'int', expected: '5' }, + { value: 2, type: 'int', expected: '6' }, + { value: 11, type: 'int', expected: '16' }, + { value: 1, type: 'int', expected: '26' }, - { value: Buffer.from([0x05]), type: "varbinary", expected: "0" }, - { value: Buffer.from([0x01]), type: "varbinary", expected: "1" }, - { value: Buffer.from([0x00]), type: "varbinary", expected: "2" }, - { value: Buffer.from([0x0C]), type: "varbinary", expected: "3" }, - { value: Buffer.from([0x06]), type: "varbinary", expected: "5" }, - { value: Buffer.from([0x04]), type: "varbinary", expected: "6" }, - { value: Buffer.from([0X0B]), type: "varbinary", expected: "16" }, - { value: Buffer.from([0x0E]), type: "varbinary", expected: "26" }, + { value: Buffer.from([0x05]), type: 'varbinary', expected: '0' }, + { value: Buffer.from([0x01]), type: 'varbinary', expected: '1' }, + { value: Buffer.from([0x00]), type: 'varbinary', expected: '2' }, + { value: Buffer.from([0x0C]), type: 'varbinary', expected: '3' }, + { value: Buffer.from([0x06]), type: 'varbinary', expected: '5' }, + { value: Buffer.from([0x04]), type: 'varbinary', expected: '6' }, + { value: Buffer.from([0X0B]), type: 'varbinary', expected: '16' }, + { value: Buffer.from([0x0E]), type: 'varbinary', expected: '26' }, ]; - debug("getPartitionForValue"); + debug('getPartitionForValue'); test.expect(cases.length); const client = new VoltClient(configs()); - debug("Connecting"); + debug('Connecting'); return client.connect() .then( () => waitForHashinator(client) ) @@ -97,9 +97,9 @@ }) .catch(function(value){ //debug("Test Failed | Results: %O", value); - console.error(value); + debug(value); client.exit(); - test.ok(false, "Test failed, see previous messages"); + test.ok(false, 'Test failed, see previous messages'); test.done(); }); } diff --git a/test/cases/connections.js b/test/cases/connections.js index 316897d..69bc91d 100644 --- a/test/cases/connections.js +++ b/test/cases/connections.js @@ -21,31 +21,31 @@ * OTHER DEALINGS IN THE SOFTWARE. */ -const VoltClient = require("../../lib/client"); -const VoltConfiguration = require("../../lib/configuration"); -const VoltConstants = require("../../lib/voltconstants"); +const VoltClient = require('../../lib/client'); +const VoltConfiguration = require('../../lib/configuration'); +const VoltConstants = require('../../lib/voltconstants'); -require("nodeunit"); +require('nodeunit'); -const testContext = require("../util/test-context"); -const debug = console.log; //require("debug")("voltdb-client-nodejs:ConnectionsTest"); +const testContext = require('../util/test-context'); +const debug = require('debug')('voltdb-client-nodejs:ConnectionsTest'); // Setup context testContext.setup(); function goodConfig() { - return require("../config"); + return require('../config'); } function badConfig() { - debug("using badConfig"); + debug('using badConfig'); const configs = []; let config = new VoltConfiguration(); - config.host = "idontexists"; + config.host = 'idontexists'; config.port = testContext.port(); - config.password = "12345"; - config.user = "operator"; + config.password = '12345'; + config.user = 'operator'; config.reconnectInterval = 0; //No reconnects configs.push(config); @@ -59,9 +59,9 @@ function badConfig() { } function badAuthConfig(){ - debug("using badAuthConfig"); + debug('using badAuthConfig'); var config = Object.assign({},goodConfig()[0]); - config.password = "12345"; + config.password = '12345'; config.reconnectInterval = 0; //No reconnects return [config]; @@ -70,15 +70,15 @@ function badAuthConfig(){ const disconnect = client => { client._connections.forEach( con => { if ( con.validConnection ){ - console.log("Closing connection to " + con.config.host + ":" + con.config.port); + debug('Closing connection to ' + con.config.host + ':' + con.config.port); con.socket.end(); } }); - const call = client.adHoc("select * from query_will_never_get_to_the_db;"); + const call = client.adHoc('select * from query_will_never_get_to_the_db;'); call.read.then( response => { - console.log("Query Response", response); + debug('Query Response', response); }); return call.onQueryAllowed; @@ -91,10 +91,10 @@ const waitForReconnect = (client, retries, interval) => new Promise( resolve => const resolved = client.isConnected(); iteration++; - debug("Reconnected yet?", resolved); + debug('Reconnected yet?', resolved); if ( resolved || iteration === retries ) { - debug("So is connected?", resolved); + debug('So is connected?', resolved); clearInterval(handle); resolve(resolved); } @@ -104,76 +104,76 @@ const waitForReconnect = (client, retries, interval) => new Promise( resolve => exports.connections = { setUp : function(callback) { - debug("connections setup called"); + debug('connections setup called'); callback(); }, tearDown : function(callback) { - debug("connections teardown called"); + debug('connections teardown called'); callback(); }, - "Bad connection results" : function(test) { - debug("running bad connection test"); + 'Bad connection results' : function(test) { + debug('running bad connection test'); const config = badConfig(); var client = new VoltClient(config); client.connect().then ( ({ connected, errors }) => { - debug("bad connection test "); + debug('bad connection test '); test.expect(3); test.ok(!connected); - test.equals(errors[0], VoltConstants.LOGIN_STATUS.HOST_UNKNOWN, "Login Error 0 should be host unknown"); - test.equals(errors[1], VoltConstants.LOGIN_STATUS.CONNECTION_REFUSED, "Login Error 0 should be connection refused"); + test.equals(errors[0], VoltConstants.LOGIN_STATUS.HOST_UNKNOWN, 'Login Error 0 should be host unknown'); + test.equals(errors[1], VoltConstants.LOGIN_STATUS.CONNECTION_REFUSED, 'Login Error 0 should be connection refused'); client.exit(); test.done(); }).catch( error => { - console.error("BadConnectionError: ", error); + debug('BadConnectionError: ', error); }); }, - "Good connection results" : function(test) { - debug("running good connection test"); + 'Good connection results' : function(test) { + debug('running good connection test'); const client = new VoltClient(goodConfig()); client.connect().then ( connected => { test.expect(1); - test.ok(connected, "Should have been able to connect, is Volt running on localhost?"); + test.ok(connected, 'Should have been able to connect, is Volt running on localhost?'); client.exit(); test.done(); }); - },"Mixed connection results" : function(test) { - debug("running mixed connection test"); + },'Mixed connection results' : function(test) { + debug('running mixed connection test'); const mixedConfig = goodConfig().concat(badConfig()); var client = new VoltClient(mixedConfig); client.connect().then ( ({ connected, errors }) => { test.expect(6); - test.ok(connected, "Should have been able to connect, is Volt running on localhost?"); - test.equals(client._connections.length,1, "Should have one good connection"); - test.equals(client._badConnections.length, 2, "Should have one bad connection"); - test.equals(errors[0], null, "Login Error 0 should be null"); - test.equals(errors[1], VoltConstants.LOGIN_STATUS.HOST_UNKNOWN, "Login Error 0 should be host unknown"); - test.equals(errors[2], VoltConstants.LOGIN_STATUS.CONNECTION_REFUSED, "Login Error 0 should be connection refused"); + test.ok(connected, 'Should have been able to connect, is Volt running on localhost?'); + test.equals(client._connections.length,1, 'Should have one good connection'); + test.equals(client._badConnections.length, 2, 'Should have one bad connection'); + test.equals(errors[0], null, 'Login Error 0 should be null'); + test.equals(errors[1], VoltConstants.LOGIN_STATUS.HOST_UNKNOWN, 'Login Error 0 should be host unknown'); + test.equals(errors[2], VoltConstants.LOGIN_STATUS.CONNECTION_REFUSED, 'Login Error 0 should be connection refused'); client.exit(); test.done(); }); - },"Bad Auth connection results" : function(test) { - debug("running bad auth connection test"); + },'Bad Auth connection results' : function(test) { + debug('running bad auth connection test'); var client = new VoltClient(badAuthConfig()); client.connect().then ( ({ connected, errors }) => { - debug("bad auth connection test "); + debug('bad auth connection test '); test.expect(2); test.ok(!connected); - test.equals(errors[0], VoltConstants.LOGIN_STATUS.AUTHENTICATION_ERROR, "Login Error 0 should be authentication error"); + test.equals(errors[0], VoltConstants.LOGIN_STATUS.AUTHENTICATION_ERROR, 'Login Error 0 should be authentication error'); client.exit(); test.done(); }); - }, "Reconnect results" : function(test) { - debug("Reconnect connection test"); + }, 'Reconnect results' : function(test) { + debug('Reconnect connection test'); const configs = goodConfig(); configs[0].reconnectInterval = 5 * 1000; //5s to really see it; @@ -184,10 +184,10 @@ exports.connections = { .then( () => disconnect(client) ) .then( () => waitForReconnect(client, 20, 1000)) .then( connected => { - console.log(" Client Connected: ", client.isConnected()); + debug(' Client Connected: ', client.isConnected()); test.expect(1); - test.ok(connected, "Should have been able to connect, is Volt running on localhost?"); + test.ok(connected, 'Should have been able to connect, is Volt running on localhost?'); test.done(); client.exit(); }); diff --git a/test/cases/typestest.js b/test/cases/typestest.js index 30d8321..80a5525 100644 --- a/test/cases/typestest.js +++ b/test/cases/typestest.js @@ -24,13 +24,13 @@ // TODO: Remove a lot of the console/util logging statements being used for // debugging purposes. -var VoltClient = require("../../lib/client"); -var VoltProcedure = require("../../lib/query"); -const debug = console.log; //require("debug")("voltdb-client-nodejs:TypeTest"); +var VoltClient = require('../../lib/client'); +var VoltProcedure = require('../../lib/query'); +const debug = require('debug')('voltdb-client-nodejs:TypeTest'); -var util = require("util"); -const testContext = require("../util/test-context"); -require("nodeunit"); +var util = require('util'); +const testContext = require('../util/test-context'); +require('nodeunit'); //Setup context testContext.setup(); @@ -38,10 +38,10 @@ testContext.setup(); var client = null; function config() { - return require("../config"); + return require('../config'); } -const dropTableSQL = "drop table typetest if exists;"; +const dropTableSQL = 'drop table typetest if exists;'; const createTableSQL =`CREATE TABLE typetest( test_id integer NOT NULL, test_tiny tinyint NOT NULL, @@ -55,10 +55,10 @@ const createTableSQL =`CREATE TABLE typetest( test_timestamp timestamp NOT NULL, PRIMARY KEY (test_id) );`; -const partitionTableSQL = "PARTITION TABLE typetest ON COLUMN test_id;"; +const partitionTableSQL = 'PARTITION TABLE typetest ON COLUMN test_id;'; function syncQuery(queryString){ - debug("Query | query: ", queryString); + debug('Query | query: ', queryString); return client.adHoc(queryString).read.then( function read(response){ if ( response.code ) { throw new Error(response.results.statusString); @@ -73,22 +73,22 @@ const TIMESTAMP_VALUE = new Date(1331310436605); exports.typetest = { setUp : function(callback) { - debug("typetest setup called"); + debug('typetest setup called'); client = new VoltClient(config()); client.connect().then(function startup() { - if ( !client.isConnected() ) throw Error("Client not connected"); + if ( !client.isConnected() ) throw Error('Client not connected'); callback(); }); }, tearDown : function(callback) { if ( client ) { - debug("typetest teardown called"); + debug('typetest teardown called'); client.exit(); callback(); } }, - "Init test" : function(test) { - debug("init test"); + 'Init test' : function(test) { + debug('init test'); test.expect(1); return syncQuery(dropTableSQL) @@ -96,47 +96,47 @@ exports.typetest = { .then (() => syncQuery(partitionTableSQL)) .then( () => { //Using TYPETEST.insert instead of JavaStoredProcedure to skip the Java Source Compiling and Loading - const args = [0,1,2,3,4,5.1,6.000342,"seven",VAR_BINARY_VALUE,TIMESTAMP_VALUE.getTime()]; - const signature = ["integer","tinyint","smallint","integer","bigint","float","decimal","string","varbinary","timestamp"]; - const initProc = new VoltProcedure("TYPETEST.insert", signature); + const args = [0,1,2,3,4,5.1,6.000342,'seven',VAR_BINARY_VALUE,TIMESTAMP_VALUE.getTime()]; + const signature = ['integer','tinyint','smallint','integer','bigint','float','decimal','string','varbinary','timestamp']; + const initProc = new VoltProcedure('TYPETEST.insert', signature); const query = initProc.getQuery(); query.setParameters(args); client.callProcedure(query).read.then( ({ results }) => { - debug("\nInit Test results %o", results); - test.equals(results.status, 1 , "did I get called"); + debug('\nInit Test results %o', results); + test.equals(results.status, 1 , 'did I get called'); test.done(); }); - }).catch(console.error); + }).catch( debug ); }, - "select test" : function(test) { - debug("select test"); + 'select test' : function(test) { + debug('select test'); test.expect(12); - var initProc = new VoltProcedure("TYPETEST.select", ["int"]); + var initProc = new VoltProcedure('TYPETEST.select', ['int']); var query = initProc.getQuery(); query.setParameters([0]); const call = client.callProcedure(query); call.read.then( function read({ results }) { - debug("Select test results:", results); - debug("results inspection: %o", results.table[0].data[0].TEST_TIMESTAMP); - debug("inspect %s", util.inspect(results.table[0].data[0])); - - test.equals(results.status, 1, "Invalid status: " + results.status + "should be 1"); - test.equals(results.table[0].data.length, 1, "Row count should be 1"); - test.equals(results.table[0].data[0].TEST_ID, 0, "Wrong row ID, should be 0"); - test.equals(results.table[0].data[0].TEST_TINY, 1, "Wrong tiny, should be 1"); - test.equals(results.table[0].data[0].TEST_SMALL, 2, "Wrong small, should be 2"); - test.equals(results.table[0].data[0].TEST_INTEGER, 3, "Wrong integer, should be 3"); - test.equals(results.table[0].data[0].TEST_BIG, 4, "Wrong integer, should be 4"); - test.equals(results.table[0].data[0].TEST_FLOAT, 5.1, "Wrong float, should be 5.1"); - test.equals(results.table[0].data[0].TEST_DECIMAL, 6.000342, "Wrong decimal, should be 6.000342"); - test.equals(results.table[0].data[0].TEST_VARCHAR, "seven", "Wrong varchar, should be seven"); - test.ok(results.table[0].data[0].TEST_VARBINARY.equals(VAR_BINARY_VALUE), "Wrong varbinary, should be " + VAR_BINARY_VALUE); - test.equals(results.table[0].data[0].TEST_TIMESTAMP.getTime(), TIMESTAMP_VALUE.getTime(), TIMESTAMP_VALUE.toString() + ": " + results.table[0].data[0].TEST_TIMESTAMP); + debug('Select test results:', results); + debug('results inspection: %o', results.table[0].data[0].TEST_TIMESTAMP); + debug('inspect %s', util.inspect(results.table[0].data[0])); + + test.equals(results.status, 1, 'Invalid status: ' + results.status + 'should be 1'); + test.equals(results.table[0].data.length, 1, 'Row count should be 1'); + test.equals(results.table[0].data[0].TEST_ID, 0, 'Wrong row ID, should be 0'); + test.equals(results.table[0].data[0].TEST_TINY, 1, 'Wrong tiny, should be 1'); + test.equals(results.table[0].data[0].TEST_SMALL, 2, 'Wrong small, should be 2'); + test.equals(results.table[0].data[0].TEST_INTEGER, 3, 'Wrong integer, should be 3'); + test.equals(results.table[0].data[0].TEST_BIG, 4, 'Wrong integer, should be 4'); + test.equals(results.table[0].data[0].TEST_FLOAT, 5.1, 'Wrong float, should be 5.1'); + test.equals(results.table[0].data[0].TEST_DECIMAL, 6.000342, 'Wrong decimal, should be 6.000342'); + test.equals(results.table[0].data[0].TEST_VARCHAR, 'seven', 'Wrong varchar, should be seven'); + test.ok(results.table[0].data[0].TEST_VARBINARY.equals(VAR_BINARY_VALUE), 'Wrong varbinary, should be ' + VAR_BINARY_VALUE); + test.equals(results.table[0].data[0].TEST_TIMESTAMP.getTime(), TIMESTAMP_VALUE.getTime(), TIMESTAMP_VALUE.toString() + ': ' + results.table[0].data[0].TEST_TIMESTAMP); test.done(); }); diff --git a/test/cases/updateClassesTest.js b/test/cases/updateClassesTest.js index 1b33c60..8d2005f 100644 --- a/test/cases/updateClassesTest.js +++ b/test/cases/updateClassesTest.js @@ -21,29 +21,26 @@ * OTHER DEALINGS IN THE SOFTWARE. */ -const VoltClient = require("../../lib/client"); -const debug = require("debug")("voltdb-client-nodejs:TypeTest"); +const VoltClient = require('../../lib/client'); +const debug = require('debug')('voltdb-client-nodejs:Update Classes Test'); -const testContext = require("../util/test-context"); +const testContext = require('../util/test-context'); testContext.setup(); -require("nodeunit"); -const config = require("../config"); - -//Setup context - +require('nodeunit'); +const config = require('../config'); const client = new VoltClient(config); -const procName = "VoltTableTest"; -const className = "com.voltdb.test.volttable.proc.VoltTableTest"; -const jarPath = __dirname + "/../../tools/testdb/typetest.jar"; +const procName = 'VoltTableTest'; +const className = 'com.voltdb.test.volttable.proc.VoltTableTest'; +const jarPath = __dirname + '/../../tools/testdb/typetest.jar'; const dropProc = `drop procedure ${procName} if exists;`; const createProc = `create procedure from class ${className};`; function syncQuery(queryString){ - console.log("Query | query: ", queryString); + debug('Query | query: ', queryString); return () => client.adHoc(queryString).read.then( function read(response){ if ( response.code ) { @@ -57,49 +54,49 @@ function syncQuery(queryString){ exports.updateClasses = { setUp : function(callback) { client.connect().then(function startup() { - if ( !client.isConnected() ) throw Error("Client not connected"); + if ( !client.isConnected() ) throw Error('Client not connected'); callback(); }); }, tearDown : function(callback) { if ( client ) { - debug("typetest teardown called"); + debug('typetest teardown called'); client.exit(); callback(); } }, - "UpdateClasses remove" : function(test) { + 'UpdateClasses remove' : function(test) { test.expect(2); - console.log("UpdateClasses(null,'" + className + "')"); + debug('UpdateClasses(null,\'' + className + '\')'); return syncQuery(dropProc)() .then( () => client.updateClasses(null, className).read ) .then( response => { - test.equals(response.results.status,1, "Command should succeed"); + test.equals(response.results.status,1, 'Command should succeed'); return syncQuery(createProc)(); }) .then( response => { - test.equals(response.results.status, -2, "Command should not succeed"); + test.equals(response.results.status, -2, 'Command should not succeed'); test.done(); - }).catch(console.error); + }).catch(debug); }, - "UpdateClasses load" : function(test) { + 'UpdateClasses load' : function(test) { test.expect(2); - console.log(`UpdateClasses('${jarPath}', null)`); + debug(`UpdateClasses('${jarPath}', null)`); return client.updateClasses(jarPath).read.then( response => { - console.log(response.code, response.results.statusString); - test.equals(response.results.status, 1, "Command should succeed"); + debug(response.code, response.results.statusString); + test.equals(response.results.status, 1, 'Command should succeed'); return syncQuery(createProc)(); }).then( response => { - console.log(response.code, response.results.statusString); - test.equals(response.results.status, 1, "Command should succeed"); + debug(response.code, response.results.statusString); + test.equals(response.results.status, 1, 'Command should succeed'); test.done(); - }).catch(console.error); + }).catch(debug); } -}; +}; \ No newline at end of file diff --git a/test/cases/volttableTest.js b/test/cases/volttableTest.js index de16056..5185e22 100644 --- a/test/cases/volttableTest.js +++ b/test/cases/volttableTest.js @@ -21,28 +21,28 @@ * OTHER DEALINGS IN THE SOFTWARE. */ -const VoltClient = require("../../lib/client"); -const VoltProcedure = require("../../lib/query"); -const debug = require("debug")("voltdb-client-nodejs:TypeTest"); -const VoltTable = require("../../lib/volttable"); +const VoltClient = require('../../lib/client'); +const VoltProcedure = require('../../lib/query'); +const debug = require('debug')('voltdb-client-nodejs:TypeTest'); +const VoltTable = require('../../lib/volttable'); -const testContext = require("../util/test-context"); +const testContext = require('../util/test-context'); testContext.setup(); -require("nodeunit"); -const config = require("../config"); +require('nodeunit'); +const config = require('../config'); //Setup context const client = new VoltClient(config); -const TIMESTAMP_VALUE = new Date("2002/07/25"); +const TIMESTAMP_VALUE = new Date('2002/07/25'); -const className = "com.voltdb.test.volttable.proc.VoltTableTest"; -const jarPath = __dirname + "/../../tools/testdb/typetest.jar"; +const className = 'com.voltdb.test.volttable.proc.VoltTableTest'; +const jarPath = __dirname + '/../../tools/testdb/typetest.jar'; const createProc = `create procedure from class ${className};`; const dropProc = `drop procedure ${className} if exists;`; -const dropTable = "drop table typetest if exists;"; +const dropTable = 'drop table typetest if exists;'; const createTable =`CREATE TABLE typetest( test_id integer NOT NULL, test_tiny tinyint NOT NULL, @@ -56,24 +56,24 @@ const createTable =`CREATE TABLE typetest( test_timestamp timestamp NOT NULL, PRIMARY KEY (test_id) );`; -const partitionTable = "PARTITION TABLE typetest ON COLUMN test_id;"; -const selectData = "select * from typetest;"; +const partitionTable = 'PARTITION TABLE typetest ON COLUMN test_id;'; +const selectData = 'select * from typetest;'; function getTypeTestVoltTable(){ const vt = new VoltTable(); - vt.addColumn("test_id","integer"); //2 - vt.addColumn("test_tiny","tinyint"); //3 - vt.addColumn("test_small","smallint"); //4 - vt.addColumn("test_integer","integer"); //5 - vt.addColumn("test_big","bigint"); //6 - vt.addColumn("test_float","float"); //7.7 - vt.addColumn("test_decimal","decimal"); //8.000008 - vt.addColumn("test_varchar","string"); //"nine" - vt.addColumn("test_varbinary","varbinary"); //"0A" = [10] - vt.addColumn("test_timestamp","timestamp"); //1902/07/25 - - vt.addRow(2,3,4,5,6,7.7,8.000008, "nine", new Buffer([10]), TIMESTAMP_VALUE); + vt.addColumn('test_id','integer'); //2 + vt.addColumn('test_tiny','tinyint'); //3 + vt.addColumn('test_small','smallint'); //4 + vt.addColumn('test_integer','integer'); //5 + vt.addColumn('test_big','bigint'); //6 + vt.addColumn('test_float','float'); //7.7 + vt.addColumn('test_decimal','decimal'); //8.000008 + vt.addColumn('test_varchar','string'); //"nine" + vt.addColumn('test_varbinary','varbinary'); //"0A" = [10] + vt.addColumn('test_timestamp','timestamp'); //1902/07/25 + + vt.addRow(2,3,4,5,6,7.7,8.000008, 'nine', new Buffer([10]), TIMESTAMP_VALUE); return vt; } @@ -93,14 +93,14 @@ function syncExec(procedure, signature, args){ } function syncQuery(queryString){ - console.log("Query | query: ", queryString); + debug('Query | query: ', queryString); return () => client.adHoc(queryString).read.then( function read(response){ if ( response.code ) { throw new Error(response.results.statusString); } - console.log(response.results.statusString); + debug(response.results.statusString); return response; }); @@ -109,21 +109,21 @@ function syncQuery(queryString){ exports.volttableTest = { setUp : function(callback) { client.connect().then(function startup() { - if ( !client.isConnected() ) throw Error("Client not connected"); + if ( !client.isConnected() ) throw Error('Client not connected'); callback(); }); }, tearDown : function(callback) { if ( client ) { - debug("typetest teardown called"); + debug('typetest teardown called'); client.exit(); callback(); } }, - "Init" : function(test){ + 'Init' : function(test){ test.expect(1); - console.log(`UpdateClasses('${jarPath}', null)`); + debug(`UpdateClasses('${jarPath}', null)`); return client.updateClasses(jarPath).read .then( syncQuery(dropProc) ) .then( syncQuery(dropTable) ) @@ -134,16 +134,16 @@ exports.volttableTest = { test.ok(true); test.done(); }) - .catch(console.error); + .catch(debug); }, - "VoltTable" : function(test) { + 'VoltTable' : function(test) { const volttable = getTypeTestVoltTable(); - syncExec("VoltTableTest",["volttable"],[volttable])() + syncExec('VoltTableTest',['volttable'],[volttable])() .then(({ code, results })=> { - console.log(results.statusString); + debug(results.statusString); - test.equals(code, null, "Should not be an error code"); - test.equals(results.status, 1, "Status code should be SUCCESS"); + test.equals(code, null, 'Should not be an error code'); + test.equals(results.status, 1, 'Status code should be SUCCESS'); return null; }) @@ -151,15 +151,15 @@ exports.volttableTest = { .then( response => { const loadedVolttable = response.results.table[0]; - console.log("Inserted", volttable.data ); - console.log("Selected", loadedVolttable.data ); + debug('Inserted', volttable.data ); + debug('Selected', loadedVolttable.data ); - test.ok(volttable.equals(loadedVolttable), "Inserted VoltTable should be the same that the one selected"); + test.ok(volttable.equals(loadedVolttable), 'Inserted VoltTable should be the same that the one selected'); test.done(); }) /* */ - .catch(console.error); + .catch(debug); } }; diff --git a/test/config.js b/test/config.js index f9d5081..8207a76 100644 --- a/test/config.js +++ b/test/config.js @@ -1,13 +1,13 @@ const configs = []; -const VoltConfiguration = require("../lib/configuration"); -const testContext = require("./util/test-context"); +const VoltConfiguration = require('../lib/configuration'); +const testContext = require('./util/test-context'); let config = null; config = new VoltConfiguration(); -config.host = "192.168.0.51"; -config.username = "operator"; -config.password = "mech"; -config.hashAlgorithm = "sha1"; +config.host = 'localhost'; +//config.username = 'operator'; +//config.password = 'mech'; +config.hashAlgorithm = 'sha1'; config.port = testContext.port(); configs.push(config); diff --git a/test/testrunner.js b/test/testrunner.js index 5cb60d9..077a7f9 100644 --- a/test/testrunner.js +++ b/test/testrunner.js @@ -21,12 +21,12 @@ * OTHER DEALINGS IN THE SOFTWARE. */ -var nodeunit = require("nodeunit"); -var fs = require("fs"); -require("child_process"); -const path = require("path"); +var nodeunit = require('nodeunit'); +var fs = require('fs'); +require('child_process'); +const path = require('path'); -const testCasesDirectory = path.resolve(__dirname, "cases"); +const testCasesDirectory = path.resolve(__dirname, 'cases'); var TestRunner = function() { this.testDirectories = [testCasesDirectory]; @@ -44,14 +44,14 @@ tr.loadTests = function() { for(let inner = 0; inner < cases.length; inner++) { if ( testName && cases[inner] !== `${testName}.js` ) continue; - this.fileList = this.fileList.concat(this.testDirectories[index] + "/" + cases[inner]); + this.fileList = this.fileList.concat(this.testDirectories[index] + '/' + cases[inner]); } } }; tr.run = function() { if (this.fileList.length === 0) { - console.error(`Test ${process.argv[TEST_NAME]} not found`); + process.stderr.write(`Test ${process.argv[TEST_NAME]} not found \n`); process.exit(1); } diff --git a/test/util/docker-util.js b/test/util/docker-util.js index 6d569a6..93dd1c3 100644 --- a/test/util/docker-util.js +++ b/test/util/docker-util.js @@ -1,10 +1,10 @@ !(function(global) { // eslint-disable-line no-unused-vars - "use strict"; + 'use strict'; - const childProcess = require("child_process"); - const debug = require("debug")("voltdb-client-nodejs:DockerUtil"); - const os = require("os"); + const childProcess = require('child_process'); + const debug = require('debug')('voltdb-client-nodejs:DockerUtil'); + const os = require('os'); /* * TODO: Should eventually go in VoltConstants. @@ -27,26 +27,26 @@ /* * "docker port node1 21212" will return something like this "0.0.0.0:33164". Just parse out the port at the end. */ - const command = "docker"; - const args = ["port", containerName, VOLT_CLIENT_PORT]; + const command = 'docker'; + const args = ['port', containerName, VOLT_CLIENT_PORT]; const dockerPortResponse = childProcess.spawnSync(command, args); if(dockerPortResponse.status !== 0){ // Failure, log a warning and just fall through, returning the default port - console.warn(`Docker port query failure | Will return default port '${VOLT_CLIENT_PORT}'. \ + debug(`Docker port query failure | Will return default port '${VOLT_CLIENT_PORT}'. \ Docker port query for container '${containerName}' and port '${VOLT_CLIENT_PORT}' failed, error was:${os.EOL} ${dockerPortResponse.stderr.toString()}`); } else{ // Success const dockerPortResponseString = dockerPortResponse.stdout.toString(); - const dockerPortResponseArray = dockerPortResponseString.replace("\n", "").replace("\r", "").split(":"); + const dockerPortResponseArray = dockerPortResponseString.replace('\n', '').replace('\r', '').split(':'); if(dockerPortResponseArray.length === 2){ - debug("Container Found | Name: %o, Client Port: %o, Exposed Client Port: %o ", containerName, VOLT_CLIENT_PORT, clientPort); + debug('Container Found | Name: %o, Client Port: %o, Exposed Client Port: %o ', containerName, VOLT_CLIENT_PORT, clientPort); clientPort = parseInt(dockerPortResponseArray[1]); } else{ // Failure, log a warning and just fall through, returning the default port - console.warn(`Docker port query failure | Will return default port '${VOLT_CLIENT_PORT}'. + debug(`Docker port query failure | Will return default port '${VOLT_CLIENT_PORT}'. Docker port query for container '${containerName}' and port '${VOLT_CLIENT_PORT}' returned unrecognised response, response was:${os.EOL} ${dockerPortResponseString}`); } diff --git a/test/util/test-context.js b/test/util/test-context.js index 756cafb..d7939d4 100644 --- a/test/util/test-context.js +++ b/test/util/test-context.js @@ -6,12 +6,12 @@ */ !(function(global) { // eslint-disable-line no-unused-vars - "use strict"; + 'use strict'; - const yargs = require("yargs"); - const dockerUtil = require("../util/docker-util"); + const yargs = require('yargs'); + const dockerUtil = require('../util/docker-util'); - const VOLT_CONTAINER_NAME = "node1"; + const VOLT_CONTAINER_NAME = 'node1'; // TODO: Should eventually go in VoltConstants. const VOLT_CLIENT_PORT = 21212; @@ -27,11 +27,11 @@ function _setup(){ var argv = yargs - .usage("$0 -i instance [testname]") - .alias("i", "instance") - .demandOption(["i"]) - .describe("i", "Specify the type of VoltDB instance the tests will be run against. " + - "Can be a local instance [local] or a local instance running in a Docker container [docker]") + .usage('$0 -i instance [testname]') + .alias('i', 'instance') + .demandOption(['i']) + .describe('i', 'Specify the type of VoltDB instance the tests will be run against. ' + + 'Can be a local instance [local] or a local instance running in a Docker container [docker]') .argv; config.instance = argv.instance; @@ -46,10 +46,10 @@ var voltPort = -1; - if(config.instance === "local"){ + if(config.instance === 'local'){ voltPort = VOLT_CLIENT_PORT; } - else if(config.instance === "docker"){ + else if(config.instance === 'docker'){ voltPort = dockerUtil.getExposedVoltPort(VOLT_CONTAINER_NAME); } else{ diff --git a/voternoui.js b/voternoui.js index 9d22bcc..785225b 100644 --- a/voternoui.js +++ b/voternoui.js @@ -25,22 +25,22 @@ * OTHER DEALINGS IN THE SOFTWARE. */ -var cli = require("cli"); -require ("cluster"); -var VoltClient = require("./lib/client"); -var VoltConfiguration = require("./lib/configuration"); -var VoltProcedure = require("./lib/query"); +var cli = require('cli'); +require ('cluster'); +var VoltClient = require('./lib/client'); +var VoltConfiguration = require('./lib/configuration'); +var VoltProcedure = require('./lib/query'); -var util = require("util"); +var util = require('util'); var client = null; -var resultsProc = new VoltProcedure("Results"); -var initProc = new VoltProcedure("Initialize", ["int", "string"]); -var voteProc = new VoltProcedure("Vote", ["long", "int", "long"]); +var resultsProc = new VoltProcedure('Results'); +var initProc = new VoltProcedure('Initialize', ['int', 'string']); +var voteProc = new VoltProcedure('Vote', ['long', 'int', 'long']); var options = cli.parse({ - voteCount : ["c", "Number of votes to run", "number", 10000], - clusterNode0 : ["h", "VoltDB host (one of the cluster)", "string", "localhost"] + voteCount : ['c', 'Number of votes to run', 'number', 10000], + clusterNode0 : ['h', 'VoltDB host (one of the cluster)', 'string', 'localhost'] }); var area_codes = [907, 205, 256, 334, 251, 870, 501, 479, 480, 602, 623, 928, @@ -64,9 +64,9 @@ var area_codes = [907, 205, 256, 334, 251, 870, 501, 479, 480, 602, 623, 928, 936, 409, 972, 469, 214, 682, 832, 281, 830, 956, 432, 915, 435, 801, 385, 434, 804, 757, 703, 571, 276, 236, 540, 802, 509, 360, 564, 206, 425, 253, 715, 920, 262, 414, 608, 304, 307]; -var voteCandidates = "Edwina Burnam,Tabatha Gehling,Kelly Clauss," + -"Jessie Alloway,Alana Bregman,Jessie Eichman,Allie Rogalski,Nita Coster," + -"Kurt Walser,Ericka Dieter,Loraine NygrenTania Mattioli"; +var voteCandidates = 'Edwina Burnam,Tabatha Gehling,Kelly Clauss,' + +'Jessie Alloway,Alana Bregman,Jessie Eichman,Allie Rogalski,Nita Coster,' + +'Kurt Walser,Ericka Dieter,Loraine NygrenTania Mattioli'; function main() { @@ -74,7 +74,7 @@ function main() { var clusterNodes = [options.clusterNode0]; var configs = []; for ( var index = 0; index < clusterNodes.length; index++ ) { - console.log("Host: " + clusterNodes[index]); + console.log('Host: ' + clusterNodes[index]); var vc = new VoltConfiguration(); vc.host = clusterNodes[index]; configs.push(vc); @@ -82,21 +82,21 @@ function main() { client = new VoltClient(configs); client.connect(function startup(results) { - console.log("Node up"); + console.log('Node up'); voltInit(); }, function loginError(results) { - console.log("Error logging in: " + results); + console.log('Error logging in: ' + results); }); } function voltInit() { - console.log("voltInit"); + console.log('voltInit'); var query = initProc.getQuery(); query.setParameters([6, voteCandidates]); client.callProcedure(query, function initVoter(event, code, results) { if ( results.error == false ) { var val = results.table[0][0]; - console.log( "Initialized app for " + val[""] + " candidates.\n\n"); + console.log( 'Initialized app for ' + val[''] + ' candidates.\n\n'); var voteJob = {}; voteJob.voteCount = options.voteCount; @@ -108,30 +108,30 @@ function voltInit() { } function voteOften(voteJob) { - console.log("voteOften"); + console.log('voteOften'); voteInsertLoop(voteJob); } function voteResultsOften(voteJob) { - console.log("voteResultsOften"); + console.log('voteResultsOften'); voteResultsLoop(voteJob); } function voteResults(voteJob) { - console.log("voteResults"); + console.log('voteResults'); var query = resultsProc.getQuery(); client.callProcedure(query, function displayResults(event, code, results) { var mytotalVotes = 0; - var msg = ""; + var msg = ''; var longestString = 0; var rows = results.table[0]; for(var i = 0; i < rows.length; i++) { mytotalVotes += rows[i].TOTAL_VOTES; - msg += util.format("%s\t%s\t%d\n", rows[i].CONTESTANT_NAME, + msg += util.format('%s\t%s\t%d\n', rows[i].CONTESTANT_NAME, rows[i].CONTESTANT_NUMBER, rows[i].TOTAL_VOTES); } - msg += util.format("%d votes\n\n", mytotalVotes); + msg += util.format('%d votes\n\n', mytotalVotes); console.log(msg); runNextLink(voteJob); }); @@ -143,7 +143,7 @@ function connectionStats() { function voteEnd(voteJob) { client.connectionStats(); - console.log("voteEnd"); + console.log('voteEnd'); process.exit(); } @@ -189,7 +189,7 @@ function voteResultsLoop(voteJob) { //console.log('reads left: ', reads); if(reads == 0) { - logVoteResultsTime(startTime, voteJob.voteCount, "Results"); + logVoteResultsTime(startTime, voteJob.voteCount, 'Results'); runNextLink(voteJob); } else { // console.log("reads ", reads); @@ -199,8 +199,8 @@ function voteResultsLoop(voteJob) { //console.log('writes left: ', voteJob.voteCount-index); if(index < voteJob.voteCount) { if ( index % 5000 == 0 ) { - console.log("Executed ", index, " queries in ", - (new Date().getTime()) - chunkTime, "ms ", + console.log('Executed ', index, ' queries in ', + (new Date().getTime()) - chunkTime, 'ms ', util.inspect(process.memoryUsage())); chunkTime = new Date().getTime(); } @@ -209,12 +209,12 @@ function voteResultsLoop(voteJob) { process.nextTick(innerResultsLoop); } } else { - console.log("Time to stop querying: ", index); + console.log('Time to stop querying: ', index); } //console.log('write done'); }); } else { - console.log(readyToWriteCounter++, "Index is: ", index, " and ", + console.log(readyToWriteCounter++, 'Index is: ', index, ' and ', voteJob.voteCount); } }; @@ -239,7 +239,7 @@ function voteInsertLoop(voteJob) { //console.log("reads ", reads); reads--; if(reads == 0) { - logVoteInsertTime(startTime, voteJob.voteCount, "Results"); + logVoteInsertTime(startTime, voteJob.voteCount, 'Results'); runNextLink(voteJob); } else { //console.log("reads ", reads); @@ -247,8 +247,8 @@ function voteInsertLoop(voteJob) { }, function readyToWrite() { if( index < voteJob.voteCount ) { if ( index % 5000 == 0 ) { - console.log("Executed ", index, " votes in ", - (new Date().getTime()) - chunkTime, "ms "/*, + console.log('Executed ', index, ' votes in ', + (new Date().getTime()) - chunkTime, 'ms '/*, util.inspect(process.memoryUsage())*/); chunkTime = new Date().getTime(); } @@ -263,11 +263,11 @@ function voteInsertLoop(voteJob) { } function logVoteInsertTime(startTime, votes, typeString) { - logTime("Voted", startTime, votes, typeString); + logTime('Voted', startTime, votes, typeString); } function logVoteResultsTime(startTime, votes, typeString) { - logTime("Queried for results", startTime, votes, typeString); + logTime('Queried for results', startTime, votes, typeString); } function logTime(operation, startTime, votes, typeString) { @@ -276,9 +276,9 @@ function logTime(operation, startTime, votes, typeString) { endTimeMS = (endTimeMS > 0 ? endTimeMS : 1 ); endTimeSeconds = (endTimeSeconds > 0 ? endTimeSeconds : 1 ); - console.log(util.format("%s %d times in %d milliseconds.\n" - + "%s %d times in %d seconds.\n%d milliseconds per transaction\n" - + "%d transactions per millisecond\n%d transactions per second\n\n", + console.log(util.format('%s %d times in %d milliseconds.\n' + + '%s %d times in %d seconds.\n%d milliseconds per transaction\n' + + '%d transactions per millisecond\n%d transactions per second\n\n', operation, votes, endTimeMS, operation, votes, @@ -287,7 +287,7 @@ function logTime(operation, startTime, votes, typeString) { } function isValidObject(object) { - return typeof object != "undefined" && object != null; + return typeof object != 'undefined' && object != null; } function runNextLink(voteJob) { diff --git a/writer.js b/writer.js index b2bec4d..46b4708 100644 --- a/writer.js +++ b/writer.js @@ -32,28 +32,28 @@ * */ -var os = require("os"); -var cli = require("cli"); -var util = require("util"); -var cluster = require("cluster"); -var VoltClient = require("./lib/client"); -var VoltProcedure = require("./lib/query"); +var os = require('os'); +var cli = require('cli'); +var util = require('util'); +var cluster = require('cluster'); +var VoltClient = require('./lib/client'); +var VoltProcedure = require('./lib/query'); var numCPUs = os.cpus().length; -var logTag = "master "; +var logTag = 'master '; var client = null; -var resultsProc = new VoltProcedure("Results"); -var initProc = new VoltProcedure("Initialize", ["int", "string"]); -var writeProc = new VoltProcedure("Vote", ["long", "int", "long"]); +var resultsProc = new VoltProcedure('Results'); +var initProc = new VoltProcedure('Initialize', ['int', 'string']); +var writeProc = new VoltProcedure('Vote', ['long', 'int', 'long']); var throughput = 0; var options = cli.parse({ - loops : ["c", "Number of loops to run", "number", 10000], - voltGate : ["h", "VoltDB host (any if multi-node)", "string", "localhost"], - workers : ["f", "client worker forks", "number", numCPUs], - verbose : ["v", "verbose output"], - debug : ["d", "debug output"] + loops : ['c', 'Number of loops to run', 'number', 10000], + voltGate : ['h', 'VoltDB host (any if multi-node)', 'string', 'localhost'], + workers : ['f', 'client worker forks', 'number', numCPUs], + verbose : ['v', 'verbose output'], + debug : ['d', 'debug output'] }); var workers = options.workers; @@ -61,7 +61,7 @@ var vlog = options.verbose || options.debug ? log : function() { }; var vvlog = options.debug ? log : function() { }; -var cargos = "a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z"; +var cargos = 'a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z'; if(cluster.isMaster) master_main(); @@ -70,19 +70,19 @@ else function master_main() { - log("-- Crude Forking Write Benchmark Client --"); + log('-- Crude Forking Write Benchmark Client --'); - log("VoltDB host: " + options.voltGate); - log("worker forks: " + workers); + log('VoltDB host: ' + options.voltGate); + log('worker forks: ' + workers); // fork workers for(var i = 0; i < workers; i++) { - vvlog("forking worker #" + i); + vvlog('forking worker #' + i); var worker = cluster.fork(); // result counter - worker.on("message", function(msg) { - if(msg.cmd && msg.cmd == "result") { + worker.on('message', function(msg) { + if(msg.cmd && msg.cmd == 'result') { throughput += msg.throughput; } }); @@ -90,34 +90,34 @@ function master_main() { // track exits, print total var exited = 0; - cluster.on("death", function(worker) { - vlog("worker (pid " + worker.pid + ") exits."); + cluster.on('death', function(worker) { + vlog('worker (pid ' + worker.pid + ') exits.'); exited++; if(exited == workers) { - log("Total: " + Math.round(throughput) + " TPS"); + log('Total: ' + Math.round(throughput) + ' TPS'); } }); } function worker_main() { - logTag = "worker " + process.env.NODE_WORKER_ID; - vvlog("worker main"); + logTag = 'worker ' + process.env.NODE_WORKER_ID; + vvlog('worker main'); // define and start a Volt client client = new VoltClient([{ host : options.voltGate, port : 21212, - username : "user", - password : "password", - service : "database", + username : 'user', + password : 'password', + service : 'database', queryTimeout : 50000 }]); client.connect().then(({ connected, errors }) => { if ( connected ) { - vvlog("Node up"); + vvlog('Node up'); } else { - vvlog("Node up (on Error)", { errors }); + vvlog('Node up (on Error)', { errors }); } voltInit(); @@ -126,7 +126,7 @@ function worker_main() { } function voltInit() { - vvlog("voltInit"); + vvlog('voltInit'); var query = initProc.getQuery(); query.setParameters([cargos.length, cargos]); @@ -150,7 +150,7 @@ function getSteps() { } function writeResults(job) { - vvlog("writeResults"); + vvlog('writeResults'); const query = resultsProc.getQuery(); client.callProcedure(query).read.then( () => step(job) ); } @@ -161,7 +161,7 @@ function connectionStats() { function writeEnd() { connectionStats(); - vvlog("writeEnd"); + vvlog('writeEnd'); process.exit(); } @@ -186,31 +186,31 @@ function writeInsertLoop(job) { const call = client.callProcedure(query); call.read.then( () => { - vvlog("reads ", reads); + vvlog('reads ', reads); reads--; if(reads == 0) { - logTime(startTime, job.loops, "Results"); + logTime(startTime, job.loops, 'Results'); step(job); } else { - vvlog("reads ", reads); + vvlog('reads ', reads); } })< call.onQueryAllowed.then ( () => { if(index < job.loops) { if(index && index % 5000 == 0) { - vlog("Executed " + index + " writes in " + ((new Date().getTime()) - chunkTime) + "ms " + util.inspect(process.memoryUsage())); + vlog('Executed ' + index + ' writes in ' + ((new Date().getTime()) - chunkTime) + 'ms ' + util.inspect(process.memoryUsage())); chunkTime = new Date().getTime(); } index++; process.nextTick(innerLoop); } else { - log(doneWith++, "Time to stop voting: ", index); + log(doneWith++, 'Time to stop voting: ', index); } }); } else { - vvlog("Index is: " + index + " and " + job.loops); + vvlog('Index is: ' + index + ' and ' + job.loops); } }; // void stack, yield @@ -223,10 +223,10 @@ function logTime(startTime, writes) { var endTimeMS = Math.max(1, new Date().getTime() - startTime); var throughput = writes * 1000 / endTimeMS; - log(util.format("%d transactions in %d milliseconds.\n" + "%d transactions per second", writes, endTimeMS, throughput)); + log(util.format('%d transactions in %d milliseconds.\n' + '%d transactions per second', writes, endTimeMS, throughput)); process.send({ - cmd : "result", + cmd : 'result', throughput : throughput }); } @@ -240,8 +240,8 @@ function step(job) { } function log(tx) { - tx = tx.replace(/\n/g, "\n" + logTag + ": "); - console.log(logTag + ": " + tx); + tx = tx.replace(/\n/g, '\n' + logTag + ': '); + console.log(logTag + ': ' + tx); } function getRand(max) { From ac8a41490df57322aaacf1a2c24b20e55b893920 Mon Sep 17 00:00:00 2001 From: aamadeo27 Date: Sat, 15 Sep 2018 18:32:44 -0400 Subject: [PATCH 5/9] Bug fix: Zero values turn to null when using Volttable.addRow() --- lib/volttable.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/volttable.js b/lib/volttable.js index c9277e2..fd6461c 100644 --- a/lib/volttable.js +++ b/lib/volttable.js @@ -99,7 +99,7 @@ VoltTable.prototype.addRow = function(...args){ let idx = this.data.length; this.data[idx] = {}; - this.columnNames.forEach((name,i) => this.data[idx][name] = args[i] || null); + this.columnNames.forEach((name,i) => this.data[idx][name] = args[i]); }; VoltTable.prototype.writeToBuffer = function(parser){ From 7e99b71e28db00a6e30d684eeebea7658bc22948 Mon Sep 17 00:00:00 2001 From: aamadeo27 Date: Thu, 20 Sep 2018 21:09:45 -0400 Subject: [PATCH 6/9] Sugar for SystemCatalog --- lib/client.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lib/client.js b/lib/client.js index e7a4f8a..9063fd0 100644 --- a/lib/client.js +++ b/lib/client.js @@ -36,6 +36,7 @@ const UpdateClasses = new VoltProcedure('@UpdateClasses',['varbinary','string']) const Statistics = new VoltProcedure('@Statistics',['string','int']); const GetPartitionKeys = new VoltProcedure('@GetPartitionKeys',['string']); const SystemInformation = new VoltProcedure('@SystemInformation',['string']); +const SystemCatalog = new VoltProcedure('@SystemCatalog',['string']); const VoltClient = function(configuration) { EventEmitter.call(this); @@ -239,6 +240,14 @@ VoltClient.prototype.systemInformation = function(selector){ return this.callProcedure(statement); }; +VoltClient.prototype.systemCatalog = function(selector){ + const statement = SystemCatalog.getQuery(); + + statement.setParameters([selector]); + + return this.callProcedure(statement); +}; + VoltClient.prototype.exit = function(callback) { debug('Exiting | Connections Length: %o', this._connections.length); From 71aee82be4d7047330e7b158ad8a82602e365954 Mon Sep 17 00:00:00 2001 From: albert Date: Sat, 12 Jan 2019 13:36:22 -0300 Subject: [PATCH 7/9] Update connetion.js No reconection when database closes socket. --- lib/connection.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/connection.js b/lib/connection.js index 96edd9d..5ce7533 100644 --- a/lib/connection.js +++ b/lib/connection.js @@ -99,7 +99,9 @@ VoltConnection.prototype.initSocket = function(socket, resolve) { resolve(this); resolve=undefined; //only once will be called - if ( loginStatus !== VoltConstants.SOCKET_ERRORS.HOST_UNKNOWN && this.config.reconnectInterval > 0){ + if ( loginStatus !== VoltConstants.SOCKET_ERRORS.HOST_UNKNOWN && + loginStatus !== VoltConstants.SOCKET_ERRORS.SOCKET_CLOSED && + this.config.reconnectInterval > 0){ /** * This will call reconnect() that will call connect() that will call again to * this function to set this up if it fails again. From 14be5c227643511279eab50449ed33948cabae29 Mon Sep 17 00:00:00 2001 From: albert Date: Sat, 12 Jan 2019 13:40:58 -0300 Subject: [PATCH 8/9] Update connection.js --- lib/connection.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/connection.js b/lib/connection.js index 5ce7533..5a4bf07 100644 --- a/lib/connection.js +++ b/lib/connection.js @@ -100,7 +100,7 @@ VoltConnection.prototype.initSocket = function(socket, resolve) { resolve=undefined; //only once will be called if ( loginStatus !== VoltConstants.SOCKET_ERRORS.HOST_UNKNOWN && - loginStatus !== VoltConstants.SOCKET_ERRORS.SOCKET_CLOSED && + loginStatus !== VoltConstants.SOCKET_ERRORS.EPIPE && this.config.reconnectInterval > 0){ /** * This will call reconnect() that will call connect() that will call again to From 27b69f352f5bc15f97e742e0b614d2173ce29a81 Mon Sep 17 00:00:00 2001 From: amadeoa Date: Fri, 19 Jul 2019 10:48:37 -0400 Subject: [PATCH 9/9] Murmurhash version update --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index b6193eb..b12d127 100644 --- a/package.json +++ b/package.json @@ -30,7 +30,7 @@ "cli": "^1.0.0", "ctype": "^0.5.0", "debug": "^3.0.1", - "murmurhash-native": "^3.2.4", + "murmurhash-native": "^3.4.1", "supports-color": "^4.4.0" }, "devDependencies": {