GeSHi Source Viewer: jquery-ui.jsView Raw


  1. /*! jQuery UI - v1.13.0 - 2022-01-10
  2. * http://jqueryui.com
  3. * Includes: widget.js, position.js, form-reset-mixin.js, jquery-patch.js, keycode.js, labels.js, scroll-parent.js, unique-id.js, widgets/button.js, widgets/checkboxradio.js, widgets/controlgroup.js, widgets/menu.js, widgets/mouse.js, widgets/progressbar.js, widgets/selectmenu.js, widgets/slider.js, effect.js
  4. * Copyright jQuery Foundation and other contributors; Licensed MIT */
  5.  
  6. ( function( factory ) {
  7. 	"use strict";
  8.  
  9. 	if ( typeof define === "function" && define.amd ) {
  10.  
  11. 		// AMD. Register as an anonymous module.
  12. 		define( [ "jquery" ], factory );
  13. 	} else {
  14.  
  15. 		// Browser globals
  16. 		factory( jQuery );
  17. 	}
  18. } )( function( $ ) {
  19. "use strict";
  20.  
  21. $.ui = $.ui || {};
  22.  
  23. var version = $.ui.version = "1.13.0";
  24.  
  25.  
  26. /*!
  27.  * jQuery UI Widget 1.13.0
  28.  * http://jqueryui.com
  29.  *
  30.  * Copyright jQuery Foundation and other contributors
  31.  * Released under the MIT license.
  32.  * http://jquery.org/license
  33.  */
  34.  
  35. //>>label: Widget
  36. //>>group: Core
  37. //>>description: Provides a factory for creating stateful widgets with a common API.
  38. //>>docs: http://api.jqueryui.com/jQuery.widget/
  39. //>>demos: http://jqueryui.com/widget/
  40.  
  41.  
  42. var widgetUuid = 0;
  43. var widgetHasOwnProperty = Array.prototype.hasOwnProperty;
  44. var widgetSlice = Array.prototype.slice;
  45.  
  46. $.cleanData = ( function( orig ) {
  47. 	return function( elems ) {
  48. 		var events, elem, i;
  49. 		for ( i = 0; ( elem = elems[ i ] ) != null; i++ ) {
  50.  
  51. 			// Only trigger remove when necessary to save time
  52. 			events = $._data( elem, "events" );
  53. 			if ( events && events.remove ) {
  54. 				$( elem ).triggerHandler( "remove" );
  55. 			}
  56. 		}
  57. 		orig( elems );
  58. 	};
  59. } )( $.cleanData );
  60.  
  61. $.widget = function( name, base, prototype ) {
  62. 	var existingConstructor, constructor, basePrototype;
  63.  
  64. 	// ProxiedPrototype allows the provided prototype to remain unmodified
  65. 	// so that it can be used as a mixin for multiple widgets (#8876)
  66. 	var proxiedPrototype = {};
  67.  
  68. 	var namespace = name.split( "." )[ 0 ];
  69. 	name = name.split( "." )[ 1 ];
  70. 	var fullName = namespace + "-" + name;
  71.  
  72. 	if ( !prototype ) {
  73. 		prototype = base;
  74. 		base = $.Widget;
  75. 	}
  76.  
  77. 	if ( Array.isArray( prototype ) ) {
  78. 		prototype = $.extend.apply( null, [ {} ].concat( prototype ) );
  79. 	}
  80.  
  81. 	// Create selector for plugin
  82. 	$.expr.pseudos[ fullName.toLowerCase() ] = function( elem ) {
  83. 		return !!$.data( elem, fullName );
  84. 	};
  85.  
  86. 	$[ namespace ] = $[ namespace ] || {};
  87. 	existingConstructor = $[ namespace ][ name ];
  88. 	constructor = $[ namespace ][ name ] = function( options, element ) {
  89.  
  90. 		// Allow instantiation without "new" keyword
  91. 		if ( !this._createWidget ) {
  92. 			return new constructor( options, element );
  93. 		}
  94.  
  95. 		// Allow instantiation without initializing for simple inheritance
  96. 		// must use "new" keyword (the code above always passes args)
  97. 		if ( arguments.length ) {
  98. 			this._createWidget( options, element );
  99. 		}
  100. 	};
  101.  
  102. 	// Extend with the existing constructor to carry over any static properties
  103. 	$.extend( constructor, existingConstructor, {
  104. 		version: prototype.version,
  105.  
  106. 		// Copy the object used to create the prototype in case we need to
  107. 		// redefine the widget later
  108. 		_proto: $.extend( {}, prototype ),
  109.  
  110. 		// Track widgets that inherit from this widget in case this widget is
  111. 		// redefined after a widget inherits from it
  112. 		_childConstructors: []
  113. 	} );
  114.  
  115. 	basePrototype = new base();
  116.  
  117. 	// We need to make the options hash a property directly on the new instance
  118. 	// otherwise we'll modify the options hash on the prototype that we're
  119. 	// inheriting from
  120. 	basePrototype.options = $.widget.extend( {}, basePrototype.options );
  121. 	$.each( prototype, function( prop, value ) {
  122. 		if ( typeof value !== "function" ) {
  123. 			proxiedPrototype[ prop ] = value;
  124. 			return;
  125. 		}
  126. 		proxiedPrototype[ prop ] = ( function() {
  127. 			function _super() {
  128. 				return base.prototype[ prop ].apply( this, arguments );
  129. 			}
  130.  
  131. 			function _superApply( args ) {
  132. 				return base.prototype[ prop ].apply( this, args );
  133. 			}
  134.  
  135. 			return function() {
  136. 				var __super = this._super;
  137. 				var __superApply = this._superApply;
  138. 				var returnValue;
  139.  
  140. 				this._super = _super;
  141. 				this._superApply = _superApply;
  142.  
  143. 				returnValue = value.apply( this, arguments );
  144.  
  145. 				this._super = __super;
  146. 				this._superApply = __superApply;
  147.  
  148. 				return returnValue;
  149. 			};
  150. 		} )();
  151. 	} );
  152. 	constructor.prototype = $.widget.extend( basePrototype, {
  153.  
  154. 		// TODO: remove support for widgetEventPrefix
  155. 		// always use the name + a colon as the prefix, e.g., draggable:start
  156. 		// don't prefix for widgets that aren't DOM-based
  157. 		widgetEventPrefix: existingConstructor ? ( basePrototype.widgetEventPrefix || name ) : name
  158. 	}, proxiedPrototype, {
  159. 		constructor: constructor,
  160. 		namespace: namespace,
  161. 		widgetName: name,
  162. 		widgetFullName: fullName
  163. 	} );
  164.  
  165. 	// If this widget is being redefined then we need to find all widgets that
  166. 	// are inheriting from it and redefine all of them so that they inherit from
  167. 	// the new version of this widget. We're essentially trying to replace one
  168. 	// level in the prototype chain.
  169. 	if ( existingConstructor ) {
  170. 		$.each( existingConstructor._childConstructors, function( i, child ) {
  171. 			var childPrototype = child.prototype;
  172.  
  173. 			// Redefine the child widget using the same prototype that was
  174. 			// originally used, but inherit from the new version of the base
  175. 			$.widget( childPrototype.namespace + "." + childPrototype.widgetName, constructor,
  176. 				child._proto );
  177. 		} );
  178.  
  179. 		// Remove the list of existing child constructors from the old constructor
  180. 		// so the old child constructors can be garbage collected
  181. 		delete existingConstructor._childConstructors;
  182. 	} else {
  183. 		base._childConstructors.push( constructor );
  184. 	}
  185.  
  186. 	$.widget.bridge( name, constructor );
  187.  
  188. 	return constructor;
  189. };
  190.  
  191. $.widget.extend = function( target ) {
  192. 	var input = widgetSlice.call( arguments, 1 );
  193. 	var inputIndex = 0;
  194. 	var inputLength = input.length;
  195. 	var key;
  196. 	var value;
  197.  
  198. 	for ( ; inputIndex < inputLength; inputIndex++ ) {
  199. 		for ( key in input[ inputIndex ] ) {
  200. 			value = input[ inputIndex ][ key ];
  201. 			if ( widgetHasOwnProperty.call( input[ inputIndex ], key ) && value !== undefined ) {
  202.  
  203. 				// Clone objects
  204. 				if ( $.isPlainObject( value ) ) {
  205. 					target[ key ] = $.isPlainObject( target[ key ] ) ?
  206. 						$.widget.extend( {}, target[ key ], value ) :
  207.  
  208. 						// Don't extend strings, arrays, etc. with objects
  209. 						$.widget.extend( {}, value );
  210.  
  211. 				// Copy everything else by reference
  212. 				} else {
  213. 					target[ key ] = value;
  214. 				}
  215. 			}
  216. 		}
  217. 	}
  218. 	return target;
  219. };
  220.  
  221. $.widget.bridge = function( name, object ) {
  222. 	var fullName = object.prototype.widgetFullName || name;
  223. 	$.fn[ name ] = function( options ) {
  224. 		var isMethodCall = typeof options === "string";
  225. 		var args = widgetSlice.call( arguments, 1 );
  226. 		var returnValue = this;
  227.  
  228. 		if ( isMethodCall ) {
  229.  
  230. 			// If this is an empty collection, we need to have the instance method
  231. 			// return undefined instead of the jQuery instance
  232. 			if ( !this.length && options === "instance" ) {
  233. 				returnValue = undefined;
  234. 			} else {
  235. 				this.each( function() {
  236. 					var methodValue;
  237. 					var instance = $.data( this, fullName );
  238.  
  239. 					if ( options === "instance" ) {
  240. 						returnValue = instance;
  241. 						return false;
  242. 					}
  243.  
  244. 					if ( !instance ) {
  245. 						return $.error( "cannot call methods on " + name +
  246. 							" prior to initialization; " +
  247. 							"attempted to call method '" + options + "'" );
  248. 					}
  249.  
  250. 					if ( typeof instance[ options ] !== "function" ||
  251. 						options.charAt( 0 ) === "_" ) {
  252. 						return $.error( "no such method '" + options + "' for " + name +
  253. 							" widget instance" );
  254. 					}
  255.  
  256. 					methodValue = instance[ options ].apply( instance, args );
  257.  
  258. 					if ( methodValue !== instance && methodValue !== undefined ) {
  259. 						returnValue = methodValue && methodValue.jquery ?
  260. 							returnValue.pushStack( methodValue.get() ) :
  261. 							methodValue;
  262. 						return false;
  263. 					}
  264. 				} );
  265. 			}
  266. 		} else {
  267.  
  268. 			// Allow multiple hashes to be passed on init
  269. 			if ( args.length ) {
  270. 				options = $.widget.extend.apply( null, [ options ].concat( args ) );
  271. 			}
  272.  
  273. 			this.each( function() {
  274. 				var instance = $.data( this, fullName );
  275. 				if ( instance ) {
  276. 					instance.option( options || {} );
  277. 					if ( instance._init ) {
  278. 						instance._init();
  279. 					}
  280. 				} else {
  281. 					$.data( this, fullName, new object( options, this ) );
  282. 				}
  283. 			} );
  284. 		}
  285.  
  286. 		return returnValue;
  287. 	};
  288. };
  289.  
  290. $.Widget = function( /* options, element */ ) {};
  291. $.Widget._childConstructors = [];
  292.  
  293. $.Widget.prototype = {
  294. 	widgetName: "widget",
  295. 	widgetEventPrefix: "",
  296. 	defaultElement: "<div>",
  297.  
  298. 	options: {
  299. 		classes: {},
  300. 		disabled: false,
  301.  
  302. 		// Callbacks
  303. 		create: null
  304. 	},
  305.  
  306. 	_createWidget: function( options, element ) {
  307. 		element = $( element || this.defaultElement || this )[ 0 ];
  308. 		this.element = $( element );
  309. 		this.uuid = widgetUuid++;
  310. 		this.eventNamespace = "." + this.widgetName + this.uuid;
  311.  
  312. 		this.bindings = $();
  313. 		this.hoverable = $();
  314. 		this.focusable = $();
  315. 		this.classesElementLookup = {};
  316.  
  317. 		if ( element !== this ) {
  318. 			$.data( element, this.widgetFullName, this );
  319. 			this._on( true, this.element, {
  320. 				remove: function( event ) {
  321. 					if ( event.target === element ) {
  322. 						this.destroy();
  323. 					}
  324. 				}
  325. 			} );
  326. 			this.document = $( element.style ?
  327.  
  328. 				// Element within the document
  329. 				element.ownerDocument :
  330.  
  331. 				// Element is window or document
  332. 				element.document || element );
  333. 			this.window = $( this.document[ 0 ].defaultView || this.document[ 0 ].parentWindow );
  334. 		}
  335.  
  336. 		this.options = $.widget.extend( {},
  337. 			this.options,
  338. 			this._getCreateOptions(),
  339. 			options );
  340.  
  341. 		this._create();
  342.  
  343. 		if ( this.options.disabled ) {
  344. 			this._setOptionDisabled( this.options.disabled );
  345. 		}
  346.  
  347. 		this._trigger( "create", null, this._getCreateEventData() );
  348. 		this._init();
  349. 	},
  350.  
  351. 	_getCreateOptions: function() {
  352. 		return {};
  353. 	},
  354.  
  355. 	_getCreateEventData: $.noop,
  356.  
  357. 	_create: $.noop,
  358.  
  359. 	_init: $.noop,
  360.  
  361. 	destroy: function() {
  362. 		var that = this;
  363.  
  364. 		this._destroy();
  365. 		$.each( this.classesElementLookup, function( key, value ) {
  366. 			that._removeClass( value, key );
  367. 		} );
  368.  
  369. 		// We can probably remove the unbind calls in 2.0
  370. 		// all event bindings should go through this._on()
  371. 		this.element
  372. 			.off( this.eventNamespace )
  373. 			.removeData( this.widgetFullName );
  374. 		this.widget()
  375. 			.off( this.eventNamespace )
  376. 			.removeAttr( "aria-disabled" );
  377.  
  378. 		// Clean up events and states
  379. 		this.bindings.off( this.eventNamespace );
  380. 	},
  381.  
  382. 	_destroy: $.noop,
  383.  
  384. 	widget: function() {
  385. 		return this.element;
  386. 	},
  387.  
  388. 	option: function( key, value ) {
  389. 		var options = key;
  390. 		var parts;
  391. 		var curOption;
  392. 		var i;
  393.  
  394. 		if ( arguments.length === 0 ) {
  395.  
  396. 			// Don't return a reference to the internal hash
  397. 			return $.widget.extend( {}, this.options );
  398. 		}
  399.  
  400. 		if ( typeof key === "string" ) {
  401.  
  402. 			// Handle nested keys, e.g., "foo.bar" => { foo: { bar: ___ } }
  403. 			options = {};
  404. 			parts = key.split( "." );
  405. 			key = parts.shift();
  406. 			if ( parts.length ) {
  407. 				curOption = options[ key ] = $.widget.extend( {}, this.options[ key ] );
  408. 				for ( i = 0; i < parts.length - 1; i++ ) {
  409. 					curOption[ parts[ i ] ] = curOption[ parts[ i ] ] || {};
  410. 					curOption = curOption[ parts[ i ] ];
  411. 				}
  412. 				key = parts.pop();
  413. 				if ( arguments.length === 1 ) {
  414. 					return curOption[ key ] === undefined ? null : curOption[ key ];
  415. 				}
  416. 				curOption[ key ] = value;
  417. 			} else {
  418. 				if ( arguments.length === 1 ) {
  419. 					return this.options[ key ] === undefined ? null : this.options[ key ];
  420. 				}
  421. 				options[ key ] = value;
  422. 			}
  423. 		}
  424.  
  425. 		this._setOptions( options );
  426.  
  427. 		return this;
  428. 	},
  429.  
  430. 	_setOptions: function( options ) {
  431. 		var key;
  432.  
  433. 		for ( key in options ) {
  434. 			this._setOption( key, options[ key ] );
  435. 		}
  436.  
  437. 		return this;
  438. 	},
  439.  
  440. 	_setOption: function( key, value ) {
  441. 		if ( key === "classes" ) {
  442. 			this._setOptionClasses( value );
  443. 		}
  444.  
  445. 		this.options[ key ] = value;
  446.  
  447. 		if ( key === "disabled" ) {
  448. 			this._setOptionDisabled( value );
  449. 		}
  450.  
  451. 		return this;
  452. 	},
  453.  
  454. 	_setOptionClasses: function( value ) {
  455. 		var classKey, elements, currentElements;
  456.  
  457. 		for ( classKey in value ) {
  458. 			currentElements = this.classesElementLookup[ classKey ];
  459. 			if ( value[ classKey ] === this.options.classes[ classKey ] ||
  460. 					!currentElements ||
  461. 					!currentElements.length ) {
  462. 				continue;
  463. 			}
  464.  
  465. 			// We are doing this to create a new jQuery object because the _removeClass() call
  466. 			// on the next line is going to destroy the reference to the current elements being
  467. 			// tracked. We need to save a copy of this collection so that we can add the new classes
  468. 			// below.
  469. 			elements = $( currentElements.get() );
  470. 			this._removeClass( currentElements, classKey );
  471.  
  472. 			// We don't use _addClass() here, because that uses this.options.classes
  473. 			// for generating the string of classes. We want to use the value passed in from
  474. 			// _setOption(), this is the new value of the classes option which was passed to
  475. 			// _setOption(). We pass this value directly to _classes().
  476. 			elements.addClass( this._classes( {
  477. 				element: elements,
  478. 				keys: classKey,
  479. 				classes: value,
  480. 				add: true
  481. 			} ) );
  482. 		}
  483. 	},
  484.  
  485. 	_setOptionDisabled: function( value ) {
  486. 		this._toggleClass( this.widget(), this.widgetFullName + "-disabled", null, !!value );
  487.  
  488. 		// If the widget is becoming disabled, then nothing is interactive
  489. 		if ( value ) {
  490. 			this._removeClass( this.hoverable, null, "ui-state-hover" );
  491. 			this._removeClass( this.focusable, null, "ui-state-focus" );
  492. 		}
  493. 	},
  494.  
  495. 	enable: function() {
  496. 		return this._setOptions( { disabled: false } );
  497. 	},
  498.  
  499. 	disable: function() {
  500. 		return this._setOptions( { disabled: true } );
  501. 	},
  502.  
  503. 	_classes: function( options ) {
  504. 		var full = [];
  505. 		var that = this;
  506.  
  507. 		options = $.extend( {
  508. 			element: this.element,
  509. 			classes: this.options.classes || {}
  510. 		}, options );
  511.  
  512. 		function bindRemoveEvent() {
  513. 			options.element.each( function( _, element ) {
  514. 				var isTracked = $.map( that.classesElementLookup, function( elements ) {
  515. 					return elements;
  516. 				} )
  517. 					.some( function( elements ) {
  518. 						return elements.is( element );
  519. 					} );
  520.  
  521. 				if ( !isTracked ) {
  522. 					that._on( $( element ), {
  523. 						remove: "_untrackClassesElement"
  524. 					} );
  525. 				}
  526. 			} );
  527. 		}
  528.  
  529. 		function processClassString( classes, checkOption ) {
  530. 			var current, i;
  531. 			for ( i = 0; i < classes.length; i++ ) {
  532. 				current = that.classesElementLookup[ classes[ i ] ] || $();
  533. 				if ( options.add ) {
  534. 					bindRemoveEvent();
  535. 					current = $( $.uniqueSort( current.get().concat( options.element.get() ) ) );
  536. 				} else {
  537. 					current = $( current.not( options.element ).get() );
  538. 				}
  539. 				that.classesElementLookup[ classes[ i ] ] = current;
  540. 				full.push( classes[ i ] );
  541. 				if ( checkOption && options.classes[ classes[ i ] ] ) {
  542. 					full.push( options.classes[ classes[ i ] ] );
  543. 				}
  544. 			}
  545. 		}
  546.  
  547. 		if ( options.keys ) {
  548. 			processClassString( options.keys.match( /\S+/g ) || [], true );
  549. 		}
  550. 		if ( options.extra ) {
  551. 			processClassString( options.extra.match( /\S+/g ) || [] );
  552. 		}
  553.  
  554. 		return full.join( " " );
  555. 	},
  556.  
  557. 	_untrackClassesElement: function( event ) {
  558. 		var that = this;
  559. 		$.each( that.classesElementLookup, function( key, value ) {
  560. 			if ( $.inArray( event.target, value ) !== -1 ) {
  561. 				that.classesElementLookup[ key ] = $( value.not( event.target ).get() );
  562. 			}
  563. 		} );
  564.  
  565. 		this._off( $( event.target ) );
  566. 	},
  567.  
  568. 	_removeClass: function( element, keys, extra ) {
  569. 		return this._toggleClass( element, keys, extra, false );
  570. 	},
  571.  
  572. 	_addClass: function( element, keys, extra ) {
  573. 		return this._toggleClass( element, keys, extra, true );
  574. 	},
  575.  
  576. 	_toggleClass: function( element, keys, extra, add ) {
  577. 		add = ( typeof add === "boolean" ) ? add : extra;
  578. 		var shift = ( typeof element === "string" || element === null ),
  579. 			options = {
  580. 				extra: shift ? keys : extra,
  581. 				keys: shift ? element : keys,
  582. 				element: shift ? this.element : element,
  583. 				add: add
  584. 			};
  585. 		options.element.toggleClass( this._classes( options ), add );
  586. 		return this;
  587. 	},
  588.  
  589. 	_on: function( suppressDisabledCheck, element, handlers ) {
  590. 		var delegateElement;
  591. 		var instance = this;
  592.  
  593. 		// No suppressDisabledCheck flag, shuffle arguments
  594. 		if ( typeof suppressDisabledCheck !== "boolean" ) {
  595. 			handlers = element;
  596. 			element = suppressDisabledCheck;
  597. 			suppressDisabledCheck = false;
  598. 		}
  599.  
  600. 		// No element argument, shuffle and use this.element
  601. 		if ( !handlers ) {
  602. 			handlers = element;
  603. 			element = this.element;
  604. 			delegateElement = this.widget();
  605. 		} else {
  606. 			element = delegateElement = $( element );
  607. 			this.bindings = this.bindings.add( element );
  608. 		}
  609.  
  610. 		$.each( handlers, function( event, handler ) {
  611. 			function handlerProxy() {
  612.  
  613. 				// Allow widgets to customize the disabled handling
  614. 				// - disabled as an array instead of boolean
  615. 				// - disabled class as method for disabling individual parts
  616. 				if ( !suppressDisabledCheck &&
  617. 						( instance.options.disabled === true ||
  618. 						$( this ).hasClass( "ui-state-disabled" ) ) ) {
  619. 					return;
  620. 				}
  621. 				return ( typeof handler === "string" ? instance[ handler ] : handler )
  622. 					.apply( instance, arguments );
  623. 			}
  624.  
  625. 			// Copy the guid so direct unbinding works
  626. 			if ( typeof handler !== "string" ) {
  627. 				handlerProxy.guid = handler.guid =
  628. 					handler.guid || handlerProxy.guid || $.guid++;
  629. 			}
  630.  
  631. 			var match = event.match( /^([\w:-]*)\s*(.*)$/ );
  632. 			var eventName = match[ 1 ] + instance.eventNamespace;
  633. 			var selector = match[ 2 ];
  634.  
  635. 			if ( selector ) {
  636. 				delegateElement.on( eventName, selector, handlerProxy );
  637. 			} else {
  638. 				element.on( eventName, handlerProxy );
  639. 			}
  640. 		} );
  641. 	},
  642.  
  643. 	_off: function( element, eventName ) {
  644. 		eventName = ( eventName || "" ).split( " " ).join( this.eventNamespace + " " ) +
  645. 			this.eventNamespace;
  646. 		element.off( eventName );
  647.  
  648. 		// Clear the stack to avoid memory leaks (#10056)
  649. 		this.bindings = $( this.bindings.not( element ).get() );
  650. 		this.focusable = $( this.focusable.not( element ).get() );
  651. 		this.hoverable = $( this.hoverable.not( element ).get() );
  652. 	},
  653.  
  654. 	_delay: function( handler, delay ) {
  655. 		function handlerProxy() {
  656. 			return ( typeof handler === "string" ? instance[ handler ] : handler )
  657. 				.apply( instance, arguments );
  658. 		}
  659. 		var instance = this;
  660. 		return setTimeout( handlerProxy, delay || 0 );
  661. 	},
  662.  
  663. 	_hoverable: function( element ) {
  664. 		this.hoverable = this.hoverable.add( element );
  665. 		this._on( element, {
  666. 			mouseenter: function( event ) {
  667. 				this._addClass( $( event.currentTarget ), null, "ui-state-hover" );
  668. 			},
  669. 			mouseleave: function( event ) {
  670. 				this._removeClass( $( event.currentTarget ), null, "ui-state-hover" );
  671. 			}
  672. 		} );
  673. 	},
  674.  
  675. 	_focusable: function( element ) {
  676. 		this.focusable = this.focusable.add( element );
  677. 		this._on( element, {
  678. 			focusin: function( event ) {
  679. 				this._addClass( $( event.currentTarget ), null, "ui-state-focus" );
  680. 			},
  681. 			focusout: function( event ) {
  682. 				this._removeClass( $( event.currentTarget ), null, "ui-state-focus" );
  683. 			}
  684. 		} );
  685. 	},
  686.  
  687. 	_trigger: function( type, event, data ) {
  688. 		var prop, orig;
  689. 		var callback = this.options[ type ];
  690.  
  691. 		data = data || {};
  692. 		event = $.Event( event );
  693. 		event.type = ( type === this.widgetEventPrefix ?
  694. 			type :
  695. 			this.widgetEventPrefix + type ).toLowerCase();
  696.  
  697. 		// The original event may come from any element
  698. 		// so we need to reset the target on the new event
  699. 		event.target = this.element[ 0 ];
  700.  
  701. 		// Copy original event properties over to the new event
  702. 		orig = event.originalEvent;
  703. 		if ( orig ) {
  704. 			for ( prop in orig ) {
  705. 				if ( !( prop in event ) ) {
  706. 					event[ prop ] = orig[ prop ];
  707. 				}
  708. 			}
  709. 		}
  710.  
  711. 		this.element.trigger( event, data );
  712. 		return !( typeof callback === "function" &&
  713. 			callback.apply( this.element[ 0 ], [ event ].concat( data ) ) === false ||
  714. 			event.isDefaultPrevented() );
  715. 	}
  716. };
  717.  
  718. $.each( { show: "fadeIn", hide: "fadeOut" }, function( method, defaultEffect ) {
  719. 	$.Widget.prototype[ "_" + method ] = function( element, options, callback ) {
  720. 		if ( typeof options === "string" ) {
  721. 			options = { effect: options };
  722. 		}
  723.  
  724. 		var hasOptions;
  725. 		var effectName = !options ?
  726. 			method :
  727. 			options === true || typeof options === "number" ?
  728. 				defaultEffect :
  729. 				options.effect || defaultEffect;
  730.  
  731. 		options = options || {};
  732. 		if ( typeof options === "number" ) {
  733. 			options = { duration: options };
  734. 		} else if ( options === true ) {
  735. 			options = {};
  736. 		}
  737.  
  738. 		hasOptions = !$.isEmptyObject( options );
  739. 		options.complete = callback;
  740.  
  741. 		if ( options.delay ) {
  742. 			element.delay( options.delay );
  743. 		}
  744.  
  745. 		if ( hasOptions && $.effects && $.effects.effect[ effectName ] ) {
  746. 			element[ method ]( options );
  747. 		} else if ( effectName !== method && element[ effectName ] ) {
  748. 			element[ effectName ]( options.duration, options.easing, callback );
  749. 		} else {
  750. 			element.queue( function( next ) {
  751. 				$( this )[ method ]();
  752. 				if ( callback ) {
  753. 					callback.call( element[ 0 ] );
  754. 				}
  755. 				next();
  756. 			} );
  757. 		}
  758. 	};
  759. } );
  760.  
  761. var widget = $.widget;
  762.  
  763.  
  764. /*!
  765.  * jQuery UI Position 1.13.0
  766.  * http://jqueryui.com
  767.  *
  768.  * Copyright jQuery Foundation and other contributors
  769.  * Released under the MIT license.
  770.  * http://jquery.org/license
  771.  *
  772.  * http://api.jqueryui.com/position/
  773.  */
  774.  
  775. //>>label: Position
  776. //>>group: Core
  777. //>>description: Positions elements relative to other elements.
  778. //>>docs: http://api.jqueryui.com/position/
  779. //>>demos: http://jqueryui.com/position/
  780.  
  781.  
  782. ( function() {
  783. var cachedScrollbarWidth,
  784. 	max = Math.max,
  785. 	abs = Math.abs,
  786. 	rhorizontal = /left|center|right/,
  787. 	rvertical = /top|center|bottom/,
  788. 	roffset = /[\+\-]\d+(\.[\d]+)?%?/,
  789. 	rposition = /^\w+/,
  790. 	rpercent = /%$/,
  791. 	_position = $.fn.position;
  792.  
  793. function getOffsets( offsets, width, height ) {
  794. 	return [
  795. 		parseFloat( offsets[ 0 ] ) * ( rpercent.test( offsets[ 0 ] ) ? width / 100 : 1 ),
  796. 		parseFloat( offsets[ 1 ] ) * ( rpercent.test( offsets[ 1 ] ) ? height / 100 : 1 )
  797. 	];
  798. }
  799.  
  800. function parseCss( element, property ) {
  801. 	return parseInt( $.css( element, property ), 10 ) || 0;
  802. }
  803.  
  804. function isWindow( obj ) {
  805. 	return obj != null && obj === obj.window;
  806. }
  807.  
  808. function getDimensions( elem ) {
  809. 	var raw = elem[ 0 ];
  810. 	if ( raw.nodeType === 9 ) {
  811. 		return {
  812. 			width: elem.width(),
  813. 			height: elem.height(),
  814. 			offset: { top: 0, left: 0 }
  815. 		};
  816. 	}
  817. 	if ( isWindow( raw ) ) {
  818. 		return {
  819. 			width: elem.width(),
  820. 			height: elem.height(),
  821. 			offset: { top: elem.scrollTop(), left: elem.scrollLeft() }
  822. 		};
  823. 	}
  824. 	if ( raw.preventDefault ) {
  825. 		return {
  826. 			width: 0,
  827. 			height: 0,
  828. 			offset: { top: raw.pageY, left: raw.pageX }
  829. 		};
  830. 	}
  831. 	return {
  832. 		width: elem.outerWidth(),
  833. 		height: elem.outerHeight(),
  834. 		offset: elem.offset()
  835. 	};
  836. }
  837.  
  838. $.position = {
  839. 	scrollbarWidth: function() {
  840. 		if ( cachedScrollbarWidth !== undefined ) {
  841. 			return cachedScrollbarWidth;
  842. 		}
  843. 		var w1, w2,
  844. 			div = $( "<div style=" +
  845. 				"'display:block;position:absolute;width:200px;height:200px;overflow:hidden;'>" +
  846. 				"<div style='height:300px;width:auto;'></div></div>" ),
  847. 			innerDiv = div.children()[ 0 ];
  848.  
  849. 		$( "body" ).append( div );
  850. 		w1 = innerDiv.offsetWidth;
  851. 		div.css( "overflow", "scroll" );
  852.  
  853. 		w2 = innerDiv.offsetWidth;
  854.  
  855. 		if ( w1 === w2 ) {
  856. 			w2 = div[ 0 ].clientWidth;
  857. 		}
  858.  
  859. 		div.remove();
  860.  
  861. 		return ( cachedScrollbarWidth = w1 - w2 );
  862. 	},
  863. 	getScrollInfo: function( within ) {
  864. 		var overflowX = within.isWindow || within.isDocument ? "" :
  865. 				within.element.css( "overflow-x" ),
  866. 			overflowY = within.isWindow || within.isDocument ? "" :
  867. 				within.element.css( "overflow-y" ),
  868. 			hasOverflowX = overflowX === "scroll" ||
  869. 				( overflowX === "auto" && within.width < within.element[ 0 ].scrollWidth ),
  870. 			hasOverflowY = overflowY === "scroll" ||
  871. 				( overflowY === "auto" && within.height < within.element[ 0 ].scrollHeight );
  872. 		return {
  873. 			width: hasOverflowY ? $.position.scrollbarWidth() : 0,
  874. 			height: hasOverflowX ? $.position.scrollbarWidth() : 0
  875. 		};
  876. 	},
  877. 	getWithinInfo: function( element ) {
  878. 		var withinElement = $( element || window ),
  879. 			isElemWindow = isWindow( withinElement[ 0 ] ),
  880. 			isDocument = !!withinElement[ 0 ] && withinElement[ 0 ].nodeType === 9,
  881. 			hasOffset = !isElemWindow && !isDocument;
  882. 		return {
  883. 			element: withinElement,
  884. 			isWindow: isElemWindow,
  885. 			isDocument: isDocument,
  886. 			offset: hasOffset ? $( element ).offset() : { left: 0, top: 0 },
  887. 			scrollLeft: withinElement.scrollLeft(),
  888. 			scrollTop: withinElement.scrollTop(),
  889. 			width: withinElement.outerWidth(),
  890. 			height: withinElement.outerHeight()
  891. 		};
  892. 	}
  893. };
  894.  
  895. $.fn.position = function( options ) {
  896. 	if ( !options || !options.of ) {
  897. 		return _position.apply( this, arguments );
  898. 	}
  899.  
  900. 	// Make a copy, we don't want to modify arguments
  901. 	options = $.extend( {}, options );
  902.  
  903. 	var atOffset, targetWidth, targetHeight, targetOffset, basePosition, dimensions,
  904.  
  905. 		// Make sure string options are treated as CSS selectors
  906. 		target = typeof options.of === "string" ?
  907. 			$( document ).find( options.of ) :
  908. 			$( options.of ),
  909.  
  910. 		within = $.position.getWithinInfo( options.within ),
  911. 		scrollInfo = $.position.getScrollInfo( within ),
  912. 		collision = ( options.collision || "flip" ).split( " " ),
  913. 		offsets = {};
  914.  
  915. 	dimensions = getDimensions( target );
  916. 	if ( target[ 0 ].preventDefault ) {
  917.  
  918. 		// Force left top to allow flipping
  919. 		options.at = "left top";
  920. 	}
  921. 	targetWidth = dimensions.width;
  922. 	targetHeight = dimensions.height;
  923. 	targetOffset = dimensions.offset;
  924.  
  925. 	// Clone to reuse original targetOffset later
  926. 	basePosition = $.extend( {}, targetOffset );
  927.  
  928. 	// Force my and at to have valid horizontal and vertical positions
  929. 	// if a value is missing or invalid, it will be converted to center
  930. 	$.each( [ "my", "at" ], function() {
  931. 		var pos = ( options[ this ] || "" ).split( " " ),
  932. 			horizontalOffset,
  933. 			verticalOffset;
  934.  
  935. 		if ( pos.length === 1 ) {
  936. 			pos = rhorizontal.test( pos[ 0 ] ) ?
  937. 				pos.concat( [ "center" ] ) :
  938. 				rvertical.test( pos[ 0 ] ) ?
  939. 					[ "center" ].concat( pos ) :
  940. 					[ "center", "center" ];
  941. 		}
  942. 		pos[ 0 ] = rhorizontal.test( pos[ 0 ] ) ? pos[ 0 ] : "center";
  943. 		pos[ 1 ] = rvertical.test( pos[ 1 ] ) ? pos[ 1 ] : "center";
  944.  
  945. 		// Calculate offsets
  946. 		horizontalOffset = roffset.exec( pos[ 0 ] );
  947. 		verticalOffset = roffset.exec( pos[ 1 ] );
  948. 		offsets[ this ] = [
  949. 			horizontalOffset ? horizontalOffset[ 0 ] : 0,
  950. 			verticalOffset ? verticalOffset[ 0 ] : 0
  951. 		];
  952.  
  953. 		// Reduce to just the positions without the offsets
  954. 		options[ this ] = [
  955. 			rposition.exec( pos[ 0 ] )[ 0 ],
  956. 			rposition.exec( pos[ 1 ] )[ 0 ]
  957. 		];
  958. 	} );
  959.  
  960. 	// Normalize collision option
  961. 	if ( collision.length === 1 ) {
  962. 		collision[ 1 ] = collision[ 0 ];
  963. 	}
  964.  
  965. 	if ( options.at[ 0 ] === "right" ) {
  966. 		basePosition.left += targetWidth;
  967. 	} else if ( options.at[ 0 ] === "center" ) {
  968. 		basePosition.left += targetWidth / 2;
  969. 	}
  970.  
  971. 	if ( options.at[ 1 ] === "bottom" ) {
  972. 		basePosition.top += targetHeight;
  973. 	} else if ( options.at[ 1 ] === "center" ) {
  974. 		basePosition.top += targetHeight / 2;
  975. 	}
  976.  
  977. 	atOffset = getOffsets( offsets.at, targetWidth, targetHeight );
  978. 	basePosition.left += atOffset[ 0 ];
  979. 	basePosition.top += atOffset[ 1 ];
  980.  
  981. 	return this.each( function() {
  982. 		var collisionPosition, using,
  983. 			elem = $( this ),
  984. 			elemWidth = elem.outerWidth(),
  985. 			elemHeight = elem.outerHeight(),
  986. 			marginLeft = parseCss( this, "marginLeft" ),
  987. 			marginTop = parseCss( this, "marginTop" ),
  988. 			collisionWidth = elemWidth + marginLeft + parseCss( this, "marginRight" ) +
  989. 				scrollInfo.width,
  990. 			collisionHeight = elemHeight + marginTop + parseCss( this, "marginBottom" ) +
  991. 				scrollInfo.height,
  992. 			position = $.extend( {}, basePosition ),
  993. 			myOffset = getOffsets( offsets.my, elem.outerWidth(), elem.outerHeight() );
  994.  
  995. 		if ( options.my[ 0 ] === "right" ) {
  996. 			position.left -= elemWidth;
  997. 		} else if ( options.my[ 0 ] === "center" ) {
  998. 			position.left -= elemWidth / 2;
  999. 		}
  1000.  
  1001. 		if ( options.my[ 1 ] === "bottom" ) {
  1002. 			position.top -= elemHeight;
  1003. 		} else if ( options.my[ 1 ] === "center" ) {
  1004. 			position.top -= elemHeight / 2;
  1005. 		}
  1006.  
  1007. 		position.left += myOffset[ 0 ];
  1008. 		position.top += myOffset[ 1 ];
  1009.  
  1010. 		collisionPosition = {
  1011. 			marginLeft: marginLeft,
  1012. 			marginTop: marginTop
  1013. 		};
  1014.  
  1015. 		$.each( [ "left", "top" ], function( i, dir ) {
  1016. 			if ( $.ui.position[ collision[ i ] ] ) {
  1017. 				$.ui.position[ collision[ i ] ][ dir ]( position, {
  1018. 					targetWidth: targetWidth,
  1019. 					targetHeight: targetHeight,
  1020. 					elemWidth: elemWidth,
  1021. 					elemHeight: elemHeight,
  1022. 					collisionPosition: collisionPosition,
  1023. 					collisionWidth: collisionWidth,
  1024. 					collisionHeight: collisionHeight,
  1025. 					offset: [ atOffset[ 0 ] + myOffset[ 0 ], atOffset [ 1 ] + myOffset[ 1 ] ],
  1026. 					my: options.my,
  1027. 					at: options.at,
  1028. 					within: within,
  1029. 					elem: elem
  1030. 				} );
  1031. 			}
  1032. 		} );
  1033.  
  1034. 		if ( options.using ) {
  1035.  
  1036. 			// Adds feedback as second argument to using callback, if present
  1037. 			using = function( props ) {
  1038. 				var left = targetOffset.left - position.left,
  1039. 					right = left + targetWidth - elemWidth,
  1040. 					top = targetOffset.top - position.top,
  1041. 					bottom = top + targetHeight - elemHeight,
  1042. 					feedback = {
  1043. 						target: {
  1044. 							element: target,
  1045. 							left: targetOffset.left,
  1046. 							top: targetOffset.top,
  1047. 							width: targetWidth,
  1048. 							height: targetHeight
  1049. 						},
  1050. 						element: {
  1051. 							element: elem,
  1052. 							left: position.left,
  1053. 							top: position.top,
  1054. 							width: elemWidth,
  1055. 							height: elemHeight
  1056. 						},
  1057. 						horizontal: right < 0 ? "left" : left > 0 ? "right" : "center",
  1058. 						vertical: bottom < 0 ? "top" : top > 0 ? "bottom" : "middle"
  1059. 					};
  1060. 				if ( targetWidth < elemWidth && abs( left + right ) < targetWidth ) {
  1061. 					feedback.horizontal = "center";
  1062. 				}
  1063. 				if ( targetHeight < elemHeight && abs( top + bottom ) < targetHeight ) {
  1064. 					feedback.vertical = "middle";
  1065. 				}
  1066. 				if ( max( abs( left ), abs( right ) ) > max( abs( top ), abs( bottom ) ) ) {
  1067. 					feedback.important = "horizontal";
  1068. 				} else {
  1069. 					feedback.important = "vertical";
  1070. 				}
  1071. 				options.using.call( this, props, feedback );
  1072. 			};
  1073. 		}
  1074.  
  1075. 		elem.offset( $.extend( position, { using: using } ) );
  1076. 	} );
  1077. };
  1078.  
  1079. $.ui.position = {
  1080. 	fit: {
  1081. 		left: function( position, data ) {
  1082. 			var within = data.within,
  1083. 				withinOffset = within.isWindow ? within.scrollLeft : within.offset.left,
  1084. 				outerWidth = within.width,
  1085. 				collisionPosLeft = position.left - data.collisionPosition.marginLeft,
  1086. 				overLeft = withinOffset - collisionPosLeft,
  1087. 				overRight = collisionPosLeft + data.collisionWidth - outerWidth - withinOffset,
  1088. 				newOverRight;
  1089.  
  1090. 			// Element is wider than within
  1091. 			if ( data.collisionWidth > outerWidth ) {
  1092.  
  1093. 				// Element is initially over the left side of within
  1094. 				if ( overLeft > 0 && overRight <= 0 ) {
  1095. 					newOverRight = position.left + overLeft + data.collisionWidth - outerWidth -
  1096. 						withinOffset;
  1097. 					position.left += overLeft - newOverRight;
  1098.  
  1099. 				// Element is initially over right side of within
  1100. 				} else if ( overRight > 0 && overLeft <= 0 ) {
  1101. 					position.left = withinOffset;
  1102.  
  1103. 				// Element is initially over both left and right sides of within
  1104. 				} else {
  1105. 					if ( overLeft > overRight ) {
  1106. 						position.left = withinOffset + outerWidth - data.collisionWidth;
  1107. 					} else {
  1108. 						position.left = withinOffset;
  1109. 					}
  1110. 				}
  1111.  
  1112. 			// Too far left -> align with left edge
  1113. 			} else if ( overLeft > 0 ) {
  1114. 				position.left += overLeft;
  1115.  
  1116. 			// Too far right -> align with right edge
  1117. 			} else if ( overRight > 0 ) {
  1118. 				position.left -= overRight;
  1119.  
  1120. 			// Adjust based on position and margin
  1121. 			} else {
  1122. 				position.left = max( position.left - collisionPosLeft, position.left );
  1123. 			}
  1124. 		},
  1125. 		top: function( position, data ) {
  1126. 			var within = data.within,
  1127. 				withinOffset = within.isWindow ? within.scrollTop : within.offset.top,
  1128. 				outerHeight = data.within.height,
  1129. 				collisionPosTop = position.top - data.collisionPosition.marginTop,
  1130. 				overTop = withinOffset - collisionPosTop,
  1131. 				overBottom = collisionPosTop + data.collisionHeight - outerHeight - withinOffset,
  1132. 				newOverBottom;
  1133.  
  1134. 			// Element is taller than within
  1135. 			if ( data.collisionHeight > outerHeight ) {
  1136.  
  1137. 				// Element is initially over the top of within
  1138. 				if ( overTop > 0 && overBottom <= 0 ) {
  1139. 					newOverBottom = position.top + overTop + data.collisionHeight - outerHeight -
  1140. 						withinOffset;
  1141. 					position.top += overTop - newOverBottom;
  1142.  
  1143. 				// Element is initially over bottom of within
  1144. 				} else if ( overBottom > 0 && overTop <= 0 ) {
  1145. 					position.top = withinOffset;
  1146.  
  1147. 				// Element is initially over both top and bottom of within
  1148. 				} else {
  1149. 					if ( overTop > overBottom ) {
  1150. 						position.top = withinOffset + outerHeight - data.collisionHeight;
  1151. 					} else {
  1152. 						position.top = withinOffset;
  1153. 					}
  1154. 				}
  1155.  
  1156. 			// Too far up -> align with top
  1157. 			} else if ( overTop > 0 ) {
  1158. 				position.top += overTop;
  1159.  
  1160. 			// Too far down -> align with bottom edge
  1161. 			} else if ( overBottom > 0 ) {
  1162. 				position.top -= overBottom;
  1163.  
  1164. 			// Adjust based on position and margin
  1165. 			} else {
  1166. 				position.top = max( position.top - collisionPosTop, position.top );
  1167. 			}
  1168. 		}
  1169. 	},
  1170. 	flip: {
  1171. 		left: function( position, data ) {
  1172. 			var within = data.within,
  1173. 				withinOffset = within.offset.left + within.scrollLeft,
  1174. 				outerWidth = within.width,
  1175. 				offsetLeft = within.isWindow ? within.scrollLeft : within.offset.left,
  1176. 				collisionPosLeft = position.left - data.collisionPosition.marginLeft,
  1177. 				overLeft = collisionPosLeft - offsetLeft,
  1178. 				overRight = collisionPosLeft + data.collisionWidth - outerWidth - offsetLeft,
  1179. 				myOffset = data.my[ 0 ] === "left" ?
  1180. 					-data.elemWidth :
  1181. 					data.my[ 0 ] === "right" ?
  1182. 						data.elemWidth :
  1183. 						0,
  1184. 				atOffset = data.at[ 0 ] === "left" ?
  1185. 					data.targetWidth :
  1186. 					data.at[ 0 ] === "right" ?
  1187. 						-data.targetWidth :
  1188. 						0,
  1189. 				offset = -2 * data.offset[ 0 ],
  1190. 				newOverRight,
  1191. 				newOverLeft;
  1192.  
  1193. 			if ( overLeft < 0 ) {
  1194. 				newOverRight = position.left + myOffset + atOffset + offset + data.collisionWidth -
  1195. 					outerWidth - withinOffset;
  1196. 				if ( newOverRight < 0 || newOverRight < abs( overLeft ) ) {
  1197. 					position.left += myOffset + atOffset + offset;
  1198. 				}
  1199. 			} else if ( overRight > 0 ) {
  1200. 				newOverLeft = position.left - data.collisionPosition.marginLeft + myOffset +
  1201. 					atOffset + offset - offsetLeft;
  1202. 				if ( newOverLeft > 0 || abs( newOverLeft ) < overRight ) {
  1203. 					position.left += myOffset + atOffset + offset;
  1204. 				}
  1205. 			}
  1206. 		},
  1207. 		top: function( position, data ) {
  1208. 			var within = data.within,
  1209. 				withinOffset = within.offset.top + within.scrollTop,
  1210. 				outerHeight = within.height,
  1211. 				offsetTop = within.isWindow ? within.scrollTop : within.offset.top,
  1212. 				collisionPosTop = position.top - data.collisionPosition.marginTop,
  1213. 				overTop = collisionPosTop - offsetTop,
  1214. 				overBottom = collisionPosTop + data.collisionHeight - outerHeight - offsetTop,
  1215. 				top = data.my[ 1 ] === "top",
  1216. 				myOffset = top ?
  1217. 					-data.elemHeight :
  1218. 					data.my[ 1 ] === "bottom" ?
  1219. 						data.elemHeight :
  1220. 						0,
  1221. 				atOffset = data.at[ 1 ] === "top" ?
  1222. 					data.targetHeight :
  1223. 					data.at[ 1 ] === "bottom" ?
  1224. 						-data.targetHeight :
  1225. 						0,
  1226. 				offset = -2 * data.offset[ 1 ],
  1227. 				newOverTop,
  1228. 				newOverBottom;
  1229. 			if ( overTop < 0 ) {
  1230. 				newOverBottom = position.top + myOffset + atOffset + offset + data.collisionHeight -
  1231. 					outerHeight - withinOffset;
  1232. 				if ( newOverBottom < 0 || newOverBottom < abs( overTop ) ) {
  1233. 					position.top += myOffset + atOffset + offset;
  1234. 				}
  1235. 			} else if ( overBottom > 0 ) {
  1236. 				newOverTop = position.top - data.collisionPosition.marginTop + myOffset + atOffset +
  1237. 					offset - offsetTop;
  1238. 				if ( newOverTop > 0 || abs( newOverTop ) < overBottom ) {
  1239. 					position.top += myOffset + atOffset + offset;
  1240. 				}
  1241. 			}
  1242. 		}
  1243. 	},
  1244. 	flipfit: {
  1245. 		left: function() {
  1246. 			$.ui.position.flip.left.apply( this, arguments );
  1247. 			$.ui.position.fit.left.apply( this, arguments );
  1248. 		},
  1249. 		top: function() {
  1250. 			$.ui.position.flip.top.apply( this, arguments );
  1251. 			$.ui.position.fit.top.apply( this, arguments );
  1252. 		}
  1253. 	}
  1254. };
  1255.  
  1256. } )();
  1257.  
  1258. var position = $.ui.position;
  1259.  
  1260.  
  1261.  
  1262. // Support: IE8 Only
  1263. // IE8 does not support the form attribute and when it is supplied. It overwrites the form prop
  1264. // with a string, so we need to find the proper form.
  1265. var form = $.fn._form = function() {
  1266. 	return typeof this[ 0 ].form === "string" ? this.closest( "form" ) : $( this[ 0 ].form );
  1267. };
  1268.  
  1269.  
  1270. /*!
  1271.  * jQuery UI Form Reset Mixin 1.13.0
  1272.  * http://jqueryui.com
  1273.  *
  1274.  * Copyright jQuery Foundation and other contributors
  1275.  * Released under the MIT license.
  1276.  * http://jquery.org/license
  1277.  */
  1278.  
  1279. //>>label: Form Reset Mixin
  1280. //>>group: Core
  1281. //>>description: Refresh input widgets when their form is reset
  1282. //>>docs: http://api.jqueryui.com/form-reset-mixin/
  1283.  
  1284.  
  1285. var formResetMixin = $.ui.formResetMixin = {
  1286. 	_formResetHandler: function() {
  1287. 		var form = $( this );
  1288.  
  1289. 		// Wait for the form reset to actually happen before refreshing
  1290. 		setTimeout( function() {
  1291. 			var instances = form.data( "ui-form-reset-instances" );
  1292. 			$.each( instances, function() {
  1293. 				this.refresh();
  1294. 			} );
  1295. 		} );
  1296. 	},
  1297.  
  1298. 	_bindFormResetHandler: function() {
  1299. 		this.form = this.element._form();
  1300. 		if ( !this.form.length ) {
  1301. 			return;
  1302. 		}
  1303.  
  1304. 		var instances = this.form.data( "ui-form-reset-instances" ) || [];
  1305. 		if ( !instances.length ) {
  1306.  
  1307. 			// We don't use _on() here because we use a single event handler per form
  1308. 			this.form.on( "reset.ui-form-reset", this._formResetHandler );
  1309. 		}
  1310. 		instances.push( this );
  1311. 		this.form.data( "ui-form-reset-instances", instances );
  1312. 	},
  1313.  
  1314. 	_unbindFormResetHandler: function() {
  1315. 		if ( !this.form.length ) {
  1316. 			return;
  1317. 		}
  1318.  
  1319. 		var instances = this.form.data( "ui-form-reset-instances" );
  1320. 		instances.splice( $.inArray( this, instances ), 1 );
  1321. 		if ( instances.length ) {
  1322. 			this.form.data( "ui-form-reset-instances", instances );
  1323. 		} else {
  1324. 			this.form
  1325. 				.removeData( "ui-form-reset-instances" )
  1326. 				.off( "reset.ui-form-reset" );
  1327. 		}
  1328. 	}
  1329. };
  1330.  
  1331.  
  1332. /*!
  1333.  * jQuery UI Support for jQuery core 1.8.x and newer 1.13.0
  1334.  * http://jqueryui.com
  1335.  *
  1336.  * Copyright jQuery Foundation and other contributors
  1337.  * Released under the MIT license.
  1338.  * http://jquery.org/license
  1339.  *
  1340.  */
  1341.  
  1342. //>>label: jQuery 1.8+ Support
  1343. //>>group: Core
  1344. //>>description: Support version 1.8.x and newer of jQuery core
  1345.  
  1346.  
  1347. // Support: jQuery 1.9.x or older
  1348. // $.expr[ ":" ] is deprecated.
  1349. if ( !$.expr.pseudos ) {
  1350. 	$.expr.pseudos = $.expr[ ":" ];
  1351. }
  1352.  
  1353. // Support: jQuery 1.11.x or older
  1354. // $.unique has been renamed to $.uniqueSort
  1355. if ( !$.uniqueSort ) {
  1356. 	$.uniqueSort = $.unique;
  1357. }
  1358.  
  1359. // Support: jQuery 2.2.x or older.
  1360. // This method has been defined in jQuery 3.0.0.
  1361. // Code from https://github.com/jquery/jquery/blob/e539bac79e666bba95bba86d690b4e609dca2286/src/selector/escapeSelector.js
  1362. if ( !$.escapeSelector ) {
  1363.  
  1364. 	// CSS string/identifier serialization
  1365. 	// https://drafts.csswg.org/cssom/#common-serializing-idioms
  1366. 	var rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\x80-\uFFFF\w-]/g;
  1367.  
  1368. 	var fcssescape = function( ch, asCodePoint ) {
  1369. 		if ( asCodePoint ) {
  1370.  
  1371. 			// U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER
  1372. 			if ( ch === "\0" ) {
  1373. 				return "\uFFFD";
  1374. 			}
  1375.  
  1376. 			// Control characters and (dependent upon position) numbers get escaped as code points
  1377. 			return ch.slice( 0, -1 ) + "\\" + ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " ";
  1378. 		}
  1379.  
  1380. 		// Other potentially-special ASCII characters get backslash-escaped
  1381. 		return "\\" + ch;
  1382. 	};
  1383.  
  1384. 	$.escapeSelector = function( sel ) {
  1385. 		return ( sel + "" ).replace( rcssescape, fcssescape );
  1386. 	};
  1387. }
  1388.  
  1389. // Support: jQuery 3.4.x or older
  1390. // These methods have been defined in jQuery 3.5.0.
  1391. if ( !$.fn.even || !$.fn.odd ) {
  1392. 	$.fn.extend( {
  1393. 		even: function() {
  1394. 			return this.filter( function( i ) {
  1395. 				return i % 2 === 0;
  1396. 			} );
  1397. 		},
  1398. 		odd: function() {
  1399. 			return this.filter( function( i ) {
  1400. 				return i % 2 === 1;
  1401. 			} );
  1402. 		}
  1403. 	} );
  1404. }
  1405.  
  1406. ;
  1407. /*!
  1408.  * jQuery UI Keycode 1.13.0
  1409.  * http://jqueryui.com
  1410.  *
  1411.  * Copyright jQuery Foundation and other contributors
  1412.  * Released under the MIT license.
  1413.  * http://jquery.org/license
  1414.  */
  1415.  
  1416. //>>label: Keycode
  1417. //>>group: Core
  1418. //>>description: Provide keycodes as keynames
  1419. //>>docs: http://api.jqueryui.com/jQuery.ui.keyCode/
  1420.  
  1421.  
  1422. var keycode = $.ui.keyCode = {
  1423. 	BACKSPACE: 8,
  1424. 	COMMA: 188,
  1425. 	DELETE: 46,
  1426. 	DOWN: 40,
  1427. 	END: 35,
  1428. 	ENTER: 13,
  1429. 	ESCAPE: 27,
  1430. 	HOME: 36,
  1431. 	LEFT: 37,
  1432. 	PAGE_DOWN: 34,
  1433. 	PAGE_UP: 33,
  1434. 	PERIOD: 190,
  1435. 	RIGHT: 39,
  1436. 	SPACE: 32,
  1437. 	TAB: 9,
  1438. 	UP: 38
  1439. };
  1440.  
  1441.  
  1442. /*!
  1443.  * jQuery UI Labels 1.13.0
  1444.  * http://jqueryui.com
  1445.  *
  1446.  * Copyright jQuery Foundation and other contributors
  1447.  * Released under the MIT license.
  1448.  * http://jquery.org/license
  1449.  */
  1450.  
  1451. //>>label: labels
  1452. //>>group: Core
  1453. //>>description: Find all the labels associated with a given input
  1454. //>>docs: http://api.jqueryui.com/labels/
  1455.  
  1456.  
  1457. var labels = $.fn.labels = function() {
  1458. 	var ancestor, selector, id, labels, ancestors;
  1459.  
  1460. 	if ( !this.length ) {
  1461. 		return this.pushStack( [] );
  1462. 	}
  1463.  
  1464. 	// Check control.labels first
  1465. 	if ( this[ 0 ].labels && this[ 0 ].labels.length ) {
  1466. 		return this.pushStack( this[ 0 ].labels );
  1467. 	}
  1468.  
  1469. 	// Support: IE <= 11, FF <= 37, Android <= 2.3 only
  1470. 	// Above browsers do not support control.labels. Everything below is to support them
  1471. 	// as well as document fragments. control.labels does not work on document fragments
  1472. 	labels = this.eq( 0 ).parents( "label" );
  1473.  
  1474. 	// Look for the label based on the id
  1475. 	id = this.attr( "id" );
  1476. 	if ( id ) {
  1477.  
  1478. 		// We don't search against the document in case the element
  1479. 		// is disconnected from the DOM
  1480. 		ancestor = this.eq( 0 ).parents().last();
  1481.  
  1482. 		// Get a full set of top level ancestors
  1483. 		ancestors = ancestor.add( ancestor.length ? ancestor.siblings() : this.siblings() );
  1484.  
  1485. 		// Create a selector for the label based on the id
  1486. 		selector = "label[for='" + $.escapeSelector( id ) + "']";
  1487.  
  1488. 		labels = labels.add( ancestors.find( selector ).addBack( selector ) );
  1489.  
  1490. 	}
  1491.  
  1492. 	// Return whatever we have found for labels
  1493. 	return this.pushStack( labels );
  1494. };
  1495.  
  1496.  
  1497. /*!
  1498.  * jQuery UI Scroll Parent 1.13.0
  1499.  * http://jqueryui.com
  1500.  *
  1501.  * Copyright jQuery Foundation and other contributors
  1502.  * Released under the MIT license.
  1503.  * http://jquery.org/license
  1504.  */
  1505.  
  1506. //>>label: scrollParent
  1507. //>>group: Core
  1508. //>>description: Get the closest ancestor element that is scrollable.
  1509. //>>docs: http://api.jqueryui.com/scrollParent/
  1510.  
  1511.  
  1512. var scrollParent = $.fn.scrollParent = function( includeHidden ) {
  1513. 	var position = this.css( "position" ),
  1514. 		excludeStaticParent = position === "absolute",
  1515. 		overflowRegex = includeHidden ? /(auto|scroll|hidden)/ : /(auto|scroll)/,
  1516. 		scrollParent = this.parents().filter( function() {
  1517. 			var parent = $( this );
  1518. 			if ( excludeStaticParent && parent.css( "position" ) === "static" ) {
  1519. 				return false;
  1520. 			}
  1521. 			return overflowRegex.test( parent.css( "overflow" ) + parent.css( "overflow-y" ) +
  1522. 				parent.css( "overflow-x" ) );
  1523. 		} ).eq( 0 );
  1524.  
  1525. 	return position === "fixed" || !scrollParent.length ?
  1526. 		$( this[ 0 ].ownerDocument || document ) :
  1527. 		scrollParent;
  1528. };
  1529.  
  1530.  
  1531. /*!
  1532.  * jQuery UI Unique ID 1.13.0
  1533.  * http://jqueryui.com
  1534.  *
  1535.  * Copyright jQuery Foundation and other contributors
  1536.  * Released under the MIT license.
  1537.  * http://jquery.org/license
  1538.  */
  1539.  
  1540. //>>label: uniqueId
  1541. //>>group: Core
  1542. //>>description: Functions to generate and remove uniqueId's
  1543. //>>docs: http://api.jqueryui.com/uniqueId/
  1544.  
  1545.  
  1546. var uniqueId = $.fn.extend( {
  1547. 	uniqueId: ( function() {
  1548. 		var uuid = 0;
  1549.  
  1550. 		return function() {
  1551. 			return this.each( function() {
  1552. 				if ( !this.id ) {
  1553. 					this.id = "ui-id-" + ( ++uuid );
  1554. 				}
  1555. 			} );
  1556. 		};
  1557. 	} )(),
  1558.  
  1559. 	removeUniqueId: function() {
  1560. 		return this.each( function() {
  1561. 			if ( /^ui-id-\d+$/.test( this.id ) ) {
  1562. 				$( this ).removeAttr( "id" );
  1563. 			}
  1564. 		} );
  1565. 	}
  1566. } );
  1567.  
  1568.  
  1569. /*!
  1570.  * jQuery UI Controlgroup 1.13.0
  1571.  * http://jqueryui.com
  1572.  *
  1573.  * Copyright jQuery Foundation and other contributors
  1574.  * Released under the MIT license.
  1575.  * http://jquery.org/license
  1576.  */
  1577.  
  1578. //>>label: Controlgroup
  1579. //>>group: Widgets
  1580. //>>description: Visually groups form control widgets
  1581. //>>docs: http://api.jqueryui.com/controlgroup/
  1582. //>>demos: http://jqueryui.com/controlgroup/
  1583. //>>css.structure: ../../themes/base/core.css
  1584. //>>css.structure: ../../themes/base/controlgroup.css
  1585. //>>css.theme: ../../themes/base/theme.css
  1586.  
  1587.  
  1588. var controlgroupCornerRegex = /ui-corner-([a-z]){2,6}/g;
  1589.  
  1590. var widgetsControlgroup = $.widget( "ui.controlgroup", {
  1591. 	version: "1.13.0",
  1592. 	defaultElement: "<div>",
  1593. 	options: {
  1594. 		direction: "horizontal",
  1595. 		disabled: null,
  1596. 		onlyVisible: true,
  1597. 		items: {
  1598. 			"button": "input[type=button], input[type=submit], input[type=reset], button, a",
  1599. 			"controlgroupLabel": ".ui-controlgroup-label",
  1600. 			"checkboxradio": "input[type='checkbox'], input[type='radio']",
  1601. 			"selectmenu": "select",
  1602. 			"spinner": ".ui-spinner-input"
  1603. 		}
  1604. 	},
  1605.  
  1606. 	_create: function() {
  1607. 		this._enhance();
  1608. 	},
  1609.  
  1610. 	// To support the enhanced option in jQuery Mobile, we isolate DOM manipulation
  1611. 	_enhance: function() {
  1612. 		this.element.attr( "role", "toolbar" );
  1613. 		this.refresh();
  1614. 	},
  1615.  
  1616. 	_destroy: function() {
  1617. 		this._callChildMethod( "destroy" );
  1618. 		this.childWidgets.removeData( "ui-controlgroup-data" );
  1619. 		this.element.removeAttr( "role" );
  1620. 		if ( this.options.items.controlgroupLabel ) {
  1621. 			this.element
  1622. 				.find( this.options.items.controlgroupLabel )
  1623. 				.find( ".ui-controlgroup-label-contents" )
  1624. 				.contents().unwrap();
  1625. 		}
  1626. 	},
  1627.  
  1628. 	_initWidgets: function() {
  1629. 		var that = this,
  1630. 			childWidgets = [];
  1631.  
  1632. 		// First we iterate over each of the items options
  1633. 		$.each( this.options.items, function( widget, selector ) {
  1634. 			var labels;
  1635. 			var options = {};
  1636.  
  1637. 			// Make sure the widget has a selector set
  1638. 			if ( !selector ) {
  1639. 				return;
  1640. 			}
  1641.  
  1642. 			if ( widget === "controlgroupLabel" ) {
  1643. 				labels = that.element.find( selector );
  1644. 				labels.each( function() {
  1645. 					var element = $( this );
  1646.  
  1647. 					if ( element.children( ".ui-controlgroup-label-contents" ).length ) {
  1648. 						return;
  1649. 					}
  1650. 					element.contents()
  1651. 						.wrapAll( "<span class='ui-controlgroup-label-contents'></span>" );
  1652. 				} );
  1653. 				that._addClass( labels, null, "ui-widget ui-widget-content ui-state-default" );
  1654. 				childWidgets = childWidgets.concat( labels.get() );
  1655. 				return;
  1656. 			}
  1657.  
  1658. 			// Make sure the widget actually exists
  1659. 			if ( !$.fn[ widget ] ) {
  1660. 				return;
  1661. 			}
  1662.  
  1663. 			// We assume everything is in the middle to start because we can't determine
  1664. 			// first / last elements until all enhancments are done.
  1665. 			if ( that[ "_" + widget + "Options" ] ) {
  1666. 				options = that[ "_" + widget + "Options" ]( "middle" );
  1667. 			} else {
  1668. 				options = { classes: {} };
  1669. 			}
  1670.  
  1671. 			// Find instances of this widget inside controlgroup and init them
  1672. 			that.element
  1673. 				.find( selector )
  1674. 				.each( function() {
  1675. 					var element = $( this );
  1676. 					var instance = element[ widget ]( "instance" );
  1677.  
  1678. 					// We need to clone the default options for this type of widget to avoid
  1679. 					// polluting the variable options which has a wider scope than a single widget.
  1680. 					var instanceOptions = $.widget.extend( {}, options );
  1681.  
  1682. 					// If the button is the child of a spinner ignore it
  1683. 					// TODO: Find a more generic solution
  1684. 					if ( widget === "button" && element.parent( ".ui-spinner" ).length ) {
  1685. 						return;
  1686. 					}
  1687.  
  1688. 					// Create the widget if it doesn't exist
  1689. 					if ( !instance ) {
  1690. 						instance = element[ widget ]()[ widget ]( "instance" );
  1691. 					}
  1692. 					if ( instance ) {
  1693. 						instanceOptions.classes =
  1694. 							that._resolveClassesValues( instanceOptions.classes, instance );
  1695. 					}
  1696. 					element[ widget ]( instanceOptions );
  1697.  
  1698. 					// Store an instance of the controlgroup to be able to reference
  1699. 					// from the outermost element for changing options and refresh
  1700. 					var widgetElement = element[ widget ]( "widget" );
  1701. 					$.data( widgetElement[ 0 ], "ui-controlgroup-data",
  1702. 						instance ? instance : element[ widget ]( "instance" ) );
  1703.  
  1704. 					childWidgets.push( widgetElement[ 0 ] );
  1705. 				} );
  1706. 		} );
  1707.  
  1708. 		this.childWidgets = $( $.uniqueSort( childWidgets ) );
  1709. 		this._addClass( this.childWidgets, "ui-controlgroup-item" );
  1710. 	},
  1711.  
  1712. 	_callChildMethod: function( method ) {
  1713. 		this.childWidgets.each( function() {
  1714. 			var element = $( this ),
  1715. 				data = element.data( "ui-controlgroup-data" );
  1716. 			if ( data && data[ method ] ) {
  1717. 				data[ method ]();
  1718. 			}
  1719. 		} );
  1720. 	},
  1721.  
  1722. 	_updateCornerClass: function( element, position ) {
  1723. 		var remove = "ui-corner-top ui-corner-bottom ui-corner-left ui-corner-right ui-corner-all";
  1724. 		var add = this._buildSimpleOptions( position, "label" ).classes.label;
  1725.  
  1726. 		this._removeClass( element, null, remove );
  1727. 		this._addClass( element, null, add );
  1728. 	},
  1729.  
  1730. 	_buildSimpleOptions: function( position, key ) {
  1731. 		var direction = this.options.direction === "vertical";
  1732. 		var result = {
  1733. 			classes: {}
  1734. 		};
  1735. 		result.classes[ key ] = {
  1736. 			"middle": "",
  1737. 			"first": "ui-corner-" + ( direction ? "top" : "left" ),
  1738. 			"last": "ui-corner-" + ( direction ? "bottom" : "right" ),
  1739. 			"only": "ui-corner-all"
  1740. 		}[ position ];
  1741.  
  1742. 		return result;
  1743. 	},
  1744.  
  1745. 	_spinnerOptions: function( position ) {
  1746. 		var options = this._buildSimpleOptions( position, "ui-spinner" );
  1747.  
  1748. 		options.classes[ "ui-spinner-up" ] = "";
  1749. 		options.classes[ "ui-spinner-down" ] = "";
  1750.  
  1751. 		return options;
  1752. 	},
  1753.  
  1754. 	_buttonOptions: function( position ) {
  1755. 		return this._buildSimpleOptions( position, "ui-button" );
  1756. 	},
  1757.  
  1758. 	_checkboxradioOptions: function( position ) {
  1759. 		return this._buildSimpleOptions( position, "ui-checkboxradio-label" );
  1760. 	},
  1761.  
  1762. 	_selectmenuOptions: function( position ) {
  1763. 		var direction = this.options.direction === "vertical";
  1764. 		return {
  1765. 			width: direction ? "auto" : false,
  1766. 			classes: {
  1767. 				middle: {
  1768. 					"ui-selectmenu-button-open": "",
  1769. 					"ui-selectmenu-button-closed": ""
  1770. 				},
  1771. 				first: {
  1772. 					"ui-selectmenu-button-open": "ui-corner-" + ( direction ? "top" : "tl" ),
  1773. 					"ui-selectmenu-button-closed": "ui-corner-" + ( direction ? "top" : "left" )
  1774. 				},
  1775. 				last: {
  1776. 					"ui-selectmenu-button-open": direction ? "" : "ui-corner-tr",
  1777. 					"ui-selectmenu-button-closed": "ui-corner-" + ( direction ? "bottom" : "right" )
  1778. 				},
  1779. 				only: {
  1780. 					"ui-selectmenu-button-open": "ui-corner-top",
  1781. 					"ui-selectmenu-button-closed": "ui-corner-all"
  1782. 				}
  1783.  
  1784. 			}[ position ]
  1785. 		};
  1786. 	},
  1787.  
  1788. 	_resolveClassesValues: function( classes, instance ) {
  1789. 		var result = {};
  1790. 		$.each( classes, function( key ) {
  1791. 			var current = instance.options.classes[ key ] || "";
  1792. 			current = String.prototype.trim.call( current.replace( controlgroupCornerRegex, "" ) );
  1793. 			result[ key ] = ( current + " " + classes[ key ] ).replace( /\s+/g, " " );
  1794. 		} );
  1795. 		return result;
  1796. 	},
  1797.  
  1798. 	_setOption: function( key, value ) {
  1799. 		if ( key === "direction" ) {
  1800. 			this._removeClass( "ui-controlgroup-" + this.options.direction );
  1801. 		}
  1802.  
  1803. 		this._super( key, value );
  1804. 		if ( key === "disabled" ) {
  1805. 			this._callChildMethod( value ? "disable" : "enable" );
  1806. 			return;
  1807. 		}
  1808.  
  1809. 		this.refresh();
  1810. 	},
  1811.  
  1812. 	refresh: function() {
  1813. 		var children,
  1814. 			that = this;
  1815.  
  1816. 		this._addClass( "ui-controlgroup ui-controlgroup-" + this.options.direction );
  1817.  
  1818. 		if ( this.options.direction === "horizontal" ) {
  1819. 			this._addClass( null, "ui-helper-clearfix" );
  1820. 		}
  1821. 		this._initWidgets();
  1822.  
  1823. 		children = this.childWidgets;
  1824.  
  1825. 		// We filter here because we need to track all childWidgets not just the visible ones
  1826. 		if ( this.options.onlyVisible ) {
  1827. 			children = children.filter( ":visible" );
  1828. 		}
  1829.  
  1830. 		if ( children.length ) {
  1831.  
  1832. 			// We do this last because we need to make sure all enhancment is done
  1833. 			// before determining first and last
  1834. 			$.each( [ "first", "last" ], function( index, value ) {
  1835. 				var instance = children[ value ]().data( "ui-controlgroup-data" );
  1836.  
  1837. 				if ( instance && that[ "_" + instance.widgetName + "Options" ] ) {
  1838. 					var options = that[ "_" + instance.widgetName + "Options" ](
  1839. 						children.length === 1 ? "only" : value
  1840. 					);
  1841. 					options.classes = that._resolveClassesValues( options.classes, instance );
  1842. 					instance.element[ instance.widgetName ]( options );
  1843. 				} else {
  1844. 					that._updateCornerClass( children[ value ](), value );
  1845. 				}
  1846. 			} );
  1847.  
  1848. 			// Finally call the refresh method on each of the child widgets.
  1849. 			this._callChildMethod( "refresh" );
  1850. 		}
  1851. 	}
  1852. } );
  1853.  
  1854. /*!
  1855.  * jQuery UI Checkboxradio 1.13.0
  1856.  * http://jqueryui.com
  1857.  *
  1858.  * Copyright jQuery Foundation and other contributors
  1859.  * Released under the MIT license.
  1860.  * http://jquery.org/license
  1861.  */
  1862.  
  1863. //>>label: Checkboxradio
  1864. //>>group: Widgets
  1865. //>>description: Enhances a form with multiple themeable checkboxes or radio buttons.
  1866. //>>docs: http://api.jqueryui.com/checkboxradio/
  1867. //>>demos: http://jqueryui.com/checkboxradio/
  1868. //>>css.structure: ../../themes/base/core.css
  1869. //>>css.structure: ../../themes/base/button.css
  1870. //>>css.structure: ../../themes/base/checkboxradio.css
  1871. //>>css.theme: ../../themes/base/theme.css
  1872.  
  1873.  
  1874. $.widget( "ui.checkboxradio", [ $.ui.formResetMixin, {
  1875. 	version: "1.13.0",
  1876. 	options: {
  1877. 		disabled: null,
  1878. 		label: null,
  1879. 		icon: true,
  1880. 		classes: {
  1881. 			"ui-checkboxradio-label": "ui-corner-all",
  1882. 			"ui-checkboxradio-icon": "ui-corner-all"
  1883. 		}
  1884. 	},
  1885.  
  1886. 	_getCreateOptions: function() {
  1887. 		var disabled, labels;
  1888. 		var that = this;
  1889. 		var options = this._super() || {};
  1890.  
  1891. 		// We read the type here, because it makes more sense to throw a element type error first,
  1892. 		// rather then the error for lack of a label. Often if its the wrong type, it
  1893. 		// won't have a label (e.g. calling on a div, btn, etc)
  1894. 		this._readType();
  1895.  
  1896. 		labels = this.element.labels();
  1897.  
  1898. 		// If there are multiple labels, use the last one
  1899. 		this.label = $( labels[ labels.length - 1 ] );
  1900. 		if ( !this.label.length ) {
  1901. 			$.error( "No label found for checkboxradio widget" );
  1902. 		}
  1903.  
  1904. 		this.originalLabel = "";
  1905.  
  1906. 		// We need to get the label text but this may also need to make sure it does not contain the
  1907. 		// input itself.
  1908. 		this.label.contents().not( this.element[ 0 ] ).each( function() {
  1909.  
  1910. 			// The label contents could be text, html, or a mix. We concat each element to get a
  1911. 			// string representation of the label, without the input as part of it.
  1912. 			that.originalLabel += this.nodeType === 3 ? $( this ).text() : this.outerHTML;
  1913. 		} );
  1914.  
  1915. 		// Set the label option if we found label text
  1916. 		if ( this.originalLabel ) {
  1917. 			options.label = this.originalLabel;
  1918. 		}
  1919.  
  1920. 		disabled = this.element[ 0 ].disabled;
  1921. 		if ( disabled != null ) {
  1922. 			options.disabled = disabled;
  1923. 		}
  1924. 		return options;
  1925. 	},
  1926.  
  1927. 	_create: function() {
  1928. 		var checked = this.element[ 0 ].checked;
  1929.  
  1930. 		this._bindFormResetHandler();
  1931.  
  1932. 		if ( this.options.disabled == null ) {
  1933. 			this.options.disabled = this.element[ 0 ].disabled;
  1934. 		}
  1935.  
  1936. 		this._setOption( "disabled", this.options.disabled );
  1937. 		this._addClass( "ui-checkboxradio", "ui-helper-hidden-accessible" );
  1938. 		this._addClass( this.label, "ui-checkboxradio-label", "ui-button ui-widget" );
  1939.  
  1940. 		if ( this.type === "radio" ) {
  1941. 			this._addClass( this.label, "ui-checkboxradio-radio-label" );
  1942. 		}
  1943.  
  1944. 		if ( this.options.label && this.options.label !== this.originalLabel ) {
  1945. 			this._updateLabel();
  1946. 		} else if ( this.originalLabel ) {
  1947. 			this.options.label = this.originalLabel;
  1948. 		}
  1949.  
  1950. 		this._enhance();
  1951.  
  1952. 		if ( checked ) {
  1953. 			this._addClass( this.label, "ui-checkboxradio-checked", "ui-state-active" );
  1954. 		}
  1955.  
  1956. 		this._on( {
  1957. 			change: "_toggleClasses",
  1958. 			focus: function() {
  1959. 				this._addClass( this.label, null, "ui-state-focus ui-visual-focus" );
  1960. 			},
  1961. 			blur: function() {
  1962. 				this._removeClass( this.label, null, "ui-state-focus ui-visual-focus" );
  1963. 			}
  1964. 		} );
  1965. 	},
  1966.  
  1967. 	_readType: function() {
  1968. 		var nodeName = this.element[ 0 ].nodeName.toLowerCase();
  1969. 		this.type = this.element[ 0 ].type;
  1970. 		if ( nodeName !== "input" || !/radio|checkbox/.test( this.type ) ) {
  1971. 			$.error( "Can't create checkboxradio on element.nodeName=" + nodeName +
  1972. 				" and element.type=" + this.type );
  1973. 		}
  1974. 	},
  1975.  
  1976. 	// Support jQuery Mobile enhanced option
  1977. 	_enhance: function() {
  1978. 		this._updateIcon( this.element[ 0 ].checked );
  1979. 	},
  1980.  
  1981. 	widget: function() {
  1982. 		return this.label;
  1983. 	},
  1984.  
  1985. 	_getRadioGroup: function() {
  1986. 		var group;
  1987. 		var name = this.element[ 0 ].name;
  1988. 		var nameSelector = "input[name='" + $.escapeSelector( name ) + "']";
  1989.  
  1990. 		if ( !name ) {
  1991. 			return $( [] );
  1992. 		}
  1993.  
  1994. 		if ( this.form.length ) {
  1995. 			group = $( this.form[ 0 ].elements ).filter( nameSelector );
  1996. 		} else {
  1997.  
  1998. 			// Not inside a form, check all inputs that also are not inside a form
  1999. 			group = $( nameSelector ).filter( function() {
  2000. 				return $( this )._form().length === 0;
  2001. 			} );
  2002. 		}
  2003.  
  2004. 		return group.not( this.element );
  2005. 	},
  2006.  
  2007. 	_toggleClasses: function() {
  2008. 		var checked = this.element[ 0 ].checked;
  2009. 		this._toggleClass( this.label, "ui-checkboxradio-checked", "ui-state-active", checked );
  2010.  
  2011. 		if ( this.options.icon && this.type === "checkbox" ) {
  2012. 			this._toggleClass( this.icon, null, "ui-icon-check ui-state-checked", checked )
  2013. 				._toggleClass( this.icon, null, "ui-icon-blank", !checked );
  2014. 		}
  2015.  
  2016. 		if ( this.type === "radio" ) {
  2017. 			this._getRadioGroup()
  2018. 				.each( function() {
  2019. 					var instance = $( this ).checkboxradio( "instance" );
  2020.  
  2021. 					if ( instance ) {
  2022. 						instance._removeClass( instance.label,
  2023. 							"ui-checkboxradio-checked", "ui-state-active" );
  2024. 					}
  2025. 				} );
  2026. 		}
  2027. 	},
  2028.  
  2029. 	_destroy: function() {
  2030. 		this._unbindFormResetHandler();
  2031.  
  2032. 		if ( this.icon ) {
  2033. 			this.icon.remove();
  2034. 			this.iconSpace.remove();
  2035. 		}
  2036. 	},
  2037.  
  2038. 	_setOption: function( key, value ) {
  2039.  
  2040. 		// We don't allow the value to be set to nothing
  2041. 		if ( key === "label" && !value ) {
  2042. 			return;
  2043. 		}
  2044.  
  2045. 		this._super( key, value );
  2046.  
  2047. 		if ( key === "disabled" ) {
  2048. 			this._toggleClass( this.label, null, "ui-state-disabled", value );
  2049. 			this.element[ 0 ].disabled = value;
  2050.  
  2051. 			// Don't refresh when setting disabled
  2052. 			return;
  2053. 		}
  2054. 		this.refresh();
  2055. 	},
  2056.  
  2057. 	_updateIcon: function( checked ) {
  2058. 		var toAdd = "ui-icon ui-icon-background ";
  2059.  
  2060. 		if ( this.options.icon ) {
  2061. 			if ( !this.icon ) {
  2062. 				this.icon = $( "<span>" );
  2063. 				this.iconSpace = $( "<span> </span>" );
  2064. 				this._addClass( this.iconSpace, "ui-checkboxradio-icon-space" );
  2065. 			}
  2066.  
  2067. 			if ( this.type === "checkbox" ) {
  2068. 				toAdd += checked ? "ui-icon-check ui-state-checked" : "ui-icon-blank";
  2069. 				this._removeClass( this.icon, null, checked ? "ui-icon-blank" : "ui-icon-check" );
  2070. 			} else {
  2071. 				toAdd += "ui-icon-blank";
  2072. 			}
  2073. 			this._addClass( this.icon, "ui-checkboxradio-icon", toAdd );
  2074. 			if ( !checked ) {
  2075. 				this._removeClass( this.icon, null, "ui-icon-check ui-state-checked" );
  2076. 			}
  2077. 			this.icon.prependTo( this.label ).after( this.iconSpace );
  2078. 		} else if ( this.icon !== undefined ) {
  2079. 			this.icon.remove();
  2080. 			this.iconSpace.remove();
  2081. 			delete this.icon;
  2082. 		}
  2083. 	},
  2084.  
  2085. 	_updateLabel: function() {
  2086.  
  2087. 		// Remove the contents of the label ( minus the icon, icon space, and input )
  2088. 		var contents = this.label.contents().not( this.element[ 0 ] );
  2089. 		if ( this.icon ) {
  2090. 			contents = contents.not( this.icon[ 0 ] );
  2091. 		}
  2092. 		if ( this.iconSpace ) {
  2093. 			contents = contents.not( this.iconSpace[ 0 ] );
  2094. 		}
  2095. 		contents.remove();
  2096.  
  2097. 		this.label.append( this.options.label );
  2098. 	},
  2099.  
  2100. 	refresh: function() {
  2101. 		var checked = this.element[ 0 ].checked,
  2102. 			isDisabled = this.element[ 0 ].disabled;
  2103.  
  2104. 		this._updateIcon( checked );
  2105. 		this._toggleClass( this.label, "ui-checkboxradio-checked", "ui-state-active", checked );
  2106. 		if ( this.options.label !== null ) {
  2107. 			this._updateLabel();
  2108. 		}
  2109.  
  2110. 		if ( isDisabled !== this.options.disabled ) {
  2111. 			this._setOptions( { "disabled": isDisabled } );
  2112. 		}
  2113. 	}
  2114.  
  2115. } ] );
  2116.  
  2117. var widgetsCheckboxradio = $.ui.checkboxradio;
  2118.  
  2119.  
  2120. /*!
  2121.  * jQuery UI Button 1.13.0
  2122.  * http://jqueryui.com
  2123.  *
  2124.  * Copyright jQuery Foundation and other contributors
  2125.  * Released under the MIT license.
  2126.  * http://jquery.org/license
  2127.  */
  2128.  
  2129. //>>label: Button
  2130. //>>group: Widgets
  2131. //>>description: Enhances a form with themeable buttons.
  2132. //>>docs: http://api.jqueryui.com/button/
  2133. //>>demos: http://jqueryui.com/button/
  2134. //>>css.structure: ../../themes/base/core.css
  2135. //>>css.structure: ../../themes/base/button.css
  2136. //>>css.theme: ../../themes/base/theme.css
  2137.  
  2138.  
  2139. $.widget( "ui.button", {
  2140. 	version: "1.13.0",
  2141. 	defaultElement: "<button>",
  2142. 	options: {
  2143. 		classes: {
  2144. 			"ui-button": "ui-corner-all"
  2145. 		},
  2146. 		disabled: null,
  2147. 		icon: null,
  2148. 		iconPosition: "beginning",
  2149. 		label: null,
  2150. 		showLabel: true
  2151. 	},
  2152.  
  2153. 	_getCreateOptions: function() {
  2154. 		var disabled,
  2155.  
  2156. 			// This is to support cases like in jQuery Mobile where the base widget does have
  2157. 			// an implementation of _getCreateOptions
  2158. 			options = this._super() || {};
  2159.  
  2160. 		this.isInput = this.element.is( "input" );
  2161.  
  2162. 		disabled = this.element[ 0 ].disabled;
  2163. 		if ( disabled != null ) {
  2164. 			options.disabled = disabled;
  2165. 		}
  2166.  
  2167. 		this.originalLabel = this.isInput ? this.element.val() : this.element.html();
  2168. 		if ( this.originalLabel ) {
  2169. 			options.label = this.originalLabel;
  2170. 		}
  2171.  
  2172. 		return options;
  2173. 	},
  2174.  
  2175. 	_create: function() {
  2176. 		if ( !this.option.showLabel & !this.options.icon ) {
  2177. 			this.options.showLabel = true;
  2178. 		}
  2179.  
  2180. 		// We have to check the option again here even though we did in _getCreateOptions,
  2181. 		// because null may have been passed on init which would override what was set in
  2182. 		// _getCreateOptions
  2183. 		if ( this.options.disabled == null ) {
  2184. 			this.options.disabled = this.element[ 0 ].disabled || false;
  2185. 		}
  2186.  
  2187. 		this.hasTitle = !!this.element.attr( "title" );
  2188.  
  2189. 		// Check to see if the label needs to be set or if its already correct
  2190. 		if ( this.options.label && this.options.label !== this.originalLabel ) {
  2191. 			if ( this.isInput ) {
  2192. 				this.element.val( this.options.label );
  2193. 			} else {
  2194. 				this.element.html( this.options.label );
  2195. 			}
  2196. 		}
  2197. 		this._addClass( "ui-button", "ui-widget" );
  2198. 		this._setOption( "disabled", this.options.disabled );
  2199. 		this._enhance();
  2200.  
  2201. 		if ( this.element.is( "a" ) ) {
  2202. 			this._on( {
  2203. 				"keyup": function( event ) {
  2204. 					if ( event.keyCode === $.ui.keyCode.SPACE ) {
  2205. 						event.preventDefault();
  2206.  
  2207. 						// Support: PhantomJS <= 1.9, IE 8 Only
  2208. 						// If a native click is available use it so we actually cause navigation
  2209. 						// otherwise just trigger a click event
  2210. 						if ( this.element[ 0 ].click ) {
  2211. 							this.element[ 0 ].click();
  2212. 						} else {
  2213. 							this.element.trigger( "click" );
  2214. 						}
  2215. 					}
  2216. 				}
  2217. 			} );
  2218. 		}
  2219. 	},
  2220.  
  2221. 	_enhance: function() {
  2222. 		if ( !this.element.is( "button" ) ) {
  2223. 			this.element.attr( "role", "button" );
  2224. 		}
  2225.  
  2226. 		if ( this.options.icon ) {
  2227. 			this._updateIcon( "icon", this.options.icon );
  2228. 			this._updateTooltip();
  2229. 		}
  2230. 	},
  2231.  
  2232. 	_updateTooltip: function() {
  2233. 		this.title = this.element.attr( "title" );
  2234.  
  2235. 		if ( !this.options.showLabel && !this.title ) {
  2236. 			this.element.attr( "title", this.options.label );
  2237. 		}
  2238. 	},
  2239.  
  2240. 	_updateIcon: function( option, value ) {
  2241. 		var icon = option !== "iconPosition",
  2242. 			position = icon ? this.options.iconPosition : value,
  2243. 			displayBlock = position === "top" || position === "bottom";
  2244.  
  2245. 		// Create icon
  2246. 		if ( !this.icon ) {
  2247. 			this.icon = $( "<span>" );
  2248.  
  2249. 			this._addClass( this.icon, "ui-button-icon", "ui-icon" );
  2250.  
  2251. 			if ( !this.options.showLabel ) {
  2252. 				this._addClass( "ui-button-icon-only" );
  2253. 			}
  2254. 		} else if ( icon ) {
  2255.  
  2256. 			// If we are updating the icon remove the old icon class
  2257. 			this._removeClass( this.icon, null, this.options.icon );
  2258. 		}
  2259.  
  2260. 		// If we are updating the icon add the new icon class
  2261. 		if ( icon ) {
  2262. 			this._addClass( this.icon, null, value );
  2263. 		}
  2264.  
  2265. 		this._attachIcon( position );
  2266.  
  2267. 		// If the icon is on top or bottom we need to add the ui-widget-icon-block class and remove
  2268. 		// the iconSpace if there is one.
  2269. 		if ( displayBlock ) {
  2270. 			this._addClass( this.icon, null, "ui-widget-icon-block" );
  2271. 			if ( this.iconSpace ) {
  2272. 				this.iconSpace.remove();
  2273. 			}
  2274. 		} else {
  2275.  
  2276. 			// Position is beginning or end so remove the ui-widget-icon-block class and add the
  2277. 			// space if it does not exist
  2278. 			if ( !this.iconSpace ) {
  2279. 				this.iconSpace = $( "<span> </span>" );
  2280. 				this._addClass( this.iconSpace, "ui-button-icon-space" );
  2281. 			}
  2282. 			this._removeClass( this.icon, null, "ui-wiget-icon-block" );
  2283. 			this._attachIconSpace( position );
  2284. 		}
  2285. 	},
  2286.  
  2287. 	_destroy: function() {
  2288. 		this.element.removeAttr( "role" );
  2289.  
  2290. 		if ( this.icon ) {
  2291. 			this.icon.remove();
  2292. 		}
  2293. 		if ( this.iconSpace ) {
  2294. 			this.iconSpace.remove();
  2295. 		}
  2296. 		if ( !this.hasTitle ) {
  2297. 			this.element.removeAttr( "title" );
  2298. 		}
  2299. 	},
  2300.  
  2301. 	_attachIconSpace: function( iconPosition ) {
  2302. 		this.icon[ /^(?:end|bottom)/.test( iconPosition ) ? "before" : "after" ]( this.iconSpace );
  2303. 	},
  2304.  
  2305. 	_attachIcon: function( iconPosition ) {
  2306. 		this.element[ /^(?:end|bottom)/.test( iconPosition ) ? "append" : "prepend" ]( this.icon );
  2307. 	},
  2308.  
  2309. 	_setOptions: function( options ) {
  2310. 		var newShowLabel = options.showLabel === undefined ?
  2311. 				this.options.showLabel :
  2312. 				options.showLabel,
  2313. 			newIcon = options.icon === undefined ? this.options.icon : options.icon;
  2314.  
  2315. 		if ( !newShowLabel && !newIcon ) {
  2316. 			options.showLabel = true;
  2317. 		}
  2318. 		this._super( options );
  2319. 	},
  2320.  
  2321. 	_setOption: function( key, value ) {
  2322. 		if ( key === "icon" ) {
  2323. 			if ( value ) {
  2324. 				this._updateIcon( key, value );
  2325. 			} else if ( this.icon ) {
  2326. 				this.icon.remove();
  2327. 				if ( this.iconSpace ) {
  2328. 					this.iconSpace.remove();
  2329. 				}
  2330. 			}
  2331. 		}
  2332.  
  2333. 		if ( key === "iconPosition" ) {
  2334. 			this._updateIcon( key, value );
  2335. 		}
  2336.  
  2337. 		// Make sure we can't end up with a button that has neither text nor icon
  2338. 		if ( key === "showLabel" ) {
  2339. 				this._toggleClass( "ui-button-icon-only", null, !value );
  2340. 				this._updateTooltip();
  2341. 		}
  2342.  
  2343. 		if ( key === "label" ) {
  2344. 			if ( this.isInput ) {
  2345. 				this.element.val( value );
  2346. 			} else {
  2347.  
  2348. 				// If there is an icon, append it, else nothing then append the value
  2349. 				// this avoids removal of the icon when setting label text
  2350. 				this.element.html( value );
  2351. 				if ( this.icon ) {
  2352. 					this._attachIcon( this.options.iconPosition );
  2353. 					this._attachIconSpace( this.options.iconPosition );
  2354. 				}
  2355. 			}
  2356. 		}
  2357.  
  2358. 		this._super( key, value );
  2359.  
  2360. 		if ( key === "disabled" ) {
  2361. 			this._toggleClass( null, "ui-state-disabled", value );
  2362. 			this.element[ 0 ].disabled = value;
  2363. 			if ( value ) {
  2364. 				this.element.trigger( "blur" );
  2365. 			}
  2366. 		}
  2367. 	},
  2368.  
  2369. 	refresh: function() {
  2370.  
  2371. 		// Make sure to only check disabled if its an element that supports this otherwise
  2372. 		// check for the disabled class to determine state
  2373. 		var isDisabled = this.element.is( "input, button" ) ?
  2374. 			this.element[ 0 ].disabled : this.element.hasClass( "ui-button-disabled" );
  2375.  
  2376. 		if ( isDisabled !== this.options.disabled ) {
  2377. 			this._setOptions( { disabled: isDisabled } );
  2378. 		}
  2379.  
  2380. 		this._updateTooltip();
  2381. 	}
  2382. } );
  2383.  
  2384. // DEPRECATED
  2385. if ( $.uiBackCompat !== false ) {
  2386.  
  2387. 	// Text and Icons options
  2388. 	$.widget( "ui.button", $.ui.button, {
  2389. 		options: {
  2390. 			text: true,
  2391. 			icons: {
  2392. 				primary: null,
  2393. 				secondary: null
  2394. 			}
  2395. 		},
  2396.  
  2397. 		_create: function() {
  2398. 			if ( this.options.showLabel && !this.options.text ) {
  2399. 				this.options.showLabel = this.options.text;
  2400. 			}
  2401. 			if ( !this.options.showLabel && this.options.text ) {
  2402. 				this.options.text = this.options.showLabel;
  2403. 			}
  2404. 			if ( !this.options.icon && ( this.options.icons.primary ||
  2405. 					this.options.icons.secondary ) ) {
  2406. 				if ( this.options.icons.primary ) {
  2407. 					this.options.icon = this.options.icons.primary;
  2408. 				} else {
  2409. 					this.options.icon = this.options.icons.secondary;
  2410. 					this.options.iconPosition = "end";
  2411. 				}
  2412. 			} else if ( this.options.icon ) {
  2413. 				this.options.icons.primary = this.options.icon;
  2414. 			}
  2415. 			this._super();
  2416. 		},
  2417.  
  2418. 		_setOption: function( key, value ) {
  2419. 			if ( key === "text" ) {
  2420. 				this._super( "showLabel", value );
  2421. 				return;
  2422. 			}
  2423. 			if ( key === "showLabel" ) {
  2424. 				this.options.text = value;
  2425. 			}
  2426. 			if ( key === "icon" ) {
  2427. 				this.options.icons.primary = value;
  2428. 			}
  2429. 			if ( key === "icons" ) {
  2430. 				if ( value.primary ) {
  2431. 					this._super( "icon", value.primary );
  2432. 					this._super( "iconPosition", "beginning" );
  2433. 				} else if ( value.secondary ) {
  2434. 					this._super( "icon", value.secondary );
  2435. 					this._super( "iconPosition", "end" );
  2436. 				}
  2437. 			}
  2438. 			this._superApply( arguments );
  2439. 		}
  2440. 	} );
  2441.  
  2442. 	$.fn.button = ( function( orig ) {
  2443. 		return function( options ) {
  2444. 			var isMethodCall = typeof options === "string";
  2445. 			var args = Array.prototype.slice.call( arguments, 1 );
  2446. 			var returnValue = this;
  2447.  
  2448. 			if ( isMethodCall ) {
  2449.  
  2450. 				// If this is an empty collection, we need to have the instance method
  2451. 				// return undefined instead of the jQuery instance
  2452. 				if ( !this.length && options === "instance" ) {
  2453. 					returnValue = undefined;
  2454. 				} else {
  2455. 					this.each( function() {
  2456. 						var methodValue;
  2457. 						var type = $( this ).attr( "type" );
  2458. 						var name = type !== "checkbox" && type !== "radio" ?
  2459. 							"button" :
  2460. 							"checkboxradio";
  2461. 						var instance = $.data( this, "ui-" + name );
  2462.  
  2463. 						if ( options === "instance" ) {
  2464. 							returnValue = instance;
  2465. 							return false;
  2466. 						}
  2467.  
  2468. 						if ( !instance ) {
  2469. 							return $.error( "cannot call methods on button" +
  2470. 								" prior to initialization; " +
  2471. 								"attempted to call method '" + options + "'" );
  2472. 						}
  2473.  
  2474. 						if ( typeof instance[ options ] !== "function" ||
  2475. 							options.charAt( 0 ) === "_" ) {
  2476. 							return $.error( "no such method '" + options + "' for button" +
  2477. 								" widget instance" );
  2478. 						}
  2479.  
  2480. 						methodValue = instance[ options ].apply( instance, args );
  2481.  
  2482. 						if ( methodValue !== instance && methodValue !== undefined ) {
  2483. 							returnValue = methodValue && methodValue.jquery ?
  2484. 								returnValue.pushStack( methodValue.get() ) :
  2485. 								methodValue;
  2486. 							return false;
  2487. 						}
  2488. 					} );
  2489. 				}
  2490. 			} else {
  2491.  
  2492. 				// Allow multiple hashes to be passed on init
  2493. 				if ( args.length ) {
  2494. 					options = $.widget.extend.apply( null, [ options ].concat( args ) );
  2495. 				}
  2496.  
  2497. 				this.each( function() {
  2498. 					var type = $( this ).attr( "type" );
  2499. 					var name = type !== "checkbox" && type !== "radio" ? "button" : "checkboxradio";
  2500. 					var instance = $.data( this, "ui-" + name );
  2501.  
  2502. 					if ( instance ) {
  2503. 						instance.option( options || {} );
  2504. 						if ( instance._init ) {
  2505. 							instance._init();
  2506. 						}
  2507. 					} else {
  2508. 						if ( name === "button" ) {
  2509. 							orig.call( $( this ), options );
  2510. 							return;
  2511. 						}
  2512.  
  2513. 						$( this ).checkboxradio( $.extend( { icon: false }, options ) );
  2514. 					}
  2515. 				} );
  2516. 			}
  2517.  
  2518. 			return returnValue;
  2519. 		};
  2520. 	} )( $.fn.button );
  2521.  
  2522. 	$.fn.buttonset = function() {
  2523. 		if ( !$.ui.controlgroup ) {
  2524. 			$.error( "Controlgroup widget missing" );
  2525. 		}
  2526. 		if ( arguments[ 0 ] === "option" && arguments[ 1 ] === "items" && arguments[ 2 ] ) {
  2527. 			return this.controlgroup.apply( this,
  2528. 				[ arguments[ 0 ], "items.button", arguments[ 2 ] ] );
  2529. 		}
  2530. 		if ( arguments[ 0 ] === "option" && arguments[ 1 ] === "items" ) {
  2531. 			return this.controlgroup.apply( this, [ arguments[ 0 ], "items.button" ] );
  2532. 		}
  2533. 		if ( typeof arguments[ 0 ] === "object" && arguments[ 0 ].items ) {
  2534. 			arguments[ 0 ].items = {
  2535. 				button: arguments[ 0 ].items
  2536. 			};
  2537. 		}
  2538. 		return this.controlgroup.apply( this, arguments );
  2539. 	};
  2540. }
  2541.  
  2542. var widgetsButton = $.ui.button;
  2543.  
  2544.  
  2545.  
  2546. var safeActiveElement = $.ui.safeActiveElement = function( document ) {
  2547. 	var activeElement;
  2548.  
  2549. 	// Support: IE 9 only
  2550. 	// IE9 throws an "Unspecified error" accessing document.activeElement from an <iframe>
  2551. 	try {
  2552. 		activeElement = document.activeElement;
  2553. 	} catch ( error ) {
  2554. 		activeElement = document.body;
  2555. 	}
  2556.  
  2557. 	// Support: IE 9 - 11 only
  2558. 	// IE may return null instead of an element
  2559. 	// Interestingly, this only seems to occur when NOT in an iframe
  2560. 	if ( !activeElement ) {
  2561. 		activeElement = document.body;
  2562. 	}
  2563.  
  2564. 	// Support: IE 11 only
  2565. 	// IE11 returns a seemingly empty object in some cases when accessing
  2566. 	// document.activeElement from an <iframe>
  2567. 	if ( !activeElement.nodeName ) {
  2568. 		activeElement = document.body;
  2569. 	}
  2570.  
  2571. 	return activeElement;
  2572. };
  2573.  
  2574.  
  2575. /*!
  2576.  * jQuery UI Menu 1.13.0
  2577.  * http://jqueryui.com
  2578.  *
  2579.  * Copyright jQuery Foundation and other contributors
  2580.  * Released under the MIT license.
  2581.  * http://jquery.org/license
  2582.  */
  2583.  
  2584. //>>label: Menu
  2585. //>>group: Widgets
  2586. //>>description: Creates nestable menus.
  2587. //>>docs: http://api.jqueryui.com/menu/
  2588. //>>demos: http://jqueryui.com/menu/
  2589. //>>css.structure: ../../themes/base/core.css
  2590. //>>css.structure: ../../themes/base/menu.css
  2591. //>>css.theme: ../../themes/base/theme.css
  2592.  
  2593.  
  2594. var widgetsMenu = $.widget( "ui.menu", {
  2595. 	version: "1.13.0",
  2596. 	defaultElement: "<ul>",
  2597. 	delay: 300,
  2598. 	options: {
  2599. 		icons: {
  2600. 			submenu: "ui-icon-caret-1-e"
  2601. 		},
  2602. 		items: "> *",
  2603. 		menus: "ul",
  2604. 		position: {
  2605. 			my: "left top",
  2606. 			at: "right top"
  2607. 		},
  2608. 		role: "menu",
  2609.  
  2610. 		// Callbacks
  2611. 		blur: null,
  2612. 		focus: null,
  2613. 		select: null
  2614. 	},
  2615.  
  2616. 	_create: function() {
  2617. 		this.activeMenu = this.element;
  2618.  
  2619. 		// Flag used to prevent firing of the click handler
  2620. 		// as the event bubbles up through nested menus
  2621. 		this.mouseHandled = false;
  2622. 		this.lastMousePosition = { x: null, y: null };
  2623. 		this.element
  2624. 			.uniqueId()
  2625. 			.attr( {
  2626. 				role: this.options.role,
  2627. 				tabIndex: 0
  2628. 			} );
  2629.  
  2630. 		this._addClass( "ui-menu", "ui-widget ui-widget-content" );
  2631. 		this._on( {
  2632.  
  2633. 			// Prevent focus from sticking to links inside menu after clicking
  2634. 			// them (focus should always stay on UL during navigation).
  2635. 			"mousedown .ui-menu-item": function( event ) {
  2636. 				event.preventDefault();
  2637.  
  2638. 				this._activateItem( event );
  2639. 			},
  2640. 			"click .ui-menu-item": function( event ) {
  2641. 				var target = $( event.target );
  2642. 				var active = $( $.ui.safeActiveElement( this.document[ 0 ] ) );
  2643. 				if ( !this.mouseHandled && target.not( ".ui-state-disabled" ).length ) {
  2644. 					this.select( event );
  2645.  
  2646. 					// Only set the mouseHandled flag if the event will bubble, see #9469.
  2647. 					if ( !event.isPropagationStopped() ) {
  2648. 						this.mouseHandled = true;
  2649. 					}
  2650.  
  2651. 					// Open submenu on click
  2652. 					if ( target.has( ".ui-menu" ).length ) {
  2653. 						this.expand( event );
  2654. 					} else if ( !this.element.is( ":focus" ) &&
  2655. 							active.closest( ".ui-menu" ).length ) {
  2656.  
  2657. 						// Redirect focus to the menu
  2658. 						this.element.trigger( "focus", [ true ] );
  2659.  
  2660. 						// If the active item is on the top level, let it stay active.
  2661. 						// Otherwise, blur the active item since it is no longer visible.
  2662. 						if ( this.active && this.active.parents( ".ui-menu" ).length === 1 ) {
  2663. 							clearTimeout( this.timer );
  2664. 						}
  2665. 					}
  2666. 				}
  2667. 			},
  2668. 			"mouseenter .ui-menu-item": "_activateItem",
  2669. 			"mousemove .ui-menu-item": "_activateItem",
  2670. 			mouseleave: "collapseAll",
  2671. 			"mouseleave .ui-menu": "collapseAll",
  2672. 			focus: function( event, keepActiveItem ) {
  2673.  
  2674. 				// If there's already an active item, keep it active
  2675. 				// If not, activate the first item
  2676. 				var item = this.active || this._menuItems().first();
  2677.  
  2678. 				if ( !keepActiveItem ) {
  2679. 					this.focus( event, item );
  2680. 				}
  2681. 			},
  2682. 			blur: function( event ) {
  2683. 				this._delay( function() {
  2684. 					var notContained = !$.contains(
  2685. 						this.element[ 0 ],
  2686. 						$.ui.safeActiveElement( this.document[ 0 ] )
  2687. 					);
  2688. 					if ( notContained ) {
  2689. 						this.collapseAll( event );
  2690. 					}
  2691. 				} );
  2692. 			},
  2693. 			keydown: "_keydown"
  2694. 		} );
  2695.  
  2696. 		this.refresh();
  2697.  
  2698. 		// Clicks outside of a menu collapse any open menus
  2699. 		this._on( this.document, {
  2700. 			click: function( event ) {
  2701. 				if ( this._closeOnDocumentClick( event ) ) {
  2702. 					this.collapseAll( event, true );
  2703. 				}
  2704.  
  2705. 				// Reset the mouseHandled flag
  2706. 				this.mouseHandled = false;
  2707. 			}
  2708. 		} );
  2709. 	},
  2710.  
  2711. 	_activateItem: function( event ) {
  2712.  
  2713. 		// Ignore mouse events while typeahead is active, see #10458.
  2714. 		// Prevents focusing the wrong item when typeahead causes a scroll while the mouse
  2715. 		// is over an item in the menu
  2716. 		if ( this.previousFilter ) {
  2717. 			return;
  2718. 		}
  2719.  
  2720. 		// If the mouse didn't actually move, but the page was scrolled, ignore the event (#9356)
  2721. 		if ( event.clientX === this.lastMousePosition.x &&
  2722. 				event.clientY === this.lastMousePosition.y ) {
  2723. 			return;
  2724. 		}
  2725.  
  2726. 		this.lastMousePosition = {
  2727. 			x: event.clientX,
  2728. 			y: event.clientY
  2729. 		};
  2730.  
  2731. 		var actualTarget = $( event.target ).closest( ".ui-menu-item" ),
  2732. 			target = $( event.currentTarget );
  2733.  
  2734. 		// Ignore bubbled events on parent items, see #11641
  2735. 		if ( actualTarget[ 0 ] !== target[ 0 ] ) {
  2736. 			return;
  2737. 		}
  2738.  
  2739. 		// If the item is already active, there's nothing to do
  2740. 		if ( target.is( ".ui-state-active" ) ) {
  2741. 			return;
  2742. 		}
  2743.  
  2744. 		// Remove ui-state-active class from siblings of the newly focused menu item
  2745. 		// to avoid a jump caused by adjacent elements both having a class with a border
  2746. 		this._removeClass( target.siblings().children( ".ui-state-active" ),
  2747. 			null, "ui-state-active" );
  2748. 		this.focus( event, target );
  2749. 	},
  2750.  
  2751. 	_destroy: function() {
  2752. 		var items = this.element.find( ".ui-menu-item" )
  2753. 				.removeAttr( "role aria-disabled" ),
  2754. 			submenus = items.children( ".ui-menu-item-wrapper" )
  2755. 				.removeUniqueId()
  2756. 				.removeAttr( "tabIndex role aria-haspopup" );
  2757.  
  2758. 		// Destroy (sub)menus
  2759. 		this.element
  2760. 			.removeAttr( "aria-activedescendant" )
  2761. 			.find( ".ui-menu" ).addBack()
  2762. 				.removeAttr( "role aria-labelledby aria-expanded aria-hidden aria-disabled " +
  2763. 					"tabIndex" )
  2764. 				.removeUniqueId()
  2765. 				.show();
  2766.  
  2767. 		submenus.children().each( function() {
  2768. 			var elem = $( this );
  2769. 			if ( elem.data( "ui-menu-submenu-caret" ) ) {
  2770. 				elem.remove();
  2771. 			}
  2772. 		} );
  2773. 	},
  2774.  
  2775. 	_keydown: function( event ) {
  2776. 		var match, prev, character, skip,
  2777. 			preventDefault = true;
  2778.  
  2779. 		switch ( event.keyCode ) {
  2780. 		case $.ui.keyCode.PAGE_UP:
  2781. 			this.previousPage( event );
  2782. 			break;
  2783. 		case $.ui.keyCode.PAGE_DOWN:
  2784. 			this.nextPage( event );
  2785. 			break;
  2786. 		case $.ui.keyCode.HOME:
  2787. 			this._move( "first", "first", event );
  2788. 			break;
  2789. 		case $.ui.keyCode.END:
  2790. 			this._move( "last", "last", event );
  2791. 			break;
  2792. 		case $.ui.keyCode.UP:
  2793. 			this.previous( event );
  2794. 			break;
  2795. 		case $.ui.keyCode.DOWN:
  2796. 			this.next( event );
  2797. 			break;
  2798. 		case $.ui.keyCode.LEFT:
  2799. 			this.collapse( event );
  2800. 			break;
  2801. 		case $.ui.keyCode.RIGHT:
  2802. 			if ( this.active && !this.active.is( ".ui-state-disabled" ) ) {
  2803. 				this.expand( event );
  2804. 			}
  2805. 			break;
  2806. 		case $.ui.keyCode.ENTER:
  2807. 		case $.ui.keyCode.SPACE:
  2808. 			this._activate( event );
  2809. 			break;
  2810. 		case $.ui.keyCode.ESCAPE:
  2811. 			this.collapse( event );
  2812. 			break;
  2813. 		default:
  2814. 			preventDefault = false;
  2815. 			prev = this.previousFilter || "";
  2816. 			skip = false;
  2817.  
  2818. 			// Support number pad values
  2819. 			character = event.keyCode >= 96 && event.keyCode <= 105 ?
  2820. 				( event.keyCode - 96 ).toString() : String.fromCharCode( event.keyCode );
  2821.  
  2822. 			clearTimeout( this.filterTimer );
  2823.  
  2824. 			if ( character === prev ) {
  2825. 				skip = true;
  2826. 			} else {
  2827. 				character = prev + character;
  2828. 			}
  2829.  
  2830. 			match = this._filterMenuItems( character );
  2831. 			match = skip && match.index( this.active.next() ) !== -1 ?
  2832. 				this.active.nextAll( ".ui-menu-item" ) :
  2833. 				match;
  2834.  
  2835. 			// If no matches on the current filter, reset to the last character pressed
  2836. 			// to move down the menu to the first item that starts with that character
  2837. 			if ( !match.length ) {
  2838. 				character = String.fromCharCode( event.keyCode );
  2839. 				match = this._filterMenuItems( character );
  2840. 			}
  2841.  
  2842. 			if ( match.length ) {
  2843. 				this.focus( event, match );
  2844. 				this.previousFilter = character;
  2845. 				this.filterTimer = this._delay( function() {
  2846. 					delete this.previousFilter;
  2847. 				}, 1000 );
  2848. 			} else {
  2849. 				delete this.previousFilter;
  2850. 			}
  2851. 		}
  2852.  
  2853. 		if ( preventDefault ) {
  2854. 			event.preventDefault();
  2855. 		}
  2856. 	},
  2857.  
  2858. 	_activate: function( event ) {
  2859. 		if ( this.active && !this.active.is( ".ui-state-disabled" ) ) {
  2860. 			if ( this.active.children( "[aria-haspopup='true']" ).length ) {
  2861. 				this.expand( event );
  2862. 			} else {
  2863. 				this.select( event );
  2864. 			}
  2865. 		}
  2866. 	},
  2867.  
  2868. 	refresh: function() {
  2869. 		var menus, items, newSubmenus, newItems, newWrappers,
  2870. 			that = this,
  2871. 			icon = this.options.icons.submenu,
  2872. 			submenus = this.element.find( this.options.menus );
  2873.  
  2874. 		this._toggleClass( "ui-menu-icons", null, !!this.element.find( ".ui-icon" ).length );
  2875.  
  2876. 		// Initialize nested menus
  2877. 		newSubmenus = submenus.filter( ":not(.ui-menu)" )
  2878. 			.hide()
  2879. 			.attr( {
  2880. 				role: this.options.role,
  2881. 				"aria-hidden": "true",
  2882. 				"aria-expanded": "false"
  2883. 			} )
  2884. 			.each( function() {
  2885. 				var menu = $( this ),
  2886. 					item = menu.prev(),
  2887. 					submenuCaret = $( "<span>" ).data( "ui-menu-submenu-caret", true );
  2888.  
  2889. 				that._addClass( submenuCaret, "ui-menu-icon", "ui-icon " + icon );
  2890. 				item
  2891. 					.attr( "aria-haspopup", "true" )
  2892. 					.prepend( submenuCaret );
  2893. 				menu.attr( "aria-labelledby", item.attr( "id" ) );
  2894. 			} );
  2895.  
  2896. 		this._addClass( newSubmenus, "ui-menu", "ui-widget ui-widget-content ui-front" );
  2897.  
  2898. 		menus = submenus.add( this.element );
  2899. 		items = menus.find( this.options.items );
  2900.  
  2901. 		// Initialize menu-items containing spaces and/or dashes only as dividers
  2902. 		items.not( ".ui-menu-item" ).each( function() {
  2903. 			var item = $( this );
  2904. 			if ( that._isDivider( item ) ) {
  2905. 				that._addClass( item, "ui-menu-divider", "ui-widget-content" );
  2906. 			}
  2907. 		} );
  2908.  
  2909. 		// Don't refresh list items that are already adapted
  2910. 		newItems = items.not( ".ui-menu-item, .ui-menu-divider" );
  2911. 		newWrappers = newItems.children()
  2912. 			.not( ".ui-menu" )
  2913. 				.uniqueId()
  2914. 				.attr( {
  2915. 					tabIndex: -1,
  2916. 					role: this._itemRole()
  2917. 				} );
  2918. 		this._addClass( newItems, "ui-menu-item" )
  2919. 			._addClass( newWrappers, "ui-menu-item-wrapper" );
  2920.  
  2921. 		// Add aria-disabled attribute to any disabled menu item
  2922. 		items.filter( ".ui-state-disabled" ).attr( "aria-disabled", "true" );
  2923.  
  2924. 		// If the active item has been removed, blur the menu
  2925. 		if ( this.active && !$.contains( this.element[ 0 ], this.active[ 0 ] ) ) {
  2926. 			this.blur();
  2927. 		}
  2928. 	},
  2929.  
  2930. 	_itemRole: function() {
  2931. 		return {
  2932. 			menu: "menuitem",
  2933. 			listbox: "option"
  2934. 		}[ this.options.role ];
  2935. 	},
  2936.  
  2937. 	_setOption: function( key, value ) {
  2938. 		if ( key === "icons" ) {
  2939. 			var icons = this.element.find( ".ui-menu-icon" );
  2940. 			this._removeClass( icons, null, this.options.icons.submenu )
  2941. 				._addClass( icons, null, value.submenu );
  2942. 		}
  2943. 		this._super( key, value );
  2944. 	},
  2945.  
  2946. 	_setOptionDisabled: function( value ) {
  2947. 		this._super( value );
  2948.  
  2949. 		this.element.attr( "aria-disabled", String( value ) );
  2950. 		this._toggleClass( null, "ui-state-disabled", !!value );
  2951. 	},
  2952.  
  2953. 	focus: function( event, item ) {
  2954. 		var nested, focused, activeParent;
  2955. 		this.blur( event, event && event.type === "focus" );
  2956.  
  2957. 		this._scrollIntoView( item );
  2958.  
  2959. 		this.active = item.first();
  2960.  
  2961. 		focused = this.active.children( ".ui-menu-item-wrapper" );
  2962. 		this._addClass( focused, null, "ui-state-active" );
  2963.  
  2964. 		// Only update aria-activedescendant if there's a role
  2965. 		// otherwise we assume focus is managed elsewhere
  2966. 		if ( this.options.role ) {
  2967. 			this.element.attr( "aria-activedescendant", focused.attr( "id" ) );
  2968. 		}
  2969.  
  2970. 		// Highlight active parent menu item, if any
  2971. 		activeParent = this.active
  2972. 			.parent()
  2973. 				.closest( ".ui-menu-item" )
  2974. 					.children( ".ui-menu-item-wrapper" );
  2975. 		this._addClass( activeParent, null, "ui-state-active" );
  2976.  
  2977. 		if ( event && event.type === "keydown" ) {
  2978. 			this._close();
  2979. 		} else {
  2980. 			this.timer = this._delay( function() {
  2981. 				this._close();
  2982. 			}, this.delay );
  2983. 		}
  2984.  
  2985. 		nested = item.children( ".ui-menu" );
  2986. 		if ( nested.length && event && ( /^mouse/.test( event.type ) ) ) {
  2987. 			this._startOpening( nested );
  2988. 		}
  2989. 		this.activeMenu = item.parent();
  2990.  
  2991. 		this._trigger( "focus", event, { item: item } );
  2992. 	},
  2993.  
  2994. 	_scrollIntoView: function( item ) {
  2995. 		var borderTop, paddingTop, offset, scroll, elementHeight, itemHeight;
  2996. 		if ( this._hasScroll() ) {
  2997. 			borderTop = parseFloat( $.css( this.activeMenu[ 0 ], "borderTopWidth" ) ) || 0;
  2998. 			paddingTop = parseFloat( $.css( this.activeMenu[ 0 ], "paddingTop" ) ) || 0;
  2999. 			offset = item.offset().top - this.activeMenu.offset().top - borderTop - paddingTop;
  3000. 			scroll = this.activeMenu.scrollTop();
  3001. 			elementHeight = this.activeMenu.height();
  3002. 			itemHeight = item.outerHeight();
  3003.  
  3004. 			if ( offset < 0 ) {
  3005. 				this.activeMenu.scrollTop( scroll + offset );
  3006. 			} else if ( offset + itemHeight > elementHeight ) {
  3007. 				this.activeMenu.scrollTop( scroll + offset - elementHeight + itemHeight );
  3008. 			}
  3009. 		}
  3010. 	},
  3011.  
  3012. 	blur: function( event, fromFocus ) {
  3013. 		if ( !fromFocus ) {
  3014. 			clearTimeout( this.timer );
  3015. 		}
  3016.  
  3017. 		if ( !this.active ) {
  3018. 			return;
  3019. 		}
  3020.  
  3021. 		this._removeClass( this.active.children( ".ui-menu-item-wrapper" ),
  3022. 			null, "ui-state-active" );
  3023.  
  3024. 		this._trigger( "blur", event, { item: this.active } );
  3025. 		this.active = null;
  3026. 	},
  3027.  
  3028. 	_startOpening: function( submenu ) {
  3029. 		clearTimeout( this.timer );
  3030.  
  3031. 		// Don't open if already open fixes a Firefox bug that caused a .5 pixel
  3032. 		// shift in the submenu position when mousing over the caret icon
  3033. 		if ( submenu.attr( "aria-hidden" ) !== "true" ) {
  3034. 			return;
  3035. 		}
  3036.  
  3037. 		this.timer = this._delay( function() {
  3038. 			this._close();
  3039. 			this._open( submenu );
  3040. 		}, this.delay );
  3041. 	},
  3042.  
  3043. 	_open: function( submenu ) {
  3044. 		var position = $.extend( {
  3045. 			of: this.active
  3046. 		}, this.options.position );
  3047.  
  3048. 		clearTimeout( this.timer );
  3049. 		this.element.find( ".ui-menu" ).not( submenu.parents( ".ui-menu" ) )
  3050. 			.hide()
  3051. 			.attr( "aria-hidden", "true" );
  3052.  
  3053. 		submenu
  3054. 			.show()
  3055. 			.removeAttr( "aria-hidden" )
  3056. 			.attr( "aria-expanded", "true" )
  3057. 			.position( position );
  3058. 	},
  3059.  
  3060. 	collapseAll: function( event, all ) {
  3061. 		clearTimeout( this.timer );
  3062. 		this.timer = this._delay( function() {
  3063.  
  3064. 			// If we were passed an event, look for the submenu that contains the event
  3065. 			var currentMenu = all ? this.element :
  3066. 				$( event && event.target ).closest( this.element.find( ".ui-menu" ) );
  3067.  
  3068. 			// If we found no valid submenu ancestor, use the main menu to close all
  3069. 			// sub menus anyway
  3070. 			if ( !currentMenu.length ) {
  3071. 				currentMenu = this.element;
  3072. 			}
  3073.  
  3074. 			this._close( currentMenu );
  3075.  
  3076. 			this.blur( event );
  3077.  
  3078. 			// Work around active item staying active after menu is blurred
  3079. 			this._removeClass( currentMenu.find( ".ui-state-active" ), null, "ui-state-active" );
  3080.  
  3081. 			this.activeMenu = currentMenu;
  3082. 		}, all ? 0 : this.delay );
  3083. 	},
  3084.  
  3085. 	// With no arguments, closes the currently active menu - if nothing is active
  3086. 	// it closes all menus.  If passed an argument, it will search for menus BELOW
  3087. 	_close: function( startMenu ) {
  3088. 		if ( !startMenu ) {
  3089. 			startMenu = this.active ? this.active.parent() : this.element;
  3090. 		}
  3091.  
  3092. 		startMenu.find( ".ui-menu" )
  3093. 			.hide()
  3094. 			.attr( "aria-hidden", "true" )
  3095. 			.attr( "aria-expanded", "false" );
  3096. 	},
  3097.  
  3098. 	_closeOnDocumentClick: function( event ) {
  3099. 		return !$( event.target ).closest( ".ui-menu" ).length;
  3100. 	},
  3101.  
  3102. 	_isDivider: function( item ) {
  3103.  
  3104. 		// Match hyphen, em dash, en dash
  3105. 		return !/[^\-\u2014\u2013\s]/.test( item.text() );
  3106. 	},
  3107.  
  3108. 	collapse: function( event ) {
  3109. 		var newItem = this.active &&
  3110. 			this.active.parent().closest( ".ui-menu-item", this.element );
  3111. 		if ( newItem && newItem.length ) {
  3112. 			this._close();
  3113. 			this.focus( event, newItem );
  3114. 		}
  3115. 	},
  3116.  
  3117. 	expand: function( event ) {
  3118. 		var newItem = this.active && this._menuItems( this.active.children( ".ui-menu" ) ).first();
  3119.  
  3120. 		if ( newItem && newItem.length ) {
  3121. 			this._open( newItem.parent() );
  3122.  
  3123. 			// Delay so Firefox will not hide activedescendant change in expanding submenu from AT
  3124. 			this._delay( function() {
  3125. 				this.focus( event, newItem );
  3126. 			} );
  3127. 		}
  3128. 	},
  3129.  
  3130. 	next: function( event ) {
  3131. 		this._move( "next", "first", event );
  3132. 	},
  3133.  
  3134. 	previous: function( event ) {
  3135. 		this._move( "prev", "last", event );
  3136. 	},
  3137.  
  3138. 	isFirstItem: function() {
  3139. 		return this.active && !this.active.prevAll( ".ui-menu-item" ).length;
  3140. 	},
  3141.  
  3142. 	isLastItem: function() {
  3143. 		return this.active && !this.active.nextAll( ".ui-menu-item" ).length;
  3144. 	},
  3145.  
  3146. 	_menuItems: function( menu ) {
  3147. 		return ( menu || this.element )
  3148. 			.find( this.options.items )
  3149. 			.filter( ".ui-menu-item" );
  3150. 	},
  3151.  
  3152. 	_move: function( direction, filter, event ) {
  3153. 		var next;
  3154. 		if ( this.active ) {
  3155. 			if ( direction === "first" || direction === "last" ) {
  3156. 				next = this.active
  3157. 					[ direction === "first" ? "prevAll" : "nextAll" ]( ".ui-menu-item" )
  3158. 					.last();
  3159. 			} else {
  3160. 				next = this.active
  3161. 					[ direction + "All" ]( ".ui-menu-item" )
  3162. 					.first();
  3163. 			}
  3164. 		}
  3165. 		if ( !next || !next.length || !this.active ) {
  3166. 			next = this._menuItems( this.activeMenu )[ filter ]();
  3167. 		}
  3168.  
  3169. 		this.focus( event, next );
  3170. 	},
  3171.  
  3172. 	nextPage: function( event ) {
  3173. 		var item, base, height;
  3174.  
  3175. 		if ( !this.active ) {
  3176. 			this.next( event );
  3177. 			return;
  3178. 		}
  3179. 		if ( this.isLastItem() ) {
  3180. 			return;
  3181. 		}
  3182. 		if ( this._hasScroll() ) {
  3183. 			base = this.active.offset().top;
  3184. 			height = this.element.innerHeight();
  3185.  
  3186. 			// jQuery 3.2 doesn't include scrollbars in innerHeight, add it back.
  3187. 			if ( $.fn.jquery.indexOf( "3.2." ) === 0 ) {
  3188. 				height += this.element[ 0 ].offsetHeight - this.element.outerHeight();
  3189. 			}
  3190.  
  3191. 			this.active.nextAll( ".ui-menu-item" ).each( function() {
  3192. 				item = $( this );
  3193. 				return item.offset().top - base - height < 0;
  3194. 			} );
  3195.  
  3196. 			this.focus( event, item );
  3197. 		} else {
  3198. 			this.focus( event, this._menuItems( this.activeMenu )
  3199. 				[ !this.active ? "first" : "last" ]() );
  3200. 		}
  3201. 	},
  3202.  
  3203. 	previousPage: function( event ) {
  3204. 		var item, base, height;
  3205. 		if ( !this.active ) {
  3206. 			this.next( event );
  3207. 			return;
  3208. 		}
  3209. 		if ( this.isFirstItem() ) {
  3210. 			return;
  3211. 		}
  3212. 		if ( this._hasScroll() ) {
  3213. 			base = this.active.offset().top;
  3214. 			height = this.element.innerHeight();
  3215.  
  3216. 			// jQuery 3.2 doesn't include scrollbars in innerHeight, add it back.
  3217. 			if ( $.fn.jquery.indexOf( "3.2." ) === 0 ) {
  3218. 				height += this.element[ 0 ].offsetHeight - this.element.outerHeight();
  3219. 			}
  3220.  
  3221. 			this.active.prevAll( ".ui-menu-item" ).each( function() {
  3222. 				item = $( this );
  3223. 				return item.offset().top - base + height > 0;
  3224. 			} );
  3225.  
  3226. 			this.focus( event, item );
  3227. 		} else {
  3228. 			this.focus( event, this._menuItems( this.activeMenu ).first() );
  3229. 		}
  3230. 	},
  3231.  
  3232. 	_hasScroll: function() {
  3233. 		return this.element.outerHeight() < this.element.prop( "scrollHeight" );
  3234. 	},
  3235.  
  3236. 	select: function( event ) {
  3237.  
  3238. 		// TODO: It should never be possible to not have an active item at this
  3239. 		// point, but the tests don't trigger mouseenter before click.
  3240. 		this.active = this.active || $( event.target ).closest( ".ui-menu-item" );
  3241. 		var ui = { item: this.active };
  3242. 		if ( !this.active.has( ".ui-menu" ).length ) {
  3243. 			this.collapseAll( event, true );
  3244. 		}
  3245. 		this._trigger( "select", event, ui );
  3246. 	},
  3247.  
  3248. 	_filterMenuItems: function( character ) {
  3249. 		var escapedCharacter = character.replace( /[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&" ),
  3250. 			regex = new RegExp( "^" + escapedCharacter, "i" );
  3251.  
  3252. 		return this.activeMenu
  3253. 			.find( this.options.items )
  3254.  
  3255. 				// Only match on items, not dividers or other content (#10571)
  3256. 				.filter( ".ui-menu-item" )
  3257. 					.filter( function() {
  3258. 						return regex.test(
  3259. 							String.prototype.trim.call(
  3260. 								$( this ).children( ".ui-menu-item-wrapper" ).text() ) );
  3261. 					} );
  3262. 	}
  3263. } );
  3264.  
  3265.  
  3266.  
  3267. // This file is deprecated
  3268. var ie = $.ui.ie = !!/msie [\w.]+/.exec( navigator.userAgent.toLowerCase() );
  3269.  
  3270. /*!
  3271.  * jQuery UI Mouse 1.13.0
  3272.  * http://jqueryui.com
  3273.  *
  3274.  * Copyright jQuery Foundation and other contributors
  3275.  * Released under the MIT license.
  3276.  * http://jquery.org/license
  3277.  */
  3278.  
  3279. //>>label: Mouse
  3280. //>>group: Widgets
  3281. //>>description: Abstracts mouse-based interactions to assist in creating certain widgets.
  3282. //>>docs: http://api.jqueryui.com/mouse/
  3283.  
  3284.  
  3285. var mouseHandled = false;
  3286. $( document ).on( "mouseup", function() {
  3287. 	mouseHandled = false;
  3288. } );
  3289.  
  3290. var widgetsMouse = $.widget( "ui.mouse", {
  3291. 	version: "1.13.0",
  3292. 	options: {
  3293. 		cancel: "input, textarea, button, select, option",
  3294. 		distance: 1,
  3295. 		delay: 0
  3296. 	},
  3297. 	_mouseInit: function() {
  3298. 		var that = this;
  3299.  
  3300. 		this.element
  3301. 			.on( "mousedown." + this.widgetName, function( event ) {
  3302. 				return that._mouseDown( event );
  3303. 			} )
  3304. 			.on( "click." + this.widgetName, function( event ) {
  3305. 				if ( true === $.data( event.target, that.widgetName + ".preventClickEvent" ) ) {
  3306. 					$.removeData( event.target, that.widgetName + ".preventClickEvent" );
  3307. 					event.stopImmediatePropagation();
  3308. 					return false;
  3309. 				}
  3310. 			} );
  3311.  
  3312. 		this.started = false;
  3313. 	},
  3314.  
  3315. 	// TODO: make sure destroying one instance of mouse doesn't mess with
  3316. 	// other instances of mouse
  3317. 	_mouseDestroy: function() {
  3318. 		this.element.off( "." + this.widgetName );
  3319. 		if ( this._mouseMoveDelegate ) {
  3320. 			this.document
  3321. 				.off( "mousemove." + this.widgetName, this._mouseMoveDelegate )
  3322. 				.off( "mouseup." + this.widgetName, this._mouseUpDelegate );
  3323. 		}
  3324. 	},
  3325.  
  3326. 	_mouseDown: function( event ) {
  3327.  
  3328. 		// don't let more than one widget handle mouseStart
  3329. 		if ( mouseHandled ) {
  3330. 			return;
  3331. 		}
  3332.  
  3333. 		this._mouseMoved = false;
  3334.  
  3335. 		// We may have missed mouseup (out of window)
  3336. 		if ( this._mouseStarted ) {
  3337. 			this._mouseUp( event );
  3338. 		}
  3339.  
  3340. 		this._mouseDownEvent = event;
  3341.  
  3342. 		var that = this,
  3343. 			btnIsLeft = ( event.which === 1 ),
  3344.  
  3345. 			// event.target.nodeName works around a bug in IE 8 with
  3346. 			// disabled inputs (#7620)
  3347. 			elIsCancel = ( typeof this.options.cancel === "string" && event.target.nodeName ?
  3348. 				$( event.target ).closest( this.options.cancel ).length : false );
  3349. 		if ( !btnIsLeft || elIsCancel || !this._mouseCapture( event ) ) {
  3350. 			return true;
  3351. 		}
  3352.  
  3353. 		this.mouseDelayMet = !this.options.delay;
  3354. 		if ( !this.mouseDelayMet ) {
  3355. 			this._mouseDelayTimer = setTimeout( function() {
  3356. 				that.mouseDelayMet = true;
  3357. 			}, this.options.delay );
  3358. 		}
  3359.  
  3360. 		if ( this._mouseDistanceMet( event ) && this._mouseDelayMet( event ) ) {
  3361. 			this._mouseStarted = ( this._mouseStart( event ) !== false );
  3362. 			if ( !this._mouseStarted ) {
  3363. 				event.preventDefault();
  3364. 				return true;
  3365. 			}
  3366. 		}
  3367.  
  3368. 		// Click event may never have fired (Gecko & Opera)
  3369. 		if ( true === $.data( event.target, this.widgetName + ".preventClickEvent" ) ) {
  3370. 			$.removeData( event.target, this.widgetName + ".preventClickEvent" );
  3371. 		}
  3372.  
  3373. 		// These delegates are required to keep context
  3374. 		this._mouseMoveDelegate = function( event ) {
  3375. 			return that._mouseMove( event );
  3376. 		};
  3377. 		this._mouseUpDelegate = function( event ) {
  3378. 			return that._mouseUp( event );
  3379. 		};
  3380.  
  3381. 		this.document
  3382. 			.on( "mousemove." + this.widgetName, this._mouseMoveDelegate )
  3383. 			.on( "mouseup." + this.widgetName, this._mouseUpDelegate );
  3384.  
  3385. 		event.preventDefault();
  3386.  
  3387. 		mouseHandled = true;
  3388. 		return true;
  3389. 	},
  3390.  
  3391. 	_mouseMove: function( event ) {
  3392.  
  3393. 		// Only check for mouseups outside the document if you've moved inside the document
  3394. 		// at least once. This prevents the firing of mouseup in the case of IE<9, which will
  3395. 		// fire a mousemove event if content is placed under the cursor. See #7778
  3396. 		// Support: IE <9
  3397. 		if ( this._mouseMoved ) {
  3398.  
  3399. 			// IE mouseup check - mouseup happened when mouse was out of window
  3400. 			if ( $.ui.ie && ( !document.documentMode || document.documentMode < 9 ) &&
  3401. 					!event.button ) {
  3402. 				return this._mouseUp( event );
  3403.  
  3404. 			// Iframe mouseup check - mouseup occurred in another document
  3405. 			} else if ( !event.which ) {
  3406.  
  3407. 				// Support: Safari <=8 - 9
  3408. 				// Safari sets which to 0 if you press any of the following keys
  3409. 				// during a drag (#14461)
  3410. 				if ( event.originalEvent.altKey || event.originalEvent.ctrlKey ||
  3411. 						event.originalEvent.metaKey || event.originalEvent.shiftKey ) {
  3412. 					this.ignoreMissingWhich = true;
  3413. 				} else if ( !this.ignoreMissingWhich ) {
  3414. 					return this._mouseUp( event );
  3415. 				}
  3416. 			}
  3417. 		}
  3418.  
  3419. 		if ( event.which || event.button ) {
  3420. 			this._mouseMoved = true;
  3421. 		}
  3422.  
  3423. 		if ( this._mouseStarted ) {
  3424. 			this._mouseDrag( event );
  3425. 			return event.preventDefault();
  3426. 		}
  3427.  
  3428. 		if ( this._mouseDistanceMet( event ) && this._mouseDelayMet( event ) ) {
  3429. 			this._mouseStarted =
  3430. 				( this._mouseStart( this._mouseDownEvent, event ) !== false );
  3431. 			if ( this._mouseStarted ) {
  3432. 				this._mouseDrag( event );
  3433. 			} else {
  3434. 				this._mouseUp( event );
  3435. 			}
  3436. 		}
  3437.  
  3438. 		return !this._mouseStarted;
  3439. 	},
  3440.  
  3441. 	_mouseUp: function( event ) {
  3442. 		this.document
  3443. 			.off( "mousemove." + this.widgetName, this._mouseMoveDelegate )
  3444. 			.off( "mouseup." + this.widgetName, this._mouseUpDelegate );
  3445.  
  3446. 		if ( this._mouseStarted ) {
  3447. 			this._mouseStarted = false;
  3448.  
  3449. 			if ( event.target === this._mouseDownEvent.target ) {
  3450. 				$.data( event.target, this.widgetName + ".preventClickEvent", true );
  3451. 			}
  3452.  
  3453. 			this._mouseStop( event );
  3454. 		}
  3455.  
  3456. 		if ( this._mouseDelayTimer ) {
  3457. 			clearTimeout( this._mouseDelayTimer );
  3458. 			delete this._mouseDelayTimer;
  3459. 		}
  3460.  
  3461. 		this.ignoreMissingWhich = false;
  3462. 		mouseHandled = false;
  3463. 		event.preventDefault();
  3464. 	},
  3465.  
  3466. 	_mouseDistanceMet: function( event ) {
  3467. 		return ( Math.max(
  3468. 				Math.abs( this._mouseDownEvent.pageX - event.pageX ),
  3469. 				Math.abs( this._mouseDownEvent.pageY - event.pageY )
  3470. 			) >= this.options.distance
  3471. 		);
  3472. 	},
  3473.  
  3474. 	_mouseDelayMet: function( /* event */ ) {
  3475. 		return this.mouseDelayMet;
  3476. 	},
  3477.  
  3478. 	// These are placeholder methods, to be overriden by extending plugin
  3479. 	_mouseStart: function( /* event */ ) {},
  3480. 	_mouseDrag: function( /* event */ ) {},
  3481. 	_mouseStop: function( /* event */ ) {},
  3482. 	_mouseCapture: function( /* event */ ) {
  3483. 		return true;
  3484. 	}
  3485. } );
  3486.  
  3487.  
  3488. /*!
  3489.  * jQuery UI Progressbar 1.13.0
  3490.  * http://jqueryui.com
  3491.  *
  3492.  * Copyright jQuery Foundation and other contributors
  3493.  * Released under the MIT license.
  3494.  * http://jquery.org/license
  3495.  */
  3496.  
  3497. //>>label: Progressbar
  3498. //>>group: Widgets
  3499. /* eslint-disable max-len */
  3500. //>>description: Displays a status indicator for loading state, standard percentage, and other progress indicators.
  3501. /* eslint-enable max-len */
  3502. //>>docs: http://api.jqueryui.com/progressbar/
  3503. //>>demos: http://jqueryui.com/progressbar/
  3504. //>>css.structure: ../../themes/base/core.css
  3505. //>>css.structure: ../../themes/base/progressbar.css
  3506. //>>css.theme: ../../themes/base/theme.css
  3507.  
  3508.  
  3509. var widgetsProgressbar = $.widget( "ui.progressbar", {
  3510. 	version: "1.13.0",
  3511. 	options: {
  3512. 		classes: {
  3513. 			"ui-progressbar": "ui-corner-all",
  3514. 			"ui-progressbar-value": "ui-corner-left",
  3515. 			"ui-progressbar-complete": "ui-corner-right"
  3516. 		},
  3517. 		max: 100,
  3518. 		value: 0,
  3519.  
  3520. 		change: null,
  3521. 		complete: null
  3522. 	},
  3523.  
  3524. 	min: 0,
  3525.  
  3526. 	_create: function() {
  3527.  
  3528. 		// Constrain initial value
  3529. 		this.oldValue = this.options.value = this._constrainedValue();
  3530.  
  3531. 		this.element.attr( {
  3532.  
  3533. 			// Only set static values; aria-valuenow and aria-valuemax are
  3534. 			// set inside _refreshValue()
  3535. 			role: "progressbar",
  3536. 			"aria-valuemin": this.min
  3537. 		} );
  3538. 		this._addClass( "ui-progressbar", "ui-widget ui-widget-content" );
  3539.  
  3540. 		this.valueDiv = $( "<div>" ).appendTo( this.element );
  3541. 		this._addClass( this.valueDiv, "ui-progressbar-value", "ui-widget-header" );
  3542. 		this._refreshValue();
  3543. 	},
  3544.  
  3545. 	_destroy: function() {
  3546. 		this.element.removeAttr( "role aria-valuemin aria-valuemax aria-valuenow" );
  3547.  
  3548. 		this.valueDiv.remove();
  3549. 	},
  3550.  
  3551. 	value: function( newValue ) {
  3552. 		if ( newValue === undefined ) {
  3553. 			return this.options.value;
  3554. 		}
  3555.  
  3556. 		this.options.value = this._constrainedValue( newValue );
  3557. 		this._refreshValue();
  3558. 	},
  3559.  
  3560. 	_constrainedValue: function( newValue ) {
  3561. 		if ( newValue === undefined ) {
  3562. 			newValue = this.options.value;
  3563. 		}
  3564.  
  3565. 		this.indeterminate = newValue === false;
  3566.  
  3567. 		// Sanitize value
  3568. 		if ( typeof newValue !== "number" ) {
  3569. 			newValue = 0;
  3570. 		}
  3571.  
  3572. 		return this.indeterminate ? false :
  3573. 			Math.min( this.options.max, Math.max( this.min, newValue ) );
  3574. 	},
  3575.  
  3576. 	_setOptions: function( options ) {
  3577.  
  3578. 		// Ensure "value" option is set after other values (like max)
  3579. 		var value = options.value;
  3580. 		delete options.value;
  3581.  
  3582. 		this._super( options );
  3583.  
  3584. 		this.options.value = this._constrainedValue( value );
  3585. 		this._refreshValue();
  3586. 	},
  3587.  
  3588. 	_setOption: function( key, value ) {
  3589. 		if ( key === "max" ) {
  3590.  
  3591. 			// Don't allow a max less than min
  3592. 			value = Math.max( this.min, value );
  3593. 		}
  3594. 		this._super( key, value );
  3595. 	},
  3596.  
  3597. 	_setOptionDisabled: function( value ) {
  3598. 		this._super( value );
  3599.  
  3600. 		this.element.attr( "aria-disabled", value );
  3601. 		this._toggleClass( null, "ui-state-disabled", !!value );
  3602. 	},
  3603.  
  3604. 	_percentage: function() {
  3605. 		return this.indeterminate ?
  3606. 			100 :
  3607. 			100 * ( this.options.value - this.min ) / ( this.options.max - this.min );
  3608. 	},
  3609.  
  3610. 	_refreshValue: function() {
  3611. 		var value = this.options.value,
  3612. 			percentage = this._percentage();
  3613.  
  3614. 		this.valueDiv
  3615. 			.toggle( this.indeterminate || value > this.min )
  3616. 			.width( percentage.toFixed( 0 ) + "%" );
  3617.  
  3618. 		this
  3619. 			._toggleClass( this.valueDiv, "ui-progressbar-complete", null,
  3620. 				value === this.options.max )
  3621. 			._toggleClass( "ui-progressbar-indeterminate", null, this.indeterminate );
  3622.  
  3623. 		if ( this.indeterminate ) {
  3624. 			this.element.removeAttr( "aria-valuenow" );
  3625. 			if ( !this.overlayDiv ) {
  3626. 				this.overlayDiv = $( "<div>" ).appendTo( this.valueDiv );
  3627. 				this._addClass( this.overlayDiv, "ui-progressbar-overlay" );
  3628. 			}
  3629. 		} else {
  3630. 			this.element.attr( {
  3631. 				"aria-valuemax": this.options.max,
  3632. 				"aria-valuenow": value
  3633. 			} );
  3634. 			if ( this.overlayDiv ) {
  3635. 				this.overlayDiv.remove();
  3636. 				this.overlayDiv = null;
  3637. 			}
  3638. 		}
  3639.  
  3640. 		if ( this.oldValue !== value ) {
  3641. 			this.oldValue = value;
  3642. 			this._trigger( "change" );
  3643. 		}
  3644. 		if ( value === this.options.max ) {
  3645. 			this._trigger( "complete" );
  3646. 		}
  3647. 	}
  3648. } );
  3649.  
  3650.  
  3651. /*!
  3652.  * jQuery UI Selectmenu 1.13.0
  3653.  * http://jqueryui.com
  3654.  *
  3655.  * Copyright jQuery Foundation and other contributors
  3656.  * Released under the MIT license.
  3657.  * http://jquery.org/license
  3658.  */
  3659.  
  3660. //>>label: Selectmenu
  3661. //>>group: Widgets
  3662. /* eslint-disable max-len */
  3663. //>>description: Duplicates and extends the functionality of a native HTML select element, allowing it to be customizable in behavior and appearance far beyond the limitations of a native select.
  3664. /* eslint-enable max-len */
  3665. //>>docs: http://api.jqueryui.com/selectmenu/
  3666. //>>demos: http://jqueryui.com/selectmenu/
  3667. //>>css.structure: ../../themes/base/core.css
  3668. //>>css.structure: ../../themes/base/selectmenu.css, ../../themes/base/button.css
  3669. //>>css.theme: ../../themes/base/theme.css
  3670.  
  3671.  
  3672. var widgetsSelectmenu = $.widget( "ui.selectmenu", [ $.ui.formResetMixin, {
  3673. 	version: "1.13.0",
  3674. 	defaultElement: "<select>",
  3675. 	options: {
  3676. 		appendTo: null,
  3677. 		classes: {
  3678. 			"ui-selectmenu-button-open": "ui-corner-top",
  3679. 			"ui-selectmenu-button-closed": "ui-corner-all"
  3680. 		},
  3681. 		disabled: null,
  3682. 		icons: {
  3683. 			button: "ui-icon-triangle-1-s"
  3684. 		},
  3685. 		position: {
  3686. 			my: "left top",
  3687. 			at: "left bottom",
  3688. 			collision: "none"
  3689. 		},
  3690. 		width: false,
  3691.  
  3692. 		// Callbacks
  3693. 		change: null,
  3694. 		close: null,
  3695. 		focus: null,
  3696. 		open: null,
  3697. 		select: null
  3698. 	},
  3699.  
  3700. 	_create: function() {
  3701. 		var selectmenuId = this.element.uniqueId().attr( "id" );
  3702. 		this.ids = {
  3703. 			element: selectmenuId,
  3704. 			button: selectmenuId + "-button",
  3705. 			menu: selectmenuId + "-menu"
  3706. 		};
  3707.  
  3708. 		this._drawButton();
  3709. 		this._drawMenu();
  3710. 		this._bindFormResetHandler();
  3711.  
  3712. 		this._rendered = false;
  3713. 		this.menuItems = $();
  3714. 	},
  3715.  
  3716. 	_drawButton: function() {
  3717. 		var icon,
  3718. 			that = this,
  3719. 			item = this._parseOption(
  3720. 				this.element.find( "option:selected" ),
  3721. 				this.element[ 0 ].selectedIndex
  3722. 			);
  3723.  
  3724. 		// Associate existing label with the new button
  3725. 		this.labels = this.element.labels().attr( "for", this.ids.button );
  3726. 		this._on( this.labels, {
  3727. 			click: function( event ) {
  3728. 				this.button.trigger( "focus" );
  3729. 				event.preventDefault();
  3730. 			}
  3731. 		} );
  3732.  
  3733. 		// Hide original select element
  3734. 		this.element.hide();
  3735.  
  3736. 		// Create button
  3737. 		this.button = $( "<span>", {
  3738. 			tabindex: this.options.disabled ? -1 : 0,
  3739. 			id: this.ids.button,
  3740. 			role: "combobox",
  3741. 			"aria-expanded": "false",
  3742. 			"aria-autocomplete": "list",
  3743. 			"aria-owns": this.ids.menu,
  3744. 			"aria-haspopup": "true",
  3745. 			title: this.element.attr( "title" )
  3746. 		} )
  3747. 			.insertAfter( this.element );
  3748.  
  3749. 		this._addClass( this.button, "ui-selectmenu-button ui-selectmenu-button-closed",
  3750. 			"ui-button ui-widget" );
  3751.  
  3752. 		icon = $( "<span>" ).appendTo( this.button );
  3753. 		this._addClass( icon, "ui-selectmenu-icon", "ui-icon " + this.options.icons.button );
  3754. 		this.buttonItem = this._renderButtonItem( item )
  3755. 			.appendTo( this.button );
  3756.  
  3757. 		if ( this.options.width !== false ) {
  3758. 			this._resizeButton();
  3759. 		}
  3760.  
  3761. 		this._on( this.button, this._buttonEvents );
  3762. 		this.button.one( "focusin", function() {
  3763.  
  3764. 			// Delay rendering the menu items until the button receives focus.
  3765. 			// The menu may have already been rendered via a programmatic open.
  3766. 			if ( !that._rendered ) {
  3767. 				that._refreshMenu();
  3768. 			}
  3769. 		} );
  3770. 	},
  3771.  
  3772. 	_drawMenu: function() {
  3773. 		var that = this;
  3774.  
  3775. 		// Create menu
  3776. 		this.menu = $( "<ul>", {
  3777. 			"aria-hidden": "true",
  3778. 			"aria-labelledby": this.ids.button,
  3779. 			id: this.ids.menu
  3780. 		} );
  3781.  
  3782. 		// Wrap menu
  3783. 		this.menuWrap = $( "<div>" ).append( this.menu );
  3784. 		this._addClass( this.menuWrap, "ui-selectmenu-menu", "ui-front" );
  3785. 		this.menuWrap.appendTo( this._appendTo() );
  3786.  
  3787. 		// Initialize menu widget
  3788. 		this.menuInstance = this.menu
  3789. 			.menu( {
  3790. 				classes: {
  3791. 					"ui-menu": "ui-corner-bottom"
  3792. 				},
  3793. 				role: "listbox",
  3794. 				select: function( event, ui ) {
  3795. 					event.preventDefault();
  3796.  
  3797. 					// Support: IE8
  3798. 					// If the item was selected via a click, the text selection
  3799. 					// will be destroyed in IE
  3800. 					that._setSelection();
  3801.  
  3802. 					that._select( ui.item.data( "ui-selectmenu-item" ), event );
  3803. 				},
  3804. 				focus: function( event, ui ) {
  3805. 					var item = ui.item.data( "ui-selectmenu-item" );
  3806.  
  3807. 					// Prevent inital focus from firing and check if its a newly focused item
  3808. 					if ( that.focusIndex != null && item.index !== that.focusIndex ) {
  3809. 						that._trigger( "focus", event, { item: item } );
  3810. 						if ( !that.isOpen ) {
  3811. 							that._select( item, event );
  3812. 						}
  3813. 					}
  3814. 					that.focusIndex = item.index;
  3815.  
  3816. 					that.button.attr( "aria-activedescendant",
  3817. 						that.menuItems.eq( item.index ).attr( "id" ) );
  3818. 				}
  3819. 			} )
  3820. 			.menu( "instance" );
  3821.  
  3822. 		// Don't close the menu on mouseleave
  3823. 		this.menuInstance._off( this.menu, "mouseleave" );
  3824.  
  3825. 		// Cancel the menu's collapseAll on document click
  3826. 		this.menuInstance._closeOnDocumentClick = function() {
  3827. 			return false;
  3828. 		};
  3829.  
  3830. 		// Selects often contain empty items, but never contain dividers
  3831. 		this.menuInstance._isDivider = function() {
  3832. 			return false;
  3833. 		};
  3834. 	},
  3835.  
  3836. 	refresh: function() {
  3837. 		this._refreshMenu();
  3838. 		this.buttonItem.replaceWith(
  3839. 			this.buttonItem = this._renderButtonItem(
  3840.  
  3841. 				// Fall back to an empty object in case there are no options
  3842. 				this._getSelectedItem().data( "ui-selectmenu-item" ) || {}
  3843. 			)
  3844. 		);
  3845. 		if ( this.options.width === null ) {
  3846. 			this._resizeButton();
  3847. 		}
  3848. 	},
  3849.  
  3850. 	_refreshMenu: function() {
  3851. 		var item,
  3852. 			options = this.element.find( "option" );
  3853.  
  3854. 		this.menu.empty();
  3855.  
  3856. 		this._parseOptions( options );
  3857. 		this._renderMenu( this.menu, this.items );
  3858.  
  3859. 		this.menuInstance.refresh();
  3860. 		this.menuItems = this.menu.find( "li" )
  3861. 			.not( ".ui-selectmenu-optgroup" )
  3862. 				.find( ".ui-menu-item-wrapper" );
  3863.  
  3864. 		this._rendered = true;
  3865.  
  3866. 		if ( !options.length ) {
  3867. 			return;
  3868. 		}
  3869.  
  3870. 		item = this._getSelectedItem();
  3871.  
  3872. 		// Update the menu to have the correct item focused
  3873. 		this.menuInstance.focus( null, item );
  3874. 		this._setAria( item.data( "ui-selectmenu-item" ) );
  3875.  
  3876. 		// Set disabled state
  3877. 		this._setOption( "disabled", this.element.prop( "disabled" ) );
  3878. 	},
  3879.  
  3880. 	open: function( event ) {
  3881. 		if ( this.options.disabled ) {
  3882. 			return;
  3883. 		}
  3884.  
  3885. 		// If this is the first time the menu is being opened, render the items
  3886. 		if ( !this._rendered ) {
  3887. 			this._refreshMenu();
  3888. 		} else {
  3889.  
  3890. 			// Menu clears focus on close, reset focus to selected item
  3891. 			this._removeClass( this.menu.find( ".ui-state-active" ), null, "ui-state-active" );
  3892. 			this.menuInstance.focus( null, this._getSelectedItem() );
  3893. 		}
  3894.  
  3895. 		// If there are no options, don't open the menu
  3896. 		if ( !this.menuItems.length ) {
  3897. 			return;
  3898. 		}
  3899.  
  3900. 		this.isOpen = true;
  3901. 		this._toggleAttr();
  3902. 		this._resizeMenu();
  3903. 		this._position();
  3904.  
  3905. 		this._on( this.document, this._documentClick );
  3906.  
  3907. 		this._trigger( "open", event );
  3908. 	},
  3909.  
  3910. 	_position: function() {
  3911. 		this.menuWrap.position( $.extend( { of: this.button }, this.options.position ) );
  3912. 	},
  3913.  
  3914. 	close: function( event ) {
  3915. 		if ( !this.isOpen ) {
  3916. 			return;
  3917. 		}
  3918.  
  3919. 		this.isOpen = false;
  3920. 		this._toggleAttr();
  3921.  
  3922. 		this.range = null;
  3923. 		this._off( this.document );
  3924.  
  3925. 		this._trigger( "close", event );
  3926. 	},
  3927.  
  3928. 	widget: function() {
  3929. 		return this.button;
  3930. 	},
  3931.  
  3932. 	menuWidget: function() {
  3933. 		return this.menu;
  3934. 	},
  3935.  
  3936. 	_renderButtonItem: function( item ) {
  3937. 		var buttonItem = $( "<span>" );
  3938.  
  3939. 		this._setText( buttonItem, item.label );
  3940. 		this._addClass( buttonItem, "ui-selectmenu-text" );
  3941.  
  3942. 		return buttonItem;
  3943. 	},
  3944.  
  3945. 	_renderMenu: function( ul, items ) {
  3946. 		var that = this,
  3947. 			currentOptgroup = "";
  3948.  
  3949. 		$.each( items, function( index, item ) {
  3950. 			var li;
  3951.  
  3952. 			if ( item.optgroup !== currentOptgroup ) {
  3953. 				li = $( "<li>", {
  3954. 					text: item.optgroup
  3955. 				} );
  3956. 				that._addClass( li, "ui-selectmenu-optgroup", "ui-menu-divider" +
  3957. 					( item.element.parent( "optgroup" ).prop( "disabled" ) ?
  3958. 						" ui-state-disabled" :
  3959. 						"" ) );
  3960.  
  3961. 				li.appendTo( ul );
  3962.  
  3963. 				currentOptgroup = item.optgroup;
  3964. 			}
  3965.  
  3966. 			that._renderItemData( ul, item );
  3967. 		} );
  3968. 	},
  3969.  
  3970. 	_renderItemData: function( ul, item ) {
  3971. 		return this._renderItem( ul, item ).data( "ui-selectmenu-item", item );
  3972. 	},
  3973.  
  3974. 	_renderItem: function( ul, item ) {
  3975. 		var li = $( "<li>" ),
  3976. 			wrapper = $( "<div>", {
  3977. 				title: item.element.attr( "title" )
  3978. 			} );
  3979.  
  3980. 		if ( item.disabled ) {
  3981. 			this._addClass( li, null, "ui-state-disabled" );
  3982. 		}
  3983. 		this._setText( wrapper, item.label );
  3984.  
  3985. 		return li.append( wrapper ).appendTo( ul );
  3986. 	},
  3987.  
  3988. 	_setText: function( element, value ) {
  3989. 		if ( value ) {
  3990. 			element.text( value );
  3991. 		} else {
  3992. 			element.html( "&#160;" );
  3993. 		}
  3994. 	},
  3995.  
  3996. 	_move: function( direction, event ) {
  3997. 		var item, next,
  3998. 			filter = ".ui-menu-item";
  3999.  
  4000. 		if ( this.isOpen ) {
  4001. 			item = this.menuItems.eq( this.focusIndex ).parent( "li" );
  4002. 		} else {
  4003. 			item = this.menuItems.eq( this.element[ 0 ].selectedIndex ).parent( "li" );
  4004. 			filter += ":not(.ui-state-disabled)";
  4005. 		}
  4006.  
  4007. 		if ( direction === "first" || direction === "last" ) {
  4008. 			next = item[ direction === "first" ? "prevAll" : "nextAll" ]( filter ).eq( -1 );
  4009. 		} else {
  4010. 			next = item[ direction + "All" ]( filter ).eq( 0 );
  4011. 		}
  4012.  
  4013. 		if ( next.length ) {
  4014. 			this.menuInstance.focus( event, next );
  4015. 		}
  4016. 	},
  4017.  
  4018. 	_getSelectedItem: function() {
  4019. 		return this.menuItems.eq( this.element[ 0 ].selectedIndex ).parent( "li" );
  4020. 	},
  4021.  
  4022. 	_toggle: function( event ) {
  4023. 		this[ this.isOpen ? "close" : "open" ]( event );
  4024. 	},
  4025.  
  4026. 	_setSelection: function() {
  4027. 		var selection;
  4028.  
  4029. 		if ( !this.range ) {
  4030. 			return;
  4031. 		}
  4032.  
  4033. 		if ( window.getSelection ) {
  4034. 			selection = window.getSelection();
  4035. 			selection.removeAllRanges();
  4036. 			selection.addRange( this.range );
  4037.  
  4038. 		// Support: IE8
  4039. 		} else {
  4040. 			this.range.select();
  4041. 		}
  4042.  
  4043. 		// Support: IE
  4044. 		// Setting the text selection kills the button focus in IE, but
  4045. 		// restoring the focus doesn't kill the selection.
  4046. 		this.button.focus();
  4047. 	},
  4048.  
  4049. 	_documentClick: {
  4050. 		mousedown: function( event ) {
  4051. 			if ( !this.isOpen ) {
  4052. 				return;
  4053. 			}
  4054.  
  4055. 			if ( !$( event.target ).closest( ".ui-selectmenu-menu, #" +
  4056. 				$.escapeSelector( this.ids.button ) ).length ) {
  4057. 				this.close( event );
  4058. 			}
  4059. 		}
  4060. 	},
  4061.  
  4062. 	_buttonEvents: {
  4063.  
  4064. 		// Prevent text selection from being reset when interacting with the selectmenu (#10144)
  4065. 		mousedown: function() {
  4066. 			var selection;
  4067.  
  4068. 			if ( window.getSelection ) {
  4069. 				selection = window.getSelection();
  4070. 				if ( selection.rangeCount ) {
  4071. 					this.range = selection.getRangeAt( 0 );
  4072. 				}
  4073.  
  4074. 			// Support: IE8
  4075. 			} else {
  4076. 				this.range = document.selection.createRange();
  4077. 			}
  4078. 		},
  4079.  
  4080. 		click: function( event ) {
  4081. 			this._setSelection();
  4082. 			this._toggle( event );
  4083. 		},
  4084.  
  4085. 		keydown: function( event ) {
  4086. 			var preventDefault = true;
  4087. 			switch ( event.keyCode ) {
  4088. 			case $.ui.keyCode.TAB:
  4089. 			case $.ui.keyCode.ESCAPE:
  4090. 				this.close( event );
  4091. 				preventDefault = false;
  4092. 				break;
  4093. 			case $.ui.keyCode.ENTER:
  4094. 				if ( this.isOpen ) {
  4095. 					this._selectFocusedItem( event );
  4096. 				}
  4097. 				break;
  4098. 			case $.ui.keyCode.UP:
  4099. 				if ( event.altKey ) {
  4100. 					this._toggle( event );
  4101. 				} else {
  4102. 					this._move( "prev", event );
  4103. 				}
  4104. 				break;
  4105. 			case $.ui.keyCode.DOWN:
  4106. 				if ( event.altKey ) {
  4107. 					this._toggle( event );
  4108. 				} else {
  4109. 					this._move( "next", event );
  4110. 				}
  4111. 				break;
  4112. 			case $.ui.keyCode.SPACE:
  4113. 				if ( this.isOpen ) {
  4114. 					this._selectFocusedItem( event );
  4115. 				} else {
  4116. 					this._toggle( event );
  4117. 				}
  4118. 				break;
  4119. 			case $.ui.keyCode.LEFT:
  4120. 				this._move( "prev", event );
  4121. 				break;
  4122. 			case $.ui.keyCode.RIGHT:
  4123. 				this._move( "next", event );
  4124. 				break;
  4125. 			case $.ui.keyCode.HOME:
  4126. 			case $.ui.keyCode.PAGE_UP:
  4127. 				this._move( "first", event );
  4128. 				break;
  4129. 			case $.ui.keyCode.END:
  4130. 			case $.ui.keyCode.PAGE_DOWN:
  4131. 				this._move( "last", event );
  4132. 				break;
  4133. 			default:
  4134. 				this.menu.trigger( event );
  4135. 				preventDefault = false;
  4136. 			}
  4137.  
  4138. 			if ( preventDefault ) {
  4139. 				event.preventDefault();
  4140. 			}
  4141. 		}
  4142. 	},
  4143.  
  4144. 	_selectFocusedItem: function( event ) {
  4145. 		var item = this.menuItems.eq( this.focusIndex ).parent( "li" );
  4146. 		if ( !item.hasClass( "ui-state-disabled" ) ) {
  4147. 			this._select( item.data( "ui-selectmenu-item" ), event );
  4148. 		}
  4149. 	},
  4150.  
  4151. 	_select: function( item, event ) {
  4152. 		var oldIndex = this.element[ 0 ].selectedIndex;
  4153.  
  4154. 		// Change native select element
  4155. 		this.element[ 0 ].selectedIndex = item.index;
  4156. 		this.buttonItem.replaceWith( this.buttonItem = this._renderButtonItem( item ) );
  4157. 		this._setAria( item );
  4158. 		this._trigger( "select", event, { item: item } );
  4159.  
  4160. 		if ( item.index !== oldIndex ) {
  4161. 			this._trigger( "change", event, { item: item } );
  4162. 		}
  4163.  
  4164. 		this.close( event );
  4165. 	},
  4166.  
  4167. 	_setAria: function( item ) {
  4168. 		var id = this.menuItems.eq( item.index ).attr( "id" );
  4169.  
  4170. 		this.button.attr( {
  4171. 			"aria-labelledby": id,
  4172. 			"aria-activedescendant": id
  4173. 		} );
  4174. 		this.menu.attr( "aria-activedescendant", id );
  4175. 	},
  4176.  
  4177. 	_setOption: function( key, value ) {
  4178. 		if ( key === "icons" ) {
  4179. 			var icon = this.button.find( "span.ui-icon" );
  4180. 			this._removeClass( icon, null, this.options.icons.button )
  4181. 				._addClass( icon, null, value.button );
  4182. 		}
  4183.  
  4184. 		this._super( key, value );
  4185.  
  4186. 		if ( key === "appendTo" ) {
  4187. 			this.menuWrap.appendTo( this._appendTo() );
  4188. 		}
  4189.  
  4190. 		if ( key === "width" ) {
  4191. 			this._resizeButton();
  4192. 		}
  4193. 	},
  4194.  
  4195. 	_setOptionDisabled: function( value ) {
  4196. 		this._super( value );
  4197.  
  4198. 		this.menuInstance.option( "disabled", value );
  4199. 		this.button.attr( "aria-disabled", value );
  4200. 		this._toggleClass( this.button, null, "ui-state-disabled", value );
  4201.  
  4202. 		this.element.prop( "disabled", value );
  4203. 		if ( value ) {
  4204. 			this.button.attr( "tabindex", -1 );
  4205. 			this.close();
  4206. 		} else {
  4207. 			this.button.attr( "tabindex", 0 );
  4208. 		}
  4209. 	},
  4210.  
  4211. 	_appendTo: function() {
  4212. 		var element = this.options.appendTo;
  4213.  
  4214. 		if ( element ) {
  4215. 			element = element.jquery || element.nodeType ?
  4216. 				$( element ) :
  4217. 				this.document.find( element ).eq( 0 );
  4218. 		}
  4219.  
  4220. 		if ( !element || !element[ 0 ] ) {
  4221. 			element = this.element.closest( ".ui-front, dialog" );
  4222. 		}
  4223.  
  4224. 		if ( !element.length ) {
  4225. 			element = this.document[ 0 ].body;
  4226. 		}
  4227.  
  4228. 		return element;
  4229. 	},
  4230.  
  4231. 	_toggleAttr: function() {
  4232. 		this.button.attr( "aria-expanded", this.isOpen );
  4233.  
  4234. 		// We can't use two _toggleClass() calls here, because we need to make sure
  4235. 		// we always remove classes first and add them second, otherwise if both classes have the
  4236. 		// same theme class, it will be removed after we add it.
  4237. 		this._removeClass( this.button, "ui-selectmenu-button-" +
  4238. 			( this.isOpen ? "closed" : "open" ) )
  4239. 			._addClass( this.button, "ui-selectmenu-button-" +
  4240. 				( this.isOpen ? "open" : "closed" ) )
  4241. 			._toggleClass( this.menuWrap, "ui-selectmenu-open", null, this.isOpen );
  4242.  
  4243. 		this.menu.attr( "aria-hidden", !this.isOpen );
  4244. 	},
  4245.  
  4246. 	_resizeButton: function() {
  4247. 		var width = this.options.width;
  4248.  
  4249. 		// For `width: false`, just remove inline style and stop
  4250. 		if ( width === false ) {
  4251. 			this.button.css( "width", "" );
  4252. 			return;
  4253. 		}
  4254.  
  4255. 		// For `width: null`, match the width of the original element
  4256. 		if ( width === null ) {
  4257. 			width = this.element.show().outerWidth();
  4258. 			this.element.hide();
  4259. 		}
  4260.  
  4261. 		this.button.outerWidth( width );
  4262. 	},
  4263.  
  4264. 	_resizeMenu: function() {
  4265. 		this.menu.outerWidth( Math.max(
  4266. 			this.button.outerWidth(),
  4267.  
  4268. 			// Support: IE10
  4269. 			// IE10 wraps long text (possibly a rounding bug)
  4270. 			// so we add 1px to avoid the wrapping
  4271. 			this.menu.width( "" ).outerWidth() + 1
  4272. 		) );
  4273. 	},
  4274.  
  4275. 	_getCreateOptions: function() {
  4276. 		var options = this._super();
  4277.  
  4278. 		options.disabled = this.element.prop( "disabled" );
  4279.  
  4280. 		return options;
  4281. 	},
  4282.  
  4283. 	_parseOptions: function( options ) {
  4284. 		var that = this,
  4285. 			data = [];
  4286. 		options.each( function( index, item ) {
  4287. 			if ( item.hidden ) {
  4288. 				return;
  4289. 			}
  4290.  
  4291. 			data.push( that._parseOption( $( item ), index ) );
  4292. 		} );
  4293. 		this.items = data;
  4294. 	},
  4295.  
  4296. 	_parseOption: function( option, index ) {
  4297. 		var optgroup = option.parent( "optgroup" );
  4298.  
  4299. 		return {
  4300. 			element: option,
  4301. 			index: index,
  4302. 			value: option.val(),
  4303. 			label: option.text(),
  4304. 			optgroup: optgroup.attr( "label" ) || "",
  4305. 			disabled: optgroup.prop( "disabled" ) || option.prop( "disabled" )
  4306. 		};
  4307. 	},
  4308.  
  4309. 	_destroy: function() {
  4310. 		this._unbindFormResetHandler();
  4311. 		this.menuWrap.remove();
  4312. 		this.button.remove();
  4313. 		this.element.show();
  4314. 		this.element.removeUniqueId();
  4315. 		this.labels.attr( "for", this.ids.element );
  4316. 	}
  4317. } ] );
  4318.  
  4319.  
  4320. /*!
  4321.  * jQuery UI Slider 1.13.0
  4322.  * http://jqueryui.com
  4323.  *
  4324.  * Copyright jQuery Foundation and other contributors
  4325.  * Released under the MIT license.
  4326.  * http://jquery.org/license
  4327.  */
  4328.  
  4329. //>>label: Slider
  4330. //>>group: Widgets
  4331. //>>description: Displays a flexible slider with ranges and accessibility via keyboard.
  4332. //>>docs: http://api.jqueryui.com/slider/
  4333. //>>demos: http://jqueryui.com/slider/
  4334. //>>css.structure: ../../themes/base/core.css
  4335. //>>css.structure: ../../themes/base/slider.css
  4336. //>>css.theme: ../../themes/base/theme.css
  4337.  
  4338.  
  4339. var widgetsSlider = $.widget( "ui.slider", $.ui.mouse, {
  4340. 	version: "1.13.0",
  4341. 	widgetEventPrefix: "slide",
  4342.  
  4343. 	options: {
  4344. 		animate: false,
  4345. 		classes: {
  4346. 			"ui-slider": "ui-corner-all",
  4347. 			"ui-slider-handle": "ui-corner-all",
  4348.  
  4349. 			// Note: ui-widget-header isn't the most fittingly semantic framework class for this
  4350. 			// element, but worked best visually with a variety of themes
  4351. 			"ui-slider-range": "ui-corner-all ui-widget-header"
  4352. 		},
  4353. 		distance: 0,
  4354. 		max: 100,
  4355. 		min: 0,
  4356. 		orientation: "horizontal",
  4357. 		range: false,
  4358. 		step: 1,
  4359. 		value: 0,
  4360. 		values: null,
  4361.  
  4362. 		// Callbacks
  4363. 		change: null,
  4364. 		slide: null,
  4365. 		start: null,
  4366. 		stop: null
  4367. 	},
  4368.  
  4369. 	// Number of pages in a slider
  4370. 	// (how many times can you page up/down to go through the whole range)
  4371. 	numPages: 5,
  4372.  
  4373. 	_create: function() {
  4374. 		this._keySliding = false;
  4375. 		this._mouseSliding = false;
  4376. 		this._animateOff = true;
  4377. 		this._handleIndex = null;
  4378. 		this._detectOrientation();
  4379. 		this._mouseInit();
  4380. 		this._calculateNewMax();
  4381.  
  4382. 		this._addClass( "ui-slider ui-slider-" + this.orientation,
  4383. 			"ui-widget ui-widget-content" );
  4384.  
  4385. 		this._refresh();
  4386.  
  4387. 		this._animateOff = false;
  4388. 	},
  4389.  
  4390. 	_refresh: function() {
  4391. 		this._createRange();
  4392. 		this._createHandles();
  4393. 		this._setupEvents();
  4394. 		this._refreshValue();
  4395. 	},
  4396.  
  4397. 	_createHandles: function() {
  4398. 		var i, handleCount,
  4399. 			options = this.options,
  4400. 			existingHandles = this.element.find( ".ui-slider-handle" ),
  4401. 			handle = "<span tabindex='0'></span>",
  4402. 			handles = [];
  4403.  
  4404. 		handleCount = ( options.values && options.values.length ) || 1;
  4405.  
  4406. 		if ( existingHandles.length > handleCount ) {
  4407. 			existingHandles.slice( handleCount ).remove();
  4408. 			existingHandles = existingHandles.slice( 0, handleCount );
  4409. 		}
  4410.  
  4411. 		for ( i = existingHandles.length; i < handleCount; i++ ) {
  4412. 			handles.push( handle );
  4413. 		}
  4414.  
  4415. 		this.handles = existingHandles.add( $( handles.join( "" ) ).appendTo( this.element ) );
  4416.  
  4417. 		this._addClass( this.handles, "ui-slider-handle", "ui-state-default" );
  4418.  
  4419. 		this.handle = this.handles.eq( 0 );
  4420.  
  4421. 		this.handles.each( function( i ) {
  4422. 			$( this )
  4423. 				.data( "ui-slider-handle-index", i )
  4424. 				.attr( "tabIndex", 0 );
  4425. 		} );
  4426. 	},
  4427.  
  4428. 	_createRange: function() {
  4429. 		var options = this.options;
  4430.  
  4431. 		if ( options.range ) {
  4432. 			if ( options.range === true ) {
  4433. 				if ( !options.values ) {
  4434. 					options.values = [ this._valueMin(), this._valueMin() ];
  4435. 				} else if ( options.values.length && options.values.length !== 2 ) {
  4436. 					options.values = [ options.values[ 0 ], options.values[ 0 ] ];
  4437. 				} else if ( Array.isArray( options.values ) ) {
  4438. 					options.values = options.values.slice( 0 );
  4439. 				}
  4440. 			}
  4441.  
  4442. 			if ( !this.range || !this.range.length ) {
  4443. 				this.range = $( "<div>" )
  4444. 					.appendTo( this.element );
  4445.  
  4446. 				this._addClass( this.range, "ui-slider-range" );
  4447. 			} else {
  4448. 				this._removeClass( this.range, "ui-slider-range-min ui-slider-range-max" );
  4449.  
  4450. 				// Handle range switching from true to min/max
  4451. 				this.range.css( {
  4452. 					"left": "",
  4453. 					"bottom": ""
  4454. 				} );
  4455. 			}
  4456. 			if ( options.range === "min" || options.range === "max" ) {
  4457. 				this._addClass( this.range, "ui-slider-range-" + options.range );
  4458. 			}
  4459. 		} else {
  4460. 			if ( this.range ) {
  4461. 				this.range.remove();
  4462. 			}
  4463. 			this.range = null;
  4464. 		}
  4465. 	},
  4466.  
  4467. 	_setupEvents: function() {
  4468. 		this._off( this.handles );
  4469. 		this._on( this.handles, this._handleEvents );
  4470. 		this._hoverable( this.handles );
  4471. 		this._focusable( this.handles );
  4472. 	},
  4473.  
  4474. 	_destroy: function() {
  4475. 		this.handles.remove();
  4476. 		if ( this.range ) {
  4477. 			this.range.remove();
  4478. 		}
  4479.  
  4480. 		this._mouseDestroy();
  4481. 	},
  4482.  
  4483. 	_mouseCapture: function( event ) {
  4484. 		var position, normValue, distance, closestHandle, index, allowed, offset, mouseOverHandle,
  4485. 			that = this,
  4486. 			o = this.options;
  4487.  
  4488. 		if ( o.disabled ) {
  4489. 			return false;
  4490. 		}
  4491.  
  4492. 		this.elementSize = {
  4493. 			width: this.element.outerWidth(),
  4494. 			height: this.element.outerHeight()
  4495. 		};
  4496. 		this.elementOffset = this.element.offset();
  4497.  
  4498. 		position = { x: event.pageX, y: event.pageY };
  4499. 		normValue = this._normValueFromMouse( position );
  4500. 		distance = this._valueMax() - this._valueMin() + 1;
  4501. 		this.handles.each( function( i ) {
  4502. 			var thisDistance = Math.abs( normValue - that.values( i ) );
  4503. 			if ( ( distance > thisDistance ) ||
  4504. 				( distance === thisDistance &&
  4505. 					( i === that._lastChangedValue || that.values( i ) === o.min ) ) ) {
  4506. 				distance = thisDistance;
  4507. 				closestHandle = $( this );
  4508. 				index = i;
  4509. 			}
  4510. 		} );
  4511.  
  4512. 		allowed = this._start( event, index );
  4513. 		if ( allowed === false ) {
  4514. 			return false;
  4515. 		}
  4516. 		this._mouseSliding = true;
  4517.  
  4518. 		this._handleIndex = index;
  4519.  
  4520. 		this._addClass( closestHandle, null, "ui-state-active" );
  4521. 		closestHandle.trigger( "focus" );
  4522.  
  4523. 		offset = closestHandle.offset();
  4524. 		mouseOverHandle = !$( event.target ).parents().addBack().is( ".ui-slider-handle" );
  4525. 		this._clickOffset = mouseOverHandle ? { left: 0, top: 0 } : {
  4526. 			left: event.pageX - offset.left - ( closestHandle.width() / 2 ),
  4527. 			top: event.pageY - offset.top -
  4528. 				( closestHandle.height() / 2 ) -
  4529. 				( parseInt( closestHandle.css( "borderTopWidth" ), 10 ) || 0 ) -
  4530. 				( parseInt( closestHandle.css( "borderBottomWidth" ), 10 ) || 0 ) +
  4531. 				( parseInt( closestHandle.css( "marginTop" ), 10 ) || 0 )
  4532. 		};
  4533.  
  4534. 		if ( !this.handles.hasClass( "ui-state-hover" ) ) {
  4535. 			this._slide( event, index, normValue );
  4536. 		}
  4537. 		this._animateOff = true;
  4538. 		return true;
  4539. 	},
  4540.  
  4541. 	_mouseStart: function() {
  4542. 		return true;
  4543. 	},
  4544.  
  4545. 	_mouseDrag: function( event ) {
  4546. 		var position = { x: event.pageX, y: event.pageY },
  4547. 			normValue = this._normValueFromMouse( position );
  4548.  
  4549. 		this._slide( event, this._handleIndex, normValue );
  4550.  
  4551. 		return false;
  4552. 	},
  4553.  
  4554. 	_mouseStop: function( event ) {
  4555. 		this._removeClass( this.handles, null, "ui-state-active" );
  4556. 		this._mouseSliding = false;
  4557.  
  4558. 		this._stop( event, this._handleIndex );
  4559. 		this._change( event, this._handleIndex );
  4560.  
  4561. 		this._handleIndex = null;
  4562. 		this._clickOffset = null;
  4563. 		this._animateOff = false;
  4564.  
  4565. 		return false;
  4566. 	},
  4567.  
  4568. 	_detectOrientation: function() {
  4569. 		this.orientation = ( this.options.orientation === "vertical" ) ? "vertical" : "horizontal";
  4570. 	},
  4571.  
  4572. 	_normValueFromMouse: function( position ) {
  4573. 		var pixelTotal,
  4574. 			pixelMouse,
  4575. 			percentMouse,
  4576. 			valueTotal,
  4577. 			valueMouse;
  4578.  
  4579. 		if ( this.orientation === "horizontal" ) {
  4580. 			pixelTotal = this.elementSize.width;
  4581. 			pixelMouse = position.x - this.elementOffset.left -
  4582. 				( this._clickOffset ? this._clickOffset.left : 0 );
  4583. 		} else {
  4584. 			pixelTotal = this.elementSize.height;
  4585. 			pixelMouse = position.y - this.elementOffset.top -
  4586. 				( this._clickOffset ? this._clickOffset.top : 0 );
  4587. 		}
  4588.  
  4589. 		percentMouse = ( pixelMouse / pixelTotal );
  4590. 		if ( percentMouse > 1 ) {
  4591. 			percentMouse = 1;
  4592. 		}
  4593. 		if ( percentMouse < 0 ) {
  4594. 			percentMouse = 0;
  4595. 		}
  4596. 		if ( this.orientation === "vertical" ) {
  4597. 			percentMouse = 1 - percentMouse;
  4598. 		}
  4599.  
  4600. 		valueTotal = this._valueMax() - this._valueMin();
  4601. 		valueMouse = this._valueMin() + percentMouse * valueTotal;
  4602.  
  4603. 		return this._trimAlignValue( valueMouse );
  4604. 	},
  4605.  
  4606. 	_uiHash: function( index, value, values ) {
  4607. 		var uiHash = {
  4608. 			handle: this.handles[ index ],
  4609. 			handleIndex: index,
  4610. 			value: value !== undefined ? value : this.value()
  4611. 		};
  4612.  
  4613. 		if ( this._hasMultipleValues() ) {
  4614. 			uiHash.value = value !== undefined ? value : this.values( index );
  4615. 			uiHash.values = values || this.values();
  4616. 		}
  4617.  
  4618. 		return uiHash;
  4619. 	},
  4620.  
  4621. 	_hasMultipleValues: function() {
  4622. 		return this.options.values && this.options.values.length;
  4623. 	},
  4624.  
  4625. 	_start: function( event, index ) {
  4626. 		return this._trigger( "start", event, this._uiHash( index ) );
  4627. 	},
  4628.  
  4629. 	_slide: function( event, index, newVal ) {
  4630. 		var allowed, otherVal,
  4631. 			currentValue = this.value(),
  4632. 			newValues = this.values();
  4633.  
  4634. 		if ( this._hasMultipleValues() ) {
  4635. 			otherVal = this.values( index ? 0 : 1 );
  4636. 			currentValue = this.values( index );
  4637.  
  4638. 			if ( this.options.values.length === 2 && this.options.range === true ) {
  4639. 				newVal =  index === 0 ? Math.min( otherVal, newVal ) : Math.max( otherVal, newVal );
  4640. 			}
  4641.  
  4642. 			newValues[ index ] = newVal;
  4643. 		}
  4644.  
  4645. 		if ( newVal === currentValue ) {
  4646. 			return;
  4647. 		}
  4648.  
  4649. 		allowed = this._trigger( "slide", event, this._uiHash( index, newVal, newValues ) );
  4650.  
  4651. 		// A slide can be canceled by returning false from the slide callback
  4652. 		if ( allowed === false ) {
  4653. 			return;
  4654. 		}
  4655.  
  4656. 		if ( this._hasMultipleValues() ) {
  4657. 			this.values( index, newVal );
  4658. 		} else {
  4659. 			this.value( newVal );
  4660. 		}
  4661. 	},
  4662.  
  4663. 	_stop: function( event, index ) {
  4664. 		this._trigger( "stop", event, this._uiHash( index ) );
  4665. 	},
  4666.  
  4667. 	_change: function( event, index ) {
  4668. 		if ( !this._keySliding && !this._mouseSliding ) {
  4669.  
  4670. 			//store the last changed value index for reference when handles overlap
  4671. 			this._lastChangedValue = index;
  4672. 			this._trigger( "change", event, this._uiHash( index ) );
  4673. 		}
  4674. 	},
  4675.  
  4676. 	value: function( newValue ) {
  4677. 		if ( arguments.length ) {
  4678. 			this.options.value = this._trimAlignValue( newValue );
  4679. 			this._refreshValue();
  4680. 			this._change( null, 0 );
  4681. 			return;
  4682. 		}
  4683.  
  4684. 		return this._value();
  4685. 	},
  4686.  
  4687. 	values: function( index, newValue ) {
  4688. 		var vals,
  4689. 			newValues,
  4690. 			i;
  4691.  
  4692. 		if ( arguments.length > 1 ) {
  4693. 			this.options.values[ index ] = this._trimAlignValue( newValue );
  4694. 			this._refreshValue();
  4695. 			this._change( null, index );
  4696. 			return;
  4697. 		}
  4698.  
  4699. 		if ( arguments.length ) {
  4700. 			if ( Array.isArray( arguments[ 0 ] ) ) {
  4701. 				vals = this.options.values;
  4702. 				newValues = arguments[ 0 ];
  4703. 				for ( i = 0; i < vals.length; i += 1 ) {
  4704. 					vals[ i ] = this._trimAlignValue( newValues[ i ] );
  4705. 					this._change( null, i );
  4706. 				}
  4707. 				this._refreshValue();
  4708. 			} else {
  4709. 				if ( this._hasMultipleValues() ) {
  4710. 					return this._values( index );
  4711. 				} else {
  4712. 					return this.value();
  4713. 				}
  4714. 			}
  4715. 		} else {
  4716. 			return this._values();
  4717. 		}
  4718. 	},
  4719.  
  4720. 	_setOption: function( key, value ) {
  4721. 		var i,
  4722. 			valsLength = 0;
  4723.  
  4724. 		if ( key === "range" && this.options.range === true ) {
  4725. 			if ( value === "min" ) {
  4726. 				this.options.value = this._values( 0 );
  4727. 				this.options.values = null;
  4728. 			} else if ( value === "max" ) {
  4729. 				this.options.value = this._values( this.options.values.length - 1 );
  4730. 				this.options.values = null;
  4731. 			}
  4732. 		}
  4733.  
  4734. 		if ( Array.isArray( this.options.values ) ) {
  4735. 			valsLength = this.options.values.length;
  4736. 		}
  4737.  
  4738. 		this._super( key, value );
  4739.  
  4740. 		switch ( key ) {
  4741. 			case "orientation":
  4742. 				this._detectOrientation();
  4743. 				this._removeClass( "ui-slider-horizontal ui-slider-vertical" )
  4744. 					._addClass( "ui-slider-" + this.orientation );
  4745. 				this._refreshValue();
  4746. 				if ( this.options.range ) {
  4747. 					this._refreshRange( value );
  4748. 				}
  4749.  
  4750. 				// Reset positioning from previous orientation
  4751. 				this.handles.css( value === "horizontal" ? "bottom" : "left", "" );
  4752. 				break;
  4753. 			case "value":
  4754. 				this._animateOff = true;
  4755. 				this._refreshValue();
  4756. 				this._change( null, 0 );
  4757. 				this._animateOff = false;
  4758. 				break;
  4759. 			case "values":
  4760. 				this._animateOff = true;
  4761. 				this._refreshValue();
  4762.  
  4763. 				// Start from the last handle to prevent unreachable handles (#9046)
  4764. 				for ( i = valsLength - 1; i >= 0; i-- ) {
  4765. 					this._change( null, i );
  4766. 				}
  4767. 				this._animateOff = false;
  4768. 				break;
  4769. 			case "step":
  4770. 			case "min":
  4771. 			case "max":
  4772. 				this._animateOff = true;
  4773. 				this._calculateNewMax();
  4774. 				this._refreshValue();
  4775. 				this._animateOff = false;
  4776. 				break;
  4777. 			case "range":
  4778. 				this._animateOff = true;
  4779. 				this._refresh();
  4780. 				this._animateOff = false;
  4781. 				break;
  4782. 		}
  4783. 	},
  4784.  
  4785. 	_setOptionDisabled: function( value ) {
  4786. 		this._super( value );
  4787.  
  4788. 		this._toggleClass( null, "ui-state-disabled", !!value );
  4789. 	},
  4790.  
  4791. 	//internal value getter
  4792. 	// _value() returns value trimmed by min and max, aligned by step
  4793. 	_value: function() {
  4794. 		var val = this.options.value;
  4795. 		val = this._trimAlignValue( val );
  4796.  
  4797. 		return val;
  4798. 	},
  4799.  
  4800. 	//internal values getter
  4801. 	// _values() returns array of values trimmed by min and max, aligned by step
  4802. 	// _values( index ) returns single value trimmed by min and max, aligned by step
  4803. 	_values: function( index ) {
  4804. 		var val,
  4805. 			vals,
  4806. 			i;
  4807.  
  4808. 		if ( arguments.length ) {
  4809. 			val = this.options.values[ index ];
  4810. 			val = this._trimAlignValue( val );
  4811.  
  4812. 			return val;
  4813. 		} else if ( this._hasMultipleValues() ) {
  4814.  
  4815. 			// .slice() creates a copy of the array
  4816. 			// this copy gets trimmed by min and max and then returned
  4817. 			vals = this.options.values.slice();
  4818. 			for ( i = 0; i < vals.length; i += 1 ) {
  4819. 				vals[ i ] = this._trimAlignValue( vals[ i ] );
  4820. 			}
  4821.  
  4822. 			return vals;
  4823. 		} else {
  4824. 			return [];
  4825. 		}
  4826. 	},
  4827.  
  4828. 	// Returns the step-aligned value that val is closest to, between (inclusive) min and max
  4829. 	_trimAlignValue: function( val ) {
  4830. 		if ( val <= this._valueMin() ) {
  4831. 			return this._valueMin();
  4832. 		}
  4833. 		if ( val >= this._valueMax() ) {
  4834. 			return this._valueMax();
  4835. 		}
  4836. 		var step = ( this.options.step > 0 ) ? this.options.step : 1,
  4837. 			valModStep = ( val - this._valueMin() ) % step,
  4838. 			alignValue = val - valModStep;
  4839.  
  4840. 		if ( Math.abs( valModStep ) * 2 >= step ) {
  4841. 			alignValue += ( valModStep > 0 ) ? step : ( -step );
  4842. 		}
  4843.  
  4844. 		// Since JavaScript has problems with large floats, round
  4845. 		// the final value to 5 digits after the decimal point (see #4124)
  4846. 		return parseFloat( alignValue.toFixed( 5 ) );
  4847. 	},
  4848.  
  4849. 	_calculateNewMax: function() {
  4850. 		var max = this.options.max,
  4851. 			min = this._valueMin(),
  4852. 			step = this.options.step,
  4853. 			aboveMin = Math.round( ( max - min ) / step ) * step;
  4854. 		max = aboveMin + min;
  4855. 		if ( max > this.options.max ) {
  4856.  
  4857. 			//If max is not divisible by step, rounding off may increase its value
  4858. 			max -= step;
  4859. 		}
  4860. 		this.max = parseFloat( max.toFixed( this._precision() ) );
  4861. 	},
  4862.  
  4863. 	_precision: function() {
  4864. 		var precision = this._precisionOf( this.options.step );
  4865. 		if ( this.options.min !== null ) {
  4866. 			precision = Math.max( precision, this._precisionOf( this.options.min ) );
  4867. 		}
  4868. 		return precision;
  4869. 	},
  4870.  
  4871. 	_precisionOf: function( num ) {
  4872. 		var str = num.toString(),
  4873. 			decimal = str.indexOf( "." );
  4874. 		return decimal === -1 ? 0 : str.length - decimal - 1;
  4875. 	},
  4876.  
  4877. 	_valueMin: function() {
  4878. 		return this.options.min;
  4879. 	},
  4880.  
  4881. 	_valueMax: function() {
  4882. 		return this.max;
  4883. 	},
  4884.  
  4885. 	_refreshRange: function( orientation ) {
  4886. 		if ( orientation === "vertical" ) {
  4887. 			this.range.css( { "width": "", "left": "" } );
  4888. 		}
  4889. 		if ( orientation === "horizontal" ) {
  4890. 			this.range.css( { "height": "", "bottom": "" } );
  4891. 		}
  4892. 	},
  4893.  
  4894. 	_refreshValue: function() {
  4895. 		var lastValPercent, valPercent, value, valueMin, valueMax,
  4896. 			oRange = this.options.range,
  4897. 			o = this.options,
  4898. 			that = this,
  4899. 			animate = ( !this._animateOff ) ? o.animate : false,
  4900. 			_set = {};
  4901.  
  4902. 		if ( this._hasMultipleValues() ) {
  4903. 			this.handles.each( function( i ) {
  4904. 				valPercent = ( that.values( i ) - that._valueMin() ) / ( that._valueMax() -
  4905. 					that._valueMin() ) * 100;
  4906. 				_set[ that.orientation === "horizontal" ? "left" : "bottom" ] = valPercent + "%";
  4907. 				$( this ).stop( 1, 1 )[ animate ? "animate" : "css" ]( _set, o.animate );
  4908. 				if ( that.options.range === true ) {
  4909. 					if ( that.orientation === "horizontal" ) {
  4910. 						if ( i === 0 ) {
  4911. 							that.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( {
  4912. 								left: valPercent + "%"
  4913. 							}, o.animate );
  4914. 						}
  4915. 						if ( i === 1 ) {
  4916. 							that.range[ animate ? "animate" : "css" ]( {
  4917. 								width: ( valPercent - lastValPercent ) + "%"
  4918. 							}, {
  4919. 								queue: false,
  4920. 								duration: o.animate
  4921. 							} );
  4922. 						}
  4923. 					} else {
  4924. 						if ( i === 0 ) {
  4925. 							that.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( {
  4926. 								bottom: ( valPercent ) + "%"
  4927. 							}, o.animate );
  4928. 						}
  4929. 						if ( i === 1 ) {
  4930. 							that.range[ animate ? "animate" : "css" ]( {
  4931. 								height: ( valPercent - lastValPercent ) + "%"
  4932. 							}, {
  4933. 								queue: false,
  4934. 								duration: o.animate
  4935. 							} );
  4936. 						}
  4937. 					}
  4938. 				}
  4939. 				lastValPercent = valPercent;
  4940. 			} );
  4941. 		} else {
  4942. 			value = this.value();
  4943. 			valueMin = this._valueMin();
  4944. 			valueMax = this._valueMax();
  4945. 			valPercent = ( valueMax !== valueMin ) ?
  4946. 					( value - valueMin ) / ( valueMax - valueMin ) * 100 :
  4947. 					0;
  4948. 			_set[ this.orientation === "horizontal" ? "left" : "bottom" ] = valPercent + "%";
  4949. 			this.handle.stop( 1, 1 )[ animate ? "animate" : "css" ]( _set, o.animate );
  4950.  
  4951. 			if ( oRange === "min" && this.orientation === "horizontal" ) {
  4952. 				this.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( {
  4953. 					width: valPercent + "%"
  4954. 				}, o.animate );
  4955. 			}
  4956. 			if ( oRange === "max" && this.orientation === "horizontal" ) {
  4957. 				this.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( {
  4958. 					width: ( 100 - valPercent ) + "%"
  4959. 				}, o.animate );
  4960. 			}
  4961. 			if ( oRange === "min" && this.orientation === "vertical" ) {
  4962. 				this.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( {
  4963. 					height: valPercent + "%"
  4964. 				}, o.animate );
  4965. 			}
  4966. 			if ( oRange === "max" && this.orientation === "vertical" ) {
  4967. 				this.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( {
  4968. 					height: ( 100 - valPercent ) + "%"
  4969. 				}, o.animate );
  4970. 			}
  4971. 		}
  4972. 	},
  4973.  
  4974. 	_handleEvents: {
  4975. 		keydown: function( event ) {
  4976. 			var allowed, curVal, newVal, step,
  4977. 				index = $( event.target ).data( "ui-slider-handle-index" );
  4978.  
  4979. 			switch ( event.keyCode ) {
  4980. 				case $.ui.keyCode.HOME:
  4981. 				case $.ui.keyCode.END:
  4982. 				case $.ui.keyCode.PAGE_UP:
  4983. 				case $.ui.keyCode.PAGE_DOWN:
  4984. 				case $.ui.keyCode.UP:
  4985. 				case $.ui.keyCode.RIGHT:
  4986. 				case $.ui.keyCode.DOWN:
  4987. 				case $.ui.keyCode.LEFT:
  4988. 					event.preventDefault();
  4989. 					if ( !this._keySliding ) {
  4990. 						this._keySliding = true;
  4991. 						this._addClass( $( event.target ), null, "ui-state-active" );
  4992. 						allowed = this._start( event, index );
  4993. 						if ( allowed === false ) {
  4994. 							return;
  4995. 						}
  4996. 					}
  4997. 					break;
  4998. 			}
  4999.  
  5000. 			step = this.options.step;
  5001. 			if ( this._hasMultipleValues() ) {
  5002. 				curVal = newVal = this.values( index );
  5003. 			} else {
  5004. 				curVal = newVal = this.value();
  5005. 			}
  5006.  
  5007. 			switch ( event.keyCode ) {
  5008. 				case $.ui.keyCode.HOME:
  5009. 					newVal = this._valueMin();
  5010. 					break;
  5011. 				case $.ui.keyCode.END:
  5012. 					newVal = this._valueMax();
  5013. 					break;
  5014. 				case $.ui.keyCode.PAGE_UP:
  5015. 					newVal = this._trimAlignValue(
  5016. 						curVal + ( ( this._valueMax() - this._valueMin() ) / this.numPages )
  5017. 					);
  5018. 					break;
  5019. 				case $.ui.keyCode.PAGE_DOWN:
  5020. 					newVal = this._trimAlignValue(
  5021. 						curVal - ( ( this._valueMax() - this._valueMin() ) / this.numPages ) );
  5022. 					break;
  5023. 				case $.ui.keyCode.UP:
  5024. 				case $.ui.keyCode.RIGHT:
  5025. 					if ( curVal === this._valueMax() ) {
  5026. 						return;
  5027. 					}
  5028. 					newVal = this._trimAlignValue( curVal + step );
  5029. 					break;
  5030. 				case $.ui.keyCode.DOWN:
  5031. 				case $.ui.keyCode.LEFT:
  5032. 					if ( curVal === this._valueMin() ) {
  5033. 						return;
  5034. 					}
  5035. 					newVal = this._trimAlignValue( curVal - step );
  5036. 					break;
  5037. 			}
  5038.  
  5039. 			this._slide( event, index, newVal );
  5040. 		},
  5041. 		keyup: function( event ) {
  5042. 			var index = $( event.target ).data( "ui-slider-handle-index" );
  5043.  
  5044. 			if ( this._keySliding ) {
  5045. 				this._keySliding = false;
  5046. 				this._stop( event, index );
  5047. 				this._change( event, index );
  5048. 				this._removeClass( $( event.target ), null, "ui-state-active" );
  5049. 			}
  5050. 		}
  5051. 	}
  5052. } );
  5053.  
  5054.  
  5055.  
  5056. // Create a local jQuery because jQuery Color relies on it and the
  5057. // global may not exist with AMD and a custom build (#10199).
  5058. // This module is a noop if used as a regular AMD module.
  5059. // eslint-disable-next-line no-unused-vars
  5060. var jQuery = $;
  5061.  
  5062.  
  5063. /*!
  5064.  * jQuery Color Animations v2.2.0
  5065.  * https://github.com/jquery/jquery-color
  5066.  *
  5067.  * Copyright OpenJS Foundation and other contributors
  5068.  * Released under the MIT license.
  5069.  * http://jquery.org/license
  5070.  *
  5071.  * Date: Sun May 10 09:02:36 2020 +0200
  5072.  */
  5073.  
  5074.  
  5075.  
  5076. 	var stepHooks = "backgroundColor borderBottomColor borderLeftColor borderRightColor " +
  5077. 		"borderTopColor color columnRuleColor outlineColor textDecorationColor textEmphasisColor",
  5078.  
  5079. 	class2type = {},
  5080. 	toString = class2type.toString,
  5081.  
  5082. 	// plusequals test for += 100 -= 100
  5083. 	rplusequals = /^([\-+])=\s*(\d+\.?\d*)/,
  5084.  
  5085. 	// a set of RE's that can match strings and generate color tuples.
  5086. 	stringParsers = [ {
  5087. 			re: /rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,
  5088. 			parse: function( execResult ) {
  5089. 				return [
  5090. 					execResult[ 1 ],
  5091. 					execResult[ 2 ],
  5092. 					execResult[ 3 ],
  5093. 					execResult[ 4 ]
  5094. 				];
  5095. 			}
  5096. 		}, {
  5097. 			re: /rgba?\(\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,
  5098. 			parse: function( execResult ) {
  5099. 				return [
  5100. 					execResult[ 1 ] * 2.55,
  5101. 					execResult[ 2 ] * 2.55,
  5102. 					execResult[ 3 ] * 2.55,
  5103. 					execResult[ 4 ]
  5104. 				];
  5105. 			}
  5106. 		}, {
  5107.  
  5108. 			// this regex ignores A-F because it's compared against an already lowercased string
  5109. 			re: /#([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})?/,
  5110. 			parse: function( execResult ) {
  5111. 				return [
  5112. 					parseInt( execResult[ 1 ], 16 ),
  5113. 					parseInt( execResult[ 2 ], 16 ),
  5114. 					parseInt( execResult[ 3 ], 16 ),
  5115. 					execResult[ 4 ] ?
  5116. 						( parseInt( execResult[ 4 ], 16 ) / 255 ).toFixed( 2 ) :
  5117. 						1
  5118. 				];
  5119. 			}
  5120. 		}, {
  5121.  
  5122. 			// this regex ignores A-F because it's compared against an already lowercased string
  5123. 			re: /#([a-f0-9])([a-f0-9])([a-f0-9])([a-f0-9])?/,
  5124. 			parse: function( execResult ) {
  5125. 				return [
  5126. 					parseInt( execResult[ 1 ] + execResult[ 1 ], 16 ),
  5127. 					parseInt( execResult[ 2 ] + execResult[ 2 ], 16 ),
  5128. 					parseInt( execResult[ 3 ] + execResult[ 3 ], 16 ),
  5129. 					execResult[ 4 ] ?
  5130. 						( parseInt( execResult[ 4 ] + execResult[ 4 ], 16 ) / 255 )
  5131. 							.toFixed( 2 ) :
  5132. 						1
  5133. 				];
  5134. 			}
  5135. 		}, {
  5136. 			re: /hsla?\(\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,
  5137. 			space: "hsla",
  5138. 			parse: function( execResult ) {
  5139. 				return [
  5140. 					execResult[ 1 ],
  5141. 					execResult[ 2 ] / 100,
  5142. 					execResult[ 3 ] / 100,
  5143. 					execResult[ 4 ]
  5144. 				];
  5145. 			}
  5146. 		} ],
  5147.  
  5148. 	// jQuery.Color( )
  5149. 	color = jQuery.Color = function( color, green, blue, alpha ) {
  5150. 		return new jQuery.Color.fn.parse( color, green, blue, alpha );
  5151. 	},
  5152. 	spaces = {
  5153. 		rgba: {
  5154. 			props: {
  5155. 				red: {
  5156. 					idx: 0,
  5157. 					type: "byte"
  5158. 				},
  5159. 				green: {
  5160. 					idx: 1,
  5161. 					type: "byte"
  5162. 				},
  5163. 				blue: {
  5164. 					idx: 2,
  5165. 					type: "byte"
  5166. 				}
  5167. 			}
  5168. 		},
  5169.  
  5170. 		hsla: {
  5171. 			props: {
  5172. 				hue: {
  5173. 					idx: 0,
  5174. 					type: "degrees"
  5175. 				},
  5176. 				saturation: {
  5177. 					idx: 1,
  5178. 					type: "percent"
  5179. 				},
  5180. 				lightness: {
  5181. 					idx: 2,
  5182. 					type: "percent"
  5183. 				}
  5184. 			}
  5185. 		}
  5186. 	},
  5187. 	propTypes = {
  5188. 		"byte": {
  5189. 			floor: true,
  5190. 			max: 255
  5191. 		},
  5192. 		"percent": {
  5193. 			max: 1
  5194. 		},
  5195. 		"degrees": {
  5196. 			mod: 360,
  5197. 			floor: true
  5198. 		}
  5199. 	},
  5200. 	support = color.support = {},
  5201.  
  5202. 	// element for support tests
  5203. 	supportElem = jQuery( "<p>" )[ 0 ],
  5204.  
  5205. 	// colors = jQuery.Color.names
  5206. 	colors,
  5207.  
  5208. 	// local aliases of functions called often
  5209. 	each = jQuery.each;
  5210.  
  5211. // determine rgba support immediately
  5212. supportElem.style.cssText = "background-color:rgba(1,1,1,.5)";
  5213. support.rgba = supportElem.style.backgroundColor.indexOf( "rgba" ) > -1;
  5214.  
  5215. // define cache name and alpha properties
  5216. // for rgba and hsla spaces
  5217. each( spaces, function( spaceName, space ) {
  5218. 	space.cache = "_" + spaceName;
  5219. 	space.props.alpha = {
  5220. 		idx: 3,
  5221. 		type: "percent",
  5222. 		def: 1
  5223. 	};
  5224. } );
  5225.  
  5226. // Populate the class2type map
  5227. jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ),
  5228. 	function( _i, name ) {
  5229. 		class2type[ "[object " + name + "]" ] = name.toLowerCase();
  5230. 	} );
  5231.  
  5232. function getType( obj ) {
  5233. 	if ( obj == null ) {
  5234. 		return obj + "";
  5235. 	}
  5236.  
  5237. 	return typeof obj === "object" ?
  5238. 		class2type[ toString.call( obj ) ] || "object" :
  5239. 		typeof obj;
  5240. }
  5241.  
  5242. function clamp( value, prop, allowEmpty ) {
  5243. 	var type = propTypes[ prop.type ] || {};
  5244.  
  5245. 	if ( value == null ) {
  5246. 		return ( allowEmpty || !prop.def ) ? null : prop.def;
  5247. 	}
  5248.  
  5249. 	// ~~ is an short way of doing floor for positive numbers
  5250. 	value = type.floor ? ~~value : parseFloat( value );
  5251.  
  5252. 	// IE will pass in empty strings as value for alpha,
  5253. 	// which will hit this case
  5254. 	if ( isNaN( value ) ) {
  5255. 		return prop.def;
  5256. 	}
  5257.  
  5258. 	if ( type.mod ) {
  5259.  
  5260. 		// we add mod before modding to make sure that negatives values
  5261. 		// get converted properly: -10 -> 350
  5262. 		return ( value + type.mod ) % type.mod;
  5263. 	}
  5264.  
  5265. 	// for now all property types without mod have min and max
  5266. 	return Math.min( type.max, Math.max( 0, value ) );
  5267. }
  5268.  
  5269. function stringParse( string ) {
  5270. 	var inst = color(),
  5271. 		rgba = inst._rgba = [];
  5272.  
  5273. 	string = string.toLowerCase();
  5274.  
  5275. 	each( stringParsers, function( _i, parser ) {
  5276. 		var parsed,
  5277. 			match = parser.re.exec( string ),
  5278. 			values = match && parser.parse( match ),
  5279. 			spaceName = parser.space || "rgba";
  5280.  
  5281. 		if ( values ) {
  5282. 			parsed = inst[ spaceName ]( values );
  5283.  
  5284. 			// if this was an rgba parse the assignment might happen twice
  5285. 			// oh well....
  5286. 			inst[ spaces[ spaceName ].cache ] = parsed[ spaces[ spaceName ].cache ];
  5287. 			rgba = inst._rgba = parsed._rgba;
  5288.  
  5289. 			// exit each( stringParsers ) here because we matched
  5290. 			return false;
  5291. 		}
  5292. 	} );
  5293.  
  5294. 	// Found a stringParser that handled it
  5295. 	if ( rgba.length ) {
  5296.  
  5297. 		// if this came from a parsed string, force "transparent" when alpha is 0
  5298. 		// chrome, (and maybe others) return "transparent" as rgba(0,0,0,0)
  5299. 		if ( rgba.join() === "0,0,0,0" ) {
  5300. 			jQuery.extend( rgba, colors.transparent );
  5301. 		}
  5302. 		return inst;
  5303. 	}
  5304.  
  5305. 	// named colors
  5306. 	return colors[ string ];
  5307. }
  5308.  
  5309. color.fn = jQuery.extend( color.prototype, {
  5310. 	parse: function( red, green, blue, alpha ) {
  5311. 		if ( red === undefined ) {
  5312. 			this._rgba = [ null, null, null, null ];
  5313. 			return this;
  5314. 		}
  5315. 		if ( red.jquery || red.nodeType ) {
  5316. 			red = jQuery( red ).css( green );
  5317. 			green = undefined;
  5318. 		}
  5319.  
  5320. 		var inst = this,
  5321. 			type = getType( red ),
  5322. 			rgba = this._rgba = [];
  5323.  
  5324. 		// more than 1 argument specified - assume ( red, green, blue, alpha )
  5325. 		if ( green !== undefined ) {
  5326. 			red = [ red, green, blue, alpha ];
  5327. 			type = "array";
  5328. 		}
  5329.  
  5330. 		if ( type === "string" ) {
  5331. 			return this.parse( stringParse( red ) || colors._default );
  5332. 		}
  5333.  
  5334. 		if ( type === "array" ) {
  5335. 			each( spaces.rgba.props, function( _key, prop ) {
  5336. 				rgba[ prop.idx ] = clamp( red[ prop.idx ], prop );
  5337. 			} );
  5338. 			return this;
  5339. 		}
  5340.  
  5341. 		if ( type === "object" ) {
  5342. 			if ( red instanceof color ) {
  5343. 				each( spaces, function( _spaceName, space ) {
  5344. 					if ( red[ space.cache ] ) {
  5345. 						inst[ space.cache ] = red[ space.cache ].slice();
  5346. 					}
  5347. 				} );
  5348. 			} else {
  5349. 				each( spaces, function( _spaceName, space ) {
  5350. 					var cache = space.cache;
  5351. 					each( space.props, function( key, prop ) {
  5352.  
  5353. 						// if the cache doesn't exist, and we know how to convert
  5354. 						if ( !inst[ cache ] && space.to ) {
  5355.  
  5356. 							// if the value was null, we don't need to copy it
  5357. 							// if the key was alpha, we don't need to copy it either
  5358. 							if ( key === "alpha" || red[ key ] == null ) {
  5359. 								return;
  5360. 							}
  5361. 							inst[ cache ] = space.to( inst._rgba );
  5362. 						}
  5363.  
  5364. 						// this is the only case where we allow nulls for ALL properties.
  5365. 						// call clamp with alwaysAllowEmpty
  5366. 						inst[ cache ][ prop.idx ] = clamp( red[ key ], prop, true );
  5367. 					} );
  5368.  
  5369. 					// everything defined but alpha?
  5370. 					if ( inst[ cache ] && jQuery.inArray( null, inst[ cache ].slice( 0, 3 ) ) < 0 ) {
  5371.  
  5372. 						// use the default of 1
  5373. 						if ( inst[ cache ][ 3 ] == null ) {
  5374. 							inst[ cache ][ 3 ] = 1;
  5375. 						}
  5376.  
  5377. 						if ( space.from ) {
  5378. 							inst._rgba = space.from( inst[ cache ] );
  5379. 						}
  5380. 					}
  5381. 				} );
  5382. 			}
  5383. 			return this;
  5384. 		}
  5385. 	},
  5386. 	is: function( compare ) {
  5387. 		var is = color( compare ),
  5388. 			same = true,
  5389. 			inst = this;
  5390.  
  5391. 		each( spaces, function( _, space ) {
  5392. 			var localCache,
  5393. 				isCache = is[ space.cache ];
  5394. 			if ( isCache ) {
  5395. 				localCache = inst[ space.cache ] || space.to && space.to( inst._rgba ) || [];
  5396. 				each( space.props, function( _, prop ) {
  5397. 					if ( isCache[ prop.idx ] != null ) {
  5398. 						same = ( isCache[ prop.idx ] === localCache[ prop.idx ] );
  5399. 						return same;
  5400. 					}
  5401. 				} );
  5402. 			}
  5403. 			return same;
  5404. 		} );
  5405. 		return same;
  5406. 	},
  5407. 	_space: function() {
  5408. 		var used = [],
  5409. 			inst = this;
  5410. 		each( spaces, function( spaceName, space ) {
  5411. 			if ( inst[ space.cache ] ) {
  5412. 				used.push( spaceName );
  5413. 			}
  5414. 		} );
  5415. 		return used.pop();
  5416. 	},
  5417. 	transition: function( other, distance ) {
  5418. 		var end = color( other ),
  5419. 			spaceName = end._space(),
  5420. 			space = spaces[ spaceName ],
  5421. 			startColor = this.alpha() === 0 ? color( "transparent" ) : this,
  5422. 			start = startColor[ space.cache ] || space.to( startColor._rgba ),
  5423. 			result = start.slice();
  5424.  
  5425. 		end = end[ space.cache ];
  5426. 		each( space.props, function( _key, prop ) {
  5427. 			var index = prop.idx,
  5428. 				startValue = start[ index ],
  5429. 				endValue = end[ index ],
  5430. 				type = propTypes[ prop.type ] || {};
  5431.  
  5432. 			// if null, don't override start value
  5433. 			if ( endValue === null ) {
  5434. 				return;
  5435. 			}
  5436.  
  5437. 			// if null - use end
  5438. 			if ( startValue === null ) {
  5439. 				result[ index ] = endValue;
  5440. 			} else {
  5441. 				if ( type.mod ) {
  5442. 					if ( endValue - startValue > type.mod / 2 ) {
  5443. 						startValue += type.mod;
  5444. 					} else if ( startValue - endValue > type.mod / 2 ) {
  5445. 						startValue -= type.mod;
  5446. 					}
  5447. 				}
  5448. 				result[ index ] = clamp( ( endValue - startValue ) * distance + startValue, prop );
  5449. 			}
  5450. 		} );
  5451. 		return this[ spaceName ]( result );
  5452. 	},
  5453. 	blend: function( opaque ) {
  5454.  
  5455. 		// if we are already opaque - return ourself
  5456. 		if ( this._rgba[ 3 ] === 1 ) {
  5457. 			return this;
  5458. 		}
  5459.  
  5460. 		var rgb = this._rgba.slice(),
  5461. 			a = rgb.pop(),
  5462. 			blend = color( opaque )._rgba;
  5463.  
  5464. 		return color( jQuery.map( rgb, function( v, i ) {
  5465. 			return ( 1 - a ) * blend[ i ] + a * v;
  5466. 		} ) );
  5467. 	},
  5468. 	toRgbaString: function() {
  5469. 		var prefix = "rgba(",
  5470. 			rgba = jQuery.map( this._rgba, function( v, i ) {
  5471. 				if ( v != null ) {
  5472. 					return v;
  5473. 				}
  5474. 				return i > 2 ? 1 : 0;
  5475. 			} );
  5476.  
  5477. 		if ( rgba[ 3 ] === 1 ) {
  5478. 			rgba.pop();
  5479. 			prefix = "rgb(";
  5480. 		}
  5481.  
  5482. 		return prefix + rgba.join() + ")";
  5483. 	},
  5484. 	toHslaString: function() {
  5485. 		var prefix = "hsla(",
  5486. 			hsla = jQuery.map( this.hsla(), function( v, i ) {
  5487. 				if ( v == null ) {
  5488. 					v = i > 2 ? 1 : 0;
  5489. 				}
  5490.  
  5491. 				// catch 1 and 2
  5492. 				if ( i && i < 3 ) {
  5493. 					v = Math.round( v * 100 ) + "%";
  5494. 				}
  5495. 				return v;
  5496. 			} );
  5497.  
  5498. 		if ( hsla[ 3 ] === 1 ) {
  5499. 			hsla.pop();
  5500. 			prefix = "hsl(";
  5501. 		}
  5502. 		return prefix + hsla.join() + ")";
  5503. 	},
  5504. 	toHexString: function( includeAlpha ) {
  5505. 		var rgba = this._rgba.slice(),
  5506. 			alpha = rgba.pop();
  5507.  
  5508. 		if ( includeAlpha ) {
  5509. 			rgba.push( ~~( alpha * 255 ) );
  5510. 		}
  5511.  
  5512. 		return "#" + jQuery.map( rgba, function( v ) {
  5513.  
  5514. 			// default to 0 when nulls exist
  5515. 			v = ( v || 0 ).toString( 16 );
  5516. 			return v.length === 1 ? "0" + v : v;
  5517. 		} ).join( "" );
  5518. 	},
  5519. 	toString: function() {
  5520. 		return this._rgba[ 3 ] === 0 ? "transparent" : this.toRgbaString();
  5521. 	}
  5522. } );
  5523. color.fn.parse.prototype = color.fn;
  5524.  
  5525. // hsla conversions adapted from:
  5526. // https://code.google.com/p/maashaack/source/browse/packages/graphics/trunk/src/graphics/colors/HUE2RGB.as?r=5021
  5527.  
  5528. function hue2rgb( p, q, h ) {
  5529. 	h = ( h + 1 ) % 1;
  5530. 	if ( h * 6 < 1 ) {
  5531. 		return p + ( q - p ) * h * 6;
  5532. 	}
  5533. 	if ( h * 2 < 1 ) {
  5534. 		return q;
  5535. 	}
  5536. 	if ( h * 3 < 2 ) {
  5537. 		return p + ( q - p ) * ( ( 2 / 3 ) - h ) * 6;
  5538. 	}
  5539. 	return p;
  5540. }
  5541.  
  5542. spaces.hsla.to = function( rgba ) {
  5543. 	if ( rgba[ 0 ] == null || rgba[ 1 ] == null || rgba[ 2 ] == null ) {
  5544. 		return [ null, null, null, rgba[ 3 ] ];
  5545. 	}
  5546. 	var r = rgba[ 0 ] / 255,
  5547. 		g = rgba[ 1 ] / 255,
  5548. 		b = rgba[ 2 ] / 255,
  5549. 		a = rgba[ 3 ],
  5550. 		max = Math.max( r, g, b ),
  5551. 		min = Math.min( r, g, b ),
  5552. 		diff = max - min,
  5553. 		add = max + min,
  5554. 		l = add * 0.5,
  5555. 		h, s;
  5556.  
  5557. 	if ( min === max ) {
  5558. 		h = 0;
  5559. 	} else if ( r === max ) {
  5560. 		h = ( 60 * ( g - b ) / diff ) + 360;
  5561. 	} else if ( g === max ) {
  5562. 		h = ( 60 * ( b - r ) / diff ) + 120;
  5563. 	} else {
  5564. 		h = ( 60 * ( r - g ) / diff ) + 240;
  5565. 	}
  5566.  
  5567. 	// chroma (diff) == 0 means greyscale which, by definition, saturation = 0%
  5568. 	// otherwise, saturation is based on the ratio of chroma (diff) to lightness (add)
  5569. 	if ( diff === 0 ) {
  5570. 		s = 0;
  5571. 	} else if ( l <= 0.5 ) {
  5572. 		s = diff / add;
  5573. 	} else {
  5574. 		s = diff / ( 2 - add );
  5575. 	}
  5576. 	return [ Math.round( h ) % 360, s, l, a == null ? 1 : a ];
  5577. };
  5578.  
  5579. spaces.hsla.from = function( hsla ) {
  5580. 	if ( hsla[ 0 ] == null || hsla[ 1 ] == null || hsla[ 2 ] == null ) {
  5581. 		return [ null, null, null, hsla[ 3 ] ];
  5582. 	}
  5583. 	var h = hsla[ 0 ] / 360,
  5584. 		s = hsla[ 1 ],
  5585. 		l = hsla[ 2 ],
  5586. 		a = hsla[ 3 ],
  5587. 		q = l <= 0.5 ? l * ( 1 + s ) : l + s - l * s,
  5588. 		p = 2 * l - q;
  5589.  
  5590. 	return [
  5591. 		Math.round( hue2rgb( p, q, h + ( 1 / 3 ) ) * 255 ),
  5592. 		Math.round( hue2rgb( p, q, h ) * 255 ),
  5593. 		Math.round( hue2rgb( p, q, h - ( 1 / 3 ) ) * 255 ),
  5594. 		a
  5595. 	];
  5596. };
  5597.  
  5598.  
  5599. each( spaces, function( spaceName, space ) {
  5600. 	var props = space.props,
  5601. 		cache = space.cache,
  5602. 		to = space.to,
  5603. 		from = space.from;
  5604.  
  5605. 	// makes rgba() and hsla()
  5606. 	color.fn[ spaceName ] = function( value ) {
  5607.  
  5608. 		// generate a cache for this space if it doesn't exist
  5609. 		if ( to && !this[ cache ] ) {
  5610. 			this[ cache ] = to( this._rgba );
  5611. 		}
  5612. 		if ( value === undefined ) {
  5613. 			return this[ cache ].slice();
  5614. 		}
  5615.  
  5616. 		var ret,
  5617. 			type = getType( value ),
  5618. 			arr = ( type === "array" || type === "object" ) ? value : arguments,
  5619. 			local = this[ cache ].slice();
  5620.  
  5621. 		each( props, function( key, prop ) {
  5622. 			var val = arr[ type === "object" ? key : prop.idx ];
  5623. 			if ( val == null ) {
  5624. 				val = local[ prop.idx ];
  5625. 			}
  5626. 			local[ prop.idx ] = clamp( val, prop );
  5627. 		} );
  5628.  
  5629. 		if ( from ) {
  5630. 			ret = color( from( local ) );
  5631. 			ret[ cache ] = local;
  5632. 			return ret;
  5633. 		} else {
  5634. 			return color( local );
  5635. 		}
  5636. 	};
  5637.  
  5638. 	// makes red() green() blue() alpha() hue() saturation() lightness()
  5639. 	each( props, function( key, prop ) {
  5640.  
  5641. 		// alpha is included in more than one space
  5642. 		if ( color.fn[ key ] ) {
  5643. 			return;
  5644. 		}
  5645. 		color.fn[ key ] = function( value ) {
  5646. 			var local, cur, match, fn,
  5647. 				vtype = getType( value );
  5648.  
  5649. 			if ( key === "alpha" ) {
  5650. 				fn = this._hsla ? "hsla" : "rgba";
  5651. 			} else {
  5652. 				fn = spaceName;
  5653. 			}
  5654. 			local = this[ fn ]();
  5655. 			cur = local[ prop.idx ];
  5656.  
  5657. 			if ( vtype === "undefined" ) {
  5658. 				return cur;
  5659. 			}
  5660.  
  5661. 			if ( vtype === "function" ) {
  5662. 				value = value.call( this, cur );
  5663. 				vtype = getType( value );
  5664. 			}
  5665. 			if ( value == null && prop.empty ) {
  5666. 				return this;
  5667. 			}
  5668. 			if ( vtype === "string" ) {
  5669. 				match = rplusequals.exec( value );
  5670. 				if ( match ) {
  5671. 					value = cur + parseFloat( match[ 2 ] ) * ( match[ 1 ] === "+" ? 1 : -1 );
  5672. 				}
  5673. 			}
  5674. 			local[ prop.idx ] = value;
  5675. 			return this[ fn ]( local );
  5676. 		};
  5677. 	} );
  5678. } );
  5679.  
  5680. // add cssHook and .fx.step function for each named hook.
  5681. // accept a space separated string of properties
  5682. color.hook = function( hook ) {
  5683. 	var hooks = hook.split( " " );
  5684. 	each( hooks, function( _i, hook ) {
  5685. 		jQuery.cssHooks[ hook ] = {
  5686. 			set: function( elem, value ) {
  5687. 				var parsed, curElem,
  5688. 					backgroundColor = "";
  5689.  
  5690. 				if ( value !== "transparent" && ( getType( value ) !== "string" || ( parsed = stringParse( value ) ) ) ) {
  5691. 					value = color( parsed || value );
  5692. 					if ( !support.rgba && value._rgba[ 3 ] !== 1 ) {
  5693. 						curElem = hook === "backgroundColor" ? elem.parentNode : elem;
  5694. 						while (
  5695. 							( backgroundColor === "" || backgroundColor === "transparent" ) &&
  5696. 							curElem && curElem.style
  5697. 						) {
  5698. 							try {
  5699. 								backgroundColor = jQuery.css( curElem, "backgroundColor" );
  5700. 								curElem = curElem.parentNode;
  5701. 							} catch ( e ) {
  5702. 							}
  5703. 						}
  5704.  
  5705. 						value = value.blend( backgroundColor && backgroundColor !== "transparent" ?
  5706. 							backgroundColor :
  5707. 							"_default" );
  5708. 					}
  5709.  
  5710. 					value = value.toRgbaString();
  5711. 				}
  5712. 				try {
  5713. 					elem.style[ hook ] = value;
  5714. 				} catch ( e ) {
  5715.  
  5716. 					// wrapped to prevent IE from throwing errors on "invalid" values like 'auto' or 'inherit'
  5717. 				}
  5718. 			}
  5719. 		};
  5720. 		jQuery.fx.step[ hook ] = function( fx ) {
  5721. 			if ( !fx.colorInit ) {
  5722. 				fx.start = color( fx.elem, hook );
  5723. 				fx.end = color( fx.end );
  5724. 				fx.colorInit = true;
  5725. 			}
  5726. 			jQuery.cssHooks[ hook ].set( fx.elem, fx.start.transition( fx.end, fx.pos ) );
  5727. 		};
  5728. 	} );
  5729.  
  5730. };
  5731.  
  5732. color.hook( stepHooks );
  5733.  
  5734. jQuery.cssHooks.borderColor = {
  5735. 	expand: function( value ) {
  5736. 		var expanded = {};
  5737.  
  5738. 		each( [ "Top", "Right", "Bottom", "Left" ], function( _i, part ) {
  5739. 			expanded[ "border" + part + "Color" ] = value;
  5740. 		} );
  5741. 		return expanded;
  5742. 	}
  5743. };
  5744.  
  5745. // Basic color names only.
  5746. // Usage of any of the other color names requires adding yourself or including
  5747. // jquery.color.svg-names.js.
  5748. colors = jQuery.Color.names = {
  5749.  
  5750. 	// 4.1. Basic color keywords
  5751. 	aqua: "#00ffff",
  5752. 	black: "#000000",
  5753. 	blue: "#0000ff",
  5754. 	fuchsia: "#ff00ff",
  5755. 	gray: "#808080",
  5756. 	green: "#008000",
  5757. 	lime: "#00ff00",
  5758. 	maroon: "#800000",
  5759. 	navy: "#000080",
  5760. 	olive: "#808000",
  5761. 	purple: "#800080",
  5762. 	red: "#ff0000",
  5763. 	silver: "#c0c0c0",
  5764. 	teal: "#008080",
  5765. 	white: "#ffffff",
  5766. 	yellow: "#ffff00",
  5767.  
  5768. 	// 4.2.3. "transparent" color keyword
  5769. 	transparent: [ null, null, null, 0 ],
  5770.  
  5771. 	_default: "#ffffff"
  5772. };
  5773.  
  5774.  
  5775. /*!
  5776.  * jQuery UI Effects 1.13.0
  5777.  * http://jqueryui.com
  5778.  *
  5779.  * Copyright jQuery Foundation and other contributors
  5780.  * Released under the MIT license.
  5781.  * http://jquery.org/license
  5782.  */
  5783.  
  5784. //>>label: Effects Core
  5785. //>>group: Effects
  5786. /* eslint-disable max-len */
  5787. //>>description: Extends the internal jQuery effects. Includes morphing and easing. Required by all other effects.
  5788. /* eslint-enable max-len */
  5789. //>>docs: http://api.jqueryui.com/category/effects-core/
  5790. //>>demos: http://jqueryui.com/effect/
  5791.  
  5792.  
  5793. var dataSpace = "ui-effects-",
  5794. 	dataSpaceStyle = "ui-effects-style",
  5795. 	dataSpaceAnimated = "ui-effects-animated";
  5796.  
  5797. $.effects = {
  5798. 	effect: {}
  5799. };
  5800.  
  5801. /******************************************************************************/
  5802. /****************************** CLASS ANIMATIONS ******************************/
  5803. /******************************************************************************/
  5804. ( function() {
  5805.  
  5806. var classAnimationActions = [ "add", "remove", "toggle" ],
  5807. 	shorthandStyles = {
  5808. 		border: 1,
  5809. 		borderBottom: 1,
  5810. 		borderColor: 1,
  5811. 		borderLeft: 1,
  5812. 		borderRight: 1,
  5813. 		borderTop: 1,
  5814. 		borderWidth: 1,
  5815. 		margin: 1,
  5816. 		padding: 1
  5817. 	};
  5818.  
  5819. $.each(
  5820. 	[ "borderLeftStyle", "borderRightStyle", "borderBottomStyle", "borderTopStyle" ],
  5821. 	function( _, prop ) {
  5822. 		$.fx.step[ prop ] = function( fx ) {
  5823. 			if ( fx.end !== "none" && !fx.setAttr || fx.pos === 1 && !fx.setAttr ) {
  5824. 				jQuery.style( fx.elem, prop, fx.end );
  5825. 				fx.setAttr = true;
  5826. 			}
  5827. 		};
  5828. 	}
  5829. );
  5830.  
  5831. function camelCase( string ) {
  5832. 	return string.replace( /-([\da-z])/gi, function( all, letter ) {
  5833. 		return letter.toUpperCase();
  5834. 	} );
  5835. }
  5836.  
  5837. function getElementStyles( elem ) {
  5838. 	var key, len,
  5839. 		style = elem.ownerDocument.defaultView ?
  5840. 			elem.ownerDocument.defaultView.getComputedStyle( elem, null ) :
  5841. 			elem.currentStyle,
  5842. 		styles = {};
  5843.  
  5844. 	if ( style && style.length && style[ 0 ] && style[ style[ 0 ] ] ) {
  5845. 		len = style.length;
  5846. 		while ( len-- ) {
  5847. 			key = style[ len ];
  5848. 			if ( typeof style[ key ] === "string" ) {
  5849. 				styles[ camelCase( key ) ] = style[ key ];
  5850. 			}
  5851. 		}
  5852.  
  5853. 	// Support: Opera, IE <9
  5854. 	} else {
  5855. 		for ( key in style ) {
  5856. 			if ( typeof style[ key ] === "string" ) {
  5857. 				styles[ key ] = style[ key ];
  5858. 			}
  5859. 		}
  5860. 	}
  5861.  
  5862. 	return styles;
  5863. }
  5864.  
  5865. function styleDifference( oldStyle, newStyle ) {
  5866. 	var diff = {},
  5867. 		name, value;
  5868.  
  5869. 	for ( name in newStyle ) {
  5870. 		value = newStyle[ name ];
  5871. 		if ( oldStyle[ name ] !== value ) {
  5872. 			if ( !shorthandStyles[ name ] ) {
  5873. 				if ( $.fx.step[ name ] || !isNaN( parseFloat( value ) ) ) {
  5874. 					diff[ name ] = value;
  5875. 				}
  5876. 			}
  5877. 		}
  5878. 	}
  5879.  
  5880. 	return diff;
  5881. }
  5882.  
  5883. // Support: jQuery <1.8
  5884. if ( !$.fn.addBack ) {
  5885. 	$.fn.addBack = function( selector ) {
  5886. 		return this.add( selector == null ?
  5887. 			this.prevObject : this.prevObject.filter( selector )
  5888. 		);
  5889. 	};
  5890. }
  5891.  
  5892. $.effects.animateClass = function( value, duration, easing, callback ) {
  5893. 	var o = $.speed( duration, easing, callback );
  5894.  
  5895. 	return this.queue( function() {
  5896. 		var animated = $( this ),
  5897. 			baseClass = animated.attr( "class" ) || "",
  5898. 			applyClassChange,
  5899. 			allAnimations = o.children ? animated.find( "*" ).addBack() : animated;
  5900.  
  5901. 		// Map the animated objects to store the original styles.
  5902. 		allAnimations = allAnimations.map( function() {
  5903. 			var el = $( this );
  5904. 			return {
  5905. 				el: el,
  5906. 				start: getElementStyles( this )
  5907. 			};
  5908. 		} );
  5909.  
  5910. 		// Apply class change
  5911. 		applyClassChange = function() {
  5912. 			$.each( classAnimationActions, function( i, action ) {
  5913. 				if ( value[ action ] ) {
  5914. 					animated[ action + "Class" ]( value[ action ] );
  5915. 				}
  5916. 			} );
  5917. 		};
  5918. 		applyClassChange();
  5919.  
  5920. 		// Map all animated objects again - calculate new styles and diff
  5921. 		allAnimations = allAnimations.map( function() {
  5922. 			this.end = getElementStyles( this.el[ 0 ] );
  5923. 			this.diff = styleDifference( this.start, this.end );
  5924. 			return this;
  5925. 		} );
  5926.  
  5927. 		// Apply original class
  5928. 		animated.attr( "class", baseClass );
  5929.  
  5930. 		// Map all animated objects again - this time collecting a promise
  5931. 		allAnimations = allAnimations.map( function() {
  5932. 			var styleInfo = this,
  5933. 				dfd = $.Deferred(),
  5934. 				opts = $.extend( {}, o, {
  5935. 					queue: false,
  5936. 					complete: function() {
  5937. 						dfd.resolve( styleInfo );
  5938. 					}
  5939. 				} );
  5940.  
  5941. 			this.el.animate( this.diff, opts );
  5942. 			return dfd.promise();
  5943. 		} );
  5944.  
  5945. 		// Once all animations have completed:
  5946. 		$.when.apply( $, allAnimations.get() ).done( function() {
  5947.  
  5948. 			// Set the final class
  5949. 			applyClassChange();
  5950.  
  5951. 			// For each animated element,
  5952. 			// clear all css properties that were animated
  5953. 			$.each( arguments, function() {
  5954. 				var el = this.el;
  5955. 				$.each( this.diff, function( key ) {
  5956. 					el.css( key, "" );
  5957. 				} );
  5958. 			} );
  5959.  
  5960. 			// This is guarnteed to be there if you use jQuery.speed()
  5961. 			// it also handles dequeuing the next anim...
  5962. 			o.complete.call( animated[ 0 ] );
  5963. 		} );
  5964. 	} );
  5965. };
  5966.  
  5967. $.fn.extend( {
  5968. 	addClass: ( function( orig ) {
  5969. 		return function( classNames, speed, easing, callback ) {
  5970. 			return speed ?
  5971. 				$.effects.animateClass.call( this,
  5972. 					{ add: classNames }, speed, easing, callback ) :
  5973. 				orig.apply( this, arguments );
  5974. 		};
  5975. 	} )( $.fn.addClass ),
  5976.  
  5977. 	removeClass: ( function( orig ) {
  5978. 		return function( classNames, speed, easing, callback ) {
  5979. 			return arguments.length > 1 ?
  5980. 				$.effects.animateClass.call( this,
  5981. 					{ remove: classNames }, speed, easing, callback ) :
  5982. 				orig.apply( this, arguments );
  5983. 		};
  5984. 	} )( $.fn.removeClass ),
  5985.  
  5986. 	toggleClass: ( function( orig ) {
  5987. 		return function( classNames, force, speed, easing, callback ) {
  5988. 			if ( typeof force === "boolean" || force === undefined ) {
  5989. 				if ( !speed ) {
  5990.  
  5991. 					// Without speed parameter
  5992. 					return orig.apply( this, arguments );
  5993. 				} else {
  5994. 					return $.effects.animateClass.call( this,
  5995. 						( force ? { add: classNames } : { remove: classNames } ),
  5996. 						speed, easing, callback );
  5997. 				}
  5998. 			} else {
  5999.  
  6000. 				// Without force parameter
  6001. 				return $.effects.animateClass.call( this,
  6002. 					{ toggle: classNames }, force, speed, easing );
  6003. 			}
  6004. 		};
  6005. 	} )( $.fn.toggleClass ),
  6006.  
  6007. 	switchClass: function( remove, add, speed, easing, callback ) {
  6008. 		return $.effects.animateClass.call( this, {
  6009. 			add: add,
  6010. 			remove: remove
  6011. 		}, speed, easing, callback );
  6012. 	}
  6013. } );
  6014.  
  6015. } )();
  6016.  
  6017. /******************************************************************************/
  6018. /*********************************** EFFECTS **********************************/
  6019. /******************************************************************************/
  6020.  
  6021. ( function() {
  6022.  
  6023. if ( $.expr && $.expr.pseudos && $.expr.pseudos.animated ) {
  6024. 	$.expr.pseudos.animated = ( function( orig ) {
  6025. 		return function( elem ) {
  6026. 			return !!$( elem ).data( dataSpaceAnimated ) || orig( elem );
  6027. 		};
  6028. 	} )( $.expr.pseudos.animated );
  6029. }
  6030.  
  6031. if ( $.uiBackCompat !== false ) {
  6032. 	$.extend( $.effects, {
  6033.  
  6034. 		// Saves a set of properties in a data storage
  6035. 		save: function( element, set ) {
  6036. 			var i = 0, length = set.length;
  6037. 			for ( ; i < length; i++ ) {
  6038. 				if ( set[ i ] !== null ) {
  6039. 					element.data( dataSpace + set[ i ], element[ 0 ].style[ set[ i ] ] );
  6040. 				}
  6041. 			}
  6042. 		},
  6043.  
  6044. 		// Restores a set of previously saved properties from a data storage
  6045. 		restore: function( element, set ) {
  6046. 			var val, i = 0, length = set.length;
  6047. 			for ( ; i < length; i++ ) {
  6048. 				if ( set[ i ] !== null ) {
  6049. 					val = element.data( dataSpace + set[ i ] );
  6050. 					element.css( set[ i ], val );
  6051. 				}
  6052. 			}
  6053. 		},
  6054.  
  6055. 		setMode: function( el, mode ) {
  6056. 			if ( mode === "toggle" ) {
  6057. 				mode = el.is( ":hidden" ) ? "show" : "hide";
  6058. 			}
  6059. 			return mode;
  6060. 		},
  6061.  
  6062. 		// Wraps the element around a wrapper that copies position properties
  6063. 		createWrapper: function( element ) {
  6064.  
  6065. 			// If the element is already wrapped, return it
  6066. 			if ( element.parent().is( ".ui-effects-wrapper" ) ) {
  6067. 				return element.parent();
  6068. 			}
  6069.  
  6070. 			// Wrap the element
  6071. 			var props = {
  6072. 					width: element.outerWidth( true ),
  6073. 					height: element.outerHeight( true ),
  6074. 					"float": element.css( "float" )
  6075. 				},
  6076. 				wrapper = $( "<div></div>" )
  6077. 					.addClass( "ui-effects-wrapper" )
  6078. 					.css( {
  6079. 						fontSize: "100%",
  6080. 						background: "transparent",
  6081. 						border: "none",
  6082. 						margin: 0,
  6083. 						padding: 0
  6084. 					} ),
  6085.  
  6086. 				// Store the size in case width/height are defined in % - Fixes #5245
  6087. 				size = {
  6088. 					width: element.width(),
  6089. 					height: element.height()
  6090. 				},
  6091. 				active = document.activeElement;
  6092.  
  6093. 			// Support: Firefox
  6094. 			// Firefox incorrectly exposes anonymous content
  6095. 			// https://bugzilla.mozilla.org/show_bug.cgi?id=561664
  6096. 			try {
  6097. 				// eslint-disable-next-line no-unused-expressions
  6098. 				active.id;
  6099. 			} catch ( e ) {
  6100. 				active = document.body;
  6101. 			}
  6102.  
  6103. 			element.wrap( wrapper );
  6104.  
  6105. 			// Fixes #7595 - Elements lose focus when wrapped.
  6106. 			if ( element[ 0 ] === active || $.contains( element[ 0 ], active ) ) {
  6107. 				$( active ).trigger( "focus" );
  6108. 			}
  6109.  
  6110. 			// Hotfix for jQuery 1.4 since some change in wrap() seems to actually
  6111. 			// lose the reference to the wrapped element
  6112. 			wrapper = element.parent();
  6113.  
  6114. 			// Transfer positioning properties to the wrapper
  6115. 			if ( element.css( "position" ) === "static" ) {
  6116. 				wrapper.css( { position: "relative" } );
  6117. 				element.css( { position: "relative" } );
  6118. 			} else {
  6119. 				$.extend( props, {
  6120. 					position: element.css( "position" ),
  6121. 					zIndex: element.css( "z-index" )
  6122. 				} );
  6123. 				$.each( [ "top", "left", "bottom", "right" ], function( i, pos ) {
  6124. 					props[ pos ] = element.css( pos );
  6125. 					if ( isNaN( parseInt( props[ pos ], 10 ) ) ) {
  6126. 						props[ pos ] = "auto";
  6127. 					}
  6128. 				} );
  6129. 				element.css( {
  6130. 					position: "relative",
  6131. 					top: 0,
  6132. 					left: 0,
  6133. 					right: "auto",
  6134. 					bottom: "auto"
  6135. 				} );
  6136. 			}
  6137. 			element.css( size );
  6138.  
  6139. 			return wrapper.css( props ).show();
  6140. 		},
  6141.  
  6142. 		removeWrapper: function( element ) {
  6143. 			var active = document.activeElement;
  6144.  
  6145. 			if ( element.parent().is( ".ui-effects-wrapper" ) ) {
  6146. 				element.parent().replaceWith( element );
  6147.  
  6148. 				// Fixes #7595 - Elements lose focus when wrapped.
  6149. 				if ( element[ 0 ] === active || $.contains( element[ 0 ], active ) ) {
  6150. 					$( active ).trigger( "focus" );
  6151. 				}
  6152. 			}
  6153.  
  6154. 			return element;
  6155. 		}
  6156. 	} );
  6157. }
  6158.  
  6159. $.extend( $.effects, {
  6160. 	version: "1.13.0",
  6161.  
  6162. 	define: function( name, mode, effect ) {
  6163. 		if ( !effect ) {
  6164. 			effect = mode;
  6165. 			mode = "effect";
  6166. 		}
  6167.  
  6168. 		$.effects.effect[ name ] = effect;
  6169. 		$.effects.effect[ name ].mode = mode;
  6170.  
  6171. 		return effect;
  6172. 	},
  6173.  
  6174. 	scaledDimensions: function( element, percent, direction ) {
  6175. 		if ( percent === 0 ) {
  6176. 			return {
  6177. 				height: 0,
  6178. 				width: 0,
  6179. 				outerHeight: 0,
  6180. 				outerWidth: 0
  6181. 			};
  6182. 		}
  6183.  
  6184. 		var x = direction !== "horizontal" ? ( ( percent || 100 ) / 100 ) : 1,
  6185. 			y = direction !== "vertical" ? ( ( percent || 100 ) / 100 ) : 1;
  6186.  
  6187. 		return {
  6188. 			height: element.height() * y,
  6189. 			width: element.width() * x,
  6190. 			outerHeight: element.outerHeight() * y,
  6191. 			outerWidth: element.outerWidth() * x
  6192. 		};
  6193.  
  6194. 	},
  6195.  
  6196. 	clipToBox: function( animation ) {
  6197. 		return {
  6198. 			width: animation.clip.right - animation.clip.left,
  6199. 			height: animation.clip.bottom - animation.clip.top,
  6200. 			left: animation.clip.left,
  6201. 			top: animation.clip.top
  6202. 		};
  6203. 	},
  6204.  
  6205. 	// Injects recently queued functions to be first in line (after "inprogress")
  6206. 	unshift: function( element, queueLength, count ) {
  6207. 		var queue = element.queue();
  6208.  
  6209. 		if ( queueLength > 1 ) {
  6210. 			queue.splice.apply( queue,
  6211. 				[ 1, 0 ].concat( queue.splice( queueLength, count ) ) );
  6212. 		}
  6213. 		element.dequeue();
  6214. 	},
  6215.  
  6216. 	saveStyle: function( element ) {
  6217. 		element.data( dataSpaceStyle, element[ 0 ].style.cssText );
  6218. 	},
  6219.  
  6220. 	restoreStyle: function( element ) {
  6221. 		element[ 0 ].style.cssText = element.data( dataSpaceStyle ) || "";
  6222. 		element.removeData( dataSpaceStyle );
  6223. 	},
  6224.  
  6225. 	mode: function( element, mode ) {
  6226. 		var hidden = element.is( ":hidden" );
  6227.  
  6228. 		if ( mode === "toggle" ) {
  6229. 			mode = hidden ? "show" : "hide";
  6230. 		}
  6231. 		if ( hidden ? mode === "hide" : mode === "show" ) {
  6232. 			mode = "none";
  6233. 		}
  6234. 		return mode;
  6235. 	},
  6236.  
  6237. 	// Translates a [top,left] array into a baseline value
  6238. 	getBaseline: function( origin, original ) {
  6239. 		var y, x;
  6240.  
  6241. 		switch ( origin[ 0 ] ) {
  6242. 		case "top":
  6243. 			y = 0;
  6244. 			break;
  6245. 		case "middle":
  6246. 			y = 0.5;
  6247. 			break;
  6248. 		case "bottom":
  6249. 			y = 1;
  6250. 			break;
  6251. 		default:
  6252. 			y = origin[ 0 ] / original.height;
  6253. 		}
  6254.  
  6255. 		switch ( origin[ 1 ] ) {
  6256. 		case "left":
  6257. 			x = 0;
  6258. 			break;
  6259. 		case "center":
  6260. 			x = 0.5;
  6261. 			break;
  6262. 		case "right":
  6263. 			x = 1;
  6264. 			break;
  6265. 		default:
  6266. 			x = origin[ 1 ] / original.width;
  6267. 		}
  6268.  
  6269. 		return {
  6270. 			x: x,
  6271. 			y: y
  6272. 		};
  6273. 	},
  6274.  
  6275. 	// Creates a placeholder element so that the original element can be made absolute
  6276. 	createPlaceholder: function( element ) {
  6277. 		var placeholder,
  6278. 			cssPosition = element.css( "position" ),
  6279. 			position = element.position();
  6280.  
  6281. 		// Lock in margins first to account for form elements, which
  6282. 		// will change margin if you explicitly set height
  6283. 		// see: http://jsfiddle.net/JZSMt/3/ https://bugs.webkit.org/show_bug.cgi?id=107380
  6284. 		// Support: Safari
  6285. 		element.css( {
  6286. 			marginTop: element.css( "marginTop" ),
  6287. 			marginBottom: element.css( "marginBottom" ),
  6288. 			marginLeft: element.css( "marginLeft" ),
  6289. 			marginRight: element.css( "marginRight" )
  6290. 		} )
  6291. 		.outerWidth( element.outerWidth() )
  6292. 		.outerHeight( element.outerHeight() );
  6293.  
  6294. 		if ( /^(static|relative)/.test( cssPosition ) ) {
  6295. 			cssPosition = "absolute";
  6296.  
  6297. 			placeholder = $( "<" + element[ 0 ].nodeName + ">" ).insertAfter( element ).css( {
  6298.  
  6299. 				// Convert inline to inline block to account for inline elements
  6300. 				// that turn to inline block based on content (like img)
  6301. 				display: /^(inline|ruby)/.test( element.css( "display" ) ) ?
  6302. 					"inline-block" :
  6303. 					"block",
  6304. 				visibility: "hidden",
  6305.  
  6306. 				// Margins need to be set to account for margin collapse
  6307. 				marginTop: element.css( "marginTop" ),
  6308. 				marginBottom: element.css( "marginBottom" ),
  6309. 				marginLeft: element.css( "marginLeft" ),
  6310. 				marginRight: element.css( "marginRight" ),
  6311. 				"float": element.css( "float" )
  6312. 			} )
  6313. 			.outerWidth( element.outerWidth() )
  6314. 			.outerHeight( element.outerHeight() )
  6315. 			.addClass( "ui-effects-placeholder" );
  6316.  
  6317. 			element.data( dataSpace + "placeholder", placeholder );
  6318. 		}
  6319.  
  6320. 		element.css( {
  6321. 			position: cssPosition,
  6322. 			left: position.left,
  6323. 			top: position.top
  6324. 		} );
  6325.  
  6326. 		return placeholder;
  6327. 	},
  6328.  
  6329. 	removePlaceholder: function( element ) {
  6330. 		var dataKey = dataSpace + "placeholder",
  6331. 				placeholder = element.data( dataKey );
  6332.  
  6333. 		if ( placeholder ) {
  6334. 			placeholder.remove();
  6335. 			element.removeData( dataKey );
  6336. 		}
  6337. 	},
  6338.  
  6339. 	// Removes a placeholder if it exists and restores
  6340. 	// properties that were modified during placeholder creation
  6341. 	cleanUp: function( element ) {
  6342. 		$.effects.restoreStyle( element );
  6343. 		$.effects.removePlaceholder( element );
  6344. 	},
  6345.  
  6346. 	setTransition: function( element, list, factor, value ) {
  6347. 		value = value || {};
  6348. 		$.each( list, function( i, x ) {
  6349. 			var unit = element.cssUnit( x );
  6350. 			if ( unit[ 0 ] > 0 ) {
  6351. 				value[ x ] = unit[ 0 ] * factor + unit[ 1 ];
  6352. 			}
  6353. 		} );
  6354. 		return value;
  6355. 	}
  6356. } );
  6357.  
  6358. // Return an effect options object for the given parameters:
  6359. function _normalizeArguments( effect, options, speed, callback ) {
  6360.  
  6361. 	// Allow passing all options as the first parameter
  6362. 	if ( $.isPlainObject( effect ) ) {
  6363. 		options = effect;
  6364. 		effect = effect.effect;
  6365. 	}
  6366.  
  6367. 	// Convert to an object
  6368. 	effect = { effect: effect };
  6369.  
  6370. 	// Catch (effect, null, ...)
  6371. 	if ( options == null ) {
  6372. 		options = {};
  6373. 	}
  6374.  
  6375. 	// Catch (effect, callback)
  6376. 	if ( typeof options === "function" ) {
  6377. 		callback = options;
  6378. 		speed = null;
  6379. 		options = {};
  6380. 	}
  6381.  
  6382. 	// Catch (effect, speed, ?)
  6383. 	if ( typeof options === "number" || $.fx.speeds[ options ] ) {
  6384. 		callback = speed;
  6385. 		speed = options;
  6386. 		options = {};
  6387. 	}
  6388.  
  6389. 	// Catch (effect, options, callback)
  6390. 	if ( typeof speed === "function" ) {
  6391. 		callback = speed;
  6392. 		speed = null;
  6393. 	}
  6394.  
  6395. 	// Add options to effect
  6396. 	if ( options ) {
  6397. 		$.extend( effect, options );
  6398. 	}
  6399.  
  6400. 	speed = speed || options.duration;
  6401. 	effect.duration = $.fx.off ? 0 :
  6402. 		typeof speed === "number" ? speed :
  6403. 		speed in $.fx.speeds ? $.fx.speeds[ speed ] :
  6404. 		$.fx.speeds._default;
  6405.  
  6406. 	effect.complete = callback || options.complete;
  6407.  
  6408. 	return effect;
  6409. }
  6410.  
  6411. function standardAnimationOption( option ) {
  6412.  
  6413. 	// Valid standard speeds (nothing, number, named speed)
  6414. 	if ( !option || typeof option === "number" || $.fx.speeds[ option ] ) {
  6415. 		return true;
  6416. 	}
  6417.  
  6418. 	// Invalid strings - treat as "normal" speed
  6419. 	if ( typeof option === "string" && !$.effects.effect[ option ] ) {
  6420. 		return true;
  6421. 	}
  6422.  
  6423. 	// Complete callback
  6424. 	if ( typeof option === "function" ) {
  6425. 		return true;
  6426. 	}
  6427.  
  6428. 	// Options hash (but not naming an effect)
  6429. 	if ( typeof option === "object" && !option.effect ) {
  6430. 		return true;
  6431. 	}
  6432.  
  6433. 	// Didn't match any standard API
  6434. 	return false;
  6435. }
  6436.  
  6437. $.fn.extend( {
  6438. 	effect: function( /* effect, options, speed, callback */ ) {
  6439. 		var args = _normalizeArguments.apply( this, arguments ),
  6440. 			effectMethod = $.effects.effect[ args.effect ],
  6441. 			defaultMode = effectMethod.mode,
  6442. 			queue = args.queue,
  6443. 			queueName = queue || "fx",
  6444. 			complete = args.complete,
  6445. 			mode = args.mode,
  6446. 			modes = [],
  6447. 			prefilter = function( next ) {
  6448. 				var el = $( this ),
  6449. 					normalizedMode = $.effects.mode( el, mode ) || defaultMode;
  6450.  
  6451. 				// Sentinel for duck-punching the :animated pseudo-selector
  6452. 				el.data( dataSpaceAnimated, true );
  6453.  
  6454. 				// Save effect mode for later use,
  6455. 				// we can't just call $.effects.mode again later,
  6456. 				// as the .show() below destroys the initial state
  6457. 				modes.push( normalizedMode );
  6458.  
  6459. 				// See $.uiBackCompat inside of run() for removal of defaultMode in 1.14
  6460. 				if ( defaultMode && ( normalizedMode === "show" ||
  6461. 						( normalizedMode === defaultMode && normalizedMode === "hide" ) ) ) {
  6462. 					el.show();
  6463. 				}
  6464.  
  6465. 				if ( !defaultMode || normalizedMode !== "none" ) {
  6466. 					$.effects.saveStyle( el );
  6467. 				}
  6468.  
  6469. 				if ( typeof next === "function" ) {
  6470. 					next();
  6471. 				}
  6472. 			};
  6473.  
  6474. 		if ( $.fx.off || !effectMethod ) {
  6475.  
  6476. 			// Delegate to the original method (e.g., .show()) if possible
  6477. 			if ( mode ) {
  6478. 				return this[ mode ]( args.duration, complete );
  6479. 			} else {
  6480. 				return this.each( function() {
  6481. 					if ( complete ) {
  6482. 						complete.call( this );
  6483. 					}
  6484. 				} );
  6485. 			}
  6486. 		}
  6487.  
  6488. 		function run( next ) {
  6489. 			var elem = $( this );
  6490.  
  6491. 			function cleanup() {
  6492. 				elem.removeData( dataSpaceAnimated );
  6493.  
  6494. 				$.effects.cleanUp( elem );
  6495.  
  6496. 				if ( args.mode === "hide" ) {
  6497. 					elem.hide();
  6498. 				}
  6499.  
  6500. 				done();
  6501. 			}
  6502.  
  6503. 			function done() {
  6504. 				if ( typeof complete === "function" ) {
  6505. 					complete.call( elem[ 0 ] );
  6506. 				}
  6507.  
  6508. 				if ( typeof next === "function" ) {
  6509. 					next();
  6510. 				}
  6511. 			}
  6512.  
  6513. 			// Override mode option on a per element basis,
  6514. 			// as toggle can be either show or hide depending on element state
  6515. 			args.mode = modes.shift();
  6516.  
  6517. 			if ( $.uiBackCompat !== false && !defaultMode ) {
  6518. 				if ( elem.is( ":hidden" ) ? mode === "hide" : mode === "show" ) {
  6519.  
  6520. 					// Call the core method to track "olddisplay" properly
  6521. 					elem[ mode ]();
  6522. 					done();
  6523. 				} else {
  6524. 					effectMethod.call( elem[ 0 ], args, done );
  6525. 				}
  6526. 			} else {
  6527. 				if ( args.mode === "none" ) {
  6528.  
  6529. 					// Call the core method to track "olddisplay" properly
  6530. 					elem[ mode ]();
  6531. 					done();
  6532. 				} else {
  6533. 					effectMethod.call( elem[ 0 ], args, cleanup );
  6534. 				}
  6535. 			}
  6536. 		}
  6537.  
  6538. 		// Run prefilter on all elements first to ensure that
  6539. 		// any showing or hiding happens before placeholder creation,
  6540. 		// which ensures that any layout changes are correctly captured.
  6541. 		return queue === false ?
  6542. 			this.each( prefilter ).each( run ) :
  6543. 			this.queue( queueName, prefilter ).queue( queueName, run );
  6544. 	},
  6545.  
  6546. 	show: ( function( orig ) {
  6547. 		return function( option ) {
  6548. 			if ( standardAnimationOption( option ) ) {
  6549. 				return orig.apply( this, arguments );
  6550. 			} else {
  6551. 				var args = _normalizeArguments.apply( this, arguments );
  6552. 				args.mode = "show";
  6553. 				return this.effect.call( this, args );
  6554. 			}
  6555. 		};
  6556. 	} )( $.fn.show ),
  6557.  
  6558. 	hide: ( function( orig ) {
  6559. 		return function( option ) {
  6560. 			if ( standardAnimationOption( option ) ) {
  6561. 				return orig.apply( this, arguments );
  6562. 			} else {
  6563. 				var args = _normalizeArguments.apply( this, arguments );
  6564. 				args.mode = "hide";
  6565. 				return this.effect.call( this, args );
  6566. 			}
  6567. 		};
  6568. 	} )( $.fn.hide ),
  6569.  
  6570. 	toggle: ( function( orig ) {
  6571. 		return function( option ) {
  6572. 			if ( standardAnimationOption( option ) || typeof option === "boolean" ) {
  6573. 				return orig.apply( this, arguments );
  6574. 			} else {
  6575. 				var args = _normalizeArguments.apply( this, arguments );
  6576. 				args.mode = "toggle";
  6577. 				return this.effect.call( this, args );
  6578. 			}
  6579. 		};
  6580. 	} )( $.fn.toggle ),
  6581.  
  6582. 	cssUnit: function( key ) {
  6583. 		var style = this.css( key ),
  6584. 			val = [];
  6585.  
  6586. 		$.each( [ "em", "px", "%", "pt" ], function( i, unit ) {
  6587. 			if ( style.indexOf( unit ) > 0 ) {
  6588. 				val = [ parseFloat( style ), unit ];
  6589. 			}
  6590. 		} );
  6591. 		return val;
  6592. 	},
  6593.  
  6594. 	cssClip: function( clipObj ) {
  6595. 		if ( clipObj ) {
  6596. 			return this.css( "clip", "rect(" + clipObj.top + "px " + clipObj.right + "px " +
  6597. 				clipObj.bottom + "px " + clipObj.left + "px)" );
  6598. 		}
  6599. 		return parseClip( this.css( "clip" ), this );
  6600. 	},
  6601.  
  6602. 	transfer: function( options, done ) {
  6603. 		var element = $( this ),
  6604. 			target = $( options.to ),
  6605. 			targetFixed = target.css( "position" ) === "fixed",
  6606. 			body = $( "body" ),
  6607. 			fixTop = targetFixed ? body.scrollTop() : 0,
  6608. 			fixLeft = targetFixed ? body.scrollLeft() : 0,
  6609. 			endPosition = target.offset(),
  6610. 			animation = {
  6611. 				top: endPosition.top - fixTop,
  6612. 				left: endPosition.left - fixLeft,
  6613. 				height: target.innerHeight(),
  6614. 				width: target.innerWidth()
  6615. 			},
  6616. 			startPosition = element.offset(),
  6617. 			transfer = $( "<div class='ui-effects-transfer'></div>" );
  6618.  
  6619. 		transfer
  6620. 			.appendTo( "body" )
  6621. 			.addClass( options.className )
  6622. 			.css( {
  6623. 				top: startPosition.top - fixTop,
  6624. 				left: startPosition.left - fixLeft,
  6625. 				height: element.innerHeight(),
  6626. 				width: element.innerWidth(),
  6627. 				position: targetFixed ? "fixed" : "absolute"
  6628. 			} )
  6629. 			.animate( animation, options.duration, options.easing, function() {
  6630. 				transfer.remove();
  6631. 				if ( typeof done === "function" ) {
  6632. 					done();
  6633. 				}
  6634. 			} );
  6635. 	}
  6636. } );
  6637.  
  6638. function parseClip( str, element ) {
  6639. 		var outerWidth = element.outerWidth(),
  6640. 			outerHeight = element.outerHeight(),
  6641. 			clipRegex = /^rect\((-?\d*\.?\d*px|-?\d+%|auto),?\s*(-?\d*\.?\d*px|-?\d+%|auto),?\s*(-?\d*\.?\d*px|-?\d+%|auto),?\s*(-?\d*\.?\d*px|-?\d+%|auto)\)$/,
  6642. 			values = clipRegex.exec( str ) || [ "", 0, outerWidth, outerHeight, 0 ];
  6643.  
  6644. 		return {
  6645. 			top: parseFloat( values[ 1 ] ) || 0,
  6646. 			right: values[ 2 ] === "auto" ? outerWidth : parseFloat( values[ 2 ] ),
  6647. 			bottom: values[ 3 ] === "auto" ? outerHeight : parseFloat( values[ 3 ] ),
  6648. 			left: parseFloat( values[ 4 ] ) || 0
  6649. 		};
  6650. }
  6651.  
  6652. $.fx.step.clip = function( fx ) {
  6653. 	if ( !fx.clipInit ) {
  6654. 		fx.start = $( fx.elem ).cssClip();
  6655. 		if ( typeof fx.end === "string" ) {
  6656. 			fx.end = parseClip( fx.end, fx.elem );
  6657. 		}
  6658. 		fx.clipInit = true;
  6659. 	}
  6660.  
  6661. 	$( fx.elem ).cssClip( {
  6662. 		top: fx.pos * ( fx.end.top - fx.start.top ) + fx.start.top,
  6663. 		right: fx.pos * ( fx.end.right - fx.start.right ) + fx.start.right,
  6664. 		bottom: fx.pos * ( fx.end.bottom - fx.start.bottom ) + fx.start.bottom,
  6665. 		left: fx.pos * ( fx.end.left - fx.start.left ) + fx.start.left
  6666. 	} );
  6667. };
  6668.  
  6669. } )();
  6670.  
  6671. /******************************************************************************/
  6672. /*********************************** EASING ***********************************/
  6673. /******************************************************************************/
  6674.  
  6675. ( function() {
  6676.  
  6677. // Based on easing equations from Robert Penner (http://www.robertpenner.com/easing)
  6678.  
  6679. var baseEasings = {};
  6680.  
  6681. $.each( [ "Quad", "Cubic", "Quart", "Quint", "Expo" ], function( i, name ) {
  6682. 	baseEasings[ name ] = function( p ) {
  6683. 		return Math.pow( p, i + 2 );
  6684. 	};
  6685. } );
  6686.  
  6687. $.extend( baseEasings, {
  6688. 	Sine: function( p ) {
  6689. 		return 1 - Math.cos( p * Math.PI / 2 );
  6690. 	},
  6691. 	Circ: function( p ) {
  6692. 		return 1 - Math.sqrt( 1 - p * p );
  6693. 	},
  6694. 	Elastic: function( p ) {
  6695. 		return p === 0 || p === 1 ? p :
  6696. 			-Math.pow( 2, 8 * ( p - 1 ) ) * Math.sin( ( ( p - 1 ) * 80 - 7.5 ) * Math.PI / 15 );
  6697. 	},
  6698. 	Back: function( p ) {
  6699. 		return p * p * ( 3 * p - 2 );
  6700. 	},
  6701. 	Bounce: function( p ) {
  6702. 		var pow2,
  6703. 			bounce = 4;
  6704.  
  6705. 		while ( p < ( ( pow2 = Math.pow( 2, --bounce ) ) - 1 ) / 11 ) {}
  6706. 		return 1 / Math.pow( 4, 3 - bounce ) - 7.5625 * Math.pow( ( pow2 * 3 - 2 ) / 22 - p, 2 );
  6707. 	}
  6708. } );
  6709.  
  6710. $.each( baseEasings, function( name, easeIn ) {
  6711. 	$.easing[ "easeIn" + name ] = easeIn;
  6712. 	$.easing[ "easeOut" + name ] = function( p ) {
  6713. 		return 1 - easeIn( 1 - p );
  6714. 	};
  6715. 	$.easing[ "easeInOut" + name ] = function( p ) {
  6716. 		return p < 0.5 ?
  6717. 			easeIn( p * 2 ) / 2 :
  6718. 			1 - easeIn( p * -2 + 2 ) / 2;
  6719. 	};
  6720. } );
  6721.  
  6722. } )();
  6723.  
  6724. var effect = $.effects;
  6725.  
  6726.  
  6727.  
  6728.  
  6729. } );