PageSourceSearch

https://www.apli.com/themes/custom/apli/js/jquery-ui/jquery-ui.js?tmb479

js apli.com collected 2026-10-03 21:27:01 UTC 36,879 bytes, 1,419 lines download raw bytes

1/*! jQuery UI - v1.12.1 - 2019-06-27
2* http://jqueryui.com
3* Includes: widget.js, keycode.js, unique-id.js, widgets/accordion
vendor: 8,818 bytes, lines 3-330
3.js
4* Copyright jQuery Foundation and other contributors; Licensed MIT */
5
6(function( factory ) {
7	if ( typeof define === "function" && define.amd ) {
8
9		// AMD. Register as an anonymous module.
10		define([ "jquery" ], factory );
11	} else {
12
13		// Browser globals
14		factory( jQuery );
15	}
16}(function( $ ) {
17
18$.ui = $.ui || {};
19
20var version = $.ui.version = "1.12.1";
21
22
23/*!
24 * jQuery UI Widget 1.12.1
25 * http://jqueryui.com
26 *
27 * Copyright jQuery Foundation and other contributors
28 * Released under the MIT license.
29 * http://jquery.org/license
30 */
31
32//>>label: Widget
33//>>group: Core
34//>>description: Provides a factory for creating stateful widgets with a common API.
35//>>docs: http://api.jqueryui.com/jQuery.widget/
36//>>demos: http://jqueryui.com/widget/
37
38
39
40var widgetUuid = 0;
41var widgetSlice = Array.prototype.slice;
42
43$.cleanData = ( function( orig ) {
44	return function( elems ) {
45		var events, elem, i;
46		for ( i = 0; ( elem = elems[ i ] ) != null; i++ ) {
47			try {
48
49				// Only trigger remove when necessary to save time
50				events = $._data( elem, "events" );
51				if ( events && events.remove ) {
52					$( elem ).triggerHandler( "remove" );
53				}
54
55			// Http://bugs.jquery.com/ticket/8235
56			} catch ( e ) {}
57		}
58		orig( elems );
59	};
60} )( $.cleanData );
61
62$.widget = function( name, base, prototype ) {
63	var existingConstructor, constructor, basePrototype;
64
65	// ProxiedPrototype allows the provided prototype to remain unmodified
66	// so that it can be used as a mixin for multiple widgets (#8876)
67	var proxiedPrototype = {};
68
69	var namespace = name.split( "." )[ 0 ];
70	name = name.split( "." )[ 1 ];
71	var fullName = namespace + "-" + name;
72
73	if ( !prototype ) {
74		prototype = base;
75		base = $.Widget;
76	}
77
78	if ( $.isArray( prototype ) ) {
79		prototype = $.extend.apply( null, [ {} ].concat( prototype ) );
80	}
81
82	// Create selector for plugin
83	$.expr[ ":" ][ fullName.toLowerCase() ] = function( elem ) {
84		return !!$.data( elem, fullName );
85	};
86
87	$[ namespace ] = $[ namespace ] || {};
88	existingConstructor = $[ namespace ][ name ];
89	constructor = $[ namespace ][ name ] = function( options, element ) {
90
91		// Allow instantiation without "new" keyword
92		if ( !this._createWidget ) {
93			return new constructor( options, element );
94		}
95
96		// Allow instantiation without initializing for simple inheritance
97		// must use "new" keyword (the code above always passes args)
98		if ( arguments.length ) {
99			this._createWidget( options, element );
100		}
101	};
102
103	// Extend with the existing constructor to carry over any static properties
104	$.extend( constructor, existingConstructor, {
105		version: prototype.version,
106
107		// Copy the object used to create the prototype in case we need to
108		// redefine the widget later
109		_proto: $.extend( {}, prototype ),
110
111		// Track widgets that inherit from this widget in case this widget is
112		// redefined after a widget inherits from it
113		_childConstructors: []
114	} );
115
116	basePrototype = new base();
117
118	// We need to make the options hash a property directly on the new instance
119	// otherwise we'll modify the options hash on the prototype that we're
120	// inheriting from
121	basePrototype.options = $.widget.extend( {}, basePrototype.options );
122	$.each( prototype, function( prop, value ) {
123		if ( !$.isFunction( value ) ) {
124			proxiedPrototype[ prop ] = value;
125			return;
126		}
127		proxiedPrototype[ prop ] = ( function() {
128			function _super() {
129				return base.prototype[ prop ].apply( this, arguments );
130			}
131
132			function _superApply( args ) {
133				return base.prototype[ prop ].apply( this, args );
134			}
135
136			return function() {
137				var __super = this._super;
138				var __superApply = this._superApply;
139				var returnValue;
140
141				this._super = _super;
142				this._superApply = _superApply;
143
144				returnValue = value.apply( this, arguments );
145
146				this._super = __super;
147				this._superApply = __superApply;
148
149				return returnValue;
150			};
151		} )();
152	} );
153	constructor.prototype = $.widget.extend( basePrototype, {
154
155		// TODO: remove support for widgetEventPrefix
156		// always use the name + a colon as the prefix, e.g., draggable:start
157		// don't prefix for widgets that aren't DOM-based
158		widgetEventPrefix: existingConstructor ? ( basePrototype.widgetEventPrefix || name ) : name
159	}, proxiedPrototype, {
160		constructor: constructor,
161		namespace: namespace,
162		widgetName: name,
163		widgetFullName: fullName
164	} );
165
166	// If this widget is being redefined then we need to find all widgets that
167	// are inheriting from it and redefine all of them so that they inherit from
168	// the new version of this widget. We're essentially trying to replace one
169	// level in the prototype chain.
170	if ( existingConstructor ) {
171		$.each( existingConstructor._childConstructors, function( i, child ) {
172			var childPrototype = child.prototype;
173
174			// Redefine the child widget using the same prototype that was
175			// originally used, but inherit from the new version of the base
176			$.widget( childPrototype.namespace + "." + childPrototype.widgetName, constructor,
177				child._proto );
178		} );
179
180		// Remove the list of existing child constructors from the old constructor
181		// so the old child constructors can be garbage collected
182		delete existingConstructor._childConstructors;
183	} else {
184		base._childConstructors.push( constructor );
185	}
186
187	$.widget.bridge( name, constructor );
188
189	return constructor;
190};
191
192$.widget.extend = function( target ) {
193	var input = widgetSlice.call( arguments, 1 );
194	var inputIndex = 0;
195	var inputLength = input.length;
196	var key;
197	var value;
198
199	for ( ; inputIndex < inputLength; inputIndex++ ) {
200		for ( key in input[ inputIndex ] ) {
201			value = input[ inputIndex ][ key ];
202			if ( input[ inputIndex ].hasOwnProperty( key ) && value !== undefined ) {
203
204				// Clone objects
205				if ( $.isPlainObject( value ) ) {
206					target[ key ] = $.isPlainObject( target[ key ] ) ?
207						$.widget.extend( {}, target[ key ], value ) :
208
209						// Don't extend strings, arrays, etc. with objects
210						$.widget.extend( {}, value );
211
212				// Copy everything else by reference
213				} else {
214					target[ key ] = value;
215				}
216			}
217		}
218	}
219	return target;
220};
221
222$.widget.bridge = function( name, object ) {
223	var fullName = object.prototype.widgetFullName || name;
224	$.fn[ name ] = function( options ) {
225		var isMethodCall = typeof options === "string";
226		var args = widgetSlice.call( arguments, 1 );
227		var returnValue = this;
228
229		if ( isMethodCall ) {
230
231			// If this is an empty collection, we need to have the instance method
232			// return undefined instead of the jQuery instance
233			if ( !this.length && options === "instance" ) {
234				returnValue = undefined;
235			} else {
236				this.each( function() {
237					var methodValue;
238					var instance = $.data( this, fullName );
239
240					if ( options === "instance" ) {
241						returnValue = instance;
242						return false;
243					}
244
245					if ( !instance ) {
246						return $.error( "cannot call methods on " + name +
247							" prior to initialization; " +
248							"attempted to call method '" + options + "'" );
249					}
250
251					if ( !$.isFunction( instance[ options ] ) || 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
vendor: 11,069 bytes, lines 331-747
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 processClassString( classes, checkOption ) {
513			var current, i;
514			for ( i = 0; i < classes.length; i++ ) {
515				current = that.classesElementLookup[ classes[ i ] ] || $();
516				if ( options.add ) {
517					current = $( $.unique( current.get().concat( options.element.get() ) ) );
518				} else {
519					current = $( current.not( options.element ).get() );
520				}
521				that.classesElementLookup[ classes[ i ] ] = current;
522				full.push( classes[ i ] );
523				if ( checkOption && options.classes[ classes[ i ] ] ) {
524					full.push( options.classes[ classes[ i ] ] );
525				}
526			}
527		}
528
529		this._on( options.element, {
530			"remove": "_untrackClassesElement"
531		} );
532
533		if ( options.keys ) {
534			processClassString( options.keys.match( /\S+/g ) || [], true );
535		}
536		if ( options.extra ) {
537			processClassString( options.extra.match( /\S+/g ) || [] );
538		}
539
540		return full.join( " " );
541	},
542
543	_untrackClassesElement: function( event ) {
544		var that = this;
545		$.each( that.classesElementLookup, function( key, value ) {
546			if ( $.inArray( event.target, value ) !== -1 ) {
547				that.classesElementLookup[ key ] = $( value.not( event.target ).get() );
548			}
549		} );
550	},
551
552	_removeClass: function( element, keys, extra ) {
553		return this._toggleClass( element, keys, extra, false );
554	},
555
556	_addClass: function( element, keys, extra ) {
557		return this._toggleClass( element, keys, extra, true );
558	},
559
560	_toggleClass: function( element, keys, extra, add ) {
561		add = ( typeof add === "boolean" ) ? add : extra;
562		var shift = ( typeof element === "string" || element === null ),
563			options = {
564				extra: shift ? keys : extra,
565				keys: shift ? element : keys,
566				element: shift ? this.element : element,
567				add: add
568			};
569		options.element.toggleClass( this._classes( options ), add );
570		return this;
571	},
572
573	_on: function( suppressDisabledCheck, element, handlers ) {
574		var delegateElement;
575		var instance = this;
576
577		// No suppressDisabledCheck flag, shuffle arguments
578		if ( typeof suppressDisabledCheck !== "boolean" ) {
579			handlers = element;
580			element = suppressDisabledCheck;
581			suppressDisabledCheck = false;
582		}
583
584		// No element argument, shuffle and use this.element
585		if ( !handlers ) {
586			handlers = element;
587			element = this.element;
588			delegateElement = this.widget();
589		} else {
590			element = delegateElement = $( element );
591			this.bindings = this.bindings.add( element );
592		}
593
594		$.each( handlers, function( event, handler ) {
595			function handlerProxy() {
596
597				// Allow widgets to customize the disabled handling
598				// - disabled as an array instead of boolean
599				// - disabled class as method for disabling individual parts
600				if ( !suppressDisabledCheck &&
601						( instance.options.disabled === true ||
602						$( this ).hasClass( "ui-state-disabled" ) ) ) {
603					return;
604				}
605				return ( typeof handler === "string" ? instance[ handler ] : handler )
606					.apply( instance, arguments );
607			}
608
609			// Copy the guid so direct unbinding works
610			if ( typeof handler !== "string" ) {
611				handlerProxy.guid = handler.guid =
612					handler.guid || handlerProxy.guid || $.guid++;
613			}
614
615			var match = event.match( /^([\w:-]*)\s*(.*)$/ );
616			var eventName = match[ 1 ] + instance.eventNamespace;
617			var selector = match[ 2 ];
618
619			if ( selector ) {
620				delegateElement.on( eventName, selector, handlerProxy );
621			} else {
622				element.on( eventName, handlerProxy );
623			}
624		} );
625	},
626
627	_off: function( element, eventName ) {
628		eventName = ( eventName || "" ).split( " " ).join( this.eventNamespace + " " ) +
629			this.eventNamespace;
630		element.off( eventName ).off( eventName );
631
632		// Clear the stack to avoid memory leaks (#10056)
633		this.bindings = $( this.bindings.not( element ).get() );
634		this.focusable = $( this.focusable.not( element ).get() );
635		this.hoverable = $( this.hoverable.not( element ).get() );
636	},
637
638	_delay: function( handler, delay ) {
639		function handlerProxy() {
640			return ( typeof handler === "string" ? instance[ handler ] : handler )
641				.apply( instance, arguments );
642		}
643		var instance = this;
644		return setTimeout( handlerProxy, delay || 0 );
645	},
646
647	_hoverable: function( element ) {
648		this.hoverable = this.hoverable.add( element );
649		this._on( element, {
650			mouseenter: function( event ) {
651				this._addClass( $( event.currentTarget ), null, "ui-state-hover" );
652			},
653			mouseleave: function( event ) {
654				this._removeClass( $( event.currentTarget ), null, "ui-state-hover" );
655			}
656		} );
657	},
658
659	_focusable: function( element ) {
660		this.focusable = this.focusable.add( element );
661		this._on( element, {
662			focusin: function( event ) {
663				this._addClass( $( event.currentTarget ), null, "ui-state-focus" );
664			},
665			focusout: function( event ) {
666				this._removeClass( $( event.currentTarget ), null, "ui-state-focus" );
667			}
668		} );
669	},
670
671	_trigger: function( type, event, data ) {
672		var prop, orig;
673		var callback = this.options[ type ];
674
675		data = data || {};
676		event = $.Event( event );
677		event.type = ( type === this.widgetEventPrefix ?
678			type :
679			this.widgetEventPrefix + type ).toLowerCase();
680
681		// The original event may come from any element
682		// so we need to reset the target on the new event
683		event.target = this.element[ 0 ];
684
685		// Copy original event properties over to the new event
686		orig = event.originalEvent;
687		if ( orig ) {
688			for ( prop in orig ) {
689				if ( !( prop in event ) ) {
690					event[ prop ] = orig[ prop ];
691				}
692			}
693		}
694
695		this.element.trigger( event, data );
696		return !( $.isFunction( callback ) &&
697			callback.apply( this.element[ 0 ], [ event ].concat( data ) ) === false ||
698			event.isDefaultPrevented() );
699	}
700};
701
702$.each( { show: "fadeIn", hide: "fadeOut" }, function( method, defaultEffect ) {
703	$.Widget.prototype[ "_" + method ] = function( element, options, callback ) {
704		if ( typeof options === "string" ) {
705			options = { effect: options };
706		}
707
708		var hasOptions;
709		var effectName = !options ?
710			method :
711			options === true || typeof options === "number" ?
712				defaultEffect :
713				options.effect || defaultEffect;
714
715		options = options || {};
716		if ( typeof options === "number" ) {
717			options = { duration: options };
718		}
719
720		hasOptions = !$.isEmptyObject( options );
721		options.complete = callback;
722
723		if ( options.delay ) {
724			element.delay( options.delay );
725		}
726
727		if ( hasOptions && $.effects && $.effects.effect[ effectName ] ) {
728			element[ method ]( options );
729		} else if ( effectName !== method && element[ effectName ] ) {
730			element[ effectName ]( options.duration, options.easing, callback );
731		} else {
732			element.queue( function( next ) {
733				$( this )[ method ]();
734				if ( callback ) {
735					callback.call( element[ 0 ] );
736				}
737				next();
738			} );
739		}
740	};
741} );
742
743var widget = $.widget;
744
745
746/*!
747 * jQuery UI 
747Keycode 1.12.1
748 * http://jqueryui.com
749 *
750 * Copyright jQuery Foundation and other contributors
751 * Released under the MIT license.
752 * http://jquery.org/license
753 */
754
755//>>label: Keycode
756//>>group: Core
757//>>description: Provide keycodes as keynames
758//>>docs: http://api.jqueryui.com/jQuery.ui.keyCode/
759
760
761var keycode = $.ui.keyCode = {
762	BACKSPACE: 8,
763	COMMA: 188,
764	DELETE: 46,
765	DOWN: 40,
766	END: 35,
767	ENTER: 13,
768	ESCAPE: 27,
769	HOME: 36,
770	LEFT: 37,
771	PAGE_DOWN: 34,
772	PAGE_UP: 33,
773	PERIOD: 190,
774	RIGHT: 39,
775	SPACE: 32,
776	TAB: 9,
777	UP: 38
778}
vendor: 16,336 bytes, lines 778-1417
778;
779
780
781/*!
782 * jQuery UI Unique ID 1.12.1
783 * http://jqueryui.com
784 *
785 * Copyright jQuery Foundation and other contributors
786 * Released under the MIT license.
787 * http://jquery.org/license
788 */
789
790//>>label: uniqueId
791//>>group: Core
792//>>description: Functions to generate and remove uniqueId's
793//>>docs: http://api.jqueryui.com/uniqueId/
794
795
796
797var uniqueId = $.fn.extend( {
798	uniqueId: ( function() {
799		var uuid = 0;
800
801		return function() {
802			return this.each( function() {
803				if ( !this.id ) {
804					this.id = "ui-id-" + ( ++uuid );
805				}
806			} );
807		};
808	} )(),
809
810	removeUniqueId: function() {
811		return this.each( function() {
812			if ( /^ui-id-\d+$/.test( this.id ) ) {
813				$( this ).removeAttr( "id" );
814			}
815		} );
816	}
817} );
818
819
820/*!
821 * jQuery UI Accordion 1.12.1
822 * http://jqueryui.com
823 *
824 * Copyright jQuery Foundation and other contributors
825 * Released under the MIT license.
826 * http://jquery.org/license
827 */
828
829//>>label: Accordion
830//>>group: Widgets
831// jscs:disable maximumLineLength
832//>>description: Displays collapsible content panels for presenting information in a limited amount of space.
833// jscs:enable maximumLineLength
834//>>docs: http://api.jqueryui.com/accordion/
835//>>demos: http://jqueryui.com/accordion/
836//>>css.structure: ../../themes/base/core.css
837//>>css.structure: ../../themes/base/accordion.css
838//>>css.theme: ../../themes/base/theme.css
839
840
841
842var widgetsAccordion = $.widget( "ui.accordion", {
843	version: "1.12.1",
844	options: {
845		active: 0,
846		animate: {},
847		classes: {
848			"ui-accordion-header": "ui-corner-top",
849			"ui-accordion-header-collapsed": "ui-corner-all",
850			"ui-accordion-content": "ui-corner-bottom"
851		},
852		collapsible: false,
853		event: "click",
854		header: "> li > :first-child, > :not(li):even",
855		heightStyle: "auto",
856		icons: {
857			activeHeader: "ui-icon-triangle-1-s",
858			header: "ui-icon-triangle-1-e"
859		},
860
861		// Callbacks
862		activate: null,
863		beforeActivate: null
864	},
865
866	hideProps: {
867		borderTopWidth: "hide",
868		borderBottomWidth: "hide",
869		paddingTop: "hide",
870		paddingBottom: "hide",
871		height: "hide"
872	},
873
874	showProps: {
875		borderTopWidth: "show",
876		borderBottomWidth: "show",
877		paddingTop: "show",
878		paddingBottom: "show",
879		height: "show"
880	},
881
882	_create: function() {
883		var options = this.options;
884
885		this.prevShow = this.prevHide = $();
886		this._addClass( "ui-accordion", "ui-widget ui-helper-reset" );
887		this.element.attr( "role", "tablist" );
888
889		// Don't allow collapsible: false and active: false / null
890		if ( !options.collapsible && ( options.active === false || options.active == null ) ) {
891			options.active = 0;
892		}
893
894		this._processPanels();
895
896		// handle negative values
897		if ( options.active < 0 ) {
898			options.active += this.headers.length;
899		}
900		this._refresh();
901	},
902
903	_getCreateEventData: function() {
904		return {
905			header: this.active,
906			panel: !this.active.length ? $() : this.active.next()
907		};
908	},
909
910	_createIcons: function() {
911		var icon, children,
912			icons = this.options.icons;
913
914		if ( icons ) {
915			icon = $( "<span>" );
916			this._addClass( icon, "ui-accordion-header-icon", "ui-icon " + icons.header );
917			icon.prependTo( this.headers );
918			children = this.active.children( ".ui-accordion-header-icon" );
919			this._removeClass( children, icons.header )
920				._addClass( children, null, icons.activeHeader )
921				._addClass( this.headers, "ui-accordion-icons" );
922		}
923	},
924
925	_destroyIcons: function() {
926		this._removeClass( this.headers, "ui-accordion-icons" );
927		this.headers.children( ".ui-accordion-header-icon" ).remove();
928	},
929
930	_destroy: function() {
931		var contents;
932
933		// Clean up main element
934		this.element.removeAttr( "role" );
935
936		// Clean up headers
937		this.headers
938			.removeAttr( "role aria-expanded aria-selected aria-controls tabIndex" )
939			.removeUniqueId();
940
941		this._destroyIcons();
942
943		// Clean up content panels
944		contents = this.headers.next()
945			.css( "display", "" )
946			.removeAttr( "role aria-hidden aria-labelledby" )
947			.removeUniqueId();
948
949		if ( this.options.heightStyle !== "content" ) {
950			contents.css( "height", "" );
951		}
952	},
953
954	_setOption: function( key, value ) {
955		if ( key === "active" ) {
956
957			// _activate() will handle invalid values and update this.options
958			this._activate( value );
959			return;
960		}
961
962		if ( key === "event" ) {
963			if ( this.options.event ) {
964				this._off( this.headers, this.options.event );
965			}
966			this._setupEvents( value );
967		}
968
969		this._super( key, value );
970
971		// Setting collapsible: false while collapsed; open first panel
972		if ( key === "collapsible" && !value && this.options.active === false ) {
973			this._activate( 0 );
974		}
975
976		if ( key === "icons" ) {
977			this._destroyIcons();
978			if ( value ) {
979				this._createIcons();
980			}
981		}
982	},
983
984	_setOptionDisabled: function( value ) {
985		this._super( value );
986
987		this.element.attr( "aria-disabled", value );
988
989		// Support: IE8 Only
990		// #5332 / #6059 - opacity doesn't cascade to positioned elements in IE
991		// so we need to add the disabled class to the headers and panels
992		this._toggleClass( null, "ui-state-disabled", !!value );
993		this._toggleClass( this.headers.add( this.headers.next() ), null, "ui-state-disabled",
994			!!value );
995	},
996
997	_keydown: function( event ) {
998		if ( event.altKey || event.ctrlKey ) {
999			return;
1000		}
1001
1002		var keyCode = $.ui.keyCode,
1003			length = this.headers.length,
1004			currentIndex = this.headers.index( event.target ),
1005			toFocus = false;
1006
1007		switch ( event.keyCode ) {
1008		case keyCode.RIGHT:
1009		case keyCode.DOWN:
1010			toFocus = this.headers[ ( currentIndex + 1 ) % length ];
1011			break;
1012		case keyCode.LEFT:
1013		case keyCode.UP:
1014			toFocus = this.headers[ ( currentIndex - 1 + length ) % length ];
1015			break;
1016		case keyCode.SPACE:
1017		case keyCode.ENTER:
1018			this._eventHandler( event );
1019			break;
1020		case keyCode.HOME:
1021			toFocus = this.headers[ 0 ];
1022			break;
1023		case keyCode.END:
1024			toFocus = this.headers[ length - 1 ];
1025			break;
1026		}
1027
1028		if ( toFocus ) {
1029			$( event.target ).attr( "tabIndex", -1 );
1030			$( toFocus ).attr( "tabIndex", 0 );
1031			$( toFocus ).trigger( "focus" );
1032			event.preventDefault();
1033		}
1034	},
1035
1036	_panelKeyDown: function( event ) {
1037		if ( event.keyCode === $.ui.keyCode.UP && event.ctrlKey ) {
1038			$( event.currentTarget ).prev().trigger( "focus" );
1039		}
1040	},
1041
1042	refresh: function() {
1043		var options = this.options;
1044		this._processPanels();
1045
1046		// Was collapsed or no panel
1047		if ( ( options.active === false && options.collapsible === true ) ||
1048				!this.headers.length ) {
1049			options.active = false;
1050			this.active = $();
1051
1052		// active false only when collapsible is true
1053		} else if ( options.active === false ) {
1054			this._activate( 0 );
1055
1056		// was active, but active panel is gone
1057		} else if ( this.active.length && !$.contains( this.element[ 0 ], this.active[ 0 ] ) ) {
1058
1059			// all remaining panel are disabled
1060			if ( this.headers.length === this.headers.find( ".ui-state-disabled" ).length ) {
1061				options.active = false;
1062				this.active = $();
1063
1064			// activate previous panel
1065			} else {
1066				this._activate( Math.max( 0, options.active - 1 ) );
1067			}
1068
1069		// was active, active panel still exists
1070		} else {
1071
1072			// make sure active index is correct
1073			options.active = this.headers.index( this.active );
1074		}
1075
1076		this._destroyIcons();
1077
1078		this._refresh();
1079	},
1080
1081	_processPanels: function() {
1082		var prevHeaders = this.headers,
1083			prevPanels = this.panels;
1084
1085		this.headers = this.element.find( this.options.header );
1086		this._addClass( this.headers, "ui-accordion-header ui-accordion-header-collapsed",
1087			"ui-state-default" );
1088
1089		this.panels = this.headers.next().filter( ":not(.ui-accordion-content-active)" ).hide();
1090		this._addClass( this.panels, "ui-accordion-content", "ui-helper-reset ui-widget-content" );
1091
1092		// Avoid memory leaks (#10056)
1093		if ( prevPanels ) {
1094			this._off( prevHeaders.not( this.headers ) );
1095			this._off( prevPanels.not( this.panels ) );
1096		}
1097	},
1098
1099	_refresh: function() {
1100		var maxHeight,
1101			options = this.options,
1102			heightStyle = options.heightStyle,
1103			parent = this.element.parent();
1104
1105		this.active = this._findActive( options.active );
1106		this._addClass( this.active, "ui-accordion-header-active", "ui-state-active" )
1107			._removeClass( this.active, "ui-accordion-header-collapsed" );
1108		this._addClass( this.active.next(), "ui-accordion-content-active" );
1109		this.active.next().show();
1110
1111		this.headers
1112			.attr( "role", "tab" )
1113			.each( function() {
1114				var header = $( this ),
1115					headerId = header.uniqueId().attr( "id" ),
1116					panel = header.next(),
1117					panelId = panel.uniqueId().attr( "id" );
1118				header.attr( "aria-controls", panelId );
1119				panel.attr( "aria-labelledby", headerId );
1120			} )
1121			.next()
1122				.attr( "role", "tabpanel" );
1123
1124		this.headers
1125			.not( this.active )
1126				.attr( {
1127					"aria-selected": "false",
1128					"aria-expanded": "false",
1129					tabIndex: -1
1130				} )
1131				.next()
1132					.attr( {
1133						"aria-hidden": "true"
1134					} )
1135					.hide();
1136
1137		// Make sure at least one header is in the tab order
1138		if ( !this.active.length ) {
1139			this.headers.eq( 0 ).attr( "tabIndex", 0 );
1140		} else {
1141			this.active.attr( {
1142				"aria-selected": "true",
1143				"aria-expanded": "true",
1144				tabIndex: 0
1145			} )
1146				.next()
1147					.attr( {
1148						"aria-hidden": "false"
1149					} );
1150		}
1151
1152		this._createIcons();
1153
1154		this._setupEvents( options.event );
1155
1156		if ( heightStyle === "fill" ) {
1157			maxHeight = parent.height();
1158			this.element.siblings( ":visible" ).each( function() {
1159				var elem = $( this ),
1160					position = elem.css( "position" );
1161
1162				if ( position === "absolute" || position === "fixed" ) {
1163					return;
1164				}
1165				maxHeight -= elem.outerHeight( true );
1166			} );
1167
1168			this.headers.each( function() {
1169				maxHeight -= $( this ).outerHeight( true );
1170			} );
1171
1172			this.headers.next()
1173				.each( function() {
1174					$( this ).height( Math.max( 0, maxHeight -
1175						$( this ).innerHeight() + $( this ).height() ) );
1176				} )
1177				.css( "overflow", "auto" );
1178		} else if ( heightStyle === "auto" ) {
1179			maxHeight = 0;
1180			this.headers.next()
1181				.each( function() {
1182					var isVisible = $( this ).is( ":visible" );
1183					if ( !isVisible ) {
1184						$( this ).show();
1185					}
1186					maxHeight = Math.max( maxHeight, $( this ).css( "height", "" ).height() );
1187					if ( !isVisible ) {
1188						$( this ).hide();
1189					}
1190				} )
1191				.height( maxHeight );
1192		}
1193	},
1194
1195	_activate: function( index ) {
1196		var active = this._findActive( index )[ 0 ];
1197
1198		// Trying to activate the already active panel
1199		if ( active === this.active[ 0 ] ) {
1200			return;
1201		}
1202
1203		// Trying to collapse, simulate a click on the currently active header
1204		active = active || this.active[ 0 ];
1205
1206		this._eventHandler( {
1207			target: active,
1208			currentTarget: active,
1209			preventDefault: $.noop
1210		} );
1211	},
1212
1213	_findActive: function( selector ) {
1214		return typeof selector === "number" ? this.headers.eq( selector ) : $();
1215	},
1216
1217	_setupEvents: function( event ) {
1218		var events = {
1219			keydown: "_keydown"
1220		};
1221		if ( event ) {
1222			$.each( event.split( " " ), function( index, eventName ) {
1223				events[ eventName ] = "_eventHandler";
1224			} );
1225		}
1226
1227		this._off( this.headers.add( this.headers.next() ) );
1228		this._on( this.headers, events );
1229		this._on( this.headers.next(), { keydown: "_panelKeyDown" } );
1230		this._hoverable( this.headers );
1231		this._focusable( this.headers );
1232	},
1233
1234	_eventHandler: function( event ) {
1235		var activeChildren, clickedChildren,
1236			options = this.options,
1237			active = this.active,
1238			clicked = $( event.currentTarget ),
1239			clickedIsActive = clicked[ 0 ] === active[ 0 ],
1240			collapsing = clickedIsActive && options.collapsible,
1241			toShow = collapsing ? $() : clicked.next(),
1242			toHide = active.next(),
1243			eventData = {
1244				oldHeader: active,
1245				oldPanel: toHide,
1246				newHeader: collapsing ? $() : clicked,
1247				newPanel: toShow
1248			};
1249
1250		event.preventDefault();
1251
1252		if (
1253
1254				// click on active header, but not collapsible
1255				( clickedIsActive && !options.collapsible ) ||
1256
1257				// allow canceling activation
1258				( this._trigger( "beforeActivate", event, eventData ) === false ) ) {
1259			return;
1260		}
1261
1262		options.active = collapsing ? false : this.headers.index( clicked );
1263
1264		// When the call to ._toggle() comes after the class changes
1265		// it causes a very odd bug in IE 8 (see #6720)
1266		this.active = clickedIsActive ? $() : clicked;
1267		this._toggle( eventData );
1268
1269		// Switch classes
1270		// corner classes on the previously active header stay after the animation
1271		this._removeClass( active, "ui-accordion-header-active", "ui-state-active" );
1272		if ( options.icons ) {
1273			activeChildren = active.children( ".ui-accordion-header-icon" );
1274			this._removeClass( activeChildren, null, options.icons.activeHeader )
1275				._addClass( activeChildren, null, options.icons.header );
1276		}
1277
1278		if ( !clickedIsActive ) {
1279			this._removeClass( clicked, "ui-accordion-header-collapsed" )
1280				._addClass( clicked, "ui-accordion-header-active", "ui-state-active" );
1281			if ( options.icons ) {
1282				clickedChildren = clicked.children( ".ui-accordion-header-icon" );
1283				this._removeClass( clickedChildren, null, options.icons.header )
1284					._addClass( clickedChildren, null, options.icons.activeHeader );
1285			}
1286
1287			this._addClass( clicked.next(), "ui-accordion-content-active" );
1288		}
1289	},
1290
1291	_toggle: function( data ) {
1292		var toShow = data.newPanel,
1293			toHide = this.prevShow.length ? this.prevShow : data.oldPanel;
1294
1295		// Handle activating a panel during the animation for another activation
1296		this.prevShow.add( this.prevHide ).stop( true, true );
1297		this.prevShow = toShow;
1298		this.prevHide = toHide;
1299
1300		if ( this.options.animate ) {
1301			this._animate( toShow, toHide, data );
1302		} else {
1303			toHide.hide();
1304			toShow.show();
1305			this._toggleComplete( data );
1306		}
1307
1308		toHide.attr( {
1309			"aria-hidden": "true"
1310		} );
1311		toHide.prev().attr( {
1312			"aria-selected": "false",
1313			"aria-expanded": "false"
1314		} );
1315
1316		// if we're switching panels, remove the old header from the tab order
1317		// if we're opening from collapsed state, remove the previous header from the tab order
1318		// if we're collapsing, then keep the collapsing header in the tab order
1319		if ( toShow.length && toHide.length ) {
1320			toHide.prev().attr( {
1321				"tabIndex": -1,
1322				"aria-expanded": "false"
1323			} );
1324		} else if ( toShow.length ) {
1325			this.headers.filter( function() {
1326				return parseInt( $( this ).attr( "tabIndex" ), 10 ) === 0;
1327			} )
1328				.attr( "tabIndex", -1 );
1329		}
1330
1331		toShow
1332			.attr( "aria-hidden", "false" )
1333			.prev()
1334				.attr( {
1335					"aria-selected": "true",
1336					"aria-expanded": "true",
1337					tabIndex: 0
1338				} );
1339	},
1340
1341	_animate: function( toShow, toHide, data ) {
1342		var total, easing, duration,
1343			that = this,
1344			adjust = 0,
1345			boxSizing = toShow.css( "box-sizing" ),
1346			down = toShow.length &&
1347				( !toHide.length || ( toShow.index() < toHide.index() ) ),
1348			animate = this.options.animate || {},
1349			options = down && animate.down || animate,
1350			complete = function() {
1351				that._toggleComplete( data );
1352			};
1353
1354		if ( typeof options === "number" ) {
1355			duration = options;
1356		}
1357		if ( typeof options === "string" ) {
1358			easing = options;
1359		}
1360
1361		// fall back from options to animation in case of partial down settings
1362		easing = easing || options.easing || animate.easing;
1363		duration = duration || options.duration || animate.duration;
1364
1365		if ( !toHide.length ) {
1366			return toShow.animate( this.showProps, duration, easing, complete );
1367		}
1368		if ( !toShow.length ) {
1369			return toHide.animate( this.hideProps, duration, easing, complete );
1370		}
1371
1372		total = toShow.show().outerHeight();
1373		toHide.animate( this.hideProps, {
1374			duration: duration,
1375			easing: easing,
1376			step: function( now, fx ) {
1377				fx.now = Math.round( now );
1378			}
1379		} );
1380		toShow
1381			.hide()
1382			.animate( this.showProps, {
1383				duration: duration,
1384				easing: easing,
1385				complete: complete,
1386				step: function( now, fx ) {
1387					fx.now = Math.round( now );
1388					if ( fx.prop !== "height" ) {
1389						if ( boxSizing === "content-box" ) {
1390							adjust += fx.now;
1391						}
1392					} else if ( that.options.heightStyle !== "content" ) {
1393						fx.now = Math.round( total - toHide.outerHeight() - adjust );
1394						adjust = 0;
1395					}
1396				}
1397			} );
1398	},
1399
1400	_toggleComplete: function( data ) {
1401		var toHide = data.oldPanel,
1402			prev = toHide.prev();
1403
1404		this._removeClass( toHide, "ui-accordion-content-active" );
1405		this._removeClass( prev, "ui-accordion-header-active" )
1406			._addClass( prev, "ui-accordion-header-collapsed" );
1407
1408		// Work around for rendering bug in IE (#5421)
1409		if ( toHide.length ) {
1410			toHide.parent()[ 0 ].className = toHide.parent()[ 0 ].className;
1411		}
1412		this._trigger( "activate", null, data );
1413	}
1414} );
1415
1416
1417
1418
1419}));

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.