From e9a17f43c65a8e9e351dfc46414a2508c9d73b6b Mon Sep 17 00:00:00 2001 From: Craig Michael Thompson Date: Sat, 31 Mar 2012 19:36:54 +0100 Subject: [PATCH] Add missing files and make sure to only use first element of a jquery object passed to position.container --- build/lib/consolidator.js | 2598 +++++++++++++++++++++++++++++++++++++ build/lib/uglify-js.js | 18 + dist/jquery.qtip.basic.js | 5 +- dist/jquery.qtip.css | 2 +- dist/jquery.qtip.js | 5 +- dist/jquery.qtip.min.js | 6 +- src/core.js | 3 + 7 files changed, 2631 insertions(+), 6 deletions(-) create mode 100644 build/lib/consolidator.js create mode 100644 build/lib/uglify-js.js diff --git a/build/lib/consolidator.js b/build/lib/consolidator.js new file mode 100644 index 00000000..623c9106 --- /dev/null +++ b/build/lib/consolidator.js @@ -0,0 +1,2598 @@ +/** + * @preserve Copyright 2012 Robert Gust-Bardon . + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above + * copyright notice, this list of conditions and the following + * disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, + * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF + * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/** + * @fileoverview Enhances UglifyJS with consolidation of null, Boolean, and String values. + *

Also known as aliasing, this feature has been deprecated in the Closure Compiler since its + * initial release, where it is unavailable from the CLI. The Closure Compiler allows one to log and + * influence this process. In contrast, this implementation does not introduce + * any variable declarations in global code and derives String values from + * identifier names used as property accessors.

+ *

Consolidating literals may worsen the data compression ratio when an encoding + * transformation is applied. For instance, jQuery 1.7.1 takes 248235 bytes. + * Building it with + * UglifyJS v1.2.5 results in 93647 bytes (37.73% of the original) which are + * then compressed to 33154 bytes (13.36% of the original) using gzip(1). Building it with the same + * version of UglifyJS 1.2.5 patched with the implementation of consolidation + * results in 80784 bytes (a decrease of 12863 bytes, i.e. 13.74%, in comparison + * to the aforementioned 93647 bytes) which are then compressed to 34013 bytes + * (an increase of 859 bytes, i.e. 2.59%, in comparison to the aforementioned + * 33154 bytes).

+ *

Written in the strict variant + * of ECMA-262 5.1 Edition. Encoded in UTF-8. Follows Revision 2.28 of the Google JavaScript Style Guide (except for the + * discouraged use of the {@code function} tag and the {@code namespace} tag). + * 100% typed for the Closure Compiler Version 1741.

+ *

Should you find this software useful, please consider a donation.

+ * @author follow.me@RGustBardon (Robert Gust-Bardon) + * @supported Tested with: + * + */ + +/*global console:false, exports:true, module:false, require:false */ +/*jshint sub:true */ +/** + * Consolidates null, Boolean, and String values found inside an AST. + * @param {!TSyntacticCodeUnit} oAbstractSyntaxTree An array-like object + * representing an AST. + * @return {!TSyntacticCodeUnit} An array-like object representing an AST with its null, Boolean, and + * String values consolidated. + */ +// TODO(user) Consolidation of mathematical values found in numeric literals. +// TODO(user) Unconsolidation. +// TODO(user) Consolidation of ECMA-262 6th Edition programs. +// TODO(user) Rewrite in ECMA-262 6th Edition. +exports['ast_consolidate'] = function(oAbstractSyntaxTree) { + 'use strict'; + /*jshint bitwise:true, curly:true, eqeqeq:true, forin:true, immed:true, + latedef:true, newcap:true, noarge:true, noempty:true, nonew:true, + onevar:true, plusplus:true, regexp:true, undef:true, strict:true, + sub:false, trailing:true */ + + var _, + /** + * A record consisting of data about one or more source elements. + * @constructor + * @nosideeffects + */ + TSourceElementsData = function() { + /** + * The category of the elements. + * @type {number} + * @see ESourceElementCategories + */ + this.nCategory = ESourceElementCategories.N_OTHER; + /** + * The number of occurrences (within the elements) of each primitive + * value that could be consolidated. + * @type {!Array.>} + */ + this.aCount = []; + this.aCount[EPrimaryExpressionCategories.N_IDENTIFIER_NAMES] = {}; + this.aCount[EPrimaryExpressionCategories.N_STRING_LITERALS] = {}; + this.aCount[EPrimaryExpressionCategories.N_NULL_AND_BOOLEAN_LITERALS] = + {}; + /** + * Identifier names found within the elements. + * @type {!Array.} + */ + this.aIdentifiers = []; + /** + * Prefixed representation Strings of each primitive value that could be + * consolidated within the elements. + * @type {!Array.} + */ + this.aPrimitiveValues = []; + }, + /** + * A record consisting of data about a primitive value that could be + * consolidated. + * @constructor + * @nosideeffects + */ + TPrimitiveValue = function() { + /** + * The difference in the number of terminal symbols between the original + * source text and the one with the primitive value consolidated. If the + * difference is positive, the primitive value is considered worthwhile. + * @type {number} + */ + this.nSaving = 0; + /** + * An identifier name of the variable that will be declared and assigned + * the primitive value if the primitive value is consolidated. + * @type {string} + */ + this.sName = ''; + }, + /** + * A record consisting of data on what to consolidate within the range of + * source elements that is currently being considered. + * @constructor + * @nosideeffects + */ + TSolution = function() { + /** + * An object whose keys are prefixed representation Strings of each + * primitive value that could be consolidated within the elements and + * whose values are corresponding data about those primitive values. + * @type {!Object.} + * @see TPrimitiveValue + */ + this.oPrimitiveValues = {}; + /** + * The difference in the number of terminal symbols between the original + * source text and the one with all the worthwhile primitive values + * consolidated. + * @type {number} + * @see TPrimitiveValue#nSaving + */ + this.nSavings = 0; + }, + /** + * The processor of ASTs found + * in UglifyJS. + * @namespace + * @type {!TProcessor} + */ + oProcessor = (/** @type {!TProcessor} */ require('./process')), + /** + * A record consisting of a number of constants that represent the + * difference in the number of terminal symbols between a source text with + * a modified syntactic code unit and the original one. + * @namespace + * @type {!Object.} + */ + oWeights = { + /** + * The difference in the number of punctuators required by the bracket + * notation and the dot notation. + *

'[]'.length - '.'.length

+ * @const + * @type {number} + */ + N_PROPERTY_ACCESSOR: 1, + /** + * The number of punctuators required by a variable declaration with an + * initialiser. + *

':'.length + ';'.length

+ * @const + * @type {number} + */ + N_VARIABLE_DECLARATION: 2, + /** + * The number of terminal symbols required to introduce a variable + * statement (excluding its variable declaration list). + *

'var '.length

+ * @const + * @type {number} + */ + N_VARIABLE_STATEMENT_AFFIXATION: 4, + /** + * The number of terminal symbols needed to enclose source elements + * within a function call with no argument values to a function with an + * empty parameter list. + *

'(function(){}());'.length

+ * @const + * @type {number} + */ + N_CLOSURE: 17 + }, + /** + * Categories of primary expressions from which primitive values that + * could be consolidated are derivable. + * @namespace + * @enum {number} + */ + EPrimaryExpressionCategories = { + /** + * Identifier names used as property accessors. + * @type {number} + */ + N_IDENTIFIER_NAMES: 0, + /** + * String literals. + * @type {number} + */ + N_STRING_LITERALS: 1, + /** + * Null and Boolean literals. + * @type {number} + */ + N_NULL_AND_BOOLEAN_LITERALS: 2 + }, + /** + * Prefixes of primitive values that could be consolidated. + * The String values of the prefixes must have same number of characters. + * The prefixes must not be used in any properties defined in any version + * of ECMA-262. + * @namespace + * @enum {string} + */ + EValuePrefixes = { + /** + * Identifies String values. + * @type {string} + */ + S_STRING: '#S', + /** + * Identifies null and Boolean values. + * @type {string} + */ + S_SYMBOLIC: '#O' + }, + /** + * Categories of source elements in terms of their appropriateness of + * having their primitive values consolidated. + * @namespace + * @enum {number} + */ + ESourceElementCategories = { + /** + * Identifies a source element that includes the {@code with} statement. + * @type {number} + */ + N_WITH: 0, + /** + * Identifies a source element that includes the {@code eval} identifier name. + * @type {number} + */ + N_EVAL: 1, + /** + * Identifies a source element that must be excluded from the process + * unless its whole scope is examined. + * @type {number} + */ + N_EXCLUDABLE: 2, + /** + * Identifies source elements not posing any problems. + * @type {number} + */ + N_OTHER: 3 + }, + /** + * The list of literals (other than the String ones) whose primitive + * values can be consolidated. + * @const + * @type {!Array.} + */ + A_OTHER_SUBSTITUTABLE_LITERALS = [ + 'null', // The null literal. + 'false', // The Boolean literal {@code false}. + 'true' // The Boolean literal {@code true}. + ]; + + (/** + * Consolidates all worthwhile primitive values in a syntactic code unit. + * @param {!TSyntacticCodeUnit} oSyntacticCodeUnit An array-like object + * representing the branch of the abstract syntax tree representing the + * syntactic code unit along with its scope. + * @see TPrimitiveValue#nSaving + */ + function fExamineSyntacticCodeUnit(oSyntacticCodeUnit) { + var _, + /** + * Indicates whether the syntactic code unit represents global code. + * @type {boolean} + */ + bIsGlobal = 'toplevel' === oSyntacticCodeUnit[0], + /** + * Indicates whether the whole scope is being examined. + * @type {boolean} + */ + bIsWhollyExaminable = !bIsGlobal, + /** + * An array-like object representing source elements that constitute a + * syntactic code unit. + * @type {!TSyntacticCodeUnit} + */ + oSourceElements, + /** + * A record consisting of data about the source element that is + * currently being examined. + * @type {!TSourceElementsData} + */ + oSourceElementData, + /** + * The scope of the syntactic code unit. + * @type {!TScope} + */ + oScope, + /** + * An instance of an object that allows the traversal of an AST. + * @type {!TWalker} + */ + oWalker, + /** + * An object encompassing collections of functions used during the + * traversal of an AST. + * @namespace + * @type {!Object.>} + */ + oWalkers = { + /** + * A collection of functions used during the surveyance of source + * elements. + * @namespace + * @type {!Object.} + */ + oSurveySourceElement: { + /**#nocode+*/ // JsDoc Toolkit 2.4.0 hides some of the keys. + /** + * Classifies the source element as excludable if it does not + * contain a {@code with} statement or the {@code eval} identifier + * name. Adds the identifier of the function and its formal + * parameters to the list of identifier names found. + * @param {string} sIdentifier The identifier of the function. + * @param {!Array.} aFormalParameterList Formal parameters. + * @param {!TSyntacticCodeUnit} oFunctionBody Function code. + */ + 'defun': function( + sIdentifier, + aFormalParameterList, + oFunctionBody) { + fClassifyAsExcludable(); + fAddIdentifier(sIdentifier); + aFormalParameterList.forEach(fAddIdentifier); + }, + /** + * Increments the count of the number of occurrences of the String + * value that is equivalent to the sequence of terminal symbols + * that constitute the encountered identifier name. + * @param {!TSyntacticCodeUnit} oExpression The nonterminal + * MemberExpression. + * @param {string} sIdentifierName The identifier name used as the + * property accessor. + * @return {!Array} The encountered branch of an AST with its nonterminal + * MemberExpression traversed. + */ + 'dot': function(oExpression, sIdentifierName) { + fCountPrimaryExpression( + EPrimaryExpressionCategories.N_IDENTIFIER_NAMES, + EValuePrefixes.S_STRING + sIdentifierName); + return ['dot', oWalker.walk(oExpression), sIdentifierName]; + }, + /** + * Adds the optional identifier of the function and its formal + * parameters to the list of identifier names found. + * @param {?string} sIdentifier The optional identifier of the + * function. + * @param {!Array.} aFormalParameterList Formal parameters. + * @param {!TSyntacticCodeUnit} oFunctionBody Function code. + */ + 'function': function( + sIdentifier, + aFormalParameterList, + oFunctionBody) { + if ('string' === typeof sIdentifier) { + fAddIdentifier(sIdentifier); + } + aFormalParameterList.forEach(fAddIdentifier); + }, + /** + * Either increments the count of the number of occurrences of the + * encountered null or Boolean value or classifies a source element + * as containing the {@code eval} identifier name. + * @param {string} sIdentifier The identifier encountered. + */ + 'name': function(sIdentifier) { + if (-1 !== A_OTHER_SUBSTITUTABLE_LITERALS.indexOf(sIdentifier)) { + fCountPrimaryExpression( + EPrimaryExpressionCategories.N_NULL_AND_BOOLEAN_LITERALS, + EValuePrefixes.S_SYMBOLIC + sIdentifier); + } else { + if ('eval' === sIdentifier) { + oSourceElementData.nCategory = + ESourceElementCategories.N_EVAL; + } + fAddIdentifier(sIdentifier); + } + }, + /** + * Classifies the source element as excludable if it does not + * contain a {@code with} statement or the {@code eval} identifier + * name. + * @param {TSyntacticCodeUnit} oExpression The expression whose + * value is to be returned. + */ + 'return': function(oExpression) { + fClassifyAsExcludable(); + }, + /** + * Increments the count of the number of occurrences of the + * encountered String value. + * @param {string} sStringValue The String value of the string + * literal encountered. + */ + 'string': function(sStringValue) { + if (sStringValue.length > 0) { + fCountPrimaryExpression( + EPrimaryExpressionCategories.N_STRING_LITERALS, + EValuePrefixes.S_STRING + sStringValue); + } + }, + /** + * Adds the identifier reserved for an exception to the list of + * identifier names found. + * @param {!TSyntacticCodeUnit} oTry A block of code in which an + * exception can occur. + * @param {Array} aCatch The identifier reserved for an exception + * and a block of code to handle the exception. + * @param {TSyntacticCodeUnit} oFinally An optional block of code + * to be evaluated regardless of whether an exception occurs. + */ + 'try': function(oTry, aCatch, oFinally) { + if (Array.isArray(aCatch)) { + fAddIdentifier(aCatch[0]); + } + }, + /** + * Classifies the source element as excludable if it does not + * contain a {@code with} statement or the {@code eval} identifier + * name. Adds the identifier of each declared variable to the list + * of identifier names found. + * @param {!Array.} aVariableDeclarationList Variable + * declarations. + */ + 'var': function(aVariableDeclarationList) { + fClassifyAsExcludable(); + aVariableDeclarationList.forEach(fAddVariable); + }, + /** + * Classifies a source element as containing the {@code with} + * statement. + * @param {!TSyntacticCodeUnit} oExpression An expression whose + * value is to be converted to a value of type Object and + * become the binding object of a new object environment + * record of a new lexical environment in which the statement + * is to be executed. + * @param {!TSyntacticCodeUnit} oStatement The statement to be + * executed in the augmented lexical environment. + * @return {!Array} An empty array to stop the traversal. + */ + 'with': function(oExpression, oStatement) { + oSourceElementData.nCategory = ESourceElementCategories.N_WITH; + return []; + } + /**#nocode-*/ // JsDoc Toolkit 2.4.0 hides some of the keys. + }, + /** + * A collection of functions used while looking for nested functions. + * @namespace + * @type {!Object.} + */ + oExamineFunctions: { + /**#nocode+*/ // JsDoc Toolkit 2.4.0 hides some of the keys. + /** + * Orders an examination of a nested function declaration. + * @this {!TSyntacticCodeUnit} An array-like object representing + * the branch of an AST representing the syntactic code unit along with + * its scope. + * @return {!Array} An empty array to stop the traversal. + */ + 'defun': function() { + fExamineSyntacticCodeUnit(this); + return []; + }, + /** + * Orders an examination of a nested function expression. + * @this {!TSyntacticCodeUnit} An array-like object representing + * the branch of an AST representing the syntactic code unit along with + * its scope. + * @return {!Array} An empty array to stop the traversal. + */ + 'function': function() { + fExamineSyntacticCodeUnit(this); + return []; + } + /**#nocode-*/ // JsDoc Toolkit 2.4.0 hides some of the keys. + } + }, + /** + * Records containing data about source elements. + * @type {Array.} + */ + aSourceElementsData = [], + /** + * The index (in the source text order) of the source element + * immediately following a Directive Prologue. + * @type {number} + */ + nAfterDirectivePrologue = 0, + /** + * The index (in the source text order) of the source element that is + * currently being considered. + * @type {number} + */ + nPosition, + /** + * The index (in the source text order) of the source element that is + * the last element of the range of source elements that is currently + * being considered. + * @type {(undefined|number)} + */ + nTo, + /** + * Initiates the traversal of a source element. + * @param {!TWalker} oWalker An instance of an object that allows the + * traversal of an abstract syntax tree. + * @param {!TSyntacticCodeUnit} oSourceElement A source element from + * which the traversal should commence. + * @return {function(): !TSyntacticCodeUnit} A function that is able to + * initiate the traversal from a given source element. + */ + cContext = function(oWalker, oSourceElement) { + /** + * @return {!TSyntacticCodeUnit} A function that is able to + * initiate the traversal from a given source element. + */ + var fLambda = function() { + return oWalker.walk(oSourceElement); + }; + + return fLambda; + }, + /** + * Classifies the source element as excludable if it does not + * contain a {@code with} statement or the {@code eval} identifier + * name. + */ + fClassifyAsExcludable = function() { + if (oSourceElementData.nCategory === + ESourceElementCategories.N_OTHER) { + oSourceElementData.nCategory = + ESourceElementCategories.N_EXCLUDABLE; + } + }, + /** + * Adds an identifier to the list of identifier names found. + * @param {string} sIdentifier The identifier to be added. + */ + fAddIdentifier = function(sIdentifier) { + if (-1 === oSourceElementData.aIdentifiers.indexOf(sIdentifier)) { + oSourceElementData.aIdentifiers.push(sIdentifier); + } + }, + /** + * Adds the identifier of a variable to the list of identifier names + * found. + * @param {!Array} aVariableDeclaration A variable declaration. + */ + fAddVariable = function(aVariableDeclaration) { + fAddIdentifier(/** @type {string} */ aVariableDeclaration[0]); + }, + /** + * Increments the count of the number of occurrences of the prefixed + * String representation attributed to the primary expression. + * @param {number} nCategory The category of the primary expression. + * @param {string} sName The prefixed String representation attributed + * to the primary expression. + */ + fCountPrimaryExpression = function(nCategory, sName) { + if (!oSourceElementData.aCount[nCategory].hasOwnProperty(sName)) { + oSourceElementData.aCount[nCategory][sName] = 0; + if (-1 === oSourceElementData.aPrimitiveValues.indexOf(sName)) { + oSourceElementData.aPrimitiveValues.push(sName); + } + } + oSourceElementData.aCount[nCategory][sName] += 1; + }, + /** + * Consolidates all worthwhile primitive values in a range of source + * elements. + * @param {number} nFrom The index (in the source text order) of the + * source element that is the first element of the range. + * @param {number} nTo The index (in the source text order) of the + * source element that is the last element of the range. + * @param {boolean} bEnclose Indicates whether the range should be + * enclosed within a function call with no argument values to a + * function with an empty parameter list if any primitive values + * are consolidated. + * @see TPrimitiveValue#nSaving + */ + fExamineSourceElements = function(nFrom, nTo, bEnclose) { + var _, + /** + * The index of the last mangled name. + * @type {number} + */ + nIndex = oScope.cname, + /** + * The index of the source element that is currently being + * considered. + * @type {number} + */ + nPosition, + /** + * A collection of functions used during the consolidation of + * primitive values and identifier names used as property + * accessors. + * @namespace + * @type {!Object.} + */ + oWalkersTransformers = { + /** + * If the String value that is equivalent to the sequence of + * terminal symbols that constitute the encountered identifier + * name is worthwhile, a syntactic conversion from the dot + * notation to the bracket notation ensues with that sequence + * being substituted by an identifier name to which the value + * is assigned. + * Applies to property accessors that use the dot notation. + * @param {!TSyntacticCodeUnit} oExpression The nonterminal + * MemberExpression. + * @param {string} sIdentifierName The identifier name used as + * the property accessor. + * @return {!Array} A syntactic code unit that is equivalent to + * the one encountered. + * @see TPrimitiveValue#nSaving + */ + 'dot': function(oExpression, sIdentifierName) { + /** + * The prefixed String value that is equivalent to the + * sequence of terminal symbols that constitute the + * encountered identifier name. + * @type {string} + */ + var sPrefixed = EValuePrefixes.S_STRING + sIdentifierName; + + return oSolutionBest.oPrimitiveValues.hasOwnProperty( + sPrefixed) && + oSolutionBest.oPrimitiveValues[sPrefixed].nSaving > 0 ? + ['sub', + oWalker.walk(oExpression), + ['name', + oSolutionBest.oPrimitiveValues[sPrefixed].sName]] : + ['dot', oWalker.walk(oExpression), sIdentifierName]; + }, + /** + * If the encountered identifier is a null or Boolean literal + * and its value is worthwhile, the identifier is substituted + * by an identifier name to which that value is assigned. + * Applies to identifier names. + * @param {string} sIdentifier The identifier encountered. + * @return {!Array} A syntactic code unit that is equivalent to + * the one encountered. + * @see TPrimitiveValue#nSaving + */ + 'name': function(sIdentifier) { + /** + * The prefixed representation String of the identifier. + * @type {string} + */ + var sPrefixed = EValuePrefixes.S_SYMBOLIC + sIdentifier; + + return [ + 'name', + oSolutionBest.oPrimitiveValues.hasOwnProperty(sPrefixed) && + oSolutionBest.oPrimitiveValues[sPrefixed].nSaving > 0 ? + oSolutionBest.oPrimitiveValues[sPrefixed].sName : + sIdentifier + ]; + }, + /** + * If the encountered String value is worthwhile, it is + * substituted by an identifier name to which that value is + * assigned. + * Applies to String values. + * @param {string} sStringValue The String value of the string + * literal encountered. + * @return {!Array} A syntactic code unit that is equivalent to + * the one encountered. + * @see TPrimitiveValue#nSaving + */ + 'string': function(sStringValue) { + /** + * The prefixed representation String of the primitive value + * of the literal. + * @type {string} + */ + var sPrefixed = + EValuePrefixes.S_STRING + sStringValue; + + return oSolutionBest.oPrimitiveValues.hasOwnProperty( + sPrefixed) && + oSolutionBest.oPrimitiveValues[sPrefixed].nSaving > 0 ? + ['name', + oSolutionBest.oPrimitiveValues[sPrefixed].sName] : + ['string', sStringValue]; + } + }, + /** + * Such data on what to consolidate within the range of source + * elements that is currently being considered that lead to the + * greatest known reduction of the number of the terminal symbols + * in comparison to the original source text. + * @type {!TSolution} + */ + oSolutionBest = new TSolution(), + /** + * Data representing an ongoing attempt to find a better + * reduction of the number of the terminal symbols in comparison + * to the original source text than the best one that is + * currently known. + * @type {!TSolution} + * @see oSolutionBest + */ + oSolutionCandidate = new TSolution(), + /** + * A record consisting of data about the range of source elements + * that is currently being examined. + * @type {!TSourceElementsData} + */ + oSourceElementsData = new TSourceElementsData(), + /** + * Variable declarations for each primitive value that is to be + * consolidated within the elements. + * @type {!Array.} + */ + aVariableDeclarations = [], + /** + * Augments a list with a prefixed representation String. + * @param {!Array.} aList A list that is to be augmented. + * @return {function(string)} A function that augments a list + * with a prefixed representation String. + */ + cAugmentList = function(aList) { + /** + * @param {string} sPrefixed Prefixed representation String of + * a primitive value that could be consolidated within the + * elements. + */ + var fLambda = function(sPrefixed) { + if (-1 === aList.indexOf(sPrefixed)) { + aList.push(sPrefixed); + } + }; + + return fLambda; + }, + /** + * Adds the number of occurrences of a primitive value of a given + * category that could be consolidated in the source element with + * a given index to the count of occurrences of that primitive + * value within the range of source elements that is currently + * being considered. + * @param {number} nPosition The index (in the source text order) + * of a source element. + * @param {number} nCategory The category of the primary + * expression from which the primitive value is derived. + * @return {function(string)} A function that performs the + * addition. + * @see cAddOccurrencesInCategory + */ + cAddOccurrences = function(nPosition, nCategory) { + /** + * @param {string} sPrefixed The prefixed representation String + * of a primitive value. + */ + var fLambda = function(sPrefixed) { + if (!oSourceElementsData.aCount[nCategory].hasOwnProperty( + sPrefixed)) { + oSourceElementsData.aCount[nCategory][sPrefixed] = 0; + } + oSourceElementsData.aCount[nCategory][sPrefixed] += + aSourceElementsData[nPosition].aCount[nCategory][ + sPrefixed]; + }; + + return fLambda; + }, + /** + * Adds the number of occurrences of each primitive value of a + * given category that could be consolidated in the source + * element with a given index to the count of occurrences of that + * primitive values within the range of source elements that is + * currently being considered. + * @param {number} nPosition The index (in the source text order) + * of a source element. + * @return {function(number)} A function that performs the + * addition. + * @see fAddOccurrences + */ + cAddOccurrencesInCategory = function(nPosition) { + /** + * @param {number} nCategory The category of the primary + * expression from which the primitive value is derived. + */ + var fLambda = function(nCategory) { + Object.keys( + aSourceElementsData[nPosition].aCount[nCategory] + ).forEach(cAddOccurrences(nPosition, nCategory)); + }; + + return fLambda; + }, + /** + * Adds the number of occurrences of each primitive value that + * could be consolidated in the source element with a given index + * to the count of occurrences of that primitive values within + * the range of source elements that is currently being + * considered. + * @param {number} nPosition The index (in the source text order) + * of a source element. + */ + fAddOccurrences = function(nPosition) { + Object.keys(aSourceElementsData[nPosition].aCount).forEach( + cAddOccurrencesInCategory(nPosition)); + }, + /** + * Creates a variable declaration for a primitive value if that + * primitive value is to be consolidated within the elements. + * @param {string} sPrefixed Prefixed representation String of a + * primitive value that could be consolidated within the + * elements. + * @see aVariableDeclarations + */ + cAugmentVariableDeclarations = function(sPrefixed) { + if (oSolutionBest.oPrimitiveValues[sPrefixed].nSaving > 0) { + aVariableDeclarations.push([ + oSolutionBest.oPrimitiveValues[sPrefixed].sName, + [0 === sPrefixed.indexOf(EValuePrefixes.S_SYMBOLIC) ? + 'name' : 'string', + sPrefixed.substring(EValuePrefixes.S_SYMBOLIC.length)] + ]); + } + }, + /** + * Sorts primitive values with regard to the difference in the + * number of terminal symbols between the original source text + * and the one with those primitive values consolidated. + * @param {string} sPrefixed0 The prefixed representation String + * of the first of the two primitive values that are being + * compared. + * @param {string} sPrefixed1 The prefixed representation String + * of the second of the two primitive values that are being + * compared. + * @return {number} + *
+ *
-1
+ *
if the first primitive value must be placed before + * the other one,
+ *
0
+ *
if the first primitive value may be placed before + * the other one,
+ *
1
+ *
if the first primitive value must not be placed + * before the other one.
+ *
+ * @see TSolution.oPrimitiveValues + */ + cSortPrimitiveValues = function(sPrefixed0, sPrefixed1) { + /** + * The difference between: + *
    + *
  1. the difference in the number of terminal symbols + * between the original source text and the one with the + * first primitive value consolidated, and
  2. + *
  3. the difference in the number of terminal symbols + * between the original source text and the one with the + * second primitive value consolidated.
  4. + *
+ * @type {number} + */ + var nDifference = + oSolutionCandidate.oPrimitiveValues[sPrefixed0].nSaving - + oSolutionCandidate.oPrimitiveValues[sPrefixed1].nSaving; + + return nDifference > 0 ? -1 : nDifference < 0 ? 1 : 0; + }, + /** + * Assigns an identifier name to a primitive value and calculates + * whether instances of that primitive value are worth + * consolidating. + * @param {string} sPrefixed The prefixed representation String + * of a primitive value that is being evaluated. + */ + fEvaluatePrimitiveValue = function(sPrefixed) { + var _, + /** + * The index of the last mangled name. + * @type {number} + */ + nIndex, + /** + * The representation String of the primitive value that is + * being evaluated. + * @type {string} + */ + sName = + sPrefixed.substring(EValuePrefixes.S_SYMBOLIC.length), + /** + * The number of source characters taken up by the + * representation String of the primitive value that is + * being evaluated. + * @type {number} + */ + nLengthOriginal = sName.length, + /** + * The number of source characters taken up by the + * identifier name that could substitute the primitive + * value that is being evaluated. + * substituted. + * @type {number} + */ + nLengthSubstitution, + /** + * The number of source characters taken up by by the + * representation String of the primitive value that is + * being evaluated when it is represented by a string + * literal. + * @type {number} + */ + nLengthString = oProcessor.make_string(sName).length; + + oSolutionCandidate.oPrimitiveValues[sPrefixed] = + new TPrimitiveValue(); + do { // Find an identifier unused in this or any nested scope. + nIndex = oScope.cname; + oSolutionCandidate.oPrimitiveValues[sPrefixed].sName = + oScope.next_mangled(); + } while (-1 !== oSourceElementsData.aIdentifiers.indexOf( + oSolutionCandidate.oPrimitiveValues[sPrefixed].sName)); + nLengthSubstitution = oSolutionCandidate.oPrimitiveValues[ + sPrefixed].sName.length; + if (0 === sPrefixed.indexOf(EValuePrefixes.S_SYMBOLIC)) { + // foo:null, or foo:null; + oSolutionCandidate.oPrimitiveValues[sPrefixed].nSaving -= + nLengthSubstitution + nLengthOriginal + + oWeights.N_VARIABLE_DECLARATION; + // null vs foo + oSolutionCandidate.oPrimitiveValues[sPrefixed].nSaving += + oSourceElementsData.aCount[ + EPrimaryExpressionCategories. + N_NULL_AND_BOOLEAN_LITERALS][sPrefixed] * + (nLengthOriginal - nLengthSubstitution); + } else { + // foo:'fromCharCode'; + oSolutionCandidate.oPrimitiveValues[sPrefixed].nSaving -= + nLengthSubstitution + nLengthString + + oWeights.N_VARIABLE_DECLARATION; + // .fromCharCode vs [foo] + if (oSourceElementsData.aCount[ + EPrimaryExpressionCategories.N_IDENTIFIER_NAMES + ].hasOwnProperty(sPrefixed)) { + oSolutionCandidate.oPrimitiveValues[sPrefixed].nSaving += + oSourceElementsData.aCount[ + EPrimaryExpressionCategories.N_IDENTIFIER_NAMES + ][sPrefixed] * + (nLengthOriginal - nLengthSubstitution - + oWeights.N_PROPERTY_ACCESSOR); + } + // 'fromCharCode' vs foo + if (oSourceElementsData.aCount[ + EPrimaryExpressionCategories.N_STRING_LITERALS + ].hasOwnProperty(sPrefixed)) { + oSolutionCandidate.oPrimitiveValues[sPrefixed].nSaving += + oSourceElementsData.aCount[ + EPrimaryExpressionCategories.N_STRING_LITERALS + ][sPrefixed] * + (nLengthString - nLengthSubstitution); + } + } + if (oSolutionCandidate.oPrimitiveValues[sPrefixed].nSaving > + 0) { + oSolutionCandidate.nSavings += + oSolutionCandidate.oPrimitiveValues[sPrefixed].nSaving; + } else { + oScope.cname = nIndex; // Free the identifier name. + } + }, + /** + * Adds a variable declaration to an existing variable statement. + * @param {!Array} aVariableDeclaration A variable declaration + * with an initialiser. + */ + cAddVariableDeclaration = function(aVariableDeclaration) { + (/** @type {!Array} */ oSourceElements[nFrom][1]).unshift( + aVariableDeclaration); + }; + + if (nFrom > nTo) { + return; + } + // If the range is a closure, reuse the closure. + if (nFrom === nTo && + 'stat' === oSourceElements[nFrom][0] && + 'call' === oSourceElements[nFrom][1][0] && + 'function' === oSourceElements[nFrom][1][1][0]) { + fExamineSyntacticCodeUnit(oSourceElements[nFrom][1][1]); + return; + } + // Create a list of all derived primitive values within the range. + for (nPosition = nFrom; nPosition <= nTo; nPosition += 1) { + aSourceElementsData[nPosition].aPrimitiveValues.forEach( + cAugmentList(oSourceElementsData.aPrimitiveValues)); + } + if (0 === oSourceElementsData.aPrimitiveValues.length) { + return; + } + for (nPosition = nFrom; nPosition <= nTo; nPosition += 1) { + // Add the number of occurrences to the total count. + fAddOccurrences(nPosition); + // Add identifiers of this or any nested scope to the list. + aSourceElementsData[nPosition].aIdentifiers.forEach( + cAugmentList(oSourceElementsData.aIdentifiers)); + } + // Distribute identifier names among derived primitive values. + do { // If there was any progress, find a better distribution. + oSolutionBest = oSolutionCandidate; + if (Object.keys(oSolutionCandidate.oPrimitiveValues).length > 0) { + // Sort primitive values descending by their worthwhileness. + oSourceElementsData.aPrimitiveValues.sort(cSortPrimitiveValues); + } + oSolutionCandidate = new TSolution(); + oSourceElementsData.aPrimitiveValues.forEach( + fEvaluatePrimitiveValue); + oScope.cname = nIndex; + } while (oSolutionCandidate.nSavings > oSolutionBest.nSavings); + // Take the necessity of adding a variable statement into account. + if ('var' !== oSourceElements[nFrom][0]) { + oSolutionBest.nSavings -= oWeights.N_VARIABLE_STATEMENT_AFFIXATION; + } + if (bEnclose) { + // Take the necessity of forming a closure into account. + oSolutionBest.nSavings -= oWeights.N_CLOSURE; + } + if (oSolutionBest.nSavings > 0) { + // Create variable declarations suitable for UglifyJS. + Object.keys(oSolutionBest.oPrimitiveValues).forEach( + cAugmentVariableDeclarations); + // Rewrite expressions that contain worthwhile primitive values. + for (nPosition = nFrom; nPosition <= nTo; nPosition += 1) { + oWalker = oProcessor.ast_walker(); + oSourceElements[nPosition] = + oWalker.with_walkers( + oWalkersTransformers, + cContext(oWalker, oSourceElements[nPosition])); + } + if ('var' === oSourceElements[nFrom][0]) { // Reuse the statement. + (/** @type {!Array.} */ aVariableDeclarations.reverse( + )).forEach(cAddVariableDeclaration); + } else { // Add a variable statement. + Array.prototype.splice.call( + oSourceElements, + nFrom, + 0, + ['var', aVariableDeclarations]); + nTo += 1; + } + if (bEnclose) { + // Add a closure. + Array.prototype.splice.call( + oSourceElements, + nFrom, + 0, + ['stat', ['call', ['function', null, [], []], []]]); + // Copy source elements into the closure. + for (nPosition = nTo + 1; nPosition > nFrom; nPosition -= 1) { + Array.prototype.unshift.call( + oSourceElements[nFrom][1][1][3], + oSourceElements[nPosition]); + } + // Remove source elements outside the closure. + Array.prototype.splice.call( + oSourceElements, + nFrom + 1, + nTo - nFrom + 1); + } + } + if (bEnclose) { + // Restore the availability of identifier names. + oScope.cname = nIndex; + } + }; + + oSourceElements = (/** @type {!TSyntacticCodeUnit} */ + oSyntacticCodeUnit[bIsGlobal ? 1 : 3]); + if (0 === oSourceElements.length) { + return; + } + oScope = bIsGlobal ? oSyntacticCodeUnit.scope : oSourceElements.scope; + // Skip a Directive Prologue. + while (nAfterDirectivePrologue < oSourceElements.length && + 'stat' === oSourceElements[nAfterDirectivePrologue][0] && + 'string' === oSourceElements[nAfterDirectivePrologue][1][0]) { + nAfterDirectivePrologue += 1; + aSourceElementsData.push(null); + } + if (oSourceElements.length === nAfterDirectivePrologue) { + return; + } + for (nPosition = nAfterDirectivePrologue; + nPosition < oSourceElements.length; + nPosition += 1) { + oSourceElementData = new TSourceElementsData(); + oWalker = oProcessor.ast_walker(); + // Classify a source element. + // Find its derived primitive values and count their occurrences. + // Find all identifiers used (including nested scopes). + oWalker.with_walkers( + oWalkers.oSurveySourceElement, + cContext(oWalker, oSourceElements[nPosition])); + // Establish whether the scope is still wholly examinable. + bIsWhollyExaminable = bIsWhollyExaminable && + ESourceElementCategories.N_WITH !== oSourceElementData.nCategory && + ESourceElementCategories.N_EVAL !== oSourceElementData.nCategory; + aSourceElementsData.push(oSourceElementData); + } + if (bIsWhollyExaminable) { // Examine the whole scope. + fExamineSourceElements( + nAfterDirectivePrologue, + oSourceElements.length - 1, + false); + } else { // Examine unexcluded ranges of source elements. + for (nPosition = oSourceElements.length - 1; + nPosition >= nAfterDirectivePrologue; + nPosition -= 1) { + oSourceElementData = (/** @type {!TSourceElementsData} */ + aSourceElementsData[nPosition]); + if (ESourceElementCategories.N_OTHER === + oSourceElementData.nCategory) { + if ('undefined' === typeof nTo) { + nTo = nPosition; // Indicate the end of a range. + } + // Examine the range if it immediately follows a Directive Prologue. + if (nPosition === nAfterDirectivePrologue) { + fExamineSourceElements(nPosition, nTo, true); + } + } else { + if ('undefined' !== typeof nTo) { + // Examine the range that immediately follows this source element. + fExamineSourceElements(nPosition + 1, nTo, true); + nTo = void 0; // Obliterate the range. + } + // Examine nested functions. + oWalker = oProcessor.ast_walker(); + oWalker.with_walkers( + oWalkers.oExamineFunctions, + cContext(oWalker, oSourceElements[nPosition])); + } + } + } + }(oAbstractSyntaxTree = oProcessor.ast_add_scope(oAbstractSyntaxTree))); + return oAbstractSyntaxTree; +}; +/*jshint sub:false */ + + +if (require.main === module) { + (function() { + 'use strict'; + /*jshint bitwise:true, curly:true, eqeqeq:true, forin:true, immed:true, + latedef:true, newcap:true, noarge:true, noempty:true, nonew:true, + onevar:true, plusplus:true, regexp:true, undef:true, strict:true, + sub:false, trailing:true */ + + var _, + /** + * NodeJS module for unit testing. + * @namespace + * @type {!TAssert} + * @see http://nodejs.org/docs/v0.6.10/api/all.html#assert + */ + oAssert = (/** @type {!TAssert} */ require('assert')), + /** + * The parser of ECMA-262 found in UglifyJS. + * @namespace + * @type {!TParser} + */ + oParser = (/** @type {!TParser} */ require('./parse-js')), + /** + * The processor of ASTs + * found in UglifyJS. + * @namespace + * @type {!TProcessor} + */ + oProcessor = (/** @type {!TProcessor} */ require('./process')), + /** + * An instance of an object that allows the traversal of an AST. + * @type {!TWalker} + */ + oWalker, + /** + * A collection of functions for the removal of the scope information + * during the traversal of an AST. + * @namespace + * @type {!Object.} + */ + oWalkersPurifiers = { + /**#nocode+*/ // JsDoc Toolkit 2.4.0 hides some of the keys. + /** + * Deletes the scope information from the branch of the abstract + * syntax tree representing the encountered function declaration. + * @param {string} sIdentifier The identifier of the function. + * @param {!Array.} aFormalParameterList Formal parameters. + * @param {!TSyntacticCodeUnit} oFunctionBody Function code. + */ + 'defun': function( + sIdentifier, + aFormalParameterList, + oFunctionBody) { + delete oFunctionBody.scope; + }, + /** + * Deletes the scope information from the branch of the abstract + * syntax tree representing the encountered function expression. + * @param {?string} sIdentifier The optional identifier of the + * function. + * @param {!Array.} aFormalParameterList Formal parameters. + * @param {!TSyntacticCodeUnit} oFunctionBody Function code. + */ + 'function': function( + sIdentifier, + aFormalParameterList, + oFunctionBody) { + delete oFunctionBody.scope; + } + /**#nocode-*/ // JsDoc Toolkit 2.4.0 hides some of the keys. + }, + /** + * Initiates the traversal of a source element. + * @param {!TWalker} oWalker An instance of an object that allows the + * traversal of an abstract syntax tree. + * @param {!TSyntacticCodeUnit} oSourceElement A source element from + * which the traversal should commence. + * @return {function(): !TSyntacticCodeUnit} A function that is able to + * initiate the traversal from a given source element. + */ + cContext = function(oWalker, oSourceElement) { + /** + * @return {!TSyntacticCodeUnit} A function that is able to + * initiate the traversal from a given source element. + */ + var fLambda = function() { + return oWalker.walk(oSourceElement); + }; + + return fLambda; + }, + /** + * A record consisting of configuration for the code generation phase. + * @type {!Object} + */ + oCodeGenerationOptions = { + beautify: true + }, + /** + * Tests whether consolidation of an ECMAScript program yields expected + * results. + * @param {{ + * sTitle: string, + * sInput: string, + * sOutput: string + * }} oUnitTest A record consisting of data about a unit test: its + * name, an ECMAScript program, and, if consolidation is to take + * place, the resulting ECMAScript program. + */ + cAssert = function(oUnitTest) { + var _, + /** + * An array-like object representing the AST obtained after consolidation. + * @type {!TSyntacticCodeUnit} + */ + oSyntacticCodeUnitActual = + exports.ast_consolidate(oParser.parse(oUnitTest.sInput)), + /** + * An array-like object representing the expected AST. + * @type {!TSyntacticCodeUnit} + */ + oSyntacticCodeUnitExpected = oParser.parse( + oUnitTest.hasOwnProperty('sOutput') ? + oUnitTest.sOutput : oUnitTest.sInput); + + delete oSyntacticCodeUnitActual.scope; + oWalker = oProcessor.ast_walker(); + oWalker.with_walkers( + oWalkersPurifiers, + cContext(oWalker, oSyntacticCodeUnitActual)); + try { + oAssert.deepEqual( + oSyntacticCodeUnitActual, + oSyntacticCodeUnitExpected); + } catch (oException) { + console.error( + '########## A unit test has failed.\n' + + oUnitTest.sTitle + '\n' + + '##### actual code (' + + oProcessor.gen_code(oSyntacticCodeUnitActual).length + + ' bytes)\n' + + oProcessor.gen_code( + oSyntacticCodeUnitActual, + oCodeGenerationOptions) + '\n' + + '##### expected code (' + + oProcessor.gen_code(oSyntacticCodeUnitExpected).length + + ' bytes)\n' + + oProcessor.gen_code( + oSyntacticCodeUnitExpected, + oCodeGenerationOptions)); + } + }; + + [ + // 7.6.1 Reserved Words. + { + sTitle: + 'Omission of keywords while choosing an identifier name.', + sInput: + '(function() {' + + ' var 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,' + + ' 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,' + + ' $, _,' + + ' aa, ab, ac, ad, ae, af, ag, ah, ai, aj, ak, al, am,' + + ' an, ao, ap, aq, ar, as, at, au, av, aw, ax, ay, az,' + + ' aA, aB, aC, aD, aE, aF, aG, aH, aI, aJ, aK, aL, aM,' + + ' aN, aO, aP, aQ, aR, aS, aT, aU, aV, aW, aX, aY, aZ,' + + ' a$, a_,' + + ' ba, bb, bc, bd, be, bf, bg, bh, bi, bj, bk, bl, bm,' + + ' bn, bo, bp, bq, br, bs, bt, bu, bv, bw, bx, by, bz,' + + ' bA, bB, bC, bD, bE, bF, bG, bH, bI, bJ, bK, bL, bM,' + + ' bN, bO, bP, bQ, bR, bS, bT, bU, bV, bW, bX, bY, bZ,' + + ' b$, b_,' + + ' ca, cb, cc, cd, ce, cf, cg, ch, ci, cj, ck, cl, cm,' + + ' cn, co, cp, cq, cr, cs, ct, cu, cv, cw, cx, cy, cz,' + + ' cA, cB, cC, cD, cE, cF, cG, cH, cI, cJ, cK, cL, cM,' + + ' cN, cO, cP, cQ, cR, cS, cT, cU, cV, cW, cX, cY, cZ,' + + ' c$, c_,' + + ' da, db, dc, dd, de, df, dg, dh, di, dj, dk, dl, dm,' + + ' dn, dq, dr, ds, dt, du, dv, dw, dx, dy, dz,' + + ' dA, dB, dC, dD, dE, dF, dG, dH, dI, dJ, dK, dL, dM,' + + ' dN, dO, dP, dQ, dR, dS, dT, dU, dV, dW, dX, dY, dZ,' + + ' d$, d_;' + + ' void ["abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",' + + ' "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"];' + + '}());', + sOutput: + '(function() {' + + ' var dp =' + + ' "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",' + + ' 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,' + + ' 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,' + + ' $, _,' + + ' aa, ab, ac, ad, ae, af, ag, ah, ai, aj, ak, al, am,' + + ' an, ao, ap, aq, ar, as, at, au, av, aw, ax, ay, az,' + + ' aA, aB, aC, aD, aE, aF, aG, aH, aI, aJ, aK, aL, aM,' + + ' aN, aO, aP, aQ, aR, aS, aT, aU, aV, aW, aX, aY, aZ,' + + ' a$, a_,' + + ' ba, bb, bc, bd, be, bf, bg, bh, bi, bj, bk, bl, bm,' + + ' bn, bo, bp, bq, br, bs, bt, bu, bv, bw, bx, by, bz,' + + ' bA, bB, bC, bD, bE, bF, bG, bH, bI, bJ, bK, bL, bM,' + + ' bN, bO, bP, bQ, bR, bS, bT, bU, bV, bW, bX, bY, bZ,' + + ' b$, b_,' + + ' ca, cb, cc, cd, ce, cf, cg, ch, ci, cj, ck, cl, cm,' + + ' cn, co, cp, cq, cr, cs, ct, cu, cv, cw, cx, cy, cz,' + + ' cA, cB, cC, cD, cE, cF, cG, cH, cI, cJ, cK, cL, cM,' + + ' cN, cO, cP, cQ, cR, cS, cT, cU, cV, cW, cX, cY, cZ,' + + ' c$, c_,' + + ' da, db, dc, dd, de, df, dg, dh, di, dj, dk, dl, dm,' + + ' dn, dq, dr, ds, dt, du, dv, dw, dx, dy, dz,' + + ' dA, dB, dC, dD, dE, dF, dG, dH, dI, dJ, dK, dL, dM,' + + ' dN, dO, dP, dQ, dR, dS, dT, dU, dV, dW, dX, dY, dZ,' + + ' d$, d_;' + + ' void [dp, dp];' + + '}());' + }, + // 7.8.1 Null Literals. + { + sTitle: + 'Evaluation with regard to the null value.', + sInput: + '/*jshint evil:true */' + + '(function() {' + + ' var foo;' + + ' void [null, null, null];' + + '}());' + + 'eval("");' + + '(function() {' + + ' var foo;' + + ' void [null, null];' + + '}());', + sOutput: + '/*jshint evil:true */' + + '(function() {' + + ' var a = null, foo;' + + ' void [a, a, a];' + + '}());' + + 'eval("");' + + '(function() {' + + ' var foo;' + + ' void [null, null];' + + '}());' + }, + // 7.8.2 Boolean Literals. + { + sTitle: + 'Evaluation with regard to the false value.', + sInput: + '/*jshint evil:true */' + + '(function() {' + + ' var foo;' + + ' void [false, false, false];' + + '}());' + + 'eval("");' + + '(function() {' + + ' var foo;' + + ' void [false, false];' + + '}());', + sOutput: + '/*jshint evil:true */' + + '(function() {' + + ' var a = false, foo;' + + ' void [a, a, a];' + + '}());' + + 'eval("");' + + '(function() {' + + ' var foo;' + + ' void [false, false];' + + '}());' + }, + { + sTitle: + 'Evaluation with regard to the true value.', + sInput: + '/*jshint evil:true */' + + '(function() {' + + ' var foo;' + + ' void [true, true, true];' + + '}());' + + 'eval("");' + + '(function() {' + + ' var foo;' + + ' void [true, true];' + + '}());', + sOutput: + '/*jshint evil:true */' + + '(function() {' + + ' var a = true, foo;' + + ' void [a, a, a];' + + '}());' + + 'eval("");' + + '(function() {' + + ' var foo;' + + ' void [true, true];' + + '}());' + }, + // 7.8.4 String Literals. + { + sTitle: + 'Evaluation with regard to the String value of a string literal.', + sInput: + '(function() {' + + ' var foo;' + + ' void ["abcd", "abcd", "abc", "abc"];' + + '}());', + sOutput: + '(function() {' + + ' var a = "abcd", foo;' + + ' void [a, a, "abc", "abc"];' + + '}());' + }, + // 7.8.5 Regular Expression Literals. + { + sTitle: + 'Preservation of the pattern of a regular expression literal.', + sInput: + 'void [/abcdefghijklmnopqrstuvwxyz/, /abcdefghijklmnopqrstuvwxyz/];' + }, + { + sTitle: + 'Preservation of the flags of a regular expression literal.', + sInput: + 'void [/(?:)/gim, /(?:)/gim, /(?:)/gim, /(?:)/gim, /(?:)/gim,' + + ' /(?:)/gim, /(?:)/gim, /(?:)/gim, /(?:)/gim, /(?:)/gim,' + + ' /(?:)/gim, /(?:)/gim, /(?:)/gim, /(?:)/gim, /(?:)/gim];' + }, + // 10.2 Lexical Environments. + { + sTitle: + 'Preservation of identifier names in the same scope.', + sInput: + '/*jshint shadow:true */' + + 'var a;' + + 'function b(i) {' + + '}' + + 'for (var c; 0 === Math.random(););' + + 'for (var d in {});' + + 'void ["abcdefghijklmnopqrstuvwxyz"];' + + 'void [b(a), b(c), b(d)];' + + 'void [typeof e];' + + 'i: for (; 0 === Math.random();) {' + + ' if (42 === (new Date()).getMinutes()) {' + + ' continue i;' + + ' } else {' + + ' break i;' + + ' }' + + '}' + + 'try {' + + '} catch (f) {' + + '} finally {' + + '}' + + '(function g(h) {' + + '}());' + + 'void [{' + + ' i: 42,' + + ' "j": 42,' + + ' \'k\': 42' + + '}];' + + 'void ["abcdefghijklmnopqrstuvwxyz"];', + sOutput: + '/*jshint shadow:true */' + + 'var a;' + + 'function b(i) {' + + '}' + + 'for (var c; 0 === Math.random(););' + + 'for (var d in {});' + + '(function() {' + + ' var i = "abcdefghijklmnopqrstuvwxyz";' + + ' void [i];' + + ' void [b(a), b(c), b(d)];' + + ' void [typeof e];' + + ' i: for (; 0 === Math.random();) {' + + ' if (42 === (new Date()).getMinutes()) {' + + ' continue i;' + + ' } else {' + + ' break i;' + + ' }' + + ' }' + + ' try {' + + ' } catch (f) {' + + ' } finally {' + + ' }' + + ' (function g(h) {' + + ' }());' + + ' void [{' + + ' i: 42,' + + ' "j": 42,' + + ' \'k\': 42' + + ' }];' + + ' void [i];' + + '}());' + }, + { + sTitle: + 'Preservation of identifier names in nested function code.', + sInput: + '(function() {' + + ' void ["abcdefghijklmnopqrstuvwxyz"];' + + ' (function() {' + + ' var a;' + + ' for (var b; 0 === Math.random(););' + + ' for (var c in {});' + + ' void [typeof d];' + + ' h: for (; 0 === Math.random();) {' + + ' if (42 === (new Date()).getMinutes()) {' + + ' continue h;' + + ' } else {' + + ' break h;' + + ' }' + + ' }' + + ' try {' + + ' } catch (e) {' + + ' } finally {' + + ' }' + + ' (function f(g) {' + + ' }());' + + ' void [{' + + ' h: 42,' + + ' "i": 42,' + + ' \'j\': 42' + + ' }];' + + ' }());' + + ' void ["abcdefghijklmnopqrstuvwxyz"];' + + '}());', + sOutput: + '(function() {' + + ' var h = "abcdefghijklmnopqrstuvwxyz";' + + ' void [h];' + + ' (function() {' + + ' var a;' + + ' for (var b; 0 === Math.random(););' + + ' for (var c in {});' + + ' void [typeof d];' + + ' h: for (; 0 === Math.random();) {' + + ' if (42 === (new Date()).getMinutes()) {' + + ' continue h;' + + ' } else {' + + ' break h;' + + ' }' + + ' }' + + ' try {' + + ' } catch (e) {' + + ' } finally {' + + ' }' + + ' (function f(g) {' + + ' }());' + + ' void [{' + + ' h: 42,' + + ' "i": 42,' + + ' \'j\': 42' + + ' }];' + + ' }());' + + ' void [h];' + + '}());' + }, + { + sTitle: + 'Consolidation of a closure with other source elements.', + sInput: + '(function(foo) {' + + '}("abcdefghijklmnopqrstuvwxyz"));' + + 'void ["abcdefghijklmnopqrstuvwxyz"];', + sOutput: + '(function() {' + + ' var a = "abcdefghijklmnopqrstuvwxyz";' + + ' (function(foo) {' + + ' })(a);' + + ' void [a];' + + '}());' + }, + { + sTitle: + 'Consolidation of function code instead of a sole closure.', + sInput: + '(function(foo, bar) {' + + ' void ["abcdefghijklmnopqrstuvwxyz",' + + ' "abcdefghijklmnopqrstuvwxyz"];' + + '}("abcdefghijklmnopqrstuvwxyz", "abcdefghijklmnopqrstuvwxyz"));', + sOutput: + '(function(foo, bar) {' + + ' var a = "abcdefghijklmnopqrstuvwxyz";' + + ' void [a, a];' + + '}("abcdefghijklmnopqrstuvwxyz", "abcdefghijklmnopqrstuvwxyz"));' + }, + // 11.1.5 Object Initialiser. + { + sTitle: + 'Preservation of property names of an object initialiser.', + sInput: + 'var foo = {' + + ' abcdefghijklmnopqrstuvwxyz: 42,' + + ' "zyxwvutsrqponmlkjihgfedcba": 42,' + + ' \'mlkjihgfedcbanopqrstuvwxyz\': 42' + + '};' + + 'void [' + + ' foo.abcdefghijklmnopqrstuvwxyz,' + + ' "zyxwvutsrqponmlkjihgfedcba",' + + ' \'mlkjihgfedcbanopqrstuvwxyz\'' + + '];' + }, + { + sTitle: + 'Evaluation with regard to String values derived from identifier ' + + 'names used as property accessors.', + sInput: + '(function() {' + + ' var foo;' + + ' void [' + + ' Math.abcdefghij,' + + ' Math.abcdefghij,' + + ' Math.abcdefghi,' + + ' Math.abcdefghi' + + ' ];' + + '}());', + sOutput: + '(function() {' + + ' var a = "abcdefghij", foo;' + + ' void [' + + ' Math[a],' + + ' Math[a],' + + ' Math.abcdefghi,' + + ' Math.abcdefghi' + + ' ];' + + '}());' + }, + // 11.2.1 Property Accessors. + { + sTitle: + 'Preservation of identifiers in the nonterminal MemberExpression.', + sInput: + 'void [' + + ' Math.E,' + + ' Math.LN10,' + + ' Math.LN2,' + + ' Math.LOG2E,' + + ' Math.LOG10E,' + + ' Math.PI,' + + ' Math.SQRT1_2,' + + ' Math.SQRT2,' + + ' Math.abs,' + + ' Math.acos' + + '];' + }, + // 12.2 Variable Statement. + { + sTitle: + 'Preservation of the identifier of a variable that is being ' + + 'declared in a variable statement.', + sInput: + '(function() {' + + ' var abcdefghijklmnopqrstuvwxyz;' + + ' void [abcdefghijklmnopqrstuvwxyz];' + + '}());' + }, + { + sTitle: + 'Exclusion of a variable statement in global code.', + sInput: + 'void ["abcdefghijklmnopqrstuvwxyz"];' + + 'var foo = "abcdefghijklmnopqrstuvwxyz",' + + ' bar = "abcdefghijklmnopqrstuvwxyz";' + + 'void ["abcdefghijklmnopqrstuvwxyz"];' + }, + { + sTitle: + 'Exclusion of a variable statement in function code that ' + + 'contains a with statement.', + sInput: + '(function() {' + + ' with ({});' + + ' void ["abcdefghijklmnopqrstuvwxyz"];' + + ' var foo;' + + ' void ["abcdefghijklmnopqrstuvwxyz"];' + + '}());' + }, + { + sTitle: + 'Exclusion of a variable statement in function code that ' + + 'contains a direct call to the eval function.', + sInput: + '/*jshint evil:true */' + + 'void [' + + ' function() {' + + ' eval("");' + + ' void ["abcdefghijklmnopqrstuvwxyz"];' + + ' var foo;' + + ' void ["abcdefghijklmnopqrstuvwxyz"];' + + ' }' + + '];' + }, + { + sTitle: + 'Consolidation within a variable statement in global code.', + sInput: + 'var foo = function() {' + + ' void ["abcdefghijklmnopqrstuvwxyz",' + + ' "abcdefghijklmnopqrstuvwxyz"];' + + '};', + sOutput: + 'var foo = function() {' + + ' var a = "abcdefghijklmnopqrstuvwxyz";' + + ' void [a, a];' + + '};' + }, + { + sTitle: + 'Consolidation within a variable statement excluded in function ' + + 'code due to the presence of a with statement.', + sInput: + '(function() {' + + ' with ({});' + + ' var foo = function() {' + + ' void ["abcdefghijklmnopqrstuvwxyz",' + + ' "abcdefghijklmnopqrstuvwxyz"];' + + ' };' + + '}());', + sOutput: + '(function() {' + + ' with ({});' + + ' var foo = function() {' + + ' var a = "abcdefghijklmnopqrstuvwxyz";' + + ' void [a, a];' + + ' };' + + '}());' + }, + { + sTitle: + 'Consolidation within a variable statement excluded in function ' + + 'code due to the presence of a direct call to the eval function.', + sInput: + '/*jshint evil:true */' + + '(function() {' + + ' eval("");' + + ' var foo = function() {' + + ' void ["abcdefghijklmnopqrstuvwxyz",' + + ' "abcdefghijklmnopqrstuvwxyz"];' + + ' };' + + '}());', + sOutput: + '/*jshint evil:true */' + + '(function() {' + + ' eval("");' + + ' var foo = function() {' + + ' var a = "abcdefghijklmnopqrstuvwxyz";' + + ' void [a, a];' + + ' };' + + '}());' + }, + { + sTitle: + 'Inclusion of a variable statement in function code that ' + + 'contains no with statement and no direct call to the eval ' + + 'function.', + sInput: + '(function() {' + + ' void ["abcdefghijklmnopqrstuvwxyz"];' + + ' var foo;' + + ' void ["abcdefghijklmnopqrstuvwxyz"];' + + '}());', + sOutput: + '(function() {' + + ' var a = "abcdefghijklmnopqrstuvwxyz";' + + ' void [a];' + + ' var foo;' + + ' void [a];' + + '}());' + }, + { + sTitle: + 'Ignorance with regard to a variable statement in global code.', + sInput: + 'var foo = "abcdefghijklmnopqrstuvwxyz";' + + 'void ["abcdefghijklmnopqrstuvwxyz",' + + ' "abcdefghijklmnopqrstuvwxyz"];', + sOutput: + 'var foo = "abcdefghijklmnopqrstuvwxyz";' + + '(function() {' + + ' var a = "abcdefghijklmnopqrstuvwxyz";' + + ' void [a, a];' + + '}());' + }, + // 12.4 Expression Statement. + { + sTitle: + 'Preservation of identifiers in an expression statement.', + sInput: + 'void [typeof abcdefghijklmnopqrstuvwxyz,' + + ' typeof abcdefghijklmnopqrstuvwxyz];' + }, + // 12.6.3 The {@code for} Statement. + { + sTitle: + 'Preservation of identifiers in the variable declaration list of ' + + 'a for statement.', + sInput: + 'for (var abcdefghijklmnopqrstuvwxyz; 0 === Math.random(););' + + 'for (var abcdefghijklmnopqrstuvwxyz; 0 === Math.random(););' + }, + // 12.6.4 The {@code for-in} Statement. + { + sTitle: + 'Preservation of identifiers in the variable declaration list of ' + + 'a for-in statement.', + sInput: + 'for (var abcdefghijklmnopqrstuvwxyz in {});' + + 'for (var abcdefghijklmnopqrstuvwxyz in {});' + }, + // 12.7 The {@code continue} Statement. + { + sTitle: + 'Preservation of the identifier in a continue statement.', + sInput: + 'abcdefghijklmnopqrstuvwxyz: for (; 0 === Math.random();) {' + + ' continue abcdefghijklmnopqrstuvwxyz;' + + '}' + + 'abcdefghijklmnopqrstuvwxyz: for (; 0 === Math.random();) {' + + ' continue abcdefghijklmnopqrstuvwxyz;' + + '}' + }, + // 12.8 The {@code break} Statement. + { + sTitle: + 'Preservation of the identifier in a break statement.', + sInput: + 'abcdefghijklmnopqrstuvwxyz: for (; 0 === Math.random();) {' + + ' break abcdefghijklmnopqrstuvwxyz;' + + '}' + + 'abcdefghijklmnopqrstuvwxyz: for (; 0 === Math.random();) {' + + ' break abcdefghijklmnopqrstuvwxyz;' + + '}' + }, + // 12.9 The {@code return} Statement. + { + sTitle: + 'Exclusion of a return statement in function code that contains ' + + 'a with statement.', + sInput: + '(function() {' + + ' with ({});' + + ' void ["abcdefghijklmnopqrstuvwxyz"];' + + ' if (0 === Math.random()) {' + + ' return;' + + ' } else {' + + ' }' + + ' void ["abcdefghijklmnopqrstuvwxyz"];' + + '}());' + }, + { + sTitle: + 'Exclusion of a return statement in function code that contains ' + + 'a direct call to the eval function.', + sInput: + '/*jshint evil:true */' + + '(function() {' + + ' eval("");' + + ' void ["abcdefghijklmnopqrstuvwxyz"];' + + ' if (0 === Math.random()) {' + + ' return;' + + ' } else {' + + ' }' + + ' void ["abcdefghijklmnopqrstuvwxyz"];' + + '}());' + }, + { + sTitle: + 'Consolidation within a return statement excluded in function ' + + 'code due to the presence of a with statement.', + sInput: + '(function() {' + + ' with ({});' + + ' return function() {' + + ' void ["abcdefghijklmnopqrstuvwxyz",' + + ' "abcdefghijklmnopqrstuvwxyz"];' + + ' };' + + '}());', + sOutput: + '(function() {' + + ' with ({});' + + ' return function() {' + + ' var a = "abcdefghijklmnopqrstuvwxyz";' + + ' void [a, a];' + + ' };' + + '}());' + }, + { + sTitle: + 'Consolidation within a return statement excluded in function ' + + 'code due to the presence of a direct call to the eval function.', + sInput: + '/*jshint evil:true */' + + '(function() {' + + ' eval("");' + + ' return function() {' + + ' void ["abcdefghijklmnopqrstuvwxyz",' + + ' "abcdefghijklmnopqrstuvwxyz"];' + + ' };' + + '}());', + sOutput: + '/*jshint evil:true */' + + '(function() {' + + ' eval("");' + + ' return function() {' + + ' var a = "abcdefghijklmnopqrstuvwxyz";' + + ' void [a, a];' + + ' };' + + '}());' + }, + { + sTitle: + 'Inclusion of a return statement in function code that contains ' + + 'no with statement and no direct call to the eval function.', + sInput: + '(function() {' + + ' void ["abcdefghijklmnopqrstuvwxyz"];' + + ' if (0 === Math.random()) {' + + ' return;' + + ' } else {' + + ' }' + + ' void ["abcdefghijklmnopqrstuvwxyz"];' + + '}());', + sOutput: + '(function() {' + + ' var a = "abcdefghijklmnopqrstuvwxyz";' + + ' void [a];' + + ' if (0 === Math.random()) {' + + ' return;' + + ' } else {' + + ' }' + + ' void [a];' + + '}());' + }, + // 12.10 The {@code with} Statement. + { + sTitle: + 'Preservation of the statement in a with statement.', + sInput: + 'with ({}) {' + + ' void ["abcdefghijklmnopqrstuvwxyz",' + + ' "abcdefghijklmnopqrstuvwxyz"];' + + '}' + }, + { + sTitle: + 'Exclusion of a with statement in the same syntactic code unit.', + sInput: + 'void ["abcdefghijklmnopqrstuvwxyz"];' + + 'with ({' + + ' foo: "abcdefghijklmnopqrstuvwxyz",' + + ' bar: "abcdefghijklmnopqrstuvwxyz"' + + '}) {' + + ' void ["abcdefghijklmnopqrstuvwxyz",' + + ' "abcdefghijklmnopqrstuvwxyz"];' + + '}' + + 'void ["abcdefghijklmnopqrstuvwxyz"];' + }, + { + sTitle: + 'Exclusion of a with statement in nested function code.', + sInput: + 'void ["abcdefghijklmnopqrstuvwxyz"];' + + '(function() {' + + ' with ({' + + ' foo: "abcdefghijklmnopqrstuvwxyz",' + + ' bar: "abcdefghijklmnopqrstuvwxyz"' + + ' }) {' + + ' void ["abcdefghijklmnopqrstuvwxyz",' + + ' "abcdefghijklmnopqrstuvwxyz"];' + + ' }' + + '}());' + + 'void ["abcdefghijklmnopqrstuvwxyz"];' + }, + // 12.12 Labelled Statements. + { + sTitle: + 'Preservation of the label of a labelled statement.', + sInput: + 'abcdefghijklmnopqrstuvwxyz: for (; 0 === Math.random(););' + + 'abcdefghijklmnopqrstuvwxyz: for (; 0 === Math.random(););' + }, + // 12.14 The {@code try} Statement. + { + sTitle: + 'Preservation of the identifier in the catch clause of a try' + + 'statement.', + sInput: + 'try {' + + '} catch (abcdefghijklmnopqrstuvwxyz) {' + + '} finally {' + + '}' + + 'try {' + + '} catch (abcdefghijklmnopqrstuvwxyz) {' + + '} finally {' + + '}' + }, + // 13 Function Definition. + { + sTitle: + 'Preservation of the identifier of a function declaration.', + sInput: + 'function abcdefghijklmnopqrstuvwxyz() {' + + '}' + + 'void [abcdefghijklmnopqrstuvwxyz];' + }, + { + sTitle: + 'Preservation of the identifier of a function expression.', + sInput: + 'void [' + + ' function abcdefghijklmnopqrstuvwxyz() {' + + ' },' + + ' function abcdefghijklmnopqrstuvwxyz() {' + + ' }' + + '];' + }, + { + sTitle: + 'Preservation of a formal parameter of a function declaration.', + sInput: + 'function foo(abcdefghijklmnopqrstuvwxyz) {' + + '}' + + 'function bar(abcdefghijklmnopqrstuvwxyz) {' + + '}' + }, + { + sTitle: + 'Preservation of a formal parameter in a function expression.', + sInput: + 'void [' + + ' function(abcdefghijklmnopqrstuvwxyz) {' + + ' },' + + ' function(abcdefghijklmnopqrstuvwxyz) {' + + ' }' + + '];' + }, + { + sTitle: + 'Exclusion of a function declaration.', + sInput: + 'void ["abcdefghijklmnopqrstuvwxyz"];' + + 'function foo() {' + + '}' + + 'void ["abcdefghijklmnopqrstuvwxyz"];' + }, + { + sTitle: + 'Consolidation within a function declaration.', + sInput: + 'function foo() {' + + ' void ["abcdefghijklmnopqrstuvwxyz",' + + ' "abcdefghijklmnopqrstuvwxyz"];' + + '}', + sOutput: + 'function foo() {' + + ' var a = "abcdefghijklmnopqrstuvwxyz";' + + ' void [a, a];' + + '}' + }, + // 14 Program. + { + sTitle: + 'Preservation of a program without source elements.', + sInput: + '' + }, + // 14.1 Directive Prologues and the Use Strict Directive. + { + sTitle: + 'Preservation of a Directive Prologue in global code.', + sInput: + '"abcdefghijklmnopqrstuvwxyz";' + + '\'zyxwvutsrqponmlkjihgfedcba\';' + }, + { + sTitle: + 'Preservation of a Directive Prologue in a function declaration.', + sInput: + 'function foo() {' + + ' "abcdefghijklmnopqrstuvwxyz";' + + ' \'zyxwvutsrqponmlkjihgfedcba\';' + + '}' + }, + { + sTitle: + 'Preservation of a Directive Prologue in a function expression.', + sInput: + 'void [' + + ' function() {' + + ' "abcdefghijklmnopqrstuvwxyz";' + + ' \'zyxwvutsrqponmlkjihgfedcba\';' + + ' }' + + '];' + }, + { + sTitle: + 'Ignorance with regard to a Directive Prologue in global code.', + sInput: + '"abcdefghijklmnopqrstuvwxyz";' + + 'void ["abcdefghijklmnopqrstuvwxyz",' + + ' "abcdefghijklmnopqrstuvwxyz"];', + sOutput: + '"abcdefghijklmnopqrstuvwxyz";' + + '(function() {' + + ' var a = "abcdefghijklmnopqrstuvwxyz";' + + ' void [a, a];' + + '}());' + }, + { + sTitle: + 'Ignorance with regard to a Directive Prologue in a function' + + 'declaration.', + sInput: + 'function foo() {' + + ' "abcdefghijklmnopqrstuvwxyz";' + + ' void ["abcdefghijklmnopqrstuvwxyz",' + + ' "abcdefghijklmnopqrstuvwxyz"];' + + '}', + sOutput: + 'function foo() {' + + ' "abcdefghijklmnopqrstuvwxyz";' + + ' var a = "abcdefghijklmnopqrstuvwxyz";' + + ' void [a, a];' + + '}' + }, + { + sTitle: + 'Ignorance with regard to a Directive Prologue in a function' + + 'expression.', + sInput: + '(function() {' + + ' "abcdefghijklmnopqrstuvwxyz";' + + ' void ["abcdefghijklmnopqrstuvwxyz",' + + ' "abcdefghijklmnopqrstuvwxyz"];' + + '}());', + sOutput: + '(function() {' + + ' "abcdefghijklmnopqrstuvwxyz";' + + ' var a = "abcdefghijklmnopqrstuvwxyz";' + + ' void [a, a];' + + '}());' + }, + // 15.1 The Global Object. + { + sTitle: + 'Preservation of a property of the global object.', + sInput: + 'void [undefined, undefined, undefined, undefined, undefined];' + }, + // 15.1.2.1.1 Direct Call to Eval. + { + sTitle: + 'Exclusion of a direct call to the eval function in the same ' + + 'syntactic code unit.', + sInput: + '/*jshint evil:true */' + + 'void ["abcdefghijklmnopqrstuvwxyz"];' + + 'eval("");' + + 'void ["abcdefghijklmnopqrstuvwxyz"];' + }, + { + sTitle: + 'Exclusion of a direct call to the eval function in nested ' + + 'function code.', + sInput: + '/*jshint evil:true */' + + 'void ["abcdefghijklmnopqrstuvwxyz"];' + + '(function() {' + + ' eval("");' + + '}());' + + 'void ["abcdefghijklmnopqrstuvwxyz"];' + }, + { + sTitle: + 'Consolidation within a direct call to the eval function.', + sInput: + '/*jshint evil:true */' + + 'eval(function() {' + + ' void ["abcdefghijklmnopqrstuvwxyz",' + + ' "abcdefghijklmnopqrstuvwxyz"];' + + '}());', + sOutput: + '/*jshint evil:true */' + + 'eval(function() {' + + ' var a = "abcdefghijklmnopqrstuvwxyz";' + + ' void [a, a];' + + '}());' + }, + // Consolidation proper. + { + sTitle: + 'No consolidation if it does not result in a reduction of the ' + + 'number of source characters.', + sInput: + '(function() {' + + ' var foo;' + + ' void ["ab", "ab", "abc", "abc"];' + + '}());' + }, + { + sTitle: + 'Identification of a range of source elements at the beginning ' + + 'of global code.', + sInput: + '/*jshint evil:true */' + + '"abcdefghijklmnopqrstuvwxyz";' + + 'void ["abcdefghijklmnopqrstuvwxyz",' + + ' "abcdefghijklmnopqrstuvwxyz"];' + + 'eval("");', + sOutput: + '/*jshint evil:true */' + + '"abcdefghijklmnopqrstuvwxyz";' + + '(function() {' + + ' var a = "abcdefghijklmnopqrstuvwxyz";' + + ' void [a, a];' + + '}());' + + 'eval("");' + }, + { + sTitle: + 'Identification of a range of source elements in the middle of ' + + 'global code.', + sInput: + '/*jshint evil:true */' + + '"abcdefghijklmnopqrstuvwxyz";' + + 'eval("");' + + 'void ["abcdefghijklmnopqrstuvwxyz",' + + ' "abcdefghijklmnopqrstuvwxyz"];' + + 'eval("");', + sOutput: + '/*jshint evil:true */' + + '"abcdefghijklmnopqrstuvwxyz";' + + 'eval("");' + + '(function() {' + + ' var a = "abcdefghijklmnopqrstuvwxyz";' + + ' void [a, a];' + + '}());' + + 'eval("");' + }, + { + sTitle: + 'Identification of a range of source elements at the end of ' + + 'global code.', + sInput: + '/*jshint evil:true */' + + '"abcdefghijklmnopqrstuvwxyz";' + + 'eval("");' + + 'void ["abcdefghijklmnopqrstuvwxyz",' + + ' "abcdefghijklmnopqrstuvwxyz"];', + sOutput: + '/*jshint evil:true */' + + '"abcdefghijklmnopqrstuvwxyz";' + + 'eval("");' + + '(function() {' + + ' var a = "abcdefghijklmnopqrstuvwxyz";' + + ' void [a, a];' + + '}());' + }, + { + sTitle: + 'Identification of a range of source elements at the beginning ' + + 'of function code.', + sInput: + '/*jshint evil:true */' + + '(function() {' + + ' "abcdefghijklmnopqrstuvwxyz";' + + ' void ["abcdefghijklmnopqrstuvwxyz",' + + ' "abcdefghijklmnopqrstuvwxyz"];' + + ' eval("");' + + '}());', + sOutput: + '/*jshint evil:true */' + + '(function() {' + + ' "abcdefghijklmnopqrstuvwxyz";' + + ' (function() {' + + ' var a = "abcdefghijklmnopqrstuvwxyz";' + + ' void [a, a];' + + ' }());' + + ' eval("");' + + '}());' + }, + { + sTitle: + 'Identification of a range of source elements in the middle of ' + + 'function code.', + sInput: + '/*jshint evil:true */' + + '(function() {' + + ' "abcdefghijklmnopqrstuvwxyz";' + + ' eval("");' + + ' void ["abcdefghijklmnopqrstuvwxyz",' + + ' "abcdefghijklmnopqrstuvwxyz"];' + + ' eval("");' + + '}());', + sOutput: + '/*jshint evil:true */' + + '(function() {' + + ' "abcdefghijklmnopqrstuvwxyz";' + + ' eval("");' + + ' (function() {' + + ' var a = "abcdefghijklmnopqrstuvwxyz";' + + ' void [a, a];' + + ' }());' + + ' eval("");' + + '}());' + }, + { + sTitle: + 'Identification of a range of source elements at the end of ' + + 'function code.', + sInput: + '/*jshint evil:true */' + + '(function() {' + + ' "abcdefghijklmnopqrstuvwxyz";' + + ' eval("");' + + ' void ["abcdefghijklmnopqrstuvwxyz",' + + ' "abcdefghijklmnopqrstuvwxyz"];' + + '}());', + sOutput: + '/*jshint evil:true */' + + '(function() {' + + ' "abcdefghijklmnopqrstuvwxyz";' + + ' eval("");' + + ' (function() {' + + ' var a = "abcdefghijklmnopqrstuvwxyz";' + + ' void [a, a];' + + ' }());' + + '}());' + }, + { + sTitle: + 'Evaluation with regard to String values of String literals and ' + + 'String values derived from identifier names used as property' + + 'accessors.', + sInput: + '(function() {' + + ' var foo;' + + ' void ["abcdefg", Math.abcdefg, "abcdef", Math.abcdef];' + + '}());', + sOutput: + '(function() {' + + ' var a = "abcdefg", foo;' + + ' void [a, Math[a], "abcdef", Math.abcdef];' + + '}());' + }, + { + sTitle: + 'Evaluation with regard to the necessity of adding a variable ' + + 'statement.', + sInput: + '/*jshint evil:true */' + + '(function() {' + + ' void ["abcdefgh", "abcdefgh"];' + + '}());' + + 'eval("");' + + '(function() {' + + ' void ["abcdefg", "abcdefg"];' + + '}());' + + 'eval("");' + + '(function() {' + + ' var foo;' + + ' void ["abcd", "abcd"];' + + '}());', + sOutput: + '/*jshint evil:true */' + + '(function() {' + + ' var a = "abcdefgh";' + + ' void [a, a];' + + '}());' + + 'eval("");' + + '(function() {' + + ' void ["abcdefg", "abcdefg"];' + + '}());' + + 'eval("");' + + '(function() {' + + ' var a = "abcd", foo;' + + ' void [a, a];' + + '}());' + }, + { + sTitle: + 'Evaluation with regard to the necessity of enclosing source ' + + 'elements.', + sInput: + '/*jshint evil:true */' + + 'void ["abcdefghijklmnopqrstuvwxy", "abcdefghijklmnopqrstuvwxy"];' + + 'eval("");' + + 'void ["abcdefghijklmnopqrstuvwx", "abcdefghijklmnopqrstuvwx"];' + + 'eval("");' + + '(function() {' + + ' void ["abcdefgh", "abcdefgh"];' + + '}());' + + '(function() {' + + ' void ["abcdefghijklmnopqrstuvwxy",' + + ' "abcdefghijklmnopqrstuvwxy"];' + + ' eval("");' + + ' void ["abcdefghijklmnopqrstuvwx",' + + ' "abcdefghijklmnopqrstuvwx"];' + + ' eval("");' + + ' (function() {' + + ' void ["abcdefgh", "abcdefgh"];' + + ' }());' + + '}());', + sOutput: + '/*jshint evil:true */' + + '(function() {' + + ' var a = "abcdefghijklmnopqrstuvwxy";' + + ' void [a, a];' + + '}());' + + 'eval("");' + + 'void ["abcdefghijklmnopqrstuvwx", "abcdefghijklmnopqrstuvwx"];' + + 'eval("");' + + '(function() {' + + ' var a = "abcdefgh";' + + ' void [a, a];' + + '}());' + + '(function() {' + + ' (function() {' + + ' var a = "abcdefghijklmnopqrstuvwxy";' + + ' void [a, a];' + + ' }());' + + ' eval("");' + + ' void ["abcdefghijklmnopqrstuvwx", "abcdefghijklmnopqrstuvwx"];' + + ' eval("");' + + ' (function() {' + + ' var a = "abcdefgh";' + + ' void [a, a];' + + ' }());' + + '}());' + }, + { + sTitle: + 'Employment of a closure while consolidating in global code.', + sInput: + 'void ["abcdefghijklmnopqrstuvwxyz",' + + ' "abcdefghijklmnopqrstuvwxyz"];', + sOutput: + '(function() {' + + ' var a = "abcdefghijklmnopqrstuvwxyz";' + + ' void [a, a];' + + '}());' + }, + { + sTitle: + 'Assignment of a shorter identifier to a value whose ' + + 'consolidation results in a greater reduction of the number of ' + + 'source characters.', + sInput: + '(function() {' + + ' var 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,' + + ' 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,' + + ' $, _;' + + ' void ["abcde", "abcde", "edcba", "edcba", "edcba"];' + + '}());', + sOutput: + '(function() {' + + ' var a = "edcba",' + + ' 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,' + + ' 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,' + + ' $, _;' + + ' void ["abcde", "abcde", a, a, a];' + + '}());' + } + ].forEach(cAssert); + }()); +} + +/* Local Variables: */ +/* mode: js */ +/* coding: utf-8 */ +/* indent-tabs-mode: nil */ +/* tab-width: 2 */ +/* End: */ +/* vim: set ft=javascript fenc=utf-8 et ts=2 sts=2 sw=2: */ +/* :mode=javascript:noTabs=true:tabSize=2:indentSize=2:deepIndent=true: */ diff --git a/build/lib/uglify-js.js b/build/lib/uglify-js.js new file mode 100644 index 00000000..3a56dec2 --- /dev/null +++ b/build/lib/uglify-js.js @@ -0,0 +1,18 @@ +//convienence function(src, [options]); +function uglify(orig_code, options){ + options || (options = {}); + var jsp = uglify.parser; + var pro = uglify.uglify; + + var ast = jsp.parse(orig_code, options.strict_semicolons); // parse code and get the initial AST + ast = pro.ast_mangle(ast, options.mangle_options); // get a new AST with mangled names + ast = pro.ast_squeeze(ast, options.squeeze_options); // get an AST with compression optimizations + var final_code = pro.gen_code(ast, options.gen_options); // compressed code here + return final_code; +}; + +uglify.parser = require("./parse-js"); +uglify.uglify = require("./process"); +uglify.consolidator = require("./consolidator"); + +module.exports = uglify \ No newline at end of file diff --git a/dist/jquery.qtip.basic.js b/dist/jquery.qtip.basic.js index 2ba229a0..cca20ea3 100644 --- a/dist/jquery.qtip.basic.js +++ b/dist/jquery.qtip.basic.js @@ -9,7 +9,7 @@ * http://en.wikipedia.org/wiki/MIT_License * http://en.wikipedia.org/wiki/GNU_General_Public_License * -* Date: Sat Mar 3 17:04:40 2012 +0000 +* Date: Sat Mar 31 19:19:39 2012 +0100 */ /*jslint browser: true, onevar: true, undef: true, nomen: true, bitwise: true, regexp: true, newcap: true, immed: true, strict: true */ @@ -1599,6 +1599,9 @@ function init(id, opts) if(config.hide.target === FALSE) { config.hide.target = newTarget; } if(config.position.viewport === TRUE) { config.position.viewport = posOptions.container; } + // Ensure we only use a single container + posOptions.container = posOptions.container.eq(0); + // Convert position corner values into x and y strings posOptions.at = new PLUGINS.Corner(posOptions.at); posOptions.my = new PLUGINS.Corner(posOptions.my); diff --git a/dist/jquery.qtip.css b/dist/jquery.qtip.css index 5f34f79a..a91c5175 100644 --- a/dist/jquery.qtip.css +++ b/dist/jquery.qtip.css @@ -9,7 +9,7 @@ * http://en.wikipedia.org/wiki/MIT_License * http://en.wikipedia.org/wiki/GNU_General_Public_License * -* Date: Sat Mar 3 17:04:40 2012 +0000 +* Date: Sat Mar 31 19:19:39 2012 +0100 */ /* Core qTip styles */ diff --git a/dist/jquery.qtip.js b/dist/jquery.qtip.js index eaa39219..1bb33cb5 100644 --- a/dist/jquery.qtip.js +++ b/dist/jquery.qtip.js @@ -9,7 +9,7 @@ * http://en.wikipedia.org/wiki/MIT_License * http://en.wikipedia.org/wiki/GNU_General_Public_License * -* Date: Sat Mar 3 17:04:40 2012 +0000 +* Date: Sat Mar 31 19:19:39 2012 +0100 */ /*jslint browser: true, onevar: true, undef: true, nomen: true, bitwise: true, regexp: true, newcap: true, immed: true, strict: true */ @@ -1599,6 +1599,9 @@ function init(id, opts) if(config.hide.target === FALSE) { config.hide.target = newTarget; } if(config.position.viewport === TRUE) { config.position.viewport = posOptions.container; } + // Ensure we only use a single container + posOptions.container = posOptions.container.eq(0); + // Convert position corner values into x and y strings posOptions.at = new PLUGINS.Corner(posOptions.at); posOptions.my = new PLUGINS.Corner(posOptions.my); diff --git a/dist/jquery.qtip.min.js b/dist/jquery.qtip.min.js index af47ac79..f8481412 100644 --- a/dist/jquery.qtip.min.js +++ b/dist/jquery.qtip.min.js @@ -9,7 +9,7 @@ * http://en.wikipedia.org/wiki/MIT_License * http://en.wikipedia.org/wiki/GNU_General_Public_License * -* Date: Sat Mar 3 17:04:40 2012 +0000 +* Date: Sat Mar 31 19:19:39 2012 +0100 *//*jslint browser: true, onevar: true, undef: true, nomen: true, bitwise: true, regexp: true, newcap: true, immed: true, strict: true *//*global window: false, jQuery: false, console: false, define: false */// Uses AMD or browser globals to create a jQuery plugin. -(function(a){typeof define=="function"&&define.amd?define(["jquery"],a):a(jQuery)})(function(a){"use strict";function v(){v.history=v.history||[],v.history.push(arguments);if("object"==typeof console){var a=console[console.warn?"warn":"log"],b=Array.prototype.slice.call(arguments),c;typeof arguments[0]=="string"&&(b[0]="qTip2: "+b[0]),c=a.apply?a.apply(console,b):a(b)}}function w(b){var e;if(!b||"object"!=typeof b)return c;if(b.metadata===d||"object"!=typeof b.metadata)b.metadata={type:b.metadata};if("content"in b){if(b.content===d||"object"!=typeof b.content||b.content.jquery)b.content={text:b.content};e=b.content.text||c,!a.isFunction(e)&&(!e&&!e.attr||e.length<1||"object"==typeof e&&!e.jquery)&&(b.content.text=c);if("title"in b.content){if(b.content.title===d||"object"!=typeof b.content.title)b.content.title={text:b.content.title};e=b.content.title.text||c,!a.isFunction(e)&&(!e&&!e.attr||e.length<1||"object"==typeof e&&!e.jquery)&&(b.content.title.text=c)}}return"position"in b&&(b.position===d||"object"!=typeof b.position)&&(b.position={my:b.position,at:b.position}),"show"in b&&(b.show===d||"object"!=typeof b.show)&&(b.show.jquery?b.show={target:b.show}:b.show={event:b.show}),"hide"in b&&(b.hide===d||"object"!=typeof b.hide)&&(b.hide.jquery?b.hide={target:b.hide}:b.hide={event:b.hide}),"style"in b&&(b.style===d||"object"!=typeof b.style)&&(b.style={classes:b.style}),a.each(g,function(){this.sanitize&&this.sanitize(b)}),b}function x(r,s,v,x){function H(a){var b=0,c,d=s,e=a.split(".");while(d=d[e[b++]])b",{"class":"ui-state-default ui-tooltip-close "+(s.style.widget?"":j+"-icon"),title:e,"aria-label":e}).prepend(a("",{"class":"ui-icon ui-icon-close",html:"×"})),F.button.appendTo(F.titlebar).attr("role","button").click(function(a){return D.hasClass(l)||y.hide(a),c}),y.redraw()}function L(){var c=A+"-title";F.titlebar&&J(),F.titlebar=a("
",{"class":j+"-titlebar "+(s.style.widget?"ui-widget-header":"")}).append(F.title=a("
",{id:c,"class":j+"-title","aria-atomic":b})).insertBefore(F.content).delegate(".ui-tooltip-close","mousedown keydown mouseup keyup mouseout",function(b){a(this).toggleClass("ui-state-active ui-state-focus",b.type.substr(-4)==="down")}).delegate(".ui-tooltip-close","mouseover mouseout",function(b){a(this).toggleClass("ui-state-hover",b.type==="mouseover")}),s.content.title.button?K():y.rendered&&y.redraw()}function M(a){var b=F.button,d=F.title;if(!y.rendered)return c;a?(d||L(),K()):b.remove()}function N(b,d){var e=F.title;if(!y.rendered||!b)return c;a.isFunction(b)&&(b=b.call(r,G.event,y));if(b===c||!b&&b!=="")return J(c);b.jquery&&b.length>0?e.empty().append(b.css({display:"block"})):e.html(b),y.redraw(),d!==c&&y.rendered&&D.is(":visible")&&y.reposition(G.event)}function O(b,d){function g(b){function i(e){e&&(delete h[e.src],clearTimeout(y.timers.img[e.src]),a(e).unbind(E)),a.isEmptyObject(h)&&(y.redraw(),d!==c&&y.reposition(G.event),b())}var g,h={};if((g=f.find("img[src]:not([height]):not([width])")).length===0)return i();g.each(function(b,c){if(h[c.src]!==e)return;var d=0,f=3;(function g(){if(c.height||c.width||d>f)return i(c);d+=1,y.timers.img[c.src]=setTimeout(g,700)})(),a(c).bind("error"+E+" load"+E,function(){i(this)}),h[c.src]=c})}var f=F.content;return!y.rendered||!b?c:(a.isFunction(b)&&(b=b.call(r,G.event,y)||""),b.jquery&&b.length>0?f.empty().append(b.css({display:"block"})):f.html(b),y.rendered<0?D.queue("fx",g):(C=0,g(a.noop)),y)}function P(){function j(a){if(D.hasClass(l))return c;clearTimeout(y.timers.show),clearTimeout(y.timers.hide);var d=function(){y.toggle(b,a)};s.show.delay>0?y.timers.show=setTimeout(d,s.show.delay):d()}function k(b){if(D.hasClass(l)||B||C)return c;var f=a(b.relatedTarget||b.target),g=f.closest(m)[0]===D[0],h=f[0]===e.show[0];clearTimeout(y.timers.show),clearTimeout(y.timers.hide);if(d.target==="mouse"&&g||s.hide.fixed&&/mouse(out|leave|move)/.test(b.type)&&(g||h)){try{b.preventDefault(),b.stopImmediatePropagation()}catch(i){}return}s.hide.delay>0?y.timers.hide=setTimeout(function(){y.hide(b)},s.hide.delay):y.hide(b)}function n(a){if(D.hasClass(l))return c;clearTimeout(y.timers.inactive),y.timers.inactive=setTimeout(function(){y.hide(a)},s.hide.inactive)}function o(a){D.is(":visible")&&y.reposition(a)}var d=s.position,e={show:s.show.target,hide:s.hide.target,viewport:a(d.viewport),document:a(document),body:a(document.body),window:a(window)},g={show:a.trim(""+s.show.event).split(" "),hide:a.trim(""+s.hide.event).split(" ")},i=a.browser.msie&&parseInt(a.browser.version,10)===6;D.bind("mouseenter"+E+" mouseleave"+E,function(a){var b=a.type==="mouseenter";b&&y.focus(a),D.toggleClass(p,b)}),s.hide.fixed&&(e.hide=e.hide.add(D),D.bind("mouseover"+E,function(){D.hasClass(l)||clearTimeout(y.timers.hide)})),/mouse(out|leave)/i.test(s.hide.event)?s.hide.leave==="window"&&e.window.bind("mouseout"+E+" blur"+E,function(a){/select|option/.test(a.target)&&!a.relatedTarget&&y.hide(a)}):/mouse(over|enter)/i.test(s.show.event)&&e.hide.bind("mouseleave"+E,function(a){clearTimeout(y.timers.show)}),(""+s.hide.event).indexOf("unfocus")>-1&&d.container.closest("html").bind("mousedown"+E,function(b){var c=a(b.target),d=!D.hasClass(l)&&D.is(":visible"),e=c.parents(m).filter(D[0]).length>0;c[0]!==r[0]&&c[0]!==D[0]&&!e&&!r.has(c[0]).length&&!c.attr("disabled")&&y.hide(b)}),"number"==typeof s.hide.inactive&&(e.show.bind("qtip-"+v+"-inactive",n),a.each(f.inactiveEvents,function(a,b){e.hide.add(F.tooltip).bind(b+E+"-inactive",n)})),a.each(g.hide,function(b,c){var d=a.inArray(c,g.show),f=a(e.hide);d>-1&&f.add(e.show).length===f.length||c==="unfocus"?(e.show.bind(c+E,function(a){D.is(":visible")?k(a):j(a)}),delete g.show[d]):e.hide.bind(c+E,k)}),a.each(g.show,function(a,b){e.show.bind(b+E,j)}),"number"==typeof s.hide.distance&&e.show.add(D).bind("mousemove"+E,function(a){var b=G.origin||{},c=s.hide.distance,d=Math.abs;(d(a.pageX-b.pageX)>=c||d(a.pageY-b.pageY)>=c)&&y.hide(a)}),d.target==="mouse"&&(e.show.bind("mousemove"+E,function(a){h={pageX:a.pageX,pageY:a.pageY,type:"mousemove"}}),d.adjust.mouse&&(s.hide.event&&(D.bind("mouseleave"+E,function(a){(a.relatedTarget||a.target)!==e.show[0]&&y.hide(a)}),F.target.bind("mouseenter"+E+" mouseleave"+E,function(a){G.onTarget=a.type==="mouseenter"})),e.document.bind("mousemove"+E,function(a){G.onTarget&&!D.hasClass(l)&&D.is(":visible")&&y.reposition(a||h)}))),(d.adjust.resize||e.viewport.length)&&(a.event.special.resize?e.viewport:e.window).bind("resize"+E,o),(e.viewport.length||i&&D.css("position")==="fixed")&&e.viewport.bind("scroll"+E,o)}function Q(){var b=[s.show.target[0],s.hide.target[0],y.rendered&&F.tooltip[0],s.position.container[0],s.position.viewport[0],window,document];y.rendered?a([]).pushStack(a.grep(b,function(a){return typeof a=="object"})).unbind(E):s.show.target.unbind(E+"-create")}var y=this,z=document.body,A=j+"-"+v,B=0,C=0,D=a(),E=".qtip-"+v,F,G;y.id=v,y.rendered=c,y.elements=F={target:r},y.timers={img:{}},y.options=s,y.checks={},y.plugins={},y.cache=G={event:{},target:a(),disabled:c,attr:x,onTarget:c},y.checks.builtin={"^id$":function(d,e,g){var h=g===b?f.nextid:g,i=j+"-"+h;h!==c&&h.length>0&&!a("#"+i).length&&(D[0].id=i,F.content[0].id=i+"-content",F.title[0].id=i+"-title")},"^content.text$":function(a,b,c){O(c)},"^content.title.text$":function(a,b,c){if(!c)return J();!F.title&&c&&L(),N(c)},"^content.title.button$":function(a,b,c){M(c)},"^position.(my|at)$":function(a,b,c){"string"==typeof c&&(a[b]=new g.Corner(c))},"^position.container$":function(a,b,c){y.rendered&&D.appendTo(c)},"^show.ready$":function(){y.rendered?y.toggle(b):y.render(1)},"^style.classes$":function(a,b,c){D.attr("class",j+" qtip ui-helper-reset "+c)},"^style.widget|content.title":I,"^events.(render|show|move|hide|focus|blur)$":function(b,c,d){D[(a.isFunction(d)?"":"un")+"bind"]("tooltip"+c,d)},"^(show|hide|position).(event|target|fixed|inactive|leave|distance|viewport|adjust)":function(){var a=s.position;D.attr("tracking",a.target==="mouse"&&a.adjust.mouse),Q(),P()}},a.extend(y,{render:function(d){if(y.rendered)return y;var e=s.content.text,f=s.content.title.text,h=s.position,i=a.Event("tooltiprender");return a.attr(r[0],"aria-describedby",A),D=F.tooltip=a("
",{id:A,"class":j+" qtip ui-helper-reset "+n+" "+s.style.classes+" "+j+"-pos-"+s.position.my.abbrev(),width:s.style.width||"",height:s.style.height||"",tracking:h.target==="mouse"&&h.adjust.mouse,role:"alert","aria-live":"polite","aria-atomic":c,"aria-describedby":A+"-content","aria-hidden":b}).toggleClass(l,G.disabled).data("qtip",y).appendTo(s.position.container).append(F.content=a("
",{"class":j+"-content",id:A+"-content","aria-atomic":b})),y.rendered=-1,C=1,B=1,f&&(L(),a.isFunction(f)||N(f,c)),a.isFunction(e)||O(e,c),y.rendered=b,I(),a.each(s.events,function(b,c){a.isFunction(c)&&D.bind(b==="toggle"?"tooltipshow tooltiphide":"tooltip"+b,c)}),a.each(g,function(){this.initialize==="render"&&this(y)}),P(),D.queue("fx",function(a){i.originalEvent=G.event,D.trigger(i,[y]),C=0,B=0,y.redraw(),(s.show.ready||d)&&y.toggle(b,G.event,c),a()}),y},get:function(a){var b,c;switch(a.toLowerCase()){case"dimensions":b={height:D.outerHeight(),width:D.outerWidth()};break;case"offset":b=g.offset(D,s.position.container);break;default:c=H(a.toLowerCase()),b=c[0][c[1]],b=b.precedance?b.string():b}return b},set:function(e,f){function m(a,b){var c,d,e;for(c in k)for(d in k[c])if(e=(new RegExp(d,"i")).exec(a))b.push(e),k[c][d].apply(y,b)}var g=/^position\.(my|at|adjust|target|container)|style|content|show\.ready/i,h=/^content\.(title|attr)|style/i,i=c,j=c,k=y.checks,l;return"string"==typeof e?(l=e,e={},e[l]=f):e=a.extend(b,{},e),a.each(e,function(b,c){var d=H(b.toLowerCase()),f;f=d[0][d[1]],d[0][d[1]]="object"==typeof c&&c.nodeType?a(c):c,e[b]=[d[0],d[1],c,f],i=g.test(b)||i,j=h.test(b)||j}),w(s),B=C=1,a.each(e,m),B=C=0,D.is(":visible")&&y.rendered&&(i&&y.reposition(s.position.target==="mouse"?d:G.event),j&&y.redraw()),y},toggle:function(e,f){function q(){e?(a.browser.msie&&D[0].style.removeAttribute("filter"),D.css("overflow",""),"string"==typeof i.autofocus&&a(i.autofocus,D).focus(),p=a.Event("tooltipvisible"),p.originalEvent=f?G.event:d,D.trigger(p,[y]),i.target.trigger("qtip-"+v+"-inactive")):D.css({display:"",visibility:"",opacity:"",left:"",top:""})}if(!y.rendered)return e?y.render(1):y;var g=e?"show":"hide",i=s[g],j=D.is(":visible"),k=!f||s[g].target.length<2||G.target[0]===f.target,l=s.position,n=s.content,o,p;(typeof e).search("boolean|number")&&(e=!j);if(!D.is(":animated")&&j===e&&k)return y;if(f){if(/over|enter/.test(f.type)&&/out|leave/.test(G.event.type)&&f.target===s.show.target[0]&&D.has(f.relatedTarget).length)return y;G.event=a.extend({},f)}return p=a.Event("tooltip"+g),p.originalEvent=f?G.event:d,D.trigger(p,[y,90]),p.isDefaultPrevented()?y:(a.attr(D[0],"aria-hidden",!e),e?(G.origin=a.extend({},h),y.focus(f),a.isFunction(n.text)&&O(n.text,c),a.isFunction(n.title.text)&&N(n.title.text,c),!u&&l.target==="mouse"&&l.adjust.mouse&&(a(document).bind("mousemove.qtip",function(a){h={pageX:a.pageX,pageY:a.pageY,type:"mousemove"}}),u=b),y.reposition(f,arguments[2]),(p.solo=!!i.solo)&&a(m,i.solo).not(D).qtip("hide",p)):(clearTimeout(y.timers.show),delete G.origin,u&&!a(m+'[tracking="true"]:visible',i.solo).not(D).length&&(a(document).unbind("mousemove.qtip"),u=c),y.blur(f)),k&&D.stop(1,0),i.effect===c?(D[g](),q.call(D)):a.isFunction(i.effect)?(i.effect.call(D,y),D.queue("fx",function(a){q(),a()})):D.fadeTo(90,e?1:0,q),e&&i.target.trigger("qtip-"+v+"-inactive"),y)},show:function(a){return y.toggle(b,a)},hide:function(a){return y.toggle(c,a)},focus:function(b){if(!y.rendered)return y;var c=a(m),d=parseInt(D[0].style.zIndex,10),e=f.zindex+c.length,g=a.extend({},b),h,i;return D.hasClass(o)||(i=a.Event("tooltipfocus"),i.originalEvent=g,D.trigger(i,[y,e]),i.isDefaultPrevented()||(d!==e&&(c.each(function(){this.style.zIndex>d&&(this.style.zIndex=this.style.zIndex-1)}),c.filter("."+o).qtip("blur",g)),D.addClass(o)[0].style.zIndex=e)),y},blur:function(b){var c=a.extend({},b),d;return D.removeClass(o),d=a.Event("tooltipblur"),d.originalEvent=c,D.trigger(d,[y]),y},reposition:function(b,d){if(!y.rendered||B)return y;B=1;var e=s.position.target,f=s.position,i=f.my,k=f.at,l=f.adjust,m=l.method.split(" "),n=D.outerWidth(),o=D.outerHeight(),p=0,q=0,r=a.Event("tooltipmove"),t=D.css("position")==="fixed",u=f.viewport,v={left:0,top:0},w=f.container,x=c,A=y.plugins.tip,C={horizontal:m[0],vertical:m[1]=m[1]||m[0],enabled:u.jquery&&e[0]!==window&&e[0]!==z&&l.method!=="none",left:function(a){var b=C.horizontal==="shift",c=-w.offset.left+u.offset.left+u.scrollLeft,d=i.x==="left"?n:i.x==="right"?-n:-n/2,e=k.x==="left"?p:k.x==="right"?-p:-p/2,f=A&&A.size?A.size.width||0:0,g=A&&A.corner&&A.corner.precedance==="x"&&!b?f:0,h=c-a+g,j=a+n-u.width-c+g,m=d-(i.precedance==="x"||i.x===i.y?e:0)-(k.x==="center"?p/2:0),o=i.x==="center";return b?(g=A&&A.corner&&A.corner.precedance==="y"?f:0,m=(i.x==="left"?1:-1)*d-g,v.left+=h>0?h:j>0?-j:0,v.left=Math.max(-w.offset.left+u.offset.left+(g&&A.corner.x==="center"?A.offset:0),a-m,Math.min(Math.max(-w.offset.left+u.offset.left+u.width,a+m),v.left))):(h>0&&(i.x!=="left"||j>0)?v.left-=m:j>0&&(i.x!=="right"||h>0)&&(v.left-=o?-m:m),v.left!==a&&o&&(v.left-=l.x),v.leftj&&(v.left=a)),v.left-a},top:function(a){var b=C.vertical==="shift",c=-w.offset.top+u.offset.top+u.scrollTop,d=i.y==="top"?o:i.y==="bottom"?-o:-o/2,e=k.y==="top"?q:k.y==="bottom"?-q:-q/2,f=A&&A.size?A.size.height||0:0,g=A&&A.corner&&A.corner.precedance==="y"&&!b?f:0,h=c-a+g,j=a+o-u.height-c+g,m=d-(i.precedance==="y"||i.x===i.y?e:0)-(k.y==="center"?q/2:0),n=i.y==="center";return b?(g=A&&A.corner&&A.corner.precedance==="x"?f:0,m=(i.y==="top"?1:-1)*d-g,v.top+=h>0?h:j>0?-j:0,v.top=Math.max(-w.offset.top+u.offset.top+(g&&A.corner.x==="center"?A.offset:0),a-m,Math.min(Math.max(-w.offset.top+u.offset.top+u.height,a+m),v.top))):(h>0&&(i.y!=="top"||j>0)?v.top-=m:j>0&&(i.y!=="bottom"||h>0)&&(v.top-=n?-m:m),v.top!==a&&n&&(v.top-=l.y),v.top<0&&-v.top>j&&(v.top=a)),v.top-a}},E;if(a.isArray(e)&&e.length===2)k={x:"left",y:"top"},v={left:e[0],top:e[1]};else if(e==="mouse"&&(b&&b.pageX||G.event.pageX))k={x:"left",y:"top"},b=(!b||b.type!=="resize"&&b.type!=="scroll"?b&&b.pageX&&b.type==="mousemove"?b:h&&h.pageX&&(l.mouse||!b||!b.pageX)?{pageX:h.pageX,pageY:h.pageY}:!l.mouse&&G.origin&&G.origin.pageX&&s.show.distance?G.origin:b:G.event)||b||G.event||h||{},v={top:b.pageY,left:b.pageX};else{e==="event"?b&&b.target&&b.type!=="scroll"&&b.type!=="resize"?e=G.target=a(b.target):e=G.target:e=G.target=a(e.jquery?e:F.target),e=a(e).eq(0);if(e.length===0)return y;e[0]===document||e[0]===window?(p=g.iOS?window.innerWidth:e.width(),q=g.iOS?window.innerHeight:e.height(),e[0]===window&&(v={top:(u||e).scrollTop(),left:(u||e).scrollLeft()})):e.is("area")&&g.imagemap?v=g.imagemap(e,k,C.enabled?m:c):e[0].namespaceURI==="http://www.w3.org/2000/svg"&&g.svg?v=g.svg(e,k):(p=e.outerWidth(),q=e.outerHeight(),v=g.offset(e,w)),v.offset&&(p=v.width,q=v.height,x=v.flipoffset,v=v.offset);if(g.iOS<4.1&&g.iOS>3.1||g.iOS==4.3||!g.iOS&&t)E=a(window),v.left-=E.scrollLeft(),v.top-=E.scrollTop();v.left+=k.x==="right"?p:k.x==="center"?p/2:0,v.top+=k.y==="bottom"?q:k.y==="center"?q/2:0}return v.left+=l.x+(i.x==="right"?-n:i.x==="center"?-n/2:0),v.top+=l.y+(i.y==="bottom"?-o:i.y==="center"?-o/2:0),C.enabled?(u={elem:u,height:u[(u[0]===window?"h":"outerH")+"eight"](),width:u[(u[0]===window?"w":"outerW")+"idth"](),scrollLeft:t?0:u.scrollLeft(),scrollTop:t?0:u.scrollTop(),offset:u.offset()||{left:0,top:0}},w={elem:w,scrollLeft:w.scrollLeft(),scrollTop:w.scrollTop(),offset:w.offset()||{left:0,top:0}},v.adjusted={left:C.horizontal!=="none"?C.left(v.left):0,top:C.vertical!=="none"?C.top(v.top):0},v.adjusted.left+v.adjusted.top&&D.attr("class",D[0].className.replace(/ui-tooltip-pos-\w+/i,j+"-pos-"+i.abbrev())),x&&v.adjusted.left&&(v.left+=x.left),x&&v.adjusted.top&&(v.top+=x.top)):v.adjusted={left:0,top:0},r.originalEvent=a.extend({},b),D.trigger(r,[y,v,u.elem||u]),r.isDefaultPrevented()?y:(delete v.adjusted,d===c||isNaN(v.left)||isNaN(v.top)||e==="mouse"||!a.isFunction(f.effect)?D.css(v):a.isFunction(f.effect)&&(f.effect.call(D,y,a.extend({},v)),D.queue(function(b){a(this).css({opacity:"",height:""}),a.browser.msie&&this.style.removeAttribute("filter"),b()})),B=0,y)},redraw:function(){if(y.rendered<1||C)return y;var a=s.position.container,b,c,d,e;return C=1,s.style.height&&D.css("height",s.style.height),s.style.width?D.css("width",s.style.width):(D.css("width","").addClass(q),c=D.width()+1,d=D.css("max-width")||"",e=D.css("min-width")||"",b=(d+e).indexOf("%")>-1?a.width()/100:0,d=(d.indexOf("%")>-1?b:1)*parseInt(d,10)||c,e=(e.indexOf("%")>-1?b:1)*parseInt(e,10)||0,c=d+e?Math.min(Math.max(c,e),d):c,D.css("width",Math.round(c)).removeClass(q)),C=0,y},disable:function(b){return"boolean"!=typeof b&&(b=!D.hasClass(l)&&!G.disabled),y.rendered?(D.toggleClass(l,b),a.attr(D[0],"aria-disabled",b)):G.disabled=!!b,y},enable:function(){return y.disable(c)},destroy:function(){var b=r[0],c=a.attr(b,t),d=r.data("qtip");y.rendered&&(D.stop(1,0).remove(),a.each(y.plugins,function(){this.destroy&&this.destroy()})),clearTimeout(y.timers.show),clearTimeout(y.timers.hide),Q();if(!d||y===d)a.removeData(b,"qtip"),s.suppress&&c&&(a.attr(b,"title",c),r.removeAttr(t)),r.removeAttr("aria-describedby");return r.unbind(".qtip-"+v),delete i[y.id],r}})}function y(e,h){var i,j,k,l,m,n=a(this),o=a(document.body),p=this===document?o:n,q=n.metadata?n.metadata(h.metadata):d,r=h.metadata.type==="html5"&&q?q[h.metadata.name]:d,s=n.data(h.metadata.name||"qtipopts");try{s=typeof s=="string"?(new Function("return "+s))():s}catch(u){v("Unable to parse HTML5 attribute data: "+s)}l=a.extend(b,{},f.defaults,h,typeof s=="object"?w(s):d,w(r||q)),j=l.position,l.id=e;if("boolean"==typeof l.content.text){k=n.attr(l.content.attr);if(l.content.attr===c||!k)return v("Unable to locate content for tooltip! Aborting render of tooltip on element: ",n),c;l.content.text=k}j.container.length||(j.container=o),j.target===c&&(j.target=p),l.show.target===c&&(l.show.target=p),l.show.solo===b&&(l.show.solo=j.container.closest("body")),l.hide.target===c&&(l.hide.target=p),l.position.viewport===b&&(l.position.viewport=j.container),j.at=new g.Corner(j.at),j.my=new g.Corner(j.my);if(a.data(this,"qtip"))if(l.overwrite)n.qtip("destroy");else if(l.overwrite===c)return c;return l.suppress&&(m=a.attr(this,"title"))&&a(this).removeAttr("title").attr(t,m),i=new x(n,l,e,!!k),a.data(this,"qtip",i),n.bind("remove.qtip-"+e+" removeqtip.qtip-"+e,function(){i.destroy()}),i}function z(d){var e=this,f=d.elements.tooltip,g=d.options.content.ajax,h=".qtip-ajax",i=/)<[^<]*)*<\/script>/gi,j=b,k=c,l;d.checks.ajax={"^content.ajax":function(a,b,c){b==="ajax"&&(g=c),b==="once"?e.init():g&&g.url?e.load():f.unbind(h)}},a.extend(e,{init:function(){return g&&g.url&&f.unbind(h)[g.once?"one":"bind"]("tooltipshow"+h,e.load),e},load:function(b,f){function p(){if(k)return;n&&(d.show(b.originalEvent),f=c),a.isFunction(g.complete)&&g.complete.apply(this,arguments)}function q(b){if(k)return;m&&(b=a("
").append(b.replace(i,"")).find(m)),d.set("content.text",b)}function r(a,b,c){if(k||a.status===0)return;d.set("content.text",b+": "+c)}var h=g.url.indexOf(" "),j=g.url,m,n=g.once&&!g.loading&&f;if(n)try{b.preventDefault()}catch(o){}else if(b&&b.isDefaultPrevented())return e;l&&l.abort&&l.abort(),h>-1&&(m=j.substr(h),j=j.substr(0,h)),l=a.ajax(a.extend({success:q,error:r,context:d},g,{url:j,complete:p}))},destroy:function(){l&&l.abort&&l.abort(),k=b}}),e.init()}function A(b){var c=this,d=b.elements,e=d.tooltip,f=".bgiframe-"+b.id;a.extend(c,{init:function(){d.bgiframe=a(''),d.bgiframe.appendTo(e),e.bind("tooltipmove"+f,c.adjust)},adjust:function(){var a=b.get("dimensions"),c=b.plugins.tip,f=d.tip,g,h;h=parseInt(e.css("border-left-width"),10)||0,h={left:-h,top:-h},c&&f&&(g=c.corner.precedance==="x"?["width","left"]:["height","top"],h[g[1]]-=f[g[0]]()),d.bgiframe.css(h).css(a)},destroy:function(){d.bgiframe.remove(),e.unbind(f)}}),c.init()}function B(d){var e=this,f=d.options.show.modal,h=d.elements,i=h.tooltip,j="#qtip-overlay",k=".qtipmodal",l=k+d.id,n="is-modal-qtip",p=a(document.body),q;d.checks.modal={"^show.modal.(on|blur)$":function(){e.init(),h.overlay.toggle(i.is(":visible"))}},a.extend(e,{init:function(){return f.on?(q=e.create(),i.attr(n,b).css("z-index",g.modal.zindex+a(m+"["+n+"]").length).unbind(k).unbind(l).bind("tooltipshow"+k+" tooltiphide"+k,function(b,c,d){var f=b.originalEvent;if(b.target===i[0])if(f&&b.type==="tooltiphide"&&/mouse(leave|enter)/.test(f.type)&&a(f.relatedTarget).closest(q[0]).length)try{b.preventDefault()}catch(g){}else(!f||f&&!f.solo)&&e[b.type.replace("tooltip","")](b,d)}).bind("tooltipfocus"+k,function(b){if(b.isDefaultPrevented()||b.target!==i[0])return;var c=a(m).filter("["+n+"]"),d=g.modal.zindex+c.length,e=parseInt(i[0].style.zIndex,10);q[0].style.zIndex=d-1,c.each(function(){this.style.zIndex>e&&(this.style.zIndex-=1)}),c.end().filter("."+o).qtip("blur",b.originalEvent),i.addClass(o)[0].style.zIndex=d;try{b.preventDefault()}catch(f){}}).bind("tooltiphide"+k,function(b){b.target===i[0]&&a("["+n+"]").filter(":visible").not(i).last().qtip("focus",b)}),f.escape&&a(window).unbind(l).bind("keydown"+l,function(a){a.keyCode===27&&i.hasClass(o)&&d.hide(a)}),f.blur&&h.overlay.unbind(l).bind("click"+l,function(a){i.hasClass(o)&&d.hide(a)}),e):e},create:function(){function d(){q.css({height:a(window).height(),width:a(window).width()})}var b=a(j);return b.length?h.overlay=b.insertAfter(a(m).last()):(q=h.overlay=a("
",{id:j.substr(1),html:"
",mousedown:function(){return c}}).insertAfter(a(m).last()),a(window).unbind(k).bind("resize"+k,d),d(),q)},toggle:function(d,g,h){if(d&&d.isDefaultPrevented())return e;var j=f.effect,k=g?"show":"hide",o=q.is(":visible"),r=a("["+n+"]").filter(":visible").not(i),s;return q||(q=e.create()),q.is(":animated")&&o===g||!g&&r.length?e:(g?(q.css({left:0,top:0}),q.toggleClass("blurs",f.blur),p.bind("focusin"+l,function(b){var d=a(b.target),e=d.closest(".qtip"),f=e.length<1?c:parseInt(e[0].style.zIndex,10)>parseInt(i[0].style.zIndex,10);!f&&a(b.target).closest(m)[0]!==i[0]&&i.find("input:visible").filter(":first").focus()})):p.undelegate("*","focusin"+l),q.stop(b,c),a.isFunction(j)?j.call(q,g):j===c?q[k]():q.fadeTo(parseInt(h,10)||90,g?1:0,function(){g||a(this).hide()}),g||q.queue(function(a){q.css({left:"",top:""}),a()}),e)},show:function(a,c){return e.toggle(a,b,c)},hide:function(a,b){return e.toggle(a,c,b)},destroy:function(){var b=q;return b&&(b=a("["+n+"]").not(i).length<1,b?(h.overlay.remove(),a(window).unbind(k)):h.overlay.unbind(k+d.id),p.undelegate("*","focusin"+l)),i.removeAttr(n).unbind(k)}}),e.init()}function C(a,b,c){var d=Math.ceil(b/2),e=Math.ceil(c/2),f={bottomright:[[0,0],[b,c],[b,0]],bottomleft:[[0,0],[b,0],[0,c]],topright:[[0,c],[b,0],[b,c]],topleft:[[0,0],[0,c],[b,c]],topcenter:[[0,c],[d,0],[b,c]],bottomcenter:[[0,0],[b,0],[d,c]],rightcenter:[[0,0],[b,e],[0,c]],leftcenter:[[b,0],[b,c],[0,e]]};return f.lefttop=f.bottomright,f.righttop=f.bottomleft,f.leftbottom=f.topright,f.rightbottom=f.topleft,f[a.string()]}function D(f,h){function t(a,d,g,h){if(!k.tip)return;var l=i.corner.clone(),n=g.adjusted,o=f.options.position.adjust.method.split(" "),p=o[0],q=o[1]||o[0],r={left:c,top:c,x:0,y:0},s,t={},u;i.corner.fixed!==b&&(p==="shift"&&l.precedance==="x"&&n.left&&l.y!=="center"?l.precedance=l.precedance==="x"?"y":"x":p==="flip"&&n.left&&(l.x=l.x==="center"?n.left>0?"left":"right":l.x==="left"?"right":"left"),q==="shift"&&l.precedance==="y"&&n.top&&l.x!=="center"?l.precedance=l.precedance==="y"?"x":"y":q==="flip"&&n.top&&(l.y=l.y==="center"?n.top>0?"top":"bottom":l.y==="top"?"bottom":"top"),l.string()!==m.corner.string()&&(m.top!==n.top||m.left!==n.left)&&i.update(l,c)),s=i.position(l,n),s.right!==e&&(s.left=-s.right),s.bottom!==e&&(s.top=-s.bottom),s.user=Math.max(0,j.offset);if(r.left=p==="shift"&&!!n.left)l.x==="center"?t["margin-left"]=r.x=s["margin-left"]-n.left:(u=s.right!==e?[n.left,-s.left]:[-n.left,s.left],(r.x=Math.max(u[0],u[1]))>u[0]&&(g.left-=n.left,r.left=c),t[s.right!==e?"right":"left"]=r.x);if(r.top=q==="shift"&&!!n.top)l.y==="center"?t["margin-top"]=r.y=s["margin-top"]-n.top:(u=s.bottom!==e?[n.top,-s.top]:[-n.top,s.top],(r.y=Math.max(u[0],u[1]))>u[0]&&(g.top-=n.top,r.top=c),t[s.bottom!==e?"bottom":"top"]=r.y);k.tip.css(t).toggle(!(r.x&&r.y||l.x==="center"&&r.y||l.y==="center"&&r.x)),g.left-=s.left.charAt?s.user:p!=="shift"||r.top||!r.left&&!r.top?s.left:0,g.top-=s.top.charAt?s.user:q!=="shift"||r.left||!r.left&&!r.top?s.top:0,m.left=n.left,m.top=n.top,m.corner=l.clone()}function u(a,b,c){b=b?b:a[a.precedance];var d=l.hasClass(q),e=k.titlebar&&a.y==="top",f=e?k.titlebar:k.content,g="border-"+b+"-width",h;return l.addClass(q),h=parseInt(f.css(g),10),h=(c?h||parseInt(l.css(g),10):h)||0,l.toggleClass(q,d),h}function v(b){var c=k.titlebar&&b.y==="top",d=c?k.titlebar:k.content,e=a.browser.mozilla,f=e?"-moz-":a.browser.webkit?"-webkit-":"",g=b.y+(e?"":"-")+b.x,h=f+(e?"border-radius-"+g:"border-"+g+"-radius");return parseInt(d.css(h),10)||parseInt(l.css(h),10)||0}function w(a){var b=a.precedance==="y",c=n[b?"width":"height"],d=n[b?"height":"width"],e=a.string().indexOf("center")>-1,f=c*(e?.5:1),g=Math.pow,h=Math.round,i,j,k,l=Math.sqrt(g(f,2)+g(d,2)),m=[p/f*l,p/d*l];return m[2]=Math.sqrt(g(m[0],2)-g(p,2)),m[3]=Math.sqrt(g(m[1],2)-g(p,2)),i=l+m[2]+m[3]+(e?0:m[0]),j=i/l,k=[h(j*d),h(j*c)],{height:k[b?0:1],width:k[b?1:0]}}var i=this,j=f.options.style.tip,k=f.elements,l=k.tooltip,m={top:0,left:0},n={width:j.width,height:j.height},o={},p=j.border||0,r=".qtip-tip",s=!!(a("")[0]||{}).getContext;i.corner=d,i.mimic=d,i.border=p,i.offset=j.offset,i.size=n,f.checks.tip={"^position.my|style.tip.(corner|mimic|border)$":function(){i.init()||i.destroy(),f.reposition()},"^style.tip.(height|width)$":function(){n={width:j.width,height:j.height},i.create(),i.update(),f.reposition()},"^content.title.text|style.(classes|widget)$":function(){k.tip&&i.update()}},a.extend(i,{init:function(){var b=i.detectCorner()&&(s||a.browser.msie);return b&&(i.create(),i.update(),l.unbind(r).bind("tooltipmove"+r,t)),b},detectCorner:function(){var a=j.corner,d=f.options.position,e=d.at,h=d.my.string?d.my.string():d.my;return a===c||h===c&&e===c?c:(a===b?i.corner=new g.Corner(h):a.string||(i.corner=new g.Corner(a),i.corner.fixed=b),m.corner=new g.Corner(i.corner.string()),i.corner.string()!=="centercenter")},detectColours:function(b){var c,d,e,g=k.tip.css("cssText",""),h=b||i.corner,m=h[h.precedance],p="border-"+m+"-color",r="border"+m.charAt(0)+m.substr(1)+"Color",s=/rgba?\(0, 0, 0(, 0)?\)|transparent|#123456/i,t="background-color",u="transparent",v=" !important",w=a(document.body).css("color"),x=f.elements.content.css("color"),y=k.titlebar&&(h.y==="top"||h.y==="center"&&g.position().top+n.height/2+j.offset",{"class":"ui-tooltip-tip"}).css({width:b,height:c}).prependTo(l),s?a("").appendTo(k.tip)[0].getContext("2d").save():(d='',k.tip.html(d+d),a("*",k.tip).bind("click mousedown",function(a){a.stopPropagation()}))},update:function(e,f){var h=k.tip,l=h.children(),q=n.width,r=n.height,t="px solid ",v="px dashed transparent",x=j.mimic,y=Math.round,z,A,B,D,E;e||(e=m.corner||i.corner),x===c?x=e:(x=new g.Corner(x),x.precedance=e.precedance,x.x==="inherit"?x.x=e.x:x.y==="inherit"?x.y=e.y:x.x===x.y&&(x[e.precedance]=e[e.precedance])),z=x.precedance,i.detectColours(e),o.border!=="transparent"&&o.border!=="#123456"?(p=u(e,d,b),j.border===0&&p>0&&(o.fill=o.border),i.border=p=j.border!==b?j.border:p):i.border=p=0,B=C(x,q,r),i.size=E=w(e),h.css(E),e.precedance==="y"?D=[y(x.x==="left"?p:x.x==="right"?E.width-q-p:(E.width-q)/2),y(x.y==="top"?E.height-r:0)]:D=[y(x.x==="left"?E.width-q:0),y(x.y==="top"?p:x.y==="bottom"?E.height-r-p:(E.height-r)/2)],s?(l.attr(E),A=l[0].getContext("2d"),A.restore(),A.save(),A.clearRect(0,0,3e3,3e3),A.translate(D[0],D[1]),A.beginPath(),A.moveTo(B[0][0],B[0][1]),A.lineTo(B[1][0],B[1][1]),A.lineTo(B[2][0],B[2][1]),A.closePath(),A.fillStyle=o.fill,A.strokeStyle=o.border,A.lineWidth=p*2,A.lineJoin="miter",A.miterLimit=100,p&&A.stroke(),A.fill()):(B="m"+B[0][0]+","+B[0][1]+" l"+B[1][0]+","+B[1][1]+" "+B[2][0]+","+B[2][1]+" xe",D[2]=p&&/^(r|b)/i.test(e.string())?parseFloat(a.browser.version,10)===8?2:1:0,l.css({antialias:""+(x.string().indexOf("center")>-1),left:D[0]-D[2]*Number(z==="x"),top:D[1]-D[2]*Number(z==="y"),width:q+p,height:r+p}).each(function(b){var c=a(this);c[c.prop?"prop":"attr"]({coordsize:q+p+" "+(r+p),path:B,fillcolor:o.fill,filled:!!b,stroked:!b}).css({display:p||b?"block":"none"}),!b&&c.html()===""&&c.html('')})),f!==c&&i.position(e)},position:function(d){var e=k.tip,f={},g=Math.max(0,j.offset),h,l,m;return j.corner===c||!e?c:(d=d||i.corner,h=d.precedance,l=w(d),m=[d.x,d.y],h==="x"&&m.reverse(),a.each(m,function(a,c){var e,i;c==="center"?(e=h==="y"?"left":"top",f[e]="50%",f["margin-"+e]=-Math.round(l[h==="y"?"width":"height"]/2)+g):(e=u(d,c,b),i=v(d),f[c]=a?p?u(d,c):0:g+(i>e?i:0))}),f[d[h]]-=l[h==="x"?"width":"height"],e.css({top:"",bottom:"",left:"",right:"",margin:""}).css(f),f)},destroy:function(){k.tip&&k.tip.remove(),l.unbind(r)}}),i.init()}var b=!0,c=!1,d=null,e,f,g,h,i={},j="ui-tooltip",k="ui-widget",l="ui-state-disabled",m="div.qtip."+j,n=j+"-default",o=j+"-focus",p=j+"-hover",q=j+"-fluid",r="-31000px",s="_replacedByqTip",t="oldtitle",u;f=a.fn.qtip=function(g,h,i){var j=(""+g).toLowerCase(),k=d,l=a.makeArray(arguments).slice(1),m=l[l.length-1],n=this[0]?a.data(this[0],"qtip"):d;if(!arguments.length&&n||j==="api")return n;if("string"==typeof g)return this.each(function(){var d=a.data(this,"qtip");if(!d)return b;m&&m.timeStamp&&(d.cache.event=m);if(j!=="option"&&j!=="options"||!h)d[j]&&d[j].apply(d[j],l);else{if(!a.isPlainObject(h)&&i===e)return k=d.get(h),c;d.set(h,i)}}),k!==d?k:this;if("object"==typeof g||!arguments.length)return n=w(a.extend(b,{},g)),f.bind.call(this,n,m)},f.bind=function(d,j){return this.each(function(k){function r(b){function d(){p.render(typeof b=="object"||l.show.ready),m.show.add(m.hide).unbind(o)}if(p.cache.disabled)return c;p.cache.event=a.extend({},b),p.cache.target=b?a(b.target):[e],l.show.delay>0?(clearTimeout(p.timers.show),p.timers.show=setTimeout(d,l.show.delay),n.show!==n.hide&&m.hide.bind(n.hide,function(){clearTimeout(p.timers.show)})):d()}var l,m,n,o,p,q;q=a.isArray(d.id)?d.id[k]:d.id,q=!q||q===c||q.length<1||i[q]?f.nextid++:i[q]=q,o=".qtip-"+q+"-create",p=y.call(this,q,d);if(p===c)return b;l=p.options,a.each(g,function(){this.initialize==="initialize"&&this(p)}),m={show:l.show.target,hide: -l.hide.target},n={show:a.trim(""+l.show.event).replace(/ /g,o+" ")+o,hide:a.trim(""+l.hide.event).replace(/ /g,o+" ")+o},/mouse(over|enter)/i.test(n.show)&&!/mouse(out|leave)/i.test(n.hide)&&(n.hide+=" mouseleave"+o),m.show.bind("mousemove"+o,function(a){h={pageX:a.pageX,pageY:a.pageY,type:"mousemove"},p.cache.onTarget=b}),m.show.bind(n.show,r),(l.show.ready||l.prerender)&&r(j)})},g=f.plugins={Corner:function(a){a=(""+a).replace(/([A-Z])/," $1").replace(/middle/gi,"center").toLowerCase(),this.x=(a.match(/left|right/i)||a.match(/center/)||["inherit"])[0].toLowerCase(),this.y=(a.match(/top|bottom|center/i)||["inherit"])[0].toLowerCase();var b=a.charAt(0);this.precedance=b==="t"||b==="b"?"y":"x",this.string=function(){return this.precedance==="y"?this.y+this.x:this.x+this.y},this.abbrev=function(){var a=this.x.substr(0,1),b=this.y.substr(0,1);return a===b?a:a==="c"||a!=="c"&&b!=="c"?b+a:a+b},this.clone=function(){return{x:this.x,y:this.y,precedance:this.precedance,string:this.string,abbrev:this.abbrev,clone:this.clone}}},offset:function(b,c){function j(a,b){d.left+=b*a.scrollLeft(),d.top+=b*a.scrollTop()}var d=b.offset(),e=b.closest("body")[0],f=c,g,h,i;if(f){do f.css("position")!=="static"&&(h=f.position(),d.left-=h.left+(parseInt(f.css("borderLeftWidth"),10)||0)+(parseInt(f.css("marginLeft"),10)||0),d.top-=h.top+(parseInt(f.css("borderTopWidth"),10)||0)+(parseInt(f.css("marginTop"),10)||0),!g&&(i=f.css("overflow"))!=="hidden"&&i!=="visible"&&(g=f));while((f=a(f[0].offsetParent)).length);g&&g[0]!==e&&j(g,1)}return d},iOS:parseFloat((""+(/CPU.*OS ([0-9_]{1,3})|(CPU like).*AppleWebKit.*Mobile/i.exec(navigator.userAgent)||[0,""])[1]).replace("undefined","3_2").replace("_","."))||c,fn:{attr:function(b,c){if(this.length){var d=this[0],e="title",f=a.data(d,"qtip");if(b===e&&f&&"object"==typeof f&&f.options.suppress)return arguments.length<2?a.attr(d,t):(f&&f.options.content.attr===e&&f.cache.attr&&f.set("content.text",c),this.attr(t,c))}return a.fn["attr"+s].apply(this,arguments)},clone:function(b){var c=a([]),d="title",e=a.fn["clone"+s].apply(this,arguments);return b||e.filter("["+t+"]").attr("title",function(){return a.attr(this,t)}).removeAttr(t),e}}},a.each(g.fn,function(c,d){if(!d||a.fn[c+s])return b;var e=a.fn[c+s]=a.fn[c];a.fn[c]=function(){return d.apply(this,arguments)||e.apply(this,arguments)}}),a.ui||(a["cleanData"+s]=a.cleanData,a.cleanData=function(b){for(var c=0,d;(d=b[c])!==e;c++)try{a(d).triggerHandler("removeqtip")}catch(f){}a["cleanData"+s](b)}),f.version="2.0.0pre",f.nextid=0,f.inactiveEvents="click dblclick mousedown mouseup mousemove mouseleave mouseenter".split(" "),f.zindex=15e3,f.defaults={prerender:c,id:c,overwrite:b,suppress:b,content:{text:b,attr:"title",title:{text:c,button:c}},position:{my:"top left",at:"bottom right",target:c,container:c,viewport:c,adjust:{x:0,y:0,mouse:b,resize:b,method:"flip flip"},effect:function(b,d,e){a(this).animate(d,{duration:200,queue:c})}},show:{target:c,event:"mouseenter",effect:b,delay:90,solo:c,ready:c,autofocus:c},hide:{target:c,event:"mouseleave",effect:b,delay:0,fixed:c,inactive:c,leave:"window",distance:c},style:{classes:"",widget:c,width:c,height:c,def:b},events:{render:d,move:d,show:d,hide:d,toggle:d,visible:d,focus:d,blur:d}},g.ajax=function(a){var b=a.plugins.ajax;return"object"==typeof b?b:a.plugins.ajax=new z(a)},g.ajax.initialize="render",g.ajax.sanitize=function(a){var b=a.content,c;b&&"ajax"in b&&(c=b.ajax,typeof c!="object"&&(c=a.content.ajax={url:c}),"boolean"!=typeof c.once&&c.once&&(c.once=!!c.once))},a.extend(b,f.defaults,{content:{ajax:{loading:b,once:b}}}),g.bgiframe=function(b){var d=a.browser,e=b.plugins.bgiframe;return a("select, object").length<1||!d.msie||(""+d.version).charAt(0)!=="6"?c:"object"==typeof e?e:b.plugins.bgiframe=new A(b)},g.bgiframe.initialize="render",g.imagemap=function(b,c,d){function n(a,b,c){var d=0,e=1,f=1,g=0,h=0,i=a.width,j=a.height;while(i>0&&j>0&&e>0&&f>0){i=Math.floor(i/2),j=Math.floor(j/2),c.x==="left"?e=i:c.x==="right"?e=a.width-i:e+=Math.floor(i/2),c.y==="top"?f=j:c.y==="bottom"?f=a.height-j:f+=Math.floor(j/2),d=b.length;while(d--){if(b.length<2)break;g=b[d][0]-a.offset.left,h=b[d][1]-a.offset.top,(c.x==="left"&&g>=e||c.x==="right"&&g<=e||c.x==="center"&&(ga.width-e)||c.y==="top"&&h>=f||c.y==="bottom"&&h<=f||c.y==="center"&&(ha.height-f))&&b.splice(d,1)}}return{left:b[0][0],top:b[0][1]}}b.jquery||(b=a(b));var e=(b[0].shape||b.attr("shape")).toLowerCase(),f=(b[0].coords||b.attr("coords")).split(","),g=[],h=a('img[usemap="#'+b.parent("map").attr("name")+'"]'),i=h.offset(),j={width:0,height:0,offset:{top:1e10,right:0,bottom:0,left:1e10}},k=0,l=0,m;i.left+=Math.ceil((h.outerWidth()-h.width())/2),i.top+=Math.ceil((h.outerHeight()-h.height())/2);if(e==="poly"){k=f.length;while(k--)l=[parseInt(f[--k],10),parseInt(f[k+1],10)],l[0]>j.offset.right&&(j.offset.right=l[0]),l[0]j.offset.bottom&&(j.offset.bottom=l[1]),l[1]",{"class":"ui-state-default ui-tooltip-close "+(s.style.widget?"":j+"-icon"),title:e,"aria-label":e}).prepend(a("",{"class":"ui-icon ui-icon-close",html:"×"})),F.button.appendTo(F.titlebar).attr("role","button").click(function(a){return D.hasClass(l)||y.hide(a),c}),y.redraw()}function L(){var c=A+"-title";F.titlebar&&J(),F.titlebar=a("
",{"class":j+"-titlebar "+(s.style.widget?"ui-widget-header":"")}).append(F.title=a("
",{id:c,"class":j+"-title","aria-atomic":b})).insertBefore(F.content).delegate(".ui-tooltip-close","mousedown keydown mouseup keyup mouseout",function(b){a(this).toggleClass("ui-state-active ui-state-focus",b.type.substr(-4)==="down")}).delegate(".ui-tooltip-close","mouseover mouseout",function(b){a(this).toggleClass("ui-state-hover",b.type==="mouseover")}),s.content.title.button?K():y.rendered&&y.redraw()}function M(a){var b=F.button,d=F.title;if(!y.rendered)return c;a?(d||L(),K()):b.remove()}function N(b,d){var e=F.title;if(!y.rendered||!b)return c;a.isFunction(b)&&(b=b.call(r,G.event,y));if(b===c||!b&&b!=="")return J(c);b.jquery&&b.length>0?e.empty().append(b.css({display:"block"})):e.html(b),y.redraw(),d!==c&&y.rendered&&D.is(":visible")&&y.reposition(G.event)}function O(b,d){function g(b){function i(e){e&&(delete h[e.src],clearTimeout(y.timers.img[e.src]),a(e).unbind(E)),a.isEmptyObject(h)&&(y.redraw(),d!==c&&y.reposition(G.event),b())}var g,h={};if((g=f.find("img[src]:not([height]):not([width])")).length===0)return i();g.each(function(b,c){if(h[c.src]!==e)return;var d=0,f=3;(function g(){if(c.height||c.width||d>f)return i(c);d+=1,y.timers.img[c.src]=setTimeout(g,700)})(),a(c).bind("error"+E+" load"+E,function(){i(this)}),h[c.src]=c})}var f=F.content;return!y.rendered||!b?c:(a.isFunction(b)&&(b=b.call(r,G.event,y)||""),b.jquery&&b.length>0?f.empty().append(b.css({display:"block"})):f.html(b),y.rendered<0?D.queue("fx",g):(C=0,g(a.noop)),y)}function P(){function j(a){if(D.hasClass(l))return c;clearTimeout(y.timers.show),clearTimeout(y.timers.hide);var d=function(){y.toggle(b,a)};s.show.delay>0?y.timers.show=setTimeout(d,s.show.delay):d()}function k(b){if(D.hasClass(l)||B||C)return c;var f=a(b.relatedTarget||b.target),g=f.closest(m)[0]===D[0],h=f[0]===e.show[0];clearTimeout(y.timers.show),clearTimeout(y.timers.hide);if(d.target==="mouse"&&g||s.hide.fixed&&/mouse(out|leave|move)/.test(b.type)&&(g||h)){try{b.preventDefault(),b.stopImmediatePropagation()}catch(i){}return}s.hide.delay>0?y.timers.hide=setTimeout(function(){y.hide(b)},s.hide.delay):y.hide(b)}function n(a){if(D.hasClass(l))return c;clearTimeout(y.timers.inactive),y.timers.inactive=setTimeout(function(){y.hide(a)},s.hide.inactive)}function o(a){D.is(":visible")&&y.reposition(a)}var d=s.position,e={show:s.show.target,hide:s.hide.target,viewport:a(d.viewport),document:a(document),body:a(document.body),window:a(window)},g={show:a.trim(""+s.show.event).split(" "),hide:a.trim(""+s.hide.event).split(" ")},i=a.browser.msie&&parseInt(a.browser.version,10)===6;D.bind("mouseenter"+E+" mouseleave"+E,function(a){var b=a.type==="mouseenter";b&&y.focus(a),D.toggleClass(p,b)}),s.hide.fixed&&(e.hide=e.hide.add(D),D.bind("mouseover"+E,function(){D.hasClass(l)||clearTimeout(y.timers.hide)})),/mouse(out|leave)/i.test(s.hide.event)?s.hide.leave==="window"&&e.window.bind("mouseout"+E+" blur"+E,function(a){/select|option/.test(a.target)&&!a.relatedTarget&&y.hide(a)}):/mouse(over|enter)/i.test(s.show.event)&&e.hide.bind("mouseleave"+E,function(a){clearTimeout(y.timers.show)}),(""+s.hide.event).indexOf("unfocus")>-1&&d.container.closest("html").bind("mousedown"+E,function(b){var c=a(b.target),d=!D.hasClass(l)&&D.is(":visible"),e=c.parents(m).filter(D[0]).length>0;c[0]!==r[0]&&c[0]!==D[0]&&!e&&!r.has(c[0]).length&&!c.attr("disabled")&&y.hide(b)}),"number"==typeof s.hide.inactive&&(e.show.bind("qtip-"+v+"-inactive",n),a.each(f.inactiveEvents,function(a,b){e.hide.add(F.tooltip).bind(b+E+"-inactive",n)})),a.each(g.hide,function(b,c){var d=a.inArray(c,g.show),f=a(e.hide);d>-1&&f.add(e.show).length===f.length||c==="unfocus"?(e.show.bind(c+E,function(a){D.is(":visible")?k(a):j(a)}),delete g.show[d]):e.hide.bind(c+E,k)}),a.each(g.show,function(a,b){e.show.bind(b+E,j)}),"number"==typeof s.hide.distance&&e.show.add(D).bind("mousemove"+E,function(a){var b=G.origin||{},c=s.hide.distance,d=Math.abs;(d(a.pageX-b.pageX)>=c||d(a.pageY-b.pageY)>=c)&&y.hide(a)}),d.target==="mouse"&&(e.show.bind("mousemove"+E,function(a){h={pageX:a.pageX,pageY:a.pageY,type:"mousemove"}}),d.adjust.mouse&&(s.hide.event&&(D.bind("mouseleave"+E,function(a){(a.relatedTarget||a.target)!==e.show[0]&&y.hide(a)}),F.target.bind("mouseenter"+E+" mouseleave"+E,function(a){G.onTarget=a.type==="mouseenter"})),e.document.bind("mousemove"+E,function(a){G.onTarget&&!D.hasClass(l)&&D.is(":visible")&&y.reposition(a||h)}))),(d.adjust.resize||e.viewport.length)&&(a.event.special.resize?e.viewport:e.window).bind("resize"+E,o),(e.viewport.length||i&&D.css("position")==="fixed")&&e.viewport.bind("scroll"+E,o)}function Q(){var b=[s.show.target[0],s.hide.target[0],y.rendered&&F.tooltip[0],s.position.container[0],s.position.viewport[0],window,document];y.rendered?a([]).pushStack(a.grep(b,function(a){return typeof a=="object"})).unbind(E):s.show.target.unbind(E+"-create")}var y=this,z=document.body,A=j+"-"+v,B=0,C=0,D=a(),E=".qtip-"+v,F,G;y.id=v,y.rendered=c,y.elements=F={target:r},y.timers={img:{}},y.options=s,y.checks={},y.plugins={},y.cache=G={event:{},target:a(),disabled:c,attr:x,onTarget:c},y.checks.builtin={"^id$":function(d,e,g){var h=g===b?f.nextid:g,i=j+"-"+h;h!==c&&h.length>0&&!a("#"+i).length&&(D[0].id=i,F.content[0].id=i+"-content",F.title[0].id=i+"-title")},"^content.text$":function(a,b,c){O(c)},"^content.title.text$":function(a,b,c){if(!c)return J();!F.title&&c&&L(),N(c)},"^content.title.button$":function(a,b,c){M(c)},"^position.(my|at)$":function(a,b,c){"string"==typeof c&&(a[b]=new g.Corner(c))},"^position.container$":function(a,b,c){y.rendered&&D.appendTo(c)},"^show.ready$":function(){y.rendered?y.toggle(b):y.render(1)},"^style.classes$":function(a,b,c){D.attr("class",j+" qtip ui-helper-reset "+c)},"^style.widget|content.title":I,"^events.(render|show|move|hide|focus|blur)$":function(b,c,d){D[(a.isFunction(d)?"":"un")+"bind"]("tooltip"+c,d)},"^(show|hide|position).(event|target|fixed|inactive|leave|distance|viewport|adjust)":function(){var a=s.position;D.attr("tracking",a.target==="mouse"&&a.adjust.mouse),Q(),P()}},a.extend(y,{render:function(d){if(y.rendered)return y;var e=s.content.text,f=s.content.title.text,h=s.position,i=a.Event("tooltiprender");return a.attr(r[0],"aria-describedby",A),D=F.tooltip=a("
",{id:A,"class":j+" qtip ui-helper-reset "+n+" "+s.style.classes+" "+j+"-pos-"+s.position.my.abbrev(),width:s.style.width||"",height:s.style.height||"",tracking:h.target==="mouse"&&h.adjust.mouse,role:"alert","aria-live":"polite","aria-atomic":c,"aria-describedby":A+"-content","aria-hidden":b}).toggleClass(l,G.disabled).data("qtip",y).appendTo(s.position.container).append(F.content=a("
",{"class":j+"-content",id:A+"-content","aria-atomic":b})),y.rendered=-1,C=1,B=1,f&&(L(),a.isFunction(f)||N(f,c)),a.isFunction(e)||O(e,c),y.rendered=b,I(),a.each(s.events,function(b,c){a.isFunction(c)&&D.bind(b==="toggle"?"tooltipshow tooltiphide":"tooltip"+b,c)}),a.each(g,function(){this.initialize==="render"&&this(y)}),P(),D.queue("fx",function(a){i.originalEvent=G.event,D.trigger(i,[y]),C=0,B=0,y.redraw(),(s.show.ready||d)&&y.toggle(b,G.event,c),a()}),y},get:function(a){var b,c;switch(a.toLowerCase()){case"dimensions":b={height:D.outerHeight(),width:D.outerWidth()};break;case"offset":b=g.offset(D,s.position.container);break;default:c=H(a.toLowerCase()),b=c[0][c[1]],b=b.precedance?b.string():b}return b},set:function(e,f){function m(a,b){var c,d,e;for(c in k)for(d in k[c])if(e=(new RegExp(d,"i")).exec(a))b.push(e),k[c][d].apply(y,b)}var g=/^position\.(my|at|adjust|target|container)|style|content|show\.ready/i,h=/^content\.(title|attr)|style/i,i=c,j=c,k=y.checks,l;return"string"==typeof e?(l=e,e={},e[l]=f):e=a.extend(b,{},e),a.each(e,function(b,c){var d=H(b.toLowerCase()),f;f=d[0][d[1]],d[0][d[1]]="object"==typeof c&&c.nodeType?a(c):c,e[b]=[d[0],d[1],c,f],i=g.test(b)||i,j=h.test(b)||j}),w(s),B=C=1,a.each(e,m),B=C=0,D.is(":visible")&&y.rendered&&(i&&y.reposition(s.position.target==="mouse"?d:G.event),j&&y.redraw()),y},toggle:function(e,f){function q(){e?(a.browser.msie&&D[0].style.removeAttribute("filter"),D.css("overflow",""),"string"==typeof i.autofocus&&a(i.autofocus,D).focus(),p=a.Event("tooltipvisible"),p.originalEvent=f?G.event:d,D.trigger(p,[y]),i.target.trigger("qtip-"+v+"-inactive")):D.css({display:"",visibility:"",opacity:"",left:"",top:""})}if(!y.rendered)return e?y.render(1):y;var g=e?"show":"hide",i=s[g],j=D.is(":visible"),k=!f||s[g].target.length<2||G.target[0]===f.target,l=s.position,n=s.content,o,p;(typeof e).search("boolean|number")&&(e=!j);if(!D.is(":animated")&&j===e&&k)return y;if(f){if(/over|enter/.test(f.type)&&/out|leave/.test(G.event.type)&&f.target===s.show.target[0]&&D.has(f.relatedTarget).length)return y;G.event=a.extend({},f)}return p=a.Event("tooltip"+g),p.originalEvent=f?G.event:d,D.trigger(p,[y,90]),p.isDefaultPrevented()?y:(a.attr(D[0],"aria-hidden",!e),e?(G.origin=a.extend({},h),y.focus(f),a.isFunction(n.text)&&O(n.text,c),a.isFunction(n.title.text)&&N(n.title.text,c),!u&&l.target==="mouse"&&l.adjust.mouse&&(a(document).bind("mousemove.qtip",function(a){h={pageX:a.pageX,pageY:a.pageY,type:"mousemove"}}),u=b),y.reposition(f,arguments[2]),(p.solo=!!i.solo)&&a(m,i.solo).not(D).qtip("hide",p)):(clearTimeout(y.timers.show),delete G.origin,u&&!a(m+'[tracking="true"]:visible',i.solo).not(D).length&&(a(document).unbind("mousemove.qtip"),u=c),y.blur(f)),k&&D.stop(1,0),i.effect===c?(D[g](),q.call(D)):a.isFunction(i.effect)?(i.effect.call(D,y),D.queue("fx",function(a){q(),a()})):D.fadeTo(90,e?1:0,q),e&&i.target.trigger("qtip-"+v+"-inactive"),y)},show:function(a){return y.toggle(b,a)},hide:function(a){return y.toggle(c,a)},focus:function(b){if(!y.rendered)return y;var c=a(m),d=parseInt(D[0].style.zIndex,10),e=f.zindex+c.length,g=a.extend({},b),h,i;return D.hasClass(o)||(i=a.Event("tooltipfocus"),i.originalEvent=g,D.trigger(i,[y,e]),i.isDefaultPrevented()||(d!==e&&(c.each(function(){this.style.zIndex>d&&(this.style.zIndex=this.style.zIndex-1)}),c.filter("."+o).qtip("blur",g)),D.addClass(o)[0].style.zIndex=e)),y},blur:function(b){var c=a.extend({},b),d;return D.removeClass(o),d=a.Event("tooltipblur"),d.originalEvent=c,D.trigger(d,[y]),y},reposition:function(b,d){if(!y.rendered||B)return y;B=1;var e=s.position.target,f=s.position,i=f.my,k=f.at,l=f.adjust,m=l.method.split(" "),n=D.outerWidth(),o=D.outerHeight(),p=0,q=0,r=a.Event("tooltipmove"),t=D.css("position")==="fixed",u=f.viewport,v={left:0,top:0},w=f.container,x=c,A=y.plugins.tip,C={horizontal:m[0],vertical:m[1]=m[1]||m[0],enabled:u.jquery&&e[0]!==window&&e[0]!==z&&l.method!=="none",left:function(a){var b=C.horizontal==="shift",c=-w.offset.left+u.offset.left+u.scrollLeft,d=i.x==="left"?n:i.x==="right"?-n:-n/2,e=k.x==="left"?p:k.x==="right"?-p:-p/2,f=A&&A.size?A.size.width||0:0,g=A&&A.corner&&A.corner.precedance==="x"&&!b?f:0,h=c-a+g,j=a+n-u.width-c+g,m=d-(i.precedance==="x"||i.x===i.y?e:0)-(k.x==="center"?p/2:0),o=i.x==="center";return b?(g=A&&A.corner&&A.corner.precedance==="y"?f:0,m=(i.x==="left"?1:-1)*d-g,v.left+=h>0?h:j>0?-j:0,v.left=Math.max(-w.offset.left+u.offset.left+(g&&A.corner.x==="center"?A.offset:0),a-m,Math.min(Math.max(-w.offset.left+u.offset.left+u.width,a+m),v.left))):(h>0&&(i.x!=="left"||j>0)?v.left-=m:j>0&&(i.x!=="right"||h>0)&&(v.left-=o?-m:m),v.left!==a&&o&&(v.left-=l.x),v.leftj&&(v.left=a)),v.left-a},top:function(a){var b=C.vertical==="shift",c=-w.offset.top+u.offset.top+u.scrollTop,d=i.y==="top"?o:i.y==="bottom"?-o:-o/2,e=k.y==="top"?q:k.y==="bottom"?-q:-q/2,f=A&&A.size?A.size.height||0:0,g=A&&A.corner&&A.corner.precedance==="y"&&!b?f:0,h=c-a+g,j=a+o-u.height-c+g,m=d-(i.precedance==="y"||i.x===i.y?e:0)-(k.y==="center"?q/2:0),n=i.y==="center";return b?(g=A&&A.corner&&A.corner.precedance==="x"?f:0,m=(i.y==="top"?1:-1)*d-g,v.top+=h>0?h:j>0?-j:0,v.top=Math.max(-w.offset.top+u.offset.top+(g&&A.corner.x==="center"?A.offset:0),a-m,Math.min(Math.max(-w.offset.top+u.offset.top+u.height,a+m),v.top))):(h>0&&(i.y!=="top"||j>0)?v.top-=m:j>0&&(i.y!=="bottom"||h>0)&&(v.top-=n?-m:m),v.top!==a&&n&&(v.top-=l.y),v.top<0&&-v.top>j&&(v.top=a)),v.top-a}},E;if(a.isArray(e)&&e.length===2)k={x:"left",y:"top"},v={left:e[0],top:e[1]};else if(e==="mouse"&&(b&&b.pageX||G.event.pageX))k={x:"left",y:"top"},b=(!b||b.type!=="resize"&&b.type!=="scroll"?b&&b.pageX&&b.type==="mousemove"?b:h&&h.pageX&&(l.mouse||!b||!b.pageX)?{pageX:h.pageX,pageY:h.pageY}:!l.mouse&&G.origin&&G.origin.pageX&&s.show.distance?G.origin:b:G.event)||b||G.event||h||{},v={top:b.pageY,left:b.pageX};else{e==="event"?b&&b.target&&b.type!=="scroll"&&b.type!=="resize"?e=G.target=a(b.target):e=G.target:e=G.target=a(e.jquery?e:F.target),e=a(e).eq(0);if(e.length===0)return y;e[0]===document||e[0]===window?(p=g.iOS?window.innerWidth:e.width(),q=g.iOS?window.innerHeight:e.height(),e[0]===window&&(v={top:(u||e).scrollTop(),left:(u||e).scrollLeft()})):e.is("area")&&g.imagemap?v=g.imagemap(e,k,C.enabled?m:c):e[0].namespaceURI==="http://www.w3.org/2000/svg"&&g.svg?v=g.svg(e,k):(p=e.outerWidth(),q=e.outerHeight(),v=g.offset(e,w)),v.offset&&(p=v.width,q=v.height,x=v.flipoffset,v=v.offset);if(g.iOS<4.1&&g.iOS>3.1||g.iOS==4.3||!g.iOS&&t)E=a(window),v.left-=E.scrollLeft(),v.top-=E.scrollTop();v.left+=k.x==="right"?p:k.x==="center"?p/2:0,v.top+=k.y==="bottom"?q:k.y==="center"?q/2:0}return v.left+=l.x+(i.x==="right"?-n:i.x==="center"?-n/2:0),v.top+=l.y+(i.y==="bottom"?-o:i.y==="center"?-o/2:0),C.enabled?(u={elem:u,height:u[(u[0]===window?"h":"outerH")+"eight"](),width:u[(u[0]===window?"w":"outerW")+"idth"](),scrollLeft:t?0:u.scrollLeft(),scrollTop:t?0:u.scrollTop(),offset:u.offset()||{left:0,top:0}},w={elem:w,scrollLeft:w.scrollLeft(),scrollTop:w.scrollTop(),offset:w.offset()||{left:0,top:0}},v.adjusted={left:C.horizontal!=="none"?C.left(v.left):0,top:C.vertical!=="none"?C.top(v.top):0},v.adjusted.left+v.adjusted.top&&D.attr("class",D[0].className.replace(/ui-tooltip-pos-\w+/i,j+"-pos-"+i.abbrev())),x&&v.adjusted.left&&(v.left+=x.left),x&&v.adjusted.top&&(v.top+=x.top)):v.adjusted={left:0,top:0},r.originalEvent=a.extend({},b),D.trigger(r,[y,v,u.elem||u]),r.isDefaultPrevented()?y:(delete v.adjusted,d===c||isNaN(v.left)||isNaN(v.top)||e==="mouse"||!a.isFunction(f.effect)?D.css(v):a.isFunction(f.effect)&&(f.effect.call(D,y,a.extend({},v)),D.queue(function(b){a(this).css({opacity:"",height:""}),a.browser.msie&&this.style.removeAttribute("filter"),b()})),B=0,y)},redraw:function(){if(y.rendered<1||C)return y;var a=s.position.container,b,c,d,e;return C=1,s.style.height&&D.css("height",s.style.height),s.style.width?D.css("width",s.style.width):(D.css("width","").addClass(q),c=D.width()+1,d=D.css("max-width")||"",e=D.css("min-width")||"",b=(d+e).indexOf("%")>-1?a.width()/100:0,d=(d.indexOf("%")>-1?b:1)*parseInt(d,10)||c,e=(e.indexOf("%")>-1?b:1)*parseInt(e,10)||0,c=d+e?Math.min(Math.max(c,e),d):c,D.css("width",Math.round(c)).removeClass(q)),C=0,y},disable:function(b){return"boolean"!=typeof b&&(b=!D.hasClass(l)&&!G.disabled),y.rendered?(D.toggleClass(l,b),a.attr(D[0],"aria-disabled",b)):G.disabled=!!b,y},enable:function(){return y.disable(c)},destroy:function(){var b=r[0],c=a.attr(b,t),d=r.data("qtip");y.rendered&&(D.stop(1,0).remove(),a.each(y.plugins,function(){this.destroy&&this.destroy()})),clearTimeout(y.timers.show),clearTimeout(y.timers.hide),Q();if(!d||y===d)a.removeData(b,"qtip"),s.suppress&&c&&(a.attr(b,"title",c),r.removeAttr(t)),r.removeAttr("aria-describedby");return r.unbind(".qtip-"+v),delete i[y.id],r}})}function y(e,h){var i,j,k,l,m,n=a(this),o=a(document.body),p=this===document?o:n,q=n.metadata?n.metadata(h.metadata):d,r=h.metadata.type==="html5"&&q?q[h.metadata.name]:d,s=n.data(h.metadata.name||"qtipopts");try{s=typeof s=="string"?(new Function("return "+s))():s}catch(u){v("Unable to parse HTML5 attribute data: "+s)}l=a.extend(b,{},f.defaults,h,typeof s=="object"?w(s):d,w(r||q)),j=l.position,l.id=e;if("boolean"==typeof l.content.text){k=n.attr(l.content.attr);if(l.content.attr===c||!k)return v("Unable to locate content for tooltip! Aborting render of tooltip on element: ",n),c;l.content.text=k}j.container.length||(j.container=o),j.target===c&&(j.target=p),l.show.target===c&&(l.show.target=p),l.show.solo===b&&(l.show.solo=j.container.closest("body")),l.hide.target===c&&(l.hide.target=p),l.position.viewport===b&&(l.position.viewport=j.container),j.container=j.container.eq(0),j.at=new g.Corner(j.at),j.my=new g.Corner(j.my);if(a.data(this,"qtip"))if(l.overwrite)n.qtip("destroy");else if(l.overwrite===c)return c;return l.suppress&&(m=a.attr(this,"title"))&&a(this).removeAttr("title").attr(t,m),i=new x(n,l,e,!!k),a.data(this,"qtip",i),n.bind("remove.qtip-"+e+" removeqtip.qtip-"+e,function(){i.destroy()}),i}function z(d){var e=this,f=d.elements.tooltip,g=d.options.content.ajax,h=".qtip-ajax",i=/)<[^<]*)*<\/script>/gi,j=b,k=c,l;d.checks.ajax={"^content.ajax":function(a,b,c){b==="ajax"&&(g=c),b==="once"?e.init():g&&g.url?e.load():f.unbind(h)}},a.extend(e,{init:function(){return g&&g.url&&f.unbind(h)[g.once?"one":"bind"]("tooltipshow"+h,e.load),e},load:function(b,f){function p(){if(k)return;n&&(d.show(b.originalEvent),f=c),a.isFunction(g.complete)&&g.complete.apply(this,arguments)}function q(b){if(k)return;m&&(b=a("
").append(b.replace(i,"")).find(m)),d.set("content.text",b)}function r(a,b,c){if(k||a.status===0)return;d.set("content.text",b+": "+c)}var h=g.url.indexOf(" "),j=g.url,m,n=g.once&&!g.loading&&f;if(n)try{b.preventDefault()}catch(o){}else if(b&&b.isDefaultPrevented())return e;l&&l.abort&&l.abort(),h>-1&&(m=j.substr(h),j=j.substr(0,h)),l=a.ajax(a.extend({success:q,error:r,context:d},g,{url:j,complete:p}))},destroy:function(){l&&l.abort&&l.abort(),k=b}}),e.init()}function A(b){var c=this,d=b.elements,e=d.tooltip,f=".bgiframe-"+b.id;a.extend(c,{init:function(){d.bgiframe=a(''),d.bgiframe.appendTo(e),e.bind("tooltipmove"+f,c.adjust)},adjust:function(){var a=b.get("dimensions"),c=b.plugins.tip,f=d.tip,g,h;h=parseInt(e.css("border-left-width"),10)||0,h={left:-h,top:-h},c&&f&&(g=c.corner.precedance==="x"?["width","left"]:["height","top"],h[g[1]]-=f[g[0]]()),d.bgiframe.css(h).css(a)},destroy:function(){d.bgiframe.remove(),e.unbind(f)}}),c.init()}function B(d){var e=this,f=d.options.show.modal,h=d.elements,i=h.tooltip,j="#qtip-overlay",k=".qtipmodal",l=k+d.id,n="is-modal-qtip",p=a(document.body),q;d.checks.modal={"^show.modal.(on|blur)$":function(){e.init(),h.overlay.toggle(i.is(":visible"))}},a.extend(e,{init:function(){return f.on?(q=e.create(),i.attr(n,b).css("z-index",g.modal.zindex+a(m+"["+n+"]").length).unbind(k).unbind(l).bind("tooltipshow"+k+" tooltiphide"+k,function(b,c,d){var f=b.originalEvent;if(b.target===i[0])if(f&&b.type==="tooltiphide"&&/mouse(leave|enter)/.test(f.type)&&a(f.relatedTarget).closest(q[0]).length)try{b.preventDefault()}catch(g){}else(!f||f&&!f.solo)&&e[b.type.replace("tooltip","")](b,d)}).bind("tooltipfocus"+k,function(b){if(b.isDefaultPrevented()||b.target!==i[0])return;var c=a(m).filter("["+n+"]"),d=g.modal.zindex+c.length,e=parseInt(i[0].style.zIndex,10);q[0].style.zIndex=d-1,c.each(function(){this.style.zIndex>e&&(this.style.zIndex-=1)}),c.end().filter("."+o).qtip("blur",b.originalEvent),i.addClass(o)[0].style.zIndex=d;try{b.preventDefault()}catch(f){}}).bind("tooltiphide"+k,function(b){b.target===i[0]&&a("["+n+"]").filter(":visible").not(i).last().qtip("focus",b)}),f.escape&&a(window).unbind(l).bind("keydown"+l,function(a){a.keyCode===27&&i.hasClass(o)&&d.hide(a)}),f.blur&&h.overlay.unbind(l).bind("click"+l,function(a){i.hasClass(o)&&d.hide(a)}),e):e},create:function(){function d(){q.css({height:a(window).height(),width:a(window).width()})}var b=a(j);return b.length?h.overlay=b.insertAfter(a(m).last()):(q=h.overlay=a("
",{id:j.substr(1),html:"
",mousedown:function(){return c}}).insertAfter(a(m).last()),a(window).unbind(k).bind("resize"+k,d),d(),q)},toggle:function(d,g,h){if(d&&d.isDefaultPrevented())return e;var j=f.effect,k=g?"show":"hide",o=q.is(":visible"),r=a("["+n+"]").filter(":visible").not(i),s;return q||(q=e.create()),q.is(":animated")&&o===g||!g&&r.length?e:(g?(q.css({left:0,top:0}),q.toggleClass("blurs",f.blur),p.bind("focusin"+l,function(b){var d=a(b.target),e=d.closest(".qtip"),f=e.length<1?c:parseInt(e[0].style.zIndex,10)>parseInt(i[0].style.zIndex,10);!f&&a(b.target).closest(m)[0]!==i[0]&&i.find("input:visible").filter(":first").focus()})):p.undelegate("*","focusin"+l),q.stop(b,c),a.isFunction(j)?j.call(q,g):j===c?q[k]():q.fadeTo(parseInt(h,10)||90,g?1:0,function(){g||a(this).hide()}),g||q.queue(function(a){q.css({left:"",top:""}),a()}),e)},show:function(a,c){return e.toggle(a,b,c)},hide:function(a,b){return e.toggle(a,c,b)},destroy:function(){var b=q;return b&&(b=a("["+n+"]").not(i).length<1,b?(h.overlay.remove(),a(window).unbind(k)):h.overlay.unbind(k+d.id),p.undelegate("*","focusin"+l)),i.removeAttr(n).unbind(k)}}),e.init()}function C(a,b,c){var d=Math.ceil(b/2),e=Math.ceil(c/2),f={bottomright:[[0,0],[b,c],[b,0]],bottomleft:[[0,0],[b,0],[0,c]],topright:[[0,c],[b,0],[b,c]],topleft:[[0,0],[0,c],[b,c]],topcenter:[[0,c],[d,0],[b,c]],bottomcenter:[[0,0],[b,0],[d,c]],rightcenter:[[0,0],[b,e],[0,c]],leftcenter:[[b,0],[b,c],[0,e]]};return f.lefttop=f.bottomright,f.righttop=f.bottomleft,f.leftbottom=f.topright,f.rightbottom=f.topleft,f[a.string()]}function D(f,h){function t(a,d,g,h){if(!k.tip)return;var l=i.corner.clone(),n=g.adjusted,o=f.options.position.adjust.method.split(" "),p=o[0],q=o[1]||o[0],r={left:c,top:c,x:0,y:0},s,t={},u;i.corner.fixed!==b&&(p==="shift"&&l.precedance==="x"&&n.left&&l.y!=="center"?l.precedance=l.precedance==="x"?"y":"x":p==="flip"&&n.left&&(l.x=l.x==="center"?n.left>0?"left":"right":l.x==="left"?"right":"left"),q==="shift"&&l.precedance==="y"&&n.top&&l.x!=="center"?l.precedance=l.precedance==="y"?"x":"y":q==="flip"&&n.top&&(l.y=l.y==="center"?n.top>0?"top":"bottom":l.y==="top"?"bottom":"top"),l.string()!==m.corner.string()&&(m.top!==n.top||m.left!==n.left)&&i.update(l,c)),s=i.position(l,n),s.right!==e&&(s.left=-s.right),s.bottom!==e&&(s.top=-s.bottom),s.user=Math.max(0,j.offset);if(r.left=p==="shift"&&!!n.left)l.x==="center"?t["margin-left"]=r.x=s["margin-left"]-n.left:(u=s.right!==e?[n.left,-s.left]:[-n.left,s.left],(r.x=Math.max(u[0],u[1]))>u[0]&&(g.left-=n.left,r.left=c),t[s.right!==e?"right":"left"]=r.x);if(r.top=q==="shift"&&!!n.top)l.y==="center"?t["margin-top"]=r.y=s["margin-top"]-n.top:(u=s.bottom!==e?[n.top,-s.top]:[-n.top,s.top],(r.y=Math.max(u[0],u[1]))>u[0]&&(g.top-=n.top,r.top=c),t[s.bottom!==e?"bottom":"top"]=r.y);k.tip.css(t).toggle(!(r.x&&r.y||l.x==="center"&&r.y||l.y==="center"&&r.x)),g.left-=s.left.charAt?s.user:p!=="shift"||r.top||!r.left&&!r.top?s.left:0,g.top-=s.top.charAt?s.user:q!=="shift"||r.left||!r.left&&!r.top?s.top:0,m.left=n.left,m.top=n.top,m.corner=l.clone()}function u(a,b,c){b=b?b:a[a.precedance];var d=l.hasClass(q),e=k.titlebar&&a.y==="top",f=e?k.titlebar:k.content,g="border-"+b+"-width",h;return l.addClass(q),h=parseInt(f.css(g),10),h=(c?h||parseInt(l.css(g),10):h)||0,l.toggleClass(q,d),h}function v(b){var c=k.titlebar&&b.y==="top",d=c?k.titlebar:k.content,e=a.browser.mozilla,f=e?"-moz-":a.browser.webkit?"-webkit-":"",g=b.y+(e?"":"-")+b.x,h=f+(e?"border-radius-"+g:"border-"+g+"-radius");return parseInt(d.css(h),10)||parseInt(l.css(h),10)||0}function w(a){var b=a.precedance==="y",c=n[b?"width":"height"],d=n[b?"height":"width"],e=a.string().indexOf("center")>-1,f=c*(e?.5:1),g=Math.pow,h=Math.round,i,j,k,l=Math.sqrt(g(f,2)+g(d,2)),m=[p/f*l,p/d*l];return m[2]=Math.sqrt(g(m[0],2)-g(p,2)),m[3]=Math.sqrt(g(m[1],2)-g(p,2)),i=l+m[2]+m[3]+(e?0:m[0]),j=i/l,k=[h(j*d),h(j*c)],{height:k[b?0:1],width:k[b?1:0]}}var i=this,j=f.options.style.tip,k=f.elements,l=k.tooltip,m={top:0,left:0},n={width:j.width,height:j.height},o={},p=j.border||0,r=".qtip-tip",s=!!(a("")[0]||{}).getContext;i.corner=d,i.mimic=d,i.border=p,i.offset=j.offset,i.size=n,f.checks.tip={"^position.my|style.tip.(corner|mimic|border)$":function(){i.init()||i.destroy(),f.reposition()},"^style.tip.(height|width)$":function(){n={width:j.width,height:j.height},i.create(),i.update(),f.reposition()},"^content.title.text|style.(classes|widget)$":function(){k.tip&&i.update()}},a.extend(i,{init:function(){var b=i.detectCorner()&&(s||a.browser.msie);return b&&(i.create(),i.update(),l.unbind(r).bind("tooltipmove"+r,t)),b},detectCorner:function(){var a=j.corner,d=f.options.position,e=d.at,h=d.my.string?d.my.string():d.my;return a===c||h===c&&e===c?c:(a===b?i.corner=new g.Corner(h):a.string||(i.corner=new g.Corner(a),i.corner.fixed=b),m.corner=new g.Corner(i.corner.string()),i.corner.string()!=="centercenter")},detectColours:function(b){var c,d,e,g=k.tip.css("cssText",""),h=b||i.corner,m=h[h.precedance],p="border-"+m+"-color",r="border"+m.charAt(0)+m.substr(1)+"Color",s=/rgba?\(0, 0, 0(, 0)?\)|transparent|#123456/i,t="background-color",u="transparent",v=" !important",w=a(document.body).css("color"),x=f.elements.content.css("color"),y=k.titlebar&&(h.y==="top"||h.y==="center"&&g.position().top+n.height/2+j.offset",{"class":"ui-tooltip-tip"}).css({width:b,height:c}).prependTo(l),s?a("").appendTo(k.tip)[0].getContext("2d").save():(d='',k.tip.html(d+d),a("*",k.tip).bind("click mousedown",function(a){a.stopPropagation()}))},update:function(e,f){var h=k.tip,l=h.children(),q=n.width,r=n.height,t="px solid ",v="px dashed transparent",x=j.mimic,y=Math.round,z,A,B,D,E;e||(e=m.corner||i.corner),x===c?x=e:(x=new g.Corner(x),x.precedance=e.precedance,x.x==="inherit"?x.x=e.x:x.y==="inherit"?x.y=e.y:x.x===x.y&&(x[e.precedance]=e[e.precedance])),z=x.precedance,i.detectColours(e),o.border!=="transparent"&&o.border!=="#123456"?(p=u(e,d,b),j.border===0&&p>0&&(o.fill=o.border),i.border=p=j.border!==b?j.border:p):i.border=p=0,B=C(x,q,r),i.size=E=w(e),h.css(E),e.precedance==="y"?D=[y(x.x==="left"?p:x.x==="right"?E.width-q-p:(E.width-q)/2),y(x.y==="top"?E.height-r:0)]:D=[y(x.x==="left"?E.width-q:0),y(x.y==="top"?p:x.y==="bottom"?E.height-r-p:(E.height-r)/2)],s?(l.attr(E),A=l[0].getContext("2d"),A.restore(),A.save(),A.clearRect(0,0,3e3,3e3),A.translate(D[0],D[1]),A.beginPath(),A.moveTo(B[0][0],B[0][1]),A.lineTo(B[1][0],B[1][1]),A.lineTo(B[2][0],B[2][1]),A.closePath(),A.fillStyle=o.fill,A.strokeStyle=o.border,A.lineWidth=p*2,A.lineJoin="miter",A.miterLimit=100,p&&A.stroke(),A.fill()):(B="m"+B[0][0]+","+B[0][1]+" l"+B[1][0]+","+B[1][1]+" "+B[2][0]+","+B[2][1]+" xe",D[2]=p&&/^(r|b)/i.test(e.string())?parseFloat(a.browser.version,10)===8?2:1:0,l.css({antialias:""+(x.string().indexOf("center")>-1),left:D[0]-D[2]*Number(z==="x"),top:D[1]-D[2]*Number(z==="y"),width:q+p,height:r+p}).each(function(b){var c=a(this);c[c.prop?"prop":"attr"]({coordsize:q+p+" "+(r+p),path:B,fillcolor:o.fill,filled:!!b,stroked:!b}).css({display:p||b?"block":"none"}),!b&&c.html()===""&&c.html('')})),f!==c&&i.position(e)},position:function(d){var e=k.tip,f={},g=Math.max(0,j.offset),h,l,m;return j.corner===c||!e?c:(d=d||i.corner,h=d.precedance,l=w(d),m=[d.x,d.y],h==="x"&&m.reverse(),a.each(m,function(a,c){var e,i;c==="center"?(e=h==="y"?"left":"top",f[e]="50%",f["margin-"+e]=-Math.round(l[h==="y"?"width":"height"]/2)+g):(e=u(d,c,b),i=v(d),f[c]=a?p?u(d,c):0:g+(i>e?i:0))}),f[d[h]]-=l[h==="x"?"width":"height"],e.css({top:"",bottom:"",left:"",right:"",margin:""}).css(f),f)},destroy:function(){k.tip&&k.tip.remove(),l.unbind(r)}}),i.init()}var b=!0,c=!1,d=null,e,f,g,h,i={},j="ui-tooltip",k="ui-widget",l="ui-state-disabled",m="div.qtip."+j,n=j+"-default",o=j+"-focus",p=j+"-hover",q=j+"-fluid",r="-31000px",s="_replacedByqTip",t="oldtitle",u;f=a.fn.qtip=function(g,h,i){var j=(""+g).toLowerCase(),k=d,l=a.makeArray(arguments).slice(1),m=l[l.length-1],n=this[0]?a.data(this[0],"qtip"):d;if(!arguments.length&&n||j==="api")return n;if("string"==typeof g)return this.each(function(){var d=a.data(this,"qtip");if(!d)return b;m&&m.timeStamp&&(d.cache.event=m);if(j!=="option"&&j!=="options"||!h)d[j]&&d[j].apply(d[j],l);else{if(!a.isPlainObject(h)&&i===e)return k=d.get(h),c;d.set(h,i)}}),k!==d?k:this;if("object"==typeof g||!arguments.length)return n=w(a.extend(b,{},g)),f.bind.call(this,n,m)},f.bind=function(d,j){return this.each(function(k){function r(b){function d(){p.render(typeof b=="object"||l.show.ready),m.show.add(m.hide).unbind(o)}if(p.cache.disabled)return c;p.cache.event=a.extend({},b),p.cache.target=b?a(b.target):[e],l.show.delay>0?(clearTimeout(p.timers.show),p.timers.show=setTimeout(d,l.show.delay),n.show!==n.hide&&m.hide.bind(n.hide,function(){clearTimeout(p.timers.show)})):d()}var l,m,n,o,p,q;q=a.isArray(d.id)?d.id[k]:d.id,q=!q||q===c||q.length<1||i[q]?f.nextid++:i[q]=q,o=".qtip-"+q+"-create",p=y.call(this,q,d);if(p===c)return b;l=p.options,a.each(g,function(){this.initialize==="initialize"&&this(p +)}),m={show:l.show.target,hide:l.hide.target},n={show:a.trim(""+l.show.event).replace(/ /g,o+" ")+o,hide:a.trim(""+l.hide.event).replace(/ /g,o+" ")+o},/mouse(over|enter)/i.test(n.show)&&!/mouse(out|leave)/i.test(n.hide)&&(n.hide+=" mouseleave"+o),m.show.bind("mousemove"+o,function(a){h={pageX:a.pageX,pageY:a.pageY,type:"mousemove"},p.cache.onTarget=b}),m.show.bind(n.show,r),(l.show.ready||l.prerender)&&r(j)})},g=f.plugins={Corner:function(a){a=(""+a).replace(/([A-Z])/," $1").replace(/middle/gi,"center").toLowerCase(),this.x=(a.match(/left|right/i)||a.match(/center/)||["inherit"])[0].toLowerCase(),this.y=(a.match(/top|bottom|center/i)||["inherit"])[0].toLowerCase();var b=a.charAt(0);this.precedance=b==="t"||b==="b"?"y":"x",this.string=function(){return this.precedance==="y"?this.y+this.x:this.x+this.y},this.abbrev=function(){var a=this.x.substr(0,1),b=this.y.substr(0,1);return a===b?a:a==="c"||a!=="c"&&b!=="c"?b+a:a+b},this.clone=function(){return{x:this.x,y:this.y,precedance:this.precedance,string:this.string,abbrev:this.abbrev,clone:this.clone}}},offset:function(b,c){function j(a,b){d.left+=b*a.scrollLeft(),d.top+=b*a.scrollTop()}var d=b.offset(),e=b.closest("body")[0],f=c,g,h,i;if(f){do f.css("position")!=="static"&&(h=f.position(),d.left-=h.left+(parseInt(f.css("borderLeftWidth"),10)||0)+(parseInt(f.css("marginLeft"),10)||0),d.top-=h.top+(parseInt(f.css("borderTopWidth"),10)||0)+(parseInt(f.css("marginTop"),10)||0),!g&&(i=f.css("overflow"))!=="hidden"&&i!=="visible"&&(g=f));while((f=a(f[0].offsetParent)).length);g&&g[0]!==e&&j(g,1)}return d},iOS:parseFloat((""+(/CPU.*OS ([0-9_]{1,3})|(CPU like).*AppleWebKit.*Mobile/i.exec(navigator.userAgent)||[0,""])[1]).replace("undefined","3_2").replace("_","."))||c,fn:{attr:function(b,c){if(this.length){var d=this[0],e="title",f=a.data(d,"qtip");if(b===e&&f&&"object"==typeof f&&f.options.suppress)return arguments.length<2?a.attr(d,t):(f&&f.options.content.attr===e&&f.cache.attr&&f.set("content.text",c),this.attr(t,c))}return a.fn["attr"+s].apply(this,arguments)},clone:function(b){var c=a([]),d="title",e=a.fn["clone"+s].apply(this,arguments);return b||e.filter("["+t+"]").attr("title",function(){return a.attr(this,t)}).removeAttr(t),e}}},a.each(g.fn,function(c,d){if(!d||a.fn[c+s])return b;var e=a.fn[c+s]=a.fn[c];a.fn[c]=function(){return d.apply(this,arguments)||e.apply(this,arguments)}}),a.ui||(a["cleanData"+s]=a.cleanData,a.cleanData=function(b){for(var c=0,d;(d=b[c])!==e;c++)try{a(d).triggerHandler("removeqtip")}catch(f){}a["cleanData"+s](b)}),f.version="2.0.0pre",f.nextid=0,f.inactiveEvents="click dblclick mousedown mouseup mousemove mouseleave mouseenter".split(" "),f.zindex=15e3,f.defaults={prerender:c,id:c,overwrite:b,suppress:b,content:{text:b,attr:"title",title:{text:c,button:c}},position:{my:"top left",at:"bottom right",target:c,container:c,viewport:c,adjust:{x:0,y:0,mouse:b,resize:b,method:"flip flip"},effect:function(b,d,e){a(this).animate(d,{duration:200,queue:c})}},show:{target:c,event:"mouseenter",effect:b,delay:90,solo:c,ready:c,autofocus:c},hide:{target:c,event:"mouseleave",effect:b,delay:0,fixed:c,inactive:c,leave:"window",distance:c},style:{classes:"",widget:c,width:c,height:c,def:b},events:{render:d,move:d,show:d,hide:d,toggle:d,visible:d,focus:d,blur:d}},g.ajax=function(a){var b=a.plugins.ajax;return"object"==typeof b?b:a.plugins.ajax=new z(a)},g.ajax.initialize="render",g.ajax.sanitize=function(a){var b=a.content,c;b&&"ajax"in b&&(c=b.ajax,typeof c!="object"&&(c=a.content.ajax={url:c}),"boolean"!=typeof c.once&&c.once&&(c.once=!!c.once))},a.extend(b,f.defaults,{content:{ajax:{loading:b,once:b}}}),g.bgiframe=function(b){var d=a.browser,e=b.plugins.bgiframe;return a("select, object").length<1||!d.msie||(""+d.version).charAt(0)!=="6"?c:"object"==typeof e?e:b.plugins.bgiframe=new A(b)},g.bgiframe.initialize="render",g.imagemap=function(b,c,d){function n(a,b,c){var d=0,e=1,f=1,g=0,h=0,i=a.width,j=a.height;while(i>0&&j>0&&e>0&&f>0){i=Math.floor(i/2),j=Math.floor(j/2),c.x==="left"?e=i:c.x==="right"?e=a.width-i:e+=Math.floor(i/2),c.y==="top"?f=j:c.y==="bottom"?f=a.height-j:f+=Math.floor(j/2),d=b.length;while(d--){if(b.length<2)break;g=b[d][0]-a.offset.left,h=b[d][1]-a.offset.top,(c.x==="left"&&g>=e||c.x==="right"&&g<=e||c.x==="center"&&(ga.width-e)||c.y==="top"&&h>=f||c.y==="bottom"&&h<=f||c.y==="center"&&(ha.height-f))&&b.splice(d,1)}}return{left:b[0][0],top:b[0][1]}}b.jquery||(b=a(b));var e=(b[0].shape||b.attr("shape")).toLowerCase(),f=(b[0].coords||b.attr("coords")).split(","),g=[],h=a('img[usemap="#'+b.parent("map").attr("name")+'"]'),i=h.offset(),j={width:0,height:0,offset:{top:1e10,right:0,bottom:0,left:1e10}},k=0,l=0,m;i.left+=Math.ceil((h.outerWidth()-h.width())/2),i.top+=Math.ceil((h.outerHeight()-h.height())/2);if(e==="poly"){k=f.length;while(k--)l=[parseInt(f[--k],10),parseInt(f[k+1],10)],l[0]>j.offset.right&&(j.offset.right=l[0]),l[0]j.offset.bottom&&(j.offset.bottom=l[1]),l[1]