PageSourceSearch

https://www.city.minamiuonuma.niigata.jp/assets/cms/public.js

js city.minamiuonuma.niigata.jp collected 2026-10-02 06:08:11 UTC 1,375,114 bytes, 37,157 lines download raw bytes

vendor: 6,796 bytes, lines 1-260
1/*!
2 * jQuery JavaScript Library v3.7.0
3 * https://jquery.com/
4 *
5 * Copyright OpenJS Foundation and other contributors
6 * Released under the MIT license
7 * https://jquery.org/license
8 *
9 * Date: 2023-05-11T18:29Z
10 */
11( function( global, factory ) {
12
13	"use strict";
14
15	if ( typeof module === "object" && typeof module.exports === "object" ) {
16
17		// For CommonJS and CommonJS-like environments where a proper `window`
18		// is present, execute the factory and get jQuery.
19		// For environments that do not have a `window` with a `document`
20		// (such as Node.js), expose a factory as module.exports.
21		// This accentuates the need for the creation of a real `window`.
22		// e.g. var jQuery = require("jquery")(window);
23		// See ticket trac-14549 for more info.
24		module.exports = global.document ?
25			factory( global, true ) :
26			function( w ) {
27				if ( !w.document ) {
28					throw new Error( "jQuery requires a window with a document" );
29				}
30				return factory( w );
31			};
32	} else {
33		factory( global );
34	}
35
36// Pass this if window is not defined yet
37} )( typeof window !== "undefined" ? window : this, function( window, noGlobal ) {
38
39// Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1
40// throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode
41// arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), strict mode should be common
42// enough that all such attempts are guarded in a try block.
43"use strict";
44
45var arr = [];
46
47var getProto = Object.getPrototypeOf;
48
49var slice = arr.slice;
50
51var flat = arr.flat ? function( array ) {
52	return arr.flat.call( array );
53} : function( array ) {
54	return arr.concat.apply( [], array );
55};
56
57
58var push = arr.push;
59
60var indexOf = arr.indexOf;
61
62var class2type = {};
63
64var toString = class2type.toString;
65
66var hasOwn = class2type.hasOwnProperty;
67
68var fnToString = hasOwn.toString;
69
70var ObjectFunctionString = fnToString.call( Object );
71
72var support = {};
73
74var isFunction = function isFunction( obj ) {
75
76		// Support: Chrome <=57, Firefox <=52
77		// In some browsers, typeof returns "function" for HTML <object> elements
78		// (i.e., `typeof document.createElement( "object" ) === "function"`).
79		// We don't want to classify *any* DOM node as a function.
80		// Support: QtWeb <=3.8.5, WebKit <=534.34, wkhtmltopdf tool <=0.12.5
81		// Plus for old WebKit, typeof returns "function" for HTML collections
82		// (e.g., `typeof document.getElementsByTagName("div") === "function"`). (gh-4756)
83		return typeof obj === "function" && typeof obj.nodeType !== "number" &&
84			typeof obj.item !== "function";
85	};
86
87
88var isWindow = function isWindow( obj ) {
89		return obj != null && obj === obj.window;
90	};
91
92
93var document = window.document;
94
95
96
97	var preservedScriptAttributes = {
98		type: true,
99		src: true,
100		nonce: true,
101		noModule: true
102	};
103
104	function DOMEval( code, node, doc ) {
105		doc = doc || document;
106
107		var i, val,
108			script = doc.createElement( "script" );
109
110		script.text = code;
111		if ( node ) {
112			for ( i in preservedScriptAttributes ) {
113
114				// Support: Firefox 64+, Edge 18+
115				// Some browsers don't support the "nonce" property on scripts.
116				// On the other hand, just using `getAttribute` is not enough as
117				// the `nonce` attribute is reset to an empty string whenever it
118				// becomes browsing-context connected.
119				// See https://github.com/whatwg/html/issues/2369
120				// See https://html.spec.whatwg.org/#nonce-attributes
121				// The `node.getAttribute` check was added for the sake of
122				// `jQuery.globalEval` so that it can fake a nonce-containing node
123				// via an object.
124				val = node[ i ] || node.getAttribute && node.getAttribute( i );
125				if ( val ) {
126					script.setAttribute( i, val );
127				}
128			}
129		}
130		doc.head.appendChild( script ).parentNode.removeChild( script );
131	}
132
133
134function toType( obj ) {
135	if ( obj == null ) {
136		return obj + "";
137	}
138
139	// Support: Android <=2.3 only (functionish RegExp)
140	return typeof obj === "object" || typeof obj === "function" ?
141		class2type[ toString.call( obj ) ] || "object" :
142		typeof obj;
143}
144/* global Symbol */
145// Defining this global in .eslintrc.json would create a danger of using the global
146// unguarded in another place, it seems safer to define global only for this module
147
148
149
150var version = "3.7.0",
151
152	rhtmlSuffix = /HTML$/i,
153
154	// Define a local copy of jQuery
155	jQuery = function( selector, context ) {
156
157		// The jQuery object is actually just the init constructor 'enhanced'
158		// Need init if jQuery is called (just allow error to be thrown if not included)
159		return new jQuery.fn.init( selector, context );
160	};
161
162jQuery.fn = jQuery.prototype = {
163
164	// The current version of jQuery being used
165	jquery: version,
166
167	constructor: jQuery,
168
169	// The default length of a jQuery object is 0
170	length: 0,
171
172	toArray: function() {
173		return slice.call( this );
174	},
175
176	// Get the Nth element in the matched element set OR
177	// Get the whole matched element set as a clean array
178	get: function( num ) {
179
180		// Return all the elements in a clean array
181		if ( num == null ) {
182			return slice.call( this );
183		}
184
185		// Return just the one element from the set
186		return num < 0 ? this[ num + this.length ] : this[ num ];
187	},
188
189	// Take an array of elements and push it onto the stack
190	// (returning the new matched element set)
191	pushStack: function( elems ) {
192
193		// Build a new jQuery matched element set
194		var ret = jQuery.merge( this.constructor(), elems );
195
196		// Add the old object onto the stack (as a reference)
197		ret.prevObject = this;
198
199		// Return the newly-formed element set
200		return ret;
201	},
202
203	// Execute a callback for every element in the matched set.
204	each: function( callback ) {
205		return jQuery.each( this, callback );
206	},
207
208	map: function( callback ) {
209		return this.pushStack( jQuery.map( this, function( elem, i ) {
210			return callback.call( elem, i, elem );
211		} ) );
212	},
213
214	slice: function() {
215		return this.pushStack( slice.apply( this, arguments ) );
216	},
217
218	first: function() {
219		return this.eq( 0 );
220	},
221
222	last: function() {
223		return this.eq( -1 );
224	},
225
226	even: function() {
227		return this.pushStack( jQuery.grep( this, function( _elem, i ) {
228			return ( i + 1 ) % 2;
229		} ) );
230	},
231
232	odd: function() {
233		return this.pushStack( jQuery.grep( this, function( _elem, i ) {
234			return i % 2;
235		} ) );
236	},
237
238	eq: function( i ) {
239		var len = this.length,
240			j = +i + ( i < 0 ? len : 0 );
241		return this.pushStack( j >= 0 && j < len ? [ this[ j ] ] : [] );
242	},
243
244	end: function() {
245		return this.prevObject || this.constructor();
246	},
247
248	// For internal use only.
249	// Behaves like an Array's method, not like a jQuery method.
250	push: push,
251	sort: arr.sort,
252	splice: arr.splice
253};
254
255jQuery.extend = jQuery.fn.extend = function() {
256	var options, name, src, copy, copyIsArray, clone,
257		target = arguments[ 0 ] || {},
258		i = 1,
259		length = arguments.length,
260		deep = false;
vendor: 80,589 bytes, lines 261-3218
261
262	// Handle a deep copy situation
263	if ( typeof target === "boolean" ) {
264		deep = target;
265
266		// Skip the boolean and the target
267		target = arguments[ i ] || {};
268		i++;
269	}
270
271	// Handle case when target is a string or something (possible in deep copy)
272	if ( typeof target !== "object" && !isFunction( target ) ) {
273		target = {};
274	}
275
276	// Extend jQuery itself if only one argument is passed
277	if ( i === length ) {
278		target = this;
279		i--;
280	}
281
282	for ( ; i < length; i++ ) {
283
284		// Only deal with non-null/undefined values
285		if ( ( options = arguments[ i ] ) != null ) {
286
287			// Extend the base object
288			for ( name in options ) {
289				copy = options[ name ];
290
291				// Prevent Object.prototype pollution
292				// Prevent never-ending loop
293				if ( name === "__proto__" || target === copy ) {
294					continue;
295				}
296
297				// Recurse if we're merging plain objects or arrays
298				if ( deep && copy && ( jQuery.isPlainObject( copy ) ||
299					( copyIsArray = Array.isArray( copy ) ) ) ) {
300					src = target[ name ];
301
302					// Ensure proper type for the source value
303					if ( copyIsArray && !Array.isArray( src ) ) {
304						clone = [];
305					} else if ( !copyIsArray && !jQuery.isPlainObject( src ) ) {
306						clone = {};
307					} else {
308						clone = src;
309					}
310					copyIsArray = false;
311
312					// Never move original objects, clone them
313					target[ name ] = jQuery.extend( deep, clone, copy );
314
315				// Don't bring in undefined values
316				} else if ( copy !== undefined ) {
317					target[ name ] = copy;
318				}
319			}
320		}
321	}
322
323	// Return the modified object
324	return target;
325};
326
327jQuery.extend( {
328
329	// Unique for each copy of jQuery on the page
330	expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ),
331
332	// Assume jQuery is ready without the ready module
333	isReady: true,
334
335	error: function( msg ) {
336		throw new Error( msg );
337	},
338
339	noop: function() {},
340
341	isPlainObject: function( obj ) {
342		var proto, Ctor;
343
344		// Detect obvious negatives
345		// Use toString instead of jQuery.type to catch host objects
346		if ( !obj || toString.call( obj ) !== "[object Object]" ) {
347			return false;
348		}
349
350		proto = getProto( obj );
351
352		// Objects with no prototype (e.g., `Object.create( null )`) are plain
353		if ( !proto ) {
354			return true;
355		}
356
357		// Objects with prototype are plain iff they were constructed by a global Object function
358		Ctor = hasOwn.call( proto, "constructor" ) && proto.constructor;
359		return typeof Ctor === "function" && fnToString.call( Ctor ) === ObjectFunctionString;
360	},
361
362	isEmptyObject: function( obj ) {
363		var name;
364
365		for ( name in obj ) {
366			return false;
367		}
368		return true;
369	},
370
371	// Evaluates a script in a provided context; falls back to the global one
372	// if not specified.
373	globalEval: function( code, options, doc ) {
374		DOMEval( code, { nonce: options && options.nonce }, doc );
375	},
376
377	each: function( obj, callback ) {
378		var length, i = 0;
379
380		if ( isArrayLike( obj ) ) {
381			length = obj.length;
382			for ( ; i < length; i++ ) {
383				if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
384					break;
385				}
386			}
387		} else {
388			for ( i in obj ) {
389				if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
390					break;
391				}
392			}
393		}
394
395		return obj;
396	},
397
398
399	// Retrieve the text value of an array of DOM nodes
400	text: function( elem ) {
401		var node,
402			ret = "",
403			i = 0,
404			nodeType = elem.nodeType;
405
406		if ( !nodeType ) {
407
408			// If no nodeType, this is expected to be an array
409			while ( ( node = elem[ i++ ] ) ) {
410
411				// Do not traverse comment nodes
412				ret += jQuery.text( node );
413			}
414		} else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
415			return elem.textContent;
416		} else if ( nodeType === 3 || nodeType === 4 ) {
417			return elem.nodeValue;
418		}
419
420		// Do not include comment or processing instruction nodes
421
422		return ret;
423	},
424
425	// results is for internal usage only
426	makeArray: function( arr, results ) {
427		var ret = results || [];
428
429		if ( arr != null ) {
430			if ( isArrayLike( Object( arr ) ) ) {
431				jQuery.merge( ret,
432					typeof arr === "string" ?
433						[ arr ] : arr
434				);
435			} else {
436				push.call( ret, arr );
437			}
438		}
439
440		return ret;
441	},
442
443	inArray: function( elem, arr, i ) {
444		return arr == null ? -1 : indexOf.call( arr, elem, i );
445	},
446
447	isXMLDoc: function( elem ) {
448		var namespace = elem && elem.namespaceURI,
449			docElem = elem && ( elem.ownerDocument || elem ).documentElement;
450
451		// Assume HTML when documentElement doesn't yet exist, such as inside
452		// document fragments.
453		return !rhtmlSuffix.test( namespace || docElem && docElem.nodeName || "HTML" );
454	},
455
456	// Support: Android <=4.0 only, PhantomJS 1 only
457	// push.apply(_, arraylike) throws on ancient WebKit
458	merge: function( first, second ) {
459		var len = +second.length,
460			j = 0,
461			i = first.length;
462
463		for ( ; j < len; j++ ) {
464			first[ i++ ] = second[ j ];
465		}
466
467		first.length = i;
468
469		return first;
470	},
471
472	grep: function( elems, callback, invert ) {
473		var callbackInverse,
474			matches = [],
475			i = 0,
476			length = elems.length,
477			callbackExpect = !invert;
478
479		// Go through the array, only saving the items
480		// that pass the validator function
481		for ( ; i < length; i++ ) {
482			callbackInverse = !callback( elems[ i ], i );
483			if ( callbackInverse !== callbackExpect ) {
484				matches.push( elems[ i ] );
485			}
486		}
487
488		return matches;
489	},
490
491	// arg is for internal usage only
492	map: function( elems, callback, arg ) {
493		var length, value,
494			i = 0,
495			ret = [];
496
497		// Go through the array, translating each of the items to their new values
498		if ( isArrayLike( elems ) ) {
499			length = elems.length;
500			for ( ; i < length; i++ ) {
501				value = callback( elems[ i ], i, arg );
502
503				if ( value != null ) {
504					ret.push( value );
505				}
506			}
507
508		// Go through every key on the object,
509		} else {
510			for ( i in elems ) {
511				value = callback( elems[ i ], i, arg );
512
513				if ( value != null ) {
514					ret.push( value );
515				}
516			}
517		}
518
519		// Flatten any nested arrays
520		return flat( ret );
521	},
522
523	// A global GUID counter for objects
524	guid: 1,
525
526	// jQuery.support is not used in Core but other projects attach their
527	// properties to it so it needs to exist.
528	support: support
529} );
530
531if ( typeof Symbol === "function" ) {
532	jQuery.fn[ Symbol.iterator ] = arr[ Symbol.iterator ];
533}
534
535// Populate the class2type map
536jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ),
537	function( _i, name ) {
538		class2type[ "[object " + name + "]" ] = name.toLowerCase();
539	} );
540
541function isArrayLike( obj ) {
542
543	// Support: real iOS 8.2 only (not reproducible in simulator)
544	// `in` check used to prevent JIT error (gh-2145)
545	// hasOwn isn't used here due to false negatives
546	// regarding Nodelist length in IE
547	var length = !!obj && "length" in obj && obj.length,
548		type = toType( obj );
549
550	if ( isFunction( obj ) || isWindow( obj ) ) {
551		return false;
552	}
553
554	return type === "array" || length === 0 ||
555		typeof length === "number" && length > 0 && ( length - 1 ) in obj;
556}
557
558
559function nodeName( elem, name ) {
560
561	return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
562
563}
564var pop = arr.pop;
565
566
567var sort = arr.sort;
568
569
570var splice = arr.splice;
571
572
573var whitespace = "[\\x20\\t\\r\\n\\f]";
574
575
576var rtrimCSS = new RegExp(
577	"^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$",
578	"g"
579);
580
581
582
583
584// Note: an element does not contain itself
585jQuery.contains = function( a, b ) {
586	var bup = b && b.parentNode;
587
588	return a === bup || !!( bup && bup.nodeType === 1 && (
589
590		// Support: IE 9 - 11+
591		// IE doesn't have `contains` on SVG.
592		a.contains ?
593			a.contains( bup ) :
594			a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16
595	) );
596};
597
598
599
600
601// CSS string/identifier serialization
602// https://drafts.csswg.org/cssom/#common-serializing-idioms
603var rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\x80-\uFFFF\w-]/g;
604
605function fcssescape( ch, asCodePoint ) {
606	if ( asCodePoint ) {
607
608		// U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER
609		if ( ch === "\0" ) {
610			return "\uFFFD";
611		}
612
613		// Control characters and (dependent upon position) numbers get escaped as code points
614		return ch.slice( 0, -1 ) + "\\" + ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " ";
615	}
616
617	// Other potentially-special ASCII characters get backslash-escaped
618	return "\\" + ch;
619}
620
621jQuery.escapeSelector = function( sel ) {
622	return ( sel + "" ).replace( rcssescape, fcssescape );
623};
624
625
626
627
628var preferredDoc = document,
629	pushNative = push;
630
631( function() {
632
633var i,
634	Expr,
635	outermostContext,
636	sortInput,
637	hasDuplicate,
638	push = pushNative,
639
640	// Local document vars
641	document,
642	documentElement,
643	documentIsHTML,
644	rbuggyQSA,
645	matches,
646
647	// Instance-specific data
648	expando = jQuery.expando,
649	dirruns = 0,
650	done = 0,
651	classCache = createCache(),
652	tokenCache = createCache(),
653	compilerCache = createCache(),
654	nonnativeSelectorCache = createCache(),
655	sortOrder = function( a, b ) {
656		if ( a === b ) {
657			hasDuplicate = true;
658		}
659		return 0;
660	},
661
662	booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|" +
663		"loop|multiple|open|readonly|required|scoped",
664
665	// Regular expressions
666
667	// https://www.w3.org/TR/css-syntax-3/#ident-token-diagram
668	identifier = "(?:\\\\[\\da-fA-F]{1,6}" + whitespace +
669		"?|\\\\[^\\r\\n\\f]|[\\w-]|[^\0-\\x7f])+",
670
671	// Attribute selectors: https://www.w3.org/TR/selectors/#attribute-selectors
672	attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace +
673
674		// Operator (capture 2)
675		"*([*^$|!~]?=)" + whitespace +
676
677		// "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]"
678		"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" +
679		whitespace + "*\\]",
680
681	pseudos = ":(" + identifier + ")(?:\\((" +
682
683		// To reduce the number of selectors needing tokenize in the preFilter, prefer arguments:
684		// 1. quoted (capture 3; capture 4 or capture 5)
685		"('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" +
686
687		// 2. simple (capture 6)
688		"((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" +
689
690		// 3. anything else (capture 2)
691		".*" +
692		")\\)|)",
693
694	// Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
695	rwhitespace = new RegExp( whitespace + "+", "g" ),
696
697	rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ),
698	rleadingCombinator = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" +
699		whitespace + "*" ),
700	rdescend = new RegExp( whitespace + "|>" ),
701
702	rpseudo = new RegExp( pseudos ),
703	ridentifier = new RegExp( "^" + identifier + "$" ),
704
705	matchExpr = {
706		ID: new RegExp( "^#(" + identifier + ")" ),
707		CLASS: new RegExp( "^\\.(" + identifier + ")" ),
708		TAG: new RegExp( "^(" + identifier + "|[*])" ),
709		ATTR: new RegExp( "^" + attributes ),
710		PSEUDO: new RegExp( "^" + pseudos ),
711		CHILD: new RegExp(
712			"^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" +
713				whitespace + "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" +
714				whitespace + "*(\\d+)|))" + whitespace + "*\\)|)", "i" ),
715		bool: new RegExp( "^(?:" + booleans + ")$", "i" ),
716
717		// For use in libraries implementing .is()
718		// We use this for POS matching in `select`
719		needsContext: new RegExp( "^" + whitespace +
720			"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + whitespace +
721			"*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" )
722	},
723
724	rinputs = /^(?:input|select|textarea|button)$/i,
725	rheader = /^h\d$/i,
726
727	// Easily-parseable/retrievable ID or TAG or CLASS selectors
728	rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
729
730	rsibling = /[+~]/,
731
732	// CSS escapes
733	// https://www.w3.org/TR/CSS21/syndata.html#escaped-characters
734	runescape = new RegExp( "\\\\[\\da-fA-F]{1,6}" + whitespace +
735		"?|\\\\([^\\r\\n\\f])", "g" ),
736	funescape = function( escape, nonHex ) {
737		var high = "0x" + escape.slice( 1 ) - 0x10000;
738
739		if ( nonHex ) {
740
741			// Strip the backslash prefix from a non-hex escape sequence
742			return nonHex;
743		}
744
745		// Replace a hexadecimal escape sequence with the encoded Unicode code point
746		// Support: IE <=11+
747		// For values outside the Basic Multilingual Plane (BMP), manually construct a
748		// surrogate pair
749		return high < 0 ?
750			String.fromCharCode( high + 0x10000 ) :
751			String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 );
752	},
753
754	// Used for iframes; see `setDocument`.
755	// Support: IE 9 - 11+, Edge 12 - 18+
756	// Removing the function wrapper causes a "Permission Denied"
757	// error in IE/Edge.
758	unloadHandler = function() {
759		setDocument();
760	},
761
762	inDisabledFieldset = addCombinator(
763		function( elem ) {
764			return elem.disabled === true && nodeName( elem, "fieldset" );
765		},
766		{ dir: "parentNode", next: "legend" }
767	);
768
769// Support: IE <=9 only
770// Accessing document.activeElement can throw unexpectedly
771// https://bugs.jquery.com/ticket/13393
772function safeActiveElement() {
773	try {
774		return document.activeElement;
775	} catch ( err ) { }
776}
777
778// Optimize for push.apply( _, NodeList )
779try {
780	push.apply(
781		( arr = slice.call( preferredDoc.childNodes ) ),
782		preferredDoc.childNodes
783	);
784
785	// Support: Android <=4.0
786	// Detect silently failing push.apply
787	// eslint-disable-next-line no-unused-expressions
788	arr[ preferredDoc.childNodes.length ].nodeType;
789} catch ( e ) {
790	push = {
791		apply: function( target, els ) {
792			pushNative.apply( target, slice.call( els ) );
793		},
794		call: function( target ) {
795			pushNative.apply( target, slice.call( arguments, 1 ) );
796		}
797	};
798}
799
800function find( selector, context, results, seed ) {
801	var m, i, elem, nid, match, groups, newSelector,
802		newContext = context && context.ownerDocument,
803
804		// nodeType defaults to 9, since context defaults to document
805		nodeType = context ? context.nodeType : 9;
806
807	results = results || [];
808
809	// Return early from calls with invalid selector or context
810	if ( typeof selector !== "string" || !selector ||
811		nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) {
812
813		return results;
814	}
815
816	// Try to shortcut find operations (as opposed to filters) in HTML documents
817	if ( !seed ) {
818		setDocument( context );
819		context = context || document;
820
821		if ( documentIsHTML ) {
822
823			// If the selector is sufficiently simple, try using a "get*By*" DOM method
824			// (excepting DocumentFragment context, where the methods don't exist)
825			if ( nodeType !== 11 && ( match = rquickExpr.exec( selector ) ) ) {
826
827				// ID selector
828				if ( ( m = match[ 1 ] ) ) {
829
830					// Document context
831					if ( nodeType === 9 ) {
832						if ( ( elem = context.getElementById( m ) ) ) {
833
834							// Support: IE 9 only
835							// getElementById can match elements by name instead of ID
836							if ( elem.id === m ) {
837								push.call( results, elem );
838								return results;
839							}
840						} else {
841							return results;
842						}
843
844					// Element context
845					} else {
846
847						// Support: IE 9 only
848						// getElementById can match elements by name instead of ID
849						if ( newContext && ( elem = newContext.getElementById( m ) ) &&
850							find.contains( context, elem ) &&
851							elem.id === m ) {
852
853							push.call( results, elem );
854							return results;
855						}
856					}
857
858				// Type selector
859				} else if ( match[ 2 ] ) {
860					push.apply( results, context.getElementsByTagName( selector ) );
861					return results;
862
863				// Class selector
864				} else if ( ( m = match[ 3 ] ) && context.getElementsByClassName ) {
865					push.apply( results, context.getElementsByClassName( m ) );
866					return results;
867				}
868			}
869
870			// Take advantage of querySelectorAll
871			if ( !nonnativeSelectorCache[ selector + " " ] &&
872				( !rbuggyQSA || !rbuggyQSA.test( selector ) ) ) {
873
874				newSelector = selector;
875				newContext = context;
876
877				// qSA considers elements outside a scoping root when evaluating child or
878				// descendant combinators, which is not what we want.
879				// In such cases, we work around the behavior by prefixing every selector in the
880				// list with an ID selector referencing the scope context.
881				// The technique has to be used as well when a leading combinator is used
882				// as such selectors are not recognized by querySelectorAll.
883				// Thanks to Andrew Dupont for this technique.
884				if ( nodeType === 1 &&
885					( rdescend.test( selector ) || rleadingCombinator.test( selector ) ) ) {
886
887					// Expand context for sibling selectors
888					newContext = rsibling.test( selector ) && testContext( context.parentNode ) ||
889						context;
890
891					// We can use :scope instead of the ID hack if the browser
892					// supports it & if we're not changing the context.
893					// Support: IE 11+, Edge 17 - 18+
894					// IE/Edge sometimes throw a "Permission denied" error when
895					// strict-comparing two documents; shallow comparisons work.
896					// eslint-disable-next-line eqeqeq
897					if ( newContext != context || !support.scope ) {
898
899						// Capture the context ID, setting it first if necessary
900						if ( ( nid = context.getAttribute( "id" ) ) ) {
901							nid = jQuery.escapeSelector( nid );
902						} else {
903							context.setAttribute( "id", ( nid = expando ) );
904						}
905					}
906
907					// Prefix every selector in the list
908					groups = tokenize( selector );
909					i = groups.length;
910					while ( i-- ) {
911						groups[ i ] = ( nid ? "#" + nid : ":scope" ) + " " +
912							toSelector( groups[ i ] );
913					}
914					newSelector = groups.join( "," );
915				}
916
917				try {
918					push.apply( results,
919						newContext.querySelectorAll( newSelector )
920					);
921					return results;
922				} catch ( qsaError ) {
923					nonnativeSelectorCache( selector, true );
924				} finally {
925					if ( nid === expando ) {
926						context.removeAttribute( "id" );
927					}
928				}
929			}
930		}
931	}
932
933	// All others
934	return select( selector.replace( rtrimCSS, "$1" ), context, results, seed );
935}
936
937/**
938 * Create key-value caches of limited size
939 * @returns {function(string, object)} Returns the Object data after storing it on itself with
940 *	property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)
941 *	deleting the oldest entry
942 */
943function createCache() {
944	var keys = [];
945
946	function cache( key, value ) {
947
948		// Use (key + " ") to avoid collision with native prototype properties
949		// (see https://github.com/jquery/sizzle/issues/157)
950		if ( keys.push( key + " " ) > Expr.cacheLength ) {
951
952			// Only keep the most recent entries
953			delete cache[ keys.shift() ];
954		}
955		return ( cache[ key + " " ] = value );
956	}
957	return cache;
958}
959
960/**
961 * Mark a function for special use by jQuery selector module
962 * @param {Function} fn The function to mark
963 */
964function markFunction( fn ) {
965	fn[ expando ] = true;
966	return fn;
967}
968
969/**
970 * Support testing using an element
971 * @param {Function} fn Passed the created element and returns a boolean result
972 */
973function assert( fn ) {
974	var el = document.createElement( "fieldset" );
975
976	try {
977		return !!fn( el );
978	} catch ( e ) {
979		return false;
980	} finally {
981
982		// Remove from its parent by default
983		if ( el.parentNode ) {
984			el.parentNode.removeChild( el );
985		}
986
987		// release memory in IE
988		el = null;
989	}
990}
991
992/**
993 * Returns a function to use in pseudos for input types
994 * @param {String} type
995 */
996function createInputPseudo( type ) {
997	return function( elem ) {
998		return nodeName( elem, "input" ) && elem.type === type;
999	};
1000}
1001
1002/**
1003 * Returns a function to use in pseudos for buttons
1004 * @param {String} type
1005 */
1006function createButtonPseudo( type ) {
1007	return function( elem ) {
1008		return ( nodeName( elem, "input" ) || nodeName( elem, "button" ) ) &&
1009			elem.type === type;
1010	};
1011}
1012
1013/**
1014 * Returns a function to use in pseudos for :enabled/:disabled
1015 * @param {Boolean} disabled true for :disabled; false for :enabled
1016 */
1017function createDisabledPseudo( disabled ) {
1018
1019	// Known :disabled false positives: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable
1020	return function( elem ) {
1021
1022		// Only certain elements can match :enabled or :disabled
1023		// https://html.spec.whatwg.org/multipage/scripting.html#selector-enabled
1024		// https://html.spec.whatwg.org/multipage/scripting.html#selector-disabled
1025		if ( "form" in elem ) {
1026
1027			// Check for inherited disabledness on relevant non-disabled elements:
1028			// * listed form-associated elements in a disabled fieldset
1029			//   https://html.spec.whatwg.org/multipage/forms.html#category-listed
1030			//   https://html.spec.whatwg.org/multipage/forms.html#concept-fe-disabled
1031			// * option elements in a disabled optgroup
1032			//   https://html.spec.whatwg.org/multipage/forms.html#concept-option-disabled
1033			// All such elements have a "form" property.
1034			if ( elem.parentNode && elem.disabled === false ) {
1035
1036				// Option elements defer to a parent optgroup if present
1037				if ( "label" in elem ) {
1038					if ( "label" in elem.parentNode ) {
1039						return elem.parentNode.disabled === disabled;
1040					} else {
1041						return elem.disabled === disabled;
1042					}
1043				}
1044
1045				// Support: IE 6 - 11+
1046				// Use the isDisabled shortcut property to check for disabled fieldset ancestors
1047				return elem.isDisabled === disabled ||
1048
1049					// Where there is no isDisabled, check manually
1050					elem.isDisabled !== !disabled &&
1051						inDisabledFieldset( elem ) === disabled;
1052			}
1053
1054			return elem.disabled === disabled;
1055
1056		// Try to winnow out elements that can't be disabled before trusting the disabled property.
1057		// Some victims get caught in our net (label, legend, menu, track), but it shouldn't
1058		// even exist on them, let alone have a boolean value.
1059		} else if ( "label" in elem ) {
1060			return elem.disabled === disabled;
1061		}
1062
1063		// Remaining elements are neither :enabled nor :disabled
1064		return false;
1065	};
1066}
1067
1068/**
1069 * Returns a function to use in pseudos for positionals
1070 * @param {Function} fn
1071 */
1072function createPositionalPseudo( fn ) {
1073	return markFunction( function( argument ) {
1074		argument = +argument;
1075		return markFunction( function( seed, matches ) {
1076			var j,
1077				matchIndexes = fn( [], seed.length, argument ),
1078				i = matchIndexes.length;
1079
1080			// Match elements found at the specified indexes
1081			while ( i-- ) {
1082				if ( seed[ ( j = matchIndexes[ i ] ) ] ) {
1083					seed[ j ] = !( matches[ j ] = seed[ j ] );
1084				}
1085			}
1086		} );
1087	} );
1088}
1089
1090/**
1091 * Checks a node for validity as a jQuery selector context
1092 * @param {Element|Object=} context
1093 * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value
1094 */
1095function testContext( context ) {
1096	return context && typeof context.getElementsByTagName !== "undefined" && context;
1097}
1098
1099/**
1100 * Sets document-related variables once based on the current document
1101 * @param {Element|Object} [node] An element or document object to use to set the document
1102 * @returns {Object} Returns the current document
1103 */
1104function setDocument( node ) {
1105	var subWindow,
1106		doc = node ? node.ownerDocument || node : preferredDoc;
1107
1108	// Return early if doc is invalid or already selected
1109	// Support: IE 11+, Edge 17 - 18+
1110	// IE/Edge sometimes throw a "Permission denied" error when strict-comparing
1111	// two documents; shallow comparisons work.
1112	// eslint-disable-next-line eqeqeq
1113	if ( doc == document || doc.nodeType !== 9 || !doc.documentElement ) {
1114		return document;
1115	}
1116
1117	// Update global variables
1118	document = doc;
1119	documentElement = document.documentElement;
1120	documentIsHTML = !jQuery.isXMLDoc( document );
1121
1122	// Support: iOS 7 only, IE 9 - 11+
1123	// Older browsers didn't support unprefixed `matches`.
1124	matches = documentElement.matches ||
1125		documentElement.webkitMatchesSelector ||
1126		documentElement.msMatchesSelector;
1127
1128	// Support: IE 9 - 11+, Edge 12 - 18+
1129	// Accessing iframe documents after unload throws "permission denied" errors (see trac-13936)
1130	// Support: IE 11+, Edge 17 - 18+
1131	// IE/Edge sometimes throw a "Permission denied" error when strict-comparing
1132	// two documents; shallow comparisons work.
1133	// eslint-disable-next-line eqeqeq
1134	if ( preferredDoc != document &&
1135		( subWindow = document.defaultView ) && subWindow.top !== subWindow ) {
1136
1137		// Support: IE 9 - 11+, Edge 12 - 18+
1138		subWindow.addEventListener( "unload", unloadHandler );
1139	}
1140
1141	// Support: IE <10
1142	// Check if getElementById returns elements by name
1143	// The broken getElementById methods don't pick up programmatically-set names,
1144	// so use a roundabout getElementsByName test
1145	support.getById = assert( function( el ) {
1146		documentElement.appendChild( el ).id = jQuery.expando;
1147		return !document.getElementsByName ||
1148			!document.getElementsByName( jQuery.expando ).length;
1149	} );
1150
1151	// Support: IE 9 only
1152	// Check to see if it's possible to do matchesSelector
1153	// on a disconnected node.
1154	support.disconnectedMatch = assert( function( el ) {
1155		return matches.call( el, "*" );
1156	} );
1157
1158	// Support: IE 9 - 11+, Edge 12 - 18+
1159	// IE/Edge don't support the :scope pseudo-class.
1160	support.scope = assert( function() {
1161		return document.querySelectorAll( ":scope" );
1162	} );
1163
1164	// Support: Chrome 105 - 111 only, Safari 15.4 - 16.3 only
1165	// Make sure the `:has()` argument is parsed unforgivingly.
1166	// We include `*` in the test to detect buggy implementations that are
1167	// _selectively_ forgiving (specifically when the list includes at least
1168	// one valid selector).
1169	// Note that we treat complete lack of support for `:has()` as if it were
1170	// spec-compliant support, which is fine because use of `:has()` in such
1171	// environments will fail in the qSA path and fall back to jQuery traversal
1172	// anyway.
1173	support.cssHas = assert( function() {
1174		try {
1175			document.querySelector( ":has(*,:jqfake)" );
1176			return false;
1177		} catch ( e ) {
1178			return true;
1179		}
1180	} );
1181
1182	// ID filter and find
1183	if ( support.getById ) {
1184		Expr.filter.ID = function( id ) {
1185			var attrId = id.replace( runescape, funescape );
1186			return function( elem ) {
1187				return elem.getAttribute( "id" ) === attrId;
1188			};
1189		};
1190		Expr.find.ID = function( id, context ) {
1191			if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
1192				var elem = context.getElementById( id );
1193				return elem ? [ elem ] : [];
1194			}
1195		};
1196	} else {
1197		Expr.filter.ID =  function( id ) {
1198			var attrId = id.replace( runescape, funescape );
1199			return function( elem ) {
1200				var node = typeof elem.getAttributeNode !== "undefined" &&
1201					elem.getAttributeNode( "id" );
1202				return node && node.value === attrId;
1203			};
1204		};
1205
1206		// Support: IE 6 - 7 only
1207		// getElementById is not reliable as a find shortcut
1208		Expr.find.ID = function( id, context ) {
1209			if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
1210				var node, i, elems,
1211					elem = context.getElementById( id );
1212
1213				if ( elem ) {
1214
1215					// Verify the id attribute
1216					node = elem.getAttributeNode( "id" );
1217					if ( node && node.value === id ) {
1218						return [ elem ];
1219					}
1220
1221					// Fall back on getElementsByName
1222					elems = context.getElementsByName( id );
1223					i = 0;
1224					while ( ( elem = elems[ i++ ] ) ) {
1225						node = elem.getAttributeNode( "id" );
1226						if ( node && node.value === id ) {
1227							return [ elem ];
1228						}
1229					}
1230				}
1231
1232				return [];
1233			}
1234		};
1235	}
1236
1237	// Tag
1238	Expr.find.TAG = function( tag, context ) {
1239		if ( typeof context.getElementsByTagName !== "undefined" ) {
1240			return context.getElementsByTagName( tag );
1241
1242		// DocumentFragment nodes don't have gEBTN
1243		} else {
1244			return context.querySelectorAll( tag );
1245		}
1246	};
1247
1248	// Class
1249	Expr.find.CLASS = function( className, context ) {
1250		if ( typeof context.getElementsByClassName !== "undefined" && documentIsHTML ) {
1251			return context.getElementsByClassName( className );
1252		}
1253	};
1254
1255	/* QSA/matchesSelector
1256	---------------------------------------------------------------------- */
1257
1258	// QSA and matchesSelector support
1259
1260	rbuggyQSA = [];
1261
1262	// Build QSA regex
1263	// Regex strategy adopted from Diego Perini
1264	assert( function( el ) {
1265
1266		var input;
1267
1268		documentElement.appendChild( el ).innerHTML =
1269			"<a id='" + expando + "' href='' disabled='disabled'></a>" +
1270			"<select id='" + expando + "-\r\\' disabled='disabled'>" +
1271			"<option selected=''></option></select>";
1272
1273		// Support: iOS <=7 - 8 only
1274		// Boolean attributes and "value" are not treated correctly in some XML documents
1275		if ( !el.querySelectorAll( "[selected]" ).length ) {
1276			rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" );
1277		}
1278
1279		// Support: iOS <=7 - 8 only
1280		if ( !el.querySelectorAll( "[id~=" + expando + "-]" ).length ) {
1281			rbuggyQSA.push( "~=" );
1282		}
1283
1284		// Support: iOS 8 only
1285		// https://bugs.webkit.org/show_bug.cgi?id=136851
1286		// In-page `selector#id sibling-combinator selector` fails
1287		if ( !el.querySelectorAll( "a#" + expando + "+*" ).length ) {
1288			rbuggyQSA.push( ".#.+[+~]" );
1289		}
1290
1291		// Support: Chrome <=105+, Firefox <=104+, Safari <=15.4+
1292		// In some of the document kinds, these selectors wouldn't work natively.
1293		// This is probably OK but for backwards compatibility we want to maintain
1294		// handling them through jQuery traversal in jQuery 3.x.
1295		if ( !el.querySelectorAll( ":checked" ).length ) {
1296			rbuggyQSA.push( ":checked" );
1297		}
1298
1299		// Support: Windows 8 Native Apps
1300		// The type and name attributes are restricted during .innerHTML assignment
1301		input = document.createElement( "input" );
1302		input.setAttribute( "type", "hidden" );
1303		el.appendChild( input ).setAttribute( "name", "D" );
1304
1305		// Support: IE 9 - 11+
1306		// IE's :disabled selector does not pick up the children of disabled fieldsets
1307		// Support: Chrome <=105+, Firefox <=104+, Safari <=15.4+
1308		// In some of the document kinds, these selectors wouldn't work natively.
1309		// This is probably OK but for backwards compatibility we want to maintain
1310		// handling them through jQuery traversal in jQuery 3.x.
1311		documentElement.appendChild( el ).disabled = true;
1312		if ( el.querySelectorAll( ":disabled" ).length !== 2 ) {
1313			rbuggyQSA.push( ":enabled", ":disabled" );
1314		}
1315
1316		// Support: IE 11+, Edge 15 - 18+
1317		// IE 11/Edge don't find elements on a `[name='']` query in some cases.
1318		// Adding a temporary attribute to the document before the selection works
1319		// around the issue.
1320		// Interestingly, IE 10 & older don't seem to have the issue.
1321		input = document.createElement( "input" );
1322		input.setAttribute( "name", "" );
1323		el.appendChild( input );
1324		if ( !el.querySelectorAll( "[name='']" ).length ) {
1325			rbuggyQSA.push( "\\[" + whitespace + "*name" + whitespace + "*=" +
1326				whitespace + "*(?:''|\"\")" );
1327		}
1328	} );
1329
1330	if ( !support.cssHas ) {
1331
1332		// Support: Chrome 105 - 110+, Safari 15.4 - 16.3+
1333		// Our regular `try-catch` mechanism fails to detect natively-unsupported
1334		// pseudo-classes inside `:has()` (such as `:has(:contains("Foo"))`)
1335		// in browsers that parse the `:has()` argument as a forgiving selector list.
1336		// https://drafts.csswg.org/selectors/#relational now requires the argument
1337		// to be parsed unforgivingly, but browsers have not yet fully adjusted.
1338		rbuggyQSA.push( ":has" );
1339	}
1340
1341	rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join( "|" ) );
1342
1343	/* Sorting
1344	---------------------------------------------------------------------- */
1345
1346	// Document order sorting
1347	sortOrder = function( a, b ) {
1348
1349		// Flag for duplicate removal
1350		if ( a === b ) {
1351			hasDuplicate = true;
1352			return 0;
1353		}
1354
1355		// Sort on method existence if only one input has compareDocumentPosition
1356		var compare = !a.compareDocumentPosition - !b.compareDocumentPosition;
1357		if ( compare ) {
1358			return compare;
1359		}
1360
1361		// Calculate position if both inputs belong to the same document
1362		// Support: IE 11+, Edge 17 - 18+
1363		// IE/Edge sometimes throw a "Permission denied" error when strict-comparing
1364		// two documents; shallow comparisons work.
1365		// eslint-disable-next-line eqeqeq
1366		compare = ( a.ownerDocument || a ) == ( b.ownerDocument || b ) ?
1367			a.compareDocumentPosition( b ) :
1368
1369			// Otherwise we know they are disconnected
1370			1;
1371
1372		// Disconnected nodes
1373		if ( compare & 1 ||
1374			( !support.sortDetached && b.compareDocumentPosition( a ) === compare ) ) {
1375
1376			// Choose the first element that is related to our preferred document
1377			// Support: IE 11+, Edge 17 - 18+
1378			// IE/Edge sometimes throw a "Permission denied" error when strict-comparing
1379			// two documents; shallow comparisons work.
1380			// eslint-disable-next-line eqeqeq
1381			if ( a === document || a.ownerDocument == preferredDoc &&
1382				find.contains( preferredDoc, a ) ) {
1383				return -1;
1384			}
1385
1386			// Support: IE 11+, Edge 17 - 18+
1387			// IE/Edge sometimes throw a "Permission denied" error when strict-comparing
1388			// two documents; shallow comparisons work.
1389			// eslint-disable-next-line eqeqeq
1390			if ( b === document || b.ownerDocument == preferredDoc &&
1391				find.contains( preferredDoc, b ) ) {
1392				return 1;
1393			}
1394
1395			// Maintain original order
1396			return sortInput ?
1397				( indexOf.call( sortInput, a ) - indexOf.call( sortInput, b ) ) :
1398				0;
1399		}
1400
1401		return compare & 4 ? -1 : 1;
1402	};
1403
1404	return document;
1405}
1406
1407find.matches = function( expr, elements ) {
1408	return find( expr, null, null, elements );
1409};
1410
1411find.matchesSelector = function( elem, expr ) {
1412	setDocument( elem );
1413
1414	if ( documentIsHTML &&
1415		!nonnativeSelectorCache[ expr + " " ] &&
1416		( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) {
1417
1418		try {
1419			var ret = matches.call( elem, expr );
1420
1421			// IE 9's matchesSelector returns false on disconnected nodes
1422			if ( ret || support.disconnectedMatch ||
1423
1424					// As well, disconnected nodes are said to be in a document
1425					// fragment in IE 9
1426					elem.document && elem.document.nodeType !== 11 ) {
1427				return ret;
1428			}
1429		} catch ( e ) {
1430			nonnativeSelectorCache( expr, true );
1431		}
1432	}
1433
1434	return find( expr, document, null, [ elem ] ).length > 0;
1435};
1436
1437find.contains = function( context, elem ) {
1438
1439	// Set document vars if needed
1440	// Support: IE 11+, Edge 17 - 18+
1441	// IE/Edge sometimes throw a "Permission denied" error when strict-comparing
1442	// two documents; shallow comparisons work.
1443	// eslint-disable-next-line eqeqeq
1444	if ( ( context.ownerDocument || context ) != document ) {
1445		setDocument( context );
1446	}
1447	return jQuery.contains( context, elem );
1448};
1449
1450
1451find.attr = function( elem, name ) {
1452
1453	// Set document vars if needed
1454	// Support: IE 11+, Edge 17 - 18+
1455	// IE/Edge sometimes throw a "Permission denied" error when strict-comparing
1456	// two documents; shallow comparisons work.
1457	// eslint-disable-next-line eqeqeq
1458	if ( ( elem.ownerDocument || elem ) != document ) {
1459		setDocument( elem );
1460	}
1461
1462	var fn = Expr.attrHandle[ name.toLowerCase() ],
1463
1464		// Don't get fooled by Object.prototype properties (see trac-13807)
1465		val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ?
1466			fn( elem, name, !documentIsHTML ) :
1467			undefined;
1468
1469	if ( val !== undefined ) {
1470		return val;
1471	}
1472
1473	return elem.getAttribute( name );
1474};
1475
1476find.error = function( msg ) {
1477	throw new Error( "Syntax error, unrecognized expression: " + msg );
1478};
1479
1480/**
1481 * Document sorting and removing duplicates
1482 * @param {ArrayLike} results
1483 */
1484jQuery.uniqueSort = function( results ) {
1485	var elem,
1486		duplicates = [],
1487		j = 0,
1488		i = 0;
1489
1490	// Unless we *know* we can detect duplicates, assume their presence
1491	//
1492	// Support: Android <=4.0+
1493	// Testing for detecting duplicates is unpredictable so instead assume we can't
1494	// depend on duplicate detection in all browsers without a stable sort.
1495	hasDuplicate = !support.sortStable;
1496	sortInput = !support.sortStable && slice.call( results, 0 );
1497	sort.call( results, sortOrder );
1498
1499	if ( hasDuplicate ) {
1500		while ( ( elem = results[ i++ ] ) ) {
1501			if ( elem === results[ i ] ) {
1502				j = duplicates.push( i );
1503			}
1504		}
1505		while ( j-- ) {
1506			splice.call( results, duplicates[ j ], 1 );
1507		}
1508	}
1509
1510	// Clear input after sorting to release objects
1511	// See https://github.com/jquery/sizzle/pull/225
1512	sortInput = null;
1513
1514	return results;
1515};
1516
1517jQuery.fn.uniqueSort = function() {
1518	return this.pushStack( jQuery.uniqueSort( slice.apply( this ) ) );
1519};
1520
1521Expr = jQuery.expr = {
1522
1523	// Can be adjusted by the user
1524	cacheLength: 50,
1525
1526	createPseudo: markFunction,
1527
1528	match: matchExpr,
1529
1530	attrHandle: {},
1531
1532	find: {},
1533
1534	relative: {
1535		">": { dir: "parentNode", first: true },
1536		" ": { dir: "parentNode" },
1537		"+": { dir: "previousSibling", first: true },
1538		"~": { dir: "previousSibling" }
1539	},
1540
1541	preFilter: {
1542		ATTR: function( match ) {
1543			match[ 1 ] = match[ 1 ].replace( runescape, funescape );
1544
1545			// Move the given value to match[3] whether quoted or unquoted
1546			match[ 3 ] = ( match[ 3 ] || match[ 4 ] || match[ 5 ] || "" )
1547				.replace( runescape, funescape );
1548
1549			if ( match[ 2 ] === "~=" ) {
1550				match[ 3 ] = " " + match[ 3 ] + " ";
1551			}
1552
1553			return match.slice( 0, 4 );
1554		},
1555
1556		CHILD: function( match ) {
1557
1558			/* matches from matchExpr["CHILD"]
1559				1 type (only|nth|...)
1560				2 what (child|of-type)
1561				3 argument (even|odd|\d*|\d*n([+-]\d+)?|...)
1562				4 xn-component of xn+y argument ([+-]?\d*n|)
1563				5 sign of xn-component
1564				6 x of xn-component
1565				7 sign of y-component
1566				8 y of y-component
1567			*/
1568			match[ 1 ] = match[ 1 ].toLowerCase();
1569
1570			if ( match[ 1 ].slice( 0, 3 ) === "nth" ) {
1571
1572				// nth-* requires argument
1573				if ( !match[ 3 ] ) {
1574					find.error( match[ 0 ] );
1575				}
1576
1577				// numeric x and y parameters for Expr.filter.CHILD
1578				// remember that false/true cast respectively to 0/1
1579				match[ 4 ] = +( match[ 4 ] ?
1580					match[ 5 ] + ( match[ 6 ] || 1 ) :
1581					2 * ( match[ 3 ] === "even" || match[ 3 ] === "odd" )
1582				);
1583				match[ 5 ] = +( ( match[ 7 ] + match[ 8 ] ) || match[ 3 ] === "odd" );
1584
1585			// other types prohibit arguments
1586			} else if ( match[ 3 ] ) {
1587				find.error( match[ 0 ] );
1588			}
1589
1590			return match;
1591		},
1592
1593		PSEUDO: function( match ) {
1594			var excess,
1595				unquoted = !match[ 6 ] && match[ 2 ];
1596
1597			if ( matchExpr.CHILD.test( match[ 0 ] ) ) {
1598				return null;
1599			}
1600
1601			// Accept quoted arguments as-is
1602			if ( match[ 3 ] ) {
1603				match[ 2 ] = match[ 4 ] || match[ 5 ] || "";
1604
1605			// Strip excess characters from unquoted arguments
1606			} else if ( unquoted && rpseudo.test( unquoted ) &&
1607
1608				// Get excess from tokenize (recursively)
1609				( excess = tokenize( unquoted, true ) ) &&
1610
1611				// advance to the next closing parenthesis
1612				( excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length ) ) {
1613
1614				// excess is a negative index
1615				match[ 0 ] = match[ 0 ].slice( 0, excess );
1616				match[ 2 ] = unquoted.slice( 0, excess );
1617			}
1618
1619			// Return only captures needed by the pseudo filter method (type and argument)
1620			return match.slice( 0, 3 );
1621		}
1622	},
1623
1624	filter: {
1625
1626		TAG: function( nodeNameSelector ) {
1627			var expectedNodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase();
1628			return nodeNameSelector === "*" ?
1629				function() {
1630					return true;
1631				} :
1632				function( elem ) {
1633					return nodeName( elem, expectedNodeName );
1634				};
1635		},
1636
1637		CLASS: function( className ) {
1638			var pattern = classCache[ className + " " ];
1639
1640			return pattern ||
1641				( pattern = new RegExp( "(^|" + whitespace + ")" + className +
1642					"(" + whitespace + "|$)" ) ) &&
1643				classCache( className, function( elem ) {
1644					return pattern.test(
1645						typeof elem.className === "string" && elem.className ||
1646							typeof elem.getAttribute !== "undefined" &&
1647								elem.getAttribute( "class" ) ||
1648							""
1649					);
1650				} );
1651		},
1652
1653		ATTR: function( name, operator, check ) {
1654			return function( elem ) {
1655				var result = find.attr( elem, name );
1656
1657				if ( result == null ) {
1658					return operator === "!=";
1659				}
1660				if ( !operator ) {
1661					return true;
1662				}
1663
1664				result += "";
1665
1666				if ( operator === "=" ) {
1667					return result === check;
1668				}
1669				if ( operator === "!=" ) {
1670					return result !== check;
1671				}
1672				if ( operator === "^=" ) {
1673					return check && result.indexOf( check ) === 0;
1674				}
1675				if ( operator === "*=" ) {
1676					return check && result.indexOf( check ) > -1;
1677				}
1678				if ( operator === "$=" ) {
1679					return check && result.slice( -check.length ) === check;
1680				}
1681				if ( operator === "~=" ) {
1682					return ( " " + result.replace( rwhitespace, " " ) + " " )
1683						.indexOf( check ) > -1;
1684				}
1685				if ( operator === "|=" ) {
1686					return result === check || result.slice( 0, check.length + 1 ) === check + "-";
1687				}
1688
1689				return false;
1690			};
1691		},
1692
1693		CHILD: function( type, what, _argument, first, last ) {
1694			var simple = type.slice( 0, 3 ) !== "nth",
1695				forward = type.slice( -4 ) !== "last",
1696				ofType = what === "of-type";
1697
1698			return first === 1 && last === 0 ?
1699
1700				// Shortcut for :nth-*(n)
1701				function( elem ) {
1702					return !!elem.parentNode;
1703				} :
1704
1705				function( elem, _context, xml ) {
1706					var cache, outerCache, node, nodeIndex, start,
1707						dir = simple !== forward ? "nextSibling" : "previousSibling",
1708						parent = elem.parentNode,
1709						name = ofType && elem.nodeName.toLowerCase(),
1710						useCache = !xml && !ofType,
1711						diff = false;
1712
1713					if ( parent ) {
1714
1715						// :(first|last|only)-(child|of-type)
1716						if ( simple ) {
1717							while ( dir ) {
1718								node = elem;
1719								while ( ( node = node[ dir ] ) ) {
1720									if ( ofType ?
1721										nodeName( node, name ) :
1722										node.nodeType === 1 ) {
1723
1724										return false;
1725									}
1726								}
1727
1728								// Reverse direction for :only-* (if we haven't yet done so)
1729								start = dir = type === "only" && !start && "nextSibling";
1730							}
1731							return true;
1732						}
1733
1734						start = [ forward ? parent.firstChild : parent.lastChild ];
1735
1736						// non-xml :nth-child(...) stores cache data on `parent`
1737						if ( forward && useCache ) {
1738
1739							// Seek `elem` from a previously-cached index
1740							outerCache = parent[ expando ] || ( parent[ expando ] = {} );
1741							cache = outerCache[ type ] || [];
1742							nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
1743							diff = nodeIndex && cache[ 2 ];
1744							node = nodeIndex && parent.childNodes[ nodeIndex ];
1745
1746							while ( ( node = ++nodeIndex && node && node[ dir ] ||
1747
1748								// Fallback to seeking `elem` from the start
1749								( diff = nodeIndex = 0 ) || start.pop() ) ) {
1750
1751								// When found, cache indexes on `parent` and break
1752								if ( node.nodeType === 1 && ++diff && node === elem ) {
1753									outerCache[ type ] = [ dirruns, nodeIndex, diff ];
1754									break;
1755								}
1756							}
1757
1758						} else {
1759
1760							// Use previously-cached element index if available
1761							if ( useCache ) {
1762								outerCache = elem[ expando ] || ( elem[ expando ] = {} );
1763								cache = outerCache[ type ] || [];
1764								nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
1765								diff = nodeIndex;
1766							}
1767
1768							// xml :nth-child(...)
1769							// or :nth-last-child(...) or :nth(-last)?-of-type(...)
1770							if ( diff === false ) {
1771
1772								// Use the same loop as above to seek `elem` from the start
1773								while ( ( node = ++nodeIndex && node && node[ dir ] ||
1774									( diff = nodeIndex = 0 ) || start.pop() ) ) {
1775
1776									if ( ( ofType ?
1777										nodeName( node, name ) :
1778										node.nodeType === 1 ) &&
1779										++diff ) {
1780
1781										// Cache the index of each encountered element
1782										if ( useCache ) {
1783											outerCache = node[ expando ] ||
1784												( node[ expando ] = {} );
1785											outerCache[ type ] = [ dirruns, diff ];
1786										}
1787
1788										if ( node === elem ) {
1789											break;
1790										}
1791									}
1792								}
1793							}
1794						}
1795
1796						// Incorporate the offset, then check against cycle size
1797						diff -= last;
1798						return diff === first || ( diff % first === 0 && diff / first >= 0 );
1799					}
1800				};
1801		},
1802
1803		PSEUDO: function( pseudo, argument ) {
1804
1805			// pseudo-class names are case-insensitive
1806			// https://www.w3.org/TR/selectors/#pseudo-classes
1807			// Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
1808			// Remember that setFilters inherits from pseudos
1809			var args,
1810				fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] ||
1811					find.error( "unsupported pseudo: " + pseudo );
1812
1813			// The user may use createPseudo to indicate that
1814			// arguments are needed to create the filter function
1815			// just as jQuery does
1816			if ( fn[ expando ] ) {
1817				return fn( argument );
1818			}
1819
1820			// But maintain support for old signatures
1821			if ( fn.length > 1 ) {
1822				args = [ pseudo, pseudo, "", argument ];
1823				return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ?
1824					markFunction( function( seed, matches ) {
1825						var idx,
1826							matched = fn( seed, argument ),
1827							i = matched.length;
1828						while ( i-- ) {
1829							idx = indexOf.call( seed, matched[ i ] );
1830							seed[ idx ] = !( matches[ idx ] = matched[ i ] );
1831						}
1832					} ) :
1833					function( elem ) {
1834						return fn( elem, 0, args );
1835					};
1836			}
1837
1838			return fn;
1839		}
1840	},
1841
1842	pseudos: {
1843
1844		// Potentially complex pseudos
1845		not: markFunction( function( selector ) {
1846
1847			// Trim the selector passed to compile
1848			// to avoid treating leading and trailing
1849			// spaces as combinators
1850			var input = [],
1851				results = [],
1852				matcher = compile( selector.replace( rtrimCSS, "$1" ) );
1853
1854			return matcher[ expando ] ?
1855				markFunction( function( seed, matches, _context, xml ) {
1856					var elem,
1857						unmatched = matcher( seed, null, xml, [] ),
1858						i = seed.length;
1859
1860					// Match elements unmatched by `matcher`
1861					while ( i-- ) {
1862						if ( ( elem = unmatched[ i ] ) ) {
1863							seed[ i ] = !( matches[ i ] = elem );
1864						}
1865					}
1866				} ) :
1867				function( elem, _context, xml ) {
1868					input[ 0 ] = elem;
1869					matcher( input, null, xml, results );
1870
1871					// Don't keep the element
1872					// (see https://github.com/jquery/sizzle/issues/299)
1873					input[ 0 ] = null;
1874					return !results.pop();
1875				};
1876		} ),
1877
1878		has: markFunction( function( selector ) {
1879			return function( elem ) {
1880				return find( selector, elem ).length > 0;
1881			};
1882		} ),
1883
1884		contains: markFunction( function( text ) {
1885			text = text.replace( runescape, funescape );
1886			return function( elem ) {
1887				return ( elem.textContent || jQuery.text( elem ) ).indexOf( text ) > -1;
1888			};
1889		} ),
1890
1891		// "Whether an element is represented by a :lang() selector
1892		// is based solely on the element's language value
1893		// being equal to the identifier C,
1894		// or beginning with the identifier C immediately followed by "-".
1895		// The matching of C against the element's language value is performed case-insensitively.
1896		// The identifier C does not have to be a valid language name."
1897		// https://www.w3.org/TR/selectors/#lang-pseudo
1898		lang: markFunction( function( lang ) {
1899
1900			// lang value must be a valid identifier
1901			if ( !ridentifier.test( lang || "" ) ) {
1902				find.error( "unsupported lang: " + lang );
1903			}
1904			lang = lang.replace( runescape, funescape ).toLowerCase();
1905			return function( elem ) {
1906				var elemLang;
1907				do {
1908					if ( ( elemLang = documentIsHTML ?
1909						elem.lang :
1910						elem.getAttribute( "xml:lang" ) || elem.getAttribute( "lang" ) ) ) {
1911
1912						elemLang = elemLang.toLowerCase();
1913						return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0;
1914					}
1915				} while ( ( elem = elem.parentNode ) && elem.nodeType === 1 );
1916				return false;
1917			};
1918		} ),
1919
1920		// Miscellaneous
1921		target: function( elem ) {
1922			var hash = window.location && window.location.hash;
1923			return hash && hash.slice( 1 ) === elem.id;
1924		},
1925
1926		root: function( elem ) {
1927			return elem === documentElement;
1928		},
1929
1930		focus: function( elem ) {
1931			return elem === safeActiveElement() &&
1932				document.hasFocus() &&
1933				!!( elem.type || elem.href || ~elem.tabIndex );
1934		},
1935
1936		// Boolean properties
1937		enabled: createDisabledPseudo( false ),
1938		disabled: createDisabledPseudo( true ),
1939
1940		checked: function( elem ) {
1941
1942			// In CSS3, :checked should return both checked and selected elements
1943			// https://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
1944			return ( nodeName( elem, "input" ) && !!elem.checked ) ||
1945				( nodeName( elem, "option" ) && !!elem.selected );
1946		},
1947
1948		selected: function( elem ) {
1949
1950			// Support: IE <=11+
1951			// Accessing the selectedIndex property
1952			// forces the browser to treat the default option as
1953			// selected when in an optgroup.
1954			if ( elem.parentNode ) {
1955				// eslint-disable-next-line no-unused-expressions
1956				elem.parentNode.selectedIndex;
1957			}
1958
1959			return elem.selected === true;
1960		},
1961
1962		// Contents
1963		empty: function( elem ) {
1964
1965			// https://www.w3.org/TR/selectors/#empty-pseudo
1966			// :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5),
1967			//   but not by others (comment: 8; processing instruction: 7; etc.)
1968			// nodeType < 6 works because attributes (2) do not appear as children
1969			for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
1970				if ( elem.nodeType < 6 ) {
1971					return false;
1972				}
1973			}
1974			return true;
1975		},
1976
1977		parent: function( elem ) {
1978			return !Expr.pseudos.empty( elem );
1979		},
1980
1981		// Element/input types
1982		header: function( elem ) {
1983			return rheader.test( elem.nodeName );
1984		},
1985
1986		input: function( elem ) {
1987			return rinputs.test( elem.nodeName );
1988		},
1989
1990		button: function( elem ) {
1991			return nodeName( elem, "input" ) && elem.type === "button" ||
1992				nodeName( elem, "button" );
1993		},
1994
1995		text: function( elem ) {
1996			var attr;
1997			return nodeName( elem, "input" ) && elem.type === "text" &&
1998
1999				// Support: IE <10 only
2000				// New HTML5 attribute values (e.g., "search") appear
2001				// with elem.type === "text"
2002				( ( attr = elem.getAttribute( "type" ) ) == null ||
2003					attr.toLowerCase() === "text" );
2004		},
2005
2006		// Position-in-collection
2007		first: createPositionalPseudo( function() {
2008			return [ 0 ];
2009		} ),
2010
2011		last: createPositionalPseudo( function( _matchIndexes, length ) {
2012			return [ length - 1 ];
2013		} ),
2014
2015		eq: createPositionalPseudo( function( _matchIndexes, length, argument ) {
2016			return [ argument < 0 ? argument + length : argument ];
2017		} ),
2018
2019		even: createPositionalPseudo( function( matchIndexes, length ) {
2020			var i = 0;
2021			for ( ; i < length; i += 2 ) {
2022				matchIndexes.push( i );
2023			}
2024			return matchIndexes;
2025		} ),
2026
2027		odd: createPositionalPseudo( function( matchIndexes, length ) {
2028			var i = 1;
2029			for ( ; i < length; i += 2 ) {
2030				matchIndexes.push( i );
2031			}
2032			return matchIndexes;
2033		} ),
2034
2035		lt: createPositionalPseudo( function( matchIndexes, length, argument ) {
2036			var i;
2037
2038			if ( argument < 0 ) {
2039				i = argument + length;
2040			} else if ( argument > length ) {
2041				i = length;
2042			} else {
2043				i = argument;
2044			}
2045
2046			for ( ; --i >= 0; ) {
2047				matchIndexes.push( i );
2048			}
2049			return matchIndexes;
2050		} ),
2051
2052		gt: createPositionalPseudo( function( matchIndexes, length, argument ) {
2053			var i = argument < 0 ? argument + length : argument;
2054			for ( ; ++i < length; ) {
2055				matchIndexes.push( i );
2056			}
2057			return matchIndexes;
2058		} )
2059	}
2060};
2061
2062Expr.pseudos.nth = Expr.pseudos.eq;
2063
2064// Add button/input type pseudos
2065for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) {
2066	Expr.pseudos[ i ] = createInputPseudo( i );
2067}
2068for ( i in { submit: true, reset: true } ) {
2069	Expr.pseudos[ i ] = createButtonPseudo( i );
2070}
2071
2072// Easy API for creating new setFilters
2073function setFilters() {}
2074setFilters.prototype = Expr.filters = Expr.pseudos;
2075Expr.setFilters = new setFilters();
2076
2077function tokenize( selector, parseOnly ) {
2078	var matched, match, tokens, type,
2079		soFar, groups, preFilters,
2080		cached = tokenCache[ selector + " " ];
2081
2082	if ( cached ) {
2083		return parseOnly ? 0 : cached.slice( 0 );
2084	}
2085
2086	soFar = selector;
2087	groups = [];
2088	preFilters = Expr.preFilter;
2089
2090	while ( soFar ) {
2091
2092		// Comma and first run
2093		if ( !matched || ( match = rcomma.exec( soFar ) ) ) {
2094			if ( match ) {
2095
2096				// Don't consume trailing commas as valid
2097				soFar = soFar.slice( match[ 0 ].length ) || soFar;
2098			}
2099			groups.push( ( tokens = [] ) );
2100		}
2101
2102		matched = false;
2103
2104		// Combinators
2105		if ( ( match = rleadingCombinator.exec( soFar ) ) ) {
2106			matched = match.shift();
2107			tokens.push( {
2108				value: matched,
2109
2110				// Cast descendant combinators to space
2111				type: match[ 0 ].replace( rtrimCSS, " " )
2112			} );
2113			soFar = soFar.slice( matched.length );
2114		}
2115
2116		// Filters
2117		for ( type in Expr.filter ) {
2118			if ( ( match = matchExpr[ type ].exec( soFar ) ) && ( !preFilters[ type ] ||
2119				( match = preFilters[ type ]( match ) ) ) ) {
2120				matched = match.shift();
2121				tokens.push( {
2122					value: matched,
2123					type: type,
2124					matches: match
2125				} );
2126				soFar = soFar.slice( matched.length );
2127			}
2128		}
2129
2130		if ( !matched ) {
2131			break;
2132		}
2133	}
2134
2135	// Return the length of the invalid excess
2136	// if we're just parsing
2137	// Otherwise, throw an error or return tokens
2138	if ( parseOnly ) {
2139		return soFar.length;
2140	}
2141
2142	return soFar ?
2143		find.error( selector ) :
2144
2145		// Cache the tokens
2146		tokenCache( selector, groups ).slice( 0 );
2147}
2148
2149function toSelector( tokens ) {
2150	var i = 0,
2151		len = tokens.length,
2152		selector = "";
2153	for ( ; i < len; i++ ) {
2154		selector += tokens[ i ].value;
2155	}
2156	return selector;
2157}
2158
2159function addCombinator( matcher, combinator, base ) {
2160	var dir = combinator.dir,
2161		skip = combinator.next,
2162		key = skip || dir,
2163		checkNonElements = base && key === "parentNode",
2164		doneName = done++;
2165
2166	return combinator.first ?
2167
2168		// Check against closest ancestor/preceding element
2169		function( elem, context, xml ) {
2170			while ( ( elem = elem[ dir ] ) ) {
2171				if ( elem.nodeType === 1 || checkNonElements ) {
2172					return matcher( elem, context, xml );
2173				}
2174			}
2175			return false;
2176		} :
2177
2178		// Check against all ancestor/preceding elements
2179		function( elem, context, xml ) {
2180			var oldCache, outerCache,
2181				newCache = [ dirruns, doneName ];
2182
2183			// We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching
2184			if ( xml ) {
2185				while ( ( elem = elem[ dir ] ) ) {
2186					if ( elem.nodeType === 1 || checkNonElements ) {
2187						if ( matcher( elem, context, xml ) ) {
2188							return true;
2189						}
2190					}
2191				}
2192			} else {
2193				while ( ( elem = elem[ dir ] ) ) {
2194					if ( elem.nodeType === 1 || checkNonElements ) {
2195						outerCache = elem[ expando ] || ( elem[ expando ] = {} );
2196
2197						if ( skip && nodeName( elem, skip ) ) {
2198							elem = elem[ dir ] || elem;
2199						} else if ( ( oldCache = outerCache[ key ] ) &&
2200							oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) {
2201
2202							// Assign to newCache so results back-propagate to previous elements
2203							return ( newCache[ 2 ] = oldCache[ 2 ] );
2204						} else {
2205
2206							// Reuse newcache so results back-propagate to previous elements
2207							outerCache[ key ] = newCache;
2208
2209							// A match means we're done; a fail means we have to keep checking
2210							if ( ( newCache[ 2 ] = matcher( elem, context, xml ) ) ) {
2211								return true;
2212							}
2213						}
2214					}
2215				}
2216			}
2217			return false;
2218		};
2219}
2220
2221function elementMatcher( matchers ) {
2222	return matchers.length > 1 ?
2223		function( elem, context, xml ) {
2224			var i = matchers.length;
2225			while ( i-- ) {
2226				if ( !matchers[ i ]( elem, context, xml ) ) {
2227					return false;
2228				}
2229			}
2230			return true;
2231		} :
2232		matchers[ 0 ];
2233}
2234
2235function multipleContexts( selector, contexts, results ) {
2236	var i = 0,
2237		len = contexts.length;
2238	for ( ; i < len; i++ ) {
2239		find( selector, contexts[ i ], results );
2240	}
2241	return results;
2242}
2243
2244function condense( unmatched, map, filter, context, xml ) {
2245	var elem,
2246		newUnmatched = [],
2247		i = 0,
2248		len = unmatched.length,
2249		mapped = map != null;
2250
2251	for ( ; i < len; i++ ) {
2252		if ( ( elem = unmatched[ i ] ) ) {
2253			if ( !filter || filter( elem, context, xml ) ) {
2254				newUnmatched.push( elem );
2255				if ( mapped ) {
2256					map.push( i );
2257				}
2258			}
2259		}
2260	}
2261
2262	return newUnmatched;
2263}
2264
2265function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {
2266	if ( postFilter && !postFilter[ expando ] ) {
2267		postFilter = setMatcher( postFilter );
2268	}
2269	if ( postFinder && !postFinder[ expando ] ) {
2270		postFinder = setMatcher( postFinder, postSelector );
2271	}
2272	return markFunction( function( seed, results, context, xml ) {
2273		var temp, i, elem, matcherOut,
2274			preMap = [],
2275			postMap = [],
2276			preexisting = results.length,
2277
2278			// Get initial elements from seed or context
2279			elems = seed ||
2280				multipleContexts( selector || "*",
2281					context.nodeType ? [ context ] : context, [] ),
2282
2283			// Prefilter to get matcher input, preserving a map for seed-results synchronization
2284			matcherIn = preFilter && ( seed || !selector ) ?
2285				condense( elems, preMap, preFilter, context, xml ) :
2286				elems;
2287
2288		if ( matcher ) {
2289
2290			// If we have a postFinder, or filtered seed, or non-seed postFilter
2291			// or preexisting results,
2292			matcherOut = postFinder || ( seed ? preFilter : preexisting || postFilter ) ?
2293
2294				// ...intermediate processing is necessary
2295				[] :
2296
2297				// ...otherwise use results directly
2298				results;
2299
2300			// Find primary matches
2301			matcher( matcherIn, matcherOut, context, xml );
2302		} else {
2303			matcherOut = matcherIn;
2304		}
2305
2306		// Apply postFilter
2307		if ( postFilter ) {
2308			temp = condense( matcherOut, postMap );
2309			postFilter( temp, [], context, xml );
2310
2311			// Un-match failing elements by moving them back to matcherIn
2312			i = temp.length;
2313			while ( i-- ) {
2314				if ( ( elem = temp[ i ] ) ) {
2315					matcherOut[ postMap[ i ] ] = !( matcherIn[ postMap[ i ] ] = elem );
2316				}
2317			}
2318		}
2319
2320		if ( seed ) {
2321			if ( postFinder || preFilter ) {
2322				if ( postFinder ) {
2323
2324					// Get the final matcherOut by condensing this intermediate into postFinder contexts
2325					temp = [];
2326					i = matcherOut.length;
2327					while ( i-- ) {
2328						if ( ( elem = matcherOut[ i ] ) ) {
2329
2330							// Restore matcherIn since elem is not yet a final match
2331							temp.push( ( matcherIn[ i ] = elem ) );
2332						}
2333					}
2334					postFinder( null, ( matcherOut = [] ), temp, xml );
2335				}
2336
2337				// Move matched elements from seed to results to keep them synchronized
2338				i = matcherOut.length;
2339				while ( i-- ) {
2340					if ( ( elem = matcherOut[ i ] ) &&
2341						( temp = postFinder ? indexOf.call( seed, elem ) : preMap[ i ] ) > -1 ) {
2342
2343						seed[ temp ] = !( results[ temp ] = elem );
2344					}
2345				}
2346			}
2347
2348		// Add elements to results, through postFinder if defined
2349		} else {
2350			matcherOut = condense(
2351				matcherOut === results ?
2352					matcherOut.splice( preexisting, matcherOut.length ) :
2353					matcherOut
2354			);
2355			if ( postFinder ) {
2356				postFinder( null, results, matcherOut, xml );
2357			} else {
2358				push.apply( results, matcherOut );
2359			}
2360		}
2361	} );
2362}
2363
2364function matcherFromTokens( tokens ) {
2365	var checkContext, matcher, j,
2366		len = tokens.length,
2367		leadingRelative = Expr.relative[ tokens[ 0 ].type ],
2368		implicitRelative = leadingRelative || Expr.relative[ " " ],
2369		i = leadingRelative ? 1 : 0,
2370
2371		// The foundational matcher ensures that elements are reachable from top-level context(s)
2372		matchContext = addCombinator( function( elem ) {
2373			return elem === checkContext;
2374		}, implicitRelative, true ),
2375		matchAnyContext = addCombinator( function( elem ) {
2376			return indexOf.call( checkContext, elem ) > -1;
2377		}, implicitRelative, true ),
2378		matchers = [ function( elem, context, xml ) {
2379
2380			// Support: IE 11+, Edge 17 - 18+
2381			// IE/Edge sometimes throw a "Permission denied" error when strict-comparing
2382			// two documents; shallow comparisons work.
2383			// eslint-disable-next-line eqeqeq
2384			var ret = ( !leadingRelative && ( xml || context != outermostContext ) ) || (
2385				( checkContext = context ).nodeType ?
2386					matchContext( elem, context, xml ) :
2387					matchAnyContext( elem, context, xml ) );
2388
2389			// Avoid hanging onto element
2390			// (see https://github.com/jquery/sizzle/issues/299)
2391			checkContext = null;
2392			return ret;
2393		} ];
2394
2395	for ( ; i < len; i++ ) {
2396		if ( ( matcher = Expr.relative[ tokens[ i ].type ] ) ) {
2397			matchers = [ addCombinator( elementMatcher( matchers ), matcher ) ];
2398		} else {
2399			matcher = Expr.filter[ tokens[ i ].type ].apply( null, tokens[ i ].matches );
2400
2401			// Return special upon seeing a positional matcher
2402			if ( matcher[ expando ] ) {
2403
2404				// Find the next relative operator (if any) for proper handling
2405				j = ++i;
2406				for ( ; j < len; j++ ) {
2407					if ( Expr.relative[ tokens[ j ].type ] ) {
2408						break;
2409					}
2410				}
2411				return setMatcher(
2412					i > 1 && elementMatcher( matchers ),
2413					i > 1 && toSelector(
2414
2415						// If the preceding token was a descendant combinator, insert an implicit any-element `*`
2416						tokens.slice( 0, i - 1 )
2417							.concat( { value: tokens[ i - 2 ].type === " " ? "*" : "" } )
2418					).replace( rtrimCSS, "$1" ),
2419					matcher,
2420					i < j && matcherFromTokens( tokens.slice( i, j ) ),
2421					j < len && matcherFromTokens( ( tokens = tokens.slice( j ) ) ),
2422					j < len && toSelector( tokens )
2423				);
2424			}
2425			matchers.push( matcher );
2426		}
2427	}
2428
2429	return elementMatcher( matchers );
2430}
2431
2432function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
2433	var bySet = setMatchers.length > 0,
2434		byElement = elementMatchers.length > 0,
2435		superMatcher = function( seed, context, xml, results, outermost ) {
2436			var elem, j, matcher,
2437				matchedCount = 0,
2438				i = "0",
2439				unmatched = seed && [],
2440				setMatched = [],
2441				contextBackup = outermostContext,
2442
2443				// We must always have either seed elements or outermost context
2444				elems = seed || byElement && Expr.find.TAG( "*", outermost ),
2445
2446				// Use integer dirruns iff this is the outermost matcher
2447				dirrunsUnique = ( dirruns += contextBackup == null ? 1 : Math.random() || 0.1 ),
2448				len = elems.length;
2449
2450			if ( outermost ) {
2451
2452				// Support: IE 11+, Edge 17 - 18+
2453				// IE/Edge sometimes throw a "Permission denied" error when strict-comparing
2454				// two documents; shallow comparisons work.
2455				// eslint-disable-next-line eqeqeq
2456				outermostContext = context == document || context || outermost;
2457			}
2458
2459			// Add elements passing elementMatchers directly to results
2460			// Support: iOS <=7 - 9 only
2461			// Tolerate NodeList properties (IE: "length"; Safari: <number>) matching
2462			// elements by id. (see trac-14142)
2463			for ( ; i !== len && ( elem = elems[ i ] ) != null; i++ ) {
2464				if ( byElement && elem ) {
2465					j = 0;
2466
2467					// Support: IE 11+, Edge 17 - 18+
2468					// IE/Edge sometimes throw a "Permission denied" error when strict-comparing
2469					// two documents; shallow comparisons work.
2470					// eslint-disable-next-line eqeqeq
2471					if ( !context && elem.ownerDocument != document ) {
2472						setDocument( elem );
2473						xml = !documentIsHTML;
2474					}
2475					while ( ( matcher = elementMatchers[ j++ ] ) ) {
2476						if ( matcher( elem, context || document, xml ) ) {
2477							push.call( results, elem );
2478							break;
2479						}
2480					}
2481					if ( outermost ) {
2482						dirruns = dirrunsUnique;
2483					}
2484				}
2485
2486				// Track unmatched elements for set filters
2487				if ( bySet ) {
2488
2489					// They will have gone through all possible matchers
2490					if ( ( elem = !matcher && elem ) ) {
2491						matchedCount--;
2492					}
2493
2494					// Lengthen the array for every element, matched or not
2495					if ( seed ) {
2496						unmatched.push( elem );
2497					}
2498				}
2499			}
2500
2501			// `i` is now the count of elements visited above, and adding it to `matchedCount`
2502			// makes the latter nonnegative.
2503			matchedCount += i;
2504
2505			// Apply set filters to unmatched elements
2506			// NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount`
2507			// equals `i`), unless we didn't visit _any_ elements in the above loop because we have
2508			// no element matchers and no seed.
2509			// Incrementing an initially-string "0" `i` allows `i` to remain a string only in that
2510			// case, which will result in a "00" `matchedCount` that differs from `i` but is also
2511			// numerically zero.
2512			if ( bySet && i !== matchedCount ) {
2513				j = 0;
2514				while ( ( matcher = setMatchers[ j++ ] ) ) {
2515					matcher( unmatched, setMatched, context, xml );
2516				}
2517
2518				if ( seed ) {
2519
2520					// Reintegrate element matches to eliminate the need for sorting
2521					if ( matchedCount > 0 ) {
2522						while ( i-- ) {
2523							if ( !( unmatched[ i ] || setMatched[ i ] ) ) {
2524								setMatched[ i ] = pop.call( results );
2525							}
2526						}
2527					}
2528
2529					// Discard index placeholder values to get only actual matches
2530					setMatched = condense( setMatched );
2531				}
2532
2533				// Add matches to results
2534				push.apply( results, setMatched );
2535
2536				// Seedless set matches succeeding multiple successful matchers stipulate sorting
2537				if ( outermost && !seed && setMatched.length > 0 &&
2538					( matchedCount + setMatchers.length ) > 1 ) {
2539
2540					jQuery.uniqueSort( results );
2541				}
2542			}
2543
2544			// Override manipulation of globals by nested matchers
2545			if ( outermost ) {
2546				dirruns = dirrunsUnique;
2547				outermostContext = contextBackup;
2548			}
2549
2550			return unmatched;
2551		};
2552
2553	return bySet ?
2554		markFunction( superMatcher ) :
2555		superMatcher;
2556}
2557
2558function compile( selector, match /* Internal Use Only */ ) {
2559	var i,
2560		setMatchers = [],
2561		elementMatchers = [],
2562		cached = compilerCache[ selector + " " ];
2563
2564	if ( !cached ) {
2565
2566		// Generate a function of recursive functions that can be used to check each element
2567		if ( !match ) {
2568			match = tokenize( selector );
2569		}
2570		i = match.length;
2571		while ( i-- ) {
2572			cached = matcherFromTokens( match[ i ] );
2573			if ( cached[ expando ] ) {
2574				setMatchers.push( cached );
2575			} else {
2576				elementMatchers.push( cached );
2577			}
2578		}
2579
2580		// Cache the compiled function
2581		cached = compilerCache( selector,
2582			matcherFromGroupMatchers( elementMatchers, setMatchers ) );
2583
2584		// Save selector and tokenization
2585		cached.selector = selector;
2586	}
2587	return cached;
2588}
2589
2590/**
2591 * A low-level selection function that works with jQuery's compiled
2592 *  selector functions
2593 * @param {String|Function} selector A selector or a pre-compiled
2594 *  selector function built with jQuery selector compile
2595 * @param {Element} context
2596 * @param {Array} [results]
2597 * @param {Array} [seed] A set of elements to match against
2598 */
2599function select( selector, context, results, seed ) {
2600	var i, tokens, token, type, find,
2601		compiled = typeof selector === "function" && selector,
2602		match = !seed && tokenize( ( selector = compiled.selector || selector ) );
2603
2604	results = results || [];
2605
2606	// Try to minimize operations if there is only one selector in the list and no seed
2607	// (the latter of which guarantees us context)
2608	if ( match.length === 1 ) {
2609
2610		// Reduce context if the leading compound selector is an ID
2611		tokens = match[ 0 ] = match[ 0 ].slice( 0 );
2612		if ( tokens.length > 2 && ( token = tokens[ 0 ] ).type === "ID" &&
2613				context.nodeType === 9 && documentIsHTML && Expr.relative[ tokens[ 1 ].type ] ) {
2614
2615			context = ( Expr.find.ID(
2616				token.matches[ 0 ].replace( runescape, funescape ),
2617				context
2618			) || [] )[ 0 ];
2619			if ( !context ) {
2620				return results;
2621
2622			// Precompiled matchers will still verify ancestry, so step up a level
2623			} else if ( compiled ) {
2624				context = context.parentNode;
2625			}
2626
2627			selector = selector.slice( tokens.shift().value.length );
2628		}
2629
2630		// Fetch a seed set for right-to-left matching
2631		i = matchExpr.needsContext.test( selector ) ? 0 : tokens.length;
2632		while ( i-- ) {
2633			token = tokens[ i ];
2634
2635			// Abort if we hit a combinator
2636			if ( Expr.relative[ ( type = token.type ) ] ) {
2637				break;
2638			}
2639			if ( ( find = Expr.find[ type ] ) ) {
2640
2641				// Search, expanding context for leading sibling combinators
2642				if ( ( seed = find(
2643					token.matches[ 0 ].replace( runescape, funescape ),
2644					rsibling.test( tokens[ 0 ].type ) &&
2645						testContext( context.parentNode ) || context
2646				) ) ) {
2647
2648					// If seed is empty or no tokens remain, we can return early
2649					tokens.splice( i, 1 );
2650					selector = seed.length && toSelector( tokens );
2651					if ( !selector ) {
2652						push.apply( results, seed );
2653						return results;
2654					}
2655
2656					break;
2657				}
2658			}
2659		}
2660	}
2661
2662	// Compile and execute a filtering function if one is not provided
2663	// Provide `match` to avoid retokenization if we modified the selector above
2664	( compiled || compile( selector, match ) )(
2665		seed,
2666		context,
2667		!documentIsHTML,
2668		results,
2669		!context || rsibling.test( selector ) && testContext( context.parentNode ) || context
2670	);
2671	return results;
2672}
2673
2674// One-time assignments
2675
2676// Support: Android <=4.0 - 4.1+
2677// Sort stability
2678support.sortStable = expando.split( "" ).sort( sortOrder ).join( "" ) === expando;
2679
2680// Initialize against the default document
2681setDocument();
2682
2683// Support: Android <=4.0 - 4.1+
2684// Detached nodes confoundingly follow *each other*
2685support.sortDetached = assert( function( el ) {
2686
2687	// Should return 1, but returns 4 (following)
2688	return el.compareDocumentPosition( document.createElement( "fieldset" ) ) & 1;
2689} );
2690
2691jQuery.find = find;
2692
2693// Deprecated
2694jQuery.expr[ ":" ] = jQuery.expr.pseudos;
2695jQuery.unique = jQuery.uniqueSort;
2696
2697// These have always been private, but they used to be documented
2698// as part of Sizzle so let's maintain them in the 3.x line
2699// for backwards compatibility purposes.
2700find.compile = compile;
2701find.select = select;
2702find.setDocument = setDocument;
2703
2704find.escape = jQuery.escapeSelector;
2705find.getText = jQuery.text;
2706find.isXML = jQuery.isXMLDoc;
2707find.selectors = jQuery.expr;
2708find.support = jQuery.support;
2709find.uniqueSort = jQuery.uniqueSort;
2710
2711	/* eslint-enable */
2712
2713} )();
2714
2715
2716var dir = function( elem, dir, until ) {
2717	var matched = [],
2718		truncate = until !== undefined;
2719
2720	while ( ( elem = elem[ dir ] ) && elem.nodeType !== 9 ) {
2721		if ( elem.nodeType === 1 ) {
2722			if ( truncate && jQuery( elem ).is( until ) ) {
2723				break;
2724			}
2725			matched.push( elem );
2726		}
2727	}
2728	return matched;
2729};
2730
2731
2732var siblings = function( n, elem ) {
2733	var matched = [];
2734
2735	for ( ; n; n = n.nextSibling ) {
2736		if ( n.nodeType === 1 && n !== elem ) {
2737			matched.push( n );
2738		}
2739	}
2740
2741	return matched;
2742};
2743
2744
2745var rneedsContext = jQuery.expr.match.needsContext;
2746
2747var rsingleTag = ( /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i );
2748
2749
2750
2751// Implement the identical functionality for filter and not
2752function winnow( elements, qualifier, not ) {
2753	if ( isFunction( qualifier ) ) {
2754		return jQuery.grep( elements, function( elem, i ) {
2755			return !!qualifier.call( elem, i, elem ) !== not;
2756		} );
2757	}
2758
2759	// Single element
2760	if ( qualifier.nodeType ) {
2761		return jQuery.grep( elements, function( elem ) {
2762			return ( elem === qualifier ) !== not;
2763		} );
2764	}
2765
2766	// Arraylike of elements (jQuery, arguments, Array)
2767	if ( typeof qualifier !== "string" ) {
2768		return jQuery.grep( elements, function( elem ) {
2769			return ( indexOf.call( qualifier, elem ) > -1 ) !== not;
2770		} );
2771	}
2772
2773	// Filtered directly for both simple and complex selectors
2774	return jQuery.filter( qualifier, elements, not );
2775}
2776
2777jQuery.filter = function( expr, elems, not ) {
2778	var elem = elems[ 0 ];
2779
2780	if ( not ) {
2781		expr = ":not(" + expr + ")";
2782	}
2783
2784	if ( elems.length === 1 && elem.nodeType === 1 ) {
2785		return jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [];
2786	}
2787
2788	return jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) {
2789		return elem.nodeType === 1;
2790	} ) );
2791};
2792
2793jQuery.fn.extend( {
2794	find: function( selector ) {
2795		var i, ret,
2796			len = this.length,
2797			self = this;
2798
2799		if ( typeof selector !== "string" ) {
2800			return this.pushStack( jQuery( selector ).filter( function() {
2801				for ( i = 0; i < len; i++ ) {
2802					if ( jQuery.contains( self[ i ], this ) ) {
2803						return true;
2804					}
2805				}
2806			} ) );
2807		}
2808
2809		ret = this.pushStack( [] );
2810
2811		for ( i = 0; i < len; i++ ) {
2812			jQuery.find( selector, self[ i ], ret );
2813		}
2814
2815		return len > 1 ? jQuery.uniqueSort( ret ) : ret;
2816	},
2817	filter: function( selector ) {
2818		return this.pushStack( winnow( this, selector || [], false ) );
2819	},
2820	not: function( selector ) {
2821		return this.pushStack( winnow( this, selector || [], true ) );
2822	},
2823	is: function( selector ) {
2824		return !!winnow(
2825			this,
2826
2827			// If this is a positional/relative selector, check membership in the returned set
2828			// so $("p:first").is("p:last") won't return true for a doc with two "p".
2829			typeof selector === "string" && rneedsContext.test( selector ) ?
2830				jQuery( selector ) :
2831				selector || [],
2832			false
2833		).length;
2834	}
2835} );
2836
2837
2838// Initialize a jQuery object
2839
2840
2841// A central reference to the root jQuery(document)
2842var rootjQuery,
2843
2844	// A simple way to check for HTML strings
2845	// Prioritize #id over <tag> to avoid XSS via location.hash (trac-9521)
2846	// Strict HTML recognition (trac-11290: must start with <)
2847	// Shortcut simple #id case for speed
2848	rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/,
2849
2850	init = jQuery.fn.init = function( selector, context, root ) {
2851		var match, elem;
2852
2853		// HANDLE: $(""), $(null), $(undefined), $(false)
2854		if ( !selector ) {
2855			return this;
2856		}
2857
2858		// Method init() accepts an alternate rootjQuery
2859		// so migrate can support jQuery.sub (gh-2101)
2860		root = root || rootjQuery;
2861
2862		// Handle HTML strings
2863		if ( typeof selector === "string" ) {
2864			if ( selector[ 0 ] === "<" &&
2865				selector[ selector.length - 1 ] === ">" &&
2866				selector.length >= 3 ) {
2867
2868				// Assume that strings that start and end with <> are HTML and skip the regex check
2869				match = [ null, selector, null ];
2870
2871			} else {
2872				match = rquickExpr.exec( selector );
2873			}
2874
2875			// Match html or make sure no context is specified for #id
2876			if ( match && ( match[ 1 ] || !context ) ) {
2877
2878				// HANDLE: $(html) -> $(array)
2879				if ( match[ 1 ] ) {
2880					context = context instanceof jQuery ? context[ 0 ] : context;
2881
2882					// Option to run scripts is true for back-compat
2883					// Intentionally let the error be thrown if parseHTML is not present
2884					jQuery.merge( this, jQuery.parseHTML(
2885						match[ 1 ],
2886						context && context.nodeType ? context.ownerDocument || context : document,
2887						true
2888					) );
2889
2890					// HANDLE: $(html, props)
2891					if ( rsingleTag.test( match[ 1 ] ) && jQuery.isPlainObject( context ) ) {
2892						for ( match in context ) {
2893
2894							// Properties of context are called as methods if possible
2895							if ( isFunction( this[ match ] ) ) {
2896								this[ match ]( context[ match ] );
2897
2898							// ...and otherwise set as attributes
2899							} else {
2900								this.attr( match, context[ match ] );
2901							}
2902						}
2903					}
2904
2905					return this;
2906
2907				// HANDLE: $(#id)
2908				} else {
2909					elem = document.getElementById( match[ 2 ] );
2910
2911					if ( elem ) {
2912
2913						// Inject the element directly into the jQuery object
2914						this[ 0 ] = elem;
2915						this.length = 1;
2916					}
2917					return this;
2918				}
2919
2920			// HANDLE: $(expr, $(...))
2921			} else if ( !context || context.jquery ) {
2922				return ( context || root ).find( selector );
2923
2924			// HANDLE: $(expr, context)
2925			// (which is just equivalent to: $(context).find(expr)
2926			} else {
2927				return this.constructor( context ).find( selector );
2928			}
2929
2930		// HANDLE: $(DOMElement)
2931		} else if ( selector.nodeType ) {
2932			this[ 0 ] = selector;
2933			this.length = 1;
2934			return this;
2935
2936		// HANDLE: $(function)
2937		// Shortcut for document ready
2938		} else if ( isFunction( selector ) ) {
2939			return root.ready !== undefined ?
2940				root.ready( selector ) :
2941
2942				// Execute immediately if ready is not present
2943				selector( jQuery );
2944		}
2945
2946		return jQuery.makeArray( selector, this );
2947	};
2948
2949// Give the init function the jQuery prototype for later instantiation
2950init.prototype = jQuery.fn;
2951
2952// Initialize central reference
2953rootjQuery = jQuery( document );
2954
2955
2956var rparentsprev = /^(?:parents|prev(?:Until|All))/,
2957
2958	// Methods guaranteed to produce a unique set when starting from a unique set
2959	guaranteedUnique = {
2960		children: true,
2961		contents: true,
2962		next: true,
2963		prev: true
2964	};
2965
2966jQuery.fn.extend( {
2967	has: function( target ) {
2968		var targets = jQuery( target, this ),
2969			l = targets.length;
2970
2971		return this.filter( function() {
2972			var i = 0;
2973			for ( ; i < l; i++ ) {
2974				if ( jQuery.contains( this, targets[ i ] ) ) {
2975					return true;
2976				}
2977			}
2978		} );
2979	},
2980
2981	closest: function( selectors, context ) {
2982		var cur,
2983			i = 0,
2984			l = this.length,
2985			matched = [],
2986			targets = typeof selectors !== "string" && jQuery( selectors );
2987
2988		// Positional selectors never match, since there's no _selection_ context
2989		if ( !rneedsContext.test( selectors ) ) {
2990			for ( ; i < l; i++ ) {
2991				for ( cur = this[ i ]; cur && cur !== context; cur = cur.parentNode ) {
2992
2993					// Always skip document fragments
2994					if ( cur.nodeType < 11 && ( targets ?
2995						targets.index( cur ) > -1 :
2996
2997						// Don't pass non-elements to jQuery#find
2998						cur.nodeType === 1 &&
2999							jQuery.find.matchesSelector( cur, selectors ) ) ) {
3000
3001						matched.push( cur );
3002						break;
3003					}
3004				}
3005			}
3006		}
3007
3008		return this.pushStack( matched.length > 1 ? jQuery.uniqueSort( matched ) : matched );
3009	},
3010
3011	// Determine the position of an element within the set
3012	index: function( elem ) {
3013
3014		// No argument, return index in parent
3015		if ( !elem ) {
3016			return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1;
3017		}
3018
3019		// Index in selector
3020		if ( typeof elem === "string" ) {
3021			return indexOf.call( jQuery( elem ), this[ 0 ] );
3022		}
3023
3024		// Locate the position of the desired element
3025		return indexOf.call( this,
3026
3027			// If it receives a jQuery object, the first element is used
3028			elem.jquery ? elem[ 0 ] : elem
3029		);
3030	},
3031
3032	add: function( selector, context ) {
3033		return this.pushStack(
3034			jQuery.uniqueSort(
3035				jQuery.merge( this.get(), jQuery( selector, context ) )
3036			)
3037		);
3038	},
3039
3040	addBack: function( selector ) {
3041		return this.add( selector == null ?
3042			this.prevObject : this.prevObject.filter( selector )
3043		);
3044	}
3045} );
3046
3047function sibling( cur, dir ) {
3048	while ( ( cur = cur[ dir ] ) && cur.nodeType !== 1 ) {}
3049	return cur;
3050}
3051
3052jQuery.each( {
3053	parent: function( elem ) {
3054		var parent = elem.parentNode;
3055		return parent && parent.nodeType !== 11 ? parent : null;
3056	},
3057	parents: function( elem ) {
3058		return dir( elem, "parentNode" );
3059	},
3060	parentsUntil: function( elem, _i, until ) {
3061		return dir( elem, "parentNode", until );
3062	},
3063	next: function( elem ) {
3064		return sibling( elem, "nextSibling" );
3065	},
3066	prev: function( elem ) {
3067		return sibling( elem, "previousSibling" );
3068	},
3069	nextAll: function( elem ) {
3070		return dir( elem, "nextSibling" );
3071	},
3072	prevAll: function( elem ) {
3073		return dir( elem, "previousSibling" );
3074	},
3075	nextUntil: function( elem, _i, until ) {
3076		return dir( elem, "nextSibling", until );
3077	},
3078	prevUntil: function( elem, _i, until ) {
3079		return dir( elem, "previousSibling", until );
3080	},
3081	siblings: function( elem ) {
3082		return siblings( ( elem.parentNode || {} ).firstChild, elem );
3083	},
3084	children: function( elem ) {
3085		return siblings( elem.firstChild );
3086	},
3087	contents: function( elem ) {
3088		if ( elem.contentDocument != null &&
3089
3090			// Support: IE 11+
3091			// <object> elements with no `data` attribute has an object
3092			// `contentDocument` with a `null` prototype.
3093			getProto( elem.contentDocument ) ) {
3094
3095			return elem.contentDocument;
3096		}
3097
3098		// Support: IE 9 - 11 only, iOS 7 only, Android Browser <=4.3 only
3099		// Treat the template element as a regular one in browsers that
3100		// don't support it.
3101		if ( nodeName( elem, "template" ) ) {
3102			elem = elem.content || elem;
3103		}
3104
3105		return jQuery.merge( [], elem.childNodes );
3106	}
3107}, function( name, fn ) {
3108	jQuery.fn[ name ] = function( until, selector ) {
3109		var matched = jQuery.map( this, fn, until );
3110
3111		if ( name.slice( -5 ) !== "Until" ) {
3112			selector = until;
3113		}
3114
3115		if ( selector && typeof selector === "string" ) {
3116			matched = jQuery.filter( selector, matched );
3117		}
3118
3119		if ( this.length > 1 ) {
3120
3121			// Remove duplicates
3122			if ( !guaranteedUnique[ name ] ) {
3123				jQuery.uniqueSort( matched );
3124			}
3125
3126			// Reverse order for parents* and prev-derivatives
3127			if ( rparentsprev.test( name ) ) {
3128				matched.reverse();
3129			}
3130		}
3131
3132		return this.pushStack( matched );
3133	};
3134} );
3135var rnothtmlwhite = ( /[^\x20\t\r\n\f]+/g );
3136
3137
3138
3139// Convert String-formatted options into Object-formatted ones
3140function createOptions( options ) {
3141	var object = {};
3142	jQuery.each( options.match( rnothtmlwhite ) || [], function( _, flag ) {
3143		object[ flag ] = true;
3144	} );
3145	return object;
3146}
3147
3148/*
3149 * Create a callback list using the following parameters:
3150 *
3151 *	options: an optional list of space-separated options that will change how
3152 *			the callback list behaves or a more traditional option object
3153 *
3154 * By default a callback list will act like an event callback list and can be
3155 * "fired" multiple times.
3156 *
3157 * Possible options:
3158 *
3159 *	once:			will ensure the callback list can only be fired once (like a Deferred)
3160 *
3161 *	memory:			will keep track of previous values and will call any callback added
3162 *					after the list has been fired right away with the latest "memorized"
3163 *					values (like a Deferred)
3164 *
3165 *	unique:			will ensure a callback can only be added once (no duplicate in the list)
3166 *
3167 *	stopOnFalse:	interrupt callings when a callback returns false
3168 *
3169 */
3170jQuery.Callbacks = function( options ) {
3171
3172	// Convert options from String-formatted to Object-formatted if needed
3173	// (we check in cache first)
3174	options = typeof options === "string" ?
3175		createOptions( options ) :
3176		jQuery.extend( {}, options );
3177
3178	var // Flag to know if list is currently firing
3179		firing,
3180
3181		// Last fire value for non-forgettable lists
3182		memory,
3183
3184		// Flag to know if list was already fired
3185		fired,
3186
3187		// Flag to prevent firing
3188		locked,
3189
3190		// Actual callback list
3191		list = [],
3192
3193		// Queue of execution data for repeatable lists
3194		queue = [],
3195
3196		// Index of currently firing callback (modified by add/remove as needed)
3197		firingIndex = -1,
3198
3199		// Fire callbacks
3200		fire = function() {
3201
3202			// Enforce single-firing
3203			locked = locked || options.once;
3204
3205			// Execute callbacks for all pending executions,
3206			// respecting firingIndex overrides and runtime changes
3207			fired = firing = true;
3208			for ( ; queue.length; firingIndex = -1 ) {
3209				memory = queue.shift();
3210				while ( ++firingIndex < list.length ) {
3211
3212					// Run callback and check for early termination
3213					if ( list[ firingIndex ].apply( memory[ 0 ], memory[ 1 ] ) === false &&
3214						options.stopOnFalse ) {
3215
3216						// Jump to end and forget the data so .add doesn't re-fire
3217						firingIndex = list.length;
3218						memory = false;
vendor: 4,918 bytes, lines 3219-3428
3219					}
3220				}
3221			}
3222
3223			// Forget the data if we're done with it
3224			if ( !options.memory ) {
3225				memory = false;
3226			}
3227
3228			firing = false;
3229
3230			// Clean up if we're done firing for good
3231			if ( locked ) {
3232
3233				// Keep an empty list if we have data for future add calls
3234				if ( memory ) {
3235					list = [];
3236
3237				// Otherwise, this object is spent
3238				} else {
3239					list = "";
3240				}
3241			}
3242		},
3243
3244		// Actual Callbacks object
3245		self = {
3246
3247			// Add a callback or a collection of callbacks to the list
3248			add: function() {
3249				if ( list ) {
3250
3251					// If we have memory from a past run, we should fire after adding
3252					if ( memory && !firing ) {
3253						firingIndex = list.length - 1;
3254						queue.push( memory );
3255					}
3256
3257					( function add( args ) {
3258						jQuery.each( args, function( _, arg ) {
3259							if ( isFunction( arg ) ) {
3260								if ( !options.unique || !self.has( arg ) ) {
3261									list.push( arg );
3262								}
3263							} else if ( arg && arg.length && toType( arg ) !== "string" ) {
3264
3265								// Inspect recursively
3266								add( arg );
3267							}
3268						} );
3269					} )( arguments );
3270
3271					if ( memory && !firing ) {
3272						fire();
3273					}
3274				}
3275				return this;
3276			},
3277
3278			// Remove a callback from the list
3279			remove: function() {
3280				jQuery.each( arguments, function( _, arg ) {
3281					var index;
3282					while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) {
3283						list.splice( index, 1 );
3284
3285						// Handle firing indexes
3286						if ( index <= firingIndex ) {
3287							firingIndex--;
3288						}
3289					}
3290				} );
3291				return this;
3292			},
3293
3294			// Check if a given callback is in the list.
3295			// If no argument is given, return whether or not list has callbacks attached.
3296			has: function( fn ) {
3297				return fn ?
3298					jQuery.inArray( fn, list ) > -1 :
3299					list.length > 0;
3300			},
3301
3302			// Remove all callbacks from the list
3303			empty: function() {
3304				if ( list ) {
3305					list = [];
3306				}
3307				return this;
3308			},
3309
3310			// Disable .fire and .add
3311			// Abort any current/pending executions
3312			// Clear all callbacks and values
3313			disable: function() {
3314				locked = queue = [];
3315				list = memory = "";
3316				return this;
3317			},
3318			disabled: function() {
3319				return !list;
3320			},
3321
3322			// Disable .fire
3323			// Also disable .add unless we have memory (since it would have no effect)
3324			// Abort any pending executions
3325			lock: function() {
3326				locked = queue = [];
3327				if ( !memory && !firing ) {
3328					list = memory = "";
3329				}
3330				return this;
3331			},
3332			locked: function() {
3333				return !!locked;
3334			},
3335
3336			// Call all callbacks with the given context and arguments
3337			fireWith: function( context, args ) {
3338				if ( !locked ) {
3339					args = args || [];
3340					args = [ context, args.slice ? args.slice() : args ];
3341					queue.push( args );
3342					if ( !firing ) {
3343						fire();
3344					}
3345				}
3346				return this;
3347			},
3348
3349			// Call all the callbacks with the given arguments
3350			fire: function() {
3351				self.fireWith( this, arguments );
3352				return this;
3353			},
3354
3355			// To know if the callbacks have already been called at least once
3356			fired: function() {
3357				return !!fired;
3358			}
3359		};
3360
3361	return self;
3362};
3363
3364
3365function Identity( v ) {
3366	return v;
3367}
3368function Thrower( ex ) {
3369	throw ex;
3370}
3371
3372function adoptValue( value, resolve, reject, noValue ) {
3373	var method;
3374
3375	try {
3376
3377		// Check for promise aspect first to privilege synchronous behavior
3378		if ( value && isFunction( ( method = value.promise ) ) ) {
3379			method.call( value ).done( resolve ).fail( reject );
3380
3381		// Other thenables
3382		} else if ( value && isFunction( ( method = value.then ) ) ) {
3383			method.call( value, resolve, reject );
3384
3385		// Other non-thenables
3386		} else {
3387
3388			// Control `resolve` arguments by letting Array#slice cast boolean `noValue` to integer:
3389			// * false: [ value ].slice( 0 ) => resolve( value )
3390			// * true: [ value ].slice( 1 ) => resolve()
3391			resolve.apply( undefined, [ value ].slice( noValue ) );
3392		}
3393
3394	// For Promises/A+, convert exceptions into rejections
3395	// Since jQuery.when doesn't unwrap thenables, we can skip the extra checks appearing in
3396	// Deferred#then to conditionally suppress rejection.
3397	} catch ( value ) {
3398
3399		// Support: Android 4.0 only
3400		// Strict mode functions invoked without .call/.apply get global-object context
3401		reject.apply( undefined, [ value ] );
3402	}
3403}
3404
3405jQuery.extend( {
3406
3407	Deferred: function( func ) {
3408		var tuples = [
3409
3410				// action, add listener, callbacks,
3411				// ... .then handlers, argument index, [final state]
3412				[ "notify", "progress", jQuery.Callbacks( "memory" ),
3413					jQuery.Callbacks( "memory" ), 2 ],
3414				[ "resolve", "done", jQuery.Callbacks( "once memory" ),
3415					jQuery.Callbacks( "once memory" ), 0, "resolved" ],
3416				[ "reject", "fail", jQuery.Callbacks( "once memory" ),
3417					jQuery.Callbacks( "once memory" ), 1, "rejected" ]
3418			],
3419			state = "pending",
3420			promise = {
3421				state: function() {
3422					return state;
3423				},
3424				always: function() {
3425					deferred.done( arguments ).fail( arguments );
3426					return this;
3427				},
3428				"catch": function( fn ) {
vendor: 28,472 bytes, lines 3429-4540
3429					return promise.then( null, fn );
3430				},
3431
3432				// Keep pipe for back-compat
3433				pipe: function( /* fnDone, fnFail, fnProgress */ ) {
3434					var fns = arguments;
3435
3436					return jQuery.Deferred( function( newDefer ) {
3437						jQuery.each( tuples, function( _i, tuple ) {
3438
3439							// Map tuples (progress, done, fail) to arguments (done, fail, progress)
3440							var fn = isFunction( fns[ tuple[ 4 ] ] ) && fns[ tuple[ 4 ] ];
3441
3442							// deferred.progress(function() { bind to newDefer or newDefer.notify })
3443							// deferred.done(function() { bind to newDefer or newDefer.resolve })
3444							// deferred.fail(function() { bind to newDefer or newDefer.reject })
3445							deferred[ tuple[ 1 ] ]( function() {
3446								var returned = fn && fn.apply( this, arguments );
3447								if ( returned && isFunction( returned.promise ) ) {
3448									returned.promise()
3449										.progress( newDefer.notify )
3450										.done( newDefer.resolve )
3451										.fail( newDefer.reject );
3452								} else {
3453									newDefer[ tuple[ 0 ] + "With" ](
3454										this,
3455										fn ? [ returned ] : arguments
3456									);
3457								}
3458							} );
3459						} );
3460						fns = null;
3461					} ).promise();
3462				},
3463				then: function( onFulfilled, onRejected, onProgress ) {
3464					var maxDepth = 0;
3465					function resolve( depth, deferred, handler, special ) {
3466						return function() {
3467							var that = this,
3468								args = arguments,
3469								mightThrow = function() {
3470									var returned, then;
3471
3472									// Support: Promises/A+ section 2.3.3.3.3
3473									// https://promisesaplus.com/#point-59
3474									// Ignore double-resolution attempts
3475									if ( depth < maxDepth ) {
3476										return;
3477									}
3478
3479									returned = handler.apply( that, args );
3480
3481									// Support: Promises/A+ section 2.3.1
3482									// https://promisesaplus.com/#point-48
3483									if ( returned === deferred.promise() ) {
3484										throw new TypeError( "Thenable self-resolution" );
3485									}
3486
3487									// Support: Promises/A+ sections 2.3.3.1, 3.5
3488									// https://promisesaplus.com/#point-54
3489									// https://promisesaplus.com/#point-75
3490									// Retrieve `then` only once
3491									then = returned &&
3492
3493										// Support: Promises/A+ section 2.3.4
3494										// https://promisesaplus.com/#point-64
3495										// Only check objects and functions for thenability
3496										( typeof returned === "object" ||
3497											typeof returned === "function" ) &&
3498										returned.then;
3499
3500									// Handle a returned thenable
3501									if ( isFunction( then ) ) {
3502
3503										// Special processors (notify) just wait for resolution
3504										if ( special ) {
3505											then.call(
3506												returned,
3507												resolve( maxDepth, deferred, Identity, special ),
3508												resolve( maxDepth, deferred, Thrower, special )
3509											);
3510
3511										// Normal processors (resolve) also hook into progress
3512										} else {
3513
3514											// ...and disregard older resolution values
3515											maxDepth++;
3516
3517											then.call(
3518												returned,
3519												resolve( maxDepth, deferred, Identity, special ),
3520												resolve( maxDepth, deferred, Thrower, special ),
3521												resolve( maxDepth, deferred, Identity,
3522													deferred.notifyWith )
3523											);
3524										}
3525
3526									// Handle all other returned values
3527									} else {
3528
3529										// Only substitute handlers pass on context
3530										// and multiple values (non-spec behavior)
3531										if ( handler !== Identity ) {
3532											that = undefined;
3533											args = [ returned ];
3534										}
3535
3536										// Process the value(s)
3537										// Default process is resolve
3538										( special || deferred.resolveWith )( that, args );
3539									}
3540								},
3541
3542								// Only normal processors (resolve) catch and reject exceptions
3543								process = special ?
3544									mightThrow :
3545									function() {
3546										try {
3547											mightThrow();
3548										} catch ( e ) {
3549
3550											if ( jQuery.Deferred.exceptionHook ) {
3551												jQuery.Deferred.exceptionHook( e,
3552													process.error );
3553											}
3554
3555											// Support: Promises/A+ section 2.3.3.3.4.1
3556											// https://promisesaplus.com/#point-61
3557											// Ignore post-resolution exceptions
3558											if ( depth + 1 >= maxDepth ) {
3559
3560												// Only substitute handlers pass on context
3561												// and multiple values (non-spec behavior)
3562												if ( handler !== Thrower ) {
3563													that = undefined;
3564													args = [ e ];
3565												}
3566
3567												deferred.rejectWith( that, args );
3568											}
3569										}
3570									};
3571
3572							// Support: Promises/A+ section 2.3.3.3.1
3573							// https://promisesaplus.com/#point-57
3574							// Re-resolve promises immediately to dodge false rejection from
3575							// subsequent errors
3576							if ( depth ) {
3577								process();
3578							} else {
3579
3580								// Call an optional hook to record the error, in case of exception
3581								// since it's otherwise lost when execution goes async
3582								if ( jQuery.Deferred.getErrorHook ) {
3583									process.error = jQuery.Deferred.getErrorHook();
3584
3585								// The deprecated alias of the above. While the name suggests
3586								// returning the stack, not an error instance, jQuery just passes
3587								// it directly to `console.warn` so both will work; an instance
3588								// just better cooperates with source maps.
3589								} else if ( jQuery.Deferred.getStackHook ) {
3590									process.error = jQuery.Deferred.getStackHook();
3591								}
3592								window.setTimeout( process );
3593							}
3594						};
3595					}
3596
3597					return jQuery.Deferred( function( newDefer ) {
3598
3599						// progress_handlers.add( ... )
3600						tuples[ 0 ][ 3 ].add(
3601							resolve(
3602								0,
3603								newDefer,
3604								isFunction( onProgress ) ?
3605									onProgress :
3606									Identity,
3607								newDefer.notifyWith
3608							)
3609						);
3610
3611						// fulfilled_handlers.add( ... )
3612						tuples[ 1 ][ 3 ].add(
3613							resolve(
3614								0,
3615								newDefer,
3616								isFunction( onFulfilled ) ?
3617									onFulfilled :
3618									Identity
3619							)
3620						);
3621
3622						// rejected_handlers.add( ... )
3623						tuples[ 2 ][ 3 ].add(
3624							resolve(
3625								0,
3626								newDefer,
3627								isFunction( onRejected ) ?
3628									onRejected :
3629									Thrower
3630							)
3631						);
3632					} ).promise();
3633				},
3634
3635				// Get a promise for this deferred
3636				// If obj is provided, the promise aspect is added to the object
3637				promise: function( obj ) {
3638					return obj != null ? jQuery.extend( obj, promise ) : promise;
3639				}
3640			},
3641			deferred = {};
3642
3643		// Add list-specific methods
3644		jQuery.each( tuples, function( i, tuple ) {
3645			var list = tuple[ 2 ],
3646				stateString = tuple[ 5 ];
3647
3648			// promise.progress = list.add
3649			// promise.done = list.add
3650			// promise.fail = list.add
3651			promise[ tuple[ 1 ] ] = list.add;
3652
3653			// Handle state
3654			if ( stateString ) {
3655				list.add(
3656					function() {
3657
3658						// state = "resolved" (i.e., fulfilled)
3659						// state = "rejected"
3660						state = stateString;
3661					},
3662
3663					// rejected_callbacks.disable
3664					// fulfilled_callbacks.disable
3665					tuples[ 3 - i ][ 2 ].disable,
3666
3667					// rejected_handlers.disable
3668					// fulfilled_handlers.disable
3669					tuples[ 3 - i ][ 3 ].disable,
3670
3671					// progress_callbacks.lock
3672					tuples[ 0 ][ 2 ].lock,
3673
3674					// progress_handlers.lock
3675					tuples[ 0 ][ 3 ].lock
3676				);
3677			}
3678
3679			// progress_handlers.fire
3680			// fulfilled_handlers.fire
3681			// rejected_handlers.fire
3682			list.add( tuple[ 3 ].fire );
3683
3684			// deferred.notify = function() { deferred.notifyWith(...) }
3685			// deferred.resolve = function() { deferred.resolveWith(...) }
3686			// deferred.reject = function() { deferred.rejectWith(...) }
3687			deferred[ tuple[ 0 ] ] = function() {
3688				deferred[ tuple[ 0 ] + "With" ]( this === deferred ? undefined : this, arguments );
3689				return this;
3690			};
3691
3692			// deferred.notifyWith = list.fireWith
3693			// deferred.resolveWith = list.fireWith
3694			// deferred.rejectWith = list.fireWith
3695			deferred[ tuple[ 0 ] + "With" ] = list.fireWith;
3696		} );
3697
3698		// Make the deferred a promise
3699		promise.promise( deferred );
3700
3701		// Call given func if any
3702		if ( func ) {
3703			func.call( deferred, deferred );
3704		}
3705
3706		// All done!
3707		return deferred;
3708	},
3709
3710	// Deferred helper
3711	when: function( singleValue ) {
3712		var
3713
3714			// count of uncompleted subordinates
3715			remaining = arguments.length,
3716
3717			// count of unprocessed arguments
3718			i = remaining,
3719
3720			// subordinate fulfillment data
3721			resolveContexts = Array( i ),
3722			resolveValues = slice.call( arguments ),
3723
3724			// the primary Deferred
3725			primary = jQuery.Deferred(),
3726
3727			// subordinate callback factory
3728			updateFunc = function( i ) {
3729				return function( value ) {
3730					resolveContexts[ i ] = this;
3731					resolveValues[ i ] = arguments.length > 1 ? slice.call( arguments ) : value;
3732					if ( !( --remaining ) ) {
3733						primary.resolveWith( resolveContexts, resolveValues );
3734					}
3735				};
3736			};
3737
3738		// Single- and empty arguments are adopted like Promise.resolve
3739		if ( remaining <= 1 ) {
3740			adoptValue( singleValue, primary.done( updateFunc( i ) ).resolve, primary.reject,
3741				!remaining );
3742
3743			// Use .then() to unwrap secondary thenables (cf. gh-3000)
3744			if ( primary.state() === "pending" ||
3745				isFunction( resolveValues[ i ] && resolveValues[ i ].then ) ) {
3746
3747				return primary.then();
3748			}
3749		}
3750
3751		// Multiple arguments are aggregated like Promise.all array elements
3752		while ( i-- ) {
3753			adoptValue( resolveValues[ i ], updateFunc( i ), primary.reject );
3754		}
3755
3756		return primary.promise();
3757	}
3758} );
3759
3760
3761// These usually indicate a programmer mistake during development,
3762// warn about them ASAP rather than swallowing them by default.
3763var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;
3764
3765// If `jQuery.Deferred.getErrorHook` is defined, `asyncError` is an error
3766// captured before the async barrier to get the original error cause
3767// which may otherwise be hidden.
3768jQuery.Deferred.exceptionHook = function( error, asyncError ) {
3769
3770	// Support: IE 8 - 9 only
3771	// Console exists when dev tools are open, which can happen at any time
3772	if ( window.console && window.console.warn && error && rerrorNames.test( error.name ) ) {
3773		window.console.warn( "jQuery.Deferred exception: " + error.message,
3774			error.stack, asyncError );
3775	}
3776};
3777
3778
3779
3780
3781jQuery.readyException = function( error ) {
3782	window.setTimeout( function() {
3783		throw error;
3784	} );
3785};
3786
3787
3788
3789
3790// The deferred used on DOM ready
3791var readyList = jQuery.Deferred();
3792
3793jQuery.fn.ready = function( fn ) {
3794
3795	readyList
3796		.then( fn )
3797
3798		// Wrap jQuery.readyException in a function so that the lookup
3799		// happens at the time of error handling instead of callback
3800		// registration.
3801		.catch( function( error ) {
3802			jQuery.readyException( error );
3803		} );
3804
3805	return this;
3806};
3807
3808jQuery.extend( {
3809
3810	// Is the DOM ready to be used? Set to true once it occurs.
3811	isReady: false,
3812
3813	// A counter to track how many items to wait for before
3814	// the ready event fires. See trac-6781
3815	readyWait: 1,
3816
3817	// Handle when the DOM is ready
3818	ready: function( wait ) {
3819
3820		// Abort if there are pending holds or we're already ready
3821		if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) {
3822			return;
3823		}
3824
3825		// Remember that the DOM is ready
3826		jQuery.isReady = true;
3827
3828		// If a normal DOM Ready event fired, decrement, and wait if need be
3829		if ( wait !== true && --jQuery.readyWait > 0 ) {
3830			return;
3831		}
3832
3833		// If there are functions bound, to execute
3834		readyList.resolveWith( document, [ jQuery ] );
3835	}
3836} );
3837
3838jQuery.ready.then = readyList.then;
3839
3840// The ready event handler and self cleanup method
3841function completed() {
3842	document.removeEventListener( "DOMContentLoaded", completed );
3843	window.removeEventListener( "load", completed );
3844	jQuery.ready();
3845}
3846
3847// Catch cases where $(document).ready() is called
3848// after the browser event has already occurred.
3849// Support: IE <=9 - 10 only
3850// Older IE sometimes signals "interactive" too soon
3851if ( document.readyState === "complete" ||
3852	( document.readyState !== "loading" && !document.documentElement.doScroll ) ) {
3853
3854	// Handle it asynchronously to allow scripts the opportunity to delay ready
3855	window.setTimeout( jQuery.ready );
3856
3857} else {
3858
3859	// Use the handy event callback
3860	document.addEventListener( "DOMContentLoaded", completed );
3861
3862	// A fallback to window.onload, that will always work
3863	window.addEventListener( "load", completed );
3864}
3865
3866
3867
3868
3869// Multifunctional method to get and set values of a collection
3870// The value/s can optionally be executed if it's a function
3871var access = function( elems, fn, key, value, chainable, emptyGet, raw ) {
3872	var i = 0,
3873		len = elems.length,
3874		bulk = key == null;
3875
3876	// Sets many values
3877	if ( toType( key ) === "object" ) {
3878		chainable = true;
3879		for ( i in key ) {
3880			access( elems, fn, i, key[ i ], true, emptyGet, raw );
3881		}
3882
3883	// Sets one value
3884	} else if ( value !== undefined ) {
3885		chainable = true;
3886
3887		if ( !isFunction( value ) ) {
3888			raw = true;
3889		}
3890
3891		if ( bulk ) {
3892
3893			// Bulk operations run against the entire set
3894			if ( raw ) {
3895				fn.call( elems, value );
3896				fn = null;
3897
3898			// ...except when executing function values
3899			} else {
3900				bulk = fn;
3901				fn = function( elem, _key, value ) {
3902					return bulk.call( jQuery( elem ), value );
3903				};
3904			}
3905		}
3906
3907		if ( fn ) {
3908			for ( ; i < len; i++ ) {
3909				fn(
3910					elems[ i ], key, raw ?
3911						value :
3912						value.call( elems[ i ], i, fn( elems[ i ], key ) )
3913				);
3914			}
3915		}
3916	}
3917
3918	if ( chainable ) {
3919		return elems;
3920	}
3921
3922	// Gets
3923	if ( bulk ) {
3924		return fn.call( elems );
3925	}
3926
3927	return len ? fn( elems[ 0 ], key ) : emptyGet;
3928};
3929
3930
3931// Matches dashed string for camelizing
3932var rmsPrefix = /^-ms-/,
3933	rdashAlpha = /-([a-z])/g;
3934
3935// Used by camelCase as callback to replace()
3936function fcamelCase( _all, letter ) {
3937	return letter.toUpperCase();
3938}
3939
3940// Convert dashed to camelCase; used by the css and data modules
3941// Support: IE <=9 - 11, Edge 12 - 15
3942// Microsoft forgot to hump their vendor prefix (trac-9572)
3943function camelCase( string ) {
3944	return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
3945}
3946var acceptData = function( owner ) {
3947
3948	// Accepts only:
3949	//  - Node
3950	//    - Node.ELEMENT_NODE
3951	//    - Node.DOCUMENT_NODE
3952	//  - Object
3953	//    - Any
3954	return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType );
3955};
3956
3957
3958
3959
3960function Data() {
3961	this.expando = jQuery.expando + Data.uid++;
3962}
3963
3964Data.uid = 1;
3965
3966Data.prototype = {
3967
3968	cache: function( owner ) {
3969
3970		// Check if the owner object already has a cache
3971		var value = owner[ this.expando ];
3972
3973		// If not, create one
3974		if ( !value ) {
3975			value = {};
3976
3977			// We can accept data for non-element nodes in modern browsers,
3978			// but we should not, see trac-8335.
3979			// Always return an empty object.
3980			if ( acceptData( owner ) ) {
3981
3982				// If it is a node unlikely to be stringify-ed or looped over
3983				// use plain assignment
3984				if ( owner.nodeType ) {
3985					owner[ this.expando ] = value;
3986
3987				// Otherwise secure it in a non-enumerable property
3988				// configurable must be true to allow the property to be
3989				// deleted when data is removed
3990				} else {
3991					Object.defineProperty( owner, this.expando, {
3992						value: value,
3993						configurable: true
3994					} );
3995				}
3996			}
3997		}
3998
3999		return value;
4000	},
4001	set: function( owner, data, value ) {
4002		var prop,
4003			cache = this.cache( owner );
4004
4005		// Handle: [ owner, key, value ] args
4006		// Always use camelCase key (gh-2257)
4007		if ( typeof data === "string" ) {
4008			cache[ camelCase( data ) ] = value;
4009
4010		// Handle: [ owner, { properties } ] args
4011		} else {
4012
4013			// Copy the properties one-by-one to the cache object
4014			for ( prop in data ) {
4015				cache[ camelCase( prop ) ] = data[ prop ];
4016			}
4017		}
4018		return cache;
4019	},
4020	get: function( owner, key ) {
4021		return key === undefined ?
4022			this.cache( owner ) :
4023
4024			// Always use camelCase key (gh-2257)
4025			owner[ this.expando ] && owner[ this.expando ][ camelCase( key ) ];
4026	},
4027	access: function( owner, key, value ) {
4028
4029		// In cases where either:
4030		//
4031		//   1. No key was specified
4032		//   2. A string key was specified, but no value provided
4033		//
4034		// Take the "read" path and allow the get method to determine
4035		// which value to return, respectively either:
4036		//
4037		//   1. The entire cache object
4038		//   2. The data stored at the key
4039		//
4040		if ( key === undefined ||
4041				( ( key && typeof key === "string" ) && value === undefined ) ) {
4042
4043			return this.get( owner, key );
4044		}
4045
4046		// When the key is not a string, or both a key and value
4047		// are specified, set or extend (existing objects) with either:
4048		//
4049		//   1. An object of properties
4050		//   2. A key and value
4051		//
4052		this.set( owner, key, value );
4053
4054		// Since the "set" path can have two possible entry points
4055		// return the expected data based on which path was taken[*]
4056		return value !== undefined ? value : key;
4057	},
4058	remove: function( owner, key ) {
4059		var i,
4060			cache = owner[ this.expando ];
4061
4062		if ( cache === undefined ) {
4063			return;
4064		}
4065
4066		if ( key !== undefined ) {
4067
4068			// Support array or space separated string of keys
4069			if ( Array.isArray( key ) ) {
4070
4071				// If key is an array of keys...
4072				// We always set camelCase keys, so remove that.
4073				key = key.map( camelCase );
4074			} else {
4075				key = camelCase( key );
4076
4077				// If a key with the spaces exists, use it.
4078				// Otherwise, create an array by matching non-whitespace
4079				key = key in cache ?
4080					[ key ] :
4081					( key.match( rnothtmlwhite ) || [] );
4082			}
4083
4084			i = key.length;
4085
4086			while ( i-- ) {
4087				delete cache[ key[ i ] ];
4088			}
4089		}
4090
4091		// Remove the expando if there's no more data
4092		if ( key === undefined || jQuery.isEmptyObject( cache ) ) {
4093
4094			// Support: Chrome <=35 - 45
4095			// Webkit & Blink performance suffers when deleting properties
4096			// from DOM nodes, so set to undefined instead
4097			// https://bugs.chromium.org/p/chromium/issues/detail?id=378607 (bug restricted)
4098			if ( owner.nodeType ) {
4099				owner[ this.expando ] = undefined;
4100			} else {
4101				delete owner[ this.expando ];
4102			}
4103		}
4104	},
4105	hasData: function( owner ) {
4106		var cache = owner[ this.expando ];
4107		return cache !== undefined && !jQuery.isEmptyObject( cache );
4108	}
4109};
4110var dataPriv = new Data();
4111
4112var dataUser = new Data();
4113
4114
4115
4116//	Implementation Summary
4117//
4118//	1. Enforce API surface and semantic compatibility with 1.9.x branch
4119//	2. Improve the module's maintainability by reducing the storage
4120//		paths to a single mechanism.
4121//	3. Use the same single mechanism to support "private" and "user" data.
4122//	4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData)
4123//	5. Avoid exposing implementation details on user objects (eg. expando properties)
4124//	6. Provide a clear path for implementation upgrade to WeakMap in 2014
4125
4126var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,
4127	rmultiDash = /[A-Z]/g;
4128
4129function getData( data ) {
4130	if ( data === "true" ) {
4131		return true;
4132	}
4133
4134	if ( data === "false" ) {
4135		return false;
4136	}
4137
4138	if ( data === "null" ) {
4139		return null;
4140	}
4141
4142	// Only convert to a number if it doesn't change the string
4143	if ( data === +data + "" ) {
4144		return +data;
4145	}
4146
4147	if ( rbrace.test( data ) ) {
4148		return JSON.parse( data );
4149	}
4150
4151	return data;
4152}
4153
4154function dataAttr( elem, key, data ) {
4155	var name;
4156
4157	// If nothing was found internally, try to fetch any
4158	// data from the HTML5 data-* attribute
4159	if ( data === undefined && elem.nodeType === 1 ) {
4160		name = "data-" + key.replace( rmultiDash, "-$&" ).toLowerCase();
4161		data = elem.getAttribute( name );
4162
4163		if ( typeof data === "string" ) {
4164			try {
4165				data = getData( data );
4166			} catch ( e ) {}
4167
4168			// Make sure we set the data so it isn't changed later
4169			dataUser.set( elem, key, data );
4170		} else {
4171			data = undefined;
4172		}
4173	}
4174	return data;
4175}
4176
4177jQuery.extend( {
4178	hasData: function( elem ) {
4179		return dataUser.hasData( elem ) || dataPriv.hasData( elem );
4180	},
4181
4182	data: function( elem, name, data ) {
4183		return dataUser.access( elem, name, data );
4184	},
4185
4186	removeData: function( elem, name ) {
4187		dataUser.remove( elem, name );
4188	},
4189
4190	// TODO: Now that all calls to _data and _removeData have been replaced
4191	// with direct calls to dataPriv methods, these can be deprecated.
4192	_data: function( elem, name, data ) {
4193		return dataPriv.access( elem, name, data );
4194	},
4195
4196	_removeData: function( elem, name ) {
4197		dataPriv.remove( elem, name );
4198	}
4199} );
4200
4201jQuery.fn.extend( {
4202	data: function( key, value ) {
4203		var i, name, data,
4204			elem = this[ 0 ],
4205			attrs = elem && elem.attributes;
4206
4207		// Gets all values
4208		if ( key === undefined ) {
4209			if ( this.length ) {
4210				data = dataUser.get( elem );
4211
4212				if ( elem.nodeType === 1 && !dataPriv.get( elem, "hasDataAttrs" ) ) {
4213					i = attrs.length;
4214					while ( i-- ) {
4215
4216						// Support: IE 11 only
4217						// The attrs elements can be null (trac-14894)
4218						if ( attrs[ i ] ) {
4219							name = attrs[ i ].name;
4220							if ( name.indexOf( "data-" ) === 0 ) {
4221								name = camelCase( name.slice( 5 ) );
4222								dataAttr( elem, name, data[ name ] );
4223							}
4224						}
4225					}
4226					dataPriv.set( elem, "hasDataAttrs", true );
4227				}
4228			}
4229
4230			return data;
4231		}
4232
4233		// Sets multiple values
4234		if ( typeof key === "object" ) {
4235			return this.each( function() {
4236				dataUser.set( this, key );
4237			} );
4238		}
4239
4240		return access( this, function( value ) {
4241			var data;
4242
4243			// The calling jQuery object (element matches) is not empty
4244			// (and therefore has an element appears at this[ 0 ]) and the
4245			// `value` parameter was not undefined. An empty jQuery object
4246			// will result in `undefined` for elem = this[ 0 ] which will
4247			// throw an exception if an attempt to read a data cache is made.
4248			if ( elem && value === undefined ) {
4249
4250				// Attempt to get data from the cache
4251				// The key will always be camelCased in Data
4252				data = dataUser.get( elem, key );
4253				if ( data !== undefined ) {
4254					return data;
4255				}
4256
4257				// Attempt to "discover" the data in
4258				// HTML5 custom data-* attrs
4259				data = dataAttr( elem, key );
4260				if ( data !== undefined ) {
4261					return data;
4262				}
4263
4264				// We tried really hard, but the data doesn't exist.
4265				return;
4266			}
4267
4268			// Set the data...
4269			this.each( function() {
4270
4271				// We always store the camelCased key
4272				dataUser.set( this, key, value );
4273			} );
4274		}, null, value, arguments.length > 1, null, true );
4275	},
4276
4277	removeData: function( key ) {
4278		return this.each( function() {
4279			dataUser.remove( this, key );
4280		} );
4281	}
4282} );
4283
4284
4285jQuery.extend( {
4286	queue: function( elem, type, data ) {
4287		var queue;
4288
4289		if ( elem ) {
4290			type = ( type || "fx" ) + "queue";
4291			queue = dataPriv.get( elem, type );
4292
4293			// Speed up dequeue by getting out quickly if this is just a lookup
4294			if ( data ) {
4295				if ( !queue || Array.isArray( data ) ) {
4296					queue = dataPriv.access( elem, type, jQuery.makeArray( data ) );
4297				} else {
4298					queue.push( data );
4299				}
4300			}
4301			return queue || [];
4302		}
4303	},
4304
4305	dequeue: function( elem, type ) {
4306		type = type || "fx";
4307
4308		var queue = jQuery.queue( elem, type ),
4309			startLength = queue.length,
4310			fn = queue.shift(),
4311			hooks = jQuery._queueHooks( elem, type ),
4312			next = function() {
4313				jQuery.dequeue( elem, type );
4314			};
4315
4316		// If the fx queue is dequeued, always remove the progress sentinel
4317		if ( fn === "inprogress" ) {
4318			fn = queue.shift();
4319			startLength--;
4320		}
4321
4322		if ( fn ) {
4323
4324			// Add a progress sentinel to prevent the fx queue from being
4325			// automatically dequeued
4326			if ( type === "fx" ) {
4327				queue.unshift( "inprogress" );
4328			}
4329
4330			// Clear up the last queue stop function
4331			delete hooks.stop;
4332			fn.call( elem, next, hooks );
4333		}
4334
4335		if ( !startLength && hooks ) {
4336			hooks.empty.fire();
4337		}
4338	},
4339
4340	// Not public - generate a queueHooks object, or return the current one
4341	_queueHooks: function( elem, type ) {
4342		var key = type + "queueHooks";
4343		return dataPriv.get( elem, key ) || dataPriv.access( elem, key, {
4344			empty: jQuery.Callbacks( "once memory" ).add( function() {
4345				dataPriv.remove( elem, [ type + "queue", key ] );
4346			} )
4347		} );
4348	}
4349} );
4350
4351jQuery.fn.extend( {
4352	queue: function( type, data ) {
4353		var setter = 2;
4354
4355		if ( typeof type !== "string" ) {
4356			data = type;
4357			type = "fx";
4358			setter--;
4359		}
4360
4361		if ( arguments.length < setter ) {
4362			return jQuery.queue( this[ 0 ], type );
4363		}
4364
4365		return data === undefined ?
4366			this :
4367			this.each( function() {
4368				var queue = jQuery.queue( this, type, data );
4369
4370				// Ensure a hooks for this queue
4371				jQuery._queueHooks( this, type );
4372
4373				if ( type === "fx" && queue[ 0 ] !== "inprogress" ) {
4374					jQuery.dequeue( this, type );
4375				}
4376			} );
4377	},
4378	dequeue: function( type ) {
4379		return this.each( function() {
4380			jQuery.dequeue( this, type );
4381		} );
4382	},
4383	clearQueue: function( type ) {
4384		return this.queue( type || "fx", [] );
4385	},
4386
4387	// Get a promise resolved when queues of a certain type
4388	// are emptied (fx is the type by default)
4389	promise: function( type, obj ) {
4390		var tmp,
4391			count = 1,
4392			defer = jQuery.Deferred(),
4393			elements = this,
4394			i = this.length,
4395			resolve = function() {
4396				if ( !( --count ) ) {
4397					defer.resolveWith( elements, [ elements ] );
4398				}
4399			};
4400
4401		if ( typeof type !== "string" ) {
4402			obj = type;
4403			type = undefined;
4404		}
4405		type = type || "fx";
4406
4407		while ( i-- ) {
4408			tmp = dataPriv.get( elements[ i ], type + "queueHooks" );
4409			if ( tmp && tmp.empty ) {
4410				count++;
4411				tmp.empty.add( resolve );
4412			}
4413		}
4414		resolve();
4415		return defer.promise( obj );
4416	}
4417} );
4418var pnum = ( /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/ ).source;
4419
4420var rcssNum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" );
4421
4422
4423var cssExpand = [ "Top", "Right", "Bottom", "Left" ];
4424
4425var documentElement = document.documentElement;
4426
4427
4428
4429	var isAttached = function( elem ) {
4430			return jQuery.contains( elem.ownerDocument, elem );
4431		},
4432		composed = { composed: true };
4433
4434	// Support: IE 9 - 11+, Edge 12 - 18+, iOS 10.0 - 10.2 only
4435	// Check attachment across shadow DOM boundaries when possible (gh-3504)
4436	// Support: iOS 10.0-10.2 only
4437	// Early iOS 10 versions support `attachShadow` but not `getRootNode`,
4438	// leading to errors. We need to check for `getRootNode`.
4439	if ( documentElement.getRootNode ) {
4440		isAttached = function( elem ) {
4441			return jQuery.contains( elem.ownerDocument, elem ) ||
4442				elem.getRootNode( composed ) === elem.ownerDocument;
4443		};
4444	}
4445var isHiddenWithinTree = function( elem, el ) {
4446
4447		// isHiddenWithinTree might be called from jQuery#filter function;
4448		// in that case, element will be second argument
4449		elem = el || elem;
4450
4451		// Inline style trumps all
4452		return elem.style.display === "none" ||
4453			elem.style.display === "" &&
4454
4455			// Otherwise, check computed style
4456			// Support: Firefox <=43 - 45
4457			// Disconnected elements can have computed display: none, so first confirm that elem is
4458			// in the document.
4459			isAttached( elem ) &&
4460
4461			jQuery.css( elem, "display" ) === "none";
4462	};
4463
4464
4465
4466function adjustCSS( elem, prop, valueParts, tween ) {
4467	var adjusted, scale,
4468		maxIterations = 20,
4469		currentValue = tween ?
4470			function() {
4471				return tween.cur();
4472			} :
4473			function() {
4474				return jQuery.css( elem, prop, "" );
4475			},
4476		initial = currentValue(),
4477		unit = valueParts && valueParts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ),
4478
4479		// Starting value computation is required for potential unit mismatches
4480		initialInUnit = elem.nodeType &&
4481			( jQuery.cssNumber[ prop ] || unit !== "px" && +initial ) &&
4482			rcssNum.exec( jQuery.css( elem, prop ) );
4483
4484	if ( initialInUnit && initialInUnit[ 3 ] !== unit ) {
4485
4486		// Support: Firefox <=54
4487		// Halve the iteration target value to prevent interference from CSS upper bounds (gh-2144)
4488		initial = initial / 2;
4489
4490		// Trust units reported by jQuery.css
4491		unit = unit || initialInUnit[ 3 ];
4492
4493		// Iteratively approximate from a nonzero starting point
4494		initialInUnit = +initial || 1;
4495
4496		while ( maxIterations-- ) {
4497
4498			// Evaluate and update our best guess (doubling guesses that zero out).
4499			// Finish if the scale equals or crosses 1 (making the old*new product non-positive).
4500			jQuery.style( elem, prop, initialInUnit + unit );
4501			if ( ( 1 - scale ) * ( 1 - ( scale = currentValue() / initial || 0.5 ) ) <= 0 ) {
4502				maxIterations = 0;
4503			}
4504			initialInUnit = initialInUnit / scale;
4505
4506		}
4507
4508		initialInUnit = initialInUnit * 2;
4509		jQuery.style( elem, prop, initialInUnit + unit );
4510
4511		// Make sure we update the tween properties later on
4512		valueParts = valueParts || [];
4513	}
4514
4515	if ( valueParts ) {
4516		initialInUnit = +initialInUnit || +initial || 0;
4517
4518		// Apply relative offset (+=/-=) if specified
4519		adjusted = valueParts[ 1 ] ?
4520			initialInUnit + ( valueParts[ 1 ] + 1 ) * valueParts[ 2 ] :
4521			+valueParts[ 2 ];
4522		if ( tween ) {
4523			tween.unit = unit;
4524			tween.start = initialInUnit;
4525			tween.end = adjusted;
4526		}
4527	}
4528	return adjusted;
4529}
4530
4531
4532var defaultDisplayMap = {};
4533
4534function getDefaultDisplay( elem ) {
4535	var temp,
4536		doc = elem.ownerDocument,
4537		nodeName = elem.nodeName,
4538		display = defaultDisplayMap[ nodeName ];
4539
4540	if ( display ) {
vendor: 2,317 bytes, lines 4541-4639
4541		return display;
4542	}
4543
4544	temp = doc.body.appendChild( doc.createElement( nodeName ) );
4545	display = jQuery.css( temp, "display" );
4546
4547	temp.parentNode.removeChild( temp );
4548
4549	if ( display === "none" ) {
4550		display = "block";
4551	}
4552	defaultDisplayMap[ nodeName ] = display;
4553
4554	return display;
4555}
4556
4557function showHide( elements, show ) {
4558	var display, elem,
4559		values = [],
4560		index = 0,
4561		length = elements.length;
4562
4563	// Determine new display value for elements that need to change
4564	for ( ; index < length; index++ ) {
4565		elem = elements[ index ];
4566		if ( !elem.style ) {
4567			continue;
4568		}
4569
4570		display = elem.style.display;
4571		if ( show ) {
4572
4573			// Since we force visibility upon cascade-hidden elements, an immediate (and slow)
4574			// check is required in this first loop unless we have a nonempty display value (either
4575			// inline or about-to-be-restored)
4576			if ( display === "none" ) {
4577				values[ index ] = dataPriv.get( elem, "display" ) || null;
4578				if ( !values[ index ] ) {
4579					elem.style.display = "";
4580				}
4581			}
4582			if ( elem.style.display === "" && isHiddenWithinTree( elem ) ) {
4583				values[ index ] = getDefaultDisplay( elem );
4584			}
4585		} else {
4586			if ( display !== "none" ) {
4587				values[ index ] = "none";
4588
4589				// Remember what we're overwriting
4590				dataPriv.set( elem, "display", display );
4591			}
4592		}
4593	}
4594
4595	// Set the display of the elements in a second loop to avoid constant reflow
4596	for ( index = 0; index < length; index++ ) {
4597		if ( values[ index ] != null ) {
4598			elements[ index ].style.display = values[ index ];
4599		}
4600	}
4601
4602	return elements;
4603}
4604
4605jQuery.fn.extend( {
4606	show: function() {
4607		return showHide( this, true );
4608	},
4609	hide: function() {
4610		return showHide( this );
4611	},
4612	toggle: function( state ) {
4613		if ( typeof state === "boolean" ) {
4614			return state ? this.show() : this.hide();
4615		}
4616
4617		return this.each( function() {
4618			if ( isHiddenWithinTree( this ) ) {
4619				jQuery( this ).show();
4620			} else {
4621				jQuery( this ).hide();
4622			}
4623		} );
4624	}
4625} );
4626var rcheckableType = ( /^(?:checkbox|radio)$/i );
4627
4628var rtagName = ( /<([a-z][^\/\0>\x20\t\r\n\f]*)/i );
4629
4630var rscriptType = ( /^$|^module$|\/(?:java|ecma)script/i );
4631
4632
4633
4634( function() {
4635	var fragment = document.createDocumentFragment(),
4636		div = fragment.appendChild( document.createElement( "div" ) ),
4637		input = document.createElement( "input" );
4638
4639	// Support: Android 4.0 - 4.3 only
vendor: 10,092 bytes, lines 4640-5024
4640	// Check state lost if the name is set (trac-11217)
4641	// Support: Windows Web Apps (WWA)
4642	// `name` and `type` must use .setAttribute for WWA (trac-14901)
4643	input.setAttribute( "type", "radio" );
4644	input.setAttribute( "checked", "checked" );
4645	input.setAttribute( "name", "t" );
4646
4647	div.appendChild( input );
4648
4649	// Support: Android <=4.1 only
4650	// Older WebKit doesn't clone checked state correctly in fragments
4651	support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked;
4652
4653	// Support: IE <=11 only
4654	// Make sure textarea (and checkbox) defaultValue is properly cloned
4655	div.innerHTML = "<textarea>x</textarea>";
4656	support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue;
4657
4658	// Support: IE <=9 only
4659	// IE <=9 replaces <option> tags with their contents when inserted outside of
4660	// the select element.
4661	div.innerHTML = "<option></option>";
4662	support.option = !!div.lastChild;
4663} )();
4664
4665
4666// We have to close these tags to support XHTML (trac-13200)
4667var wrapMap = {
4668
4669	// XHTML parsers do not magically insert elements in the
4670	// same way that tag soup parsers do. So we cannot shorten
4671	// this by omitting <tbody> or other required elements.
4672	thead: [ 1, "<table>", "</table>" ],
4673	col: [ 2, "<table><colgroup>", "</colgroup></table>" ],
4674	tr: [ 2, "<table><tbody>", "</tbody></table>" ],
4675	td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
4676
4677	_default: [ 0, "", "" ]
4678};
4679
4680wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
4681wrapMap.th = wrapMap.td;
4682
4683// Support: IE <=9 only
4684if ( !support.option ) {
4685	wrapMap.optgroup = wrapMap.option = [ 1, "<select multiple='multiple'>", "</select>" ];
4686}
4687
4688
4689function getAll( context, tag ) {
4690
4691	// Support: IE <=9 - 11 only
4692	// Use typeof to avoid zero-argument method invocation on host objects (trac-15151)
4693	var ret;
4694
4695	if ( typeof context.getElementsByTagName !== "undefined" ) {
4696		ret = context.getElementsByTagName( tag || "*" );
4697
4698	} else if ( typeof context.querySelectorAll !== "undefined" ) {
4699		ret = context.querySelectorAll( tag || "*" );
4700
4701	} else {
4702		ret = [];
4703	}
4704
4705	if ( tag === undefined || tag && nodeName( context, tag ) ) {
4706		return jQuery.merge( [ context ], ret );
4707	}
4708
4709	return ret;
4710}
4711
4712
4713// Mark scripts as having already been evaluated
4714function setGlobalEval( elems, refElements ) {
4715	var i = 0,
4716		l = elems.length;
4717
4718	for ( ; i < l; i++ ) {
4719		dataPriv.set(
4720			elems[ i ],
4721			"globalEval",
4722			!refElements || dataPriv.get( refElements[ i ], "globalEval" )
4723		);
4724	}
4725}
4726
4727
4728var rhtml = /<|&#?\w+;/;
4729
4730function buildFragment( elems, context, scripts, selection, ignored ) {
4731	var elem, tmp, tag, wrap, attached, j,
4732		fragment = context.createDocumentFragment(),
4733		nodes = [],
4734		i = 0,
4735		l = elems.length;
4736
4737	for ( ; i < l; i++ ) {
4738		elem = elems[ i ];
4739
4740		if ( elem || elem === 0 ) {
4741
4742			// Add nodes directly
4743			if ( toType( elem ) === "object" ) {
4744
4745				// Support: Android <=4.0 only, PhantomJS 1 only
4746				// push.apply(_, arraylike) throws on ancient WebKit
4747				jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem );
4748
4749			// Convert non-html into a text node
4750			} else if ( !rhtml.test( elem ) ) {
4751				nodes.push( context.createTextNode( elem ) );
4752
4753			// Convert html into DOM nodes
4754			} else {
4755				tmp = tmp || fragment.appendChild( context.createElement( "div" ) );
4756
4757				// Deserialize a standard representation
4758				tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase();
4759				wrap = wrapMap[ tag ] || wrapMap._default;
4760				tmp.innerHTML = wrap[ 1 ] + jQuery.htmlPrefilter( elem ) + wrap[ 2 ];
4761
4762				// Descend through wrappers to the right content
4763				j = wrap[ 0 ];
4764				while ( j-- ) {
4765					tmp = tmp.lastChild;
4766				}
4767
4768				// Support: Android <=4.0 only, PhantomJS 1 only
4769				// push.apply(_, arraylike) throws on ancient WebKit
4770				jQuery.merge( nodes, tmp.childNodes );
4771
4772				// Remember the top-level container
4773				tmp = fragment.firstChild;
4774
4775				// Ensure the created nodes are orphaned (trac-12392)
4776				tmp.textContent = "";
4777			}
4778		}
4779	}
4780
4781	// Remove wrapper from fragment
4782	fragment.textContent = "";
4783
4784	i = 0;
4785	while ( ( elem = nodes[ i++ ] ) ) {
4786
4787		// Skip elements already in the context collection (trac-4087)
4788		if ( selection && jQuery.inArray( elem, selection ) > -1 ) {
4789			if ( ignored ) {
4790				ignored.push( elem );
4791			}
4792			continue;
4793		}
4794
4795		attached = isAttached( elem );
4796
4797		// Append to fragment
4798		tmp = getAll( fragment.appendChild( elem ), "script" );
4799
4800		// Preserve script evaluation history
4801		if ( attached ) {
4802			setGlobalEval( tmp );
4803		}
4804
4805		// Capture executables
4806		if ( scripts ) {
4807			j = 0;
4808			while ( ( elem = tmp[ j++ ] ) ) {
4809				if ( rscriptType.test( elem.type || "" ) ) {
4810					scripts.push( elem );
4811				}
4812			}
4813		}
4814	}
4815
4816	return fragment;
4817}
4818
4819
4820var rtypenamespace = /^([^.]*)(?:\.(.+)|)/;
4821
4822function returnTrue() {
4823	return true;
4824}
4825
4826function returnFalse() {
4827	return false;
4828}
4829
4830function on( elem, types, selector, data, fn, one ) {
4831	var origFn, type;
4832
4833	// Types can be a map of types/handlers
4834	if ( typeof types === "object" ) {
4835
4836		// ( types-Object, selector, data )
4837		if ( typeof selector !== "string" ) {
4838
4839			// ( types-Object, data )
4840			data = data || selector;
4841			selector = undefined;
4842		}
4843		for ( type in types ) {
4844			on( elem, type, selector, data, types[ type ], one );
4845		}
4846		return elem;
4847	}
4848
4849	if ( data == null && fn == null ) {
4850
4851		// ( types, fn )
4852		fn = selector;
4853		data = selector = undefined;
4854	} else if ( fn == null ) {
4855		if ( typeof selector === "string" ) {
4856
4857			// ( types, selector, fn )
4858			fn = data;
4859			data = undefined;
4860		} else {
4861
4862			// ( types, data, fn )
4863			fn = data;
4864			data = selector;
4865			selector = undefined;
4866		}
4867	}
4868	if ( fn === false ) {
4869		fn = returnFalse;
4870	} else if ( !fn ) {
4871		return elem;
4872	}
4873
4874	if ( one === 1 ) {
4875		origFn = fn;
4876		fn = function( event ) {
4877
4878			// Can use an empty set, since event contains the info
4879			jQuery().off( event );
4880			return origFn.apply( this, arguments );
4881		};
4882
4883		// Use same guid so caller can remove using origFn
4884		fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ );
4885	}
4886	return elem.each( function() {
4887		jQuery.event.add( this, types, fn, data, selector );
4888	} );
4889}
4890
4891/*
4892 * Helper functions for managing events -- not part of the public interface.
4893 * Props to Dean Edwards' addEvent library for many of the ideas.
4894 */
4895jQuery.event = {
4896
4897	global: {},
4898
4899	add: function( elem, types, handler, data, selector ) {
4900
4901		var handleObjIn, eventHandle, tmp,
4902			events, t, handleObj,
4903			special, handlers, type, namespaces, origType,
4904			elemData = dataPriv.get( elem );
4905
4906		// Only attach events to objects that accept data
4907		if ( !acceptData( elem ) ) {
4908			return;
4909		}
4910
4911		// Caller can pass in an object of custom data in lieu of the handler
4912		if ( handler.handler ) {
4913			handleObjIn = handler;
4914			handler = handleObjIn.handler;
4915			selector = handleObjIn.selector;
4916		}
4917
4918		// Ensure that invalid selectors throw exceptions at attach time
4919		// Evaluate against documentElement in case elem is a non-element node (e.g., document)
4920		if ( selector ) {
4921			jQuery.find.matchesSelector( documentElement, selector );
4922		}
4923
4924		// Make sure that the handler has a unique ID, used to find/remove it later
4925		if ( !handler.guid ) {
4926			handler.guid = jQuery.guid++;
4927		}
4928
4929		// Init the element's event structure and main handler, if this is the first
4930		if ( !( events = elemData.events ) ) {
4931			events = elemData.events = Object.create( null );
4932		}
4933		if ( !( eventHandle = elemData.handle ) ) {
4934			eventHandle = elemData.handle = function( e ) {
4935
4936				// Discard the second event of a jQuery.event.trigger() and
4937				// when an event is called after a page has unloaded
4938				return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ?
4939					jQuery.event.dispatch.apply( elem, arguments ) : undefined;
4940			};
4941		}
4942
4943		// Handle multiple events separated by a space
4944		types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
4945		t = types.length;
4946		while ( t-- ) {
4947			tmp = rtypenamespace.exec( types[ t ] ) || [];
4948			type = origType = tmp[ 1 ];
4949			namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
4950
4951			// There *must* be a type, no attaching namespace-only handlers
4952			if ( !type ) {
4953				continue;
4954			}
4955
4956			// If event changes its type, use the special event handlers for the changed type
4957			special = jQuery.event.special[ type ] || {};
4958
4959			// If selector defined, determine special event api type, otherwise given type
4960			type = ( selector ? special.delegateType : special.bindType ) || type;
4961
4962			// Update special based on newly reset type
4963			special = jQuery.event.special[ type ] || {};
4964
4965			// handleObj is passed to all event handlers
4966			handleObj = jQuery.extend( {
4967				type: type,
4968				origType: origType,
4969				data: data,
4970				handler: handler,
4971				guid: handler.guid,
4972				selector: selector,
4973				needsContext: selector && jQuery.expr.match.needsContext.test( selector ),
4974				namespace: namespaces.join( "." )
4975			}, handleObjIn );
4976
4977			// Init the event handler queue if we're the first
4978			if ( !( handlers = events[ type ] ) ) {
4979				handlers = events[ type ] = [];
4980				handlers.delegateCount = 0;
4981
4982				// Only use addEventListener if the special events handler returns false
4983				if ( !special.setup ||
4984					special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
4985
4986					if ( elem.addEventListener ) {
4987						elem.addEventListener( type, eventHandle );
4988					}
4989				}
4990			}
4991
4992			if ( special.add ) {
4993				special.add.call( elem, handleObj );
4994
4995				if ( !handleObj.handler.guid ) {
4996					handleObj.handler.guid = handler.guid;
4997				}
4998			}
4999
5000			// Add to the element's handler list, delegates in front
5001			if ( selector ) {
5002				handlers.splice( handlers.delegateCount++, 0, handleObj );
5003			} else {
5004				handlers.push( handleObj );
5005			}
5006
5007			// Keep track of which events have ever been used, for event optimization
5008			jQuery.event.global[ type ] = true;
5009		}
5010
5011	},
5012
5013	// Detach an event or set of events from an element
5014	remove: function( elem, types, handler, selector, mappedTypes ) {
5015
5016		var j, origCount, tmp,
5017			events, t, handleObj,
5018			special, handlers, type, namespaces, origType,
5019			elemData = dataPriv.hasData( elem ) && dataPriv.get( elem );
5020
5021		if ( !elemData || !( events = elemData.events ) ) {
5022			return;
5023		}
5024
vendor: 4,197 bytes, lines 5025-5163
5025		// Once for each type.namespace in types; type may be omitted
5026		types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
5027		t = types.length;
5028		while ( t-- ) {
5029			tmp = rtypenamespace.exec( types[ t ] ) || [];
5030			type = origType = tmp[ 1 ];
5031			namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
5032
5033			// Unbind all events (on this namespace, if provided) for the element
5034			if ( !type ) {
5035				for ( type in events ) {
5036					jQuery.event.remove( elem, type + types[ t ], handler, selector, true );
5037				}
5038				continue;
5039			}
5040
5041			special = jQuery.event.special[ type ] || {};
5042			type = ( selector ? special.delegateType : special.bindType ) || type;
5043			handlers = events[ type ] || [];
5044			tmp = tmp[ 2 ] &&
5045				new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" );
5046
5047			// Remove matching events
5048			origCount = j = handlers.length;
5049			while ( j-- ) {
5050				handleObj = handlers[ j ];
5051
5052				if ( ( mappedTypes || origType === handleObj.origType ) &&
5053					( !handler || handler.guid === handleObj.guid ) &&
5054					( !tmp || tmp.test( handleObj.namespace ) ) &&
5055					( !selector || selector === handleObj.selector ||
5056						selector === "**" && handleObj.selector ) ) {
5057					handlers.splice( j, 1 );
5058
5059					if ( handleObj.selector ) {
5060						handlers.delegateCount--;
5061					}
5062					if ( special.remove ) {
5063						special.remove.call( elem, handleObj );
5064					}
5065				}
5066			}
5067
5068			// Remove generic event handler if we removed something and no more handlers exist
5069			// (avoids potential for endless recursion during removal of special event handlers)
5070			if ( origCount && !handlers.length ) {
5071				if ( !special.teardown ||
5072					special.teardown.call( elem, namespaces, elemData.handle ) === false ) {
5073
5074					jQuery.removeEvent( elem, type, elemData.handle );
5075				}
5076
5077				delete events[ type ];
5078			}
5079		}
5080
5081		// Remove data and the expando if it's no longer used
5082		if ( jQuery.isEmptyObject( events ) ) {
5083			dataPriv.remove( elem, "handle events" );
5084		}
5085	},
5086
5087	dispatch: function( nativeEvent ) {
5088
5089		var i, j, ret, matched, handleObj, handlerQueue,
5090			args = new Array( arguments.length ),
5091
5092			// Make a writable jQuery.Event from the native event object
5093			event = jQuery.event.fix( nativeEvent ),
5094
5095			handlers = (
5096				dataPriv.get( this, "events" ) || Object.create( null )
5097			)[ event.type ] || [],
5098			special = jQuery.event.special[ event.type ] || {};
5099
5100		// Use the fix-ed jQuery.Event rather than the (read-only) native event
5101		args[ 0 ] = event;
5102
5103		for ( i = 1; i < arguments.length; i++ ) {
5104			args[ i ] = arguments[ i ];
5105		}
5106
5107		event.delegateTarget = this;
5108
5109		// Call the preDispatch hook for the mapped type, and let it bail if desired
5110		if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) {
5111			return;
5112		}
5113
5114		// Determine handlers
5115		handlerQueue = jQuery.event.handlers.call( this, event, handlers );
5116
5117		// Run delegates first; they may want to stop propagation beneath us
5118		i = 0;
5119		while ( ( matched = handlerQueue[ i++ ] ) && !event.isPropagationStopped() ) {
5120			event.currentTarget = matched.elem;
5121
5122			j = 0;
5123			while ( ( handleObj = matched.handlers[ j++ ] ) &&
5124				!event.isImmediatePropagationStopped() ) {
5125
5126				// If the event is namespaced, then each handler is only invoked if it is
5127				// specially universal or its namespaces are a superset of the event's.
5128				if ( !event.rnamespace || handleObj.namespace === false ||
5129					event.rnamespace.test( handleObj.namespace ) ) {
5130
5131					event.handleObj = handleObj;
5132					event.data = handleObj.data;
5133
5134					ret = ( ( jQuery.event.special[ handleObj.origType ] || {} ).handle ||
5135						handleObj.handler ).apply( matched.elem, args );
5136
5137					if ( ret !== undefined ) {
5138						if ( ( event.result = ret ) === false ) {
5139							event.preventDefault();
5140							event.stopPropagation();
5141						}
5142					}
5143				}
5144			}
5145		}
5146
5147		// Call the postDispatch hook for the mapped type
5148		if ( special.postDispatch ) {
5149			special.postDispatch.call( this, event );
5150		}
5151
5152		return event.result;
5153	},
5154
5155	handlers: function( event, handlers ) {
5156		var i, handleObj, sel, matchedHandlers, matchedSelectors,
5157			handlerQueue = [],
5158			delegateCount = handlers.delegateCount,
5159			cur = event.target;
5160
5161		// Find delegate handlers
5162		if ( delegateCount &&
5163
vendor: 25,415 bytes, lines 5164-6040
5164			// Support: IE <=9
5165			// Black-hole SVG <use> instance trees (trac-13180)
5166			cur.nodeType &&
5167
5168			// Support: Firefox <=42
5169			// Suppress spec-violating clicks indicating a non-primary pointer button (trac-3861)
5170			// https://www.w3.org/TR/DOM-Level-3-Events/#event-type-click
5171			// Support: IE 11 only
5172			// ...but not arrow key "clicks" of radio inputs, which can have `button` -1 (gh-2343)
5173			!( event.type === "click" && event.button >= 1 ) ) {
5174
5175			for ( ; cur !== this; cur = cur.parentNode || this ) {
5176
5177				// Don't check non-elements (trac-13208)
5178				// Don't process clicks on disabled elements (trac-6911, trac-8165, trac-11382, trac-11764)
5179				if ( cur.nodeType === 1 && !( event.type === "click" && cur.disabled === true ) ) {
5180					matchedHandlers = [];
5181					matchedSelectors = {};
5182					for ( i = 0; i < delegateCount; i++ ) {
5183						handleObj = handlers[ i ];
5184
5185						// Don't conflict with Object.prototype properties (trac-13203)
5186						sel = handleObj.selector + " ";
5187
5188						if ( matchedSelectors[ sel ] === undefined ) {
5189							matchedSelectors[ sel ] = handleObj.needsContext ?
5190								jQuery( sel, this ).index( cur ) > -1 :
5191								jQuery.find( sel, this, null, [ cur ] ).length;
5192						}
5193						if ( matchedSelectors[ sel ] ) {
5194							matchedHandlers.push( handleObj );
5195						}
5196					}
5197					if ( matchedHandlers.length ) {
5198						handlerQueue.push( { elem: cur, handlers: matchedHandlers } );
5199					}
5200				}
5201			}
5202		}
5203
5204		// Add the remaining (directly-bound) handlers
5205		cur = this;
5206		if ( delegateCount < handlers.length ) {
5207			handlerQueue.push( { elem: cur, handlers: handlers.slice( delegateCount ) } );
5208		}
5209
5210		return handlerQueue;
5211	},
5212
5213	addProp: function( name, hook ) {
5214		Object.defineProperty( jQuery.Event.prototype, name, {
5215			enumerable: true,
5216			configurable: true,
5217
5218			get: isFunction( hook ) ?
5219				function() {
5220					if ( this.originalEvent ) {
5221						return hook( this.originalEvent );
5222					}
5223				} :
5224				function() {
5225					if ( this.originalEvent ) {
5226						return this.originalEvent[ name ];
5227					}
5228				},
5229
5230			set: function( value ) {
5231				Object.defineProperty( this, name, {
5232					enumerable: true,
5233					configurable: true,
5234					writable: true,
5235					value: value
5236				} );
5237			}
5238		} );
5239	},
5240
5241	fix: function( originalEvent ) {
5242		return originalEvent[ jQuery.expando ] ?
5243			originalEvent :
5244			new jQuery.Event( originalEvent );
5245	},
5246
5247	special: {
5248		load: {
5249
5250			// Prevent triggered image.load events from bubbling to window.load
5251			noBubble: true
5252		},
5253		click: {
5254
5255			// Utilize native event to ensure correct state for checkable inputs
5256			setup: function( data ) {
5257
5258				// For mutual compressibility with _default, replace `this` access with a local var.
5259				// `|| data` is dead code meant only to preserve the variable through minification.
5260				var el = this || data;
5261
5262				// Claim the first handler
5263				if ( rcheckableType.test( el.type ) &&
5264					el.click && nodeName( el, "input" ) ) {
5265
5266					// dataPriv.set( el, "click", ... )
5267					leverageNative( el, "click", true );
5268				}
5269
5270				// Return false to allow normal processing in the caller
5271				return false;
5272			},
5273			trigger: function( data ) {
5274
5275				// For mutual compressibility with _default, replace `this` access with a local var.
5276				// `|| data` is dead code meant only to preserve the variable through minification.
5277				var el = this || data;
5278
5279				// Force setup before triggering a click
5280				if ( rcheckableType.test( el.type ) &&
5281					el.click && nodeName( el, "input" ) ) {
5282
5283					leverageNative( el, "click" );
5284				}
5285
5286				// Return non-false to allow normal event-path propagation
5287				return true;
5288			},
5289
5290			// For cross-browser consistency, suppress native .click() on links
5291			// Also prevent it if we're currently inside a leveraged native-event stack
5292			_default: function( event ) {
5293				var target = event.target;
5294				return rcheckableType.test( target.type ) &&
5295					target.click && nodeName( target, "input" ) &&
5296					dataPriv.get( target, "click" ) ||
5297					nodeName( target, "a" );
5298			}
5299		},
5300
5301		beforeunload: {
5302			postDispatch: function( event ) {
5303
5304				// Support: Firefox 20+
5305				// Firefox doesn't alert if the returnValue field is not set.
5306				if ( event.result !== undefined && event.originalEvent ) {
5307					event.originalEvent.returnValue = event.result;
5308				}
5309			}
5310		}
5311	}
5312};
5313
5314// Ensure the presence of an event listener that handles manually-triggered
5315// synthetic events by interrupting progress until reinvoked in response to
5316// *native* events that it fires directly, ensuring that state changes have
5317// already occurred before other listeners are invoked.
5318function leverageNative( el, type, isSetup ) {
5319
5320	// Missing `isSetup` indicates a trigger call, which must force setup through jQuery.event.add
5321	if ( !isSetup ) {
5322		if ( dataPriv.get( el, type ) === undefined ) {
5323			jQuery.event.add( el, type, returnTrue );
5324		}
5325		return;
5326	}
5327
5328	// Register the controller as a special universal handler for all event namespaces
5329	dataPriv.set( el, type, false );
5330	jQuery.event.add( el, type, {
5331		namespace: false,
5332		handler: function( event ) {
5333			var result,
5334				saved = dataPriv.get( this, type );
5335
5336			if ( ( event.isTrigger & 1 ) && this[ type ] ) {
5337
5338				// Interrupt processing of the outer synthetic .trigger()ed event
5339				if ( !saved ) {
5340
5341					// Store arguments for use when handling the inner native event
5342					// There will always be at least one argument (an event object), so this array
5343					// will not be confused with a leftover capture object.
5344					saved = slice.call( arguments );
5345					dataPriv.set( this, type, saved );
5346
5347					// Trigger the native event and capture its result
5348					this[ type ]();
5349					result = dataPriv.get( this, type );
5350					dataPriv.set( this, type, false );
5351
5352					if ( saved !== result ) {
5353
5354						// Cancel the outer synthetic event
5355						event.stopImmediatePropagation();
5356						event.preventDefault();
5357
5358						return result;
5359					}
5360
5361				// If this is an inner synthetic event for an event with a bubbling surrogate
5362				// (focus or blur), assume that the surrogate already propagated from triggering
5363				// the native event and prevent that from happening again here.
5364				// This technically gets the ordering wrong w.r.t. to `.trigger()` (in which the
5365				// bubbling surrogate propagates *after* the non-bubbling base), but that seems
5366				// less bad than duplication.
5367				} else if ( ( jQuery.event.special[ type ] || {} ).delegateType ) {
5368					event.stopPropagation();
5369				}
5370
5371			// If this is a native event triggered above, everything is now in order
5372			// Fire an inner synthetic event with the original arguments
5373			} else if ( saved ) {
5374
5375				// ...and capture the result
5376				dataPriv.set( this, type, jQuery.event.trigger(
5377					saved[ 0 ],
5378					saved.slice( 1 ),
5379					this
5380				) );
5381
5382				// Abort handling of the native event by all jQuery handlers while allowing
5383				// native handlers on the same element to run. On target, this is achieved
5384				// by stopping immediate propagation just on the jQuery event. However,
5385				// the native event is re-wrapped by a jQuery one on each level of the
5386				// propagation so the only way to stop it for jQuery is to stop it for
5387				// everyone via native `stopPropagation()`. This is not a problem for
5388				// focus/blur which don't bubble, but it does also stop click on checkboxes
5389				// and radios. We accept this limitation.
5390				event.stopPropagation();
5391				event.isImmediatePropagationStopped = returnTrue;
5392			}
5393		}
5394	} );
5395}
5396
5397jQuery.removeEvent = function( elem, type, handle ) {
5398
5399	// This "if" is needed for plain objects
5400	if ( elem.removeEventListener ) {
5401		elem.removeEventListener( type, handle );
5402	}
5403};
5404
5405jQuery.Event = function( src, props ) {
5406
5407	// Allow instantiation without the 'new' keyword
5408	if ( !( this instanceof jQuery.Event ) ) {
5409		return new jQuery.Event( src, props );
5410	}
5411
5412	// Event object
5413	if ( src && src.type ) {
5414		this.originalEvent = src;
5415		this.type = src.type;
5416
5417		// Events bubbling up the document may have been marked as prevented
5418		// by a handler lower down the tree; reflect the correct value.
5419		this.isDefaultPrevented = src.defaultPrevented ||
5420				src.defaultPrevented === undefined &&
5421
5422				// Support: Android <=2.3 only
5423				src.returnValue === false ?
5424			returnTrue :
5425			returnFalse;
5426
5427		// Create target properties
5428		// Support: Safari <=6 - 7 only
5429		// Target should not be a text node (trac-504, trac-13143)
5430		this.target = ( src.target && src.target.nodeType === 3 ) ?
5431			src.target.parentNode :
5432			src.target;
5433
5434		this.currentTarget = src.currentTarget;
5435		this.relatedTarget = src.relatedTarget;
5436
5437	// Event type
5438	} else {
5439		this.type = src;
5440	}
5441
5442	// Put explicitly provided properties onto the event object
5443	if ( props ) {
5444		jQuery.extend( this, props );
5445	}
5446
5447	// Create a timestamp if incoming event doesn't have one
5448	this.timeStamp = src && src.timeStamp || Date.now();
5449
5450	// Mark it as fixed
5451	this[ jQuery.expando ] = true;
5452};
5453
5454// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
5455// https://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
5456jQuery.Event.prototype = {
5457	constructor: jQuery.Event,
5458	isDefaultPrevented: returnFalse,
5459	isPropagationStopped: returnFalse,
5460	isImmediatePropagationStopped: returnFalse,
5461	isSimulated: false,
5462
5463	preventDefault: function() {
5464		var e = this.originalEvent;
5465
5466		this.isDefaultPrevented = returnTrue;
5467
5468		if ( e && !this.isSimulated ) {
5469			e.preventDefault();
5470		}
5471	},
5472	stopPropagation: function() {
5473		var e = this.originalEvent;
5474
5475		this.isPropagationStopped = returnTrue;
5476
5477		if ( e && !this.isSimulated ) {
5478			e.stopPropagation();
5479		}
5480	},
5481	stopImmediatePropagation: function() {
5482		var e = this.originalEvent;
5483
5484		this.isImmediatePropagationStopped = returnTrue;
5485
5486		if ( e && !this.isSimulated ) {
5487			e.stopImmediatePropagation();
5488		}
5489
5490		this.stopPropagation();
5491	}
5492};
5493
5494// Includes all common event props including KeyEvent and MouseEvent specific props
5495jQuery.each( {
5496	altKey: true,
5497	bubbles: true,
5498	cancelable: true,
5499	changedTouches: true,
5500	ctrlKey: true,
5501	detail: true,
5502	eventPhase: true,
5503	metaKey: true,
5504	pageX: true,
5505	pageY: true,
5506	shiftKey: true,
5507	view: true,
5508	"char": true,
5509	code: true,
5510	charCode: true,
5511	key: true,
5512	keyCode: true,
5513	button: true,
5514	buttons: true,
5515	clientX: true,
5516	clientY: true,
5517	offsetX: true,
5518	offsetY: true,
5519	pointerId: true,
5520	pointerType: true,
5521	screenX: true,
5522	screenY: true,
5523	targetTouches: true,
5524	toElement: true,
5525	touches: true,
5526	which: true
5527}, jQuery.event.addProp );
5528
5529jQuery.each( { focus: "focusin", blur: "focusout" }, function( type, delegateType ) {
5530
5531	function focusMappedHandler( nativeEvent ) {
5532		if ( document.documentMode ) {
5533
5534			// Support: IE 11+
5535			// Attach a single focusin/focusout handler on the document while someone wants
5536			// focus/blur. This is because the former are synchronous in IE while the latter
5537			// are async. In other browsers, all those handlers are invoked synchronously.
5538
5539			// `handle` from private data would already wrap the event, but we need
5540			// to change the `type` here.
5541			var handle = dataPriv.get( this, "handle" ),
5542				event = jQuery.event.fix( nativeEvent );
5543			event.type = nativeEvent.type === "focusin" ? "focus" : "blur";
5544			event.isSimulated = true;
5545
5546			// First, handle focusin/focusout
5547			handle( nativeEvent );
5548
5549			// ...then, handle focus/blur
5550			//
5551			// focus/blur don't bubble while focusin/focusout do; simulate the former by only
5552			// invoking the handler at the lower level.
5553			if ( event.target === event.currentTarget ) {
5554
5555				// The setup part calls `leverageNative`, which, in turn, calls
5556				// `jQuery.event.add`, so event handle will already have been set
5557				// by this point.
5558				handle( event );
5559			}
5560		} else {
5561
5562			// For non-IE browsers, attach a single capturing handler on the document
5563			// while someone wants focusin/focusout.
5564			jQuery.event.simulate( delegateType, nativeEvent.target,
5565				jQuery.event.fix( nativeEvent ) );
5566		}
5567	}
5568
5569	jQuery.event.special[ type ] = {
5570
5571		// Utilize native event if possible so blur/focus sequence is correct
5572		setup: function() {
5573
5574			var attaches;
5575
5576			// Claim the first handler
5577			// dataPriv.set( this, "focus", ... )
5578			// dataPriv.set( this, "blur", ... )
5579			leverageNative( this, type, true );
5580
5581			if ( document.documentMode ) {
5582
5583				// Support: IE 9 - 11+
5584				// We use the same native handler for focusin & focus (and focusout & blur)
5585				// so we need to coordinate setup & teardown parts between those events.
5586				// Use `delegateType` as the key as `type` is already used by `leverageNative`.
5587				attaches = dataPriv.get( this, delegateType );
5588				if ( !attaches ) {
5589					this.addEventListener( delegateType, focusMappedHandler );
5590				}
5591				dataPriv.set( this, delegateType, ( attaches || 0 ) + 1 );
5592			} else {
5593
5594				// Return false to allow normal processing in the caller
5595				return false;
5596			}
5597		},
5598		trigger: function() {
5599
5600			// Force setup before trigger
5601			leverageNative( this, type );
5602
5603			// Return non-false to allow normal event-path propagation
5604			return true;
5605		},
5606
5607		teardown: function() {
5608			var attaches;
5609
5610			if ( document.documentMode ) {
5611				attaches = dataPriv.get( this, delegateType ) - 1;
5612				if ( !attaches ) {
5613					this.removeEventListener( delegateType, focusMappedHandler );
5614					dataPriv.remove( this, delegateType );
5615				} else {
5616					dataPriv.set( this, delegateType, attaches );
5617				}
5618			} else {
5619
5620				// Return false to indicate standard teardown should be applied
5621				return false;
5622			}
5623		},
5624
5625		// Suppress native focus or blur if we're currently inside
5626		// a leveraged native-event stack
5627		_default: function( event ) {
5628			return dataPriv.get( event.target, type );
5629		},
5630
5631		delegateType: delegateType
5632	};
5633
5634	// Support: Firefox <=44
5635	// Firefox doesn't have focus(in | out) events
5636	// Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787
5637	//
5638	// Support: Chrome <=48 - 49, Safari <=9.0 - 9.1
5639	// focus(in | out) events fire after focus & blur events,
5640	// which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order
5641	// Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857
5642	//
5643	// Support: IE 9 - 11+
5644	// To preserve relative focusin/focus & focusout/blur event order guaranteed on the 3.x branch,
5645	// attach a single handler for both events in IE.
5646	jQuery.event.special[ delegateType ] = {
5647		setup: function() {
5648
5649			// Handle: regular nodes (via `this.ownerDocument`), window
5650			// (via `this.document`) & document (via `this`).
5651			var doc = this.ownerDocument || this.document || this,
5652				dataHolder = document.documentMode ? this : doc,
5653				attaches = dataPriv.get( dataHolder, delegateType );
5654
5655			// Support: IE 9 - 11+
5656			// We use the same native handler for focusin & focus (and focusout & blur)
5657			// so we need to coordinate setup & teardown parts between those events.
5658			// Use `delegateType` as the key as `type` is already used by `leverageNative`.
5659			if ( !attaches ) {
5660				if ( document.documentMode ) {
5661					this.addEventListener( delegateType, focusMappedHandler );
5662				} else {
5663					doc.addEventListener( type, focusMappedHandler, true );
5664				}
5665			}
5666			dataPriv.set( dataHolder, delegateType, ( attaches || 0 ) + 1 );
5667		},
5668		teardown: function() {
5669			var doc = this.ownerDocument || this.document || this,
5670				dataHolder = document.documentMode ? this : doc,
5671				attaches = dataPriv.get( dataHolder, delegateType ) - 1;
5672
5673			if ( !attaches ) {
5674				if ( document.documentMode ) {
5675					this.removeEventListener( delegateType, focusMappedHandler );
5676				} else {
5677					doc.removeEventListener( type, focusMappedHandler, true );
5678				}
5679				dataPriv.remove( dataHolder, delegateType );
5680			} else {
5681				dataPriv.set( dataHolder, delegateType, attaches );
5682			}
5683		}
5684	};
5685} );
5686
5687// Create mouseenter/leave events using mouseover/out and event-time checks
5688// so that event delegation works in jQuery.
5689// Do the same for pointerenter/pointerleave and pointerover/pointerout
5690//
5691// Support: Safari 7 only
5692// Safari sends mouseenter too often; see:
5693// https://bugs.chromium.org/p/chromium/issues/detail?id=470258
5694// for the description of the bug (it existed in older Chrome versions as well).
5695jQuery.each( {
5696	mouseenter: "mouseover",
5697	mouseleave: "mouseout",
5698	pointerenter: "pointerover",
5699	pointerleave: "pointerout"
5700}, function( orig, fix ) {
5701	jQuery.event.special[ orig ] = {
5702		delegateType: fix,
5703		bindType: fix,
5704
5705		handle: function( event ) {
5706			var ret,
5707				target = this,
5708				related = event.relatedTarget,
5709				handleObj = event.handleObj;
5710
5711			// For mouseenter/leave call the handler if related is outside the target.
5712			// NB: No relatedTarget if the mouse left/entered the browser window
5713			if ( !related || ( related !== target && !jQuery.contains( target, related ) ) ) {
5714				event.type = handleObj.origType;
5715				ret = handleObj.handler.apply( this, arguments );
5716				event.type = fix;
5717			}
5718			return ret;
5719		}
5720	};
5721} );
5722
5723jQuery.fn.extend( {
5724
5725	on: function( types, selector, data, fn ) {
5726		return on( this, types, selector, data, fn );
5727	},
5728	one: function( types, selector, data, fn ) {
5729		return on( this, types, selector, data, fn, 1 );
5730	},
5731	off: function( types, selector, fn ) {
5732		var handleObj, type;
5733		if ( types && types.preventDefault && types.handleObj ) {
5734
5735			// ( event )  dispatched jQuery.Event
5736			handleObj = types.handleObj;
5737			jQuery( types.delegateTarget ).off(
5738				handleObj.namespace ?
5739					handleObj.origType + "." + handleObj.namespace :
5740					handleObj.origType,
5741				handleObj.selector,
5742				handleObj.handler
5743			);
5744			return this;
5745		}
5746		if ( typeof types === "object" ) {
5747
5748			// ( types-object [, selector] )
5749			for ( type in types ) {
5750				this.off( type, selector, types[ type ] );
5751			}
5752			return this;
5753		}
5754		if ( selector === false || typeof selector === "function" ) {
5755
5756			// ( types [, fn] )
5757			fn = selector;
5758			selector = undefined;
5759		}
5760		if ( fn === false ) {
5761			fn = returnFalse;
5762		}
5763		return this.each( function() {
5764			jQuery.event.remove( this, types, fn, selector );
5765		} );
5766	}
5767} );
5768
5769
5770var
5771
5772	// Support: IE <=10 - 11, Edge 12 - 13 only
5773	// In IE/Edge using regex groups here causes severe slowdowns.
5774	// See https://connect.microsoft.com/IE/feedback/details/1736512/
5775	rnoInnerhtml = /<script|<style|<link/i,
5776
5777	// checked="checked" or checked
5778	rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
5779
5780	rcleanScript = /^\s*<!\[CDATA\[|\]\]>\s*$/g;
5781
5782// Prefer a tbody over its parent table for containing new rows
5783function manipulationTarget( elem, content ) {
5784	if ( nodeName( elem, "table" ) &&
5785		nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ) {
5786
5787		return jQuery( elem ).children( "tbody" )[ 0 ] || elem;
5788	}
5789
5790	return elem;
5791}
5792
5793// Replace/restore the type attribute of script elements for safe DOM manipulation
5794function disableScript( elem ) {
5795	elem.type = ( elem.getAttribute( "type" ) !== null ) + "/" + elem.type;
5796	return elem;
5797}
5798function restoreScript( elem ) {
5799	if ( ( elem.type || "" ).slice( 0, 5 ) === "true/" ) {
5800		elem.type = elem.type.slice( 5 );
5801	} else {
5802		elem.removeAttribute( "type" );
5803	}
5804
5805	return elem;
5806}
5807
5808function cloneCopyEvent( src, dest ) {
5809	var i, l, type, pdataOld, udataOld, udataCur, events;
5810
5811	if ( dest.nodeType !== 1 ) {
5812		return;
5813	}
5814
5815	// 1. Copy private data: events, handlers, etc.
5816	if ( dataPriv.hasData( src ) ) {
5817		pdataOld = dataPriv.get( src );
5818		events = pdataOld.events;
5819
5820		if ( events ) {
5821			dataPriv.remove( dest, "handle events" );
5822
5823			for ( type in events ) {
5824				for ( i = 0, l = events[ type ].length; i < l; i++ ) {
5825					jQuery.event.add( dest, type, events[ type ][ i ] );
5826				}
5827			}
5828		}
5829	}
5830
5831	// 2. Copy user data
5832	if ( dataUser.hasData( src ) ) {
5833		udataOld = dataUser.access( src );
5834		udataCur = jQuery.extend( {}, udataOld );
5835
5836		dataUser.set( dest, udataCur );
5837	}
5838}
5839
5840// Fix IE bugs, see support tests
5841function fixInput( src, dest ) {
5842	var nodeName = dest.nodeName.toLowerCase();
5843
5844	// Fails to persist the checked state of a cloned checkbox or radio button.
5845	if ( nodeName === "input" && rcheckableType.test( src.type ) ) {
5846		dest.checked = src.checked;
5847
5848	// Fails to return the selected option to the default selected state when cloning options
5849	} else if ( nodeName === "input" || nodeName === "textarea" ) {
5850		dest.defaultValue = src.defaultValue;
5851	}
5852}
5853
5854function domManip( collection, args, callback, ignored ) {
5855
5856	// Flatten any nested arrays
5857	args = flat( args );
5858
5859	var fragment, first, scripts, hasScripts, node, doc,
5860		i = 0,
5861		l = collection.length,
5862		iNoClone = l - 1,
5863		value = args[ 0 ],
5864		valueIsFunction = isFunction( value );
5865
5866	// We can't cloneNode fragments that contain checked, in WebKit
5867	if ( valueIsFunction ||
5868			( l > 1 && typeof value === "string" &&
5869				!support.checkClone && rchecked.test( value ) ) ) {
5870		return collection.each( function( index ) {
5871			var self = collection.eq( index );
5872			if ( valueIsFunction ) {
5873				args[ 0 ] = value.call( this, index, self.html() );
5874			}
5875			domManip( self, args, callback, ignored );
5876		} );
5877	}
5878
5879	if ( l ) {
5880		fragment = buildFragment( args, collection[ 0 ].ownerDocument, false, collection, ignored );
5881		first = fragment.firstChild;
5882
5883		if ( fragment.childNodes.length === 1 ) {
5884			fragment = first;
5885		}
5886
5887		// Require either new content or an interest in ignored elements to invoke the callback
5888		if ( first || ignored ) {
5889			scripts = jQuery.map( getAll( fragment, "script" ), disableScript );
5890			hasScripts = scripts.length;
5891
5892			// Use the original fragment for the last item
5893			// instead of the first because it can end up
5894			// being emptied incorrectly in certain situations (trac-8070).
5895			for ( ; i < l; i++ ) {
5896				node = fragment;
5897
5898				if ( i !== iNoClone ) {
5899					node = jQuery.clone( node, true, true );
5900
5901					// Keep references to cloned scripts for later restoration
5902					if ( hasScripts ) {
5903
5904						// Support: Android <=4.0 only, PhantomJS 1 only
5905						// push.apply(_, arraylike) throws on ancient WebKit
5906						jQuery.merge( scripts, getAll( node, "script" ) );
5907					}
5908				}
5909
5910				callback.call( collection[ i ], node, i );
5911			}
5912
5913			if ( hasScripts ) {
5914				doc = scripts[ scripts.length - 1 ].ownerDocument;
5915
5916				// Reenable scripts
5917				jQuery.map( scripts, restoreScript );
5918
5919				// Evaluate executable scripts on first document insertion
5920				for ( i = 0; i < hasScripts; i++ ) {
5921					node = scripts[ i ];
5922					if ( rscriptType.test( node.type || "" ) &&
5923						!dataPriv.access( node, "globalEval" ) &&
5924						jQuery.contains( doc, node ) ) {
5925
5926						if ( node.src && ( node.type || "" ).toLowerCase()  !== "module" ) {
5927
5928							// Optional AJAX dependency, but won't run scripts if not present
5929							if ( jQuery._evalUrl && !node.noModule ) {
5930								jQuery._evalUrl( node.src, {
5931									nonce: node.nonce || node.getAttribute( "nonce" )
5932								}, doc );
5933							}
5934						} else {
5935
5936							// Unwrap a CDATA section containing script contents. This shouldn't be
5937							// needed as in XML documents they're already not visible when
5938							// inspecting element contents and in HTML documents they have no
5939							// meaning but we're preserving that logic for backwards compatibility.
5940							// This will be removed completely in 4.0. See gh-4904.
5941							DOMEval( node.textContent.replace( rcleanScript, "" ), node, doc );
5942						}
5943					}
5944				}
5945			}
5946		}
5947	}
5948
5949	return collection;
5950}
5951
5952function remove( elem, selector, keepData ) {
5953	var node,
5954		nodes = selector ? jQuery.filter( selector, elem ) : elem,
5955		i = 0;
5956
5957	for ( ; ( node = nodes[ i ] ) != null; i++ ) {
5958		if ( !keepData && node.nodeType === 1 ) {
5959			jQuery.cleanData( getAll( node ) );
5960		}
5961
5962		if ( node.parentNode ) {
5963			if ( keepData && isAttached( node ) ) {
5964				setGlobalEval( getAll( node, "script" ) );
5965			}
5966			node.parentNode.removeChild( node );
5967		}
5968	}
5969
5970	return elem;
5971}
5972
5973jQuery.extend( {
5974	htmlPrefilter: function( html ) {
5975		return html;
5976	},
5977
5978	clone: function( elem, dataAndEvents, deepDataAndEvents ) {
5979		var i, l, srcElements, destElements,
5980			clone = elem.cloneNode( true ),
5981			inPage = isAttached( elem );
5982
5983		// Fix IE cloning issues
5984		if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) &&
5985				!jQuery.isXMLDoc( elem ) ) {
5986
5987			// We eschew jQuery#find here for performance reasons:
5988			// https://jsperf.com/getall-vs-sizzle/2
5989			destElements = getAll( clone );
5990			srcElements = getAll( elem );
5991
5992			for ( i = 0, l = srcElements.length; i < l; i++ ) {
5993				fixInput( srcElements[ i ], destElements[ i ] );
5994			}
5995		}
5996
5997		// Copy the events from the original to the clone
5998		if ( dataAndEvents ) {
5999			if ( deepDataAndEvents ) {
6000				srcElements = srcElements || getAll( elem );
6001				destElements = destElements || getAll( clone );
6002
6003				for ( i = 0, l = srcElements.length; i < l; i++ ) {
6004					cloneCopyEvent( srcElements[ i ], destElements[ i ] );
6005				}
6006			} else {
6007				cloneCopyEvent( elem, clone );
6008			}
6009		}
6010
6011		// Preserve script evaluation history
6012		destElements = getAll( clone, "script" );
6013		if ( destElements.length > 0 ) {
6014			setGlobalEval( destElements, !inPage && getAll( elem, "script" ) );
6015		}
6016
6017		// Return the cloned set
6018		return clone;
6019	},
6020
6021	cleanData: function( elems ) {
6022		var data, elem, type,
6023			special = jQuery.event.special,
6024			i = 0;
6025
6026		for ( ; ( elem = elems[ i ] ) !== undefined; i++ ) {
6027			if ( acceptData( elem ) ) {
6028				if ( ( data = elem[ dataPriv.expando ] ) ) {
6029					if ( data.events ) {
6030						for ( type in data.events ) {
6031							if ( special[ type ] ) {
6032								jQuery.event.remove( elem, type );
6033
6034							// This is a shortcut to avoid jQuery.event.remove's overhead
6035							} else {
6036								jQuery.removeEvent( elem, type, data.handle );
6037							}
6038						}
6039					}
6040
vendor: 1,119 bytes, lines 6041-6085
6041					// Support: Chrome <=35 - 45+
6042					// Assign undefined instead of using delete, see Data#remove
6043					elem[ dataPriv.expando ] = undefined;
6044				}
6045				if ( elem[ dataUser.expando ] ) {
6046
6047					// Support: Chrome <=35 - 45+
6048					// Assign undefined instead of using delete, see Data#remove
6049					elem[ dataUser.expando ] = undefined;
6050				}
6051			}
6052		}
6053	}
6054} );
6055
6056jQuery.fn.extend( {
6057	detach: function( selector ) {
6058		return remove( this, selector, true );
6059	},
6060
6061	remove: function( selector ) {
6062		return remove( this, selector );
6063	},
6064
6065	text: function( value ) {
6066		return access( this, function( value ) {
6067			return value === undefined ?
6068				jQuery.text( this ) :
6069				this.empty().each( function() {
6070					if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
6071						this.textContent = value;
6072					}
6073				} );
6074		}, null, value, arguments.length );
6075	},
6076
6077	append: function() {
6078		return domManip( this, arguments, function( elem ) {
6079			if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
6080				var target = manipulationTarget( this, elem );
6081				target.appendChild( elem );
6082			}
6083		} );
6084	},
6085
vendor: 21,524 bytes, lines 6086-6823
6086	prepend: function() {
6087		return domManip( this, arguments, function( elem ) {
6088			if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
6089				var target = manipulationTarget( this, elem );
6090				target.insertBefore( elem, target.firstChild );
6091			}
6092		} );
6093	},
6094
6095	before: function() {
6096		return domManip( this, arguments, function( elem ) {
6097			if ( this.parentNode ) {
6098				this.parentNode.insertBefore( elem, this );
6099			}
6100		} );
6101	},
6102
6103	after: function() {
6104		return domManip( this, arguments, function( elem ) {
6105			if ( this.parentNode ) {
6106				this.parentNode.insertBefore( elem, this.nextSibling );
6107			}
6108		} );
6109	},
6110
6111	empty: function() {
6112		var elem,
6113			i = 0;
6114
6115		for ( ; ( elem = this[ i ] ) != null; i++ ) {
6116			if ( elem.nodeType === 1 ) {
6117
6118				// Prevent memory leaks
6119				jQuery.cleanData( getAll( elem, false ) );
6120
6121				// Remove any remaining nodes
6122				elem.textContent = "";
6123			}
6124		}
6125
6126		return this;
6127	},
6128
6129	clone: function( dataAndEvents, deepDataAndEvents ) {
6130		dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
6131		deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
6132
6133		return this.map( function() {
6134			return jQuery.clone( this, dataAndEvents, deepDataAndEvents );
6135		} );
6136	},
6137
6138	html: function( value ) {
6139		return access( this, function( value ) {
6140			var elem = this[ 0 ] || {},
6141				i = 0,
6142				l = this.length;
6143
6144			if ( value === undefined && elem.nodeType === 1 ) {
6145				return elem.innerHTML;
6146			}
6147
6148			// See if we can take a shortcut and just use innerHTML
6149			if ( typeof value === "string" && !rnoInnerhtml.test( value ) &&
6150				!wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) {
6151
6152				value = jQuery.htmlPrefilter( value );
6153
6154				try {
6155					for ( ; i < l; i++ ) {
6156						elem = this[ i ] || {};
6157
6158						// Remove element nodes and prevent memory leaks
6159						if ( elem.nodeType === 1 ) {
6160							jQuery.cleanData( getAll( elem, false ) );
6161							elem.innerHTML = value;
6162						}
6163					}
6164
6165					elem = 0;
6166
6167				// If using innerHTML throws an exception, use the fallback method
6168				} catch ( e ) {}
6169			}
6170
6171			if ( elem ) {
6172				this.empty().append( value );
6173			}
6174		}, null, value, arguments.length );
6175	},
6176
6177	replaceWith: function() {
6178		var ignored = [];
6179
6180		// Make the changes, replacing each non-ignored context element with the new content
6181		return domManip( this, arguments, function( elem ) {
6182			var parent = this.parentNode;
6183
6184			if ( jQuery.inArray( this, ignored ) < 0 ) {
6185				jQuery.cleanData( getAll( this ) );
6186				if ( parent ) {
6187					parent.replaceChild( elem, this );
6188				}
6189			}
6190
6191		// Force callback invocation
6192		}, ignored );
6193	}
6194} );
6195
6196jQuery.each( {
6197	appendTo: "append",
6198	prependTo: "prepend",
6199	insertBefore: "before",
6200	insertAfter: "after",
6201	replaceAll: "replaceWith"
6202}, function( name, original ) {
6203	jQuery.fn[ name ] = function( selector ) {
6204		var elems,
6205			ret = [],
6206			insert = jQuery( selector ),
6207			last = insert.length - 1,
6208			i = 0;
6209
6210		for ( ; i <= last; i++ ) {
6211			elems = i === last ? this : this.clone( true );
6212			jQuery( insert[ i ] )[ original ]( elems );
6213
6214			// Support: Android <=4.0 only, PhantomJS 1 only
6215			// .get() because push.apply(_, arraylike) throws on ancient WebKit
6216			push.apply( ret, elems.get() );
6217		}
6218
6219		return this.pushStack( ret );
6220	};
6221} );
6222var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" );
6223
6224var rcustomProp = /^--/;
6225
6226
6227var getStyles = function( elem ) {
6228
6229		// Support: IE <=11 only, Firefox <=30 (trac-15098, trac-14150)
6230		// IE throws on elements created in popups
6231		// FF meanwhile throws on frame elements through "defaultView.getComputedStyle"
6232		var view = elem.ownerDocument.defaultView;
6233
6234		if ( !view || !view.opener ) {
6235			view = window;
6236		}
6237
6238		return view.getComputedStyle( elem );
6239	};
6240
6241var swap = function( elem, options, callback ) {
6242	var ret, name,
6243		old = {};
6244
6245	// Remember the old values, and insert the new ones
6246	for ( name in options ) {
6247		old[ name ] = elem.style[ name ];
6248		elem.style[ name ] = options[ name ];
6249	}
6250
6251	ret = callback.call( elem );
6252
6253	// Revert the old values
6254	for ( name in options ) {
6255		elem.style[ name ] = old[ name ];
6256	}
6257
6258	return ret;
6259};
6260
6261
6262var rboxStyle = new RegExp( cssExpand.join( "|" ), "i" );
6263
6264
6265
6266( function() {
6267
6268	// Executing both pixelPosition & boxSizingReliable tests require only one layout
6269	// so they're executed at the same time to save the second computation.
6270	function computeStyleTests() {
6271
6272		// This is a singleton, we need to execute it only once
6273		if ( !div ) {
6274			return;
6275		}
6276
6277		container.style.cssText = "position:absolute;left:-11111px;width:60px;" +
6278			"margin-top:1px;padding:0;border:0";
6279		div.style.cssText =
6280			"position:relative;display:block;box-sizing:border-box;overflow:scroll;" +
6281			"margin:auto;border:1px;padding:1px;" +
6282			"width:60%;top:1%";
6283		documentElement.appendChild( container ).appendChild( div );
6284
6285		var divStyle = window.getComputedStyle( div );
6286		pixelPositionVal = divStyle.top !== "1%";
6287
6288		// Support: Android 4.0 - 4.3 only, Firefox <=3 - 44
6289		reliableMarginLeftVal = roundPixelMeasures( divStyle.marginLeft ) === 12;
6290
6291		// Support: Android 4.0 - 4.3 only, Safari <=9.1 - 10.1, iOS <=7.0 - 9.3
6292		// Some styles come back with percentage values, even though they shouldn't
6293		div.style.right = "60%";
6294		pixelBoxStylesVal = roundPixelMeasures( divStyle.right ) === 36;
6295
6296		// Support: IE 9 - 11 only
6297		// Detect misreporting of content dimensions for box-sizing:border-box elements
6298		boxSizingReliableVal = roundPixelMeasures( divStyle.width ) === 36;
6299
6300		// Support: IE 9 only
6301		// Detect overflow:scroll screwiness (gh-3699)
6302		// Support: Chrome <=64
6303		// Don't get tricked when zoom affects offsetWidth (gh-4029)
6304		div.style.position = "absolute";
6305		scrollboxSizeVal = roundPixelMeasures( div.offsetWidth / 3 ) === 12;
6306
6307		documentElement.removeChild( container );
6308
6309		// Nullify the div so it wouldn't be stored in the memory and
6310		// it will also be a sign that checks already performed
6311		div = null;
6312	}
6313
6314	function roundPixelMeasures( measure ) {
6315		return Math.round( parseFloat( measure ) );
6316	}
6317
6318	var pixelPositionVal, boxSizingReliableVal, scrollboxSizeVal, pixelBoxStylesVal,
6319		reliableTrDimensionsVal, reliableMarginLeftVal,
6320		container = document.createElement( "div" ),
6321		div = document.createElement( "div" );
6322
6323	// Finish early in limited (non-browser) environments
6324	if ( !div.style ) {
6325		return;
6326	}
6327
6328	// Support: IE <=9 - 11 only
6329	// Style of cloned element affects source element cloned (trac-8908)
6330	div.style.backgroundClip = "content-box";
6331	div.cloneNode( true ).style.backgroundClip = "";
6332	support.clearCloneStyle = div.style.backgroundClip === "content-box";
6333
6334	jQuery.extend( support, {
6335		boxSizingReliable: function() {
6336			computeStyleTests();
6337			return boxSizingReliableVal;
6338		},
6339		pixelBoxStyles: function() {
6340			computeStyleTests();
6341			return pixelBoxStylesVal;
6342		},
6343		pixelPosition: function() {
6344			computeStyleTests();
6345			return pixelPositionVal;
6346		},
6347		reliableMarginLeft: function() {
6348			computeStyleTests();
6349			return reliableMarginLeftVal;
6350		},
6351		scrollboxSize: function() {
6352			computeStyleTests();
6353			return scrollboxSizeVal;
6354		},
6355
6356		// Support: IE 9 - 11+, Edge 15 - 18+
6357		// IE/Edge misreport `getComputedStyle` of table rows with width/height
6358		// set in CSS while `offset*` properties report correct values.
6359		// Behavior in IE 9 is more subtle than in newer versions & it passes
6360		// some versions of this test; make sure not to make it pass there!
6361		//
6362		// Support: Firefox 70+
6363		// Only Firefox includes border widths
6364		// in computed dimensions. (gh-4529)
6365		reliableTrDimensions: function() {
6366			var table, tr, trChild, trStyle;
6367			if ( reliableTrDimensionsVal == null ) {
6368				table = document.createElement( "table" );
6369				tr = document.createElement( "tr" );
6370				trChild = document.createElement( "div" );
6371
6372				table.style.cssText = "position:absolute;left:-11111px;border-collapse:separate";
6373				tr.style.cssText = "border:1px solid";
6374
6375				// Support: Chrome 86+
6376				// Height set through cssText does not get applied.
6377				// Computed height then comes back as 0.
6378				tr.style.height = "1px";
6379				trChild.style.height = "9px";
6380
6381				// Support: Android 8 Chrome 86+
6382				// In our bodyBackground.html iframe,
6383				// display for all div elements is set to "inline",
6384				// which causes a problem only in Android 8 Chrome 86.
6385				// Ensuring the div is display: block
6386				// gets around this issue.
6387				trChild.style.display = "block";
6388
6389				documentElement
6390					.appendChild( table )
6391					.appendChild( tr )
6392					.appendChild( trChild );
6393
6394				trStyle = window.getComputedStyle( tr );
6395				reliableTrDimensionsVal = ( parseInt( trStyle.height, 10 ) +
6396					parseInt( trStyle.borderTopWidth, 10 ) +
6397					parseInt( trStyle.borderBottomWidth, 10 ) ) === tr.offsetHeight;
6398
6399				documentElement.removeChild( table );
6400			}
6401			return reliableTrDimensionsVal;
6402		}
6403	} );
6404} )();
6405
6406
6407function curCSS( elem, name, computed ) {
6408	var width, minWidth, maxWidth, ret,
6409		isCustomProp = rcustomProp.test( name ),
6410
6411		// Support: Firefox 51+
6412		// Retrieving style before computed somehow
6413		// fixes an issue with getting wrong values
6414		// on detached elements
6415		style = elem.style;
6416
6417	computed = computed || getStyles( elem );
6418
6419	// getPropertyValue is needed for:
6420	//   .css('filter') (IE 9 only, trac-12537)
6421	//   .css('--customProperty) (gh-3144)
6422	if ( computed ) {
6423
6424		// Support: IE <=9 - 11+
6425		// IE only supports `"float"` in `getPropertyValue`; in computed styles
6426		// it's only available as `"cssFloat"`. We no longer modify properties
6427		// sent to `.css()` apart from camelCasing, so we need to check both.
6428		// Normally, this would create difference in behavior: if
6429		// `getPropertyValue` returns an empty string, the value returned
6430		// by `.css()` would be `undefined`. This is usually the case for
6431		// disconnected elements. However, in IE even disconnected elements
6432		// with no styles return `"none"` for `getPropertyValue( "float" )`
6433		ret = computed.getPropertyValue( name ) || computed[ name ];
6434
6435		if ( isCustomProp && ret ) {
6436
6437			// Support: Firefox 105+, Chrome <=105+
6438			// Spec requires trimming whitespace for custom properties (gh-4926).
6439			// Firefox only trims leading whitespace. Chrome just collapses
6440			// both leading & trailing whitespace to a single space.
6441			//
6442			// Fall back to `undefined` if empty string returned.
6443			// This collapses a missing definition with property defined
6444			// and set to an empty string but there's no standard API
6445			// allowing us to differentiate them without a performance penalty
6446			// and returning `undefined` aligns with older jQuery.
6447			//
6448			// rtrimCSS treats U+000D CARRIAGE RETURN and U+000C FORM FEED
6449			// as whitespace while CSS does not, but this is not a problem
6450			// because CSS preprocessing replaces them with U+000A LINE FEED
6451			// (which *is* CSS whitespace)
6452			// https://www.w3.org/TR/css-syntax-3/#input-preprocessing
6453			ret = ret.replace( rtrimCSS, "$1" ) || undefined;
6454		}
6455
6456		if ( ret === "" && !isAttached( elem ) ) {
6457			ret = jQuery.style( elem, name );
6458		}
6459
6460		// A tribute to the "awesome hack by Dean Edwards"
6461		// Android Browser returns percentage for some values,
6462		// but width seems to be reliably pixels.
6463		// This is against the CSSOM draft spec:
6464		// https://drafts.csswg.org/cssom/#resolved-values
6465		if ( !support.pixelBoxStyles() && rnumnonpx.test( ret ) && rboxStyle.test( name ) ) {
6466
6467			// Remember the original values
6468			width = style.width;
6469			minWidth = style.minWidth;
6470			maxWidth = style.maxWidth;
6471
6472			// Put in the new values to get a computed value out
6473			style.minWidth = style.maxWidth = style.width = ret;
6474			ret = computed.width;
6475
6476			// Revert the changed values
6477			style.width = width;
6478			style.minWidth = minWidth;
6479			style.maxWidth = maxWidth;
6480		}
6481	}
6482
6483	return ret !== undefined ?
6484
6485		// Support: IE <=9 - 11 only
6486		// IE returns zIndex value as an integer.
6487		ret + "" :
6488		ret;
6489}
6490
6491
6492function addGetHookIf( conditionFn, hookFn ) {
6493
6494	// Define the hook, we'll check on the first run if it's really needed.
6495	return {
6496		get: function() {
6497			if ( conditionFn() ) {
6498
6499				// Hook not needed (or it's not possible to use it due
6500				// to missing dependency), remove it.
6501				delete this.get;
6502				return;
6503			}
6504
6505			// Hook needed; redefine it so that the support test is not executed again.
6506			return ( this.get = hookFn ).apply( this, arguments );
6507		}
6508	};
6509}
6510
6511
6512var cssPrefixes = [ "Webkit", "Moz", "ms" ],
6513	emptyStyle = document.createElement( "div" ).style,
6514	vendorProps = {};
6515
6516// Return a vendor-prefixed property or undefined
6517function vendorPropName( name ) {
6518
6519	// Check for vendor prefixed names
6520	var capName = name[ 0 ].toUpperCase() + name.slice( 1 ),
6521		i = cssPrefixes.length;
6522
6523	while ( i-- ) {
6524		name = cssPrefixes[ i ] + capName;
6525		if ( name in emptyStyle ) {
6526			return name;
6527		}
6528	}
6529}
6530
6531// Return a potentially-mapped jQuery.cssProps or vendor prefixed property
6532function finalPropName( name ) {
6533	var final = jQuery.cssProps[ name ] || vendorProps[ name ];
6534
6535	if ( final ) {
6536		return final;
6537	}
6538	if ( name in emptyStyle ) {
6539		return name;
6540	}
6541	return vendorProps[ name ] = vendorPropName( name ) || name;
6542}
6543
6544
6545var
6546
6547	// Swappable if display is none or starts with table
6548	// except "table", "table-cell", or "table-caption"
6549	// See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display
6550	rdisplayswap = /^(none|table(?!-c[ea]).+)/,
6551	cssShow = { position: "absolute", visibility: "hidden", display: "block" },
6552	cssNormalTransform = {
6553		letterSpacing: "0",
6554		fontWeight: "400"
6555	};
6556
6557function setPositiveNumber( _elem, value, subtract ) {
6558
6559	// Any relative (+/-) values have already been
6560	// normalized at this point
6561	var matches = rcssNum.exec( value );
6562	return matches ?
6563
6564		// Guard against undefined "subtract", e.g., when used as in cssHooks
6565		Math.max( 0, matches[ 2 ] - ( subtract || 0 ) ) + ( matches[ 3 ] || "px" ) :
6566		value;
6567}
6568
6569function boxModelAdjustment( elem, dimension, box, isBorderBox, styles, computedVal ) {
6570	var i = dimension === "width" ? 1 : 0,
6571		extra = 0,
6572		delta = 0,
6573		marginDelta = 0;
6574
6575	// Adjustment may not be necessary
6576	if ( box === ( isBorderBox ? "border" : "content" ) ) {
6577		return 0;
6578	}
6579
6580	for ( ; i < 4; i += 2 ) {
6581
6582		// Both box models exclude margin
6583		// Count margin delta separately to only add it after scroll gutter adjustment.
6584		// This is needed to make negative margins work with `outerHeight( true )` (gh-3982).
6585		if ( box === "margin" ) {
6586			marginDelta += jQuery.css( elem, box + cssExpand[ i ], true, styles );
6587		}
6588
6589		// If we get here with a content-box, we're seeking "padding" or "border" or "margin"
6590		if ( !isBorderBox ) {
6591
6592			// Add padding
6593			delta += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
6594
6595			// For "border" or "margin", add border
6596			if ( box !== "padding" ) {
6597				delta += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
6598
6599			// But still keep track of it otherwise
6600			} else {
6601				extra += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
6602			}
6603
6604		// If we get here with a border-box (content + padding + border), we're seeking "content" or
6605		// "padding" or "margin"
6606		} else {
6607
6608			// For "content", subtract padding
6609			if ( box === "content" ) {
6610				delta -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
6611			}
6612
6613			// For "content" or "padding", subtract border
6614			if ( box !== "margin" ) {
6615				delta -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
6616			}
6617		}
6618	}
6619
6620	// Account for positive content-box scroll gutter when requested by providing computedVal
6621	if ( !isBorderBox && computedVal >= 0 ) {
6622
6623		// offsetWidth/offsetHeight is a rounded sum of content, padding, scroll gutter, and border
6624		// Assuming integer scroll gutter, subtract the rest and round down
6625		delta += Math.max( 0, Math.ceil(
6626			elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] -
6627			computedVal -
6628			delta -
6629			extra -
6630			0.5
6631
6632		// If offsetWidth/offsetHeight is unknown, then we can't determine content-box scroll gutter
6633		// Use an explicit zero to avoid NaN (gh-3964)
6634		) ) || 0;
6635	}
6636
6637	return delta + marginDelta;
6638}
6639
6640function getWidthOrHeight( elem, dimension, extra ) {
6641
6642	// Start with computed style
6643	var styles = getStyles( elem ),
6644
6645		// To avoid forcing a reflow, only fetch boxSizing if we need it (gh-4322).
6646		// Fake content-box until we know it's needed to know the true value.
6647		boxSizingNeeded = !support.boxSizingReliable() || extra,
6648		isBorderBox = boxSizingNeeded &&
6649			jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
6650		valueIsBorderBox = isBorderBox,
6651
6652		val = curCSS( elem, dimension, styles ),
6653		offsetProp = "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 );
6654
6655	// Support: Firefox <=54
6656	// Return a confounding non-pixel value or feign ignorance, as appropriate.
6657	if ( rnumnonpx.test( val ) ) {
6658		if ( !extra ) {
6659			return val;
6660		}
6661		val = "auto";
6662	}
6663
6664
6665	// Support: IE 9 - 11 only
6666	// Use offsetWidth/offsetHeight for when box sizing is unreliable.
6667	// In those cases, the computed value can be trusted to be border-box.
6668	if ( ( !support.boxSizingReliable() && isBorderBox ||
6669
6670		// Support: IE 10 - 11+, Edge 15 - 18+
6671		// IE/Edge misreport `getComputedStyle` of table rows with width/height
6672		// set in CSS while `offset*` properties report correct values.
6673		// Interestingly, in some cases IE 9 doesn't suffer from this issue.
6674		!support.reliableTrDimensions() && nodeName( elem, "tr" ) ||
6675
6676		// Fall back to offsetWidth/offsetHeight when value is "auto"
6677		// This happens for inline elements with no explicit setting (gh-3571)
6678		val === "auto" ||
6679
6680		// Support: Android <=4.1 - 4.3 only
6681		// Also use offsetWidth/offsetHeight for misreported inline dimensions (gh-3602)
6682		!parseFloat( val ) && jQuery.css( elem, "display", false, styles ) === "inline" ) &&
6683
6684		// Make sure the element is visible & connected
6685		elem.getClientRects().length ) {
6686
6687		isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box";
6688
6689		// Where available, offsetWidth/offsetHeight approximate border box dimensions.
6690		// Where not available (e.g., SVG), assume unreliable box-sizing and interpret the
6691		// retrieved value as a content box dimension.
6692		valueIsBorderBox = offsetProp in elem;
6693		if ( valueIsBorderBox ) {
6694			val = elem[ offsetProp ];
6695		}
6696	}
6697
6698	// Normalize "" and auto
6699	val = parseFloat( val ) || 0;
6700
6701	// Adjust for the element's box model
6702	return ( val +
6703		boxModelAdjustment(
6704			elem,
6705			dimension,
6706			extra || ( isBorderBox ? "border" : "content" ),
6707			valueIsBorderBox,
6708			styles,
6709
6710			// Provide the current computed size to request scroll gutter calculation (gh-3589)
6711			val
6712		)
6713	) + "px";
6714}
6715
6716jQuery.extend( {
6717
6718	// Add in style property hooks for overriding the default
6719	// behavior of getting and setting a style property
6720	cssHooks: {
6721		opacity: {
6722			get: function( elem, computed ) {
6723				if ( computed ) {
6724
6725					// We should always get a number back from opacity
6726					var ret = curCSS( elem, "opacity" );
6727					return ret === "" ? "1" : ret;
6728				}
6729			}
6730		}
6731	},
6732
6733	// Don't automatically add "px" to these possibly-unitless properties
6734	cssNumber: {
6735		animationIterationCount: true,
6736		aspectRatio: true,
6737		borderImageSlice: true,
6738		columnCount: true,
6739		flexGrow: true,
6740		flexShrink: true,
6741		fontWeight: true,
6742		gridArea: true,
6743		gridColumn: true,
6744		gridColumnEnd: true,
6745		gridColumnStart: true,
6746		gridRow: true,
6747		gridRowEnd: true,
6748		gridRowStart: true,
6749		lineHeight: true,
6750		opacity: true,
6751		order: true,
6752		orphans: true,
6753		scale: true,
6754		widows: true,
6755		zIndex: true,
6756		zoom: true,
6757
6758		// SVG-related
6759		fillOpacity: true,
6760		floodOpacity: true,
6761		stopOpacity: true,
6762		strokeMiterlimit: true,
6763		strokeOpacity: true
6764	},
6765
6766	// Add in properties whose names you wish to fix before
6767	// setting or getting the value
6768	cssProps: {},
6769
6770	// Get and set the style property on a DOM Node
6771	style: function( elem, name, value, extra ) {
6772
6773		// Don't set styles on text and comment nodes
6774		if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {
6775			return;
6776		}
6777
6778		// Make sure that we're working with the right name
6779		var ret, type, hooks,
6780			origName = camelCase( name ),
6781			isCustomProp = rcustomProp.test( name ),
6782			style = elem.style;
6783
6784		// Make sure that we're working with the right name. We don't
6785		// want to query the value if it is a CSS custom property
6786		// since they are user-defined.
6787		if ( !isCustomProp ) {
6788			name = finalPropName( origName );
6789		}
6790
6791		// Gets hook for the prefixed version, then unprefixed version
6792		hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
6793
6794		// Check if we're setting a value
6795		if ( value !== undefined ) {
6796			type = typeof value;
6797
6798			// Convert "+=" or "-=" to relative numbers (trac-7345)
6799			if ( type === "string" && ( ret = rcssNum.exec( value ) ) && ret[ 1 ] ) {
6800				value = adjustCSS( elem, name, ret );
6801
6802				// Fixes bug trac-9237
6803				type = "number";
6804			}
6805
6806			// Make sure that null and NaN values aren't set (trac-7116)
6807			if ( value == null || value !== value ) {
6808				return;
6809			}
6810
6811			// If a number was passed in, add the unit (except for certain CSS properties)
6812			// The isCustomProp check can be removed in jQuery 4.0 when we only auto-append
6813			// "px" to a few hardcoded values.
6814			if ( type === "number" && !isCustomProp ) {
6815				value += ret && ret[ 3 ] || ( jQuery.cssNumber[ origName ] ? "" : "px" );
6816			}
6817
6818			// background-* props affect original clone's values
6819			if ( !support.clearCloneStyle && value === "" && name.indexOf( "background" ) === 0 ) {
6820				style[ name ] = "inherit";
6821			}
6822
6823			// If a hook was provided, use that value, otherwise just set the specified value
vendor: 16,052 bytes, lines 6824-7428
6824			if ( !hooks || !( "set" in hooks ) ||
6825				( value = hooks.set( elem, value, extra ) ) !== undefined ) {
6826
6827				if ( isCustomProp ) {
6828					style.setProperty( name, value );
6829				} else {
6830					style[ name ] = value;
6831				}
6832			}
6833
6834		} else {
6835
6836			// If a hook was provided get the non-computed value from there
6837			if ( hooks && "get" in hooks &&
6838				( ret = hooks.get( elem, false, extra ) ) !== undefined ) {
6839
6840				return ret;
6841			}
6842
6843			// Otherwise just get the value from the style object
6844			return style[ name ];
6845		}
6846	},
6847
6848	css: function( elem, name, extra, styles ) {
6849		var val, num, hooks,
6850			origName = camelCase( name ),
6851			isCustomProp = rcustomProp.test( name );
6852
6853		// Make sure that we're working with the right name. We don't
6854		// want to modify the value if it is a CSS custom property
6855		// since they are user-defined.
6856		if ( !isCustomProp ) {
6857			name = finalPropName( origName );
6858		}
6859
6860		// Try prefixed name followed by the unprefixed name
6861		hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
6862
6863		// If a hook was provided get the computed value from there
6864		if ( hooks && "get" in hooks ) {
6865			val = hooks.get( elem, true, extra );
6866		}
6867
6868		// Otherwise, if a way to get the computed value exists, use that
6869		if ( val === undefined ) {
6870			val = curCSS( elem, name, styles );
6871		}
6872
6873		// Convert "normal" to computed value
6874		if ( val === "normal" && name in cssNormalTransform ) {
6875			val = cssNormalTransform[ name ];
6876		}
6877
6878		// Make numeric if forced or a qualifier was provided and val looks numeric
6879		if ( extra === "" || extra ) {
6880			num = parseFloat( val );
6881			return extra === true || isFinite( num ) ? num || 0 : val;
6882		}
6883
6884		return val;
6885	}
6886} );
6887
6888jQuery.each( [ "height", "width" ], function( _i, dimension ) {
6889	jQuery.cssHooks[ dimension ] = {
6890		get: function( elem, computed, extra ) {
6891			if ( computed ) {
6892
6893				// Certain elements can have dimension info if we invisibly show them
6894				// but it must have a current display style that would benefit
6895				return rdisplayswap.test( jQuery.css( elem, "display" ) ) &&
6896
6897					// Support: Safari 8+
6898					// Table columns in Safari have non-zero offsetWidth & zero
6899					// getBoundingClientRect().width unless display is changed.
6900					// Support: IE <=11 only
6901					// Running getBoundingClientRect on a disconnected node
6902					// in IE throws an error.
6903					( !elem.getClientRects().length || !elem.getBoundingClientRect().width ) ?
6904					swap( elem, cssShow, function() {
6905						return getWidthOrHeight( elem, dimension, extra );
6906					} ) :
6907					getWidthOrHeight( elem, dimension, extra );
6908			}
6909		},
6910
6911		set: function( elem, value, extra ) {
6912			var matches,
6913				styles = getStyles( elem ),
6914
6915				// Only read styles.position if the test has a chance to fail
6916				// to avoid forcing a reflow.
6917				scrollboxSizeBuggy = !support.scrollboxSize() &&
6918					styles.position === "absolute",
6919
6920				// To avoid forcing a reflow, only fetch boxSizing if we need it (gh-3991)
6921				boxSizingNeeded = scrollboxSizeBuggy || extra,
6922				isBorderBox = boxSizingNeeded &&
6923					jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
6924				subtract = extra ?
6925					boxModelAdjustment(
6926						elem,
6927						dimension,
6928						extra,
6929						isBorderBox,
6930						styles
6931					) :
6932					0;
6933
6934			// Account for unreliable border-box dimensions by comparing offset* to computed and
6935			// faking a content-box to get border and padding (gh-3699)
6936			if ( isBorderBox && scrollboxSizeBuggy ) {
6937				subtract -= Math.ceil(
6938					elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] -
6939					parseFloat( styles[ dimension ] ) -
6940					boxModelAdjustment( elem, dimension, "border", false, styles ) -
6941					0.5
6942				);
6943			}
6944
6945			// Convert to pixels if value adjustment is needed
6946			if ( subtract && ( matches = rcssNum.exec( value ) ) &&
6947				( matches[ 3 ] || "px" ) !== "px" ) {
6948
6949				elem.style[ dimension ] = value;
6950				value = jQuery.css( elem, dimension );
6951			}
6952
6953			return setPositiveNumber( elem, value, subtract );
6954		}
6955	};
6956} );
6957
6958jQuery.cssHooks.marginLeft = addGetHookIf( support.reliableMarginLeft,
6959	function( elem, computed ) {
6960		if ( computed ) {
6961			return ( parseFloat( curCSS( elem, "marginLeft" ) ) ||
6962				elem.getBoundingClientRect().left -
6963					swap( elem, { marginLeft: 0 }, function() {
6964						return elem.getBoundingClientRect().left;
6965					} )
6966			) + "px";
6967		}
6968	}
6969);
6970
6971// These hooks are used by animate to expand properties
6972jQuery.each( {
6973	margin: "",
6974	padding: "",
6975	border: "Width"
6976}, function( prefix, suffix ) {
6977	jQuery.cssHooks[ prefix + suffix ] = {
6978		expand: function( value ) {
6979			var i = 0,
6980				expanded = {},
6981
6982				// Assumes a single number if not a string
6983				parts = typeof value === "string" ? value.split( " " ) : [ value ];
6984
6985			for ( ; i < 4; i++ ) {
6986				expanded[ prefix + cssExpand[ i ] + suffix ] =
6987					parts[ i ] || parts[ i - 2 ] || parts[ 0 ];
6988			}
6989
6990			return expanded;
6991		}
6992	};
6993
6994	if ( prefix !== "margin" ) {
6995		jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber;
6996	}
6997} );
6998
6999jQuery.fn.extend( {
7000	css: function( name, value ) {
7001		return access( this, function( elem, name, value ) {
7002			var styles, len,
7003				map = {},
7004				i = 0;
7005
7006			if ( Array.isArray( name ) ) {
7007				styles = getStyles( elem );
7008				len = name.length;
7009
7010				for ( ; i < len; i++ ) {
7011					map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles );
7012				}
7013
7014				return map;
7015			}
7016
7017			return value !== undefined ?
7018				jQuery.style( elem, name, value ) :
7019				jQuery.css( elem, name );
7020		}, name, value, arguments.length > 1 );
7021	}
7022} );
7023
7024
7025function Tween( elem, options, prop, end, easing ) {
7026	return new Tween.prototype.init( elem, options, prop, end, easing );
7027}
7028jQuery.Tween = Tween;
7029
7030Tween.prototype = {
7031	constructor: Tween,
7032	init: function( elem, options, prop, end, easing, unit ) {
7033		this.elem = elem;
7034		this.prop = prop;
7035		this.easing = easing || jQuery.easing._default;
7036		this.options = options;
7037		this.start = this.now = this.cur();
7038		this.end = end;
7039		this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" );
7040	},
7041	cur: function() {
7042		var hooks = Tween.propHooks[ this.prop ];
7043
7044		return hooks && hooks.get ?
7045			hooks.get( this ) :
7046			Tween.propHooks._default.get( this );
7047	},
7048	run: function( percent ) {
7049		var eased,
7050			hooks = Tween.propHooks[ this.prop ];
7051
7052		if ( this.options.duration ) {
7053			this.pos = eased = jQuery.easing[ this.easing ](
7054				percent, this.options.duration * percent, 0, 1, this.options.duration
7055			);
7056		} else {
7057			this.pos = eased = percent;
7058		}
7059		this.now = ( this.end - this.start ) * eased + this.start;
7060
7061		if ( this.options.step ) {
7062			this.options.step.call( this.elem, this.now, this );
7063		}
7064
7065		if ( hooks && hooks.set ) {
7066			hooks.set( this );
7067		} else {
7068			Tween.propHooks._default.set( this );
7069		}
7070		return this;
7071	}
7072};
7073
7074Tween.prototype.init.prototype = Tween.prototype;
7075
7076Tween.propHooks = {
7077	_default: {
7078		get: function( tween ) {
7079			var result;
7080
7081			// Use a property on the element directly when it is not a DOM element,
7082			// or when there is no matching style property that exists.
7083			if ( tween.elem.nodeType !== 1 ||
7084				tween.elem[ tween.prop ] != null && tween.elem.style[ tween.prop ] == null ) {
7085				return tween.elem[ tween.prop ];
7086			}
7087
7088			// Passing an empty string as a 3rd parameter to .css will automatically
7089			// attempt a parseFloat and fallback to a string if the parse fails.
7090			// Simple values such as "10px" are parsed to Float;
7091			// complex values such as "rotate(1rad)" are returned as-is.
7092			result = jQuery.css( tween.elem, tween.prop, "" );
7093
7094			// Empty strings, null, undefined and "auto" are converted to 0.
7095			return !result || result === "auto" ? 0 : result;
7096		},
7097		set: function( tween ) {
7098
7099			// Use step hook for back compat.
7100			// Use cssHook if its there.
7101			// Use .style if available and use plain properties where available.
7102			if ( jQuery.fx.step[ tween.prop ] ) {
7103				jQuery.fx.step[ tween.prop ]( tween );
7104			} else if ( tween.elem.nodeType === 1 && (
7105				jQuery.cssHooks[ tween.prop ] ||
7106					tween.elem.style[ finalPropName( tween.prop ) ] != null ) ) {
7107				jQuery.style( tween.elem, tween.prop, tween.now + tween.unit );
7108			} else {
7109				tween.elem[ tween.prop ] = tween.now;
7110			}
7111		}
7112	}
7113};
7114
7115// Support: IE <=9 only
7116// Panic based approach to setting things on disconnected nodes
7117Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {
7118	set: function( tween ) {
7119		if ( tween.elem.nodeType && tween.elem.parentNode ) {
7120			tween.elem[ tween.prop ] = tween.now;
7121		}
7122	}
7123};
7124
7125jQuery.easing = {
7126	linear: function( p ) {
7127		return p;
7128	},
7129	swing: function( p ) {
7130		return 0.5 - Math.cos( p * Math.PI ) / 2;
7131	},
7132	_default: "swing"
7133};
7134
7135jQuery.fx = Tween.prototype.init;
7136
7137// Back compat <1.8 extension point
7138jQuery.fx.step = {};
7139
7140
7141
7142
7143var
7144	fxNow, inProgress,
7145	rfxtypes = /^(?:toggle|show|hide)$/,
7146	rrun = /queueHooks$/;
7147
7148function schedule() {
7149	if ( inProgress ) {
7150		if ( document.hidden === false && window.requestAnimationFrame ) {
7151			window.requestAnimationFrame( schedule );
7152		} else {
7153			window.setTimeout( schedule, jQuery.fx.interval );
7154		}
7155
7156		jQuery.fx.tick();
7157	}
7158}
7159
7160// Animations created synchronously will run synchronously
7161function createFxNow() {
7162	window.setTimeout( function() {
7163		fxNow = undefined;
7164	} );
7165	return ( fxNow = Date.now() );
7166}
7167
7168// Generate parameters to create a standard animation
7169function genFx( type, includeWidth ) {
7170	var which,
7171		i = 0,
7172		attrs = { height: type };
7173
7174	// If we include width, step value is 1 to do all cssExpand values,
7175	// otherwise step value is 2 to skip over Left and Right
7176	includeWidth = includeWidth ? 1 : 0;
7177	for ( ; i < 4; i += 2 - includeWidth ) {
7178		which = cssExpand[ i ];
7179		attrs[ "margin" + which ] = attrs[ "padding" + which ] = type;
7180	}
7181
7182	if ( includeWidth ) {
7183		attrs.opacity = attrs.width = type;
7184	}
7185
7186	return attrs;
7187}
7188
7189function createTween( value, prop, animation ) {
7190	var tween,
7191		collection = ( Animation.tweeners[ prop ] || [] ).concat( Animation.tweeners[ "*" ] ),
7192		index = 0,
7193		length = collection.length;
7194	for ( ; index < length; index++ ) {
7195		if ( ( tween = collection[ index ].call( animation, prop, value ) ) ) {
7196
7197			// We're done with this property
7198			return tween;
7199		}
7200	}
7201}
7202
7203function defaultPrefilter( elem, props, opts ) {
7204	var prop, value, toggle, hooks, oldfire, propTween, restoreDisplay, display,
7205		isBox = "width" in props || "height" in props,
7206		anim = this,
7207		orig = {},
7208		style = elem.style,
7209		hidden = elem.nodeType && isHiddenWithinTree( elem ),
7210		dataShow = dataPriv.get( elem, "fxshow" );
7211
7212	// Queue-skipping animations hijack the fx hooks
7213	if ( !opts.queue ) {
7214		hooks = jQuery._queueHooks( elem, "fx" );
7215		if ( hooks.unqueued == null ) {
7216			hooks.unqueued = 0;
7217			oldfire = hooks.empty.fire;
7218			hooks.empty.fire = function() {
7219				if ( !hooks.unqueued ) {
7220					oldfire();
7221				}
7222			};
7223		}
7224		hooks.unqueued++;
7225
7226		anim.always( function() {
7227
7228			// Ensure the complete handler is called before this completes
7229			anim.always( function() {
7230				hooks.unqueued--;
7231				if ( !jQuery.queue( elem, "fx" ).length ) {
7232					hooks.empty.fire();
7233				}
7234			} );
7235		} );
7236	}
7237
7238	// Detect show/hide animations
7239	for ( prop in props ) {
7240		value = props[ prop ];
7241		if ( rfxtypes.test( value ) ) {
7242			delete props[ prop ];
7243			toggle = toggle || value === "toggle";
7244			if ( value === ( hidden ? "hide" : "show" ) ) {
7245
7246				// Pretend to be hidden if this is a "show" and
7247				// there is still data from a stopped show/hide
7248				if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) {
7249					hidden = true;
7250
7251				// Ignore all other no-op show/hide data
7252				} else {
7253					continue;
7254				}
7255			}
7256			orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop );
7257		}
7258	}
7259
7260	// Bail out if this is a no-op like .hide().hide()
7261	propTween = !jQuery.isEmptyObject( props );
7262	if ( !propTween && jQuery.isEmptyObject( orig ) ) {
7263		return;
7264	}
7265
7266	// Restrict "overflow" and "display" styles during box animations
7267	if ( isBox && elem.nodeType === 1 ) {
7268
7269		// Support: IE <=9 - 11, Edge 12 - 15
7270		// Record all 3 overflow attributes because IE does not infer the shorthand
7271		// from identically-valued overflowX and overflowY and Edge just mirrors
7272		// the overflowX value there.
7273		opts.overflow = [ style.overflow, style.overflowX, style.overflowY ];
7274
7275		// Identify a display type, preferring old show/hide data over the CSS cascade
7276		restoreDisplay = dataShow && dataShow.display;
7277		if ( restoreDisplay == null ) {
7278			restoreDisplay = dataPriv.get( elem, "display" );
7279		}
7280		display = jQuery.css( elem, "display" );
7281		if ( display === "none" ) {
7282			if ( restoreDisplay ) {
7283				display = restoreDisplay;
7284			} else {
7285
7286				// Get nonempty value(s) by temporarily forcing visibility
7287				showHide( [ elem ], true );
7288				restoreDisplay = elem.style.display || restoreDisplay;
7289				display = jQuery.css( elem, "display" );
7290				showHide( [ elem ] );
7291			}
7292		}
7293
7294		// Animate inline elements as inline-block
7295		if ( display === "inline" || display === "inline-block" && restoreDisplay != null ) {
7296			if ( jQuery.css( elem, "float" ) === "none" ) {
7297
7298				// Restore the original display value at the end of pure show/hide animations
7299				if ( !propTween ) {
7300					anim.done( function() {
7301						style.display = restoreDisplay;
7302					} );
7303					if ( restoreDisplay == null ) {
7304						display = style.display;
7305						restoreDisplay = display === "none" ? "" : display;
7306					}
7307				}
7308				style.display = "inline-block";
7309			}
7310		}
7311	}
7312
7313	if ( opts.overflow ) {
7314		style.overflow = "hidden";
7315		anim.always( function() {
7316			style.overflow = opts.overflow[ 0 ];
7317			style.overflowX = opts.overflow[ 1 ];
7318			style.overflowY = opts.overflow[ 2 ];
7319		} );
7320	}
7321
7322	// Implement show/hide animations
7323	propTween = false;
7324	for ( prop in orig ) {
7325
7326		// General show/hide setup for this element animation
7327		if ( !propTween ) {
7328			if ( dataShow ) {
7329				if ( "hidden" in dataShow ) {
7330					hidden = dataShow.hidden;
7331				}
7332			} else {
7333				dataShow = dataPriv.access( elem, "fxshow", { display: restoreDisplay } );
7334			}
7335
7336			// Store hidden/visible for toggle so `.stop().toggle()` "reverses"
7337			if ( toggle ) {
7338				dataShow.hidden = !hidden;
7339			}
7340
7341			// Show elements before animating them
7342			if ( hidden ) {
7343				showHide( [ elem ], true );
7344			}
7345
7346			/* eslint-disable no-loop-func */
7347
7348			anim.done( function() {
7349
7350				/* eslint-enable no-loop-func */
7351
7352				// The final step of a "hide" animation is actually hiding the element
7353				if ( !hidden ) {
7354					showHide( [ elem ] );
7355				}
7356				dataPriv.remove( elem, "fxshow" );
7357				for ( prop in orig ) {
7358					jQuery.style( elem, prop, orig[ prop ] );
7359				}
7360			} );
7361		}
7362
7363		// Per-property setup
7364		propTween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim );
7365		if ( !( prop in dataShow ) ) {
7366			dataShow[ prop ] = propTween.start;
7367			if ( hidden ) {
7368				propTween.end = propTween.start;
7369				propTween.start = 0;
7370			}
7371		}
7372	}
7373}
7374
7375function propFilter( props, specialEasing ) {
7376	var index, name, easing, value, hooks;
7377
7378	// camelCase, specialEasing and expand cssHook pass
7379	for ( index in props ) {
7380		name = camelCase( index );
7381		easing = specialEasing[ name ];
7382		value = props[ index ];
7383		if ( Array.isArray( value ) ) {
7384			easing = value[ 1 ];
7385			value = props[ index ] = value[ 0 ];
7386		}
7387
7388		if ( index !== name ) {
7389			props[ name ] = value;
7390			delete props[ index ];
7391		}
7392
7393		hooks = jQuery.cssHooks[ name ];
7394		if ( hooks && "expand" in hooks ) {
7395			value = hooks.expand( value );
7396			delete props[ name ];
7397
7398			// Not quite $.extend, this won't overwrite existing keys.
7399			// Reusing 'index' because we have the correct "name"
7400			for ( index in value ) {
7401				if ( !( index in props ) ) {
7402					props[ index ] = value[ index ];
7403					specialEasing[ index ] = easing;
7404				}
7405			}
7406		} else {
7407			specialEasing[ name ] = easing;
7408		}
7409	}
7410}
7411
7412function Animation( elem, properties, options ) {
7413	var result,
7414		stopped,
7415		index = 0,
7416		length = Animation.prefilters.length,
7417		deferred = jQuery.Deferred().always( function() {
7418
7419			// Don't match elem in the :animated selector
7420			delete tick.elem;
7421		} ),
7422		tick = function() {
7423			if ( stopped ) {
7424				return false;
7425			}
7426			var currentTime = fxNow || createFxNow(),
7427				remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ),
7428
vendor: 9,542 bytes, lines 7429-7819
7429				// Support: Android 2.3 only
7430				// Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (trac-12497)
7431				temp = remaining / animation.duration || 0,
7432				percent = 1 - temp,
7433				index = 0,
7434				length = animation.tweens.length;
7435
7436			for ( ; index < length; index++ ) {
7437				animation.tweens[ index ].run( percent );
7438			}
7439
7440			deferred.notifyWith( elem, [ animation, percent, remaining ] );
7441
7442			// If there's more to do, yield
7443			if ( percent < 1 && length ) {
7444				return remaining;
7445			}
7446
7447			// If this was an empty animation, synthesize a final progress notification
7448			if ( !length ) {
7449				deferred.notifyWith( elem, [ animation, 1, 0 ] );
7450			}
7451
7452			// Resolve the animation and report its conclusion
7453			deferred.resolveWith( elem, [ animation ] );
7454			return false;
7455		},
7456		animation = deferred.promise( {
7457			elem: elem,
7458			props: jQuery.extend( {}, properties ),
7459			opts: jQuery.extend( true, {
7460				specialEasing: {},
7461				easing: jQuery.easing._default
7462			}, options ),
7463			originalProperties: properties,
7464			originalOptions: options,
7465			startTime: fxNow || createFxNow(),
7466			duration: options.duration,
7467			tweens: [],
7468			createTween: function( prop, end ) {
7469				var tween = jQuery.Tween( elem, animation.opts, prop, end,
7470					animation.opts.specialEasing[ prop ] || animation.opts.easing );
7471				animation.tweens.push( tween );
7472				return tween;
7473			},
7474			stop: function( gotoEnd ) {
7475				var index = 0,
7476
7477					// If we are going to the end, we want to run all the tweens
7478					// otherwise we skip this part
7479					length = gotoEnd ? animation.tweens.length : 0;
7480				if ( stopped ) {
7481					return this;
7482				}
7483				stopped = true;
7484				for ( ; index < length; index++ ) {
7485					animation.tweens[ index ].run( 1 );
7486				}
7487
7488				// Resolve when we played the last frame; otherwise, reject
7489				if ( gotoEnd ) {
7490					deferred.notifyWith( elem, [ animation, 1, 0 ] );
7491					deferred.resolveWith( elem, [ animation, gotoEnd ] );
7492				} else {
7493					deferred.rejectWith( elem, [ animation, gotoEnd ] );
7494				}
7495				return this;
7496			}
7497		} ),
7498		props = animation.props;
7499
7500	propFilter( props, animation.opts.specialEasing );
7501
7502	for ( ; index < length; index++ ) {
7503		result = Animation.prefilters[ index ].call( animation, elem, props, animation.opts );
7504		if ( result ) {
7505			if ( isFunction( result.stop ) ) {
7506				jQuery._queueHooks( animation.elem, animation.opts.queue ).stop =
7507					result.stop.bind( result );
7508			}
7509			return result;
7510		}
7511	}
7512
7513	jQuery.map( props, createTween, animation );
7514
7515	if ( isFunction( animation.opts.start ) ) {
7516		animation.opts.start.call( elem, animation );
7517	}
7518
7519	// Attach callbacks from options
7520	animation
7521		.progress( animation.opts.progress )
7522		.done( animation.opts.done, animation.opts.complete )
7523		.fail( animation.opts.fail )
7524		.always( animation.opts.always );
7525
7526	jQuery.fx.timer(
7527		jQuery.extend( tick, {
7528			elem: elem,
7529			anim: animation,
7530			queue: animation.opts.queue
7531		} )
7532	);
7533
7534	return animation;
7535}
7536
7537jQuery.Animation = jQuery.extend( Animation, {
7538
7539	tweeners: {
7540		"*": [ function( prop, value ) {
7541			var tween = this.createTween( prop, value );
7542			adjustCSS( tween.elem, prop, rcssNum.exec( value ), tween );
7543			return tween;
7544		} ]
7545	},
7546
7547	tweener: function( props, callback ) {
7548		if ( isFunction( props ) ) {
7549			callback = props;
7550			props = [ "*" ];
7551		} else {
7552			props = props.match( rnothtmlwhite );
7553		}
7554
7555		var prop,
7556			index = 0,
7557			length = props.length;
7558
7559		for ( ; index < length; index++ ) {
7560			prop = props[ index ];
7561			Animation.tweeners[ prop ] = Animation.tweeners[ prop ] || [];
7562			Animation.tweeners[ prop ].unshift( callback );
7563		}
7564	},
7565
7566	prefilters: [ defaultPrefilter ],
7567
7568	prefilter: function( callback, prepend ) {
7569		if ( prepend ) {
7570			Animation.prefilters.unshift( callback );
7571		} else {
7572			Animation.prefilters.push( callback );
7573		}
7574	}
7575} );
7576
7577jQuery.speed = function( speed, easing, fn ) {
7578	var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : {
7579		complete: fn || !fn && easing ||
7580			isFunction( speed ) && speed,
7581		duration: speed,
7582		easing: fn && easing || easing && !isFunction( easing ) && easing
7583	};
7584
7585	// Go to the end state if fx are off
7586	if ( jQuery.fx.off ) {
7587		opt.duration = 0;
7588
7589	} else {
7590		if ( typeof opt.duration !== "number" ) {
7591			if ( opt.duration in jQuery.fx.speeds ) {
7592				opt.duration = jQuery.fx.speeds[ opt.duration ];
7593
7594			} else {
7595				opt.duration = jQuery.fx.speeds._default;
7596			}
7597		}
7598	}
7599
7600	// Normalize opt.queue - true/undefined/null -> "fx"
7601	if ( opt.queue == null || opt.queue === true ) {
7602		opt.queue = "fx";
7603	}
7604
7605	// Queueing
7606	opt.old = opt.complete;
7607
7608	opt.complete = function() {
7609		if ( isFunction( opt.old ) ) {
7610			opt.old.call( this );
7611		}
7612
7613		if ( opt.queue ) {
7614			jQuery.dequeue( this, opt.queue );
7615		}
7616	};
7617
7618	return opt;
7619};
7620
7621jQuery.fn.extend( {
7622	fadeTo: function( speed, to, easing, callback ) {
7623
7624		// Show any hidden elements after setting opacity to 0
7625		return this.filter( isHiddenWithinTree ).css( "opacity", 0 ).show()
7626
7627			// Animate to the value specified
7628			.end().animate( { opacity: to }, speed, easing, callback );
7629	},
7630	animate: function( prop, speed, easing, callback ) {
7631		var empty = jQuery.isEmptyObject( prop ),
7632			optall = jQuery.speed( speed, easing, callback ),
7633			doAnimation = function() {
7634
7635				// Operate on a copy of prop so per-property easing won't be lost
7636				var anim = Animation( this, jQuery.extend( {}, prop ), optall );
7637
7638				// Empty animations, or finishing resolves immediately
7639				if ( empty || dataPriv.get( this, "finish" ) ) {
7640					anim.stop( true );
7641				}
7642			};
7643
7644		doAnimation.finish = doAnimation;
7645
7646		return empty || optall.queue === false ?
7647			this.each( doAnimation ) :
7648			this.queue( optall.queue, doAnimation );
7649	},
7650	stop: function( type, clearQueue, gotoEnd ) {
7651		var stopQueue = function( hooks ) {
7652			var stop = hooks.stop;
7653			delete hooks.stop;
7654			stop( gotoEnd );
7655		};
7656
7657		if ( typeof type !== "string" ) {
7658			gotoEnd = clearQueue;
7659			clearQueue = type;
7660			type = undefined;
7661		}
7662		if ( clearQueue ) {
7663			this.queue( type || "fx", [] );
7664		}
7665
7666		return this.each( function() {
7667			var dequeue = true,
7668				index = type != null && type + "queueHooks",
7669				timers = jQuery.timers,
7670				data = dataPriv.get( this );
7671
7672			if ( index ) {
7673				if ( data[ index ] && data[ index ].stop ) {
7674					stopQueue( data[ index ] );
7675				}
7676			} else {
7677				for ( index in data ) {
7678					if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) {
7679						stopQueue( data[ index ] );
7680					}
7681				}
7682			}
7683
7684			for ( index = timers.length; index--; ) {
7685				if ( timers[ index ].elem === this &&
7686					( type == null || timers[ index ].queue === type ) ) {
7687
7688					timers[ index ].anim.stop( gotoEnd );
7689					dequeue = false;
7690					timers.splice( index, 1 );
7691				}
7692			}
7693
7694			// Start the next in the queue if the last step wasn't forced.
7695			// Timers currently will call their complete callbacks, which
7696			// will dequeue but only if they were gotoEnd.
7697			if ( dequeue || !gotoEnd ) {
7698				jQuery.dequeue( this, type );
7699			}
7700		} );
7701	},
7702	finish: function( type ) {
7703		if ( type !== false ) {
7704			type = type || "fx";
7705		}
7706		return this.each( function() {
7707			var index,
7708				data = dataPriv.get( this ),
7709				queue = data[ type + "queue" ],
7710				hooks = data[ type + "queueHooks" ],
7711				timers = jQuery.timers,
7712				length = queue ? queue.length : 0;
7713
7714			// Enable finishing flag on private data
7715			data.finish = true;
7716
7717			// Empty the queue first
7718			jQuery.queue( this, type, [] );
7719
7720			if ( hooks && hooks.stop ) {
7721				hooks.stop.call( this, true );
7722			}
7723
7724			// Look for any active animations, and finish them
7725			for ( index = timers.length; index--; ) {
7726				if ( timers[ index ].elem === this && timers[ index ].queue === type ) {
7727					timers[ index ].anim.stop( true );
7728					timers.splice( index, 1 );
7729				}
7730			}
7731
7732			// Look for any animations in the old queue and finish them
7733			for ( index = 0; index < length; index++ ) {
7734				if ( queue[ index ] && queue[ index ].finish ) {
7735					queue[ index ].finish.call( this );
7736				}
7737			}
7738
7739			// Turn off finishing flag
7740			delete data.finish;
7741		} );
7742	}
7743} );
7744
7745jQuery.each( [ "toggle", "show", "hide" ], function( _i, name ) {
7746	var cssFn = jQuery.fn[ name ];
7747	jQuery.fn[ name ] = function( speed, easing, callback ) {
7748		return speed == null || typeof speed === "boolean" ?
7749			cssFn.apply( this, arguments ) :
7750			this.animate( genFx( name, true ), speed, easing, callback );
7751	};
7752} );
7753
7754// Generate shortcuts for custom animations
7755jQuery.each( {
7756	slideDown: genFx( "show" ),
7757	slideUp: genFx( "hide" ),
7758	slideToggle: genFx( "toggle" ),
7759	fadeIn: { opacity: "show" },
7760	fadeOut: { opacity: "hide" },
7761	fadeToggle: { opacity: "toggle" }
7762}, function( name, props ) {
7763	jQuery.fn[ name ] = function( speed, easing, callback ) {
7764		return this.animate( props, speed, easing, callback );
7765	};
7766} );
7767
7768jQuery.timers = [];
7769jQuery.fx.tick = function() {
7770	var timer,
7771		i = 0,
7772		timers = jQuery.timers;
7773
7774	fxNow = Date.now();
7775
7776	for ( ; i < timers.length; i++ ) {
7777		timer = timers[ i ];
7778
7779		// Run the timer and safely remove it when done (allowing for external removal)
7780		if ( !timer() && timers[ i ] === timer ) {
7781			timers.splice( i--, 1 );
7782		}
7783	}
7784
7785	if ( !timers.length ) {
7786		jQuery.fx.stop();
7787	}
7788	fxNow = undefined;
7789};
7790
7791jQuery.fx.timer = function( timer ) {
7792	jQuery.timers.push( timer );
7793	jQuery.fx.start();
7794};
7795
7796jQuery.fx.interval = 13;
7797jQuery.fx.start = function() {
7798	if ( inProgress ) {
7799		return;
7800	}
7801
7802	inProgress = true;
7803	schedule();
7804};
7805
7806jQuery.fx.stop = function() {
7807	inProgress = null;
7808};
7809
7810jQuery.fx.speeds = {
7811	slow: 600,
7812	fast: 200,
7813
7814	// Default speed
7815	_default: 400
7816};
7817
7818
7819// Based off of the plugin by Clint Helfers, with permission.
vendor: 5,177 bytes, lines 7820-8040
7820jQuery.fn.delay = function( time, type ) {
7821	time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time;
7822	type = type || "fx";
7823
7824	return this.queue( type, function( next, hooks ) {
7825		var timeout = window.setTimeout( next, time );
7826		hooks.stop = function() {
7827			window.clearTimeout( timeout );
7828		};
7829	} );
7830};
7831
7832
7833( function() {
7834	var input = document.createElement( "input" ),
7835		select = document.createElement( "select" ),
7836		opt = select.appendChild( document.createElement( "option" ) );
7837
7838	input.type = "checkbox";
7839
7840	// Support: Android <=4.3 only
7841	// Default value for a checkbox should be "on"
7842	support.checkOn = input.value !== "";
7843
7844	// Support: IE <=11 only
7845	// Must access selectedIndex to make default options select
7846	support.optSelected = opt.selected;
7847
7848	// Support: IE <=11 only
7849	// An input loses its value after becoming a radio
7850	input = document.createElement( "input" );
7851	input.value = "t";
7852	input.type = "radio";
7853	support.radioValue = input.value === "t";
7854} )();
7855
7856
7857var boolHook,
7858	attrHandle = jQuery.expr.attrHandle;
7859
7860jQuery.fn.extend( {
7861	attr: function( name, value ) {
7862		return access( this, jQuery.attr, name, value, arguments.length > 1 );
7863	},
7864
7865	removeAttr: function( name ) {
7866		return this.each( function() {
7867			jQuery.removeAttr( this, name );
7868		} );
7869	}
7870} );
7871
7872jQuery.extend( {
7873	attr: function( elem, name, value ) {
7874		var ret, hooks,
7875			nType = elem.nodeType;
7876
7877		// Don't get/set attributes on text, comment and attribute nodes
7878		if ( nType === 3 || nType === 8 || nType === 2 ) {
7879			return;
7880		}
7881
7882		// Fallback to prop when attributes are not supported
7883		if ( typeof elem.getAttribute === "undefined" ) {
7884			return jQuery.prop( elem, name, value );
7885		}
7886
7887		// Attribute hooks are determined by the lowercase version
7888		// Grab necessary hook if one is defined
7889		if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
7890			hooks = jQuery.attrHooks[ name.toLowerCase() ] ||
7891				( jQuery.expr.match.bool.test( name ) ? boolHook : undefined );
7892		}
7893
7894		if ( value !== undefined ) {
7895			if ( value === null ) {
7896				jQuery.removeAttr( elem, name );
7897				return;
7898			}
7899
7900			if ( hooks && "set" in hooks &&
7901				( ret = hooks.set( elem, value, name ) ) !== undefined ) {
7902				return ret;
7903			}
7904
7905			elem.setAttribute( name, value + "" );
7906			return value;
7907		}
7908
7909		if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
7910			return ret;
7911		}
7912
7913		ret = jQuery.find.attr( elem, name );
7914
7915		// Non-existent attributes return null, we normalize to undefined
7916		return ret == null ? undefined : ret;
7917	},
7918
7919	attrHooks: {
7920		type: {
7921			set: function( elem, value ) {
7922				if ( !support.radioValue && value === "radio" &&
7923					nodeName( elem, "input" ) ) {
7924					var val = elem.value;
7925					elem.setAttribute( "type", value );
7926					if ( val ) {
7927						elem.value = val;
7928					}
7929					return value;
7930				}
7931			}
7932		}
7933	},
7934
7935	removeAttr: function( elem, value ) {
7936		var name,
7937			i = 0,
7938
7939			// Attribute names can contain non-HTML whitespace characters
7940			// https://html.spec.whatwg.org/multipage/syntax.html#attributes-2
7941			attrNames = value && value.match( rnothtmlwhite );
7942
7943		if ( attrNames && elem.nodeType === 1 ) {
7944			while ( ( name = attrNames[ i++ ] ) ) {
7945				elem.removeAttribute( name );
7946			}
7947		}
7948	}
7949} );
7950
7951// Hooks for boolean attributes
7952boolHook = {
7953	set: function( elem, value, name ) {
7954		if ( value === false ) {
7955
7956			// Remove boolean attributes when set to false
7957			jQuery.removeAttr( elem, name );
7958		} else {
7959			elem.setAttribute( name, name );
7960		}
7961		return name;
7962	}
7963};
7964
7965jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( _i, name ) {
7966	var getter = attrHandle[ name ] || jQuery.find.attr;
7967
7968	attrHandle[ name ] = function( elem, name, isXML ) {
7969		var ret, handle,
7970			lowercaseName = name.toLowerCase();
7971
7972		if ( !isXML ) {
7973
7974			// Avoid an infinite loop by temporarily removing this function from the getter
7975			handle = attrHandle[ lowercaseName ];
7976			attrHandle[ lowercaseName ] = ret;
7977			ret = getter( elem, name, isXML ) != null ?
7978				lowercaseName :
7979				null;
7980			attrHandle[ lowercaseName ] = handle;
7981		}
7982		return ret;
7983	};
7984} );
7985
7986
7987
7988
7989var rfocusable = /^(?:input|select|textarea|button)$/i,
7990	rclickable = /^(?:a|area)$/i;
7991
7992jQuery.fn.extend( {
7993	prop: function( name, value ) {
7994		return access( this, jQuery.prop, name, value, arguments.length > 1 );
7995	},
7996
7997	removeProp: function( name ) {
7998		return this.each( function() {
7999			delete this[ jQuery.propFix[ name ] || name ];
8000		} );
8001	}
8002} );
8003
8004jQuery.extend( {
8005	prop: function( elem, name, value ) {
8006		var ret, hooks,
8007			nType = elem.nodeType;
8008
8009		// Don't get/set properties on text, comment and attribute nodes
8010		if ( nType === 3 || nType === 8 || nType === 2 ) {
8011			return;
8012		}
8013
8014		if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
8015
8016			// Fix name and attach hooks
8017			name = jQuery.propFix[ name ] || name;
8018			hooks = jQuery.propHooks[ name ];
8019		}
8020
8021		if ( value !== undefined ) {
8022			if ( hooks && "set" in hooks &&
8023				( ret = hooks.set( elem, value, name ) ) !== undefined ) {
8024				return ret;
8025			}
8026
8027			return ( elem[ name ] = value );
8028		}
8029
8030		if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
8031			return ret;
8032		}
8033
8034		return elem[ name ];
8035	},
8036
8037	propHooks: {
8038		tabIndex: {
8039			get: function( elem ) {
8040
vendor: 6,126 bytes, lines 8041-8300
8041				// Support: IE <=9 - 11 only
8042				// elem.tabIndex doesn't always return the
8043				// correct value when it hasn't been explicitly set
8044				// Use proper attribute retrieval (trac-12072)
8045				var tabindex = jQuery.find.attr( elem, "tabindex" );
8046
8047				if ( tabindex ) {
8048					return parseInt( tabindex, 10 );
8049				}
8050
8051				if (
8052					rfocusable.test( elem.nodeName ) ||
8053					rclickable.test( elem.nodeName ) &&
8054					elem.href
8055				) {
8056					return 0;
8057				}
8058
8059				return -1;
8060			}
8061		}
8062	},
8063
8064	propFix: {
8065		"for": "htmlFor",
8066		"class": "className"
8067	}
8068} );
8069
8070// Support: IE <=11 only
8071// Accessing the selectedIndex property
8072// forces the browser to respect setting selected
8073// on the option
8074// The getter ensures a default option is selected
8075// when in an optgroup
8076// eslint rule "no-unused-expressions" is disabled for this code
8077// since it considers such accessions noop
8078if ( !support.optSelected ) {
8079	jQuery.propHooks.selected = {
8080		get: function( elem ) {
8081
8082			/* eslint no-unused-expressions: "off" */
8083
8084			var parent = elem.parentNode;
8085			if ( parent && parent.parentNode ) {
8086				parent.parentNode.selectedIndex;
8087			}
8088			return null;
8089		},
8090		set: function( elem ) {
8091
8092			/* eslint no-unused-expressions: "off" */
8093
8094			var parent = elem.parentNode;
8095			if ( parent ) {
8096				parent.selectedIndex;
8097
8098				if ( parent.parentNode ) {
8099					parent.parentNode.selectedIndex;
8100				}
8101			}
8102		}
8103	};
8104}
8105
8106jQuery.each( [
8107	"tabIndex",
8108	"readOnly",
8109	"maxLength",
8110	"cellSpacing",
8111	"cellPadding",
8112	"rowSpan",
8113	"colSpan",
8114	"useMap",
8115	"frameBorder",
8116	"contentEditable"
8117], function() {
8118	jQuery.propFix[ this.toLowerCase() ] = this;
8119} );
8120
8121
8122
8123
8124	// Strip and collapse whitespace according to HTML spec
8125	// https://infra.spec.whatwg.org/#strip-and-collapse-ascii-whitespace
8126	function stripAndCollapse( value ) {
8127		var tokens = value.match( rnothtmlwhite ) || [];
8128		return tokens.join( " " );
8129	}
8130
8131
8132function getClass( elem ) {
8133	return elem.getAttribute && elem.getAttribute( "class" ) || "";
8134}
8135
8136function classesToArray( value ) {
8137	if ( Array.isArray( value ) ) {
8138		return value;
8139	}
8140	if ( typeof value === "string" ) {
8141		return value.match( rnothtmlwhite ) || [];
8142	}
8143	return [];
8144}
8145
8146jQuery.fn.extend( {
8147	addClass: function( value ) {
8148		var classNames, cur, curValue, className, i, finalValue;
8149
8150		if ( isFunction( value ) ) {
8151			return this.each( function( j ) {
8152				jQuery( this ).addClass( value.call( this, j, getClass( this ) ) );
8153			} );
8154		}
8155
8156		classNames = classesToArray( value );
8157
8158		if ( classNames.length ) {
8159			return this.each( function() {
8160				curValue = getClass( this );
8161				cur = this.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
8162
8163				if ( cur ) {
8164					for ( i = 0; i < classNames.length; i++ ) {
8165						className = classNames[ i ];
8166						if ( cur.indexOf( " " + className + " " ) < 0 ) {
8167							cur += className + " ";
8168						}
8169					}
8170
8171					// Only assign if different to avoid unneeded rendering.
8172					finalValue = stripAndCollapse( cur );
8173					if ( curValue !== finalValue ) {
8174						this.setAttribute( "class", finalValue );
8175					}
8176				}
8177			} );
8178		}
8179
8180		return this;
8181	},
8182
8183	removeClass: function( value ) {
8184		var classNames, cur, curValue, className, i, finalValue;
8185
8186		if ( isFunction( value ) ) {
8187			return this.each( function( j ) {
8188				jQuery( this ).removeClass( value.call( this, j, getClass( this ) ) );
8189			} );
8190		}
8191
8192		if ( !arguments.length ) {
8193			return this.attr( "class", "" );
8194		}
8195
8196		classNames = classesToArray( value );
8197
8198		if ( classNames.length ) {
8199			return this.each( function() {
8200				curValue = getClass( this );
8201
8202				// This expression is here for better compressibility (see addClass)
8203				cur = this.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
8204
8205				if ( cur ) {
8206					for ( i = 0; i < classNames.length; i++ ) {
8207						className = classNames[ i ];
8208
8209						// Remove *all* instances
8210						while ( cur.indexOf( " " + className + " " ) > -1 ) {
8211							cur = cur.replace( " " + className + " ", " " );
8212						}
8213					}
8214
8215					// Only assign if different to avoid unneeded rendering.
8216					finalValue = stripAndCollapse( cur );
8217					if ( curValue !== finalValue ) {
8218						this.setAttribute( "class", finalValue );
8219					}
8220				}
8221			} );
8222		}
8223
8224		return this;
8225	},
8226
8227	toggleClass: function( value, stateVal ) {
8228		var classNames, className, i, self,
8229			type = typeof value,
8230			isValidValue = type === "string" || Array.isArray( value );
8231
8232		if ( isFunction( value ) ) {
8233			return this.each( function( i ) {
8234				jQuery( this ).toggleClass(
8235					value.call( this, i, getClass( this ), stateVal ),
8236					stateVal
8237				);
8238			} );
8239		}
8240
8241		if ( typeof stateVal === "boolean" && isValidValue ) {
8242			return stateVal ? this.addClass( value ) : this.removeClass( value );
8243		}
8244
8245		classNames = classesToArray( value );
8246
8247		return this.each( function() {
8248			if ( isValidValue ) {
8249
8250				// Toggle individual class names
8251				self = jQuery( this );
8252
8253				for ( i = 0; i < classNames.length; i++ ) {
8254					className = classNames[ i ];
8255
8256					// Check each className given, space separated list
8257					if ( self.hasClass( className ) ) {
8258						self.removeClass( className );
8259					} else {
8260						self.addClass( className );
8261					}
8262				}
8263
8264			// Toggle whole class name
8265			} else if ( value === undefined || type === "boolean" ) {
8266				className = getClass( this );
8267				if ( className ) {
8268
8269					// Store className if set
8270					dataPriv.set( this, "__className__", className );
8271				}
8272
8273				// If the element has a class name or if we're passed `false`,
8274				// then remove the whole classname (if there was one, the above saved it).
8275				// Otherwise bring back whatever was previously saved (if anything),
8276				// falling back to the empty string if nothing was stored.
8277				if ( this.setAttribute ) {
8278					this.setAttribute( "class",
8279						className || value === false ?
8280							"" :
8281							dataPriv.get( this, "__className__" ) || ""
8282					);
8283				}
8284			}
8285		} );
8286	},
8287
8288	hasClass: function( selector ) {
8289		var className, elem,
8290			i = 0;
8291
8292		className = " " + selector + " ";
8293		while ( ( elem = this[ i++ ] ) ) {
8294			if ( elem.nodeType === 1 &&
8295				( " " + stripAndCollapse( getClass( elem ) ) + " " ).indexOf( className ) > -1 ) {
8296				return true;
8297			}
8298		}
8299
8300		return false;
vendor: 1,385 bytes, lines 8301-8370
8301	}
8302} );
8303
8304
8305
8306
8307var rreturn = /\r/g;
8308
8309jQuery.fn.extend( {
8310	val: function( value ) {
8311		var hooks, ret, valueIsFunction,
8312			elem = this[ 0 ];
8313
8314		if ( !arguments.length ) {
8315			if ( elem ) {
8316				hooks = jQuery.valHooks[ elem.type ] ||
8317					jQuery.valHooks[ elem.nodeName.toLowerCase() ];
8318
8319				if ( hooks &&
8320					"get" in hooks &&
8321					( ret = hooks.get( elem, "value" ) ) !== undefined
8322				) {
8323					return ret;
8324				}
8325
8326				ret = elem.value;
8327
8328				// Handle most common string cases
8329				if ( typeof ret === "string" ) {
8330					return ret.replace( rreturn, "" );
8331				}
8332
8333				// Handle cases where value is null/undef or number
8334				return ret == null ? "" : ret;
8335			}
8336
8337			return;
8338		}
8339
8340		valueIsFunction = isFunction( value );
8341
8342		return this.each( function( i ) {
8343			var val;
8344
8345			if ( this.nodeType !== 1 ) {
8346				return;
8347			}
8348
8349			if ( valueIsFunction ) {
8350				val = value.call( this, i, jQuery( this ).val() );
8351			} else {
8352				val = value;
8353			}
8354
8355			// Treat null/undefined as ""; convert numbers to string
8356			if ( val == null ) {
8357				val = "";
8358
8359			} else if ( typeof val === "number" ) {
8360				val += "";
8361
8362			} else if ( Array.isArray( val ) ) {
8363				val = jQuery.map( val, function( value ) {
8364					return value == null ? "" : value + "";
8365				} );
8366			}
8367
8368			hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ];
8369
8370			// If set returns undefined, fall back to normal setting
vendor: 4,458 bytes, lines 8371-8556
8371			if ( !hooks || !( "set" in hooks ) || hooks.set( this, val, "value" ) === undefined ) {
8372				this.value = val;
8373			}
8374		} );
8375	}
8376} );
8377
8378jQuery.extend( {
8379	valHooks: {
8380		option: {
8381			get: function( elem ) {
8382
8383				var val = jQuery.find.attr( elem, "value" );
8384				return val != null ?
8385					val :
8386
8387					// Support: IE <=10 - 11 only
8388					// option.text throws exceptions (trac-14686, trac-14858)
8389					// Strip and collapse whitespace
8390					// https://html.spec.whatwg.org/#strip-and-collapse-whitespace
8391					stripAndCollapse( jQuery.text( elem ) );
8392			}
8393		},
8394		select: {
8395			get: function( elem ) {
8396				var value, option, i,
8397					options = elem.options,
8398					index = elem.selectedIndex,
8399					one = elem.type === "select-one",
8400					values = one ? null : [],
8401					max = one ? index + 1 : options.length;
8402
8403				if ( index < 0 ) {
8404					i = max;
8405
8406				} else {
8407					i = one ? index : 0;
8408				}
8409
8410				// Loop through all the selected options
8411				for ( ; i < max; i++ ) {
8412					option = options[ i ];
8413
8414					// Support: IE <=9 only
8415					// IE8-9 doesn't update selected after form reset (trac-2551)
8416					if ( ( option.selected || i === index ) &&
8417
8418							// Don't return options that are disabled or in a disabled optgroup
8419							!option.disabled &&
8420							( !option.parentNode.disabled ||
8421								!nodeName( option.parentNode, "optgroup" ) ) ) {
8422
8423						// Get the specific value for the option
8424						value = jQuery( option ).val();
8425
8426						// We don't need an array for one selects
8427						if ( one ) {
8428							return value;
8429						}
8430
8431						// Multi-Selects return an array
8432						values.push( value );
8433					}
8434				}
8435
8436				return values;
8437			},
8438
8439			set: function( elem, value ) {
8440				var optionSet, option,
8441					options = elem.options,
8442					values = jQuery.makeArray( value ),
8443					i = options.length;
8444
8445				while ( i-- ) {
8446					option = options[ i ];
8447
8448					/* eslint-disable no-cond-assign */
8449
8450					if ( option.selected =
8451						jQuery.inArray( jQuery.valHooks.option.get( option ), values ) > -1
8452					) {
8453						optionSet = true;
8454					}
8455
8456					/* eslint-enable no-cond-assign */
8457				}
8458
8459				// Force browsers to behave consistently when non-matching value is set
8460				if ( !optionSet ) {
8461					elem.selectedIndex = -1;
8462				}
8463				return values;
8464			}
8465		}
8466	}
8467} );
8468
8469// Radios and checkboxes getter/setter
8470jQuery.each( [ "radio", "checkbox" ], function() {
8471	jQuery.valHooks[ this ] = {
8472		set: function( elem, value ) {
8473			if ( Array.isArray( value ) ) {
8474				return ( elem.checked = jQuery.inArray( jQuery( elem ).val(), value ) > -1 );
8475			}
8476		}
8477	};
8478	if ( !support.checkOn ) {
8479		jQuery.valHooks[ this ].get = function( elem ) {
8480			return elem.getAttribute( "value" ) === null ? "on" : elem.value;
8481		};
8482	}
8483} );
8484
8485
8486
8487
8488// Return jQuery for attributes-only inclusion
8489var location = window.location;
8490
8491var nonce = { guid: Date.now() };
8492
8493var rquery = ( /\?/ );
8494
8495
8496
8497// Cross-browser xml parsing
8498jQuery.parseXML = function( data ) {
8499	var xml, parserErrorElem;
8500	if ( !data || typeof data !== "string" ) {
8501		return null;
8502	}
8503
8504	// Support: IE 9 - 11 only
8505	// IE throws on parseFromString with invalid input.
8506	try {
8507		xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" );
8508	} catch ( e ) {}
8509
8510	parserErrorElem = xml && xml.getElementsByTagName( "parsererror" )[ 0 ];
8511	if ( !xml || parserErrorElem ) {
8512		jQuery.error( "Invalid XML: " + (
8513			parserErrorElem ?
8514				jQuery.map( parserErrorElem.childNodes, function( el ) {
8515					return el.textContent;
8516				} ).join( "\n" ) :
8517				data
8518		) );
8519	}
8520	return xml;
8521};
8522
8523
8524var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
8525	stopPropagationCallback = function( e ) {
8526		e.stopPropagation();
8527	};
8528
8529jQuery.extend( jQuery.event, {
8530
8531	trigger: function( event, data, elem, onlyHandlers ) {
8532
8533		var i, cur, tmp, bubbleType, ontype, handle, special, lastElement,
8534			eventPath = [ elem || document ],
8535			type = hasOwn.call( event, "type" ) ? event.type : event,
8536			namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split( "." ) : [];
8537
8538		cur = lastElement = tmp = elem = elem || document;
8539
8540		// Don't do events on text and comment nodes
8541		if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
8542			return;
8543		}
8544
8545		// focus/blur morphs to focusin/out; ensure we're not firing them right now
8546		if ( rfocusMorph.test( type + jQuery.event.triggered ) ) {
8547			return;
8548		}
8549
8550		if ( type.indexOf( "." ) > -1 ) {
8551
8552			// Namespaced trigger; create a regexp to match event type in handle()
8553			namespaces = type.split( "." );
8554			type = namespaces.shift();
8555			namespaces.sort();
8556		}
vendor: 6,524 bytes, lines 8557-8806
8557		ontype = type.indexOf( ":" ) < 0 && "on" + type;
8558
8559		// Caller can pass in a jQuery.Event object, Object, or just an event type string
8560		event = event[ jQuery.expando ] ?
8561			event :
8562			new jQuery.Event( type, typeof event === "object" && event );
8563
8564		// Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true)
8565		event.isTrigger = onlyHandlers ? 2 : 3;
8566		event.namespace = namespaces.join( "." );
8567		event.rnamespace = event.namespace ?
8568			new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ) :
8569			null;
8570
8571		// Clean up the event in case it is being reused
8572		event.result = undefined;
8573		if ( !event.target ) {
8574			event.target = elem;
8575		}
8576
8577		// Clone any incoming data and prepend the event, creating the handler arg list
8578		data = data == null ?
8579			[ event ] :
8580			jQuery.makeArray( data, [ event ] );
8581
8582		// Allow special events to draw outside the lines
8583		special = jQuery.event.special[ type ] || {};
8584		if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) {
8585			return;
8586		}
8587
8588		// Determine event propagation path in advance, per W3C events spec (trac-9951)
8589		// Bubble up to document, then to window; watch for a global ownerDocument var (trac-9724)
8590		if ( !onlyHandlers && !special.noBubble && !isWindow( elem ) ) {
8591
8592			bubbleType = special.delegateType || type;
8593			if ( !rfocusMorph.test( bubbleType + type ) ) {
8594				cur = cur.parentNode;
8595			}
8596			for ( ; cur; cur = cur.parentNode ) {
8597				eventPath.push( cur );
8598				tmp = cur;
8599			}
8600
8601			// Only add window if we got to document (e.g., not plain obj or detached DOM)
8602			if ( tmp === ( elem.ownerDocument || document ) ) {
8603				eventPath.push( tmp.defaultView || tmp.parentWindow || window );
8604			}
8605		}
8606
8607		// Fire handlers on the event path
8608		i = 0;
8609		while ( ( cur = eventPath[ i++ ] ) && !event.isPropagationStopped() ) {
8610			lastElement = cur;
8611			event.type = i > 1 ?
8612				bubbleType :
8613				special.bindType || type;
8614
8615			// jQuery handler
8616			handle = ( dataPriv.get( cur, "events" ) || Object.create( null ) )[ event.type ] &&
8617				dataPriv.get( cur, "handle" );
8618			if ( handle ) {
8619				handle.apply( cur, data );
8620			}
8621
8622			// Native handler
8623			handle = ontype && cur[ ontype ];
8624			if ( handle && handle.apply && acceptData( cur ) ) {
8625				event.result = handle.apply( cur, data );
8626				if ( event.result === false ) {
8627					event.preventDefault();
8628				}
8629			}
8630		}
8631		event.type = type;
8632
8633		// If nobody prevented the default action, do it now
8634		if ( !onlyHandlers && !event.isDefaultPrevented() ) {
8635
8636			if ( ( !special._default ||
8637				special._default.apply( eventPath.pop(), data ) === false ) &&
8638				acceptData( elem ) ) {
8639
8640				// Call a native DOM method on the target with the same name as the event.
8641				// Don't do default actions on window, that's where global variables be (trac-6170)
8642				if ( ontype && isFunction( elem[ type ] ) && !isWindow( elem ) ) {
8643
8644					// Don't re-trigger an onFOO event when we call its FOO() method
8645					tmp = elem[ ontype ];
8646
8647					if ( tmp ) {
8648						elem[ ontype ] = null;
8649					}
8650
8651					// Prevent re-triggering of the same event, since we already bubbled it above
8652					jQuery.event.triggered = type;
8653
8654					if ( event.isPropagationStopped() ) {
8655						lastElement.addEventListener( type, stopPropagationCallback );
8656					}
8657
8658					elem[ type ]();
8659
8660					if ( event.isPropagationStopped() ) {
8661						lastElement.removeEventListener( type, stopPropagationCallback );
8662					}
8663
8664					jQuery.event.triggered = undefined;
8665
8666					if ( tmp ) {
8667						elem[ ontype ] = tmp;
8668					}
8669				}
8670			}
8671		}
8672
8673		return event.result;
8674	},
8675
8676	// Piggyback on a donor event to simulate a different one
8677	// Used only for `focus(in | out)` events
8678	simulate: function( type, elem, event ) {
8679		var e = jQuery.extend(
8680			new jQuery.Event(),
8681			event,
8682			{
8683				type: type,
8684				isSimulated: true
8685			}
8686		);
8687
8688		jQuery.event.trigger( e, null, elem );
8689	}
8690
8691} );
8692
8693jQuery.fn.extend( {
8694
8695	trigger: function( type, data ) {
8696		return this.each( function() {
8697			jQuery.event.trigger( type, data, this );
8698		} );
8699	},
8700	triggerHandler: function( type, data ) {
8701		var elem = this[ 0 ];
8702		if ( elem ) {
8703			return jQuery.event.trigger( type, data, elem, true );
8704		}
8705	}
8706} );
8707
8708
8709var
8710	rbracket = /\[\]$/,
8711	rCRLF = /\r?\n/g,
8712	rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i,
8713	rsubmittable = /^(?:input|select|textarea|keygen)/i;
8714
8715function buildParams( prefix, obj, traditional, add ) {
8716	var name;
8717
8718	if ( Array.isArray( obj ) ) {
8719
8720		// Serialize array item.
8721		jQuery.each( obj, function( i, v ) {
8722			if ( traditional || rbracket.test( prefix ) ) {
8723
8724				// Treat each array item as a scalar.
8725				add( prefix, v );
8726
8727			} else {
8728
8729				// Item is non-scalar (array or object), encode its numeric index.
8730				buildParams(
8731					prefix + "[" + ( typeof v === "object" && v != null ? i : "" ) + "]",
8732					v,
8733					traditional,
8734					add
8735				);
8736			}
8737		} );
8738
8739	} else if ( !traditional && toType( obj ) === "object" ) {
8740
8741		// Serialize object item.
8742		for ( name in obj ) {
8743			buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
8744		}
8745
8746	} else {
8747
8748		// Serialize scalar item.
8749		add( prefix, obj );
8750	}
8751}
8752
8753// Serialize an array of form elements or a set of
8754// key/values into a query string
8755jQuery.param = function( a, traditional ) {
8756	var prefix,
8757		s = [],
8758		add = function( key, valueOrFunction ) {
8759
8760			// If value is a function, invoke it and use its return value
8761			var value = isFunction( valueOrFunction ) ?
8762				valueOrFunction() :
8763				valueOrFunction;
8764
8765			s[ s.length ] = encodeURIComponent( key ) + "=" +
8766				encodeURIComponent( value == null ? "" : value );
8767		};
8768
8769	if ( a == null ) {
8770		return "";
8771	}
8772
8773	// If an array was passed in, assume that it is an array of form elements.
8774	if ( Array.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {
8775
8776		// Serialize the form elements
8777		jQuery.each( a, function() {
8778			add( this.name, this.value );
8779		} );
8780
8781	} else {
8782
8783		// If traditional, encode the "old" way (the way 1.3.2 or older
8784		// did it), otherwise encode params recursively.
8785		for ( prefix in a ) {
8786			buildParams( prefix, a[ prefix ], traditional, add );
8787		}
8788	}
8789
8790	// Return the resulting serialization
8791	return s.join( "&" );
8792};
8793
8794jQuery.fn.extend( {
8795	serialize: function() {
8796		return jQuery.param( this.serializeArray() );
8797	},
8798	serializeArray: function() {
8799		return this.map( function() {
8800
8801			// Can add propHook for "elements" to filter or add form elements
8802			var elements = jQuery.prop( this, "elements" );
8803			return elements ? jQuery.makeArray( elements ) : this;
8804		} ).filter( function() {
8805			var type = this.type;
8806
vendor: 32,437 bytes, lines 8807-10060
8807			// Use .is( ":disabled" ) so that fieldset[disabled] works
8808			return this.name && !jQuery( this ).is( ":disabled" ) &&
8809				rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) &&
8810				( this.checked || !rcheckableType.test( type ) );
8811		} ).map( function( _i, elem ) {
8812			var val = jQuery( this ).val();
8813
8814			if ( val == null ) {
8815				return null;
8816			}
8817
8818			if ( Array.isArray( val ) ) {
8819				return jQuery.map( val, function( val ) {
8820					return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
8821				} );
8822			}
8823
8824			return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
8825		} ).get();
8826	}
8827} );
8828
8829
8830var
8831	r20 = /%20/g,
8832	rhash = /#.*$/,
8833	rantiCache = /([?&])_=[^&]*/,
8834	rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg,
8835
8836	// trac-7653, trac-8125, trac-8152: local protocol detection
8837	rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,
8838	rnoContent = /^(?:GET|HEAD)$/,
8839	rprotocol = /^\/\//,
8840
8841	/* Prefilters
8842	 * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
8843	 * 2) These are called:
8844	 *    - BEFORE asking for a transport
8845	 *    - AFTER param serialization (s.data is a string if s.processData is true)
8846	 * 3) key is the dataType
8847	 * 4) the catchall symbol "*" can be used
8848	 * 5) execution will start with transport dataType and THEN continue down to "*" if needed
8849	 */
8850	prefilters = {},
8851
8852	/* Transports bindings
8853	 * 1) key is the dataType
8854	 * 2) the catchall symbol "*" can be used
8855	 * 3) selection will start with transport dataType and THEN go to "*" if needed
8856	 */
8857	transports = {},
8858
8859	// Avoid comment-prolog char sequence (trac-10098); must appease lint and evade compression
8860	allTypes = "*/".concat( "*" ),
8861
8862	// Anchor tag for parsing the document origin
8863	originAnchor = document.createElement( "a" );
8864
8865originAnchor.href = location.href;
8866
8867// Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
8868function addToPrefiltersOrTransports( structure ) {
8869
8870	// dataTypeExpression is optional and defaults to "*"
8871	return function( dataTypeExpression, func ) {
8872
8873		if ( typeof dataTypeExpression !== "string" ) {
8874			func = dataTypeExpression;
8875			dataTypeExpression = "*";
8876		}
8877
8878		var dataType,
8879			i = 0,
8880			dataTypes = dataTypeExpression.toLowerCase().match( rnothtmlwhite ) || [];
8881
8882		if ( isFunction( func ) ) {
8883
8884			// For each dataType in the dataTypeExpression
8885			while ( ( dataType = dataTypes[ i++ ] ) ) {
8886
8887				// Prepend if requested
8888				if ( dataType[ 0 ] === "+" ) {
8889					dataType = dataType.slice( 1 ) || "*";
8890					( structure[ dataType ] = structure[ dataType ] || [] ).unshift( func );
8891
8892				// Otherwise append
8893				} else {
8894					( structure[ dataType ] = structure[ dataType ] || [] ).push( func );
8895				}
8896			}
8897		}
8898	};
8899}
8900
8901// Base inspection function for prefilters and transports
8902function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) {
8903
8904	var inspected = {},
8905		seekingTransport = ( structure === transports );
8906
8907	function inspect( dataType ) {
8908		var selected;
8909		inspected[ dataType ] = true;
8910		jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) {
8911			var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR );
8912			if ( typeof dataTypeOrTransport === "string" &&
8913				!seekingTransport && !inspected[ dataTypeOrTransport ] ) {
8914
8915				options.dataTypes.unshift( dataTypeOrTransport );
8916				inspect( dataTypeOrTransport );
8917				return false;
8918			} else if ( seekingTransport ) {
8919				return !( selected = dataTypeOrTransport );
8920			}
8921		} );
8922		return selected;
8923	}
8924
8925	return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" );
8926}
8927
8928// A special extend for ajax options
8929// that takes "flat" options (not to be deep extended)
8930// Fixes trac-9887
8931function ajaxExtend( target, src ) {
8932	var key, deep,
8933		flatOptions = jQuery.ajaxSettings.flatOptions || {};
8934
8935	for ( key in src ) {
8936		if ( src[ key ] !== undefined ) {
8937			( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ];
8938		}
8939	}
8940	if ( deep ) {
8941		jQuery.extend( true, target, deep );
8942	}
8943
8944	return target;
8945}
8946
8947/* Handles responses to an ajax request:
8948 * - finds the right dataType (mediates between content-type and expected dataType)
8949 * - returns the corresponding response
8950 */
8951function ajaxHandleResponses( s, jqXHR, responses ) {
8952
8953	var ct, type, finalDataType, firstDataType,
8954		contents = s.contents,
8955		dataTypes = s.dataTypes;
8956
8957	// Remove auto dataType and get content-type in the process
8958	while ( dataTypes[ 0 ] === "*" ) {
8959		dataTypes.shift();
8960		if ( ct === undefined ) {
8961			ct = s.mimeType || jqXHR.getResponseHeader( "Content-Type" );
8962		}
8963	}
8964
8965	// Check if we're dealing with a known content-type
8966	if ( ct ) {
8967		for ( type in contents ) {
8968			if ( contents[ type ] && contents[ type ].test( ct ) ) {
8969				dataTypes.unshift( type );
8970				break;
8971			}
8972		}
8973	}
8974
8975	// Check to see if we have a response for the expected dataType
8976	if ( dataTypes[ 0 ] in responses ) {
8977		finalDataType = dataTypes[ 0 ];
8978	} else {
8979
8980		// Try convertible dataTypes
8981		for ( type in responses ) {
8982			if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[ 0 ] ] ) {
8983				finalDataType = type;
8984				break;
8985			}
8986			if ( !firstDataType ) {
8987				firstDataType = type;
8988			}
8989		}
8990
8991		// Or just use first one
8992		finalDataType = finalDataType || firstDataType;
8993	}
8994
8995	// If we found a dataType
8996	// We add the dataType to the list if needed
8997	// and return the corresponding response
8998	if ( finalDataType ) {
8999		if ( finalDataType !== dataTypes[ 0 ] ) {
9000			dataTypes.unshift( finalDataType );
9001		}
9002		return responses[ finalDataType ];
9003	}
9004}
9005
9006/* Chain conversions given the request and the original response
9007 * Also sets the responseXXX fields on the jqXHR instance
9008 */
9009function ajaxConvert( s, response, jqXHR, isSuccess ) {
9010	var conv2, current, conv, tmp, prev,
9011		converters = {},
9012
9013		// Work with a copy of dataTypes in case we need to modify it for conversion
9014		dataTypes = s.dataTypes.slice();
9015
9016	// Create converters map with lowercased keys
9017	if ( dataTypes[ 1 ] ) {
9018		for ( conv in s.converters ) {
9019			converters[ conv.toLowerCase() ] = s.converters[ conv ];
9020		}
9021	}
9022
9023	current = dataTypes.shift();
9024
9025	// Convert to each sequential dataType
9026	while ( current ) {
9027
9028		if ( s.responseFields[ current ] ) {
9029			jqXHR[ s.responseFields[ current ] ] = response;
9030		}
9031
9032		// Apply the dataFilter if provided
9033		if ( !prev && isSuccess && s.dataFilter ) {
9034			response = s.dataFilter( response, s.dataType );
9035		}
9036
9037		prev = current;
9038		current = dataTypes.shift();
9039
9040		if ( current ) {
9041
9042			// There's only work to do if current dataType is non-auto
9043			if ( current === "*" ) {
9044
9045				current = prev;
9046
9047			// Convert response if prev dataType is non-auto and differs from current
9048			} else if ( prev !== "*" && prev !== current ) {
9049
9050				// Seek a direct converter
9051				conv = converters[ prev + " " + current ] || converters[ "* " + current ];
9052
9053				// If none found, seek a pair
9054				if ( !conv ) {
9055					for ( conv2 in converters ) {
9056
9057						// If conv2 outputs current
9058						tmp = conv2.split( " " );
9059						if ( tmp[ 1 ] === current ) {
9060
9061							// If prev can be converted to accepted input
9062							conv = converters[ prev + " " + tmp[ 0 ] ] ||
9063								converters[ "* " + tmp[ 0 ] ];
9064							if ( conv ) {
9065
9066								// Condense equivalence converters
9067								if ( conv === true ) {
9068									conv = converters[ conv2 ];
9069
9070								// Otherwise, insert the intermediate dataType
9071								} else if ( converters[ conv2 ] !== true ) {
9072									current = tmp[ 0 ];
9073									dataTypes.unshift( tmp[ 1 ] );
9074								}
9075								break;
9076							}
9077						}
9078					}
9079				}
9080
9081				// Apply converter (if not an equivalence)
9082				if ( conv !== true ) {
9083
9084					// Unless errors are allowed to bubble, catch and return them
9085					if ( conv && s.throws ) {
9086						response = conv( response );
9087					} else {
9088						try {
9089							response = conv( response );
9090						} catch ( e ) {
9091							return {
9092								state: "parsererror",
9093								error: conv ? e : "No conversion from " + prev + " to " + current
9094							};
9095						}
9096					}
9097				}
9098			}
9099		}
9100	}
9101
9102	return { state: "success", data: response };
9103}
9104
9105jQuery.extend( {
9106
9107	// Counter for holding the number of active queries
9108	active: 0,
9109
9110	// Last-Modified header cache for next request
9111	lastModified: {},
9112	etag: {},
9113
9114	ajaxSettings: {
9115		url: location.href,
9116		type: "GET",
9117		isLocal: rlocalProtocol.test( location.protocol ),
9118		global: true,
9119		processData: true,
9120		async: true,
9121		contentType: "application/x-www-form-urlencoded; charset=UTF-8",
9122
9123		/*
9124		timeout: 0,
9125		data: null,
9126		dataType: null,
9127		username: null,
9128		password: null,
9129		cache: null,
9130		throws: false,
9131		traditional: false,
9132		headers: {},
9133		*/
9134
9135		accepts: {
9136			"*": allTypes,
9137			text: "text/plain",
9138			html: "text/html",
9139			xml: "application/xml, text/xml",
9140			json: "application/json, text/javascript"
9141		},
9142
9143		contents: {
9144			xml: /\bxml\b/,
9145			html: /\bhtml/,
9146			json: /\bjson\b/
9147		},
9148
9149		responseFields: {
9150			xml: "responseXML",
9151			text: "responseText",
9152			json: "responseJSON"
9153		},
9154
9155		// Data converters
9156		// Keys separate source (or catchall "*") and destination types with a single space
9157		converters: {
9158
9159			// Convert anything to text
9160			"* text": String,
9161
9162			// Text to html (true = no transformation)
9163			"text html": true,
9164
9165			// Evaluate text as a json expression
9166			"text json": JSON.parse,
9167
9168			// Parse text as xml
9169			"text xml": jQuery.parseXML
9170		},
9171
9172		// For options that shouldn't be deep extended:
9173		// you can add your own custom options here if
9174		// and when you create one that shouldn't be
9175		// deep extended (see ajaxExtend)
9176		flatOptions: {
9177			url: true,
9178			context: true
9179		}
9180	},
9181
9182	// Creates a full fledged settings object into target
9183	// with both ajaxSettings and settings fields.
9184	// If target is omitted, writes into ajaxSettings.
9185	ajaxSetup: function( target, settings ) {
9186		return settings ?
9187
9188			// Building a settings object
9189			ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) :
9190
9191			// Extending ajaxSettings
9192			ajaxExtend( jQuery.ajaxSettings, target );
9193	},
9194
9195	ajaxPrefilter: addToPrefiltersOrTransports( prefilters ),
9196	ajaxTransport: addToPrefiltersOrTransports( transports ),
9197
9198	// Main method
9199	ajax: function( url, options ) {
9200
9201		// If url is an object, simulate pre-1.5 signature
9202		if ( typeof url === "object" ) {
9203			options = url;
9204			url = undefined;
9205		}
9206
9207		// Force options to be an object
9208		options = options || {};
9209
9210		var transport,
9211
9212			// URL without anti-cache param
9213			cacheURL,
9214
9215			// Response headers
9216			responseHeadersString,
9217			responseHeaders,
9218
9219			// timeout handle
9220			timeoutTimer,
9221
9222			// Url cleanup var
9223			urlAnchor,
9224
9225			// Request state (becomes false upon send and true upon completion)
9226			completed,
9227
9228			// To know if global events are to be dispatched
9229			fireGlobals,
9230
9231			// Loop variable
9232			i,
9233
9234			// uncached part of the url
9235			uncached,
9236
9237			// Create the final options object
9238			s = jQuery.ajaxSetup( {}, options ),
9239
9240			// Callbacks context
9241			callbackContext = s.context || s,
9242
9243			// Context for global events is callbackContext if it is a DOM node or jQuery collection
9244			globalEventContext = s.context &&
9245				( callbackContext.nodeType || callbackContext.jquery ) ?
9246				jQuery( callbackContext ) :
9247				jQuery.event,
9248
9249			// Deferreds
9250			deferred = jQuery.Deferred(),
9251			completeDeferred = jQuery.Callbacks( "once memory" ),
9252
9253			// Status-dependent callbacks
9254			statusCode = s.statusCode || {},
9255
9256			// Headers (they are sent all at once)
9257			requestHeaders = {},
9258			requestHeadersNames = {},
9259
9260			// Default abort message
9261			strAbort = "canceled",
9262
9263			// Fake xhr
9264			jqXHR = {
9265				readyState: 0,
9266
9267				// Builds headers hashtable if needed
9268				getResponseHeader: function( key ) {
9269					var match;
9270					if ( completed ) {
9271						if ( !responseHeaders ) {
9272							responseHeaders = {};
9273							while ( ( match = rheaders.exec( responseHeadersString ) ) ) {
9274								responseHeaders[ match[ 1 ].toLowerCase() + " " ] =
9275									( responseHeaders[ match[ 1 ].toLowerCase() + " " ] || [] )
9276										.concat( match[ 2 ] );
9277							}
9278						}
9279						match = responseHeaders[ key.toLowerCase() + " " ];
9280					}
9281					return match == null ? null : match.join( ", " );
9282				},
9283
9284				// Raw string
9285				getAllResponseHeaders: function() {
9286					return completed ? responseHeadersString : null;
9287				},
9288
9289				// Caches the header
9290				setRequestHeader: function( name, value ) {
9291					if ( completed == null ) {
9292						name = requestHeadersNames[ name.toLowerCase() ] =
9293							requestHeadersNames[ name.toLowerCase() ] || name;
9294						requestHeaders[ name ] = value;
9295					}
9296					return this;
9297				},
9298
9299				// Overrides response content-type header
9300				overrideMimeType: function( type ) {
9301					if ( completed == null ) {
9302						s.mimeType = type;
9303					}
9304					return this;
9305				},
9306
9307				// Status-dependent callbacks
9308				statusCode: function( map ) {
9309					var code;
9310					if ( map ) {
9311						if ( completed ) {
9312
9313							// Execute the appropriate callbacks
9314							jqXHR.always( map[ jqXHR.status ] );
9315						} else {
9316
9317							// Lazy-add the new callbacks in a way that preserves old ones
9318							for ( code in map ) {
9319								statusCode[ code ] = [ statusCode[ code ], map[ code ] ];
9320							}
9321						}
9322					}
9323					return this;
9324				},
9325
9326				// Cancel the request
9327				abort: function( statusText ) {
9328					var finalText = statusText || strAbort;
9329					if ( transport ) {
9330						transport.abort( finalText );
9331					}
9332					done( 0, finalText );
9333					return this;
9334				}
9335			};
9336
9337		// Attach deferreds
9338		deferred.promise( jqXHR );
9339
9340		// Add protocol if not provided (prefilters might expect it)
9341		// Handle falsy url in the settings object (trac-10093: consistency with old signature)
9342		// We also use the url parameter if available
9343		s.url = ( ( url || s.url || location.href ) + "" )
9344			.replace( rprotocol, location.protocol + "//" );
9345
9346		// Alias method option to type as per ticket trac-12004
9347		s.type = options.method || options.type || s.method || s.type;
9348
9349		// Extract dataTypes list
9350		s.dataTypes = ( s.dataType || "*" ).toLowerCase().match( rnothtmlwhite ) || [ "" ];
9351
9352		// A cross-domain request is in order when the origin doesn't match the current origin.
9353		if ( s.crossDomain == null ) {
9354			urlAnchor = document.createElement( "a" );
9355
9356			// Support: IE <=8 - 11, Edge 12 - 15
9357			// IE throws exception on accessing the href property if url is malformed,
9358			// e.g. http://example.com:80x/
9359			try {
9360				urlAnchor.href = s.url;
9361
9362				// Support: IE <=8 - 11 only
9363				// Anchor's host property isn't correctly set when s.url is relative
9364				urlAnchor.href = urlAnchor.href;
9365				s.crossDomain = originAnchor.protocol + "//" + originAnchor.host !==
9366					urlAnchor.protocol + "//" + urlAnchor.host;
9367			} catch ( e ) {
9368
9369				// If there is an error parsing the URL, assume it is crossDomain,
9370				// it can be rejected by the transport if it is invalid
9371				s.crossDomain = true;
9372			}
9373		}
9374
9375		// Convert data if not already a string
9376		if ( s.data && s.processData && typeof s.data !== "string" ) {
9377			s.data = jQuery.param( s.data, s.traditional );
9378		}
9379
9380		// Apply prefilters
9381		inspectPrefiltersOrTransports( prefilters, s, options, jqXHR );
9382
9383		// If request was aborted inside a prefilter, stop there
9384		if ( completed ) {
9385			return jqXHR;
9386		}
9387
9388		// We can fire global events as of now if asked to
9389		// Don't fire events if jQuery.event is undefined in an AMD-usage scenario (trac-15118)
9390		fireGlobals = jQuery.event && s.global;
9391
9392		// Watch for a new set of requests
9393		if ( fireGlobals && jQuery.active++ === 0 ) {
9394			jQuery.event.trigger( "ajaxStart" );
9395		}
9396
9397		// Uppercase the type
9398		s.type = s.type.toUpperCase();
9399
9400		// Determine if request has content
9401		s.hasContent = !rnoContent.test( s.type );
9402
9403		// Save the URL in case we're toying with the If-Modified-Since
9404		// and/or If-None-Match header later on
9405		// Remove hash to simplify url manipulation
9406		cacheURL = s.url.replace( rhash, "" );
9407
9408		// More options handling for requests with no content
9409		if ( !s.hasContent ) {
9410
9411			// Remember the hash so we can put it back
9412			uncached = s.url.slice( cacheURL.length );
9413
9414			// If data is available and should be processed, append data to url
9415			if ( s.data && ( s.processData || typeof s.data === "string" ) ) {
9416				cacheURL += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data;
9417
9418				// trac-9682: remove data so that it's not used in an eventual retry
9419				delete s.data;
9420			}
9421
9422			// Add or update anti-cache param if needed
9423			if ( s.cache === false ) {
9424				cacheURL = cacheURL.replace( rantiCache, "$1" );
9425				uncached = ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + ( nonce.guid++ ) +
9426					uncached;
9427			}
9428
9429			// Put hash and anti-cache on the URL that will be requested (gh-1732)
9430			s.url = cacheURL + uncached;
9431
9432		// Change '%20' to '+' if this is encoded form body content (gh-2658)
9433		} else if ( s.data && s.processData &&
9434			( s.contentType || "" ).indexOf( "application/x-www-form-urlencoded" ) === 0 ) {
9435			s.data = s.data.replace( r20, "+" );
9436		}
9437
9438		// Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
9439		if ( s.ifModified ) {
9440			if ( jQuery.lastModified[ cacheURL ] ) {
9441				jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] );
9442			}
9443			if ( jQuery.etag[ cacheURL ] ) {
9444				jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] );
9445			}
9446		}
9447
9448		// Set the correct header, if data is being sent
9449		if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) {
9450			jqXHR.setRequestHeader( "Content-Type", s.contentType );
9451		}
9452
9453		// Set the Accepts header for the server, depending on the dataType
9454		jqXHR.setRequestHeader(
9455			"Accept",
9456			s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[ 0 ] ] ?
9457				s.accepts[ s.dataTypes[ 0 ] ] +
9458					( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) :
9459				s.accepts[ "*" ]
9460		);
9461
9462		// Check for headers option
9463		for ( i in s.headers ) {
9464			jqXHR.setRequestHeader( i, s.headers[ i ] );
9465		}
9466
9467		// Allow custom headers/mimetypes and early abort
9468		if ( s.beforeSend &&
9469			( s.beforeSend.call( callbackContext, jqXHR, s ) === false || completed ) ) {
9470
9471			// Abort if not done already and return
9472			return jqXHR.abort();
9473		}
9474
9475		// Aborting is no longer a cancellation
9476		strAbort = "abort";
9477
9478		// Install callbacks on deferreds
9479		completeDeferred.add( s.complete );
9480		jqXHR.done( s.success );
9481		jqXHR.fail( s.error );
9482
9483		// Get transport
9484		transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR );
9485
9486		// If no transport, we auto-abort
9487		if ( !transport ) {
9488			done( -1, "No Transport" );
9489		} else {
9490			jqXHR.readyState = 1;
9491
9492			// Send global event
9493			if ( fireGlobals ) {
9494				globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] );
9495			}
9496
9497			// If request was aborted inside ajaxSend, stop there
9498			if ( completed ) {
9499				return jqXHR;
9500			}
9501
9502			// Timeout
9503			if ( s.async && s.timeout > 0 ) {
9504				timeoutTimer = window.setTimeout( function() {
9505					jqXHR.abort( "timeout" );
9506				}, s.timeout );
9507			}
9508
9509			try {
9510				completed = false;
9511				transport.send( requestHeaders, done );
9512			} catch ( e ) {
9513
9514				// Rethrow post-completion exceptions
9515				if ( completed ) {
9516					throw e;
9517				}
9518
9519				// Propagate others as results
9520				done( -1, e );
9521			}
9522		}
9523
9524		// Callback for when everything is done
9525		function done( status, nativeStatusText, responses, headers ) {
9526			var isSuccess, success, error, response, modified,
9527				statusText = nativeStatusText;
9528
9529			// Ignore repeat invocations
9530			if ( completed ) {
9531				return;
9532			}
9533
9534			completed = true;
9535
9536			// Clear timeout if it exists
9537			if ( timeoutTimer ) {
9538				window.clearTimeout( timeoutTimer );
9539			}
9540
9541			// Dereference transport for early garbage collection
9542			// (no matter how long the jqXHR object will be used)
9543			transport = undefined;
9544
9545			// Cache response headers
9546			responseHeadersString = headers || "";
9547
9548			// Set readyState
9549			jqXHR.readyState = status > 0 ? 4 : 0;
9550
9551			// Determine if successful
9552			isSuccess = status >= 200 && status < 300 || status === 304;
9553
9554			// Get response data
9555			if ( responses ) {
9556				response = ajaxHandleResponses( s, jqXHR, responses );
9557			}
9558
9559			// Use a noop converter for missing script but not if jsonp
9560			if ( !isSuccess &&
9561				jQuery.inArray( "script", s.dataTypes ) > -1 &&
9562				jQuery.inArray( "json", s.dataTypes ) < 0 ) {
9563				s.converters[ "text script" ] = function() {};
9564			}
9565
9566			// Convert no matter what (that way responseXXX fields are always set)
9567			response = ajaxConvert( s, response, jqXHR, isSuccess );
9568
9569			// If successful, handle type chaining
9570			if ( isSuccess ) {
9571
9572				// Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
9573				if ( s.ifModified ) {
9574					modified = jqXHR.getResponseHeader( "Last-Modified" );
9575					if ( modified ) {
9576						jQuery.lastModified[ cacheURL ] = modified;
9577					}
9578					modified = jqXHR.getResponseHeader( "etag" );
9579					if ( modified ) {
9580						jQuery.etag[ cacheURL ] = modified;
9581					}
9582				}
9583
9584				// if no content
9585				if ( status === 204 || s.type === "HEAD" ) {
9586					statusText = "nocontent";
9587
9588				// if not modified
9589				} else if ( status === 304 ) {
9590					statusText = "notmodified";
9591
9592				// If we have data, let's convert it
9593				} else {
9594					statusText = response.state;
9595					success = response.data;
9596					error = response.error;
9597					isSuccess = !error;
9598				}
9599			} else {
9600
9601				// Extract error from statusText and normalize for non-aborts
9602				error = statusText;
9603				if ( status || !statusText ) {
9604					statusText = "error";
9605					if ( status < 0 ) {
9606						status = 0;
9607					}
9608				}
9609			}
9610
9611			// Set data for the fake xhr object
9612			jqXHR.status = status;
9613			jqXHR.statusText = ( nativeStatusText || statusText ) + "";
9614
9615			// Success/Error
9616			if ( isSuccess ) {
9617				deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );
9618			} else {
9619				deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );
9620			}
9621
9622			// Status-dependent callbacks
9623			jqXHR.statusCode( statusCode );
9624			statusCode = undefined;
9625
9626			if ( fireGlobals ) {
9627				globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError",
9628					[ jqXHR, s, isSuccess ? success : error ] );
9629			}
9630
9631			// Complete
9632			completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] );
9633
9634			if ( fireGlobals ) {
9635				globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] );
9636
9637				// Handle the global AJAX counter
9638				if ( !( --jQuery.active ) ) {
9639					jQuery.event.trigger( "ajaxStop" );
9640				}
9641			}
9642		}
9643
9644		return jqXHR;
9645	},
9646
9647	getJSON: function( url, data, callback ) {
9648		return jQuery.get( url, data, callback, "json" );
9649	},
9650
9651	getScript: function( url, callback ) {
9652		return jQuery.get( url, undefined, callback, "script" );
9653	}
9654} );
9655
9656jQuery.each( [ "get", "post" ], function( _i, method ) {
9657	jQuery[ method ] = function( url, data, callback, type ) {
9658
9659		// Shift arguments if data argument was omitted
9660		if ( isFunction( data ) ) {
9661			type = type || callback;
9662			callback = data;
9663			data = undefined;
9664		}
9665
9666		// The url can be an options object (which then must have .url)
9667		return jQuery.ajax( jQuery.extend( {
9668			url: url,
9669			type: method,
9670			dataType: type,
9671			data: data,
9672			success: callback
9673		}, jQuery.isPlainObject( url ) && url ) );
9674	};
9675} );
9676
9677jQuery.ajaxPrefilter( function( s ) {
9678	var i;
9679	for ( i in s.headers ) {
9680		if ( i.toLowerCase() === "content-type" ) {
9681			s.contentType = s.headers[ i ] || "";
9682		}
9683	}
9684} );
9685
9686
9687jQuery._evalUrl = function( url, options, doc ) {
9688	return jQuery.ajax( {
9689		url: url,
9690
9691		// Make this explicit, since user can override this through ajaxSetup (trac-11264)
9692		type: "GET",
9693		dataType: "script",
9694		cache: true,
9695		async: false,
9696		global: false,
9697
9698		// Only evaluate the response if it is successful (gh-4126)
9699		// dataFilter is not invoked for failure responses, so using it instead
9700		// of the default converter is kludgy but it works.
9701		converters: {
9702			"text script": function() {}
9703		},
9704		dataFilter: function( response ) {
9705			jQuery.globalEval( response, options, doc );
9706		}
9707	} );
9708};
9709
9710
9711jQuery.fn.extend( {
9712	wrapAll: function( html ) {
9713		var wrap;
9714
9715		if ( this[ 0 ] ) {
9716			if ( isFunction( html ) ) {
9717				html = html.call( this[ 0 ] );
9718			}
9719
9720			// The elements to wrap the target around
9721			wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true );
9722
9723			if ( this[ 0 ].parentNode ) {
9724				wrap.insertBefore( this[ 0 ] );
9725			}
9726
9727			wrap.map( function() {
9728				var elem = this;
9729
9730				while ( elem.firstElementChild ) {
9731					elem = elem.firstElementChild;
9732				}
9733
9734				return elem;
9735			} ).append( this );
9736		}
9737
9738		return this;
9739	},
9740
9741	wrapInner: function( html ) {
9742		if ( isFunction( html ) ) {
9743			return this.each( function( i ) {
9744				jQuery( this ).wrapInner( html.call( this, i ) );
9745			} );
9746		}
9747
9748		return this.each( function() {
9749			var self = jQuery( this ),
9750				contents = self.contents();
9751
9752			if ( contents.length ) {
9753				contents.wrapAll( html );
9754
9755			} else {
9756				self.append( html );
9757			}
9758		} );
9759	},
9760
9761	wrap: function( html ) {
9762		var htmlIsFunction = isFunction( html );
9763
9764		return this.each( function( i ) {
9765			jQuery( this ).wrapAll( htmlIsFunction ? html.call( this, i ) : html );
9766		} );
9767	},
9768
9769	unwrap: function( selector ) {
9770		this.parent( selector ).not( "body" ).each( function() {
9771			jQuery( this ).replaceWith( this.childNodes );
9772		} );
9773		return this;
9774	}
9775} );
9776
9777
9778jQuery.expr.pseudos.hidden = function( elem ) {
9779	return !jQuery.expr.pseudos.visible( elem );
9780};
9781jQuery.expr.pseudos.visible = function( elem ) {
9782	return !!( elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length );
9783};
9784
9785
9786
9787
9788jQuery.ajaxSettings.xhr = function() {
9789	try {
9790		return new window.XMLHttpRequest();
9791	} catch ( e ) {}
9792};
9793
9794var xhrSuccessStatus = {
9795
9796		// File protocol always yields status code 0, assume 200
9797		0: 200,
9798
9799		// Support: IE <=9 only
9800		// trac-1450: sometimes IE returns 1223 when it should be 204
9801		1223: 204
9802	},
9803	xhrSupported = jQuery.ajaxSettings.xhr();
9804
9805support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported );
9806support.ajax = xhrSupported = !!xhrSupported;
9807
9808jQuery.ajaxTransport( function( options ) {
9809	var callback, errorCallback;
9810
9811	// Cross domain only allowed if supported through XMLHttpRequest
9812	if ( support.cors || xhrSupported && !options.crossDomain ) {
9813		return {
9814			send: function( headers, complete ) {
9815				var i,
9816					xhr = options.xhr();
9817
9818				xhr.open(
9819					options.type,
9820					options.url,
9821					options.async,
9822					options.username,
9823					options.password
9824				);
9825
9826				// Apply custom fields if provided
9827				if ( options.xhrFields ) {
9828					for ( i in options.xhrFields ) {
9829						xhr[ i ] = options.xhrFields[ i ];
9830					}
9831				}
9832
9833				// Override mime type if needed
9834				if ( options.mimeType && xhr.overrideMimeType ) {
9835					xhr.overrideMimeType( options.mimeType );
9836				}
9837
9838				// X-Requested-With header
9839				// For cross-domain requests, seeing as conditions for a preflight are
9840				// akin to a jigsaw puzzle, we simply never set it to be sure.
9841				// (it can always be set on a per-request basis or even using ajaxSetup)
9842				// For same-domain requests, won't change header if already provided.
9843				if ( !options.crossDomain && !headers[ "X-Requested-With" ] ) {
9844					headers[ "X-Requested-With" ] = "XMLHttpRequest";
9845				}
9846
9847				// Set headers
9848				for ( i in headers ) {
9849					xhr.setRequestHeader( i, headers[ i ] );
9850				}
9851
9852				// Callback
9853				callback = function( type ) {
9854					return function() {
9855						if ( callback ) {
9856							callback = errorCallback = xhr.onload =
9857								xhr.onerror = xhr.onabort = xhr.ontimeout =
9858									xhr.onreadystatechange = null;
9859
9860							if ( type === "abort" ) {
9861								xhr.abort();
9862							} else if ( type === "error" ) {
9863
9864								// Support: IE <=9 only
9865								// On a manual native abort, IE9 throws
9866								// errors on any property access that is not readyState
9867								if ( typeof xhr.status !== "number" ) {
9868									complete( 0, "error" );
9869								} else {
9870									complete(
9871
9872										// File: protocol always yields status 0; see trac-8605, trac-14207
9873										xhr.status,
9874										xhr.statusText
9875									);
9876								}
9877							} else {
9878								complete(
9879									xhrSuccessStatus[ xhr.status ] || xhr.status,
9880									xhr.statusText,
9881
9882									// Support: IE <=9 only
9883									// IE9 has no XHR2 but throws on binary (trac-11426)
9884									// For XHR2 non-text, let the caller handle it (gh-2498)
9885									( xhr.responseType || "text" ) !== "text"  ||
9886									typeof xhr.responseText !== "string" ?
9887										{ binary: xhr.response } :
9888										{ text: xhr.responseText },
9889									xhr.getAllResponseHeaders()
9890								);
9891							}
9892						}
9893					};
9894				};
9895
9896				// Listen to events
9897				xhr.onload = callback();
9898				errorCallback = xhr.onerror = xhr.ontimeout = callback( "error" );
9899
9900				// Support: IE 9 only
9901				// Use onreadystatechange to replace onabort
9902				// to handle uncaught aborts
9903				if ( xhr.onabort !== undefined ) {
9904					xhr.onabort = errorCallback;
9905				} else {
9906					xhr.onreadystatechange = function() {
9907
9908						// Check readyState before timeout as it changes
9909						if ( xhr.readyState === 4 ) {
9910
9911							// Allow onerror to be called first,
9912							// but that will not handle a native abort
9913							// Also, save errorCallback to a variable
9914							// as xhr.onerror cannot be accessed
9915							window.setTimeout( function() {
9916								if ( callback ) {
9917									errorCallback();
9918								}
9919							} );
9920						}
9921					};
9922				}
9923
9924				// Create the abort callback
9925				callback = callback( "abort" );
9926
9927				try {
9928
9929					// Do send the request (this may raise an exception)
9930					xhr.send( options.hasContent && options.data || null );
9931				} catch ( e ) {
9932
9933					// trac-14683: Only rethrow if this hasn't been notified as an error yet
9934					if ( callback ) {
9935						throw e;
9936					}
9937				}
9938			},
9939
9940			abort: function() {
9941				if ( callback ) {
9942					callback();
9943				}
9944			}
9945		};
9946	}
9947} );
9948
9949
9950
9951
9952// Prevent auto-execution of scripts when no explicit dataType was provided (See gh-2432)
9953jQuery.ajaxPrefilter( function( s ) {
9954	if ( s.crossDomain ) {
9955		s.contents.script = false;
9956	}
9957} );
9958
9959// Install script dataType
9960jQuery.ajaxSetup( {
9961	accepts: {
9962		script: "text/javascript, application/javascript, " +
9963			"application/ecmascript, application/x-ecmascript"
9964	},
9965	contents: {
9966		script: /\b(?:java|ecma)script\b/
9967	},
9968	converters: {
9969		"text script": function( text ) {
9970			jQuery.globalEval( text );
9971			return text;
9972		}
9973	}
9974} );
9975
9976// Handle cache's special case and crossDomain
9977jQuery.ajaxPrefilter( "script", function( s ) {
9978	if ( s.cache === undefined ) {
9979		s.cache = false;
9980	}
9981	if ( s.crossDomain ) {
9982		s.type = "GET";
9983	}
9984} );
9985
9986// Bind script tag hack transport
9987jQuery.ajaxTransport( "script", function( s ) {
9988
9989	// This transport only deals with cross domain or forced-by-attrs requests
9990	if ( s.crossDomain || s.scriptAttrs ) {
9991		var script, callback;
9992		return {
9993			send: function( _, complete ) {
9994				script = jQuery( "<script>" )
9995					.attr( s.scriptAttrs || {} )
9996					.prop( { charset: s.scriptCharset, src: s.url } )
9997					.on( "load error", callback = function( evt ) {
9998						script.remove();
9999						callback = null;
10000						if ( evt ) {
10001							complete( evt.type === "error" ? 404 : 200, evt.type );
10002						}
10003					} );
10004
10005				// Use native DOM manipulation to avoid our domManip AJAX trickery
10006				document.head.appendChild( script[ 0 ] );
10007			},
10008			abort: function() {
10009				if ( callback ) {
10010					callback();
10011				}
10012			}
10013		};
10014	}
10015} );
10016
10017
10018
10019
10020var oldCallbacks = [],
10021	rjsonp = /(=)\?(?=&|$)|\?\?/;
10022
10023// Default jsonp settings
10024jQuery.ajaxSetup( {
10025	jsonp: "callback",
10026	jsonpCallback: function() {
10027		var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce.guid++ ) );
10028		this[ callback ] = true;
10029		return callback;
10030	}
10031} );
10032
10033// Detect, normalize options and install callbacks for jsonp requests
10034jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
10035
10036	var callbackName, overwritten, responseContainer,
10037		jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ?
10038			"url" :
10039			typeof s.data === "string" &&
10040				( s.contentType || "" )
10041					.indexOf( "application/x-www-form-urlencoded" ) === 0 &&
10042				rjsonp.test( s.data ) && "data"
10043		);
10044
10045	// Handle iff the expected data type is "jsonp" or we have a parameter to set
10046	if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) {
10047
10048		// Get callback name, remembering preexisting value associated with it
10049		callbackName = s.jsonpCallback = isFunction( s.jsonpCallback ) ?
10050			s.jsonpCallback() :
10051			s.jsonpCallback;
10052
10053		// Insert callback into url or form data
10054		if ( jsonProp ) {
10055			s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName );
10056		} else if ( s.jsonp !== false ) {
10057			s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName;
10058		}
10059
10060		// Use data converter to retrieve json after script execution
vendor: 8,362 bytes, lines 10061-10372
10061		s.converters[ "script json" ] = function() {
10062			if ( !responseContainer ) {
10063				jQuery.error( callbackName + " was not called" );
10064			}
10065			return responseContainer[ 0 ];
10066		};
10067
10068		// Force json dataType
10069		s.dataTypes[ 0 ] = "json";
10070
10071		// Install callback
10072		overwritten = window[ callbackName ];
10073		window[ callbackName ] = function() {
10074			responseContainer = arguments;
10075		};
10076
10077		// Clean-up function (fires after converters)
10078		jqXHR.always( function() {
10079
10080			// If previous value didn't exist - remove it
10081			if ( overwritten === undefined ) {
10082				jQuery( window ).removeProp( callbackName );
10083
10084			// Otherwise restore preexisting value
10085			} else {
10086				window[ callbackName ] = overwritten;
10087			}
10088
10089			// Save back as free
10090			if ( s[ callbackName ] ) {
10091
10092				// Make sure that re-using the options doesn't screw things around
10093				s.jsonpCallback = originalSettings.jsonpCallback;
10094
10095				// Save the callback name for future use
10096				oldCallbacks.push( callbackName );
10097			}
10098
10099			// Call if it was a function and we have a response
10100			if ( responseContainer && isFunction( overwritten ) ) {
10101				overwritten( responseContainer[ 0 ] );
10102			}
10103
10104			responseContainer = overwritten = undefined;
10105		} );
10106
10107		// Delegate to script
10108		return "script";
10109	}
10110} );
10111
10112
10113
10114
10115// Support: Safari 8 only
10116// In Safari 8 documents created via document.implementation.createHTMLDocument
10117// collapse sibling forms: the second one becomes a child of the first one.
10118// Because of that, this security measure has to be disabled in Safari 8.
10119// https://bugs.webkit.org/show_bug.cgi?id=137337
10120support.createHTMLDocument = ( function() {
10121	var body = document.implementation.createHTMLDocument( "" ).body;
10122	body.innerHTML = "<form></form><form></form>";
10123	return body.childNodes.length === 2;
10124} )();
10125
10126
10127// Argument "data" should be string of html
10128// context (optional): If specified, the fragment will be created in this context,
10129// defaults to document
10130// keepScripts (optional): If true, will include scripts passed in the html string
10131jQuery.parseHTML = function( data, context, keepScripts ) {
10132	if ( typeof data !== "string" ) {
10133		return [];
10134	}
10135	if ( typeof context === "boolean" ) {
10136		keepScripts = context;
10137		context = false;
10138	}
10139
10140	var base, parsed, scripts;
10141
10142	if ( !context ) {
10143
10144		// Stop scripts or inline event handlers from being executed immediately
10145		// by using document.implementation
10146		if ( support.createHTMLDocument ) {
10147			context = document.implementation.createHTMLDocument( "" );
10148
10149			// Set the base href for the created document
10150			// so any parsed elements with URLs
10151			// are based on the document's URL (gh-2965)
10152			base = context.createElement( "base" );
10153			base.href = document.location.href;
10154			context.head.appendChild( base );
10155		} else {
10156			context = document;
10157		}
10158	}
10159
10160	parsed = rsingleTag.exec( data );
10161	scripts = !keepScripts && [];
10162
10163	// Single tag
10164	if ( parsed ) {
10165		return [ context.createElement( parsed[ 1 ] ) ];
10166	}
10167
10168	parsed = buildFragment( [ data ], context, scripts );
10169
10170	if ( scripts && scripts.length ) {
10171		jQuery( scripts ).remove();
10172	}
10173
10174	return jQuery.merge( [], parsed.childNodes );
10175};
10176
10177
10178/**
10179 * Load a url into a page
10180 */
10181jQuery.fn.load = function( url, params, callback ) {
10182	var selector, type, response,
10183		self = this,
10184		off = url.indexOf( " " );
10185
10186	if ( off > -1 ) {
10187		selector = stripAndCollapse( url.slice( off ) );
10188		url = url.slice( 0, off );
10189	}
10190
10191	// If it's a function
10192	if ( isFunction( params ) ) {
10193
10194		// We assume that it's the callback
10195		callback = params;
10196		params = undefined;
10197
10198	// Otherwise, build a param string
10199	} else if ( params && typeof params === "object" ) {
10200		type = "POST";
10201	}
10202
10203	// If we have elements to modify, make the request
10204	if ( self.length > 0 ) {
10205		jQuery.ajax( {
10206			url: url,
10207
10208			// If "type" variable is undefined, then "GET" method will be used.
10209			// Make value of this field explicit since
10210			// user can override it through ajaxSetup method
10211			type: type || "GET",
10212			dataType: "html",
10213			data: params
10214		} ).done( function( responseText ) {
10215
10216			// Save response for use in complete callback
10217			response = arguments;
10218
10219			self.html( selector ?
10220
10221				// If a selector was specified, locate the right elements in a dummy div
10222				// Exclude scripts to avoid IE 'Permission Denied' errors
10223				jQuery( "<div>" ).append( jQuery.parseHTML( responseText ) ).find( selector ) :
10224
10225				// Otherwise use the full result
10226				responseText );
10227
10228		// If the request succeeds, this function gets "data", "status", "jqXHR"
10229		// but they are ignored because response was set above.
10230		// If it fails, this function gets "jqXHR", "status", "error"
10231		} ).always( callback && function( jqXHR, status ) {
10232			self.each( function() {
10233				callback.apply( this, response || [ jqXHR.responseText, status, jqXHR ] );
10234			} );
10235		} );
10236	}
10237
10238	return this;
10239};
10240
10241
10242
10243
10244jQuery.expr.pseudos.animated = function( elem ) {
10245	return jQuery.grep( jQuery.timers, function( fn ) {
10246		return elem === fn.elem;
10247	} ).length;
10248};
10249
10250
10251
10252
10253jQuery.offset = {
10254	setOffset: function( elem, options, i ) {
10255		var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition,
10256			position = jQuery.css( elem, "position" ),
10257			curElem = jQuery( elem ),
10258			props = {};
10259
10260		// Set position first, in-case top/left are set even on static elem
10261		if ( position === "static" ) {
10262			elem.style.position = "relative";
10263		}
10264
10265		curOffset = curElem.offset();
10266		curCSSTop = jQuery.css( elem, "top" );
10267		curCSSLeft = jQuery.css( elem, "left" );
10268		calculatePosition = ( position === "absolute" || position === "fixed" ) &&
10269			( curCSSTop + curCSSLeft ).indexOf( "auto" ) > -1;
10270
10271		// Need to be able to calculate position if either
10272		// top or left is auto and position is either absolute or fixed
10273		if ( calculatePosition ) {
10274			curPosition = curElem.position();
10275			curTop = curPosition.top;
10276			curLeft = curPosition.left;
10277
10278		} else {
10279			curTop = parseFloat( curCSSTop ) || 0;
10280			curLeft = parseFloat( curCSSLeft ) || 0;
10281		}
10282
10283		if ( isFunction( options ) ) {
10284
10285			// Use jQuery.extend here to allow modification of coordinates argument (gh-1848)
10286			options = options.call( elem, i, jQuery.extend( {}, curOffset ) );
10287		}
10288
10289		if ( options.top != null ) {
10290			props.top = ( options.top - curOffset.top ) + curTop;
10291		}
10292		if ( options.left != null ) {
10293			props.left = ( options.left - curOffset.left ) + curLeft;
10294		}
10295
10296		if ( "using" in options ) {
10297			options.using.call( elem, props );
10298
10299		} else {
10300			curElem.css( props );
10301		}
10302	}
10303};
10304
10305jQuery.fn.extend( {
10306
10307	// offset() relates an element's border box to the document origin
10308	offset: function( options ) {
10309
10310		// Preserve chaining for setter
10311		if ( arguments.length ) {
10312			return options === undefined ?
10313				this :
10314				this.each( function( i ) {
10315					jQuery.offset.setOffset( this, options, i );
10316				} );
10317		}
10318
10319		var rect, win,
10320			elem = this[ 0 ];
10321
10322		if ( !elem ) {
10323			return;
10324		}
10325
10326		// Return zeros for disconnected and hidden (display: none) elements (gh-2310)
10327		// Support: IE <=11 only
10328		// Running getBoundingClientRect on a
10329		// disconnected node in IE throws an error
10330		if ( !elem.getClientRects().length ) {
10331			return { top: 0, left: 0 };
10332		}
10333
10334		// Get document-relative position by adding viewport scroll to viewport-relative gBCR
10335		rect = elem.getBoundingClientRect();
10336		win = elem.ownerDocument.defaultView;
10337		return {
10338			top: rect.top + win.pageYOffset,
10339			left: rect.left + win.pageXOffset
10340		};
10341	},
10342
10343	// position() relates an element's margin box to its offset parent's padding box
10344	// This corresponds to the behavior of CSS absolute positioning
10345	position: function() {
10346		if ( !this[ 0 ] ) {
10347			return;
10348		}
10349
10350		var offsetParent, offset, doc,
10351			elem = this[ 0 ],
10352			parentOffset = { top: 0, left: 0 };
10353
10354		// position:fixed elements are offset from the viewport, which itself always has zero offset
10355		if ( jQuery.css( elem, "position" ) === "fixed" ) {
10356
10357			// Assume position:fixed implies availability of getBoundingClientRect
10358			offset = elem.getBoundingClientRect();
10359
10360		} else {
10361			offset = this.offset();
10362
10363			// Account for the *real* offset parent, which can be the document or its root element
10364			// when a statically positioned element is identified
10365			doc = elem.ownerDocument;
10366			offsetParent = elem.offsetParent || doc.documentElement;
10367			while ( offsetParent &&
10368				( offsetParent === doc.body || offsetParent === doc.documentElement ) &&
10369				jQuery.css( offsetParent, "position" ) === "static" ) {
10370
10371				offsetParent = offsetParent.parentNode;
10372			}
vendor: 9,494 bytes, lines 10373-10704
10373			if ( offsetParent && offsetParent !== elem && offsetParent.nodeType === 1 ) {
10374
10375				// Incorporate borders into its offset, since they are outside its content origin
10376				parentOffset = jQuery( offsetParent ).offset();
10377				parentOffset.top += jQuery.css( offsetParent, "borderTopWidth", true );
10378				parentOffset.left += jQuery.css( offsetParent, "borderLeftWidth", true );
10379			}
10380		}
10381
10382		// Subtract parent offsets and element margins
10383		return {
10384			top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ),
10385			left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true )
10386		};
10387	},
10388
10389	// This method will return documentElement in the following cases:
10390	// 1) For the element inside the iframe without offsetParent, this method will return
10391	//    documentElement of the parent window
10392	// 2) For the hidden or detached element
10393	// 3) For body or html element, i.e. in case of the html node - it will return itself
10394	//
10395	// but those exceptions were never presented as a real life use-cases
10396	// and might be considered as more preferable results.
10397	//
10398	// This logic, however, is not guaranteed and can change at any point in the future
10399	offsetParent: function() {
10400		return this.map( function() {
10401			var offsetParent = this.offsetParent;
10402
10403			while ( offsetParent && jQuery.css( offsetParent, "position" ) === "static" ) {
10404				offsetParent = offsetParent.offsetParent;
10405			}
10406
10407			return offsetParent || documentElement;
10408		} );
10409	}
10410} );
10411
10412// Create scrollLeft and scrollTop methods
10413jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function( method, prop ) {
10414	var top = "pageYOffset" === prop;
10415
10416	jQuery.fn[ method ] = function( val ) {
10417		return access( this, function( elem, method, val ) {
10418
10419			// Coalesce documents and windows
10420			var win;
10421			if ( isWindow( elem ) ) {
10422				win = elem;
10423			} else if ( elem.nodeType === 9 ) {
10424				win = elem.defaultView;
10425			}
10426
10427			if ( val === undefined ) {
10428				return win ? win[ prop ] : elem[ method ];
10429			}
10430
10431			if ( win ) {
10432				win.scrollTo(
10433					!top ? val : win.pageXOffset,
10434					top ? val : win.pageYOffset
10435				);
10436
10437			} else {
10438				elem[ method ] = val;
10439			}
10440		}, method, val, arguments.length );
10441	};
10442} );
10443
10444// Support: Safari <=7 - 9.1, Chrome <=37 - 49
10445// Add the top/left cssHooks using jQuery.fn.position
10446// Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
10447// Blink bug: https://bugs.chromium.org/p/chromium/issues/detail?id=589347
10448// getComputedStyle returns percent when specified for top/left/bottom/right;
10449// rather than make the css module depend on the offset module, just check for it here
10450jQuery.each( [ "top", "left" ], function( _i, prop ) {
10451	jQuery.cssHooks[ prop ] = addGetHookIf( support.pixelPosition,
10452		function( elem, computed ) {
10453			if ( computed ) {
10454				computed = curCSS( elem, prop );
10455
10456				// If curCSS returns percentage, fallback to offset
10457				return rnumnonpx.test( computed ) ?
10458					jQuery( elem ).position()[ prop ] + "px" :
10459					computed;
10460			}
10461		}
10462	);
10463} );
10464
10465
10466// Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
10467jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
10468	jQuery.each( {
10469		padding: "inner" + name,
10470		content: type,
10471		"": "outer" + name
10472	}, function( defaultExtra, funcName ) {
10473
10474		// Margin is only for outerHeight, outerWidth
10475		jQuery.fn[ funcName ] = function( margin, value ) {
10476			var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ),
10477				extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" );
10478
10479			return access( this, function( elem, type, value ) {
10480				var doc;
10481
10482				if ( isWindow( elem ) ) {
10483
10484					// $( window ).outerWidth/Height return w/h including scrollbars (gh-1729)
10485					return funcName.indexOf( "outer" ) === 0 ?
10486						elem[ "inner" + name ] :
10487						elem.document.documentElement[ "client" + name ];
10488				}
10489
10490				// Get document width or height
10491				if ( elem.nodeType === 9 ) {
10492					doc = elem.documentElement;
10493
10494					// Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height],
10495					// whichever is greatest
10496					return Math.max(
10497						elem.body[ "scroll" + name ], doc[ "scroll" + name ],
10498						elem.body[ "offset" + name ], doc[ "offset" + name ],
10499						doc[ "client" + name ]
10500					);
10501				}
10502
10503				return value === undefined ?
10504
10505					// Get width or height on the element, requesting but not forcing parseFloat
10506					jQuery.css( elem, type, extra ) :
10507
10508					// Set width or height on the element
10509					jQuery.style( elem, type, value, extra );
10510			}, type, chainable ? margin : undefined, chainable );
10511		};
10512	} );
10513} );
10514
10515
10516jQuery.each( [
10517	"ajaxStart",
10518	"ajaxStop",
10519	"ajaxComplete",
10520	"ajaxError",
10521	"ajaxSuccess",
10522	"ajaxSend"
10523], function( _i, type ) {
10524	jQuery.fn[ type ] = function( fn ) {
10525		return this.on( type, fn );
10526	};
10527} );
10528
10529
10530
10531
10532jQuery.fn.extend( {
10533
10534	bind: function( types, data, fn ) {
10535		return this.on( types, null, data, fn );
10536	},
10537	unbind: function( types, fn ) {
10538		return this.off( types, null, fn );
10539	},
10540
10541	delegate: function( selector, types, data, fn ) {
10542		return this.on( types, selector, data, fn );
10543	},
10544	undelegate: function( selector, types, fn ) {
10545
10546		// ( namespace ) or ( selector, types [, fn] )
10547		return arguments.length === 1 ?
10548			this.off( selector, "**" ) :
10549			this.off( types, selector || "**", fn );
10550	},
10551
10552	hover: function( fnOver, fnOut ) {
10553		return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
10554	}
10555} );
10556
10557jQuery.each(
10558	( "blur focus focusin focusout resize scroll click dblclick " +
10559	"mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
10560	"change select submit keydown keypress keyup contextmenu" ).split( " " ),
10561	function( _i, name ) {
10562
10563		// Handle event binding
10564		jQuery.fn[ name ] = function( data, fn ) {
10565			return arguments.length > 0 ?
10566				this.on( name, null, data, fn ) :
10567				this.trigger( name );
10568		};
10569	}
10570);
10571
10572
10573
10574
10575// Support: Android <=4.0 only
10576// Make sure we trim BOM and NBSP
10577// Require that the "whitespace run" starts from a non-whitespace
10578// to avoid O(N^2) behavior when the engine would try matching "\s+$" at each space position.
10579var rtrim = /^[\s\uFEFF\xA0]+|([^\s\uFEFF\xA0])[\s\uFEFF\xA0]+$/g;
10580
10581// Bind a function to a context, optionally partially applying any
10582// arguments.
10583// jQuery.proxy is deprecated to promote standards (specifically Function#bind)
10584// However, it is not slated for removal any time soon
10585jQuery.proxy = function( fn, context ) {
10586	var tmp, args, proxy;
10587
10588	if ( typeof context === "string" ) {
10589		tmp = fn[ context ];
10590		context = fn;
10591		fn = tmp;
10592	}
10593
10594	// Quick check to determine if target is callable, in the spec
10595	// this throws a TypeError, but we will just return undefined.
10596	if ( !isFunction( fn ) ) {
10597		return undefined;
10598	}
10599
10600	// Simulated bind
10601	args = slice.call( arguments, 2 );
10602	proxy = function() {
10603		return fn.apply( context || this, args.concat( slice.call( arguments ) ) );
10604	};
10605
10606	// Set the guid of unique handler to the same of original handler, so it can be removed
10607	proxy.guid = fn.guid = fn.guid || jQuery.guid++;
10608
10609	return proxy;
10610};
10611
10612jQuery.holdReady = function( hold ) {
10613	if ( hold ) {
10614		jQuery.readyWait++;
10615	} else {
10616		jQuery.ready( true );
10617	}
10618};
10619jQuery.isArray = Array.isArray;
10620jQuery.parseJSON = JSON.parse;
10621jQuery.nodeName = nodeName;
10622jQuery.isFunction = isFunction;
10623jQuery.isWindow = isWindow;
10624jQuery.camelCase = camelCase;
10625jQuery.type = toType;
10626
10627jQuery.now = Date.now;
10628
10629jQuery.isNumeric = function( obj ) {
10630
10631	// As of jQuery 3.0, isNumeric is limited to
10632	// strings and numbers (primitives or objects)
10633	// that can be coerced to finite numbers (gh-2662)
10634	var type = jQuery.type( obj );
10635	return ( type === "number" || type === "string" ) &&
10636
10637		// parseFloat NaNs numeric-cast false positives ("")
10638		// ...but misinterprets leading-number strings, particularly hex literals ("0x...")
10639		// subtraction forces infinities to NaN
10640		!isNaN( obj - parseFloat( obj ) );
10641};
10642
10643jQuery.trim = function( text ) {
10644	return text == null ?
10645		"" :
10646		( text + "" ).replace( rtrim, "$1" );
10647};
10648
10649
10650
10651// Register as a named AMD module, since jQuery can be concatenated with other
10652// files that may use define, but not via a proper concatenation script that
10653// understands anonymous AMD modules. A named AMD is safest and most robust
10654// way to register. Lowercase jquery is used because AMD module names are
10655// derived from file names, and jQuery is normally delivered in a lowercase
10656// file name. Do this after creating the global so that if an AMD module wants
10657// to call noConflict to hide this version of jQuery, it will work.
10658
10659// Note that for maximum portability, libraries that are not jQuery should
10660// declare themselves as anonymous modules, and avoid setting a global if an
10661// AMD loader is present. jQuery is a special case. For more information, see
10662// https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon
10663
10664if ( typeof define === "function" && define.amd ) {
10665	define( "jquery", [], function() {
10666		return jQuery;
10667	} );
10668}
10669
10670
10671
10672
10673var
10674
10675	// Map over jQuery in case of overwrite
10676	_jQuery = window.jQuery,
10677
10678	// Map over the $ in case of overwrite
10679	_$ = window.$;
10680
10681jQuery.noConflict = function( deep ) {
10682	if ( window.$ === jQuery ) {
10683		window.$ = _$;
10684	}
10685
10686	if ( deep && window.jQuery === jQuery ) {
10687		window.jQuery = _jQuery;
10688	}
10689
10690	return jQuery;
10691};
10692
10693// Expose jQuery and $ identifiers, even in AMD
10694// (trac-7102#comment:10, https://github.com/jquery/jquery/pull/557)
10695// and CommonJS for browser emulators (trac-13566)
10696if ( typeof noGlobal === "undefined" ) {
10697	window.jQuery = window.$ = jQuery;
10698}
10699
10700
10701
10702
10703return jQuery;
10704} );
10705// Included only in the minified build, via Uglify2
10706// Only turn warnings off if not already overridden
10707if ( typeof jQuery.migrateMute === "undefined" ) {
10708	jQuery.migrateMute = true;
10709};
10710/*!
10711 * jQuery Migrate - v3.5.2 - 2024-07-17T22:31Z
10712 * Copyright OpenJS Foundation and other contributors
10713 */
10714( function( factory ) {
10715	"use strict";
10716
10717	if ( typeof define === "function" && define.amd ) {
10718
10719		// AMD. Register as an anonymous module.
10720		define( [ "jquery" ], function( jQuery ) {
10721			return factory( jQuery, window );
10722		} );
10723	} else if ( typeof module === "object" && module.exports ) {
10724
10725		// Node/CommonJS
10726		// eslint-disable-next-line no-undef
10727		module.exports = factory( require( "jquery" ), window );
10728	} else {
10729
10730		// Browser globals
10731		factory( jQuery, window );
10732	}
10733} )( function( jQuery, window ) {
10734"use strict";
10735
10736jQuery.migrateVersion = "3.5.2";
10737
10738// Returns 0 if v1 == v2, -1 if v1 < v2, 1 if v1 > v2
10739function compareVersions( v1, v2 ) {
10740	var i,
10741		rVersionParts = /^(\d+)\.(\d+)\.(\d+)/,
10742		v1p = rVersionParts.exec( v1 ) || [ ],
10743		v2p = rVersionParts.exec( v2 ) || [ ];
10744
10745	for ( i = 1; i <= 3; i++ ) {
10746		if ( +v1p[ i ] > +v2p[ i ] ) {
10747			return 1;
10748		}
10749		if ( +v1p[ i ] < +v2p[ i ] ) {
10750			return -1;
10751		}
10752	}
10753	return 0;
10754}
10755
10756function jQueryVersionSince( version ) {
10757	return compareVersions( jQuery.fn.jquery, version ) >= 0;
10758}
10759
10760// A map from disabled patch codes to `true`. This should really
10761// be a `Set` but those are unsupported in IE.
10762var disabledPatches = Object.create( null );
10763
10764// Don't apply patches for specified codes. Helpful for code bases
10765// where some Migrate warnings have been addressed and it's desirable
10766// to avoid needless patches or false positives.
10767jQuery.migrateDisablePatches = function() {
10768	var i;
10769	for ( i = 0; i < arguments.length; i++ ) {
10770		disabledPatches[ arguments[ i ] ] = true;
10771	}
10772};
10773
10774// Allow enabling patches disabled via `jQuery.migrateDisablePatches`.
10775// Helpful if you want to disable a patch only for some code that won't
10776// be updated soon to be able to focus on other warnings - and enable it
10777// immediately after such a call:
10778// ```js
10779// jQuery.migrateDisablePatches( "workaroundA" );
10780// elem.pluginViolatingWarningA( "pluginMethod" );
10781// jQuery.migrateEnablePatches( "workaroundA" );
10782// ```
10783jQuery.migrateEnablePatches = function() {
10784	var i;
10785	for ( i = 0; i < arguments.length; i++ ) {
10786		delete disabledPatches[ arguments[ i ] ];
10787	}
10788};
10789
10790jQuery.migrateIsPatchEnabled = function( patchCode ) {
10791	return !disabledPatches[ patchCode ];
10792};
10793
10794( function() {
10795
10796// Support: IE9 only
10797// IE9 only creates console object when dev tools are first opened
10798// IE9 console is a host object, callable but doesn't have .apply()
10799if ( !window.console || !window.console.log ) {
10800	return;
10801}
10802
10803// Need jQuery 3.x-4.x and no older Migrate loaded
10804if ( !jQuery || !jQueryVersionSince( "3.0.0" ) ||
10805		jQueryVersionSince( "5.0.0" ) ) {
10806	window.console.log( "JQMIGRATE: jQuery 3.x-4.x REQUIRED" );
10807}
10808if ( jQuery.migrateWarnings ) {
10809	window.console.log( "JQMIGRATE: Migrate plugin loaded multiple times" );
10810}
10811
10812// Show a message on the console so devs know we're active
10813window.console.log( "JQMIGRATE: Migrate is installed" +
10814	( jQuery.migrateMute ? "" : " with logging active" ) +
10815	", version " + jQuery.migrateVersion );
10816
10817} )();
10818
10819var warnedAbout = {};
10820
10821// By default each warning is only reported once.
10822jQuery.migrateDeduplicateWarnings = true;
10823
10824// List of warnings already given; public read only
10825jQuery.migrateWarnings = [];
10826
10827// Set to false to disable traces that appear with warnings
10828if ( jQuery.migrateTrace === undefined ) {
10829	jQuery.migrateTrace = true;
10830}
10831
10832// Forget any warnings we've already given; public
10833jQuery.migrateReset = function() {
10834	warnedAbout = {};
10835	jQuery.migrateWarnings.length = 0;
10836};
10837
10838function migrateWarn( code, msg ) {
10839	var console = window.console;
10840	if ( jQuery.migrateIsPatchEnabled( code ) &&
10841		( !jQuery.migrateDeduplicateWarnings || !warnedAbout[ msg ] ) ) {
10842		warnedAbout[ msg ] = true;
10843		jQuery.migrateWarnings.push( msg + " [" + code + "]" );
10844		if ( console && console.warn && !jQuery.migrateMute ) {
10845			console.warn( "JQMIGRATE: " + msg );
10846			if ( jQuery.migrateTrace && console.trace ) {
10847				console.trace();
10848			}
10849		}
10850	}
10851}
10852
10853function migrateWarnProp( obj, prop, value, code, msg ) {
10854	Object.defineProperty( obj, prop, {
10855		configurable: true,
10856		enumerable: true,
10857		get: function() {
10858			migrateWarn( code, msg );
10859			return value;
10860		},
10861		set: function( newValue ) {
10862			migrateWarn( code, msg );
10863			value = newValue;
10864		}
10865	} );
10866}
10867
10868function migrateWarnFuncInternal( obj, prop, newFunc, code, msg ) {
10869	var finalFunc,
10870		origFunc = obj[ prop ];
10871
10872	obj[ prop ] = function() {
10873
10874		// If `msg` not provided, do not warn; more sophisticated warnings
10875		// logic is most likely embedded in `newFunc`, in that case here
10876		// we just care about the logic choosing the proper implementation
10877		// based on whether the patch is disabled or not.
10878		if ( msg ) {
10879			migrateWarn( code, msg );
10880		}
10881
10882		// Since patches can be disabled & enabled dynamically, we
10883		// need to decide which implementation to run on each invocation.
10884		finalFunc = jQuery.migrateIsPatchEnabled( code ) ?
10885			newFunc :
10886
10887			// The function may not have existed originally so we need a fallback.
10888			( origFunc || jQuery.noop );
10889
10890		return finalFunc.apply( this, arguments );
10891	};
10892}
10893
10894function migratePatchAndWarnFunc( obj, prop, newFunc, code, msg ) {
10895	if ( !msg ) {
10896		throw new Error( "No warning message provided" );
10897	}
10898	return migrateWarnFuncInternal( obj, prop, newFunc, code, msg );
10899}
10900
10901function migratePatchFunc( obj, prop, newFunc, code ) {
10902	return migrateWarnFuncInternal( obj, prop, newFunc, code );
10903}
10904
10905if ( window.document.compatMode === "BackCompat" ) {
10906
10907	// jQuery has never supported or tested Quirks Mode
10908	migrateWarn( "quirks", "jQuery is not compatible with Quirks Mode" );
10909}
10910
10911var findProp,
10912	class2type = {},
10913	oldInit = jQuery.fn.init,
10914	oldFind = jQuery.find,
10915
10916	rattrHashTest = /\[(\s*[-\w]+\s*)([~|^$*]?=)\s*([-\w#]*?#[-\w#]*)\s*\]/,
10917	rattrHashGlob = /\[(\s*[-\w]+\s*)([~|^$*]?=)\s*([-\w#]*?#[-\w#]*)\s*\]/g,
10918
10919	// Require that the "whitespace run" starts from a non-whitespace
10920	// to avoid O(N^2) behavior when the engine would try matching "\s+$" at each space position.
10921	rtrim = /^[\s\uFEFF\xA0]+|([^\s\uFEFF\xA0])[\s\uFEFF\xA0]+$/g;
10922
10923migratePatchFunc( jQuery.fn, "init", function( arg1 ) {
10924	var args = Array.prototype.slice.call( arguments );
10925
10926	if ( jQuery.migrateIsPatchEnabled( "selector-empty-id" ) &&
10927		typeof arg1 === "string" && arg1 === "#" ) {
10928
10929		// JQuery( "#" ) is a bogus ID selector, but it returned an empty set
10930		// before jQuery 3.0
10931		migrateWarn( "selector-empty-id", "jQuery( '#' ) is not a valid selector" );
10932		args[ 0 ] = [];
10933	}
10934
10935	return oldInit.apply( this, args );
10936}, "selector-empty-id" );
10937
10938// This is already done in Core but the above patch will lose this assignment
10939// so we need to redo it. It doesn't matter whether the patch is enabled or not
10940// as the method is always going to be a Migrate-created wrapper.
10941jQuery.fn.init.prototype = jQuery.fn;
10942
10943migratePatchFunc( jQuery, "find", function( selector ) {
10944	var args = Array.prototype.slice.call( arguments );
10945
10946	// Support: PhantomJS 1.x
10947	// String#match fails to match when used with a //g RegExp, only on some strings
10948	if ( typeof selector === "string" && rattrHashTest.test( selector ) ) {
10949
10950		// The nonstandard and undocumented unquoted-hash was removed in jQuery 1.12.0
10951		// First see if qS thinks it's a valid selector, if so avoid a false positive
10952		try {
10953			window.document.querySelector( selector );
10954		} catch ( err1 ) {
10955
10956			// Didn't *look* valid to qSA, warn and try quoting what we think is the value
10957			selector = selector.replace( rattrHashGlob, function( _, attr, op, value ) {
10958				return "[" + attr + op + "\"" + value + "\"]";
10959			} );
10960
10961			// If the regexp *may* have created an invalid selector, don't update it
10962			// Note that there may be false alarms if selector uses jQuery extensions
10963			try {
10964				window.document.querySelector( selector );
10965				migrateWarn( "selector-hash",
10966					"Attribute selector with '#' must be quoted: " + args[ 0 ] );
10967				args[ 0 ] = selector;
10968			} catch ( err2 ) {
10969				migrateWarn( "selector-hash",
10970					"Attribute selector with '#' was not fixed: " + args[ 0 ] );
10971			}
10972		}
10973	}
10974
10975	return oldFind.apply( this, args );
10976}, "selector-hash" );
10977
10978// Copy properties attached to original jQuery.find method (e.g. .attr, .isXML)
10979for ( findProp in oldFind ) {
10980	if ( Object.prototype.hasOwnProperty.call( oldFind, findProp ) ) {
10981		jQuery.find[ findProp ] = oldFind[ findProp ];
10982	}
10983}
10984
10985// The number of elements contained in the matched element set
10986migratePatchAndWarnFunc( jQuery.fn, "size", function() {
10987	return this.length;
10988}, "size",
10989"jQuery.fn.size() is deprecated and removed; use the .length property" );
10990
10991migratePatchAndWarnFunc( jQuery, "parseJSON", function() {
10992	return JSON.parse.apply( null, arguments );
10993}, "parseJSON",
10994"jQuery.parseJSON is deprecated; use JSON.parse" );
10995
10996migratePatchAndWarnFunc( jQuery, "holdReady", jQuery.holdReady,
10997	"holdReady", "jQuery.holdReady is deprecated" );
10998
10999migratePatchAndWarnFunc( jQuery, "unique", jQuery.uniqueSort,
11000	"unique", "jQuery.unique is deprecated; use jQuery.uniqueSort" );
11001
11002// Now jQuery.expr.pseudos is the standard incantation
11003migrateWarnProp( jQuery.expr, "filters", jQuery.expr.pseudos, "expr-pre-pseudos",
11004	"jQuery.expr.filters is deprecated; use jQuery.expr.pseudos" );
11005migrateWarnProp( jQuery.expr, ":", jQuery.expr.pseudos, "expr-pre-pseudos",
11006	"jQuery.expr[':'] is deprecated; use jQuery.expr.pseudos" );
11007
11008// Prior to jQuery 3.1.1 there were internal refs so we don't warn there
11009if ( jQueryVersionSince( "3.1.1" ) ) {
11010	migratePatchAndWarnFunc( jQuery, "trim", function( text ) {
11011		return text == null ?
11012			"" :
11013			( text + "" ).replace( rtrim, "$1" );
11014	}, "trim",
11015	"jQuery.trim is deprecated; use String.prototype.trim" );
11016}
11017
11018// Prior to jQuery 3.2 there were internal refs so we don't warn there
11019if ( jQueryVersionSince( "3.2.0" ) ) {
11020	migratePatchAndWarnFunc( jQuery, "nodeName", function( elem, name ) {
11021		return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
11022	}, "nodeName",
11023	"jQuery.nodeName is deprecated" );
11024
11025	migratePatchAndWarnFunc( jQuery, "isArray", Array.isArray, "isArray",
11026		"jQuery.isArray is deprecated; use Array.isArray"
11027	);
11028}
11029
11030if ( jQueryVersionSince( "3.3.0" ) ) {
11031
11032	migratePatchAndWarnFunc( jQuery, "isNumeric",
11033		function( obj ) {
11034
11035			// As of jQuery 3.0, isNumeric is limited to
11036			// strings and numbers (primitives or objects)
11037			// that can be coerced to finite numbers (gh-2662)
11038			var type = typeof obj;
11039			return ( type === "number" || type === "string" ) &&
11040
11041				// parseFloat NaNs numeric-cast false positives ("")
11042				// ...but misinterprets leading-number strings, e.g. hex literals ("0x...")
11043				// subtraction forces infinities to NaN
11044				!isNaN( obj - parseFloat( obj ) );
11045		}, "isNumeric",
11046		"jQuery.isNumeric() is deprecated"
11047	);
11048
11049	// Populate the class2type map
11050	jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".
11051		split( " " ),
11052	function( _, name ) {
11053		class2type[ "[object " + name + "]" ] = name.toLowerCase();
11054	} );
11055
11056	migratePatchAndWarnFunc( jQuery, "type", function( obj ) {
11057		if ( obj == null ) {
11058			return obj + "";
11059		}
11060
11061		// Support: Android <=2.3 only (functionish RegExp)
11062		return typeof obj === "object" || typeof obj === "function" ?
11063			class2type[ Object.prototype.toString.call( obj ) ] || "object" :
11064			typeof obj;
11065	}, "type",
11066	"jQuery.type is deprecated" );
11067
11068	migratePatchAndWarnFunc( jQuery, "isFunction",
11069		function( obj ) {
11070			return typeof obj === "function";
11071		}, "isFunction",
11072		"jQuery.isFunction() is deprecated" );
11073
11074	migratePatchAndWarnFunc( jQuery, "isWindow",
11075		function( obj ) {
11076			return obj != null && obj === obj.window;
11077		}, "isWindow",
11078		"jQuery.isWindow() is deprecated"
11079	);
11080}
11081
11082// Support jQuery slim which excludes the ajax module
11083if ( jQuery.ajax ) {
11084
11085var oldAjax = jQuery.ajax,
11086	rjsonp = /(=)\?(?=&|$)|\?\?/;
11087
11088migratePatchFunc( jQuery, "ajax", function() {
11089	var jQXHR = oldAjax.apply( this, arguments );
11090
11091	// Be sure we got a jQXHR (e.g., not sync)
11092	if ( jQXHR.promise ) {
11093		migratePatchAndWarnFunc( jQXHR, "success", jQXHR.done, "jqXHR-methods",
11094			"jQXHR.success is deprecated and removed" );
11095		migratePatchAndWarnFunc( jQXHR, "error", jQXHR.fail, "jqXHR-methods",
11096			"jQXHR.error is deprecated and removed" );
11097		migratePatchAndWarnFunc( jQXHR, "complete", jQXHR.always, "jqXHR-methods",
11098			"jQXHR.complete is deprecated and removed" );
11099	}
11100
11101	return jQXHR;
11102}, "jqXHR-methods" );
11103
11104// Only trigger the logic in jQuery <4 as the JSON-to-JSONP auto-promotion
11105// behavior is gone in jQuery 4.0 and as it has security implications, we don't
11106// want to restore the legacy behavior.
11107if ( !jQueryVersionSince( "4.0.0" ) ) {
11108
11109	// Register this prefilter before the jQuery one. Otherwise, a promoted
11110	// request is transformed into one with the script dataType and we can't
11111	// catch it anymore.
11112	jQuery.ajaxPrefilter( "+json", function( s ) {
11113
11114		// Warn if JSON-to-JSONP auto-promotion happens.
11115		if ( s.jsonp !== false && ( rjsonp.test( s.url ) ||
11116				typeof s.data === "string" &&
11117				( s.contentType || "" )
11118					.indexOf( "application/x-www-form-urlencoded" ) === 0 &&
11119				rjsonp.test( s.data )
11120		) ) {
11121			migrateWarn( "jsonp-promotion", "JSON-to-JSONP auto-promotion is deprecated" );
11122		}
11123	} );
11124}
11125
11126}
11127
11128var oldRemoveAttr = jQuery.fn.removeAttr,
11129	oldToggleClass = jQuery.fn.toggleClass,
11130	rbooleans = /^(?:checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped)$/i,
11131	rmatchNonSpace = /\S+/g;
11132
11133migratePatchFunc( jQuery.fn, "removeAttr", function( name ) {
11134	var self = this,
11135		patchNeeded = false;
11136
11137	jQuery.each( name.match( rmatchNonSpace ), function( _i, attr ) {
11138		if ( rbooleans.test( attr ) ) {
11139
11140			// Only warn if at least a single node had the property set to
11141			// something else than `false`. Otherwise, this Migrate patch
11142			// doesn't influence the behavior and there's no need to set or warn.
11143			self.each( function() {
11144				if ( jQuery( this ).prop( attr ) !== false ) {
11145					patchNeeded = true;
11146					return false;
11147				}
11148			} );
11149		}
11150
11151		if ( patchNeeded ) {
11152			migrateWarn( "removeAttr-bool",
11153				"jQuery.fn.removeAttr no longer sets boolean properties: " + attr );
11154			self.prop( attr, false );
11155		}
11156	} );
11157
11158	return oldRemoveAttr.apply( this, arguments );
11159}, "removeAttr-bool" );
11160
11161migratePatchFunc( jQuery.fn, "toggleClass", function( state ) {
11162
11163	// Only deprecating no-args or single boolean arg
11164	if ( state !== undefined && typeof state !== "boolean" ) {
11165
11166		return oldToggleClass.apply( this, arguments );
11167	}
11168
11169	migrateWarn( "toggleClass-bool", "jQuery.fn.toggleClass( boolean ) is deprecated" );
11170
11171	// Toggle entire class name of each element
11172	return this.each( function() {
11173		var className = this.getAttribute && this.getAttribute( "class" ) || "";
11174
11175		if ( className ) {
11176			jQuery.data( this, "__className__", className );
11177		}
11178
11179		// If the element has a class name or if we're passed `false`,
11180		// then remove the whole classname (if there was one, the above saved it).
11181		// Otherwise bring back whatever was previously saved (if anything),
11182		// falling back to the empty string if nothing was stored.
11183		if ( this.setAttribute ) {
11184			this.setAttribute( "class",
11185				className || state === false ?
11186					"" :
11187					jQuery.data( this, "__className__" ) || ""
11188			);
11189		}
11190	} );
11191}, "toggleClass-bool" );
11192
11193function camelCase( string ) {
11194	return string.replace( /-([a-z])/g, function( _, letter ) {
11195		return letter.toUpperCase();
11196	} );
11197}
11198
11199var origFnCss, internalCssNumber,
11200	internalSwapCall = false,
11201	ralphaStart = /^[a-z]/,
11202
11203	// The regex visualized:
11204	//
11205	//                         /----------\
11206	//                        |            |    /-------\
11207	//                        |  / Top  \  |   |         |
11208	//         /--- Border ---+-| Right  |-+---+- Width -+---\
11209	//        |                 | Bottom |                    |
11210	//        |                  \ Left /                     |
11211	//        |                                               |
11212	//        |                              /----------\     |
11213	//        |          /-------------\    |            |    |- END
11214	//        |         |               |   |  / Top  \  |    |
11215	//        |         |  / Margin  \  |   | | Right  | |    |
11216	//        |---------+-|           |-+---+-| Bottom |-+----|
11217	//        |            \ Padding /         \ Left /       |
11218	// BEGIN -|                                               |
11219	//        |                /---------\                    |
11220	//        |               |           |                   |
11221	//        |               |  / Min \  |    / Width  \     |
11222	//         \--------------+-|       |-+---|          |---/
11223	//                           \ Max /       \ Height /
11224	rautoPx = /^(?:Border(?:Top|Right|Bottom|Left)?(?:Width|)|(?:Margin|Padding)?(?:Top|Right|Bottom|Left)?|(?:Min|Max)?(?:Width|Height))$/;
11225
11226// If this version of jQuery has .swap(), don't false-alarm on internal uses
11227if ( jQuery.swap ) {
11228	jQuery.each( [ "height", "width", "reliableMarginRight" ], function( _, name ) {
11229		var oldHook = jQuery.cssHooks[ name ] && jQuery.cssHooks[ name ].get;
11230
11231		if ( oldHook ) {
11232			jQuery.cssHooks[ name ].get = function() {
11233				var ret;
11234
11235				internalSwapCall = true;
11236				ret = oldHook.apply( this, arguments );
11237				internalSwapCall = false;
11238				return ret;
11239			};
11240		}
11241	} );
11242}
11243
11244migratePatchFunc( jQuery, "swap", function( elem, options, callback, args ) {
11245	var ret, name,
11246		old = {};
11247
11248	if ( !internalSwapCall ) {
11249		migrateWarn( "swap", "jQuery.swap() is undocumented and deprecated" );
11250	}
11251
11252	// Remember the old values, and insert the new ones
11253	for ( name in options ) {
11254		old[ name ] = elem.style[ name ];
11255		elem.style[ name ] = options[ name ];
11256	}
11257
11258	ret = callback.apply( elem, args || [] );
11259
11260	// Revert the old values
11261	for ( name in options ) {
11262		elem.style[ name ] = old[ name ];
11263	}
11264
11265	return ret;
11266}, "swap" );
11267
11268if ( jQueryVersionSince( "3.4.0" ) && typeof Proxy !== "undefined" ) {
11269	jQuery.cssProps = new Proxy( jQuery.cssProps || {}, {
11270		set: function() {
11271			migrateWarn( "cssProps", "jQuery.cssProps is deprecated" );
11272			return Reflect.set.apply( this, arguments );
11273		}
11274	} );
11275}
11276
11277// In jQuery >=4 where jQuery.cssNumber is missing fill it with the latest 3.x version:
11278// https://github.com/jquery/jquery/blob/3.7.1/src/css.js#L216-L246
11279// This way, number values for the CSS properties below won't start triggering
11280// Migrate warnings when jQuery gets updated to >=4.0.0 (gh-438).
11281if ( jQueryVersionSince( "4.0.0" ) ) {
11282
11283	// We need to keep this as a local variable as we need it internally
11284	// in a `jQuery.fn.css` patch and this usage shouldn't warn.
11285	internalCssNumber = {
11286		animationIterationCount: true,
11287		aspectRatio: true,
11288		borderImageSlice: true,
11289		columnCount: true,
11290		flexGrow: true,
11291		flexShrink: true,
11292		fontWeight: true,
11293		gridArea: true,
11294		gridColumn: true,
11295		gridColumnEnd: true,
11296		gridColumnStart: true,
11297		gridRow: true,
11298		gridRowEnd: true,
11299		gridRowStart: true,
11300		lineHeight: true,
11301		opacity: true,
11302		order: true,
11303		orphans: true,
11304		scale: true,
11305		widows: true,
11306		zIndex: true,
11307		zoom: true,
11308
11309		// SVG-related
11310		fillOpacity: true,
11311		floodOpacity: true,
11312		stopOpacity: true,
11313		strokeMiterlimit: true,
11314		strokeOpacity: true
11315	};
11316
11317	if ( typeof Proxy !== "undefined" ) {
11318		jQuery.cssNumber = new Proxy( internalCssNumber, {
11319			get: function() {
11320				migrateWarn( "css-number", "jQuery.cssNumber is deprecated" );
11321				return Reflect.get.apply( this, arguments );
11322			},
11323			set: function() {
11324				migrateWarn( "css-number", "jQuery.cssNumber is deprecated" );
11325				return Reflect.set.apply( this, arguments );
11326			}
11327		} );
11328	} else {
11329
11330		// Support: IE 9-11+
11331		// IE doesn't support proxies, but we still want to restore the legacy
11332		// jQuery.cssNumber there.
11333		jQuery.cssNumber = internalCssNumber;
11334	}
11335} else {
11336
11337	// Make `internalCssNumber` defined for jQuery <4 as well as it's needed
11338	// in the `jQuery.fn.css` patch below.
11339	internalCssNumber = jQuery.cssNumber;
11340}
11341
11342function isAutoPx( prop ) {
11343
11344	// The first test is used to ensure that:
11345	// 1. The prop starts with a lowercase letter (as we uppercase it for the second regex).
11346	// 2. The prop is not empty.
11347	return ralphaStart.test( prop ) &&
11348		rautoPx.test( prop[ 0 ].toUpperCase() + prop.slice( 1 ) );
11349}
11350
11351origFnCss = jQuery.fn.css;
11352
11353migratePatchFunc( jQuery.fn, "css", function( name, value ) {
11354	var camelName,
11355		origThis = this;
11356
11357	if ( name && typeof name === "object" && !Array.isArray( name ) ) {
11358		jQuery.each( name, function( n, v ) {
11359			jQuery.fn.css.call( origThis, n, v );
11360		} );
11361		return this;
11362	}
11363
11364	if ( typeof value === "number" ) {
11365		camelName = camelCase( name );
11366
11367		// Use `internalCssNumber` to avoid triggering our warnings in this
11368		// internal check.
11369		if ( !isAutoPx( camelName ) && !internalCssNumber[ camelName ] ) {
11370			migrateWarn( "css-number",
11371				"Number-typed values are deprecated for jQuery.fn.css( \"" +
11372				name + "\", value )" );
11373		}
11374	}
11375
11376	return origFnCss.apply( this, arguments );
11377}, "css-number" );
11378
11379var origData = jQuery.data;
11380
11381migratePatchFunc( jQuery, "data", function( elem, name, value ) {
11382	var curData, sameKeys, key;
11383
11384	// Name can be an object, and each entry in the object is meant to be set as data
11385	if ( name && typeof name === "object" && arguments.length === 2 ) {
11386
11387		curData = jQuery.hasData( elem ) && origData.call( this, elem );
11388		sameKeys = {};
11389		for ( key in name ) {
11390			if ( key !== camelCase( key ) ) {
11391				migrateWarn( "data-camelCase",
11392					"jQuery.data() always sets/gets camelCased names: " + key );
11393				curData[ key ] = name[ key ];
11394			} else {
11395				sameKeys[ key ] = name[ key ];
11396			}
11397		}
11398
11399		origData.call( this, elem, sameKeys );
11400
11401		return name;
11402	}
11403
11404	// If the name is transformed, look for the un-transformed name in the data object
11405	if ( name && typeof name === "string" && name !== camelCase( name ) ) {
11406
11407		curData = jQuery.hasData( elem ) && origData.call( this, elem );
11408		if ( curData && name in curData ) {
11409			migrateWarn( "data-camelCase",
11410				"jQuery.data() always sets/gets camelCased names: " + name );
11411			if ( arguments.length > 2 ) {
11412				curData[ name ] = value;
11413			}
11414			return curData[ name ];
11415		}
11416	}
11417
11418	return origData.apply( this, arguments );
11419}, "data-camelCase" );
11420
11421// Support jQuery slim which excludes the effects module
11422if ( jQuery.fx ) {
11423
11424var intervalValue, intervalMsg,
11425	oldTweenRun = jQuery.Tween.prototype.run,
11426	linearEasing = function( pct ) {
11427		return pct;
11428	};
11429
11430migratePatchFunc( jQuery.Tween.prototype, "run", function( ) {
11431	if ( jQuery.easing[ this.easing ].length > 1 ) {
11432		migrateWarn(
11433			"easing-one-arg",
11434			"'jQuery.easing." + this.easing.toString() + "' should use only one argument"
11435		);
11436
11437		jQuery.easing[ this.easing ] = linearEasing;
11438	}
11439
11440	oldTweenRun.apply( this, arguments );
11441}, "easing-one-arg" );
11442
11443intervalValue = jQuery.fx.interval;
11444intervalMsg = "jQuery.fx.interval is deprecated";
11445
11446// Support: IE9, Android <=4.4
11447// Avoid false positives on browsers that lack rAF
11448// Don't warn if document is hidden, jQuery uses setTimeout (#292)
11449if ( window.requestAnimationFrame ) {
11450	Object.defineProperty( jQuery.fx, "interval", {
11451		configurable: true,
11452		enumerable: true,
11453		get: function() {
11454			if ( !window.document.hidden ) {
11455				migrateWarn( "fx-interval", intervalMsg );
11456			}
11457
11458			// Only fallback to the default if patch is enabled
11459			if ( !jQuery.migrateIsPatchEnabled( "fx-interval" ) ) {
11460				return intervalValue;
11461			}
11462			return intervalValue === undefined ? 13 : intervalValue;
11463		},
11464		set: function( newValue ) {
11465			migrateWarn( "fx-interval", intervalMsg );
11466			intervalValue = newValue;
11467		}
11468	} );
11469}
11470
11471}
11472
11473var oldLoad = jQuery.fn.load,
11474	oldEventAdd = jQuery.event.add,
11475	originalFix = jQuery.event.fix;
11476
11477jQuery.event.props = [];
11478jQuery.event.fixHooks = {};
11479
11480migrateWarnProp( jQuery.event.props, "concat", jQuery.event.props.concat,
11481	"event-old-patch",
11482	"jQuery.event.props.concat() is deprecated and removed" );
11483
11484migratePatchFunc( jQuery.event, "fix", function( originalEvent ) {
11485	var event,
11486		type = originalEvent.type,
11487		fixHook = this.fixHooks[ type ],
11488		props = jQuery.event.props;
11489
11490	if ( props.length ) {
11491		migrateWarn( "event-old-patch",
11492			"jQuery.event.props are deprecated and removed: " + props.join() );
11493		while ( props.length ) {
11494			jQuery.event.addProp( props.pop() );
11495		}
11496	}
11497
11498	if ( fixHook && !fixHook._migrated_ ) {
11499		fixHook._migrated_ = true;
11500		migrateWarn( "event-old-patch",
11501			"jQuery.event.fixHooks are deprecated and removed: " + type );
11502		if ( ( props = fixHook.props ) && props.length ) {
11503			while ( props.length ) {
11504				jQuery.event.addProp( props.pop() );
11505			}
11506		}
11507	}
11508
11509	event = originalFix.call( this, originalEvent );
11510
11511	return fixHook && fixHook.filter ?
11512		fixHook.filter( event, originalEvent ) :
11513		event;
11514}, "event-old-patch" );
11515
11516migratePatchFunc( jQuery.event, "add", function( elem, types ) {
11517
11518	// This misses the multiple-types case but that seems awfully rare
11519	if ( elem === window && types === "load" && window.document.readyState === "complete" ) {
11520		migrateWarn( "load-after-event",
11521			"jQuery(window).on('load'...) called after load event occurred" );
11522	}
11523	return oldEventAdd.apply( this, arguments );
11524}, "load-after-event" );
11525
11526jQuery.each( [ "load", "unload", "error" ], function( _, name ) {
11527
11528	migratePatchFunc( jQuery.fn, name, function() {
11529		var args = Array.prototype.slice.call( arguments, 0 );
11530
11531		// If this is an ajax load() the first arg should be the string URL;
11532		// technically this could also be the "Anything" arg of the event .load()
11533		// which just goes to show why this dumb signature has been deprecated!
11534		// jQuery custom builds that exclude the Ajax module justifiably die here.
11535		if ( name === "load" && typeof args[ 0 ] === "string" ) {
11536			return oldLoad.apply( this, args );
11537		}
11538
11539		migrateWarn( "shorthand-removed-v3",
11540			"jQuery.fn." + name + "() is deprecated" );
11541
11542		args.splice( 0, 0, name );
11543		if ( arguments.length ) {
11544			return this.on.apply( this, args );
11545		}
11546
11547		// Use .triggerHandler here because:
11548		// - load and unload events don't need to bubble, only applied to window or image
11549		// - error event should not bubble to window, although it does pre-1.7
11550		// See http://bugs.jquery.com/ticket/11820
11551		this.triggerHandler.apply( this, args );
11552		return this;
11553	}, "shorthand-removed-v3" );
11554
11555} );
11556
11557jQuery.each( ( "blur focus focusin focusout resize scroll click dblclick " +
11558	"mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
11559	"change select submit keydown keypress keyup contextmenu" ).split( " " ),
11560function( _i, name ) {
11561
11562	// Handle event binding
11563	migratePatchAndWarnFunc( jQuery.fn, name, function( data, fn ) {
11564		return arguments.length > 0 ?
11565			this.on( name, null, data, fn ) :
11566			this.trigger( name );
11567	},
11568	"shorthand-deprecated-v3",
11569	"jQuery.fn." + name + "() event shorthand is deprecated" );
11570} );
11571
11572// Trigger "ready" event only once, on document ready
11573jQuery( function() {
11574	jQuery( window.document ).triggerHandler( "ready" );
11575} );
11576
11577jQuery.event.special.ready = {
11578	setup: function() {
11579		if ( this === window.document ) {
11580			migrateWarn( "ready-event", "'ready' event is deprecated" );
11581		}
11582	}
11583};
11584
11585migratePatchAndWarnFunc( jQuery.fn, "bind", function( types, data, fn ) {
11586	return this.on( types, null, data, fn );
11587}, "pre-on-methods", "jQuery.fn.bind() is deprecated" );
11588migratePatchAndWarnFunc( jQuery.fn, "unbind", function( types, fn ) {
11589	return this.off( types, null, fn );
11590}, "pre-on-methods", "jQuery.fn.unbind() is deprecated" );
11591migratePatchAndWarnFunc( jQuery.fn, "delegate", function( selector, types, data, fn ) {
11592	return this.on( types, selector, data, fn );
11593}, "pre-on-methods", "jQuery.fn.delegate() is deprecated" );
11594migratePatchAndWarnFunc( jQuery.fn, "undelegate", function( selector, types, fn ) {
11595	return arguments.length === 1 ?
11596		this.off( selector, "**" ) :
11597		this.off( types, selector || "**", fn );
11598}, "pre-on-methods", "jQuery.fn.undelegate() is deprecated" );
11599migratePatchAndWarnFunc( jQuery.fn, "hover", function( fnOver, fnOut ) {
11600	return this.on( "mouseenter", fnOver ).on( "mouseleave", fnOut || fnOver );
11601}, "pre-on-methods", "jQuery.fn.hover() is deprecated" );
11602
11603var rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\/\0>\x20\t\r\n\f]*)[^>]*)\/>/gi,
11604	makeMarkup = function( html ) {
11605		var doc = window.document.implementation.createHTMLDocument( "" );
11606		doc.body.innerHTML = html;
11607		return doc.body && doc.body.innerHTML;
11608	},
11609	warnIfChanged = function( html ) {
11610		var changed = html.replace( rxhtmlTag, "<$1></$2>" );
11611		if ( changed !== html && makeMarkup( html ) !== makeMarkup( changed ) ) {
11612			migrateWarn( "self-closed-tags",
11613				"HTML tags must be properly nested and closed: " + html );
11614		}
11615	};
11616
11617/**
11618 * Deprecated, please use `jQuery.migrateDisablePatches( "self-closed-tags" )` instead.
11619 * @deprecated
11620 */
11621migratePatchAndWarnFunc( jQuery, "UNSAFE_restoreLegacyHtmlPrefilter", function() {
11622	jQuery.migrateEnablePatches( "self-closed-tags" );
11623}, "legacy-self-closed-tags",
11624"jQuery.UNSAFE_restoreLegacyHtmlPrefilter deprecated; use " +
11625	"`jQuery.migrateEnablePatches( \"self-closed-tags\" )`" );
11626
11627migratePatchFunc( jQuery, "htmlPrefilter", function( html ) {
11628	warnIfChanged( html );
11629	return html.replace( rxhtmlTag, "<$1></$2>" );
11630}, "self-closed-tags" );
11631
11632// This patch needs to be disabled by default as it re-introduces
11633// security issues (CVE-2020-11022, CVE-2020-11023).
11634jQuery.migrateDisablePatches( "self-closed-tags" );
11635
11636var origOffset = jQuery.fn.offset;
11637
11638migratePatchFunc( jQuery.fn, "offset", function() {
11639	var elem = this[ 0 ];
11640
11641	if ( elem && ( !elem.nodeType || !elem.getBoundingClientRect ) ) {
11642		migrateWarn( "offset-valid-elem", "jQuery.fn.offset() requires a valid DOM element" );
11643		return arguments.length ? this : undefined;
11644	}
11645
11646	return origOffset.apply( this, arguments );
11647}, "offset-valid-elem" );
11648
11649// Support jQuery slim which excludes the ajax module
11650// The jQuery.param patch is about respecting `jQuery.ajaxSettings.traditional`
11651// so it doesn't make sense for the slim build.
11652if ( jQuery.ajax ) {
11653
11654var origParam = jQuery.param;
11655
11656migratePatchFunc( jQuery, "param", function( data, traditional ) {
11657	var ajaxTraditional = jQuery.ajaxSettings && jQuery.ajaxSettings.traditional;
11658
11659	if ( traditional === undefined && ajaxTraditional ) {
11660
11661		migrateWarn( "param-ajax-traditional",
11662			"jQuery.param() no longer uses jQuery.ajaxSettings.traditional" );
11663		traditional = ajaxTraditional;
11664	}
11665
11666	return origParam.call( this, data, traditional );
11667}, "param-ajax-traditional" );
11668
11669}
11670
11671migratePatchAndWarnFunc( jQuery.fn, "andSelf", jQuery.fn.addBack, "andSelf",
11672	"jQuery.fn.andSelf() is deprecated and removed, use jQuery.fn.addBack()" );
11673
11674// Support jQuery slim which excludes the deferred module in jQuery 4.0+
11675if ( jQuery.Deferred ) {
11676
11677var oldDeferred = jQuery.Deferred,
11678	tuples = [
11679
11680		// Action, add listener, callbacks, .then handlers, final state
11681		[ "resolve", "done", jQuery.Callbacks( "once memory" ),
11682			jQuery.Callbacks( "once memory" ), "resolved" ],
11683		[ "reject", "fail", jQuery.Callbacks( "once memory" ),
11684			jQuery.Callbacks( "once memory" ), "rejected" ],
11685		[ "notify", "progress", jQuery.Callbacks( "memory" ),
11686			jQuery.Callbacks( "memory" ) ]
11687	];
11688
11689migratePatchFunc( jQuery, "Deferred", function( func ) {
11690	var deferred = oldDeferred(),
11691		promise = deferred.promise();
11692
11693	function newDeferredPipe( /* fnDone, fnFail, fnProgress */ ) {
11694		var fns = arguments;
11695
11696		return jQuery.Deferred( function( newDefer ) {
11697			jQuery.each( tuples, function( i, tuple ) {
11698				var fn = typeof fns[ i ] === "function" && fns[ i ];
11699
11700				// Deferred.done(function() { bind to newDefer or newDefer.resolve })
11701				// deferred.fail(function() { bind to newDefer or newDefer.reject })
11702				// deferred.progress(function() { bind to newDefer or newDefer.notify })
11703				deferred[ tuple[ 1 ] ]( function() {
11704					var returned = fn && fn.apply( this, arguments );
11705					if ( returned && typeof returned.promise === "function" ) {
11706						returned.promise()
11707							.done( newDefer.resolve )
11708							.fail( newDefer.reject )
11709							.progress( newDefer.notify );
11710					} else {
11711						newDefer[ tuple[ 0 ] + "With" ](
11712							this === promise ? newDefer.promise() : this,
11713							fn ? [ returned ] : arguments
11714						);
11715					}
11716				} );
11717			} );
11718			fns = null;
11719		} ).promise();
11720	}
11721
11722	migratePatchAndWarnFunc( deferred, "pipe", newDeferredPipe, "deferred-pipe",
11723		"deferred.pipe() is deprecated" );
11724	migratePatchAndWarnFunc( promise, "pipe", newDeferredPipe, "deferred-pipe",
11725		"deferred.pipe() is deprecated" );
11726
11727	if ( func ) {
11728		func.call( deferred, deferred );
11729	}
11730
11731	return deferred;
11732}, "deferred-pipe" );
11733
11734// Preserve handler of uncaught exceptions in promise chains
11735jQuery.Deferred.exceptionHook = oldDeferred.exceptionHook;
11736
11737}
11738
11739return jQuery;
11740} );
11741/* jshint node: true */
11742
11743/**
11744 * Unobtrusive scripting adapter for jQuery
11745 * https://github.com/rails/jquery-ujs
11746 *
11747 * Requires jQuery 1.8.0 or later.
11748 *
11749 * Released under the MIT license
11750 *
11751 */
11752
11753(function() {
11754  'use strict';
11755
11756  var jqueryUjsInit = function($, undefined) {
11757
11758  // Cut down on the number of issues from people inadvertently including jquery_ujs twice
11759  // by detecting and raising an error when it happens.
11760  if ( $.rails !== undefined ) {
11761    $.error('jquery-ujs has already been loaded!');
11762  }
11763
11764  // Shorthand to make it a little easier to call public rails functions from within rails.js
11765  var rails;
11766  var $document = $(document);
11767
11768  $.rails = rails = {
11769    // Link elements bound by jquery-ujs
11770    linkClickSelector: 'a[data-confirm], a[data-method], a[data-remote]:not([disabled]), a[data-disable-with], a[data-disable]',
11771
11772    // Button elements bound by jquery-ujs
11773    buttonClickSelector: 'button[data-remote]:not([form]):not(form button), button[data-confirm]:not([form]):not(form button)',
11774
11775    // Select elements bound by jquery-ujs
11776    inputChangeSelector: 'select[data-remote], input[data-remote], textarea[data-remote]',
11777
11778    // Form elements bound by jquery-ujs
11779    formSubmitSelector: 'form:not([data-turbo=true])',
11780
11781    // Form input elements bound by jquery-ujs
11782    formInputClickSelector: 'form:not([data-turbo=true]) input[type=submit], form:not([data-turbo=true]) input[type=image], form:not([data-turbo=true]) button[type=submit], form:not([data-turbo=true]) button:not([type]), input[type=submit][form], input[type=image][form], button[type=submit][form], button[form]:not([type])',
11783
11784    // Form input elements disabled during form submission
11785    disableSelector: 'input[data-disable-with]:enabled, button[data-disable-with]:enabled, textarea[data-disable-with]:enabled, input[data-disable]:enabled, button[data-disable]:enabled, textarea[data-disable]:enabled',
11786
11787    // Form input elements re-enabled after form submission
11788    enableSelector: 'input[data-disable-with]:disabled, button[data-disable-with]:disabled, textarea[data-disable-with]:disabled, input[data-disable]:disabled, button[data-disable]:disabled, textarea[data-disable]:disabled',
11789
11790    // Form required input elements
11791    requiredInputSelector: 'input[name][required]:not([disabled]), textarea[name][required]:not([disabled])',
11792
11793    // Form file input elements
11794    fileInputSelector: 'input[name][type=file]:not([disabled])',
11795
11796    // Link onClick disable selector with possible reenable after remote submission
11797    linkDisableSelector: 'a[data-disable-with], a[data-disable]',
11798
11799    // Button onClick disable selector with possible reenable after remote submission
11800    buttonDisableSelector: 'button[data-remote][data-disable-with], button[data-remote][data-disable]',
11801
11802    // Up-to-date Cross-Site Request Forgery token
11803    csrfToken: function() {
11804     return $('meta[name=csrf-token]').attr('content');
11805    },
11806
11807    // URL param that must contain the CSRF token
11808    csrfParam: function() {
11809     return $('meta[name=csrf-param]').attr('content');
11810    },
11811
11812    // Make sure that every Ajax request sends the CSRF token
11813    CSRFProtection: function(xhr) {
11814      var token = rails.csrfToken();
11815      if (token) xhr.setRequestHeader('X-CSRF-Token', token);
11816    },
11817
11818    // Make sure that all forms have actual up-to-date tokens (cached forms contain old ones)
11819    refreshCSRFTokens: function(){
11820      $('form input[name="' + rails.csrfParam() + '"]').val(rails.csrfToken());
11821    },
11822
11823    // Triggers an event on an element and returns false if the event result is false
11824    fire: function(obj, name, data) {
11825      var event = $.Event(name);
11826      obj.trigger(event, data);
11827      return event.result !== false;
11828    },
11829
11830    // Default confirm dialog, may be overridden with custom confirm dialog in $.rails.confirm
11831    confirm: function(message) {
11832      return confirm(message);
11833    },
11834
11835    // Default ajax function, may be overridden with custom function in $.rails.ajax
11836    ajax: function(options) {
11837      return $.ajax(options);
11838    },
11839
11840    // Default way to get an element's href. May be overridden at $.rails.href.
11841    href: function(element) {
11842      return element[0].href;
11843    },
11844
11845    // Checks "data-remote" if true to handle the request through a XHR request.
11846    isRemote: function(element) {
11847      return element.data('remote') !== undefined && element.data('remote') !== false;
11848    },
11849
11850    // Submits "remote" forms and links with ajax
11851    handleRemote: function(element) {
11852      var method, url, data, withCredentials, dataType, options;
11853
11854      if (rails.fire(element, 'ajax:before')) {
11855        withCredentials = element.data('with-credentials') || null;
11856        dataType = element.data('type') || ($.ajaxSettings && $.ajaxSettings.dataType);
11857
11858        if (element.is('form')) {
11859          method = element.data('ujs:submit-button-formmethod') || element.attr('method');
11860          url = element.data('ujs:submit-button-formaction') || element.attr('action');
11861          data = $(element[0]).serializeArray();
11862          // memoized value from clicked submit button
11863          var button = element.data('ujs:submit-button');
11864          if (button) {
11865            data.push(button);
11866            element.data('ujs:submit-button', null);
11867          }
11868          element.data('ujs:submit-button-formmethod', null);
11869          element.data('ujs:submit-button-formaction', null);
11870        } else if (element.is(rails.inputChangeSelector)) {
11871          method = element.data('method');
11872          url = element.data('url');
11873          data = element.serialize();
11874          if (element.data('params')) data = data + '&' + element.data('params');
11875        } else if (element.is(rails.buttonClickSelector)) {
11876          method = element.data('method') || 'get';
11877          url = element.data('url');
11878          data = element.serialize();
11879          if (element.data('params')) data = data + '&' + element.data('params');
11880        } else {
11881          method = element.data('method');
11882          url = rails.href(element);
11883          data = element.data('params') || null;
11884        }
11885
11886        options = {
11887          type: method || 'GET', data: data, dataType: dataType,
11888          // stopping the "ajax:beforeSend" event will cancel the ajax request
11889          beforeSend: function(xhr, settings) {
11890            if (settings.dataType === undefined) {
11891              xhr.setRequestHeader('accept', '*/*;q=0.5, ' + settings.accepts.script);
11892            }
11893            if (rails.fire(element, 'ajax:beforeSend', [xhr, settings])) {
11894              element.trigger('ajax:send', xhr);
11895            } else {
11896              return false;
11897            }
11898          },
11899          success: function(data, status, xhr) {
11900            element.trigger('ajax:success', [data, status, xhr]);
11901          },
11902          complete: function(xhr, status) {
11903            element.trigger('ajax:complete', [xhr, status]);
11904          },
11905          error: function(xhr, status, error) {
11906            element.trigger('ajax:error', [xhr, status, error]);
11907          },
11908          crossDomain: rails.isCrossDomain(url)
11909        };
11910
11911        // There is no withCredentials for IE6-8 when
11912        // "Enable native XMLHTTP support" is disabled
11913        if (withCredentials) {
11914          options.xhrFields = {
11915            withCredentials: withCredentials
11916          };
11917        }
11918
11919        // Only pass url to `ajax` options if not blank
11920        if (url) { options.url = url; }
11921
11922        return rails.ajax(options);
11923      } else {
11924        return false;
11925      }
11926    },
11927
11928    // Determines if the request is a cross domain request.
11929    isCrossDomain: function(url) {
11930      var originAnchor = document.createElement('a');
11931      originAnchor.href = location.href;
11932      var urlAnchor = document.createElement('a');
11933
11934      try {
11935        urlAnchor.href = url;
11936        // This is a workaround to a IE bug.
11937        urlAnchor.href = urlAnchor.href;
11938
11939        // If URL protocol is false or is a string containing a single colon
11940        // *and* host are false, assume it is not a cross-domain request
11941        // (should only be the case for IE7 and IE compatibility mode).
11942        // Otherwise, evaluate protocol and host of the URL against the origin
11943        // protocol and host.
11944        return !(((!urlAnchor.protocol || urlAnchor.protocol === ':') && !urlAnchor.host) ||
11945          (originAnchor.protocol + '//' + originAnchor.host ===
11946            urlAnchor.protocol + '//' + urlAnchor.host));
11947      } catch (e) {
11948        // If there is an error parsing the URL, assume it is crossDomain.
11949        return true;
11950      }
11951    },
11952
11953    // Handles "data-method" on links such as:
11954    // <a href="/users/5" data-method="delete" rel="nofollow" data-confirm="Are you sure?">Delete</a>
11955    handleMethod: function(link) {
11956      var href = rails.href(link),
11957        method = link.data('method'),
11958        target = link.attr('target'),
11959        csrfToken = rails.csrfToken(),
11960        csrfParam = rails.csrfParam(),
11961        form = $('<form method="post" action="' + href + '"></form>'),
11962        metadataInput = '<input name="_method" value="' + method + '" type="hidden" />';
11963
11964      if (csrfParam !== undefined && csrfToken !== undefined && !rails.isCrossDomain(href)) {
11965        metadataInput += '<input name="' + csrfParam + '" value="' + csrfToken + '" type="hidden" />';
11966      }
11967
11968      if (target) { form.attr('target', target); }
11969
11970      form.hide().append(metadataInput).appendTo('body');
11971      form.submit();
11972    },
11973
11974    // Helper function that returns form elements that match the specified CSS selector
11975    // If form is actually a "form" element this will return associated elements outside the from that have
11976    // the html form attribute set
11977    formElements: function(form, selector) {
11978      return form.is('form') ? $(form[0].elements).filter(selector) : form.find(selector);
11979    },
11980
11981    /* Disables form elements:
11982      - Caches element value in 'ujs:enable-with' data store
11983      - Replaces element text with value of 'data-disable-with' attribute
11984      - Sets disabled property to true
11985    */
11986    disableFormElements: function(form) {
11987      rails.formElements(form, rails.disableSelector).each(function() {
11988        rails.disableFormElement($(this));
11989      });
11990    },
11991
11992    disableFormElement: function(element) {
11993      var method, replacement;
11994
11995      method = element.is('button') ? 'html' : 'val';
11996      replacement = element.data('disable-with');
11997
11998      if (replacement !== undefined) {
11999        element.data('ujs:enable-with', element[method]());
12000        element[method](replacement);
12001      }
12002
12003      element.prop('disabled', true);
12004      element.data('ujs:disabled', true);
12005    },
12006
12007    /* Re-enables disabled form elements:
12008      - Replaces element text with cached value from 'ujs:enable-with' data store (created in `disableFormElements`)
12009      - Sets disabled property to false
12010    */
12011    enableFormElements: function(form) {
12012      rails.formElements(form, rails.enableSelector).each(function() {
12013        rails.enableFormElement($(this));
12014      });
12015    },
12016
12017    enableFormElement: function(element) {
12018      var method = element.is('button') ? 'html' : 'val';
12019      if (element.data('ujs:enable-with') !== undefined) {
12020        element[method](element.data('ujs:enable-with'));
12021        element.removeData('ujs:enable-with'); // clean up cache
12022      }
12023      element.prop('disabled', false);
12024      element.removeData('ujs:disabled');
12025    },
12026
12027   /* For 'data-confirm' attribute:
12028      - Fires `confirm` event
12029      - Shows the confirmation dialog
12030      - Fires the `confirm:complete` event
12031
12032      Returns `true` if no function stops the chain and user chose yes; `false` otherwise.
12033      Attaching a handler to the element's `confirm` event that returns a `falsy` value cancels the confirmation dialog.
12034      Attaching a handler to the element's `confirm:complete` event that returns a `falsy` value makes this function
12035      return false. The `confirm:complete` event is fired whether or not the user answered true or false to the dialog.
12036   */
12037    allowAction: function(element) {
12038      var message = element.data('confirm'),
12039          answer = false, callback;
12040      if (!message) { return true; }
12041
12042      if (rails.fire(element, 'confirm')) {
12043        try {
12044          answer = rails.confirm(message);
12045        } catch (e) {
12046          (console.error || console.log).call(console, e.stack || e);
12047        }
12048        callback = rails.fire(element, 'confirm:complete', [answer]);
12049      }
12050      return answer && callback;
12051    },
12052
12053    // Helper function which checks for blank inputs in a form that match the specified CSS selector
12054    blankInputs: function(form, specifiedSelector, nonBlank) {
12055      var foundInputs = $(),
12056        input,
12057        valueToCheck,
12058        radiosForNameWithNoneSelected,
12059        radioName,
12060        selector = specifiedSelector || 'input,textarea',
12061        requiredInputs = form.find(selector),
12062        checkedRadioButtonNames = {};
12063
12064      requiredInputs.each(function() {
12065        input = $(this);
12066        if (input.is('input[type=radio]')) {
12067
12068          // Don't count unchecked required radio as blank if other radio with same name is checked,
12069          // regardless of whether same-name radio input has required attribute or not. The spec
12070          // states https://www.w3.org/TR/html5/forms.html#the-required-attribute
12071          radioName = input.attr('name');
12072
12073          // Skip if we've already seen the radio with this name.
12074          if (!checkedRadioButtonNames[radioName]) {
12075
12076            // If none checked
12077            if (form.find('input[type=radio]:checked[name="' + radioName + '"]').length === 0) {
12078              radiosForNameWithNoneSelected = form.find(
12079                'input[type=radio][name="' + radioName + '"]');
12080              foundInputs = foundInputs.add(radiosForNameWithNoneSelected);
12081            }
12082
12083            // We only need to check each name once.
12084            checkedRadioButtonNames[radioName] = radioName;
12085          }
12086        } else {
12087          valueToCheck = input.is('input[type=checkbox],input[type=radio]') ? input.is(':checked') : !!input.val();
12088          if (valueToCheck === nonBlank) {
12089            foundInputs = foundInputs.add(input);
12090          }
12091        }
12092      });
12093      return foundInputs.length ? foundInputs : false;
12094    },
12095
12096    // Helper function which checks for non-blank inputs in a form that match the specified CSS selector
12097    nonBlankInputs: function(form, specifiedSelector) {
12098      return rails.blankInputs(form, specifiedSelector, true); // true specifies nonBlank
12099    },
12100
12101    // Helper function, needed to provide consistent behavior in IE
12102    stopEverything: function(e) {
12103      $(e.target).trigger('ujs:everythingStopped');
12104      e.stopImmediatePropagation();
12105      return false;
12106    },
12107
12108    //  Replace element's html with the 'data-disable-with' after storing original html
12109    //  and prevent clicking on it
12110    disableElement: function(element) {
12111      var replacement = element.data('disable-with');
12112
12113      if (replacement !== undefined) {
12114        element.data('ujs:enable-with', element.html()); // store enabled state
12115        element.html(replacement);
12116      }
12117
12118      element.on('click.railsDisable', function(e) { // prevent further clicking
12119        return rails.stopEverything(e);
12120      });
12121      element.data('ujs:disabled', true);
12122    },
12123
12124    // Restore element to its original state which was disabled by 'disableElement' above
12125    enableElement: function(element) {
12126      if (element.data('ujs:enable-with') !== undefined) {
12127        element.html(element.data('ujs:enable-with')); // set to old enabled state
12128        element.removeData('ujs:enable-with'); // clean up cache
12129      }
12130      element.off('click.railsDisable'); // enable element
12131      element.removeData('ujs:disabled');
12132    }
12133  };
12134
12135  if (rails.fire($document, 'rails:attachBindings')) {
12136
12137    $.ajaxPrefilter(function(options, originalOptions, xhr){ if ( !options.crossDomain ) { rails.CSRFProtection(xhr); }});
12138
12139    // This event works the same as the load event, except that it fires every
12140    // time the page is loaded.
12141    //
12142    // See https://github.com/rails/jquery-ujs/issues/357
12143    // See https://developer.mozilla.org/en-US/docs/Using_Firefox_1.5_caching
12144    $(window).on('pageshow.rails', function () {
12145      $($.rails.enableSelector).each(function () {
12146        var element = $(this);
12147
12148        if (element.data('ujs:disabled')) {
12149          $.rails.enableFormElement(element);
12150        }
12151      });
12152
12153      $($.rails.linkDisableSelector).each(function () {
12154        var element = $(this);
12155
12156        if (element.data('ujs:disabled')) {
12157          $.rails.enableElement(element);
12158        }
12159      });
12160    });
12161
12162    $document.on('ajax:complete', rails.linkDisableSelector, function() {
12163        rails.enableElement($(this));
12164    });
12165
12166    $document.on('ajax:complete', rails.buttonDisableSelector, function() {
12167        rails.enableFormElement($(this));
12168    });
12169
12170    $document.on('click.rails', rails.linkClickSelector, function(e) {
12171      var link = $(this), method = link.data('method'), data = link.data('params'), metaClick = e.metaKey || e.ctrlKey;
12172      if (!rails.allowAction(link)) return rails.stopEverything(e);
12173
12174      if (!metaClick && link.is(rails.linkDisableSelector)) rails.disableElement(link);
12175
12176      if (rails.isRemote(link)) {
12177        if (metaClick && (!method || method === 'GET') && !data) { return true; }
12178
12179        var handleRemote = rails.handleRemote(link);
12180        // Response from rails.handleRemote() will either be false or a deferred object promise.
12181        if (handleRemote === false) {
12182          rails.enableElement(link);
12183        } else {
12184          handleRemote.fail( function() { rails.enableElement(link); } );
12185        }
12186        return false;
12187
12188      } else if (method) {
12189        rails.handleMethod(link);
12190        return false;
12191      }
12192    });
12193
12194    $document.on('click.rails', rails.buttonClickSelector, function(e) {
12195      var button = $(this);
12196
12197      if (!rails.allowAction(button) || !rails.isRemote(button)) return rails.stopEverything(e);
12198
12199      if (button.is(rails.buttonDisableSelector)) rails.disableFormElement(button);
12200
12201      var handleRemote = rails.handleRemote(button);
12202      // Response from rails.handleRemote() will either be false or a deferred object promise.
12203      if (handleRemote === false) {
12204        rails.enableFormElement(button);
12205      } else {
12206        handleRemote.fail( function() { rails.enableFormElement(button); } );
12207      }
12208      return false;
12209    });
12210
12211    $document.on('change.rails', rails.inputChangeSelector, function(e) {
12212      var link = $(this);
12213      if (!rails.allowAction(link) || !rails.isRemote(link)) return rails.stopEverything(e);
12214
12215      rails.handleRemote(link);
12216      return false;
12217    });
12218
12219    $document.on('submit.rails', rails.formSubmitSelector, function(e) {
12220      var form = $(this),
12221        remote = rails.isRemote(form),
12222        blankRequiredInputs,
12223        nonBlankFileInputs;
12224
12225      if (!rails.allowAction(form)) return rails.stopEverything(e);
12226
12227      // Skip other logic when required values are missing or file upload is present
12228      if (form.attr('novalidate') === undefined) {
12229        if (form.data('ujs:formnovalidate-button') === undefined) {
12230          blankRequiredInputs = rails.blankInputs(form, rails.requiredInputSelector, false);
12231          if (blankRequiredInputs && rails.fire(form, 'ajax:aborted:required', [blankRequiredInputs])) {
12232            return rails.stopEverything(e);
12233          }
12234        } else {
12235          // Clear the formnovalidate in case the next button click is not on a formnovalidate button
12236          // Not strictly necessary to do here, since it is also reset on each button click, but just to be certain
12237          form.data('ujs:formnovalidate-button', undefined);
12238        }
12239      }
12240
12241      if (remote) {
12242        nonBlankFileInputs = rails.nonBlankInputs(form, rails.fileInputSelector);
12243        if (nonBlankFileInputs) {
12244          // Slight timeout so that the submit button gets properly serialized
12245          // (make it easy for event handler to serialize form without disabled values)
12246          setTimeout(function(){ rails.disableFormElements(form); }, 13);
12247          var aborted = rails.fire(form, 'ajax:aborted:file', [nonBlankFileInputs]);
12248
12249          // Re-enable form elements if event bindings return false (canceling normal form submission)
12250          if (!aborted) { setTimeout(function(){ rails.enableFormElements(form); }, 13); }
12251
12252          return aborted;
12253        }
12254
12255        rails.handleRemote(form);
12256        return false;
12257
12258      } else {
12259        // Slight timeout so that the submit button gets properly serialized
12260        setTimeout(function(){ rails.disableFormElements(form); }, 13);
12261      }
12262    });
12263
12264    $document.on('click.rails', rails.formInputClickSelector, function(event) {
12265      var button = $(this);
12266
12267      if (!rails.allowAction(button)) return rails.stopEverything(event);
12268
12269      // Register the pressed submit button
12270      var name = button.attr('name'),
12271        data = name ? {name:name, value:button.val()} : null;
12272
12273      var form = button.closest('form');
12274      if (form.length === 0) {
12275        form = $('#' + button.attr('form'));
12276      }
12277      form.data('ujs:submit-button', data);
12278
12279      // Save attributes from button
12280      form.data('ujs:formnovalidate-button', button.attr('formnovalidate'));
12281      form.data('ujs:submit-button-formaction', button.attr('formaction'));
12282      form.data('ujs:submit-button-formmethod', button.attr('formmethod'));
12283    });
12284
12285    $document.on('ajax:send.rails', rails.formSubmitSelector, function(event) {
12286      if (this === event.target) rails.disableFormElements($(this));
12287    });
12288
12289    $document.on('ajax:complete.rails', rails.formSubmitSelector, function(event) {
12290      if (this === event.target) rails.enableFormElements($(this));
12291    });
12292
12293    $(function(){
12294      rails.refreshCSRFTokens();
12295    });
12296  }
12297
12298  };
12299
12300  if (window.jQuery) {
12301    jqueryUjsInit(jQuery);
12302  } else if (typeof exports === 'object' && typeof module === 'object') {
12303    module.exports = jqueryUjsInit;
12304  }
12305})();
12306/*!
12307 * JavaScript Cookie v2.2.0
12308 * https://github.com/js-cookie/js-cookie
12309 *
12310 * Copyright 2006, 2015 Klaus Hartl & Fagner Brack
12311 * Released under the MIT license
12312 */
12313;(function (factory) {
12314	var registeredInModuleLoader = false;
12315	if (typeof define === 'function' && define.amd) {
12316		define(factory);
12317		registeredInModuleLoader = true;
12318	}
12319	if (typeof exports === 'object') {
12320		module.exports = factory();
12321		registeredInModuleLoader = true;
12322	}
12323	if (!registeredInModuleLoader) {
12324		var OldCookies = window.Cookies;
12325		var api = window.Cookies = factory();
12326		api.noConflict = function () {
12327			window.Cookies = OldCookies;
12328			return api;
12329		};
12330	}
12331}(function () {
12332	function extend () {
12333		var i = 0;
12334		var result = {};
12335		for (; i < arguments.length; i++) {
12336			var attributes = arguments[ i ];
12337			for (var key in attributes) {
12338				result[key] = attributes[key];
12339			}
12340		}
12341		return result;
12342	}
12343
12344	function init (converter) {
12345		function api (key, value, attributes) {
12346			var result;
12347			if (typeof document === 'undefined') {
12348				return;
12349			}
12350
12351			// Write
12352
12353			if (arguments.length > 1) {
12354				attributes = extend({
12355					path: '/'
12356				}, api.defaults, attributes);
12357
12358				if (typeof attributes.expires === 'number') {
12359					var expires = new Date();
12360					expires.setMilliseconds(expires.getMilliseconds() + attributes.expires * 864e+5);
12361					attributes.expires = expires;
12362				}
12363
12364				// We're using "expires" because "max-age" is not supported by IE
12365				attributes.expires = attributes.expires ? attributes.expires.toUTCString() : '';
12366
12367				try {
12368					result = JSON.stringify(value);
12369					if (/^[\{\[]/.test(result)) {
12370						value = result;
12371					}
12372				} catch (e) {}
12373
12374				if (!converter.write) {
12375					value = encodeURIComponent(String(value))
12376						.replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g, decodeURIComponent);
12377				} else {
12378					value = converter.write(value, key);
12379				}
12380
12381				key = encodeURIComponent(String(key));
12382				key = key.replace(/%(23|24|26|2B|5E|60|7C)/g, decodeURIComponent);
12383				key = key.replace(/[\(\)]/g, escape);
12384
12385				var stringifiedAttributes = '';
12386
12387				for (var attributeName in attributes) {
12388					if (!attributes[attributeName]) {
12389						continue;
12390					}
12391					stringifiedAttributes += '; ' + attributeName;
12392					if (attributes[attributeName] === true) {
12393						continue;
12394					}
12395					stringifiedAttributes += '=' + attributes[attributeName];
12396				}
12397				return (document.cookie = key + '=' + value + stringifiedAttributes);
12398			}
12399
12400			// Read
12401
12402			if (!key) {
12403				result = {};
12404			}
12405
12406			// To prevent the for loop in the first place assign an empty array
12407			// in case there are no cookies at all. Also prevents odd result when
12408			// calling "get()"
12409			var cookies = document.cookie ? document.cookie.split('; ') : [];
12410			var rdecode = /(%[0-9A-Z]{2})+/g;
12411			var i = 0;
12412
12413			for (; i < cookies.length; i++) {
12414				var parts = cookies[i].split('=');
12415				var cookie = parts.slice(1).join('=');
12416
12417				if (!this.json && cookie.charAt(0) === '"') {
12418					cookie = cookie.slice(1, -1);
12419				}
12420
12421				try {
12422					var name = parts[0].replace(rdecode, decodeURIComponent);
12423					cookie = converter.read ?
12424						converter.read(cookie, name) : converter(cookie, name) ||
12425						cookie.replace(rdecode, decodeURIComponent);
12426
12427					if (this.json) {
12428						try {
12429							cookie = JSON.parse(cookie);
12430						} catch (e) {}
12431					}
12432
12433					if (key === name) {
12434						result = cookie;
12435						break;
12436					}
12437
12438					if (!key) {
12439						result[name] = cookie;
12440					}
12441				} catch (e) {}
12442			}
12443
12444			return result;
12445		}
12446
12447		api.set = api;
12448		api.get = function (key) {
12449			return api.call(api, key);
12450		};
12451		api.getJSON = function () {
12452			return api.apply({
12453				json: true
12454			}, [].slice.call(arguments));
12455		};
12456		api.defaults = {};
12457
12458		api.remove = function (key, attributes) {
12459			api(key, '', extend(attributes, {
12460				expires: -1
12461			}));
12462		};
12463
12464		api.withConverter = init;
12465
12466		return api;
12467	}
12468
12469	return init(function () {});
12470}));
12471/*!
12472 * jQuery Form Plugin
12473 * version: 3.09 (16-APR-2012)
12474 * @requires jQuery v1.3.2 or later
12475 *
12476 * Examples and documentation at: http://malsup.com/jquery/form/
12477 * Project repository: https://github.com/malsup/form
12478 * Dual licensed under the MIT and GPL licenses:
12479 *    http://malsup.github.com/mit-license.txt
12480 *    http://malsup.github.com/gpl-license-v2.txt
12481 */
12482/*global ActiveXObject alert */
12483;(function($) {
12484"use strict";
12485
12486/*
12487    Usage Note:
12488    -----------
12489    Do not use both ajaxSubmit and ajaxForm on the same form.  These
12490    functions are mutually exclusive.  Use ajaxSubmit if you want
12491    to bind your own submit handler to the form.  For example,
12492
12493    $(document).ready(function() {
12494        $('#myForm').on('submit', function(e) {
12495            e.preventDefault(); // <-- important
12496            $(this).ajaxSubmit({
12497                target: '#output'
12498            });
12499        });
12500    });
12501
12502    Use ajaxForm when you want the plugin to manage all the event binding
12503    for you.  For example,
12504
12505    $(document).ready(function() {
12506        $('#myForm').ajaxForm({
12507            target: '#output'
12508        });
12509    });
12510    
12511    You can also use ajaxForm with delegation (requires jQuery v1.7+), so the
12512    form does not have to exist when you invoke ajaxForm:
12513
12514    $('#myForm').ajaxForm({
12515        delegation: true,
12516        target: '#output'
12517    });
12518    
12519    When using ajaxForm, the ajaxSubmit function will be invoked for you
12520    at the appropriate time.
12521*/
12522
12523/**
12524 * Feature detection
12525 */
12526var feature = {};
12527feature.fileapi = $("<input type='file'/>").get(0).files !== undefined;
12528feature.formdata = window.FormData !== undefined;
12529
12530/**
12531 * ajaxSubmit() provides a mechanism for immediately submitting
12532 * an HTML form using AJAX.
12533 */
12534$.fn.ajaxSubmit = function(options) {
12535    /*jshint scripturl:true */
12536
12537    // fast fail if nothing selected (http://dev.jquery.com/ticket/2752)
12538    if (!this.length) {
12539        log('ajaxSubmit: skipping submit process - no element selected');
12540        return this;
12541    }
12542    
12543    var method, action, url, $form = this;
12544
12545    if (typeof options == 'function') {
12546        options = { success: options };
12547    }
12548
12549    method = this.attr('method');
12550    action = this.attr('action');
12551    url = (typeof action === 'string') ? $.trim(action) : '';
12552    url = url || window.location.href || '';
12553    if (url) {
12554        // clean url (don't include hash vaue)
12555        url = (url.match(/^([^#]+)/)||[])[1];
12556    }
12557
12558    options = $.extend(true, {
12559        url:  url,
12560        success: $.ajaxSettings.success,
12561        type: method || 'GET',
12562        iframeSrc: /^https/i.test(window.location.href || '') ? 'javascript:false' : 'about:blank'
12563    }, options);
12564
12565    // hook for manipulating the form data before it is extracted;
12566    // convenient for use with rich editors like tinyMCE or FCKEditor
12567    var veto = {};
12568    this.trigger('form-pre-serialize', [this, options, veto]);
12569    if (veto.veto) {
12570        log('ajaxSubmit: submit vetoed via form-pre-serialize trigger');
12571        return this;
12572    }
12573
12574    // provide opportunity to alter form data before it is serialized
12575    if (options.beforeSerialize && options.beforeSerialize(this, options) === false) {
12576        log('ajaxSubmit: submit aborted via beforeSerialize callback');
12577        return this;
12578    }
12579
12580    var traditional = options.traditional;
12581    if ( traditional === undefined ) {
12582        traditional = $.ajaxSettings.traditional;
12583    }
12584    
12585    var elements = [];
12586    var qx, a = this.formToArray(options.semantic, elements);
12587    if (options.data) {
12588        options.extraData = options.data;
12589        qx = $.param(options.data, traditional);
12590    }
12591
12592    // give pre-submit callback an opportunity to abort the submit
12593    if (options.beforeSubmit && options.beforeSubmit(a, this, options) === false) {
12594        log('ajaxSubmit: submit aborted via beforeSubmit callback');
12595        return this;
12596    }
12597
12598    // fire vetoable 'validate' event
12599    this.trigger('form-submit-validate', [a, this, options, veto]);
12600    if (veto.veto) {
12601        log('ajaxSubmit: submit vetoed via form-submit-validate trigger');
12602        return this;
12603    }
12604
12605    var q = $.param(a, traditional);
12606    if (qx) {
12607        q = ( q ? (q + '&' + qx) : qx );
12608    }    
12609    if (options.type.toUpperCase() == 'GET') {
12610        options.url += (options.url.indexOf('?') >= 0 ? '&' : '?') + q;
12611        options.data = null;  // data is null for 'get'
12612    }
12613    else {
12614        options.data = q; // data is the query string for 'post'
12615    }
12616
12617    var callbacks = [];
12618    if (options.resetForm) {
12619        callbacks.push(function() { $form.resetForm(); });
12620    }
12621    if (options.clearForm) {
12622        callbacks.push(function() { $form.clearForm(options.includeHidden); });
12623    }
12624
12625    // perform a load on the target only if dataType is not provided
12626    if (!options.dataType && options.target) {
12627        var oldSuccess = options.success || function(){};
12628        callbacks.push(function(data) {
12629            var fn = options.replaceTarget ? 'replaceWith' : 'html';
12630            $(options.target)[fn](data).each(oldSuccess, arguments);
12631        });
12632    }
12633    else if (options.success) {
12634        callbacks.push(options.success);
12635    }
12636
12637    options.success = function(data, status, xhr) { // jQuery 1.4+ passes xhr as 3rd arg
12638        var context = options.context || options;    // jQuery 1.4+ supports scope context 
12639        for (var i=0, max=callbacks.length; i < max; i++) {
12640            callbacks[i].apply(context, [data, status, xhr || $form, $form]);
12641        }
12642    };
12643
12644    // are there files to upload?
12645    var fileInputs = $('input:file:enabled[value]', this); // [value] (issue #113)
12646    var hasFileInputs = fileInputs.length > 0;
12647    var mp = 'multipart/form-data';
12648    var multipart = ($form.attr('enctype') == mp || $form.attr('encoding') == mp);
12649
12650    var fileAPI = feature.fileapi && feature.formdata;
12651    log("fileAPI :" + fileAPI);
12652    var shouldUseFrame = (hasFileInputs || multipart) && !fileAPI;
12653
12654    // options.iframe allows user to force iframe mode
12655    // 06-NOV-09: now defaulting to iframe mode if file input is detected
12656    if (options.iframe !== false && (options.iframe || shouldUseFrame)) {
12657        // hack to fix Safari hang (thanks to Tim Molendijk for this)
12658        // see:  http://groups.google.com/group/jquery-dev/browse_thread/thread/36395b7ab510dd5d
12659        if (options.closeKeepAlive) {
12660            $.get(options.closeKeepAlive, function() {
12661                fileUploadIframe(a);
12662            });
12663        }
12664          else {
12665            fileUploadIframe(a);
12666          }
12667    }
12668    else if ((hasFileInputs || multipart) && fileAPI) {
12669        fileUploadXhr(a);
12670    }
12671    else {
12672        $.ajax(options);
12673    }
12674
12675    // clear element array
12676    for (var k=0; k < elements.length; k++)
12677        elements[k] = null;
12678
12679    // fire 'notify' event
12680    this.trigger('form-submit-notify', [this, options]);
12681    return this;
12682
12683     // XMLHttpRequest Level 2 file uploads (big hat tip to francois2metz)
12684    function fileUploadXhr(a) {
12685        var formdata = new FormData();
12686
12687        for (var i=0; i < a.length; i++) {
12688            formdata.append(a[i].name, a[i].value);
12689        }
12690
12691        if (options.extraData) {
12692            for (var p in options.extraData)
12693                if (options.extraData.hasOwnProperty(p))
12694                    formdata.append(p, options.extraData[p]);
12695        }
12696
12697        options.data = null;
12698
12699        var s = $.extend(true, {}, $.ajaxSettings, options, {
12700            contentType: false,
12701            processData: false,
12702            cache: false,
12703            type: 'POST'
12704        });
12705        
12706        if (options.uploadProgress) {
12707            // workaround because jqXHR does not expose upload property
12708            s.xhr = function() {
12709                var xhr = jQuery.ajaxSettings.xhr();
12710                if (xhr.upload) {
12711                    xhr.upload.onprogress = function(event) {
12712                        var percent = 0;
12713                        var position = event.loaded || event.position; /*event.position is deprecated*/
12714                        var total = event.total;
12715                        if (event.lengthComputable) {
12716                            percent = Math.ceil(position / total * 100);
12717                        }
12718                        options.uploadProgress(event, position, total, percent);
12719                    };
12720                }
12721                return xhr;
12722            };
12723        }
12724
12725        s.data = null;
12726          var beforeSend = s.beforeSend;
12727          s.beforeSend = function(xhr, o) {
12728              o.data = formdata;
12729            if(beforeSend)
12730                beforeSend.call(o, xhr, options);
12731        };
12732        $.ajax(s);
12733    }
12734
12735    // private function for handling file uploads (hat tip to YAHOO!)
12736    function fileUploadIframe(a) {
12737        var form = $form[0], el, i, s, g, id, $io, io, xhr, sub, n, timedOut, timeoutHandle;
12738        var useProp = !!$.fn.prop;
12739
12740        if ($(':input[name=submit],:input[id=submit]', form).length) {
12741            // if there is an input with a name or id of 'submit' then we won't be
12742            // able to invoke the submit fn on the form (at least not x-browser)
12743            alert('Error: Form elements must not have name or id of "submit".');
12744            return;
12745        }
12746        
12747        if (a) {
12748            // ensure that every serialized input is still enabled
12749            for (i=0; i < elements.length; i++) {
12750                el = $(elements[i]);
12751                if ( useProp )
12752                    el.prop('disabled', false);
12753                else
12754                    el.removeAttr('disabled');
12755            }
12756        }
12757
12758        s = $.extend(true, {}, $.ajaxSettings, options);
12759        s.context = s.context || s;
12760        id = 'jqFormIO' + (new Date().getTime());
12761        if (s.iframeTarget) {
12762            $io = $(s.iframeTarget);
12763            n = $io.attr('name');
12764            if (!n)
12765                 $io.attr('name', id);
12766            else
12767                id = n;
12768        }
12769        else {
12770            $io = $('<iframe name="' + id + '" src="'+ s.iframeSrc +'" />');
12771            $io.css({ position: 'absolute', top: '-1000px', left: '-1000px' });
12772        }
12773        io = $io[0];
12774
12775
12776        xhr = { // mock object
12777            aborted: 0,
12778            responseText: null,
12779            responseXML: null,
12780            status: 0,
12781            statusText: 'n/a',
12782            getAllResponseHeaders: function() {},
12783            getResponseHeader: function() {},
12784            setRequestHeader: function() {},
12785            abort: function(status) {
12786                var e = (status === 'timeout' ? 'timeout' : 'aborted');
12787                log('aborting upload... ' + e);
12788                this.aborted = 1;
12789                $io.attr('src', s.iframeSrc); // abort op in progress
12790                xhr.error = e;
12791                if (s.error)
12792                    s.error.call(s.context, xhr, e, status);
12793                if (g)
12794                    $.event.trigger("ajaxError", [xhr, s, e]);
12795                if (s.complete)
12796                    s.complete.call(s.context, xhr, e);
12797            }
12798        };
12799
12800        g = s.global;
12801        // trigger ajax global events so that activity/block indicators work like normal
12802        if (g && 0 === $.active++) {
12803            $.event.trigger("ajaxStart");
12804        }
12805        if (g) {
12806            $.event.trigger("ajaxSend", [xhr, s]);
12807        }
12808
12809        if (s.beforeSend && s.beforeSend.call(s.context, xhr, s) === false) {
12810            if (s.global) {
12811                $.active--;
12812            }
12813            return;
12814        }
12815        if (xhr.aborted) {
12816            return;
12817        }
12818
12819        // add submitting element to data if we know it
12820        sub = form.clk;
12821        if (sub) {
12822            n = sub.name;
12823            if (n && !sub.disabled) {
12824                s.extraData = s.extraData || {};
12825                s.extraData[n] = sub.value;
12826                if (sub.type == "image") {
12827                    s.extraData[n+'.x'] = form.clk_x;
12828                    s.extraData[n+'.y'] = form.clk_y;
12829                }
12830            }
12831        }
12832        
12833        var CLIENT_TIMEOUT_ABORT = 1;
12834        var SERVER_ABORT = 2;
12835
12836        function getDoc(frame) {
12837            var doc = frame.contentWindow ? frame.contentWindow.document : frame.contentDocument ? frame.contentDocument : frame.document;
12838            return doc;
12839        }
12840        
12841        // Rails CSRF hack (thanks to Yvan Barthelemy)
12842        var csrf_token = $('meta[name=csrf-token]').attr('content');
12843        var csrf_param = $('meta[name=csrf-param]').attr('content');
12844        if (csrf_param && csrf_token) {
12845            s.extraData = s.extraData || {};
12846            s.extraData[csrf_param] = csrf_token;
12847        }
12848
12849        // take a breath so that pending repaints get some cpu time before the upload starts
12850        function doSubmit() {
12851            // make sure form attrs are set
12852            var t = $form.attr('target'), a = $form.attr('action');
12853
12854            // update form attrs in IE friendly way
12855            form.setAttribute('target',id);
12856            if (!method) {
12857                form.setAttribute('method', 'POST');
12858            }
12859            if (a != s.url) {
12860                form.setAttribute('action', s.url);
12861            }
12862
12863            // ie borks in some cases when setting encoding
12864            if (! s.skipEncodingOverride && (!method || /post/i.test(method))) {
12865                $form.attr({
12866                    encoding: 'multipart/form-data',
12867                    enctype:  'multipart/form-data'
12868                });
12869            }
12870
12871            // support timout
12872            if (s.timeout) {
12873                timeoutHandle = setTimeout(function() { timedOut = true; cb(CLIENT_TIMEOUT_ABORT); }, s.timeout);
12874            }
12875            
12876            // look for server aborts
12877            function checkState() {
12878                try {
12879                    var state = getDoc(io).readyState;
12880                    log('state = ' + state);
12881                    if (state && state.toLowerCase() == 'uninitialized')
12882                        setTimeout(checkState,50);
12883                }
12884                catch(e) {
12885                    log('Server abort: ' , e, ' (', e.name, ')');
12886                    cb(SERVER_ABORT);
12887                    if (timeoutHandle)
12888                        clearTimeout(timeoutHandle);
12889                    timeoutHandle = undefined;
12890                }
12891            }
12892
12893            // add "extra" data to form if provided in options
12894            var extraInputs = [];
12895            try {
12896                if (s.extraData) {
12897                    for (var n in s.extraData) {
12898                        if (s.extraData.hasOwnProperty(n)) {
12899                            extraInputs.push(
12900                                $('<input type="hidden" name="'+n+'">').attr('value',s.extraData[n])
12901                                    .appendTo(form)[0]);
12902                        }
12903                    }
12904                }
12905
12906                if (!s.iframeTarget) {
12907                    // add iframe to doc and submit the form
12908                    $io.appendTo('body');
12909                    if (io.attachEvent)
12910                        io.attachEvent('onload', cb);
12911                    else
12912                        io.addEventListener('load', cb, false);
12913                }
12914                setTimeout(checkState,15);
12915                form.submit();
12916            }
12917            finally {
12918                // reset attrs and remove "extra" input elements
12919                form.setAttribute('action',a);
12920                if(t) {
12921                    form.setAttribute('target', t);
12922                } else {
12923                    $form.removeAttr('target');
12924                }
12925                $(extraInputs).remove();
12926            }
12927        }
12928
12929        if (s.forceSync) {
12930            doSubmit();
12931        }
12932        else {
12933            setTimeout(doSubmit, 10); // this lets dom updates render
12934        }
12935
12936        var data, doc, domCheckCount = 50, callbackProcessed;
12937
12938        function cb(e) {
12939            if (xhr.aborted || callbackProcessed) {
12940                return;
12941            }
12942            try {
12943                doc = getDoc(io);
12944            }
12945            catch(ex) {
12946                log('cannot access response document: ', ex);
12947                e = SERVER_ABORT;
12948            }
12949            if (e === CLIENT_TIMEOUT_ABORT && xhr) {
12950                xhr.abort('timeout');
12951                return;
12952            }
12953            else if (e == SERVER_ABORT && xhr) {
12954                xhr.abort('server abort');
12955                return;
12956            }
12957
12958            if (!doc || doc.location.href == s.iframeSrc) {
12959                // response not received yet
12960                if (!timedOut)
12961                    return;
12962            }
12963            if (io.detachEvent)
12964                io.detachEvent('onload', cb);
12965            else    
12966                io.removeEventListener('load', cb, false);
12967
12968            var status = 'success', errMsg;
12969            try {
12970                if (timedOut) {
12971                    throw 'timeout';
12972                }
12973
12974                var isXml = s.dataType == 'xml' || doc.XMLDocument || $.isXMLDoc(doc);
12975                log('isXml='+isXml);
12976                if (!isXml && window.opera && (doc.body === null || !doc.body.innerHTML)) {
12977                    if (--domCheckCount) {
12978                        // in some browsers (Opera) the iframe DOM is not always traversable when
12979                        // the onload callback fires, so we loop a bit to accommodate
12980                        log('requeing onLoad callback, DOM not available');
12981                        setTimeout(cb, 250);
12982                        return;
12983                    }
12984                    // let this fall through because server response could be an empty document
12985                    //log('Could not access iframe DOM after mutiple tries.');
12986                    //throw 'DOMException: not available';
12987                }
12988
12989                //log('response detected');
12990                var docRoot = doc.body ? doc.body : doc.documentElement;
12991                xhr.responseText = docRoot ? docRoot.innerHTML : null;
12992                xhr.responseXML = doc.XMLDocument ? doc.XMLDocument : doc;
12993                if (isXml)
12994                    s.dataType = 'xml';
12995                xhr.getResponseHeader = function(header){
12996                    var headers = {'content-type': s.dataType};
12997                    return headers[header];
12998                };
12999                // support for XHR 'status' & 'statusText' emulation :
13000                if (docRoot) {
13001                    xhr.status = Number( docRoot.getAttribute('status') ) || xhr.status;
13002                    xhr.statusText = docRoot.getAttribute('statusText') || xhr.statusText;
13003                }
13004
13005                var dt = (s.dataType || '').toLowerCase();
13006                var scr = /(json|script|text)/.test(dt);
13007                if (scr || s.textarea) {
13008                    // see if user embedded response in textarea
13009                    var ta = doc.getElementsByTagName('textarea')[0];
13010                    if (ta) {
13011                        xhr.responseText = ta.value;
13012                        // support for XHR 'status' & 'statusText' emulation :
13013                        xhr.status = Number( ta.getAttribute('status') ) || xhr.status;
13014                        xhr.statusText = ta.getAttribute('statusText') || xhr.statusText;
13015                    }
13016                    else if (scr) {
13017                        // account for browsers injecting pre around json response
13018                        var pre = doc.getElementsByTagName('pre')[0];
13019                        var b = doc.getElementsByTagName('body')[0];
13020                        if (pre) {
13021                            xhr.responseText = pre.textContent ? pre.textContent : pre.innerText;
13022                        }
13023                        else if (b) {
13024                            xhr.responseText = b.textContent ? b.textContent : b.innerText;
13025                        }
13026                    }
13027                }
13028                else if (dt == 'xml' && !xhr.responseXML && xhr.responseText) {
13029                    xhr.responseXML = toXml(xhr.responseText);
13030                }
13031
13032                try {
13033                    data = httpData(xhr, dt, s);
13034                }
13035                catch (e) {
13036                    status = 'parsererror';
13037                    xhr.error = errMsg = (e || status);
13038                }
13039            }
13040            catch (e) {
13041                log('error caught: ',e);
13042                status = 'error';
13043                xhr.error = errMsg = (e || status);
13044            }
13045
13046            if (xhr.aborted) {
13047                log('upload aborted');
13048                status = null;
13049            }
13050
13051            if (xhr.status) { // we've set xhr.status
13052                status = (xhr.status >= 200 && xhr.status < 300 || xhr.status === 304) ? 'success' : 'error';
13053            }
13054
13055            // ordering of these callbacks/triggers is odd, but that's how $.ajax does it
13056            if (status === 'success') {
13057                if (s.success)
13058                    s.success.call(s.context, data, 'success', xhr);
13059                if (g)
13060                    $.event.trigger("ajaxSuccess", [xhr, s]);
13061            }
13062            else if (status) {
13063                if (errMsg === undefined)
13064                    errMsg = xhr.statusText;
13065                if (s.error)
13066                    s.error.call(s.context, xhr, status, errMsg);
13067                if (g)
13068                    $.event.trigger("ajaxError", [xhr, s, errMsg]);
13069            }
13070
13071            if (g)
13072                $.event.trigger("ajaxComplete", [xhr, s]);
13073
13074            if (g && ! --$.active) {
13075                $.event.trigger("ajaxStop");
13076            }
13077
13078            if (s.complete)
13079                s.complete.call(s.context, xhr, status);
13080
13081            callbackProcessed = true;
13082            if (s.timeout)
13083                clearTimeout(timeoutHandle);
13084
13085            // clean up
13086            setTimeout(function() {
13087                if (!s.iframeTarget)
13088                    $io.remove();
13089                xhr.responseXML = null;
13090            }, 100);
13091        }
13092
13093        var toXml = $.parseXML || function(s, doc) { // use parseXML if available (jQuery 1.5+)
13094            if (window.ActiveXObject) {
13095                doc = new ActiveXObject('Microsoft.XMLDOM');
13096                doc.async = 'false';
13097                doc.loadXML(s);
13098            }
13099            else {
13100                doc = (new DOMParser()).parseFromString(s, 'text/xml');
13101            }
13102            return (doc && doc.documentElement && doc.documentElement.nodeName != 'parsererror') ? doc : null;
13103        };
13104        var parseJSON = $.parseJSON || function(s) {
13105            /*jslint evil:true */
13106            return window['eval']('(' + s + ')');
13107        };
13108
13109        var httpData = function( xhr, type, s ) { // mostly lifted from jq1.4.4
13110
13111            var ct = xhr.getResponseHeader('content-type') || '',
13112                xml = type === 'xml' || !type && ct.indexOf('xml') >= 0,
13113                data = xml ? xhr.responseXML : xhr.responseText;
13114
13115            if (xml && data.documentElement.nodeName === 'parsererror') {
13116                if ($.error)
13117                    $.error('parsererror');
13118            }
13119            if (s && s.dataFilter) {
13120                data = s.dataFilter(data, type);
13121            }
13122            if (typeof data === 'string') {
13123                if (type === 'json' || !type && ct.indexOf('json') >= 0) {
13124                    data = parseJSON(data);
13125                } else if (type === "script" || !type && ct.indexOf("javascript") >= 0) {
13126                    $.globalEval(data);
13127                }
13128            }
13129            return data;
13130        };
13131    }
13132};
13133
13134/**
13135 * ajaxForm() provides a mechanism for fully automating form submission.
13136 *
13137 * The advantages of using this method instead of ajaxSubmit() are:
13138 *
13139 * 1: This method will include coordinates for <input type="image" /> elements (if the element
13140 *    is used to submit the form).
13141 * 2. This method will include the submit element's name/value data (for the element that was
13142 *    used to submit the form).
13143 * 3. This method binds the submit() method to the form for you.
13144 *
13145 * The options argument for ajaxForm works exactly as it does for ajaxSubmit.  ajaxForm merely
13146 * passes the options argument along after properly binding events for submit elements and
13147 * the form itself.
13148 */
13149$.fn.ajaxForm = function(options) {
13150    options = options || {};
13151    options.delegation = options.delegation && $.isFunction($.fn.on);
13152    
13153    // in jQuery 1.3+ we can fix mistakes with the ready state
13154    if (!options.delegation && this.length === 0) {
13155        var o = { s: this.selector, c: this.context };
13156        if (!$.isReady && o.s) {
13157            log('DOM not ready, queuing ajaxForm');
13158            $(function() {
13159                $(o.s,o.c).ajaxForm(options);
13160            });
13161            return this;
13162        }
13163        // is your DOM ready?  http://docs.jquery.com/Tutorials:Introducing_$(document).ready()
13164        log('terminating; zero elements found by selector' + ($.isReady ? '' : ' (DOM not ready)'));
13165        return this;
13166    }
13167
13168    if ( options.delegation ) {
13169        $(document)
13170            .off('submit.form-plugin', this.selector, doAjaxSubmit)
13171            .off('click.form-plugin', this.selector, captureSubmittingElement)
13172            .on('submit.form-plugin', this.selector, options, doAjaxSubmit)
13173            .on('click.form-plugin', this.selector, options, captureSubmittingElement);
13174        return this;
13175    }
13176
13177    return this.ajaxFormUnbind()
13178        .bind('submit.form-plugin', options, doAjaxSubmit)
13179        .bind('click.form-plugin', options, captureSubmittingElement);
13180};
13181
13182// private event handlers    
13183function doAjaxSubmit(e) {
13184    /*jshint validthis:true */
13185    var options = e.data;
13186    if (!e.isDefaultPrevented()) { // if event has been canceled, don't proceed
13187        e.preventDefault();
13188        $(this).ajaxSubmit(options);
13189    }
13190}
13191    
13192function captureSubmittingElement(e) {
13193    /*jshint validthis:true */
13194    var target = e.target;
13195    var $el = $(target);
13196    if (!($el.is(":submit,input:image"))) {
13197        // is this a child element of the submit el?  (ex: a span within a button)
13198        var t = $el.closest(':submit');
13199        if (t.length === 0) {
13200            return;
13201        }
13202        target = t[0];
13203    }
13204    var form = this;
13205    form.clk = target;
13206    if (target.type == 'image') {
13207        if (e.offsetX !== undefined) {
13208            form.clk_x = e.offsetX;
13209            form.clk_y = e.offsetY;
13210        } else if (typeof $.fn.offset == 'function') {
13211            var offset = $el.offset();
13212            form.clk_x = e.pageX - offset.left;
13213            form.clk_y = e.pageY - offset.top;
13214        } else {
13215            form.clk_x = e.pageX - target.offsetLeft;
13216            form.clk_y = e.pageY - target.offsetTop;
13217        }
13218    }
13219    // clear form vars
13220    setTimeout(function() { form.clk = form.clk_x = form.clk_y = null; }, 100);
13221}
13222
13223
13224// ajaxFormUnbind unbinds the event handlers that were bound by ajaxForm
13225$.fn.ajaxFormUnbind = function() {
13226    return this.unbind('submit.form-plugin click.form-plugin');
13227};
13228
13229/**
13230 * formToArray() gathers form element data into an array of objects that can
13231 * be passed to any of the following ajax functions: $.get, $.post, or load.
13232 * Each object in the array has both a 'name' and 'value' property.  An example of
13233 * an array for a simple login form might be:
13234 *
13235 * [ { name: 'username', value: 'jresig' }, { name: 'password', value: 'secret' } ]
13236 *
13237 * It is this array that is passed to pre-submit callback functions provided to the
13238 * ajaxSubmit() and ajaxForm() methods.
13239 */
13240$.fn.formToArray = function(semantic, elements) {
13241    var a = [];
13242    if (this.length === 0) {
13243        return a;
13244    }
13245
13246    var form = this[0];
13247    var els = semantic ? form.getElementsByTagName('*') : form.elements;
13248    if (!els) {
13249        return a;
13250    }
13251
13252    var i,j,n,v,el,max,jmax;
13253    for(i=0, max=els.length; i < max; i++) {
13254        el = els[i];
13255        n = el.name;
13256        if (!n) {
13257            continue;
13258        }
13259
13260        if (semantic && form.clk && el.type == "image") {
13261            // handle image inputs on the fly when semantic == true
13262            if(!el.disabled && form.clk == el) {
13263                a.push({name: n, value: $(el).val(), type: el.type });
13264                a.push({name: n+'.x', value: form.clk_x}, {name: n+'.y', value: form.clk_y});
13265            }
13266            continue;
13267        }
13268
13269        v = $.fieldValue(el, true);
13270        if (v && v.constructor == Array) {
13271            if (elements) 
13272                elements.push(el);
13273            for(j=0, jmax=v.length; j < jmax; j++) {
13274                a.push({name: n, value: v[j]});
13275            }
13276        }
13277        else if (feature.fileapi && el.type == 'file' && !el.disabled) {
13278            if (elements) 
13279                elements.push(el);
13280            var files = el.files;
13281            if (files.length) {
13282                for (j=0; j < files.length; j++) {
13283                    a.push({name: n, value: files[j], type: el.type});
13284                }
13285            }
13286            else {
13287                // #180
13288                a.push({ name: n, value: '', type: el.type });
13289            }
13290        }
13291        else if (v !== null && typeof v != 'undefined') {
13292            if (elements) 
13293                elements.push(el);
13294            a.push({name: n, value: v, type: el.type, required: el.required});
13295        }
13296    }
13297
13298    if (!semantic && form.clk) {
13299        // input type=='image' are not found in elements array! handle it here
13300        var $input = $(form.clk), input = $input[0];
13301        n = input.name;
13302        if (n && !input.disabled && input.type == 'image') {
13303            a.push({name: n, value: $input.val()});
13304            a.push({name: n+'.x', value: form.clk_x}, {name: n+'.y', value: form.clk_y});
13305        }
13306    }
13307    return a;
13308};
13309
13310/**
13311 * Serializes form data into a 'submittable' string. This method will return a string
13312 * in the format: name1=value1&amp;name2=value2
13313 */
13314$.fn.formSerialize = function(semantic) {
13315    //hand off to jQuery.param for proper encoding
13316    return $.param(this.formToArray(semantic));
13317};
13318
13319/**
13320 * Serializes all field elements in the jQuery object into a query string.
13321 * This method will return a string in the format: name1=value1&amp;name2=value2
13322 */
13323$.fn.fieldSerialize = function(successful) {
13324    var a = [];
13325    this.each(function() {
13326        var n = this.name;
13327        if (!n) {
13328            return;
13329        }
13330        var v = $.fieldValue(this, successful);
13331        if (v && v.constructor == Array) {
13332            for (var i=0,max=v.length; i < max; i++) {
13333                a.push({name: n, value: v[i]});
13334            }
13335        }
13336        else if (v !== null && typeof v != 'undefined') {
13337            a.push({name: this.name, value: v});
13338        }
13339    });
13340    //hand off to jQuery.param for proper encoding
13341    return $.param(a);
13342};
13343
13344/**
13345 * Returns the value(s) of the element in the matched set.  For example, consider the following form:
13346 *
13347 *  <form><fieldset>
13348 *      <input name="A" type="text" />
13349 *      <input name="A" type="text" />
13350 *      <input name="B" type="checkbox" value="B1" />
13351 *      <input name="B" type="checkbox" value="B2"/>
13352 *      <input name="C" type="radio" value="C1" />
13353 *      <input name="C" type="radio" value="C2" />
13354 *  </fieldset></form>
13355 *
13356 *  var v = $(':text').fieldValue();
13357 *  // if no values are entered into the text inputs
13358 *  v == ['','']
13359 *  // if values entered into the text inputs are 'foo' and 'bar'
13360 *  v == ['foo','bar']
13361 *
13362 *  var v = $(':checkbox').fieldValue();
13363 *  // if neither checkbox is checked
13364 *  v === undefined
13365 *  // if both checkboxes are checked
13366 *  v == ['B1', 'B2']
13367 *
13368 *  var v = $(':radio').fieldValue();
13369 *  // if neither radio is checked
13370 *  v === undefined
13371 *  // if first radio is checked
13372 *  v == ['C1']
13373 *
13374 * The successful argument controls whether or not the field element must be 'successful'
13375 * (per http://www.w3.org/TR/html4/interact/forms.html#successful-controls).
13376 * The default value of the successful argument is true.  If this value is false the value(s)
13377 * for each element is returned.
13378 *
13379 * Note: This method *always* returns an array.  If no valid value can be determined the
13380 *    array will be empty, otherwise it will contain one or more values.
13381 */
13382$.fn.fieldValue = function(successful) {
13383    for (var val=[], i=0, max=this.length; i < max; i++) {
13384        var el = this[i];
13385        var v = $.fieldValue(el, successful);
13386        if (v === null || typeof v == 'undefined' || (v.constructor == Array && !v.length)) {
13387            continue;
13388        }
13389        if (v.constructor == Array)
13390            $.merge(val, v);
13391        else
13392            val.push(v);
13393    }
13394    return val;
13395};
13396
13397/**
13398 * Returns the value of the field element.
13399 */
13400$.fieldValue = function(el, successful) {
13401    var n = el.name, t = el.type, tag = el.tagName.toLowerCase();
13402    if (successful === undefined) {
13403        successful = true;
13404    }
13405
13406    if (successful && (!n || el.disabled || t == 'reset' || t == 'button' ||
13407        (t == 'checkbox' || t == 'radio') && !el.checked ||
13408        (t == 'submit' || t == 'image') && el.form && el.form.clk != el ||
13409        tag == 'select' && el.selectedIndex == -1)) {
13410            return null;
13411    }
13412
13413    if (tag == 'select') {
13414        var index = el.selectedIndex;
13415        if (index < 0) {
13416            return null;
13417        }
13418        var a = [], ops = el.options;
13419        var one = (t == 'select-one');
13420        var max = (one ? index+1 : ops.length);
13421        for(var i=(one ? index : 0); i < max; i++) {
13422            var op = ops[i];
13423            if (op.selected) {
13424                var v = op.value;
13425                if (!v) { // extra pain for IE...
13426                    v = (op.attributes && op.attributes['value'] && !(op.attributes['value'].specified)) ? op.text : op.value;
13427                }
13428                if (one) {
13429                    return v;
13430                }
13431                a.push(v);
13432            }
13433        }
13434        return a;
13435    }
13436    return $(el).val();
13437};
13438
13439/**
13440 * Clears the form data.  Takes the following actions on the form's input fields:
13441 *  - input text fields will have their 'value' property set to the empty string
13442 *  - select elements will have their 'selectedIndex' property set to -1
13443 *  - checkbox and radio inputs will have their 'checked' property set to false
13444 *  - inputs of type submit, button, reset, and hidden will *not* be effected
13445 *  - button elements will *not* be effected
13446 */
13447$.fn.clearForm = function(includeHidden) {
13448    return this.each(function() {
13449        $('input,select,textarea', this).clearFields(includeHidden);
13450    });
13451};
13452
13453/**
13454 * Clears the selected form elements.
13455 */
13456$.fn.clearFields = $.fn.clearInputs = function(includeHidden) {
13457    var re = /^(?:color|date|datetime|email|month|number|password|range|search|tel|text|time|url|week)$/i; // 'hidden' is not in this list
13458    return this.each(function() {
13459        var t = this.type, tag = this.tagName.toLowerCase();
13460        if (re.test(t) || tag == 'textarea') {
13461            this.value = '';
13462        }
13463        else if (t == 'checkbox' || t == 'radio') {
13464            this.checked = false;
13465        }
13466        else if (tag == 'select') {
13467            this.selectedIndex = -1;
13468        }
13469        else if (includeHidden) {
13470            // includeHidden can be the valud true, or it can be a selector string
13471            // indicating a special test; for example:
13472            //  $('#myForm').clearForm('.special:hidden')
13473            // the above would clean hidden inputs that have the class of 'special'
13474            if ( (includeHidden === true && /hidden/.test(t)) ||
13475                 (typeof includeHidden == 'string' && $(this).is(includeHidden)) )
13476                this.value = '';
13477        }
13478    });
13479};
13480
13481/**
13482 * Resets the form data.  Causes all form elements to be reset to their original value.
13483 */
13484$.fn.resetForm = function() {
13485    return this.each(function() {
13486        // guard against an input with the name of 'reset'
13487        // note that IE reports the reset function as an 'object'
13488        if (typeof this.reset == 'function' || (typeof this.reset == 'object' && !this.reset.nodeType)) {
13489            this.reset();
13490        }
13491    });
13492};
13493
13494/**
13495 * Enables or disables any matching elements.
13496 */
13497$.fn.enable = function(b) {
13498    if (b === undefined) {
13499        b = true;
13500    }
13501    return this.each(function() {
13502        this.disabled = !b;
13503    });
13504};
13505
13506/**
13507 * Checks/unchecks any matching checkboxes or radio buttons and
13508 * selects/deselects and matching option elements.
13509 */
13510$.fn.selected = function(select) {
13511    if (select === undefined) {
13512        select = true;
13513    }
13514    return this.each(function() {
13515        var t = this.type;
13516        if (t == 'checkbox' || t == 'radio') {
13517            this.checked = select;
13518        }
13519        else if (this.tagName.toLowerCase() == 'option') {
13520            var $sel = $(this).parent('select');
13521            if (select && $sel[0] && $sel[0].type == 'select-one') {
13522                // deselect all other options
13523                $sel.find('option').selected(false);
13524            }
13525            this.selected = select;
13526        }
13527    });
13528};
13529
13530// expose debug var
13531$.fn.ajaxSubmit.debug = false;
13532
13533// helper fn for console logging
13534function log() {
13535    if (!$.fn.ajaxSubmit.debug) 
13536        return;
13537    var msg = '[jquery.form] ' + Array.prototype.join.call(arguments,'');
13538    if (window.console && window.console.log) {
13539        window.console.log(msg);
13540    }
13541    else if (window.opera && window.opera.postError) {
13542        window.opera.postError(msg);
13543    }
13544}
13545
13546})(jQuery);
13547/*!
13548 * @copyright Copyright &copy; Kartik Visweswaran, Krajee.com, 2014 - 2016
13549 * @version 1.3.4
13550 *
13551 * Date formatter utility library that allows formatting date/time variables or Date objects using PHP DateTime format.
13552 * @see http://php.net/manual/en/function.date.php
13553 *
13554 * For more JQuery plugins visit http://plugins.krajee.com
13555 * For more Yii related demos visit http://demos.krajee.com
13556 */var DateFormatter;!function(){"use strict";var t,e,r,n,a,u,i;u=864e5,i=3600,t=function(t,e){return"string"==typeof t&&"string"==typeof e&&t.toLowerCase()===e.toLowerCase()},e=function(t,r,n){var a=n||"0",u=t.toString();return u.length<r?e(a+u,r):u},r=function(t){var e,n;for(t=t||{},e=1;e<arguments.length;e++)if(n=arguments[e])for(var a in n)n.hasOwnProperty(a)&&("object"==typeof n[a]?r(t[a],n[a]):t[a]=n[a]);return t},n=function(t,e){for(var r=0;r<e.length;r++)if(e[r].toLowerCase()===t.toLowerCase())return r;return-1},a={dateSettings:{days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],daysShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],monthsShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],meridiem:["AM","PM"],ordinal:function(t){var e=t%10,r={1:"st",2:"nd",3:"rd"};return 1!==Math.floor(t%100/10)&&r[e]?r[e]:"th"}},separators:/[ \-+\/\.T:@]/g,validParts:/[dDjlNSwzWFmMntLoYyaABgGhHisueTIOPZcrU]/g,intParts:/[djwNzmnyYhHgGis]/g,tzParts:/\b(?:[PMCEA][SDP]T|(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time|(?:GMT|UTC)(?:[-+]\d{4})?)\b/g,tzClip:/[^-+\dA-Z]/g},DateFormatter=function(t){var e=this,n=r(a,t);e.dateSettings=n.dateSettings,e.separators=n.separators,e.validParts=n.validParts,e.intParts=n.intParts,e.tzParts=n.tzParts,e.tzClip=n.tzClip},DateFormatter.prototype={constructor:DateFormatter,getMonth:function(t){var e,r=this;return e=n(t,r.dateSettings.monthsShort)+1,0===e&&(e=n(t,r.dateSettings.months)+1),e},parseDate:function(e,r){var n,a,u,i,s,o,c,f,l,h,d=this,g=!1,m=!1,p=d.dateSettings,y={date:null,year:null,month:null,day:null,hour:0,min:0,sec:0};if(!e)return null;if(e instanceof Date)return e;if("U"===r)return u=parseInt(e),u?new Date(1e3*u):e;switch(typeof e){case"number":return new Date(e);case"string":break;default:return null}
vendor: 4,365 bytes, line 13556
13556if(n=r.match(d.validParts),!n||0===n.length)throw new Error("Invalid date format definition.");for(a=e.replace(d.separators,"\x00").split("\x00"),u=0;u<a.length;u++)switch(i=a[u],s=parseInt(i),n[u]){case"y":case"Y":if(!s)return null;l=i.length,y.year=2===l?parseInt((70>s?"20":"19")+i):s,g=!0;break;case"m":case"n":case"M":case"F":if(isNaN(s)){if(o=d.getMonth(i),!(o>0))return null;y.month=o}else{if(!(s>=1&&12>=s))return null;y.month=s}g=!0;break;case"d":case"j":if(!(s>=1&&31>=s))return null;y.day=s,g=!0;break;case"g":case"h":if(c=n.indexOf("a")>-1?n.indexOf("a"):n.indexOf("A")>-1?n.indexOf("A"):-1,h=a[c],c>-1)f=t(h,p.meridiem[0])?0:t(h,p.meridiem[1])?12:-1,s>=1&&12>=s&&f>-1?y.hour=s+f-1:s>=0&&23>=s&&(y.hour=s);else{if(!(s>=0&&23>=s))return null;y.hour=s}m=!0;break;case"G":case"H":if(!(s>=0&&23>=s))return null;y.hour=s,m=!0;break;case"i":if(!(s>=0&&59>=s))return null;y.min=s,m=!0;break;case"s":if(!(s>=0&&59>=s))return null;y.sec=s,m=!0}if(g===!0&&y.year&&y.month&&y.day)y.date=new Date(y.year,y.month-1,y.day,y.hour,y.min,y.sec,0);else{if(m!==!0)return null;y.date=new Date(0,0,0,y.hour,y.min,y.sec,0)}return y.date},guessDate:function(t,e){if("string"!=typeof t)return t;var r,n,a,u,i,s,o=this,c=t.replace(o.separators,"\x00").split("\x00"),f=/^[djmn]/g,l=e.match(o.validParts),h=new Date,d=0;if(!f.test(l[0]))return t;for(a=0;a<c.length;a++){if(d=2,i=c[a],s=parseInt(i.substr(0,2)),isNaN(s))return null;switch(a){case 0:"m"===l[0]||"n"===l[0]?h.setMonth(s-1):h.setDate(s);break;case 1:"m"===l[0]||"n"===l[0]?h.setDate(s):h.setMonth(s-1);break;case 2:if(n=h.getFullYear(),r=i.length,d=4>r?r:4,n=parseInt(4>r?n.toString().substr(0,4-r)+i:i.substr(0,4)),!n)return null;h.setFullYear(n);break;case 3:h.setHours(s);break;case 4:h.setMinutes(s);break;case 5:h.setSeconds(s)}u=i.substr(d),u.length>0&&c.splice(a+1,0,u)}return h},parseFormat:function(t,r){var n,a=this,s=a.dateSettings,o=/\\?(.?)/gi,c=function(t,e){return n[t]?n[t]():e};return n={d:function(){return e(n.j(),2)},D:function(){return s.daysShort[n.w()]},j:function(){return r.getDate()},l:function(){return s.days[n.w()]},N:function(){return n.w()||7},w:function(){return r.getDay()},z:function(){var t=new Date(n.Y(),n.n()-1,n.j()),e=new Date(n.Y(),0,1);return Math.round((t-e)/u)},W:function(){var t=new Date(n.Y(),n.n()-1,n.j()-n.N()+3),r=new Date(t.getFullYear(),0,4);return e(1+Math.round((t-r)/u/7),2)},F:function(){return s.months[r.getMonth()]},m:function(){return e(n.n(),2)},M:function(){return s.monthsShort[r.getMonth()]},n:function(){return r.getMonth()+1},t:function(){return new Date(n.Y(),n.n(),0).getDate()},L:function(){var t=n.Y();return t%4===0&&t%100!==0||t%400===0?1:0},o:function(){var t=n.n(),e=n.W(),r=n.Y();return r+(12===t&&9>e?1:1===t&&e>9?-1:0)},Y:function(){return r.getFullYear()},y:function(){return n.Y().toString().slice(-2)},a:function(){return n.A().toLowerCase()},A:function(){var t=n.G()<12?0:1;return s.meridiem[t]},B:function(){var t=r.getUTCHours()*i,n=60*r.getUTCMinutes(),a=r.getUTCSeconds();return e(Math.floor((t+n+a+i)/86.4)%1e3,3)},g:function(){return n.G()%12||12},G:function(){return r.getHours()},h:function(){return e(n.g(),2)},H:function(){return e(n.G(),2)},i:function(){return e(r.getMinutes(),2)},s:function(){return e(r.getSeconds(),2)},u:function(){return e(1e3*r.getMilliseconds(),6)},e:function(){var t=/\((.*)\)/.exec(String(r))[1];return t||"Coordinated Universal Time"},I:function(){var t=new Date(n.Y(),0),e=Date.UTC(n.Y(),0),r=new Date(n.Y(),6),a=Date.UTC(n.Y(),6);return t-e!==r-a?1:0},O:function(){var t=r.getTimezoneOffset(),n=Math.abs(t);return(t>0?"-":"+")+e(100*Math.floor(n/60)+n%60,4)},P:function(){var t=n.O();return t.substr(0,3)+":"+t.substr(3,2)},T:function(){var t=(String(r).match(a.tzParts)||[""]).pop().replace(a.tzClip,"");return t||"UTC"},Z:function(){return 60*-r.getTimezoneOffset()},c:function(){return"Y-m-d\\TH:i:sP".replace(o,c)},r:function(){return"D, d M Y H:i:s O".replace(o,c)},U:function(){return r.getTime()/1e3||0}},c(t,t)},formatDate:function(t,e){var r,n,a,u,i,s=this,o="",c="\\";if("string"==typeof t&&(t=s.parseDate(t,e),!t))return null;if(t instanceof Date){for(a=e.length,r=0;a>r;r++)i=e.charAt(r),"S"!==i&&i!==c&&(r>0&&e.charAt(r-1)===c?o+=i:(u=s.parseFormat(i,t),r!==a-1&&s.intParts.test(i)&&"S"===e.charAt(r+1)&&(n=parseInt(u)||0,u+=s.dateSettings.ordinal(n)),o+=u));return o}return""}}}();
vendor: 3,950 bytes, lines 13556-13644
13556/**
13557 * @preserve jQuery DateTimePicker
13558 * @homepage http://xdsoft.net/jqplugins/datetimepicker/
13559 * @author Chupurnov Valeriy (<[email protected]>)
13560 */
13561
13562/**
13563 * @param {jQuery} $
13564 */
13565var datetimepickerFactory = function ($) {
13566	'use strict';
13567
13568	var default_options  = {
13569		i18n: {
13570			ar: { // Arabic
13571				months: [
13572					"كانون الثاني", "شباط", "آذار", "نيسان", "مايو", "حزيران", "تموز", "آب", "أيلول", "تشرين الأول", "تشرين الثاني", "كانون الأول"
13573				],
13574				dayOfWeekShort: [
13575					"ن", "ث", "ع", "خ", "ج", "س", "ح"
13576				],
13577				dayOfWeek: ["الأحد", "الاثنين", "الثلاثاء", "الأربعاء", "الخميس", "الجمعة", "السبت", "الأحد"]
13578			},
13579			ro: { // Romanian
13580				months: [
13581					"Ianuarie", "Februarie", "Martie", "Aprilie", "Mai", "Iunie", "Iulie", "August", "Septembrie", "Octombrie", "Noiembrie", "Decembrie"
13582				],
13583				dayOfWeekShort: [
13584					"Du", "Lu", "Ma", "Mi", "Jo", "Vi", "Sâ"
13585				],
13586				dayOfWeek: ["Duminică", "Luni", "Marţi", "Miercuri", "Joi", "Vineri", "Sâmbătă"]
13587			},
13588			id: { // Indonesian
13589				months: [
13590					"Januari", "Februari", "Maret", "April", "Mei", "Juni", "Juli", "Agustus", "September", "Oktober", "November", "Desember"
13591				],
13592				dayOfWeekShort: [
13593					"Min", "Sen", "Sel", "Rab", "Kam", "Jum", "Sab"
13594				],
13595				dayOfWeek: ["Minggu", "Senin", "Selasa", "Rabu", "Kamis", "Jumat", "Sabtu"]
13596			},
13597			is: { // Icelandic
13598				months: [
13599					"Janúar", "Febrúar", "Mars", "Apríl", "Maí", "Júní", "Júlí", "Ágúst", "September", "Október", "Nóvember", "Desember"
13600				],
13601				dayOfWeekShort: [
13602					"Sun", "Mán", "Þrið", "Mið", "Fim", "Fös", "Lau"
13603				],
13604				dayOfWeek: ["Sunnudagur", "Mánudagur", "Þriðjudagur", "Miðvikudagur", "Fimmtudagur", "Föstudagur", "Laugardagur"]
13605			},
13606			bg: { // Bulgarian
13607				months: [
13608					"Януари", "Февруари", "Март", "Април", "Май", "Юни", "Юли", "Август", "Септември", "Октомври", "Ноември", "Декември"
13609				],
13610				dayOfWeekShort: [
13611					"Нд", "Пн", "Вт", "Ср", "Чт", "Пт", "Сб"
13612				],
13613				dayOfWeek: ["Неделя", "Понеделник", "Вторник", "Сряда", "Четвъртък", "Петък", "Събота"]
13614			},
13615			fa: { // Persian/Farsi
13616				months: [
13617					'فروردین', 'اردیبهشت', 'خرداد', 'تیر', 'مرداد', 'شهریور', 'مهر', 'آبان', 'آذر', 'دی', 'بهمن', 'اسفند'
13618				],
13619				dayOfWeekShort: [
13620					'یکشنبه', 'دوشنبه', 'سه شنبه', 'چهارشنبه', 'پنجشنبه', 'جمعه', 'شنبه'
13621				],
13622				dayOfWeek: ["یک‌شنبه", "دوشنبه", "سه‌شنبه", "چهارشنبه", "پنج‌شنبه", "جمعه", "شنبه", "یک‌شنبه"]
13623			},
13624			ru: { // Russian
13625				months: [
13626					'Январь', 'Февраль', 'Март', 'Апрель', 'Май', 'Июнь', 'Июль', 'Август', 'Сентябрь', 'Октябрь', 'Ноябрь', 'Декабрь'
13627				],
13628				dayOfWeekShort: [
13629					"Вс", "Пн", "Вт", "Ср", "Чт", "Пт", "Сб"
13630				],
13631				dayOfWeek: ["Воскресенье", "Понедельник", "Вторник", "Среда", "Четверг", "Пятница", "Суббота"]
13632			},
13633			uk: { // Ukrainian
13634				months: [
13635					'Січень', 'Лютий', 'Березень', 'Квітень', 'Травень', 'Червень', 'Липень', 'Серпень', 'Вересень', 'Жовтень', 'Листопад', 'Грудень'
13636				],
13637				dayOfWeekShort: [
13638					"Ндл", "Пнд", "Втр", "Срд", "Чтв", "Птн", "Сбт"
13639				],
13640				dayOfWeek: ["Неділя", "Понеділок", "Вівторок", "Середа", "Четвер", "П'ятниця", "Субота"]
13641			},
13642			en: { // English
13643				months: [
13644					"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "
vendor: 18,361 bytes, lines 13644-14069
13644November", "December"
13645				],
13646				dayOfWeekShort: [
13647					"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"
13648				],
13649				dayOfWeek: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]
13650			},
13651			el: { // Ελληνικά
13652				months: [
13653					"Ιανουάριος", "Φεβρουάριος", "Μάρτιος", "Απρίλιος", "Μάιος", "Ιούνιος", "Ιούλιος", "Αύγουστος", "Σεπτέμβριος", "Οκτώβριος", "Νοέμβριος", "Δεκέμβριος"
13654				],
13655				dayOfWeekShort: [
13656					"Κυρ", "Δευ", "Τρι", "Τετ", "Πεμ", "Παρ", "Σαβ"
13657				],
13658				dayOfWeek: ["Κυριακή", "Δευτέρα", "Τρίτη", "Τετάρτη", "Πέμπτη", "Παρασκευή", "Σάββατο"]
13659			},
13660			de: { // German
13661				months: [
13662					'Januar', 'Februar', 'März', 'April', 'Mai', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'Dezember'
13663				],
13664				dayOfWeekShort: [
13665					"So", "Mo", "Di", "Mi", "Do", "Fr", "Sa"
13666				],
13667				dayOfWeek: ["Sonntag", "Montag", "Dienstag", "Mittwoch", "Donnerstag", "Freitag", "Samstag"]
13668			},
13669			nl: { // Dutch
13670				months: [
13671					"januari", "februari", "maart", "april", "mei", "juni", "juli", "augustus", "september", "oktober", "november", "december"
13672				],
13673				dayOfWeekShort: [
13674					"zo", "ma", "di", "wo", "do", "vr", "za"
13675				],
13676				dayOfWeek: ["zondag", "maandag", "dinsdag", "woensdag", "donderdag", "vrijdag", "zaterdag"]
13677			},
13678			tr: { // Turkish
13679				months: [
13680					"Ocak", "Şubat", "Mart", "Nisan", "Mayıs", "Haziran", "Temmuz", "Ağustos", "Eylül", "Ekim", "Kasım", "Aralık"
13681				],
13682				dayOfWeekShort: [
13683					"Paz", "Pts", "Sal", "Çar", "Per", "Cum", "Cts"
13684				],
13685				dayOfWeek: ["Pazar", "Pazartesi", "Salı", "Çarşamba", "Perşembe", "Cuma", "Cumartesi"]
13686			},
13687			fr: { //French
13688				months: [
13689					"Janvier", "Février", "Mars", "Avril", "Mai", "Juin", "Juillet", "Août", "Septembre", "Octobre", "Novembre", "Décembre"
13690				],
13691				dayOfWeekShort: [
13692					"Dim", "Lun", "Mar", "Mer", "Jeu", "Ven", "Sam"
13693				],
13694				dayOfWeek: ["dimanche", "lundi", "mardi", "mercredi", "jeudi", "vendredi", "samedi"]
13695			},
13696			es: { // Spanish
13697				months: [
13698					"Enero", "Febrero", "Marzo", "Abril", "Mayo", "Junio", "Julio", "Agosto", "Septiembre", "Octubre", "Noviembre", "Diciembre"
13699				],
13700				dayOfWeekShort: [
13701					"Dom", "Lun", "Mar", "Mié", "Jue", "Vie", "Sáb"
13702				],
13703				dayOfWeek: ["Domingo", "Lunes", "Martes", "Miércoles", "Jueves", "Viernes", "Sábado"]
13704			},
13705			th: { // Thai
13706				months: [
13707					'มกราคม', 'กุมภาพันธ์', 'มีนาคม', 'เมษายน', 'พฤษภาคม', 'มิถุนายน', 'กรกฎาคม', 'สิงหาคม', 'กันยายน', 'ตุลาคม', 'พฤศจิกายน', 'ธันวาคม'
13708				],
13709				dayOfWeekShort: [
13710					'อา.', 'จ.', 'อ.', 'พ.', 'พฤ.', 'ศ.', 'ส.'
13711				],
13712				dayOfWeek: ["อาทิตย์", "จันทร์", "อังคาร", "พุธ", "พฤหัส", "ศุกร์", "เสาร์", "อาทิตย์"]
13713			},
13714			pl: { // Polish
13715				months: [
13716					"styczeń", "luty", "marzec", "kwiecień", "maj", "czerwiec", "lipiec", "sierpień", "wrzesień", "październik", "listopad", "grudzień"
13717				],
13718				dayOfWeekShort: [
13719					"nd", "pn", "wt", "śr", "cz", "pt", "sb"
13720				],
13721				dayOfWeek: ["niedziela", "poniedziałek", "wtorek", "środa", "czwartek", "piątek", "sobota"]
13722			},
13723			pt: { // Portuguese
13724				months: [
13725					"Janeiro", "Fevereiro", "Março", "Abril", "Maio", "Junho", "Julho", "Agosto", "Setembro", "Outubro", "Novembro", "Dezembro"
13726				],
13727				dayOfWeekShort: [
13728					"Dom", "Seg", "Ter", "Qua", "Qui", "Sex", "Sab"
13729				],
13730				dayOfWeek: ["Domingo", "Segunda", "Terça", "Quarta", "Quinta", "Sexta", "Sábado"]
13731			},
13732			ch: { // Simplified Chinese
13733				months: [
13734					"一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"
13735				],
13736				dayOfWeekShort: [
13737					"日", "一", "二", "三", "四", "五", "六"
13738				]
13739			},
13740			se: { // Swedish
13741				months: [
13742					"Januari", "Februari", "Mars", "April", "Maj", "Juni", "Juli", "Augusti", "September",  "Oktober", "November", "December"
13743				],
13744				dayOfWeekShort: [
13745					"Sön", "Mån", "Tis", "Ons", "Tor", "Fre", "Lör"
13746				]
13747			},
13748			km: { // Khmer (ភាសាខ្មែរ)
13749				months: [
13750					"មករា​", "កុម្ភៈ", "មិនា​", "មេសា​", "ឧសភា​", "មិថុនា​", "កក្កដា​", "សីហា​", "កញ្ញា​", "តុលា​", "វិច្ឆិកា", "ធ្នូ​"
13751				],
13752				dayOfWeekShort: ["អាទិ​", "ច័ន្ទ​", "អង្គារ​", "ពុធ​", "ព្រហ​​", "សុក្រ​", "សៅរ៍"],
13753				dayOfWeek: ["អាទិត្យ​", "ច័ន្ទ​", "អង្គារ​", "ពុធ​", "ព្រហស្បតិ៍​", "សុក្រ​", "សៅរ៍"]
13754			},
13755			kr: { // Korean
13756				months: [
13757					"1월", "2월", "3월", "4월", "5월", "6월", "7월", "8월", "9월", "10월", "11월", "12월"
13758				],
13759				dayOfWeekShort: [
13760					"일", "월", "화", "수", "목", "금", "토"
13761				],
13762				dayOfWeek: ["일요일", "월요일", "화요일", "수요일", "목요일", "금요일", "토요일"]
13763			},
13764			it: { // Italian
13765				months: [
13766					"Gennaio", "Febbraio", "Marzo", "Aprile", "Maggio", "Giugno", "Luglio", "Agosto", "Settembre", "Ottobre", "Novembre", "Dicembre"
13767				],
13768				dayOfWeekShort: [
13769					"Dom", "Lun", "Mar", "Mer", "Gio", "Ven", "Sab"
13770				],
13771				dayOfWeek: ["Domenica", "Lunedì", "Martedì", "Mercoledì", "Giovedì", "Venerdì", "Sabato"]
13772			},
13773			da: { // Dansk
13774				months: [
13775					"Januar", "Februar", "Marts", "April", "Maj", "Juni", "Juli", "August", "September", "Oktober", "November", "December"
13776				],
13777				dayOfWeekShort: [
13778					"Søn", "Man", "Tir", "Ons", "Tor", "Fre", "Lør"
13779				],
13780				dayOfWeek: ["søndag", "mandag", "tirsdag", "onsdag", "torsdag", "fredag", "lørdag"]
13781			},
13782			no: { // Norwegian
13783				months: [
13784					"Januar", "Februar", "Mars", "April", "Mai", "Juni", "Juli", "August", "September", "Oktober", "November", "Desember"
13785				],
13786				dayOfWeekShort: [
13787					"Søn", "Man", "Tir", "Ons", "Tor", "Fre", "Lør"
13788				],
13789				dayOfWeek: ['Søndag', 'Mandag', 'Tirsdag', 'Onsdag', 'Torsdag', 'Fredag', 'Lørdag']
13790			},
13791			ja: { // Japanese
13792				months: [
13793					"1月", "2月", "3月", "4月", "5月", "6月", "7月", "8月", "9月", "10月", "11月", "12月"
13794				],
13795				dayOfWeekShort: [
13796					"日", "月", "火", "水", "木", "金", "土"
13797				],
13798				dayOfWeek: ["日曜", "月曜", "火曜", "水曜", "木曜", "金曜", "土曜"]
13799			},
13800			vi: { // Vietnamese
13801				months: [
13802					"Tháng 1", "Tháng 2", "Tháng 3", "Tháng 4", "Tháng 5", "Tháng 6", "Tháng 7", "Tháng 8", "Tháng 9", "Tháng 10", "Tháng 11", "Tháng 12"
13803				],
13804				dayOfWeekShort: [
13805					"CN", "T2", "T3", "T4", "T5", "T6", "T7"
13806				],
13807				dayOfWeek: ["Chủ nhật", "Thứ hai", "Thứ ba", "Thứ tư", "Thứ năm", "Thứ sáu", "Thứ bảy"]
13808			},
13809			sl: { // Slovenščina
13810				months: [
13811					"Januar", "Februar", "Marec", "April", "Maj", "Junij", "Julij", "Avgust", "September", "Oktober", "November", "December"
13812				],
13813				dayOfWeekShort: [
13814					"Ned", "Pon", "Tor", "Sre", "Čet", "Pet", "Sob"
13815				],
13816				dayOfWeek: ["Nedelja", "Ponedeljek", "Torek", "Sreda", "Četrtek", "Petek", "Sobota"]
13817			},
13818			cs: { // Čeština
13819				months: [
13820					"Leden", "Únor", "Březen", "Duben", "Květen", "Červen", "Červenec", "Srpen", "Září", "Říjen", "Listopad", "Prosinec"
13821				],
13822				dayOfWeekShort: [
13823					"Ne", "Po", "Út", "St", "Čt", "Pá", "So"
13824				]
13825			},
13826			hu: { // Hungarian
13827				months: [
13828					"Január", "Február", "Március", "Április", "Május", "Június", "Július", "Augusztus", "Szeptember", "Október", "November", "December"
13829				],
13830				dayOfWeekShort: [
13831					"Va", "Hé", "Ke", "Sze", "Cs", "Pé", "Szo"
13832				],
13833				dayOfWeek: ["vasárnap", "hétfő", "kedd", "szerda", "csütörtök", "péntek", "szombat"]
13834			},
13835			az: { //Azerbaijanian (Azeri)
13836				months: [
13837					"Yanvar", "Fevral", "Mart", "Aprel", "May", "Iyun", "Iyul", "Avqust", "Sentyabr", "Oktyabr", "Noyabr", "Dekabr"
13838				],
13839				dayOfWeekShort: [
13840					"B", "Be", "Ça", "Ç", "Ca", "C", "Ş"
13841				],
13842				dayOfWeek: ["Bazar", "Bazar ertəsi", "Çərşənbə axşamı", "Çərşənbə", "Cümə axşamı", "Cümə", "Şənbə"]
13843			},
13844			bs: { //Bosanski
13845				months: [
13846					"Januar", "Februar", "Mart", "April", "Maj", "Jun", "Jul", "Avgust", "Septembar", "Oktobar", "Novembar", "Decembar"
13847				],
13848				dayOfWeekShort: [
13849					"Ned", "Pon", "Uto", "Sri", "Čet", "Pet", "Sub"
13850				],
13851				dayOfWeek: ["Nedjelja","Ponedjeljak", "Utorak", "Srijeda", "Četvrtak", "Petak", "Subota"]
13852			},
13853			ca: { //Català
13854				months: [
13855					"Gener", "Febrer", "Març", "Abril", "Maig", "Juny", "Juliol", "Agost", "Setembre", "Octubre", "Novembre", "Desembre"
13856				],
13857				dayOfWeekShort: [
13858					"Dg", "Dl", "Dt", "Dc", "Dj", "Dv", "Ds"
13859				],
13860				dayOfWeek: ["Diumenge", "Dilluns", "Dimarts", "Dimecres", "Dijous", "Divendres", "Dissabte"]
13861			},
13862			'en-GB': { //English (British)
13863				months: [
13864					"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"
13865				],
13866				dayOfWeekShort: [
13867					"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"
13868				],
13869				dayOfWeek: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]
13870			},
13871			et: { //"Eesti"
13872				months: [
13873					"Jaanuar", "Veebruar", "Märts", "Aprill", "Mai", "Juuni", "Juuli", "August", "September", "Oktoober", "November", "Detsember"
13874				],
13875				dayOfWeekShort: [
13876					"P", "E", "T", "K", "N", "R", "L"
13877				],
13878				dayOfWeek: ["Pühapäev", "Esmaspäev", "Teisipäev", "Kolmapäev", "Neljapäev", "Reede", "Laupäev"]
13879			},
13880			eu: { //Euskara
13881				months: [
13882					"Urtarrila", "Otsaila", "Martxoa", "Apirila", "Maiatza", "Ekaina", "Uztaila", "Abuztua", "Iraila", "Urria", "Azaroa", "Abendua"
13883				],
13884				dayOfWeekShort: [
13885					"Ig.", "Al.", "Ar.", "Az.", "Og.", "Or.", "La."
13886				],
13887				dayOfWeek: ['Igandea', 'Astelehena', 'Asteartea', 'Asteazkena', 'Osteguna', 'Ostirala', 'Larunbata']
13888			},
13889			fi: { //Finnish (Suomi)
13890				months: [
13891					"Tammikuu", "Helmikuu", "Maaliskuu", "Huhtikuu", "Toukokuu", "Kesäkuu", "Heinäkuu", "Elokuu", "Syyskuu", "Lokakuu", "Marraskuu", "Joulukuu"
13892				],
13893				dayOfWeekShort: [
13894					"Su", "Ma", "Ti", "Ke", "To", "Pe", "La"
13895				],
13896				dayOfWeek: ["sunnuntai", "maanantai", "tiistai", "keskiviikko", "torstai", "perjantai", "lauantai"]
13897			},
13898			gl: { //Galego
13899				months: [
13900					"Xan", "Feb", "Maz", "Abr", "Mai", "Xun", "Xul", "Ago", "Set", "Out", "Nov", "Dec"
13901				],
13902				dayOfWeekShort: [
13903					"Dom", "Lun", "Mar", "Mer", "Xov", "Ven", "Sab"
13904				],
13905				dayOfWeek: ["Domingo", "Luns", "Martes", "Mércores", "Xoves", "Venres", "Sábado"]
13906			},
13907			hr: { //Hrvatski
13908				months: [
13909					"Siječanj", "Veljača", "Ožujak", "Travanj", "Svibanj", "Lipanj", "Srpanj", "Kolovoz", "Rujan", "Listopad", "Studeni", "Prosinac"
13910				],
13911				dayOfWeekShort: [
13912					"Ned", "Pon", "Uto", "Sri", "Čet", "Pet", "Sub"
13913				],
13914				dayOfWeek: ["Nedjelja", "Ponedjeljak", "Utorak", "Srijeda", "Četvrtak", "Petak", "Subota"]
13915			},
13916			ko: { //Korean (한국어)
13917				months: [
13918					"1월", "2월", "3월", "4월", "5월", "6월", "7월", "8월", "9월", "10월", "11월", "12월"
13919				],
13920				dayOfWeekShort: [
13921					"일", "월", "화", "수", "목", "금", "토"
13922				],
13923				dayOfWeek: ["일요일", "월요일", "화요일", "수요일", "목요일", "금요일", "토요일"]
13924			},
13925			lt: { //Lithuanian (lietuvių)
13926				months: [
13927					"Sausio", "Vasario", "Kovo", "Balandžio", "Gegužės", "Birželio", "Liepos", "Rugpjūčio", "Rugsėjo", "Spalio", "Lapkričio", "Gruodžio"
13928				],
13929				dayOfWeekShort: [
13930					"Sek", "Pir", "Ant", "Tre", "Ket", "Pen", "Šeš"
13931				],
13932				dayOfWeek: ["Sekmadienis", "Pirmadienis", "Antradienis", "Trečiadienis", "Ketvirtadienis", "Penktadienis", "Šeštadienis"]
13933			},
13934			lv: { //Latvian (Latviešu)
13935				months: [
13936					"Janvāris", "Februāris", "Marts", "Aprīlis ", "Maijs", "Jūnijs", "Jūlijs", "Augusts", "Septembris", "Oktobris", "Novembris", "Decembris"
13937				],
13938				dayOfWeekShort: [
13939					"Sv", "Pr", "Ot", "Tr", "Ct", "Pk", "St"
13940				],
13941				dayOfWeek: ["Svētdiena", "Pirmdiena", "Otrdiena", "Trešdiena", "Ceturtdiena", "Piektdiena", "Sestdiena"]
13942			},
13943			mk: { //Macedonian (Македонски)
13944				months: [
13945					"јануари", "февруари", "март", "април", "мај", "јуни", "јули", "август", "септември", "октомври", "ноември", "декември"
13946				],
13947				dayOfWeekShort: [
13948					"нед", "пон", "вто", "сре", "чет", "пет", "саб"
13949				],
13950				dayOfWeek: ["Недела", "Понеделник", "Вторник", "Среда", "Четврток", "Петок", "Сабота"]
13951			},
13952			mn: { //Mongolian (Монгол)
13953				months: [
13954					"1-р сар", "2-р сар", "3-р сар", "4-р сар", "5-р сар", "6-р сар", "7-р сар", "8-р сар", "9-р сар", "10-р сар", "11-р сар", "12-р сар"
13955				],
13956				dayOfWeekShort: [
13957					"Дав", "Мяг", "Лха", "Пүр", "Бсн", "Бям", "Ням"
13958				],
13959				dayOfWeek: ["Даваа", "Мягмар", "Лхагва", "Пүрэв", "Баасан", "Бямба", "Ням"]
13960			},
13961			'pt-BR': { //Português(Brasil)
13962				months: [
13963					"Janeiro", "Fevereiro", "Março", "Abril", "Maio", "Junho", "Julho", "Agosto", "Setembro", "Outubro", "Novembro", "Dezembro"
13964				],
13965				dayOfWeekShort: [
13966					"Dom", "Seg", "Ter", "Qua", "Qui", "Sex", "Sáb"
13967				],
13968				dayOfWeek: ["Domingo", "Segunda", "Terça", "Quarta", "Quinta", "Sexta", "Sábado"]
13969			},
13970			sk: { //Slovenčina
13971				months: [
13972					"Január", "Február", "Marec", "Apríl", "Máj", "Jún", "Júl", "August", "September", "Október", "November", "December"
13973				],
13974				dayOfWeekShort: [
13975					"Ne", "Po", "Ut", "St", "Å t", "Pi", "So"
13976				],
13977				dayOfWeek: ["Nedeľa", "Pondelok", "Utorok", "Streda", "Štvrtok", "Piatok", "Sobota"]
13978			},
13979			sq: { //Albanian (Shqip)
13980				months: [
13981					"Janar", "Shkurt", "Mars", "Prill", "Maj", "Qershor", "Korrik", "Gusht", "Shtator", "Tetor", "Nëntor", "Dhjetor"
13982				],
13983				dayOfWeekShort: [
13984					"Die", "Hën", "Mar", "Mër", "Enj", "Pre", "Shtu"
13985				],
13986				dayOfWeek: ["E Diel", "E Hënë", "E Martē", "E Mërkurë", "E Enjte", "E Premte", "E Shtunë"]
13987			},
13988			'sr-YU': { //Serbian (Srpski)
13989				months: [
13990					"Januar", "Februar", "Mart", "April", "Maj", "Jun", "Jul", "Avgust", "Septembar", "Oktobar", "Novembar", "Decembar"
13991				],
13992				dayOfWeekShort: [
13993					"Ned", "Pon", "Uto", "Sre", "čet", "Pet", "Sub"
13994				],
13995				dayOfWeek: ["Nedelja","Ponedeljak", "Utorak", "Sreda", "Četvrtak", "Petak", "Subota"]
13996			},
13997			sr: { //Serbian Cyrillic (Српски)
13998				months: [
13999					"јануар", "фебруар", "март", "април", "мај", "јун", "јул", "август", "септембар", "октобар", "новембар", "децембар"
14000				],
14001				dayOfWeekShort: [
14002					"нед", "пон", "уто", "сре", "чет", "пет", "суб"
14003				],
14004				dayOfWeek: ["Недеља","Понедељак", "Уторак", "Среда", "Четвртак", "Петак", "Субота"]
14005			},
14006			sv: { //Svenska
14007				months: [
14008					"Januari", "Februari", "Mars", "April", "Maj", "Juni", "Juli", "Augusti", "September", "Oktober", "November", "December"
14009				],
14010				dayOfWeekShort: [
14011					"Sön", "Mån", "Tis", "Ons", "Tor", "Fre", "Lör"
14012				],
14013				dayOfWeek: ["Söndag", "Måndag", "Tisdag", "Onsdag", "Torsdag", "Fredag", "Lördag"]
14014			},
14015			'zh-TW': { //Traditional Chinese (繁體中文)
14016				months: [
14017					"一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"
14018				],
14019				dayOfWeekShort: [
14020					"日", "一", "二", "三", "四", "五", "六"
14021				],
14022				dayOfWeek: ["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"]
14023			},
14024			zh: { //Simplified Chinese (简体中文)
14025				months: [
14026					"一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"
14027				],
14028				dayOfWeekShort: [
14029					"日", "一", "二", "三", "四", "五", "六"
14030				],
14031				dayOfWeek: ["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"]
14032			},
14033			ug:{ // Uyghur(ئۇيغۇرچە)
14034				months: [
14035					"1-ئاي","2-ئاي","3-ئاي","4-ئاي","5-ئاي","6-ئاي","7-ئاي","8-ئاي","9-ئاي","10-ئاي","11-ئاي","12-ئاي"
14036				],
14037				dayOfWeek: [
14038					"يەكشەنبە", "دۈشەنبە","سەيشەنبە","چارشەنبە","پەيشەنبە","جۈمە","شەنبە"
14039				]
14040			},
14041			he: { //Hebrew (עברית)
14042				months: [
14043					'ינואר', 'פברואר', 'מרץ', 'אפריל', 'מאי', 'יוני', 'יולי', 'אוגוסט', 'ספטמבר', 'אוקטובר', 'נובמבר', 'דצמבר'
14044				],
14045				dayOfWeekShort: [
14046					'א\'', 'ב\'', 'ג\'', 'ד\'', 'ה\'', 'ו\'', 'שבת'
14047				],
14048				dayOfWeek: ["ראשון", "שני", "שלישי", "רביעי", "חמישי", "שישי", "שבת", "ראשון"]
14049			},
14050			hy: { // Armenian
14051				months: [
14052					"Հունվար", "Փետրվար", "Մարտ", "Ապրիլ", "Մայիս", "Հունիս", "Հուլիս", "Օգոստոս", "Սեպտեմբեր", "Հոկտեմբեր", "Նոյեմբեր", "Դեկտեմբեր"
14053				],
14054				dayOfWeekShort: [
14055					"Կի", "Երկ", "Երք", "Չոր", "Հնգ", "Ուրբ", "Շբթ"
14056				],
14057				dayOfWeek: ["Կիրակի", "Երկուշաբթի", "Երեքշաբթի", "Չորեքշաբթի", "Հինգշաբթի", "Ուրբաթ", "Շաբաթ"]
14058			},
14059			kg: { // Kyrgyz
14060				months: [
14061					'Үчтүн айы', 'Бирдин айы', 'Жалган Куран', 'Чын Куран', 'Бугу', 'Кулжа', 'Теке', 'Баш Оона', 'Аяк Оона', 'Тогуздун айы', 'Жетинин айы', 'Бештин айы'
14062				],
14063				dayOfWeekShort: [
14064					"Жек", "Дүй", "Шей", "Шар", "Бей", "Жум", "Ише"
14065				],
14066				dayOfWeek: [
14067					"Жекшемб", "Дүйшөмб", "Шейшемб", "Шаршемб", "Бейшемби", "Жума", "Ишенб"
14068				]
14069			},
vendor: 48,905 bytes, lines 14070-15502
14070			rm: { // Romansh
14071				months: [
14072					"Schaner", "Favrer", "Mars", "Avrigl", "Matg", "Zercladur", "Fanadur", "Avust", "Settember", "October", "November", "December"
14073				],
14074				dayOfWeekShort: [
14075					"Du", "Gli", "Ma", "Me", "Gie", "Ve", "So"
14076				],
14077				dayOfWeek: [
14078					"Dumengia", "Glindesdi", "Mardi", "Mesemna", "Gievgia", "Venderdi", "Sonda"
14079				]
14080			},
14081			ka: { // Georgian
14082				months: [
14083					'იანვარი', 'თებერვალი', 'მარტი', 'აპრილი', 'მაისი', 'ივნისი', 'ივლისი', 'აგვისტო', 'სექტემბერი', 'ოქტომბერი', 'ნოემბერი', 'დეკემბერი'
14084				],
14085				dayOfWeekShort: [
14086					"კვ", "ორშ", "სამშ", "ოთხ", "ხუთ", "პარ", "შაბ"
14087				],
14088				dayOfWeek: ["კვირა", "ორშაბათი", "სამშაბათი", "ოთხშაბათი", "ხუთშაბათი", "პარასკევი", "შაბათი"]
14089			}
14090		},
14091
14092		ownerDocument: document,
14093		contentWindow: window,
14094
14095		value: '',
14096		rtl: false,
14097
14098		format:	'Y/m/d H:i',
14099		formatTime:	'H:i',
14100		formatDate:	'Y/m/d',
14101
14102		startDate:	false, // new Date(), '1986/12/08', '-1970/01/05','-1970/01/05',
14103		step: 60,
14104		monthChangeSpinner: true,
14105
14106		closeOnDateSelect: false,
14107		closeOnTimeSelect: true,
14108		closeOnWithoutClick: true,
14109		closeOnInputClick: true,
14110		openOnFocus: true,
14111
14112		timepicker: true,
14113		datepicker: true,
14114		weeks: false,
14115
14116		defaultTime: false,	// use formatTime format (ex. '10:00' for formatTime:	'H:i')
14117		defaultDate: false,	// use formatDate format (ex new Date() or '1986/12/08' or '-1970/01/05' or '-1970/01/05')
14118
14119		minDate: false,
14120		maxDate: false,
14121		minTime: false,
14122		maxTime: false,
14123		minDateTime: false,
14124		maxDateTime: false,
14125
14126		allowTimes: [],
14127		opened: false,
14128		initTime: true,
14129		inline: false,
14130		theme: '',
14131		touchMovedThreshold: 5,
14132
14133		onSelectDate: function () {},
14134		onSelectTime: function () {},
14135		onChangeMonth: function () {},
14136		onGetWeekOfYear: function () {},
14137		onChangeYear: function () {},
14138		onChangeDateTime: function () {},
14139		onShow: function () {},
14140		onClose: function () {},
14141		onGenerate: function () {},
14142
14143		withoutCopyright: true,
14144		inverseButton: false,
14145		hours12: false,
14146		next: 'xdsoft_next',
14147		prev : 'xdsoft_prev',
14148		dayOfWeekStart: 0,
14149		parentID: 'body',
14150		timeHeightInTimePicker: 25,
14151		timepickerScrollbar: true,
14152		todayButton: true,
14153		prevButton: true,
14154		nextButton: true,
14155		defaultSelect: true,
14156
14157		scrollMonth: true,
14158		scrollTime: true,
14159		scrollInput: true,
14160
14161		lazyInit: false,
14162		mask: false,
14163		validateOnBlur: true,
14164		allowBlank: true,
14165		yearStart: 1950,
14166		yearEnd: 2050,
14167		monthStart: 0,
14168		monthEnd: 11,
14169		style: '',
14170		id: '',
14171		fixed: false,
14172		roundTime: 'round', // ceil, floor
14173		className: '',
14174		weekends: [],
14175		highlightedDates: [],
14176		highlightedPeriods: [],
14177		allowDates : [],
14178		allowDateRe : null,
14179		disabledDates : [],
14180		disabledWeekDays: [],
14181		yearOffset: 0,
14182		beforeShowDay: null,
14183
14184		enterLikeTab: true,
14185        showApplyButton: false,
14186        insideParent: false,
14187	};
14188
14189	var dateHelper = null,
14190		defaultDateHelper = null,
14191		globalLocaleDefault = 'en',
14192		globalLocale = 'en';
14193
14194	var dateFormatterOptionsDefault = {
14195		meridiem: ['AM', 'PM']
14196	};
14197
14198	var initDateFormatter = function(){
14199		var locale = default_options.i18n[globalLocale],
14200			opts = {
14201				days: locale.dayOfWeek,
14202				daysShort: locale.dayOfWeekShort,
14203				months: locale.months,
14204				monthsShort: $.map(locale.months, function(n){ return n.substring(0, 3) })
14205			};
14206
14207		if (typeof DateFormatter === 'function') {
14208			dateHelper = defaultDateHelper = new DateFormatter({
14209				dateSettings: $.extend({}, dateFormatterOptionsDefault, opts)
14210			});
14211		}
14212	};
14213
14214	var dateFormatters = {
14215		moment: {
14216			default_options:{
14217				format: 'YYYY/MM/DD HH:mm',
14218				formatDate: 'YYYY/MM/DD',
14219				formatTime: 'HH:mm',
14220			},
14221			formatter: {
14222				parseDate: function (date, format) {
14223					if(isFormatStandard(format)){
14224						return defaultDateHelper.parseDate(date, format);
14225					} 
14226					var d = moment(date, format);
14227					return d.isValid() ? d.toDate() : false;
14228				},
14229
14230				formatDate: function (date, format) {
14231					if(isFormatStandard(format)){
14232						return defaultDateHelper.formatDate(date, format);
14233					} 
14234					return moment(date).format(format);
14235				},
14236
14237				formatMask: function(format){
14238					return format
14239						.replace(/Y{4}/g, '9999')
14240						.replace(/Y{2}/g, '99')
14241						.replace(/M{2}/g, '19')
14242						.replace(/D{2}/g, '39')
14243						.replace(/H{2}/g, '29')
14244						.replace(/m{2}/g, '59')
14245						.replace(/s{2}/g, '59');
14246				},
14247			}
14248		}
14249	}
14250
14251	// for locale settings
14252	$.datetimepicker = {
14253		setLocale: function(locale){
14254			var newLocale = default_options.i18n[locale] ? locale : globalLocaleDefault;
14255			if (globalLocale !== newLocale) {
14256				globalLocale = newLocale;
14257				// reinit date formatter
14258				initDateFormatter();
14259			}
14260		},
14261
14262		setDateFormatter: function(dateFormatter) {
14263			if(typeof dateFormatter === 'string' && dateFormatters.hasOwnProperty(dateFormatter)){
14264				var df = dateFormatters[dateFormatter];
14265				$.extend(default_options, df.default_options);
14266				dateHelper = df.formatter; 
14267			}
14268			else {
14269				dateHelper = dateFormatter;
14270			}
14271		},
14272	};
14273
14274	var standardFormats = {
14275		RFC_2822: 'D, d M Y H:i:s O',
14276		ATOM: 'Y-m-d\TH:i:sP',
14277		ISO_8601: 'Y-m-d\TH:i:sO',
14278		RFC_822: 'D, d M y H:i:s O',
14279		RFC_850: 'l, d-M-y H:i:s T',
14280		RFC_1036: 'D, d M y H:i:s O',
14281		RFC_1123: 'D, d M Y H:i:s O',
14282		RSS: 'D, d M Y H:i:s O',
14283		W3C: 'Y-m-d\TH:i:sP'
14284	}
14285
14286	var isFormatStandard = function(format){
14287		return Object.values(standardFormats).indexOf(format) === -1 ? false : true;
14288	}
14289
14290	$.extend($.datetimepicker, standardFormats);
14291
14292	// first init date formatter
14293	initDateFormatter();
14294
14295	// fix for ie8
14296	if (!window.getComputedStyle) {
14297		window.getComputedStyle = function (el) {
14298			this.el = el;
14299			this.getPropertyValue = function (prop) {
14300				var re = /(-([a-z]))/g;
14301				if (prop === 'float') {
14302					prop = 'styleFloat';
14303				}
14304				if (re.test(prop)) {
14305					prop = prop.replace(re, function (a, b, c) {
14306						return c.toUpperCase();
14307					});
14308				}
14309				return el.currentStyle[prop] || null;
14310			};
14311			return this;
14312		};
14313	}
14314	if (!Array.prototype.indexOf) {
14315		Array.prototype.indexOf = function (obj, start) {
14316			var i, j;
14317			for (i = (start || 0), j = this.length; i < j; i += 1) {
14318				if (this[i] === obj) { return i; }
14319			}
14320			return -1;
14321		};
14322	}
14323
14324	Date.prototype.countDaysInMonth = function () {
14325		return new Date(this.getFullYear(), this.getMonth() + 1, 0).getDate();
14326	};
14327
14328	$.fn.xdsoftScroller = function (options, percent) {
14329		return this.each(function () {
14330			var timeboxparent = $(this),
14331				pointerEventToXY = function (e) {
14332					var out = {x: 0, y: 0},
14333						touch;
14334					if (e.type === 'touchstart' || e.type === 'touchmove' || e.type === 'touchend' || e.type === 'touchcancel') {
14335						touch  = e.originalEvent.touches[0] || e.originalEvent.changedTouches[0];
14336						out.x = touch.clientX;
14337						out.y = touch.clientY;
14338					} else if (e.type === 'mousedown' || e.type === 'mouseup' || e.type === 'mousemove' || e.type === 'mouseover' || e.type === 'mouseout' || e.type === 'mouseenter' || e.type === 'mouseleave') {
14339						out.x = e.clientX;
14340						out.y = e.clientY;
14341					}
14342					return out;
14343				},
14344				timebox,
14345				parentHeight,
14346				height,
14347				scrollbar,
14348				scroller,
14349				maximumOffset = 100,
14350				start = false,
14351				startY = 0,
14352				startTop = 0,
14353				h1 = 0,
14354				touchStart = false,
14355				startTopScroll = 0,
14356				calcOffset = function () {};
14357
14358			if (percent === 'hide') {
14359				timeboxparent.find('.xdsoft_scrollbar').hide();
14360				return;
14361			}
14362
14363			if (!$(this).hasClass('xdsoft_scroller_box')) {
14364				timebox = timeboxparent.children().eq(0);
14365				parentHeight = timeboxparent[0].clientHeight;
14366				height = timebox[0].offsetHeight;
14367				scrollbar = $('<div class="xdsoft_scrollbar"></div>');
14368				scroller = $('<div class="xdsoft_scroller"></div>');
14369				scrollbar.append(scroller);
14370
14371				timeboxparent.addClass('xdsoft_scroller_box').append(scrollbar);
14372				calcOffset = function calcOffset(event) {
14373					var offset = pointerEventToXY(event).y - startY + startTopScroll;
14374					if (offset < 0) {
14375						offset = 0;
14376					}
14377					if (offset + scroller[0].offsetHeight > h1) {
14378						offset = h1 - scroller[0].offsetHeight;
14379					}
14380					timeboxparent.trigger('scroll_element.xdsoft_scroller', [maximumOffset ? offset / maximumOffset : 0]);
14381				};
14382
14383				scroller
14384					.on('touchstart.xdsoft_scroller mousedown.xdsoft_scroller', function (event) {
14385						if (!parentHeight) {
14386							timeboxparent.trigger('resize_scroll.xdsoft_scroller', [percent]);
14387						}
14388
14389						startY = pointerEventToXY(event).y;
14390						startTopScroll = parseInt(scroller.css('margin-top'), 10);
14391						h1 = scrollbar[0].offsetHeight;
14392
14393						if (event.type === 'mousedown' || event.type === 'touchstart') {
14394							if (options.ownerDocument) {
14395								$(options.ownerDocument.body).addClass('xdsoft_noselect');
14396							}
14397							$([options.ownerDocument.body, options.contentWindow]).on('touchend mouseup.xdsoft_scroller', function arguments_callee() {
14398								$([options.ownerDocument.body, options.contentWindow]).off('touchend mouseup.xdsoft_scroller', arguments_callee)
14399									.off('mousemove.xdsoft_scroller', calcOffset)
14400									.removeClass('xdsoft_noselect');
14401							});
14402							$(options.ownerDocument.body).on('mousemove.xdsoft_scroller', calcOffset);
14403						} else {
14404							touchStart = true;
14405							event.stopPropagation();
14406							event.preventDefault();
14407						}
14408					})
14409					.on('touchmove', function (event) {
14410						if (touchStart) {
14411							event.preventDefault();
14412							calcOffset(event);
14413						}
14414					})
14415					.on('touchend touchcancel', function () {
14416						touchStart =  false;
14417						startTopScroll = 0;
14418					});
14419
14420				timeboxparent
14421					.on('scroll_element.xdsoft_scroller', function (event, percentage) {
14422						if (!parentHeight) {
14423							timeboxparent.trigger('resize_scroll.xdsoft_scroller', [percentage, true]);
14424						}
14425						percentage = percentage > 1 ? 1 : (percentage < 0 || isNaN(percentage)) ? 0 : percentage;
14426
14427						scroller.css('margin-top', maximumOffset * percentage);
14428
14429						setTimeout(function () {
14430							timebox.css('marginTop', -parseInt((timebox[0].offsetHeight - parentHeight) * percentage, 10));
14431						}, 10);
14432					})
14433					.on('resize_scroll.xdsoft_scroller', function (event, percentage, noTriggerScroll) {
14434						var percent, sh;
14435						parentHeight = timeboxparent[0].clientHeight;
14436						height = timebox[0].offsetHeight;
14437						percent = parentHeight / height;
14438						sh = percent * scrollbar[0].offsetHeight;
14439						if (percent > 1) {
14440							scroller.hide();
14441						} else {
14442							scroller.show();
14443							scroller.css('height', parseInt(sh > 10 ? sh : 10, 10));
14444							maximumOffset = scrollbar[0].offsetHeight - scroller[0].offsetHeight;
14445							if (noTriggerScroll !== true) {
14446								timeboxparent.trigger('scroll_element.xdsoft_scroller', [percentage || Math.abs(parseInt(timebox.css('marginTop'), 10)) / (height - parentHeight)]);
14447							}
14448						}
14449					});
14450
14451				timeboxparent.on('mousewheel', function (event) {
14452					var top = Math.abs(parseInt(timebox.css('marginTop'), 10));
14453
14454					top = top - (event.deltaY * 20);
14455					if (top < 0) {
14456						top = 0;
14457					}
14458
14459					timeboxparent.trigger('scroll_element.xdsoft_scroller', [top / (height - parentHeight)]);
14460					event.stopPropagation();
14461					return false;
14462				});
14463
14464				timeboxparent.on('touchstart', function (event) {
14465					start = pointerEventToXY(event);
14466					startTop = Math.abs(parseInt(timebox.css('marginTop'), 10));
14467				});
14468
14469				timeboxparent.on('touchmove', function (event) {
14470					if (start) {
14471						event.preventDefault();
14472						var coord = pointerEventToXY(event);
14473						timeboxparent.trigger('scroll_element.xdsoft_scroller', [(startTop - (coord.y - start.y)) / (height - parentHeight)]);
14474					}
14475				});
14476
14477				timeboxparent.on('touchend touchcancel', function () {
14478					start = false;
14479					startTop = 0;
14480				});
14481			}
14482			timeboxparent.trigger('resize_scroll.xdsoft_scroller', [percent]);
14483		});
14484	};
14485
14486	$.fn.datetimepicker = function (opt, opt2) {
14487		var result = this,
14488			KEY0 = 48,
14489			KEY9 = 57,
14490			_KEY0 = 96,
14491			_KEY9 = 105,
14492            CTRLKEY = 17,
14493            CMDKEY = 91,
14494			DEL = 46,
14495			ENTER = 13,
14496			ESC = 27,
14497			BACKSPACE = 8,
14498			ARROWLEFT = 37,
14499			ARROWUP = 38,
14500			ARROWRIGHT = 39,
14501			ARROWDOWN = 40,
14502			TAB = 9,
14503			F5 = 116,
14504			AKEY = 65,
14505			CKEY = 67,
14506			VKEY = 86,
14507			ZKEY = 90,
14508			YKEY = 89,
14509            ctrlDown	=	false,
14510            cmdDown = false,
14511			options = ($.isPlainObject(opt) || !opt) ? $.extend(true, {}, default_options, opt) : $.extend(true, {}, default_options),
14512
14513			lazyInitTimer = 0,
14514			createDateTimePicker,
14515			destroyDateTimePicker,
14516
14517			lazyInit = function (input) {
14518				input
14519					.on('open.xdsoft focusin.xdsoft mousedown.xdsoft touchstart', function initOnActionCallback() {
14520						if (input.is(':disabled') || input.data('xdsoft_datetimepicker')) {
14521							return;
14522						}
14523						clearTimeout(lazyInitTimer);
14524						lazyInitTimer = setTimeout(function () {
14525
14526							if (!input.data('xdsoft_datetimepicker')) {
14527								createDateTimePicker(input);
14528							}
14529							input
14530								.off('open.xdsoft focusin.xdsoft mousedown.xdsoft touchstart', initOnActionCallback)
14531								.trigger('open.xdsoft');
14532						}, 100);
14533					});
14534			};
14535
14536		createDateTimePicker = function (input) {
14537			var datetimepicker = $('<div class="xdsoft_datetimepicker xdsoft_noselect"></div>'),
14538				xdsoft_copyright = $('<div class="xdsoft_copyright"><a target="_blank" href="http://xdsoft.net/jqplugins/datetimepicker/">xdsoft.net</a></div>'),
14539				datepicker = $('<div class="xdsoft_datepicker active"></div>'),
14540				month_picker = $('<div class="xdsoft_monthpicker"><button type="button" class="xdsoft_prev"></button><button type="button" class="xdsoft_today_button"></button>' +
14541					'<div class="xdsoft_label xdsoft_month"><span></span><i></i></div>' +
14542					'<div class="xdsoft_label xdsoft_year"><span></span><i></i></div>' +
14543					'<button type="button" class="xdsoft_next"></button></div>'),
14544				calendar = $('<div class="xdsoft_calendar"></div>'),
14545				timepicker = $('<div class="xdsoft_timepicker active"><button type="button" class="xdsoft_prev"></button><div class="xdsoft_time_box"></div><button type="button" class="xdsoft_next"></button></div>'),
14546				timeboxparent = timepicker.find('.xdsoft_time_box').eq(0),
14547				timebox = $('<div class="xdsoft_time_variant"></div>'),
14548				applyButton = $('<button type="button" class="xdsoft_save_selected blue-gradient-button">Save Selected</button>'),
14549
14550				monthselect = $('<div class="xdsoft_select xdsoft_monthselect"><div></div></div>'),
14551				yearselect = $('<div class="xdsoft_select xdsoft_yearselect"><div></div></div>'),
14552				triggerAfterOpen = false,
14553				XDSoft_datetime,
14554
14555				xchangeTimer,
14556				timerclick,
14557				current_time_index,
14558				setPos,
14559				timer = 0,
14560				_xdsoft_datetime,
14561				forEachAncestorOf;
14562
14563			if (options.id) {
14564				datetimepicker.attr('id', options.id);
14565			}
14566			if (options.style) {
14567				datetimepicker.attr('style', options.style);
14568			}
14569			if (options.weeks) {
14570				datetimepicker.addClass('xdsoft_showweeks');
14571			}
14572			if (options.rtl) {
14573				datetimepicker.addClass('xdsoft_rtl');
14574			}
14575
14576			datetimepicker.addClass('xdsoft_' + options.theme);
14577			datetimepicker.addClass(options.className);
14578
14579			month_picker
14580				.find('.xdsoft_month span')
14581				.after(monthselect);
14582			month_picker
14583				.find('.xdsoft_year span')
14584				.after(yearselect);
14585
14586			month_picker
14587				.find('.xdsoft_month,.xdsoft_year')
14588				.on('touchstart mousedown.xdsoft', function (event) {
14589					var select = $(this).find('.xdsoft_select').eq(0),
14590						val = 0,
14591						top = 0,
14592						visible = select.is(':visible'),
14593						items,
14594						i;
14595
14596					month_picker
14597						.find('.xdsoft_select')
14598						.hide();
14599					if (_xdsoft_datetime.currentTime) {
14600						val = _xdsoft_datetime.currentTime[$(this).hasClass('xdsoft_month') ? 'getMonth' : 'getFullYear']();
14601					}
14602
14603					select[visible ? 'hide' : 'show']();
14604					for (items = select.find('div.xdsoft_option'), i = 0; i < items.length; i += 1) {
14605						if (items.eq(i).data('value') === val) {
14606							break;
14607						} else {
14608							top += items[0].offsetHeight;
14609						}
14610					}
14611
14612					select.xdsoftScroller(options, top / (select.children()[0].offsetHeight - (select[0].clientHeight)));
14613					event.stopPropagation();
14614					return false;
14615				});
14616
14617			var handleTouchMoved = function (event) {
14618				var evt = event.originalEvent;
14619				var touchPosition = evt.touches ? evt.touches[0] : evt;
14620				this.touchStartPosition = this.touchStartPosition || touchPosition;
14621				var xMovement = Math.abs(this.touchStartPosition.clientX - touchPosition.clientX);
14622				var yMovement = Math.abs(this.touchStartPosition.clientY - touchPosition.clientY);
14623				var distance = Math.sqrt(xMovement * xMovement + yMovement * yMovement);
14624				if(distance > options.touchMovedThreshold) {
14625					this.touchMoved = true;
14626				}
14627			}
14628
14629			month_picker
14630				.find('.xdsoft_select')
14631				.xdsoftScroller(options)
14632				.on('touchstart mousedown.xdsoft', function (event) {
14633					var evt = event.originalEvent;
14634					this.touchMoved = false;
14635					this.touchStartPosition = evt.touches ? evt.touches[0] : evt;
14636					event.stopPropagation();
14637					event.preventDefault();
14638				})
14639				.on('touchmove', '.xdsoft_option', handleTouchMoved)
14640				.on('touchend mousedown.xdsoft', '.xdsoft_option', function () {
14641					if (!this.touchMoved) {
14642						if (_xdsoft_datetime.currentTime === undefined || _xdsoft_datetime.currentTime === null) {
14643							_xdsoft_datetime.currentTime = _xdsoft_datetime.now();
14644						}
14645
14646						var year = _xdsoft_datetime.currentTime.getFullYear();
14647						if (_xdsoft_datetime && _xdsoft_datetime.currentTime) {
14648							_xdsoft_datetime.currentTime[$(this).parent().parent().hasClass('xdsoft_monthselect') ? 'setMonth' : 'setFullYear']($(this).data('value'));
14649						}
14650
14651						$(this).parent().parent().hide();
14652
14653						datetimepicker.trigger('xchange.xdsoft');
14654						if (options.onChangeMonth && $.isFunction(options.onChangeMonth)) {
14655							options.onChangeMonth.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input'));
14656						}
14657
14658						if (year !== _xdsoft_datetime.currentTime.getFullYear() && $.isFunction(options.onChangeYear)) {
14659							options.onChangeYear.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input'));
14660						}
14661					}
14662				});
14663
14664			datetimepicker.getValue = function () {
14665				return _xdsoft_datetime.getCurrentTime();
14666			};
14667
14668			datetimepicker.setOptions = function (_options) {
14669				var highlightedDates = {};
14670
14671				options = $.extend(true, {}, options, _options);
14672
14673				if (_options.allowTimes && $.isArray(_options.allowTimes) && _options.allowTimes.length) {
14674					options.allowTimes = $.extend(true, [], _options.allowTimes);
14675				}
14676
14677				if (_options.weekends && $.isArray(_options.weekends) && _options.weekends.length) {
14678					options.weekends = $.extend(true, [], _options.weekends);
14679				}
14680
14681				if (_options.allowDates && $.isArray(_options.allowDates) && _options.allowDates.length) {
14682					options.allowDates = $.extend(true, [], _options.allowDates);
14683				}
14684
14685				if (_options.allowDateRe && Object.prototype.toString.call(_options.allowDateRe)==="[object String]") {
14686					options.allowDateRe = new RegExp(_options.allowDateRe);
14687				}
14688
14689				if (_options.highlightedDates && $.isArray(_options.highlightedDates) && _options.highlightedDates.length) {
14690					$.each(_options.highlightedDates, function (index, value) {
14691						var splitData = $.map(value.split(','), $.trim),
14692							exDesc,
14693							hDate = new HighlightedDate(dateHelper.parseDate(splitData[0], options.formatDate), splitData[1], splitData[2]), // date, desc, style
14694							keyDate = dateHelper.formatDate(hDate.date, options.formatDate);
14695						if (highlightedDates[keyDate] !== undefined) {
14696							exDesc = highlightedDates[keyDate].desc;
14697							if (exDesc && exDesc.length && hDate.desc && hDate.desc.length) {
14698								highlightedDates[keyDate].desc = exDesc + "\n" + hDate.desc;
14699							}
14700						} else {
14701							highlightedDates[keyDate] = hDate;
14702						}
14703					});
14704
14705					options.highlightedDates = $.extend(true, [], highlightedDates);
14706				}
14707
14708				if (_options.highlightedPeriods && $.isArray(_options.highlightedPeriods) && _options.highlightedPeriods.length) {
14709					highlightedDates = $.extend(true, [], options.highlightedDates);
14710					$.each(_options.highlightedPeriods, function (index, value) {
14711						var dateTest, // start date
14712							dateEnd,
14713							desc,
14714							hDate,
14715							keyDate,
14716							exDesc,
14717							style;
14718						if ($.isArray(value)) {
14719							dateTest = value[0];
14720							dateEnd = value[1];
14721							desc = value[2];
14722							style = value[3];
14723						}
14724						else {
14725							var splitData = $.map(value.split(','), $.trim);
14726							dateTest = dateHelper.parseDate(splitData[0], options.formatDate);
14727							dateEnd = dateHelper.parseDate(splitData[1], options.formatDate);
14728							desc = splitData[2];
14729							style = splitData[3];
14730						}
14731
14732						while (dateTest <= dateEnd) {
14733							hDate = new HighlightedDate(dateTest, desc, style);
14734							keyDate = dateHelper.formatDate(dateTest, options.formatDate);
14735							dateTest.setDate(dateTest.getDate() + 1);
14736							if (highlightedDates[keyDate] !== undefined) {
14737								exDesc = highlightedDates[keyDate].desc;
14738								if (exDesc && exDesc.length && hDate.desc && hDate.desc.length) {
14739									highlightedDates[keyDate].desc = exDesc + "\n" + hDate.desc;
14740								}
14741							} else {
14742								highlightedDates[keyDate] = hDate;
14743							}
14744						}
14745					});
14746
14747					options.highlightedDates = $.extend(true, [], highlightedDates);
14748				}
14749
14750				if (_options.disabledDates && $.isArray(_options.disabledDates) && _options.disabledDates.length) {
14751					options.disabledDates = $.extend(true, [], _options.disabledDates);
14752				}
14753
14754				if (_options.disabledWeekDays && $.isArray(_options.disabledWeekDays) && _options.disabledWeekDays.length) {
14755					options.disabledWeekDays = $.extend(true, [], _options.disabledWeekDays);
14756				}
14757
14758				if ((options.open || options.opened) && (!options.inline)) {
14759					input.trigger('open.xdsoft');
14760				}
14761
14762				if (options.inline) {
14763					triggerAfterOpen = true;
14764					datetimepicker.addClass('xdsoft_inline');
14765					input.after(datetimepicker).hide();
14766				}
14767
14768				if (options.inverseButton) {
14769					options.next = 'xdsoft_prev';
14770					options.prev = 'xdsoft_next';
14771				}
14772
14773				if (options.datepicker) {
14774					datepicker.addClass('active');
14775				} else {
14776					datepicker.removeClass('active');
14777				}
14778
14779				if (options.timepicker) {
14780					timepicker.addClass('active');
14781				} else {
14782					timepicker.removeClass('active');
14783				}
14784
14785				if (options.value) {
14786					_xdsoft_datetime.setCurrentTime(options.value);
14787					if (input && input.val) {
14788						input.val(_xdsoft_datetime.str);
14789					}
14790				}
14791
14792				if (isNaN(options.dayOfWeekStart)) {
14793					options.dayOfWeekStart = 0;
14794				} else {
14795					options.dayOfWeekStart = parseInt(options.dayOfWeekStart, 10) % 7;
14796				}
14797
14798				if (!options.timepickerScrollbar) {
14799					timeboxparent.xdsoftScroller(options, 'hide');
14800				}
14801
14802				if (options.minDate && /^[\+\-](.*)$/.test(options.minDate)) {
14803					options.minDate = dateHelper.formatDate(_xdsoft_datetime.strToDateTime(options.minDate), options.formatDate);
14804				}
14805
14806				if (options.maxDate &&  /^[\+\-](.*)$/.test(options.maxDate)) {
14807					options.maxDate = dateHelper.formatDate(_xdsoft_datetime.strToDateTime(options.maxDate), options.formatDate);
14808				}
14809
14810                if (options.minDateTime &&  /^\+(.*)$/.test(options.minDateTime)) {
14811                	options.minDateTime = _xdsoft_datetime.strToDateTime(options.minDateTime).dateFormat(options.formatDate);
14812                }
14813
14814                if (options.maxDateTime &&  /^\+(.*)$/.test(options.maxDateTime)) {
14815                	options.maxDateTime = _xdsoft_datetime.strToDateTime(options.maxDateTime).dateFormat(options.formatDate);
14816                }
14817
14818				applyButton.toggle(options.showApplyButton);
14819
14820				month_picker
14821					.find('.xdsoft_today_button')
14822					.css('visibility', !options.todayButton ? 'hidden' : 'visible');
14823
14824				month_picker
14825					.find('.' + options.prev)
14826					.css('visibility', !options.prevButton ? 'hidden' : 'visible');
14827
14828				month_picker
14829					.find('.' + options.next)
14830					.css('visibility', !options.nextButton ? 'hidden' : 'visible');
14831
14832				setMask(options);
14833
14834				if (options.validateOnBlur) {
14835					input
14836						.off('blur.xdsoft')
14837						.on('blur.xdsoft', function () {
14838							if (options.allowBlank && (!$.trim($(this).val()).length ||
14839									(typeof options.mask === "string" && $.trim($(this).val()) === options.mask.replace(/[0-9]/g, '_')))) {
14840								$(this).val(null);
14841								datetimepicker.data('xdsoft_datetime').empty();
14842							} else {
14843								var d = dateHelper.parseDate($(this).val(), options.format);
14844								if (d) { // parseDate() may skip some invalid parts like date or time, so make it clear for user: show parsed date/time
14845									$(this).val(dateHelper.formatDate(d, options.format));
14846								} else {
14847									var splittedHours   = +([$(this).val()[0], $(this).val()[1]].join('')),
14848										splittedMinutes = +([$(this).val()[2], $(this).val()[3]].join(''));
14849
14850									// parse the numbers as 0312 => 03:12
14851									if (!options.datepicker && options.timepicker && splittedHours >= 0 && splittedHours < 24 && splittedMinutes >= 0 && splittedMinutes < 60) {
14852										$(this).val([splittedHours, splittedMinutes].map(function (item) {
14853											return item > 9 ? item : '0' + item;
14854										}).join(':'));
14855									} else {
14856										$(this).val(dateHelper.formatDate(_xdsoft_datetime.now(), options.format));
14857									}
14858								}
14859								datetimepicker.data('xdsoft_datetime').setCurrentTime($(this).val());
14860							}
14861
14862							datetimepicker.trigger('changedatetime.xdsoft');
14863							datetimepicker.trigger('close.xdsoft');
14864						});
14865				}
14866				options.dayOfWeekStartPrev = (options.dayOfWeekStart === 0) ? 6 : options.dayOfWeekStart - 1;
14867
14868				datetimepicker
14869					.trigger('xchange.xdsoft')
14870					.trigger('afterOpen.xdsoft');
14871			};
14872
14873			datetimepicker
14874				.data('options', options)
14875				.on('touchstart mousedown.xdsoft', function (event) {
14876					event.stopPropagation();
14877					event.preventDefault();
14878					yearselect.hide();
14879					monthselect.hide();
14880					return false;
14881				});
14882
14883			//scroll_element = timepicker.find('.xdsoft_time_box');
14884			timeboxparent.append(timebox);
14885			timeboxparent.xdsoftScroller(options);
14886
14887			datetimepicker.on('afterOpen.xdsoft', function () {
14888				timeboxparent.xdsoftScroller(options);
14889			});
14890
14891			datetimepicker
14892				.append(datepicker)
14893				.append(timepicker);
14894
14895			if (options.withoutCopyright !== true) {
14896				datetimepicker
14897					.append(xdsoft_copyright);
14898			}
14899
14900			datepicker
14901				.append(month_picker)
14902				.append(calendar)
14903				.append(applyButton);
14904
14905            if (options.insideParent) {
14906                $(input).parent().append(datetimepicker);
14907            } else {
14908                $(options.parentID).append(datetimepicker);
14909            }
14910
14911			XDSoft_datetime = function () {
14912				var _this = this;
14913				_this.now = function (norecursion) {
14914					var d = new Date(),
14915						date,
14916						time;
14917
14918					if (!norecursion && options.defaultDate) {
14919						date = _this.strToDateTime(options.defaultDate);
14920						d.setFullYear(date.getFullYear());
14921						d.setMonth(date.getMonth());
14922						d.setDate(date.getDate());
14923					}
14924
14925					d.setFullYear(d.getFullYear());
14926
14927					if (!norecursion && options.defaultTime) {
14928						time = _this.strtotime(options.defaultTime);
14929						d.setHours(time.getHours());
14930						d.setMinutes(time.getMinutes());
14931						d.setSeconds(time.getSeconds());
14932						d.setMilliseconds(time.getMilliseconds());
14933					}
14934					return d;
14935				};
14936
14937				_this.isValidDate = function (d) {
14938					if (Object.prototype.toString.call(d) !== "[object Date]") {
14939						return false;
14940					}
14941					return !isNaN(d.getTime());
14942				};
14943
14944				_this.setCurrentTime = function (dTime, requireValidDate) {
14945					if (typeof dTime === 'string') {
14946						_this.currentTime = _this.strToDateTime(dTime);
14947					}
14948					else if (_this.isValidDate(dTime)) {
14949						_this.currentTime = dTime;
14950					}
14951					else if (!dTime && !requireValidDate && options.allowBlank && !options.inline) {
14952						_this.currentTime = null;
14953					}
14954					else {
14955						_this.currentTime = _this.now();
14956					}
14957
14958					datetimepicker.trigger('xchange.xdsoft');
14959				};
14960
14961				_this.empty = function () {
14962					_this.currentTime = null;
14963				};
14964
14965				_this.getCurrentTime = function () {
14966					return _this.currentTime;
14967				};
14968
14969				_this.nextMonth = function () {
14970
14971					if (_this.currentTime === undefined || _this.currentTime === null) {
14972						_this.currentTime = _this.now();
14973					}
14974
14975					var month = _this.currentTime.getMonth() + 1,
14976						year;
14977					if (month === 12) {
14978						_this.currentTime.setFullYear(_this.currentTime.getFullYear() + 1);
14979						month = 0;
14980					}
14981
14982					year = _this.currentTime.getFullYear();
14983
14984					_this.currentTime.setDate(
14985						Math.min(
14986							new Date(_this.currentTime.getFullYear(), month + 1, 0).getDate(),
14987							_this.currentTime.getDate()
14988						)
14989					);
14990					_this.currentTime.setMonth(month);
14991
14992					if (options.onChangeMonth && $.isFunction(options.onChangeMonth)) {
14993						options.onChangeMonth.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input'));
14994					}
14995
14996					if (year !== _this.currentTime.getFullYear() && $.isFunction(options.onChangeYear)) {
14997						options.onChangeYear.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input'));
14998					}
14999
15000					datetimepicker.trigger('xchange.xdsoft');
15001					return month;
15002				};
15003
15004				_this.prevMonth = function () {
15005
15006					if (_this.currentTime === undefined || _this.currentTime === null) {
15007						_this.currentTime = _this.now();
15008					}
15009
15010					var month = _this.currentTime.getMonth() - 1;
15011					if (month === -1) {
15012						_this.currentTime.setFullYear(_this.currentTime.getFullYear() - 1);
15013						month = 11;
15014					}
15015					_this.currentTime.setDate(
15016						Math.min(
15017							new Date(_this.currentTime.getFullYear(), month + 1, 0).getDate(),
15018							_this.currentTime.getDate()
15019						)
15020					);
15021					_this.currentTime.setMonth(month);
15022					if (options.onChangeMonth && $.isFunction(options.onChangeMonth)) {
15023						options.onChangeMonth.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input'));
15024					}
15025					datetimepicker.trigger('xchange.xdsoft');
15026					return month;
15027				};
15028
15029				_this.getWeekOfYear = function (datetime) {
15030					if (options.onGetWeekOfYear && $.isFunction(options.onGetWeekOfYear)) {
15031						var week = options.onGetWeekOfYear.call(datetimepicker, datetime);
15032						if (typeof week !== 'undefined') {
15033							return week;
15034						}
15035					}
15036					var onejan = new Date(datetime.getFullYear(), 0, 1);
15037
15038					//First week of the year is th one with the first Thursday according to ISO8601
15039					if (onejan.getDay() !== 4) {
15040						onejan.setMonth(0, 1 + ((4 - onejan.getDay()+ 7) % 7));
15041					}
15042
15043					return Math.ceil((((datetime - onejan) / 86400000) + onejan.getDay() + 1) / 7);
15044				};
15045
15046				_this.strToDateTime = function (sDateTime) {
15047					var tmpDate = [], timeOffset, currentTime;
15048
15049					if (sDateTime && sDateTime instanceof Date && _this.isValidDate(sDateTime)) {
15050						return sDateTime;
15051					}
15052
15053					tmpDate = /^([+-]{1})(.*)$/.exec(sDateTime);
15054
15055					if (tmpDate) {
15056						tmpDate[2] = dateHelper.parseDate(tmpDate[2], options.formatDate);
15057					}
15058
15059					if (tmpDate  && tmpDate[2]) {
15060						timeOffset = tmpDate[2].getTime() - (tmpDate[2].getTimezoneOffset()) * 60000;
15061						currentTime = new Date((_this.now(true)).getTime() + parseInt(tmpDate[1] + '1', 10) * timeOffset);
15062					} else {
15063						currentTime = sDateTime ? dateHelper.parseDate(sDateTime, options.format) : _this.now();
15064					}
15065
15066					if (!_this.isValidDate(currentTime)) {
15067						currentTime = _this.now();
15068					}
15069
15070					return currentTime;
15071				};
15072
15073				_this.strToDate = function (sDate) {
15074					if (sDate && sDate instanceof Date && _this.isValidDate(sDate)) {
15075						return sDate;
15076					}
15077
15078					var currentTime = sDate ? dateHelper.parseDate(sDate, options.formatDate) : _this.now(true);
15079					if (!_this.isValidDate(currentTime)) {
15080						currentTime = _this.now(true);
15081					}
15082					return currentTime;
15083				};
15084
15085				_this.strtotime = function (sTime) {
15086					if (sTime && sTime instanceof Date && _this.isValidDate(sTime)) {
15087						return sTime;
15088					}
15089					var currentTime = sTime ? dateHelper.parseDate(sTime, options.formatTime) : _this.now(true);
15090					if (!_this.isValidDate(currentTime)) {
15091						currentTime = _this.now(true);
15092					}
15093					return currentTime;
15094				};
15095
15096				_this.str = function () {
15097					var format = options.format;
15098					if (options.yearOffset) {
15099						format = format.replace('Y', _this.currentTime.getFullYear() + options.yearOffset);
15100						format = format.replace('y', String(_this.currentTime.getFullYear() + options.yearOffset).substring(2, 4));
15101					}
15102					return dateHelper.formatDate(_this.currentTime, format);
15103				};
15104				_this.currentTime = this.now();
15105			};
15106
15107			_xdsoft_datetime = new XDSoft_datetime();
15108
15109			applyButton.on('touchend click', function (e) {//pathbrite
15110				e.preventDefault();
15111				datetimepicker.data('changed', true);
15112				_xdsoft_datetime.setCurrentTime(getCurrentValue());
15113				input.val(_xdsoft_datetime.str());
15114				datetimepicker.trigger('close.xdsoft');
15115			});
15116			month_picker
15117				.find('.xdsoft_today_button')
15118				.on('touchend mousedown.xdsoft', function () {
15119					datetimepicker.data('changed', true);
15120					_xdsoft_datetime.setCurrentTime(0, true);
15121					datetimepicker.trigger('afterOpen.xdsoft');
15122				}).on('dblclick.xdsoft', function () {
15123				var currentDate = _xdsoft_datetime.getCurrentTime(), minDate, maxDate;
15124				currentDate = new Date(currentDate.getFullYear(), currentDate.getMonth(), currentDate.getDate());
15125				minDate = _xdsoft_datetime.strToDate(options.minDate);
15126				minDate = new Date(minDate.getFullYear(), minDate.getMonth(), minDate.getDate());
15127				if (currentDate < minDate) {
15128					return;
15129				}
15130				maxDate = _xdsoft_datetime.strToDate(options.maxDate);
15131				maxDate = new Date(maxDate.getFullYear(), maxDate.getMonth(), maxDate.getDate());
15132				if (currentDate > maxDate) {
15133					return;
15134				}
15135				input.val(_xdsoft_datetime.str());
15136				input.trigger('change');
15137				datetimepicker.trigger('close.xdsoft');
15138			});
15139			month_picker
15140				.find('.xdsoft_prev,.xdsoft_next')
15141				.on('touchend mousedown.xdsoft', function () {
15142					var $this = $(this),
15143						timer = 0,
15144						stop = false;
15145
15146					(function arguments_callee1(v) {
15147						if ($this.hasClass(options.next)) {
15148							_xdsoft_datetime.nextMonth();
15149						} else if ($this.hasClass(options.prev)) {
15150							_xdsoft_datetime.prevMonth();
15151						}
15152						if (options.monthChangeSpinner) {
15153							if (!stop) {
15154								timer = setTimeout(arguments_callee1, v || 100);
15155							}
15156						}
15157					}(500));
15158
15159					$([options.ownerDocument.body, options.contentWindow]).on('touchend mouseup.xdsoft', function arguments_callee2() {
15160						clearTimeout(timer);
15161						stop = true;
15162						$([options.ownerDocument.body, options.contentWindow]).off('touchend mouseup.xdsoft', arguments_callee2);
15163					});
15164				});
15165
15166			timepicker
15167				.find('.xdsoft_prev,.xdsoft_next')
15168				.on('touchend mousedown.xdsoft', function () {
15169					var $this = $(this),
15170						timer = 0,
15171						stop = false,
15172						period = 110;
15173					(function arguments_callee4(v) {
15174						var pheight = timeboxparent[0].clientHeight,
15175							height = timebox[0].offsetHeight,
15176							top = Math.abs(parseInt(timebox.css('marginTop'), 10));
15177						if ($this.hasClass(options.next) && (height - pheight) - options.timeHeightInTimePicker >= top) {
15178							timebox.css('marginTop', '-' + (top + options.timeHeightInTimePicker) + 'px');
15179						} else if ($this.hasClass(options.prev) && top - options.timeHeightInTimePicker >= 0) {
15180							timebox.css('marginTop', '-' + (top - options.timeHeightInTimePicker) + 'px');
15181						}
15182						/**
15183						 * Fixed bug:
15184						 * When using css3 transition, it will cause a bug that you cannot scroll the timepicker list.
15185						 * The reason is that the transition-duration time, if you set it to 0, all things fine, otherwise, this
15186						 * would cause a bug when you use jquery.css method.
15187						 * Let's say: * { transition: all .5s ease; }
15188						 * jquery timebox.css('marginTop') will return the original value which is before you clicking the next/prev button,
15189						 * meanwhile the timebox[0].style.marginTop will return the right value which is after you clicking the
15190						 * next/prev button.
15191						 *
15192						 * What we should do:
15193						 * Replace timebox.css('marginTop') with timebox[0].style.marginTop.
15194						 */
15195						timeboxparent.trigger('scroll_element.xdsoft_scroller', [Math.abs(parseInt(timebox[0].style.marginTop, 10) / (height - pheight))]);
15196						period = (period > 10) ? 10 : period - 10;
15197						if (!stop) {
15198							timer = setTimeout(arguments_callee4, v || period);
15199						}
15200					}(500));
15201					$([options.ownerDocument.body, options.contentWindow]).on('touchend mouseup.xdsoft', function arguments_callee5() {
15202						clearTimeout(timer);
15203						stop = true;
15204						$([options.ownerDocument.body, options.contentWindow])
15205							.off('touchend mouseup.xdsoft', arguments_callee5);
15206					});
15207				});
15208
15209			xchangeTimer = 0;
15210			// base handler - generating a calendar and timepicker
15211			datetimepicker
15212				.on('xchange.xdsoft', function (event) {
15213					clearTimeout(xchangeTimer);
15214					xchangeTimer = setTimeout(function () {
15215
15216						if (_xdsoft_datetime.currentTime === undefined || _xdsoft_datetime.currentTime === null) {
15217							_xdsoft_datetime.currentTime = _xdsoft_datetime.now();
15218						}
15219
15220						var table =	'',
15221							start = new Date(_xdsoft_datetime.currentTime.getFullYear(), _xdsoft_datetime.currentTime.getMonth(), 1, 12, 0, 0),
15222							i = 0,
15223							j,
15224							today = _xdsoft_datetime.now(),
15225							maxDate = false,
15226							minDate = false,
15227							minDateTime = false,
15228							maxDateTime = false,
15229							hDate,
15230							day,
15231							d,
15232							y,
15233							m,
15234							w,
15235							classes = [],
15236							customDateSettings,
15237							newRow = true,
15238							time = '',
15239							h,
15240							line_time,
15241							description;
15242
15243						while (start.getDay() !== options.dayOfWeekStart) {
15244							start.setDate(start.getDate() - 1);
15245						}
15246
15247						table += '<table><thead><tr>';
15248
15249						if (options.weeks) {
15250							table += '<th></th>';
15251						}
15252
15253						for (j = 0; j < 7; j += 1) {
15254							table += '<th>' + options.i18n[globalLocale].dayOfWeekShort[(j + options.dayOfWeekStart) % 7] + '</th>';
15255						}
15256
15257						table += '</tr></thead>';
15258						table += '<tbody>';
15259
15260						if (options.maxDate !== false) {
15261							maxDate = _xdsoft_datetime.strToDate(options.maxDate);
15262							maxDate = new Date(maxDate.getFullYear(), maxDate.getMonth(), maxDate.getDate(), 23, 59, 59, 999);
15263						}
15264
15265						if (options.minDate !== false) {
15266							minDate = _xdsoft_datetime.strToDate(options.minDate);
15267							minDate = new Date(minDate.getFullYear(), minDate.getMonth(), minDate.getDate());
15268						}
15269
15270                        if (options.minDateTime !== false) {
15271							minDateTime = _xdsoft_datetime.strToDate(options.minDateTime);
15272							minDateTime = new Date(minDateTime.getFullYear(), minDateTime.getMonth(), minDateTime.getDate(), minDateTime.getHours(), minDateTime.getMinutes(), minDateTime.getSeconds());
15273						}
15274
15275                        if (options.maxDateTime !== false) {
15276							maxDateTime = _xdsoft_datetime.strToDate(options.maxDateTime);
15277							maxDateTime = new Date(maxDateTime.getFullYear(), maxDateTime.getMonth(), maxDateTime.getDate(), maxDateTime.getHours(), maxDateTime.getMinutes(), maxDateTime.getSeconds());
15278						}
15279
15280						var maxDateTimeDay;
15281						if (maxDateTime !== false) {
15282							maxDateTimeDay = ((maxDateTime.getFullYear() * 12) + maxDateTime.getMonth()) * 31 + maxDateTime.getDate();
15283						}
15284
15285						while (i < _xdsoft_datetime.currentTime.countDaysInMonth() || start.getDay() !== options.dayOfWeekStart || _xdsoft_datetime.currentTime.getMonth() === start.getMonth()) {
15286							classes = [];
15287							i += 1;
15288
15289							day = start.getDay();
15290							d = start.getDate();
15291							y = start.getFullYear();
15292							m = start.getMonth();
15293							w = _xdsoft_datetime.getWeekOfYear(start);
15294							description = '';
15295
15296							classes.push('xdsoft_date');
15297
15298							if (options.beforeShowDay && $.isFunction(options.beforeShowDay.call)) {
15299								customDateSettings = options.beforeShowDay.call(datetimepicker, start);
15300							} else {
15301								customDateSettings = null;
15302							}
15303
15304							if(options.allowDateRe && Object.prototype.toString.call(options.allowDateRe) === "[object RegExp]"){
15305								if(!options.allowDateRe.test(dateHelper.formatDate(start, options.formatDate))){
15306									classes.push('xdsoft_disabled');
15307								}
15308							}
15309							
15310							if(options.allowDates && options.allowDates.length>0){
15311								if(options.allowDates.indexOf(dateHelper.formatDate(start, options.formatDate)) === -1){
15312									classes.push('xdsoft_disabled');
15313								}
15314							}
15315							
15316							var currentDay = ((start.getFullYear() * 12) + start.getMonth()) * 31 + start.getDate();
15317							if ((maxDate !== false && start > maxDate) || (minDateTime !== false && start < minDateTime)  || (minDate !== false && start < minDate) || (maxDateTime !== false && currentDay > maxDateTimeDay) || (customDateSettings && customDateSettings[0] === false)) {
15318								classes.push('xdsoft_disabled');
15319							}
15320							
15321							if (options.disabledDates.indexOf(dateHelper.formatDate(start, options.formatDate)) !== -1) {
15322								classes.push('xdsoft_disabled');
15323							}
15324							
15325							if (options.disabledWeekDays.indexOf(day) !== -1) {
15326								classes.push('xdsoft_disabled');
15327							}
15328							
15329							if (input.is('[disabled]')) {
15330								classes.push('xdsoft_disabled');
15331							}
15332
15333							if (customDateSettings && customDateSettings[1] !== "") {
15334								classes.push(customDateSettings[1]);
15335							}
15336
15337							if (_xdsoft_datetime.currentTime.getMonth() !== m) {
15338								classes.push('xdsoft_other_month');
15339							}
15340
15341							if ((options.defaultSelect || datetimepicker.data('changed')) && dateHelper.formatDate(_xdsoft_datetime.currentTime, options.formatDate) === dateHelper.formatDate(start, options.formatDate)) {
15342								classes.push('xdsoft_current');
15343							}
15344
15345							if (dateHelper.formatDate(today, options.formatDate) === dateHelper.formatDate(start, options.formatDate)) {
15346								classes.push('xdsoft_today');
15347							}
15348
15349							if (start.getDay() === 0 || start.getDay() === 6 || options.weekends.indexOf(dateHelper.formatDate(start, options.formatDate)) !== -1) {
15350								classes.push('xdsoft_weekend');
15351							}
15352
15353							if (options.highlightedDates[dateHelper.formatDate(start, options.formatDate)] !== undefined) {
15354								hDate = options.highlightedDates[dateHelper.formatDate(start, options.formatDate)];
15355								classes.push(hDate.style === undefined ? 'xdsoft_highlighted_default' : hDate.style);
15356								description = hDate.desc === undefined ? '' : hDate.desc;
15357							}
15358
15359							if (options.beforeShowDay && $.isFunction(options.beforeShowDay)) {
15360								classes.push(options.beforeShowDay(start));
15361							}
15362
15363							if (newRow) {
15364								table += '<tr>';
15365								newRow = false;
15366								if (options.weeks) {
15367									table += '<th>' + w + '</th>';
15368								}
15369							}
15370
15371							table += '<td data-date="' + d + '" data-month="' + m + '" data-year="' + y + '"' + ' class="xdsoft_date xdsoft_day_of_week' + start.getDay() + ' ' + classes.join(' ') + '" title="' + description + '">' +
15372								'<div>' + d + '</div>' +
15373								'</td>';
15374
15375							if (start.getDay() === options.dayOfWeekStartPrev) {
15376								table += '</tr>';
15377								newRow = true;
15378							}
15379
15380							start.setDate(d + 1);
15381						}
15382						table += '</tbody></table>';
15383
15384						calendar.html(table);
15385
15386						month_picker.find('.xdsoft_label span').eq(0).text(options.i18n[globalLocale].months[_xdsoft_datetime.currentTime.getMonth()]);
15387						month_picker.find('.xdsoft_label span').eq(1).text(_xdsoft_datetime.currentTime.getFullYear() + options.yearOffset);
15388
15389						// generate timebox
15390						time = '';
15391						h = '';
15392						m = '';
15393
15394						var minTimeMinutesOfDay = 0;
15395						if (options.minTime !== false) {
15396						    var t = _xdsoft_datetime.strtotime(options.minTime);
15397						    minTimeMinutesOfDay = 60 * t.getHours() + t.getMinutes();
15398						}
15399						var maxTimeMinutesOfDay = 24 * 60;
15400						if (options.maxTime !== false) {
15401						    var t = _xdsoft_datetime.strtotime(options.maxTime);
15402						    maxTimeMinutesOfDay = 60 * t.getHours() + t.getMinutes();
15403						}
15404
15405						if (options.minDateTime !== false) {
15406							var t = _xdsoft_datetime.strToDateTime(options.minDateTime);
15407						        var currentDayIsMinDateTimeDay = dateHelper.formatDate(_xdsoft_datetime.currentTime, options.formatDate) === dateHelper.formatDate(t, options.formatDate);
15408							if (currentDayIsMinDateTimeDay) {
15409								var m = 60 * t.getHours() + t.getMinutes();
15410								if (m > minTimeMinutesOfDay) minTimeMinutesOfDay = m;
15411							}
15412						}
15413
15414						if (options.maxDateTime !== false) {
15415							var t = _xdsoft_datetime.strToDateTime(options.maxDateTime);
15416						        var currentDayIsMaxDateTimeDay = dateHelper.formatDate(_xdsoft_datetime.currentTime, options.formatDate) === dateHelper.formatDate(t, options.formatDate);
15417							if (currentDayIsMaxDateTimeDay) {
15418								var m = 60 * t.getHours() + t.getMinutes();
15419								if (m < maxTimeMinutesOfDay) maxTimeMinutesOfDay = m;
15420							}
15421						}
15422
15423						line_time = function line_time(h, m) {
15424							var now = _xdsoft_datetime.now(), current_time,
15425								isALlowTimesInit = options.allowTimes && $.isArray(options.allowTimes) && options.allowTimes.length;
15426							now.setHours(h);
15427							h = parseInt(now.getHours(), 10);
15428							now.setMinutes(m);
15429							m = parseInt(now.getMinutes(), 10);
15430							classes = [];
15431							var currentMinutesOfDay = 60 * h + m;
15432							if (input.is('[disabled]') || (currentMinutesOfDay >= maxTimeMinutesOfDay) || (currentMinutesOfDay < minTimeMinutesOfDay)) {
15433								classes.push('xdsoft_disabled');
15434							}
15435
15436							current_time = new Date(_xdsoft_datetime.currentTime);
15437							current_time.setHours(parseInt(_xdsoft_datetime.currentTime.getHours(), 10));
15438
15439							if (!isALlowTimesInit) {
15440								current_time.setMinutes(Math[options.roundTime](_xdsoft_datetime.currentTime.getMinutes() / options.step) * options.step);
15441							}
15442
15443							if ((options.initTime || options.defaultSelect || datetimepicker.data('changed')) && current_time.getHours() === parseInt(h, 10) && ((!isALlowTimesInit && options.step > 59) || current_time.getMinutes() === parseInt(m, 10))) {
15444								if (options.defaultSelect || datetimepicker.data('changed')) {
15445									classes.push('xdsoft_current');
15446								} else if (options.initTime) {
15447									classes.push('xdsoft_init_time');
15448								}
15449							}
15450							if (parseInt(today.getHours(), 10) === parseInt(h, 10) && parseInt(today.getMinutes(), 10) === parseInt(m, 10)) {
15451								classes.push('xdsoft_today');
15452							}
15453							time += '<div class="xdsoft_time ' + classes.join(' ') + '" data-hour="' + h + '" data-minute="' + m + '">' + dateHelper.formatDate(now, options.formatTime) + '</div>';
15454						};
15455
15456						if (!options.allowTimes || !$.isArray(options.allowTimes) || !options.allowTimes.length) {
15457							for (i = 0, j = 0; i < (options.hours12 ? 12 : 24); i += 1) {
15458								for (j = 0; j < 60; j += options.step) {
15459								        var currentMinutesOfDay = i * 60 + j;
15460								        if (currentMinutesOfDay < minTimeMinutesOfDay) continue;
15461								        if (currentMinutesOfDay >= maxTimeMinutesOfDay) continue;
15462									h = (i < 10 ? '0' : '') + i;
15463									m = (j < 10 ? '0' : '') + j;
15464									line_time(h, m);
15465								}
15466							}
15467						} else {
15468							for (i = 0; i < options.allowTimes.length; i += 1) {
15469								h = _xdsoft_datetime.strtotime(options.allowTimes[i]).getHours();
15470								m = _xdsoft_datetime.strtotime(options.allowTimes[i]).getMinutes();
15471								line_time(h, m);
15472							}
15473						}
15474
15475						timebox.html(time);
15476
15477						opt = '';
15478
15479						for (i = parseInt(options.yearStart, 10); i <= parseInt(options.yearEnd, 10); i += 1) {
15480							opt += '<div class="xdsoft_option ' + (_xdsoft_datetime.currentTime.getFullYear() === i ? 'xdsoft_current' : '') + '" data-value="' + i + '">' + (i + options.yearOffset) + '</div>';
15481						}
15482						yearselect.children().eq(0)
15483							.html(opt);
15484
15485						for (i = parseInt(options.monthStart, 10), opt = ''; i <= parseInt(options.monthEnd, 10); i += 1) {
15486							opt += '<div class="xdsoft_option ' + (_xdsoft_datetime.currentTime.getMonth() === i ? 'xdsoft_current' : '') + '" data-value="' + i + '">' + options.i18n[globalLocale].months[i] + '</div>';
15487						}
15488						monthselect.children().eq(0).html(opt);
15489						$(datetimepicker)
15490							.trigger('generate.xdsoft');
15491					}, 10);
15492					event.stopPropagation();
15493				})
15494				.on('afterOpen.xdsoft', function () {
15495					if (options.timepicker) {
15496						var classType, pheight, height, top;
15497						if (timebox.find('.xdsoft_current').length) {
15498							classType = '.xdsoft_current';
15499						} else if (timebox.find('.xdsoft_init_time').length) {
15500							classType = '.xdsoft_init_time';
15501						}
15502						if (classType) {
vendor: 1,734 bytes, lines 15503-15549
15503							pheight = timeboxparent[0].clientHeight;
15504							height = timebox[0].offsetHeight;
15505							top = timebox.find(classType).index() * options.timeHeightInTimePicker + 1;
15506							if ((height - pheight) < top) {
15507								top = height - pheight;
15508							}
15509							timeboxparent.trigger('scroll_element.xdsoft_scroller', [parseInt(top, 10) / (height - pheight)]);
15510						} else {
15511							timeboxparent.trigger('scroll_element.xdsoft_scroller', [0]);
15512						}
15513					}
15514				});
15515
15516			timerclick = 0;
15517			calendar
15518				.on('touchend click.xdsoft', 'td', function (xdevent) {
15519					xdevent.stopPropagation();  // Prevents closing of Pop-ups, Modals and Flyouts in Bootstrap
15520					timerclick += 1;
15521					var $this = $(this),
15522						currentTime = _xdsoft_datetime.currentTime;
15523
15524					if (currentTime === undefined || currentTime === null) {
15525						_xdsoft_datetime.currentTime = _xdsoft_datetime.now();
15526						currentTime = _xdsoft_datetime.currentTime;
15527					}
15528
15529					if ($this.hasClass('xdsoft_disabled')) {
15530						return false;
15531					}
15532
15533					currentTime.setDate(1);
15534					currentTime.setFullYear($this.data('year'));
15535					currentTime.setMonth($this.data('month'));
15536					currentTime.setDate($this.data('date'));
15537
15538					datetimepicker.trigger('select.xdsoft', [currentTime]);
15539
15540					input.val(_xdsoft_datetime.str());
15541
15542					if (options.onSelectDate &&	$.isFunction(options.onSelectDate)) {
15543						options.onSelectDate.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input'), xdevent);
15544					}
15545
15546					datetimepicker.data('changed', true);
15547					datetimepicker.trigger('xchange.xdsoft');
15548					datetimepicker.trigger('changedatetime.xdsoft');
15549					if ((timerclick > 1 || (options.closeOnDateSelect === true || (options.closeOnDateSelect === false && !
vendor: 22,189 bytes, lines 15549-16234
15549options.timepicker))) && !options.inline) {
15550						datetimepicker.trigger('close.xdsoft');
15551					}
15552					setTimeout(function () {
15553						timerclick = 0;
15554					}, 200);
15555				});
15556
15557			timebox
15558				.on('touchstart', 'div', function (xdevent) {
15559					this.touchMoved = false;
15560				})
15561				.on('touchmove', 'div', handleTouchMoved)
15562				.on('touchend click.xdsoft', 'div', function (xdevent) {
15563					if (!this.touchMoved) {
15564						xdevent.stopPropagation();
15565						var $this = $(this),
15566							currentTime = _xdsoft_datetime.currentTime;
15567
15568						if (currentTime === undefined || currentTime === null) {
15569							_xdsoft_datetime.currentTime = _xdsoft_datetime.now();
15570							currentTime = _xdsoft_datetime.currentTime;
15571						}
15572
15573						if ($this.hasClass('xdsoft_disabled')) {
15574							return false;
15575						}
15576						currentTime.setHours($this.data('hour'));
15577						currentTime.setMinutes($this.data('minute'));
15578						datetimepicker.trigger('select.xdsoft', [currentTime]);
15579
15580						datetimepicker.data('input').val(_xdsoft_datetime.str());
15581
15582						if (options.onSelectTime && $.isFunction(options.onSelectTime)) {
15583							options.onSelectTime.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input'), xdevent);
15584						}
15585						datetimepicker.data('changed', true);
15586						datetimepicker.trigger('xchange.xdsoft');
15587						datetimepicker.trigger('changedatetime.xdsoft');
15588						if (options.inline !== true && options.closeOnTimeSelect === true) {
15589							datetimepicker.trigger('close.xdsoft');
15590						}
15591					}
15592				});
15593
15594			datepicker
15595				.on('mousewheel.xdsoft', function (event) {
15596					if (!options.scrollMonth) {
15597						return true;
15598					}
15599					if (event.deltaY < 0) {
15600						_xdsoft_datetime.nextMonth();
15601					} else {
15602						_xdsoft_datetime.prevMonth();
15603					}
15604					return false;
15605				});
15606
15607			input
15608				.on('mousewheel.xdsoft', function (event) {
15609					if (!options.scrollInput) {
15610						return true;
15611					}
15612					if (!options.datepicker && options.timepicker) {
15613						current_time_index = timebox.find('.xdsoft_current').length ? timebox.find('.xdsoft_current').eq(0).index() : 0;
15614						if (current_time_index + event.deltaY >= 0 && current_time_index + event.deltaY < timebox.children().length) {
15615							current_time_index += event.deltaY;
15616						}
15617						if (timebox.children().eq(current_time_index).length) {
15618							timebox.children().eq(current_time_index).trigger('mousedown');
15619						}
15620						return false;
15621					}
15622					if (options.datepicker && !options.timepicker) {
15623						datepicker.trigger(event, [event.deltaY, event.deltaX, event.deltaY]);
15624						if (input.val) {
15625							input.val(_xdsoft_datetime.str());
15626						}
15627						datetimepicker.trigger('changedatetime.xdsoft');
15628						return false;
15629					}
15630				});
15631
15632			datetimepicker
15633				.on('changedatetime.xdsoft', function (event) {
15634					if (options.onChangeDateTime && $.isFunction(options.onChangeDateTime)) {
15635						var $input = datetimepicker.data('input');
15636						options.onChangeDateTime.call(datetimepicker, _xdsoft_datetime.currentTime, $input, event);
15637						delete options.value;
15638						$input.trigger('change');
15639					}
15640				})
15641				.on('generate.xdsoft', function () {
15642					if (options.onGenerate && $.isFunction(options.onGenerate)) {
15643						options.onGenerate.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input'));
15644					}
15645					if (triggerAfterOpen) {
15646						datetimepicker.trigger('afterOpen.xdsoft');
15647						triggerAfterOpen = false;
15648					}
15649				})
15650				.on('click.xdsoft', function (xdevent) {
15651					xdevent.stopPropagation();
15652				});
15653
15654			current_time_index = 0;
15655
15656			/**
15657			 * Runs the callback for each of the specified node's ancestors.
15658			 *
15659			 * Return FALSE from the callback to stop ascending.
15660			 *
15661			 * @param {DOMNode} node
15662			 * @param {Function} callback
15663			 * @returns {undefined}
15664			 */
15665			forEachAncestorOf = function (node, callback) {
15666				do {
15667					node = node.parentNode;
15668
15669					if (!node || callback(node) === false) {
15670						break;
15671					}
15672				} while (node.nodeName !== 'HTML');
15673			};
15674
15675			/**
15676			 * Sets the position of the picker.
15677			 *
15678			 * @returns {undefined}
15679			 */
15680			setPos = function () {
15681				var dateInputOffset,
15682					dateInputElem,
15683					verticalPosition,
15684					left,
15685					position,
15686					datetimepickerElem,
15687					dateInputHasFixedAncestor,
15688					$dateInput,
15689					windowWidth,
15690					verticalAnchorEdge,
15691					datetimepickerCss,
15692					windowHeight,
15693					windowScrollTop;
15694
15695				$dateInput = datetimepicker.data('input');
15696				dateInputOffset = $dateInput.offset();
15697				dateInputElem = $dateInput[0];
15698
15699				verticalAnchorEdge = 'top';
15700				verticalPosition = (dateInputOffset.top + dateInputElem.offsetHeight) - 1;
15701				left = dateInputOffset.left;
15702				position = "absolute";
15703
15704				windowWidth = $(options.contentWindow).width();
15705				windowHeight = $(options.contentWindow).height();
15706				windowScrollTop = $(options.contentWindow).scrollTop();
15707
15708				if ((options.ownerDocument.documentElement.clientWidth - dateInputOffset.left) < datepicker.parent().outerWidth(true)) {
15709					var diff = datepicker.parent().outerWidth(true) - dateInputElem.offsetWidth;
15710					left = left - diff;
15711				}
15712
15713				if ($dateInput.parent().css('direction') === 'rtl') {
15714					left -= (datetimepicker.outerWidth() - $dateInput.outerWidth());
15715				}
15716
15717				if (options.fixed) {
15718					verticalPosition -= windowScrollTop;
15719					left -= $(options.contentWindow).scrollLeft();
15720					position = "fixed";
15721				} else {
15722					dateInputHasFixedAncestor = false;
15723
15724					forEachAncestorOf(dateInputElem, function (ancestorNode) {
15725						if (ancestorNode === null) {
15726							return false;
15727						}
15728
15729						if (options.contentWindow.getComputedStyle(ancestorNode).getPropertyValue('position') === 'fixed') {
15730							dateInputHasFixedAncestor = true;
15731							return false;
15732						}
15733					});
15734
15735					if (dateInputHasFixedAncestor && !options.insideParent) {
15736						position = 'fixed';
15737
15738						//If the picker won't fit entirely within the viewport then display it above the date input.
15739						if (verticalPosition + datetimepicker.outerHeight() > windowHeight + windowScrollTop) {
15740							verticalAnchorEdge = 'bottom';
15741							verticalPosition = (windowHeight + windowScrollTop) - dateInputOffset.top;
15742						} else {
15743							verticalPosition -= windowScrollTop;
15744						}
15745					} else {
15746						if (verticalPosition + datetimepicker[0].offsetHeight > windowHeight + windowScrollTop) {
15747							verticalPosition = dateInputOffset.top - datetimepicker[0].offsetHeight + 1;
15748						}
15749					}
15750
15751					if (verticalPosition < 0) {
15752						verticalPosition = 0;
15753					}
15754
15755					if (left + dateInputElem.offsetWidth > windowWidth) {
15756						left = windowWidth - dateInputElem.offsetWidth;
15757					}
15758				}
15759
15760				datetimepickerElem = datetimepicker[0];
15761
15762				forEachAncestorOf(datetimepickerElem, function (ancestorNode) {
15763					var ancestorNodePosition;
15764
15765					ancestorNodePosition = options.contentWindow.getComputedStyle(ancestorNode).getPropertyValue('position');
15766
15767					if (ancestorNodePosition === 'relative' && windowWidth >= ancestorNode.offsetWidth) {
15768						left = left - ((windowWidth - ancestorNode.offsetWidth) / 2);
15769						return false;
15770					}
15771				});
15772
15773				datetimepickerCss = {
15774					position: position,
15775					left: options.insideParent ? dateInputElem.offsetLeft : left,
15776					top: '',  //Initialize to prevent previous values interfering with new ones.
15777					bottom: ''  //Initialize to prevent previous values interfering with new ones.
15778				};
15779
15780				if (options.insideParent) {
15781                    datetimepickerCss[verticalAnchorEdge] = dateInputElem.offsetTop + dateInputElem.offsetHeight;
15782                } else {
15783                    datetimepickerCss[verticalAnchorEdge] = verticalPosition;
15784                }
15785
15786				datetimepicker.css(datetimepickerCss);
15787			};
15788
15789			datetimepicker
15790				.on('open.xdsoft', function (event) {
15791					var onShow = true;
15792					if (options.onShow && $.isFunction(options.onShow)) {
15793						onShow = options.onShow.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input'), event);
15794					}
15795					if (onShow !== false) {
15796						datetimepicker.show();
15797						setPos();
15798						$(options.contentWindow)
15799							.off('resize.xdsoft', setPos)
15800							.on('resize.xdsoft', setPos);
15801
15802						if (options.closeOnWithoutClick) {
15803							$([options.ownerDocument.body, options.contentWindow]).on('touchstart mousedown.xdsoft', function arguments_callee6() {
15804								datetimepicker.trigger('close.xdsoft');
15805								$([options.ownerDocument.body, options.contentWindow]).off('touchstart mousedown.xdsoft', arguments_callee6);
15806							});
15807						}
15808					}
15809				})
15810				.on('close.xdsoft', function (event) {
15811					var onClose = true;
15812					month_picker
15813						.find('.xdsoft_month,.xdsoft_year')
15814						.find('.xdsoft_select')
15815						.hide();
15816					if (options.onClose && $.isFunction(options.onClose)) {
15817						onClose = options.onClose.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input'), event);
15818					}
15819					if (onClose !== false && !options.opened && !options.inline) {
15820						datetimepicker.hide();
15821					}
15822					event.stopPropagation();
15823				})
15824				.on('toggle.xdsoft', function () {
15825					if (datetimepicker.is(':visible')) {
15826						datetimepicker.trigger('close.xdsoft');
15827					} else {
15828						datetimepicker.trigger('open.xdsoft');
15829					}
15830				})
15831				.data('input', input);
15832
15833			timer = 0;
15834
15835			datetimepicker.data('xdsoft_datetime', _xdsoft_datetime);
15836			datetimepicker.setOptions(options);
15837
15838			function getCurrentValue() {
15839				var ct = false, time;
15840
15841				if (options.startDate) {
15842					ct = _xdsoft_datetime.strToDate(options.startDate);
15843				} else {
15844					ct = options.value || ((input && input.val && input.val()) ? input.val() : '');
15845					if (ct) {
15846						ct = _xdsoft_datetime.strToDateTime(ct);
15847						if (options.yearOffset) {
15848							ct = new Date(ct.getFullYear() - options.yearOffset, ct.getMonth(), ct.getDate(), ct.getHours(), ct.getMinutes(), ct.getSeconds(), ct.getMilliseconds());
15849						}
15850					} else if (options.defaultDate) {
15851						ct = _xdsoft_datetime.strToDateTime(options.defaultDate);
15852						if (options.defaultTime) {
15853							time = _xdsoft_datetime.strtotime(options.defaultTime);
15854							ct.setHours(time.getHours());
15855							ct.setMinutes(time.getMinutes());
15856						}
15857					}
15858				}
15859
15860				if (ct && _xdsoft_datetime.isValidDate(ct)) {
15861					datetimepicker.data('changed', true);
15862				} else {
15863					ct = '';
15864				}
15865
15866				return ct || 0;
15867			}
15868
15869			function setMask(options) {
15870
15871				var isValidValue = function (mask, value) {
15872						var reg = mask
15873							.replace(/([\[\]\/\{\}\(\)\-\.\+]{1})/g, '\\$1')
15874							.replace(/_/g, '{digit+}')
15875							.replace(/([0-9]{1})/g, '{digit$1}')
15876							.replace(/\{digit([0-9]{1})\}/g, '[0-$1_]{1}')
15877							.replace(/\{digit[\+]\}/g, '[0-9_]{1}');
15878						return (new RegExp(reg)).test(value);
15879					},
15880					getCaretPos = function (input) {
15881						try {
15882							if (options.ownerDocument.selection && options.ownerDocument.selection.createRange) {
15883								var range = options.ownerDocument.selection.createRange();
15884								return range.getBookmark().charCodeAt(2) - 2;
15885							}
15886							if (input.setSelectionRange) {
15887								return input.selectionStart;
15888							}
15889						} catch (e) {
15890							return 0;
15891						}
15892					},
15893					setCaretPos = function (node, pos) {
15894						node = (typeof node === "string" || node instanceof String) ? options.ownerDocument.getElementById(node) : node;
15895						if (!node) {
15896							return false;
15897						}
15898						if (node.createTextRange) {
15899							var textRange = node.createTextRange();
15900							textRange.collapse(true);
15901							textRange.moveEnd('character', pos);
15902							textRange.moveStart('character', pos);
15903							textRange.select();
15904							return true;
15905						}
15906						if (node.setSelectionRange) {
15907							node.setSelectionRange(pos, pos);
15908							return true;
15909						}
15910						return false;
15911					};
15912
15913				if(options.mask) {
15914					input.off('keydown.xdsoft');
15915				}
15916
15917				if (options.mask === true) {
15918					if (dateHelper.formatMask) {
15919						options.mask = dateHelper.formatMask(options.format)
15920					} else {
15921						options.mask = options.format
15922							.replace(/Y/g, '9999')
15923							.replace(/F/g, '9999')
15924							.replace(/m/g, '19')
15925							.replace(/d/g, '39')
15926							.replace(/H/g, '29')
15927							.replace(/i/g, '59')
15928							.replace(/s/g, '59');
15929					}
15930				}
15931
15932				if ($.type(options.mask) === 'string') {
15933					if (!isValidValue(options.mask, input.val())) {
15934						input.val(options.mask.replace(/[0-9]/g, '_'));
15935						setCaretPos(input[0], 0);
15936					}
15937
15938					input.on('paste.xdsoft', function (event) {
15939					    // couple options here
15940					    // 1. return false - tell them they can't paste
15941					    // 2. insert over current characters - minimal validation
15942					    // 3. full fledged parsing and validation
15943					    // let's go option 2 for now
15944
15945					    // fires multiple times for some reason
15946
15947					    // https://stackoverflow.com/a/30496488/1366033
15948					    var clipboardData = event.clipboardData || event.originalEvent.clipboardData || window.clipboardData,
15949						pastedData = clipboardData.getData('text'),
15950						val = this.value,
15951						pos = this.selectionStart
15952
15953					    var valueBeforeCursor = val.substr(0, pos);
15954					    var valueAfterPaste = val.substr(pos + pastedData.length);
15955
15956					    val = valueBeforeCursor + pastedData + valueAfterPaste;           
15957					    pos += pastedData.length;
15958
15959					    if (isValidValue(options.mask, val)) {
15960						this.value = val;
15961						setCaretPos(this, pos);
15962					    } else if ($.trim(val) === '') {
15963						this.value = options.mask.replace(/[0-9]/g, '_');
15964					    } else {
15965						input.trigger('error_input.xdsoft');
15966					    }
15967
15968					    event.preventDefault();
15969					    return false;
15970					  });
15971
15972					  input.on('keydown.xdsoft', function (event) {
15973					    var val = this.value,
15974						key = event.which,
15975						pos = this.selectionStart,
15976						selEnd = this.selectionEnd,
15977						hasSel = pos !== selEnd,
15978						digit;
15979
15980					    // only alow these characters
15981					    if (((key >=  KEY0 && key <=  KEY9)  ||
15982						 (key >= _KEY0 && key <= _KEY9)) || 
15983						 (key === BACKSPACE || key === DEL)) {
15984
15985					      // get char to insert which is new character or placeholder ('_')
15986					      digit = (key === BACKSPACE || key === DEL) ? '_' :
15987							  String.fromCharCode((_KEY0 <= key && key <= _KEY9) ? key - KEY0 : key);
15988
15989						// we're deleting something, we're not at the start, and have normal cursor, move back one
15990						// if we have a selection length, cursor actually sits behind deletable char, not in front
15991						if (key === BACKSPACE && pos && !hasSel) {
15992						    pos -= 1;
15993						}
15994
15995						// don't stop on a separator, continue whatever direction you were going
15996						//   value char - keep incrementing position while on separator char and we still have room
15997						//   del char   - keep decrementing position while on separator char and we still have room
15998						while (true) {
15999						  var maskValueAtCurPos = options.mask.substr(pos, 1);
16000						  var posShorterThanMaskLength = pos < options.mask.length;
16001						  var posGreaterThanZero = pos > 0;
16002						  var notNumberOrPlaceholder = /[^0-9_]/;
16003						  var curPosOnSep = notNumberOrPlaceholder.test(maskValueAtCurPos);
16004						  var continueMovingPosition = curPosOnSep && posShorterThanMaskLength && posGreaterThanZero
16005
16006						  // if we hit a real char, stay where we are
16007						  if (!continueMovingPosition) break;
16008
16009						  // hitting backspace in a selection, you can possibly go back any further - go forward
16010						  pos += (key === BACKSPACE && !hasSel) ? -1 : 1;
16011
16012                        }
16013                        
16014                        if (event.metaKey) {    // cmd has been pressed
16015                            pos = 0;
16016                            hasSel = true;
16017                        }
16018
16019						if (hasSel) {
16020						  // pos might have moved so re-calc length
16021						  var selLength = selEnd - pos
16022
16023						  // if we have a selection length we will wipe out entire selection and replace with default template for that range
16024						  var defaultBlank = options.mask.replace(/[0-9]/g, '_');
16025						  var defaultBlankSelectionReplacement = defaultBlank.substr(pos, selLength); 
16026						  var selReplacementRemainder = defaultBlankSelectionReplacement.substr(1) // might be empty
16027
16028						  var valueBeforeSel = val.substr(0, pos);
16029						  var insertChars = digit + selReplacementRemainder;
16030						  var charsAfterSelection = val.substr(pos + selLength);
16031
16032						  val = valueBeforeSel + insertChars + charsAfterSelection
16033
16034						} else {
16035						  var valueBeforeCursor = val.substr(0, pos);
16036						  var insertChar = digit;
16037						  var valueAfterNextChar = val.substr(pos + 1);
16038
16039						  val = valueBeforeCursor + insertChar + valueAfterNextChar
16040						}
16041
16042						if ($.trim(val) === '') {
16043						  // if empty, set to default
16044						    val = defaultBlank
16045						} else {
16046						  // if at the last character don't need to do anything
16047						    if (pos === options.mask.length) {
16048							event.preventDefault();
16049							return false;
16050						    }
16051						}
16052
16053						// resume cursor location
16054						pos += (key === BACKSPACE) ? 0 : 1;
16055						// don't stop on a separator, continue whatever direction you were going
16056						while (/[^0-9_]/.test(options.mask.substr(pos, 1)) && pos < options.mask.length && pos > 0) {
16057						    pos += (key === BACKSPACE) ? 0 : 1;
16058						}
16059
16060						if (isValidValue(options.mask, val)) {
16061						    this.value = val;
16062						    setCaretPos(this, pos);
16063						} else if ($.trim(val) === '') {
16064						    this.value = options.mask.replace(/[0-9]/g, '_');
16065						} else {
16066						    input.trigger('error_input.xdsoft');
16067						}
16068					    } else {
16069						if (([AKEY, CKEY, VKEY, ZKEY, YKEY].indexOf(key) !== -1 && ctrlDown) || [ESC, ARROWUP, ARROWDOWN, ARROWLEFT, ARROWRIGHT, F5, CTRLKEY, TAB, ENTER].indexOf(key) !== -1) {
16070						    return true;
16071						}
16072					    }
16073
16074					    event.preventDefault();
16075					    return false;
16076					  });
16077				}
16078			}
16079
16080			_xdsoft_datetime.setCurrentTime(getCurrentValue());
16081
16082			input
16083				.data('xdsoft_datetimepicker', datetimepicker)
16084				.on('open.xdsoft focusin.xdsoft mousedown.xdsoft touchstart', function () {
16085					if (input.is(':disabled') || (input.data('xdsoft_datetimepicker').is(':visible') && options.closeOnInputClick)) {
16086						return;
16087					}
16088					if (!options.openOnFocus) {
16089						return;
16090					}
16091					clearTimeout(timer);
16092					timer = setTimeout(function () {
16093						if (input.is(':disabled')) {
16094							return;
16095						}
16096
16097						triggerAfterOpen = true;
16098						_xdsoft_datetime.setCurrentTime(getCurrentValue(), true);
16099						if(options.mask) {
16100							setMask(options);
16101						}
16102						datetimepicker.trigger('open.xdsoft');
16103					}, 100);
16104				})
16105				.on('keydown.xdsoft', function (event) {
16106					var elementSelector,
16107						key = event.which;
16108					if ([ENTER].indexOf(key) !== -1 && options.enterLikeTab) {
16109						elementSelector = $("input:visible,textarea:visible,button:visible,a:visible");
16110						datetimepicker.trigger('close.xdsoft');
16111						elementSelector.eq(elementSelector.index(this) + 1).focus();
16112						return false;
16113					}
16114					if ([TAB].indexOf(key) !== -1) {
16115						datetimepicker.trigger('close.xdsoft');
16116						return true;
16117					}
16118				})
16119				.on('blur.xdsoft', function () {
16120					datetimepicker.trigger('close.xdsoft');
16121				});
16122		};
16123		destroyDateTimePicker = function (input) {
16124			var datetimepicker = input.data('xdsoft_datetimepicker');
16125			if (datetimepicker) {
16126				datetimepicker.data('xdsoft_datetime', null);
16127				datetimepicker.remove();
16128				input
16129					.data('xdsoft_datetimepicker', null)
16130					.off('.xdsoft');
16131				$(options.contentWindow).off('resize.xdsoft');
16132				$([options.contentWindow, options.ownerDocument.body]).off('mousedown.xdsoft touchstart');
16133				if (input.unmousewheel) {
16134					input.unmousewheel();
16135				}
16136			}
16137		};
16138		$(options.ownerDocument)
16139            .off('keydown.xdsoftctrl keyup.xdsoftctrl')
16140            .off('keydown.xdsoftcmd keyup.xdsoftcmd')
16141			.on('keydown.xdsoftctrl', function (e) {
16142				if (e.keyCode === CTRLKEY) {
16143					ctrlDown = true;
16144                }
16145			})
16146			.on('keyup.xdsoftctrl', function (e) {
16147				if (e.keyCode === CTRLKEY) {
16148					ctrlDown = false;
16149                }
16150            })
16151            .on('keydown.xdsoftcmd', function (e) {
16152                if (e.keyCode === CMDKEY) {
16153                    cmdDown = true;
16154                }
16155			})
16156			.on('keyup.xdsoftcmd', function (e) {
16157                if (e.keyCode === CMDKEY) {
16158                    cmdDown = false;
16159                }
16160			});
16161
16162		this.each(function () {
16163			var datetimepicker = $(this).data('xdsoft_datetimepicker'), $input;
16164			if (datetimepicker) {
16165				if ($.type(opt) === 'string') {
16166					switch (opt) {
16167						case 'show':
16168							$(this).select().focus();
16169							datetimepicker.trigger('open.xdsoft');
16170							break;
16171						case 'hide':
16172							datetimepicker.trigger('close.xdsoft');
16173							break;
16174						case 'toggle':
16175							datetimepicker.trigger('toggle.xdsoft');
16176							break;
16177						case 'destroy':
16178							destroyDateTimePicker($(this));
16179							break;
16180						case 'reset':
16181							this.value = this.defaultValue;
16182							if (!this.value || !datetimepicker.data('xdsoft_datetime').isValidDate(dateHelper.parseDate(this.value, options.format))) {
16183								datetimepicker.data('changed', false);
16184							}
16185							datetimepicker.data('xdsoft_datetime').setCurrentTime(this.value);
16186							break;
16187						case 'validate':
16188							$input = datetimepicker.data('input');
16189							$input.trigger('blur.xdsoft');
16190							break;
16191						default:
16192							if (datetimepicker[opt] && $.isFunction(datetimepicker[opt])) {
16193								result = datetimepicker[opt](opt2);
16194							}
16195					}
16196				} else {
16197					datetimepicker
16198						.setOptions(opt);
16199				}
16200				return 0;
16201			}
16202			if ($.type(opt) !== 'string') {
16203				if (!options.lazyInit || options.open || options.inline) {
16204					createDateTimePicker($(this));
16205				} else {
16206					lazyInit($(this));
16207				}
16208			}
16209		});
16210
16211		return result;
16212	};
16213
16214	$.fn.datetimepicker.defaults = default_options;
16215
16216	function HighlightedDate(date, desc, style) {
16217		"use strict";
16218		this.date = date;
16219		this.desc = desc;
16220		this.style = style;
16221	}
16222};
16223;(function (factory) {
16224	if ( typeof define === 'function' && define.amd ) {
16225		// AMD. Register as an anonymous module.
16226		define(['jquery', 'jquery-mousewheel'], factory);
16227	} else if (typeof exports === 'object') {
16228		// Node/CommonJS style for Browserify
16229		module.exports = factory(require('jquery'));;
16230	} else {
16231		// Browser globals
16232		factory(jQuery);
16233	}
16234}
vendor: 8,295 bytes, lines 16234-16457
16234(datetimepickerFactory));
16235
16236
16237/*!
16238 * jQuery Mousewheel 3.1.13
16239 *
16240 * Copyright jQuery Foundation and other contributors
16241 * Released under the MIT license
16242 * http://jquery.org/license
16243 */
16244
16245(function (factory) {
16246    if ( typeof define === 'function' && define.amd ) {
16247        // AMD. Register as an anonymous module.
16248        define(['jquery'], factory);
16249    } else if (typeof exports === 'object') {
16250        // Node/CommonJS style for Browserify
16251        module.exports = factory;
16252    } else {
16253        // Browser globals
16254        factory(jQuery);
16255    }
16256}(function ($) {
16257
16258    var toFix  = ['wheel', 'mousewheel', 'DOMMouseScroll', 'MozMousePixelScroll'],
16259        toBind = ( 'onwheel' in document || document.documentMode >= 9 ) ?
16260                    ['wheel'] : ['mousewheel', 'DomMouseScroll', 'MozMousePixelScroll'],
16261        slice  = Array.prototype.slice,
16262        nullLowestDeltaTimeout, lowestDelta;
16263
16264    if ( $.event.fixHooks ) {
16265        for ( var i = toFix.length; i; ) {
16266            $.event.fixHooks[ toFix[--i] ] = $.event.mouseHooks;
16267        }
16268    }
16269
16270    var special = $.event.special.mousewheel = {
16271        version: '3.1.12',
16272
16273        setup: function() {
16274            if ( this.addEventListener ) {
16275                for ( var i = toBind.length; i; ) {
16276                    this.addEventListener( toBind[--i], handler, false );
16277                }
16278            } else {
16279                this.onmousewheel = handler;
16280            }
16281            // Store the line height and page height for this particular element
16282            $.data(this, 'mousewheel-line-height', special.getLineHeight(this));
16283            $.data(this, 'mousewheel-page-height', special.getPageHeight(this));
16284        },
16285
16286        teardown: function() {
16287            if ( this.removeEventListener ) {
16288                for ( var i = toBind.length; i; ) {
16289                    this.removeEventListener( toBind[--i], handler, false );
16290                }
16291            } else {
16292                this.onmousewheel = null;
16293            }
16294            // Clean up the data we added to the element
16295            $.removeData(this, 'mousewheel-line-height');
16296            $.removeData(this, 'mousewheel-page-height');
16297        },
16298
16299        getLineHeight: function(elem) {
16300            var $elem = $(elem),
16301                $parent = $elem['offsetParent' in $.fn ? 'offsetParent' : 'parent']();
16302            if (!$parent.length) {
16303                $parent = $('body');
16304            }
16305            return parseInt($parent.css('fontSize'), 10) || parseInt($elem.css('fontSize'), 10) || 16;
16306        },
16307
16308        getPageHeight: function(elem) {
16309            return $(elem).height();
16310        },
16311
16312        settings: {
16313            adjustOldDeltas: true, // see shouldAdjustOldDeltas() below
16314            normalizeOffset: true  // calls getBoundingClientRect for each event
16315        }
16316    };
16317
16318    $.fn.extend({
16319        mousewheel: function(fn) {
16320            return fn ? this.bind('mousewheel', fn) : this.trigger('mousewheel');
16321        },
16322
16323        unmousewheel: function(fn) {
16324            return this.unbind('mousewheel', fn);
16325        }
16326    });
16327
16328
16329    function handler(event) {
16330        var orgEvent   = event || window.event,
16331            args       = slice.call(arguments, 1),
16332            delta      = 0,
16333            deltaX     = 0,
16334            deltaY     = 0,
16335            absDelta   = 0,
16336            offsetX    = 0,
16337            offsetY    = 0;
16338        event = $.event.fix(orgEvent);
16339        event.type = 'mousewheel';
16340
16341        // Old school scrollwheel delta
16342        if ( 'detail'      in orgEvent ) { deltaY = orgEvent.detail * -1;      }
16343        if ( 'wheelDelta'  in orgEvent ) { deltaY = orgEvent.wheelDelta;       }
16344        if ( 'wheelDeltaY' in orgEvent ) { deltaY = orgEvent.wheelDeltaY;      }
16345        if ( 'wheelDeltaX' in orgEvent ) { deltaX = orgEvent.wheelDeltaX * -1; }
16346
16347        // Firefox < 17 horizontal scrolling related to DOMMouseScroll event
16348        if ( 'axis' in orgEvent && orgEvent.axis === orgEvent.HORIZONTAL_AXIS ) {
16349            deltaX = deltaY * -1;
16350            deltaY = 0;
16351        }
16352
16353        // Set delta to be deltaY or deltaX if deltaY is 0 for backwards compatabilitiy
16354        delta = deltaY === 0 ? deltaX : deltaY;
16355
16356        // New school wheel delta (wheel event)
16357        if ( 'deltaY' in orgEvent ) {
16358            deltaY = orgEvent.deltaY * -1;
16359            delta  = deltaY;
16360        }
16361        if ( 'deltaX' in orgEvent ) {
16362            deltaX = orgEvent.deltaX;
16363            if ( deltaY === 0 ) { delta  = deltaX * -1; }
16364        }
16365
16366        // No change actually happened, no reason to go any further
16367        if ( deltaY === 0 && deltaX === 0 ) { return; }
16368
16369        // Need to convert lines and pages to pixels if we aren't already in pixels
16370        // There are three delta modes:
16371        //   * deltaMode 0 is by pixels, nothing to do
16372        //   * deltaMode 1 is by lines
16373        //   * deltaMode 2 is by pages
16374        if ( orgEvent.deltaMode === 1 ) {
16375            var lineHeight = $.data(this, 'mousewheel-line-height');
16376            delta  *= lineHeight;
16377            deltaY *= lineHeight;
16378            deltaX *= lineHeight;
16379        } else if ( orgEvent.deltaMode === 2 ) {
16380            var pageHeight = $.data(this, 'mousewheel-page-height');
16381            delta  *= pageHeight;
16382            deltaY *= pageHeight;
16383            deltaX *= pageHeight;
16384        }
16385
16386        // Store lowest absolute delta to normalize the delta values
16387        absDelta = Math.max( Math.abs(deltaY), Math.abs(deltaX) );
16388
16389        if ( !lowestDelta || absDelta < lowestDelta ) {
16390            lowestDelta = absDelta;
16391
16392            // Adjust older deltas if necessary
16393            if ( shouldAdjustOldDeltas(orgEvent, absDelta) ) {
16394                lowestDelta /= 40;
16395            }
16396        }
16397
16398        // Adjust older deltas if necessary
16399        if ( shouldAdjustOldDeltas(orgEvent, absDelta) ) {
16400            // Divide all the things by 40!
16401            delta  /= 40;
16402            deltaX /= 40;
16403            deltaY /= 40;
16404        }
16405
16406        // Get a whole, normalized value for the deltas
16407        delta  = Math[ delta  >= 1 ? 'floor' : 'ceil' ](delta  / lowestDelta);
16408        deltaX = Math[ deltaX >= 1 ? 'floor' : 'ceil' ](deltaX / lowestDelta);
16409        deltaY = Math[ deltaY >= 1 ? 'floor' : 'ceil' ](deltaY / lowestDelta);
16410
16411        // Normalise offsetX and offsetY properties
16412        if ( special.settings.normalizeOffset && this.getBoundingClientRect ) {
16413            var boundingRect = this.getBoundingClientRect();
16414            offsetX = event.clientX - boundingRect.left;
16415            offsetY = event.clientY - boundingRect.top;
16416        }
16417
16418        // Add information to the event object
16419        event.deltaX = deltaX;
16420        event.deltaY = deltaY;
16421        event.deltaFactor = lowestDelta;
16422        event.offsetX = offsetX;
16423        event.offsetY = offsetY;
16424        // Go ahead and set deltaMode to 0 since we converted to pixels
16425        // Although this is a little odd since we overwrite the deltaX/Y
16426        // properties with normalized deltas.
16427        event.deltaMode = 0;
16428
16429        // Add event and delta to the front of the arguments
16430        args.unshift(event, delta, deltaX, deltaY);
16431
16432        // Clearout lowestDelta after sometime to better
16433        // handle multiple device types that give different
16434        // a different lowestDelta
16435        // Ex: trackpad = 3 and mouse wheel = 120
16436        if (nullLowestDeltaTimeout) { clearTimeout(nullLowestDeltaTimeout); }
16437        nullLowestDeltaTimeout = setTimeout(nullLowestDelta, 200);
16438
16439        return ($.event.dispatch || $.event.handle).apply(this, args);
16440    }
16441
16442    function nullLowestDelta() {
16443        lowestDelta = null;
16444    }
16445
16446    function shouldAdjustOldDeltas(orgEvent, absDelta) {
16447        // If this is an older event and the delta is divisable by 120,
16448        // then we are assuming that the browser is treating this as an
16449        // older mouse wheel event and that we should divide the deltas
16450        // by 40 to try and get a more usable deltaFactor.
16451        // Side note, this actually impacts the reported scroll distance
16452        // in older browsers and can cause scrolling to be slower than native.
16453        // Turn this off by setting $.event.special.mousewheel.settings.adjustOldDeltas to false.
16454        return special.settings.adjustOldDeltas && orgEvent.type === 'mousewheel' && absDelta % 120 === 0;
16455    }
16456
16457}));
vendor: 116,632 bytes, lines 16458-20095
16458;(function (root, factory) {
16459	if (typeof exports === "object") {
16460		// CommonJS
16461		module.exports = exports = factory();
16462	}
16463	else if (typeof define === "function" && define.amd) {
16464		// AMD
16465		define([], factory);
16466	}
16467	else {
16468		// Global (browser)
16469		root.CryptoJS = factory();
16470	}
16471}(this, function () {
16472
16473	/*globals window, global, require*/
16474
16475	/**
16476	 * CryptoJS core components.
16477	 */
16478	var CryptoJS = CryptoJS || (function (Math, undefined) {
16479
16480	    var crypto;
16481
16482	    // Native crypto from window (Browser)
16483	    if (typeof window !== 'undefined' && window.crypto) {
16484	        crypto = window.crypto;
16485	    }
16486
16487	    // Native crypto in web worker (Browser)
16488	    if (typeof self !== 'undefined' && self.crypto) {
16489	        crypto = self.crypto;
16490	    }
16491
16492	    // Native crypto from worker
16493	    if (typeof globalThis !== 'undefined' && globalThis.crypto) {
16494	        crypto = globalThis.crypto;
16495	    }
16496
16497	    // Native (experimental IE 11) crypto from window (Browser)
16498	    if (!crypto && typeof window !== 'undefined' && window.msCrypto) {
16499	        crypto = window.msCrypto;
16500	    }
16501
16502	    // Native crypto from global (NodeJS)
16503	    if (!crypto && typeof global !== 'undefined' && global.crypto) {
16504	        crypto = global.crypto;
16505	    }
16506
16507	    // Native crypto import via require (NodeJS)
16508	    if (!crypto && typeof require === 'function') {
16509	        try {
16510	            crypto = require('crypto');
16511	        } catch (err) {}
16512	    }
16513
16514	    /*
16515	     * Cryptographically secure pseudorandom number generator
16516	     *
16517	     * As Math.random() is cryptographically not safe to use
16518	     */
16519	    var cryptoSecureRandomInt = function () {
16520	        if (crypto) {
16521	            // Use getRandomValues method (Browser)
16522	            if (typeof crypto.getRandomValues === 'function') {
16523	                try {
16524	                    return crypto.getRandomValues(new Uint32Array(1))[0];
16525	                } catch (err) {}
16526	            }
16527
16528	            // Use randomBytes method (NodeJS)
16529	            if (typeof crypto.randomBytes === 'function') {
16530	                try {
16531	                    return crypto.randomBytes(4).readInt32LE();
16532	                } catch (err) {}
16533	            }
16534	        }
16535
16536	        throw new Error('Native crypto module could not be used to get secure random number.');
16537	    };
16538
16539	    /*
16540	     * Local polyfill of Object.create
16541
16542	     */
16543	    var create = Object.create || (function () {
16544	        function F() {}
16545
16546	        return function (obj) {
16547	            var subtype;
16548
16549	            F.prototype = obj;
16550
16551	            subtype = new F();
16552
16553	            F.prototype = null;
16554
16555	            return subtype;
16556	        };
16557	    }());
16558
16559	    /**
16560	     * CryptoJS namespace.
16561	     */
16562	    var C = {};
16563
16564	    /**
16565	     * Library namespace.
16566	     */
16567	    var C_lib = C.lib = {};
16568
16569	    /**
16570	     * Base object for prototypal inheritance.
16571	     */
16572	    var Base = C_lib.Base = (function () {
16573
16574
16575	        return {
16576	            /**
16577	             * Creates a new object that inherits from this object.
16578	             *
16579	             * @param {Object} overrides Properties to copy into the new object.
16580	             *
16581	             * @return {Object} The new object.
16582	             *
16583	             * @static
16584	             *
16585	             * @example
16586	             *
16587	             *     var MyType = CryptoJS.lib.Base.extend({
16588	             *         field: 'value',
16589	             *
16590	             *         method: function () {
16591	             *         }
16592	             *     });
16593	             */
16594	            extend: function (overrides) {
16595	                // Spawn
16596	                var subtype = create(this);
16597
16598	                // Augment
16599	                if (overrides) {
16600	                    subtype.mixIn(overrides);
16601	                }
16602
16603	                // Create default initializer
16604	                if (!subtype.hasOwnProperty('init') || this.init === subtype.init) {
16605	                    subtype.init = function () {
16606	                        subtype.$super.init.apply(this, arguments);
16607	                    };
16608	                }
16609
16610	                // Initializer's prototype is the subtype object
16611	                subtype.init.prototype = subtype;
16612
16613	                // Reference supertype
16614	                subtype.$super = this;
16615
16616	                return subtype;
16617	            },
16618
16619	            /**
16620	             * Extends this object and runs the init method.
16621	             * Arguments to create() will be passed to init().
16622	             *
16623	             * @return {Object} The new object.
16624	             *
16625	             * @static
16626	             *
16627	             * @example
16628	             *
16629	             *     var instance = MyType.create();
16630	             */
16631	            create: function () {
16632	                var instance = this.extend();
16633	                instance.init.apply(instance, arguments);
16634
16635	                return instance;
16636	            },
16637
16638	            /**
16639	             * Initializes a newly created object.
16640	             * Override this method to add some logic when your objects are created.
16641	             *
16642	             * @example
16643	             *
16644	             *     var MyType = CryptoJS.lib.Base.extend({
16645	             *         init: function () {
16646	             *             // ...
16647	             *         }
16648	             *     });
16649	             */
16650	            init: function () {
16651	            },
16652
16653	            /**
16654	             * Copies properties into this object.
16655	             *
16656	             * @param {Object} properties The properties to mix in.
16657	             *
16658	             * @example
16659	             *
16660	             *     MyType.mixIn({
16661	             *         field: 'value'
16662	             *     });
16663	             */
16664	            mixIn: function (properties) {
16665	                for (var propertyName in properties) {
16666	                    if (properties.hasOwnProperty(propertyName)) {
16667	                        this[propertyName] = properties[propertyName];
16668	                    }
16669	                }
16670
16671	                // IE won't copy toString using the loop above
16672	                if (properties.hasOwnProperty('toString')) {
16673	                    this.toString = properties.toString;
16674	                }
16675	            },
16676
16677	            /**
16678	             * Creates a copy of this object.
16679	             *
16680	             * @return {Object} The clone.
16681	             *
16682	             * @example
16683	             *
16684	             *     var clone = instance.clone();
16685	             */
16686	            clone: function () {
16687	                return this.init.prototype.extend(this);
16688	            }
16689	        };
16690	    }());
16691
16692	    /**
16693	     * An array of 32-bit words.
16694	     *
16695	     * @property {Array} words The array of 32-bit words.
16696	     * @property {number} sigBytes The number of significant bytes in this word array.
16697	     */
16698	    var WordArray = C_lib.WordArray = Base.extend({
16699	        /**
16700	         * Initializes a newly created word array.
16701	         *
16702	         * @param {Array} words (Optional) An array of 32-bit words.
16703	         * @param {number} sigBytes (Optional) The number of significant bytes in the words.
16704	         *
16705	         * @example
16706	         *
16707	         *     var wordArray = CryptoJS.lib.WordArray.create();
16708	         *     var wordArray = CryptoJS.lib.WordArray.create([0x00010203, 0x04050607]);
16709	         *     var wordArray = CryptoJS.lib.WordArray.create([0x00010203, 0x04050607], 6);
16710	         */
16711	        init: function (words, sigBytes) {
16712	            words = this.words = words || [];
16713
16714	            if (sigBytes != undefined) {
16715	                this.sigBytes = sigBytes;
16716	            } else {
16717	                this.sigBytes = words.length * 4;
16718	            }
16719	        },
16720
16721	        /**
16722	         * Converts this word array to a string.
16723	         *
16724	         * @param {Encoder} encoder (Optional) The encoding strategy to use. Default: CryptoJS.enc.Hex
16725	         *
16726	         * @return {string} The stringified word array.
16727	         *
16728	         * @example
16729	         *
16730	         *     var string = wordArray + '';
16731	         *     var string = wordArray.toString();
16732	         *     var string = wordArray.toString(CryptoJS.enc.Utf8);
16733	         */
16734	        toString: function (encoder) {
16735	            return (encoder || Hex).stringify(this);
16736	        },
16737
16738	        /**
16739	         * Concatenates a word array to this word array.
16740	         *
16741	         * @param {WordArray} wordArray The word array to append.
16742	         *
16743	         * @return {WordArray} This word array.
16744	         *
16745	         * @example
16746	         *
16747	         *     wordArray1.concat(wordArray2);
16748	         */
16749	        concat: function (wordArray) {
16750	            // Shortcuts
16751	            var thisWords = this.words;
16752	            var thatWords = wordArray.words;
16753	            var thisSigBytes = this.sigBytes;
16754	            var thatSigBytes = wordArray.sigBytes;
16755
16756	            // Clamp excess bits
16757	            this.clamp();
16758
16759	            // Concat
16760	            if (thisSigBytes % 4) {
16761	                // Copy one byte at a time
16762	                for (var i = 0; i < thatSigBytes; i++) {
16763	                    var thatByte = (thatWords[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff;
16764	                    thisWords[(thisSigBytes + i) >>> 2] |= thatByte << (24 - ((thisSigBytes + i) % 4) * 8);
16765	                }
16766	            } else {
16767	                // Copy one word at a time
16768	                for (var j = 0; j < thatSigBytes; j += 4) {
16769	                    thisWords[(thisSigBytes + j) >>> 2] = thatWords[j >>> 2];
16770	                }
16771	            }
16772	            this.sigBytes += thatSigBytes;
16773
16774	            // Chainable
16775	            return this;
16776	        },
16777
16778	        /**
16779	         * Removes insignificant bits.
16780	         *
16781	         * @example
16782	         *
16783	         *     wordArray.clamp();
16784	         */
16785	        clamp: function () {
16786	            // Shortcuts
16787	            var words = this.words;
16788	            var sigBytes = this.sigBytes;
16789
16790	            // Clamp
16791	            words[sigBytes >>> 2] &= 0xffffffff << (32 - (sigBytes % 4) * 8);
16792	            words.length = Math.ceil(sigBytes / 4);
16793	        },
16794
16795	        /**
16796	         * Creates a copy of this word array.
16797	         *
16798	         * @return {WordArray} The clone.
16799	         *
16800	         * @example
16801	         *
16802	         *     var clone = wordArray.clone();
16803	         */
16804	        clone: function () {
16805	            var clone = Base.clone.call(this);
16806	            clone.words = this.words.slice(0);
16807
16808	            return clone;
16809	        },
16810
16811	        /**
16812	         * Creates a word array filled with random bytes.
16813	         *
16814	         * @param {number} nBytes The number of random bytes to generate.
16815	         *
16816	         * @return {WordArray} The random word array.
16817	         *
16818	         * @static
16819	         *
16820	         * @example
16821	         *
16822	         *     var wordArray = CryptoJS.lib.WordArray.random(16);
16823	         */
16824	        random: function (nBytes) {
16825	            var words = [];
16826
16827	            for (var i = 0; i < nBytes; i += 4) {
16828	                words.push(cryptoSecureRandomInt());
16829	            }
16830
16831	            return new WordArray.init(words, nBytes);
16832	        }
16833	    });
16834
16835	    /**
16836	     * Encoder namespace.
16837	     */
16838	    var C_enc = C.enc = {};
16839
16840	    /**
16841	     * Hex encoding strategy.
16842	     */
16843	    var Hex = C_enc.Hex = {
16844	        /**
16845	         * Converts a word array to a hex string.
16846	         *
16847	         * @param {WordArray} wordArray The word array.
16848	         *
16849	         * @return {string} The hex string.
16850	         *
16851	         * @static
16852	         *
16853	         * @example
16854	         *
16855	         *     var hexString = CryptoJS.enc.Hex.stringify(wordArray);
16856	         */
16857	        stringify: function (wordArray) {
16858	            // Shortcuts
16859	            var words = wordArray.words;
16860	            var sigBytes = wordArray.sigBytes;
16861
16862	            // Convert
16863	            var hexChars = [];
16864	            for (var i = 0; i < sigBytes; i++) {
16865	                var bite = (words[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff;
16866	                hexChars.push((bite >>> 4).toString(16));
16867	                hexChars.push((bite & 0x0f).toString(16));
16868	            }
16869
16870	            return hexChars.join('');
16871	        },
16872
16873	        /**
16874	         * Converts a hex string to a word array.
16875	         *
16876	         * @param {string} hexStr The hex string.
16877	         *
16878	         * @return {WordArray} The word array.
16879	         *
16880	         * @static
16881	         *
16882	         * @example
16883	         *
16884	         *     var wordArray = CryptoJS.enc.Hex.parse(hexString);
16885	         */
16886	        parse: function (hexStr) {
16887	            // Shortcut
16888	            var hexStrLength = hexStr.length;
16889
16890	            // Convert
16891	            var words = [];
16892	            for (var i = 0; i < hexStrLength; i += 2) {
16893	                words[i >>> 3] |= parseInt(hexStr.substr(i, 2), 16) << (24 - (i % 8) * 4);
16894	            }
16895
16896	            return new WordArray.init(words, hexStrLength / 2);
16897	        }
16898	    };
16899
16900	    /**
16901	     * Latin1 encoding strategy.
16902	     */
16903	    var Latin1 = C_enc.Latin1 = {
16904	        /**
16905	         * Converts a word array to a Latin1 string.
16906	         *
16907	         * @param {WordArray} wordArray The word array.
16908	         *
16909	         * @return {string} The Latin1 string.
16910	         *
16911	         * @static
16912	         *
16913	         * @example
16914	         *
16915	         *     var latin1String = CryptoJS.enc.Latin1.stringify(wordArray);
16916	         */
16917	        stringify: function (wordArray) {
16918	            // Shortcuts
16919	            var words = wordArray.words;
16920	            var sigBytes = wordArray.sigBytes;
16921
16922	            // Convert
16923	            var latin1Chars = [];
16924	            for (var i = 0; i < sigBytes; i++) {
16925	                var bite = (words[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff;
16926	                latin1Chars.push(String.fromCharCode(bite));
16927	            }
16928
16929	            return latin1Chars.join('');
16930	        },
16931
16932	        /**
16933	         * Converts a Latin1 string to a word array.
16934	         *
16935	         * @param {string} latin1Str The Latin1 string.
16936	         *
16937	         * @return {WordArray} The word array.
16938	         *
16939	         * @static
16940	         *
16941	         * @example
16942	         *
16943	         *     var wordArray = CryptoJS.enc.Latin1.parse(latin1String);
16944	         */
16945	        parse: function (latin1Str) {
16946	            // Shortcut
16947	            var latin1StrLength = latin1Str.length;
16948
16949	            // Convert
16950	            var words = [];
16951	            for (var i = 0; i < latin1StrLength; i++) {
16952	                words[i >>> 2] |= (latin1Str.charCodeAt(i) & 0xff) << (24 - (i % 4) * 8);
16953	            }
16954
16955	            return new WordArray.init(words, latin1StrLength);
16956	        }
16957	    };
16958
16959	    /**
16960	     * UTF-8 encoding strategy.
16961	     */
16962	    var Utf8 = C_enc.Utf8 = {
16963	        /**
16964	         * Converts a word array to a UTF-8 string.
16965	         *
16966	         * @param {WordArray} wordArray The word array.
16967	         *
16968	         * @return {string} The UTF-8 string.
16969	         *
16970	         * @static
16971	         *
16972	         * @example
16973	         *
16974	         *     var utf8String = CryptoJS.enc.Utf8.stringify(wordArray);
16975	         */
16976	        stringify: function (wordArray) {
16977	            try {
16978	                return decodeURIComponent(escape(Latin1.stringify(wordArray)));
16979	            } catch (e) {
16980	                throw new Error('Malformed UTF-8 data');
16981	            }
16982	        },
16983
16984	        /**
16985	         * Converts a UTF-8 string to a word array.
16986	         *
16987	         * @param {string} utf8Str The UTF-8 string.
16988	         *
16989	         * @return {WordArray} The word array.
16990	         *
16991	         * @static
16992	         *
16993	         * @example
16994	         *
16995	         *     var wordArray = CryptoJS.enc.Utf8.parse(utf8String);
16996	         */
16997	        parse: function (utf8Str) {
16998	            return Latin1.parse(unescape(encodeURIComponent(utf8Str)));
16999	        }
17000	    };
17001
17002	    /**
17003	     * Abstract buffered block algorithm template.
17004	     *
17005	     * The property blockSize must be implemented in a concrete subtype.
17006	     *
17007	     * @property {number} _minBufferSize The number of blocks that should be kept unprocessed in the buffer. Default: 0
17008	     */
17009	    var BufferedBlockAlgorithm = C_lib.BufferedBlockAlgorithm = Base.extend({
17010	        /**
17011	         * Resets this block algorithm's data buffer to its initial state.
17012	         *
17013	         * @example
17014	         *
17015	         *     bufferedBlockAlgorithm.reset();
17016	         */
17017	        reset: function () {
17018	            // Initial values
17019	            this._data = new WordArray.init();
17020	            this._nDataBytes = 0;
17021	        },
17022
17023	        /**
17024	         * Adds new data to this block algorithm's buffer.
17025	         *
17026	         * @param {WordArray|string} data The data to append. Strings are converted to a WordArray using UTF-8.
17027	         *
17028	         * @example
17029	         *
17030	         *     bufferedBlockAlgorithm._append('data');
17031	         *     bufferedBlockAlgorithm._append(wordArray);
17032	         */
17033	        _append: function (data) {
17034	            // Convert string to WordArray, else assume WordArray already
17035	            if (typeof data == 'string') {
17036	                data = Utf8.parse(data);
17037	            }
17038
17039	            // Append
17040	            this._data.concat(data);
17041	            this._nDataBytes += data.sigBytes;
17042	        },
17043
17044	        /**
17045	         * Processes available data blocks.
17046	         *
17047	         * This method invokes _doProcessBlock(offset), which must be implemented by a concrete subtype.
17048	         *
17049	         * @param {boolean} doFlush Whether all blocks and partial blocks should be processed.
17050	         *
17051	         * @return {WordArray} The processed data.
17052	         *
17053	         * @example
17054	         *
17055	         *     var processedData = bufferedBlockAlgorithm._process();
17056	         *     var processedData = bufferedBlockAlgorithm._process(!!'flush');
17057	         */
17058	        _process: function (doFlush) {
17059	            var processedWords;
17060
17061	            // Shortcuts
17062	            var data = this._data;
17063	            var dataWords = data.words;
17064	            var dataSigBytes = data.sigBytes;
17065	            var blockSize = this.blockSize;
17066	            var blockSizeBytes = blockSize * 4;
17067
17068	            // Count blocks ready
17069	            var nBlocksReady = dataSigBytes / blockSizeBytes;
17070	            if (doFlush) {
17071	                // Round up to include partial blocks
17072	                nBlocksReady = Math.ceil(nBlocksReady);
17073	            } else {
17074	                // Round down to include only full blocks,
17075	                // less the number of blocks that must remain in the buffer
17076	                nBlocksReady = Math.max((nBlocksReady | 0) - this._minBufferSize, 0);
17077	            }
17078
17079	            // Count words ready
17080	            var nWordsReady = nBlocksReady * blockSize;
17081
17082	            // Count bytes ready
17083	            var nBytesReady = Math.min(nWordsReady * 4, dataSigBytes);
17084
17085	            // Process blocks
17086	            if (nWordsReady) {
17087	                for (var offset = 0; offset < nWordsReady; offset += blockSize) {
17088	                    // Perform concrete-algorithm logic
17089	                    this._doProcessBlock(dataWords, offset);
17090	                }
17091
17092	                // Remove processed words
17093	                processedWords = dataWords.splice(0, nWordsReady);
17094	                data.sigBytes -= nBytesReady;
17095	            }
17096
17097	            // Return processed words
17098	            return new WordArray.init(processedWords, nBytesReady);
17099	        },
17100
17101	        /**
17102	         * Creates a copy of this object.
17103	         *
17104	         * @return {Object} The clone.
17105	         *
17106	         * @example
17107	         *
17108	         *     var clone = bufferedBlockAlgorithm.clone();
17109	         */
17110	        clone: function () {
17111	            var clone = Base.clone.call(this);
17112	            clone._data = this._data.clone();
17113
17114	            return clone;
17115	        },
17116
17117	        _minBufferSize: 0
17118	    });
17119
17120	    /**
17121	     * Abstract hasher template.
17122	     *
17123	     * @property {number} blockSize The number of 32-bit words this hasher operates on. Default: 16 (512 bits)
17124	     */
17125	    var Hasher = C_lib.Hasher = BufferedBlockAlgorithm.extend({
17126	        /**
17127	         * Configuration options.
17128	         */
17129	        cfg: Base.extend(),
17130
17131	        /**
17132	         * Initializes a newly created hasher.
17133	         *
17134	         * @param {Object} cfg (Optional) The configuration options to use for this hash computation.
17135	         *
17136	         * @example
17137	         *
17138	         *     var hasher = CryptoJS.algo.SHA256.create();
17139	         */
17140	        init: function (cfg) {
17141	            // Apply config defaults
17142	            this.cfg = this.cfg.extend(cfg);
17143
17144	            // Set initial values
17145	            this.reset();
17146	        },
17147
17148	        /**
17149	         * Resets this hasher to its initial state.
17150	         *
17151	         * @example
17152	         *
17153	         *     hasher.reset();
17154	         */
17155	        reset: function () {
17156	            // Reset data buffer
17157	            BufferedBlockAlgorithm.reset.call(this);
17158
17159	            // Perform concrete-hasher logic
17160	            this._doReset();
17161	        },
17162
17163	        /**
17164	         * Updates this hasher with a message.
17165	         *
17166	         * @param {WordArray|string} messageUpdate The message to append.
17167	         *
17168	         * @return {Hasher} This hasher.
17169	         *
17170	         * @example
17171	         *
17172	         *     hasher.update('message');
17173	         *     hasher.update(wordArray);
17174	         */
17175	        update: function (messageUpdate) {
17176	            // Append
17177	            this._append(messageUpdate);
17178
17179	            // Update the hash
17180	            this._process();
17181
17182	            // Chainable
17183	            return this;
17184	        },
17185
17186	        /**
17187	         * Finalizes the hash computation.
17188	         * Note that the finalize operation is effectively a destructive, read-once operation.
17189	         *
17190	         * @param {WordArray|string} messageUpdate (Optional) A final message update.
17191	         *
17192	         * @return {WordArray} The hash.
17193	         *
17194	         * @example
17195	         *
17196	         *     var hash = hasher.finalize();
17197	         *     var hash = hasher.finalize('message');
17198	         *     var hash = hasher.finalize(wordArray);
17199	         */
17200	        finalize: function (messageUpdate) {
17201	            // Final message update
17202	            if (messageUpdate) {
17203	                this._append(messageUpdate);
17204	            }
17205
17206	            // Perform concrete-hasher logic
17207	            var hash = this._doFinalize();
17208
17209	            return hash;
17210	        },
17211
17212	        blockSize: 512/32,
17213
17214	        /**
17215	         * Creates a shortcut function to a hasher's object interface.
17216	         *
17217	         * @param {Hasher} hasher The hasher to create a helper for.
17218	         *
17219	         * @return {Function} The shortcut function.
17220	         *
17221	         * @static
17222	         *
17223	         * @example
17224	         *
17225	         *     var SHA256 = CryptoJS.lib.Hasher._createHelper(CryptoJS.algo.SHA256);
17226	         */
17227	        _createHelper: function (hasher) {
17228	            return function (message, cfg) {
17229	                return new hasher.init(cfg).finalize(message);
17230	            };
17231	        },
17232
17233	        /**
17234	         * Creates a shortcut function to the HMAC's object interface.
17235	         *
17236	         * @param {Hasher} hasher The hasher to use in this HMAC helper.
17237	         *
17238	         * @return {Function} The shortcut function.
17239	         *
17240	         * @static
17241	         *
17242	         * @example
17243	         *
17244	         *     var HmacSHA256 = CryptoJS.lib.Hasher._createHmacHelper(CryptoJS.algo.SHA256);
17245	         */
17246	        _createHmacHelper: function (hasher) {
17247	            return function (message, key) {
17248	                return new C_algo.HMAC.init(hasher, key).finalize(message);
17249	            };
17250	        }
17251	    });
17252
17253	    /**
17254	     * Algorithm namespace.
17255	     */
17256	    var C_algo = C.algo = {};
17257
17258	    return C;
17259	}(Math));
17260
17261
17262	(function (undefined) {
17263	    // Shortcuts
17264	    var C = CryptoJS;
17265	    var C_lib = C.lib;
17266	    var Base = C_lib.Base;
17267	    var X32WordArray = C_lib.WordArray;
17268
17269	    /**
17270	     * x64 namespace.
17271	     */
17272	    var C_x64 = C.x64 = {};
17273
17274	    /**
17275	     * A 64-bit word.
17276	     */
17277	    var X64Word = C_x64.Word = Base.extend({
17278	        /**
17279	         * Initializes a newly created 64-bit word.
17280	         *
17281	         * @param {number} high The high 32 bits.
17282	         * @param {number} low The low 32 bits.
17283	         *
17284	         * @example
17285	         *
17286	         *     var x64Word = CryptoJS.x64.Word.create(0x00010203, 0x04050607);
17287	         */
17288	        init: function (high, low) {
17289	            this.high = high;
17290	            this.low = low;
17291	        }
17292
17293	        /**
17294	         * Bitwise NOTs this word.
17295	         *
17296	         * @return {X64Word} A new x64-Word object after negating.
17297	         *
17298	         * @example
17299	         *
17300	         *     var negated = x64Word.not();
17301	         */
17302	        // not: function () {
17303	            // var high = ~this.high;
17304	            // var low = ~this.low;
17305
17306	            // return X64Word.create(high, low);
17307	        // },
17308
17309	        /**
17310	         * Bitwise ANDs this word with the passed word.
17311	         *
17312	         * @param {X64Word} word The x64-Word to AND with this word.
17313	         *
17314	         * @return {X64Word} A new x64-Word object after ANDing.
17315	         *
17316	         * @example
17317	         *
17318	         *     var anded = x64Word.and(anotherX64Word);
17319	         */
17320	        // and: function (word) {
17321	            // var high = this.high & word.high;
17322	            // var low = this.low & word.low;
17323
17324	            // return X64Word.create(high, low);
17325	        // },
17326
17327	        /**
17328	         * Bitwise ORs this word with the passed word.
17329	         *
17330	         * @param {X64Word} word The x64-Word to OR with this word.
17331	         *
17332	         * @return {X64Word} A new x64-Word object after ORing.
17333	         *
17334	         * @example
17335	         *
17336	         *     var ored = x64Word.or(anotherX64Word);
17337	         */
17338	        // or: function (word) {
17339	            // var high = this.high | word.high;
17340	            // var low = this.low | word.low;
17341
17342	            // return X64Word.create(high, low);
17343	        // },
17344
17345	        /**
17346	         * Bitwise XORs this word with the passed word.
17347	         *
17348	         * @param {X64Word} word The x64-Word to XOR with this word.
17349	         *
17350	         * @return {X64Word} A new x64-Word object after XORing.
17351	         *
17352	         * @example
17353	         *
17354	         *     var xored = x64Word.xor(anotherX64Word);
17355	         */
17356	        // xor: function (word) {
17357	            // var high = this.high ^ word.high;
17358	            // var low = this.low ^ word.low;
17359
17360	            // return X64Word.create(high, low);
17361	        // },
17362
17363	        /**
17364	         * Shifts this word n bits to the left.
17365	         *
17366	         * @param {number} n The number of bits to shift.
17367	         *
17368	         * @return {X64Word} A new x64-Word object after shifting.
17369	         *
17370	         * @example
17371	         *
17372	         *     var shifted = x64Word.shiftL(25);
17373	         */
17374	        // shiftL: function (n) {
17375	            // if (n < 32) {
17376	                // var high = (this.high << n) | (this.low >>> (32 - n));
17377	                // var low = this.low << n;
17378	            // } else {
17379	                // var high = this.low << (n - 32);
17380	                // var low = 0;
17381	            // }
17382
17383	            // return X64Word.create(high, low);
17384	        // },
17385
17386	        /**
17387	         * Shifts this word n bits to the right.
17388	         *
17389	         * @param {number} n The number of bits to shift.
17390	         *
17391	         * @return {X64Word} A new x64-Word object after shifting.
17392	         *
17393	         * @example
17394	         *
17395	         *     var shifted = x64Word.shiftR(7);
17396	         */
17397	        // shiftR: function (n) {
17398	            // if (n < 32) {
17399	                // var low = (this.low >>> n) | (this.high << (32 - n));
17400	                // var high = this.high >>> n;
17401	            // } else {
17402	                // var low = this.high >>> (n - 32);
17403	                // var high = 0;
17404	            // }
17405
17406	            // return X64Word.create(high, low);
17407	        // },
17408
17409	        /**
17410	         * Rotates this word n bits to the left.
17411	         *
17412	         * @param {number} n The number of bits to rotate.
17413	         *
17414	         * @return {X64Word} A new x64-Word object after rotating.
17415	         *
17416	         * @example
17417	         *
17418	         *     var rotated = x64Word.rotL(25);
17419	         */
17420	        // rotL: function (n) {
17421	            // return this.shiftL(n).or(this.shiftR(64 - n));
17422	        // },
17423
17424	        /**
17425	         * Rotates this word n bits to the right.
17426	         *
17427	         * @param {number} n The number of bits to rotate.
17428	         *
17429	         * @return {X64Word} A new x64-Word object after rotating.
17430	         *
17431	         * @example
17432	         *
17433	         *     var rotated = x64Word.rotR(7);
17434	         */
17435	        // rotR: function (n) {
17436	            // return this.shiftR(n).or(this.shiftL(64 - n));
17437	        // },
17438
17439	        /**
17440	         * Adds this word with the passed word.
17441	         *
17442	         * @param {X64Word} word The x64-Word to add with this word.
17443	         *
17444	         * @return {X64Word} A new x64-Word object after adding.
17445	         *
17446	         * @example
17447	         *
17448	         *     var added = x64Word.add(anotherX64Word);
17449	         */
17450	        // add: function (word) {
17451	            // var low = (this.low + word.low) | 0;
17452	            // var carry = (low >>> 0) < (this.low >>> 0) ? 1 : 0;
17453	            // var high = (this.high + word.high + carry) | 0;
17454
17455	            // return X64Word.create(high, low);
17456	        // }
17457	    });
17458
17459	    /**
17460	     * An array of 64-bit words.
17461	     *
17462	     * @property {Array} words The array of CryptoJS.x64.Word objects.
17463	     * @property {number} sigBytes The number of significant bytes in this word array.
17464	     */
17465	    var X64WordArray = C_x64.WordArray = Base.extend({
17466	        /**
17467	         * Initializes a newly created word array.
17468	         *
17469	         * @param {Array} words (Optional) An array of CryptoJS.x64.Word objects.
17470	         * @param {number} sigBytes (Optional) The number of significant bytes in the words.
17471	         *
17472	         * @example
17473	         *
17474	         *     var wordArray = CryptoJS.x64.WordArray.create();
17475	         *
17476	         *     var wordArray = CryptoJS.x64.WordArray.create([
17477	         *         CryptoJS.x64.Word.create(0x00010203, 0x04050607),
17478	         *         CryptoJS.x64.Word.create(0x18191a1b, 0x1c1d1e1f)
17479	         *     ]);
17480	         *
17481	         *     var wordArray = CryptoJS.x64.WordArray.create([
17482	         *         CryptoJS.x64.Word.create(0x00010203, 0x04050607),
17483	         *         CryptoJS.x64.Word.create(0x18191a1b, 0x1c1d1e1f)
17484	         *     ], 10);
17485	         */
17486	        init: function (words, sigBytes) {
17487	            words = this.words = words || [];
17488
17489	            if (sigBytes != undefined) {
17490	                this.sigBytes = sigBytes;
17491	            } else {
17492	                this.sigBytes = words.length * 8;
17493	            }
17494	        },
17495
17496	        /**
17497	         * Converts this 64-bit word array to a 32-bit word array.
17498	         *
17499	         * @return {CryptoJS.lib.WordArray} This word array's data as a 32-bit word array.
17500	         *
17501	         * @example
17502	         *
17503	         *     var x32WordArray = x64WordArray.toX32();
17504	         */
17505	        toX32: function () {
17506	            // Shortcuts
17507	            var x64Words = this.words;
17508	            var x64WordsLength = x64Words.length;
17509
17510	            // Convert
17511	            var x32Words = [];
17512	            for (var i = 0; i < x64WordsLength; i++) {
17513	                var x64Word = x64Words[i];
17514	                x32Words.push(x64Word.high);
17515	                x32Words.push(x64Word.low);
17516	            }
17517
17518	            return X32WordArray.create(x32Words, this.sigBytes);
17519	        },
17520
17521	        /**
17522	         * Creates a copy of this word array.
17523	         *
17524	         * @return {X64WordArray} The clone.
17525	         *
17526	         * @example
17527	         *
17528	         *     var clone = x64WordArray.clone();
17529	         */
17530	        clone: function () {
17531	            var clone = Base.clone.call(this);
17532
17533	            // Clone "words" array
17534	            var words = clone.words = this.words.slice(0);
17535
17536	            // Clone each X64Word object
17537	            var wordsLength = words.length;
17538	            for (var i = 0; i < wordsLength; i++) {
17539	                words[i] = words[i].clone();
17540	            }
17541
17542	            return clone;
17543	        }
17544	    });
17545	}());
17546
17547
17548	(function () {
17549	    // Check if typed arrays are supported
17550	    if (typeof ArrayBuffer != 'function') {
17551	        return;
17552	    }
17553
17554	    // Shortcuts
17555	    var C = CryptoJS;
17556	    var C_lib = C.lib;
17557	    var WordArray = C_lib.WordArray;
17558
17559	    // Reference original init
17560	    var superInit = WordArray.init;
17561
17562	    // Augment WordArray.init to handle typed arrays
17563	    var subInit = WordArray.init = function (typedArray) {
17564	        // Convert buffers to uint8
17565	        if (typedArray instanceof ArrayBuffer) {
17566	            typedArray = new Uint8Array(typedArray);
17567	        }
17568
17569	        // Convert other array views to uint8
17570	        if (
17571	            typedArray instanceof Int8Array ||
17572	            (typeof Uint8ClampedArray !== "undefined" && typedArray instanceof Uint8ClampedArray) ||
17573	            typedArray instanceof Int16Array ||
17574	            typedArray instanceof Uint16Array ||
17575	            typedArray instanceof Int32Array ||
17576	            typedArray instanceof Uint32Array ||
17577	            typedArray instanceof Float32Array ||
17578	            typedArray instanceof Float64Array
17579	        ) {
17580	            typedArray = new Uint8Array(typedArray.buffer, typedArray.byteOffset, typedArray.byteLength);
17581	        }
17582
17583	        // Handle Uint8Array
17584	        if (typedArray instanceof Uint8Array) {
17585	            // Shortcut
17586	            var typedArrayByteLength = typedArray.byteLength;
17587
17588	            // Extract bytes
17589	            var words = [];
17590	            for (var i = 0; i < typedArrayByteLength; i++) {
17591	                words[i >>> 2] |= typedArray[i] << (24 - (i % 4) * 8);
17592	            }
17593
17594	            // Initialize this word array
17595	            superInit.call(this, words, typedArrayByteLength);
17596	        } else {
17597	            // Else call normal init
17598	            superInit.apply(this, arguments);
17599	        }
17600	    };
17601
17602	    subInit.prototype = WordArray;
17603	}());
17604
17605
17606	(function () {
17607	    // Shortcuts
17608	    var C = CryptoJS;
17609	    var C_lib = C.lib;
17610	    var WordArray = C_lib.WordArray;
17611	    var C_enc = C.enc;
17612
17613	    /**
17614	     * UTF-16 BE encoding strategy.
17615	     */
17616	    var Utf16BE = C_enc.Utf16 = C_enc.Utf16BE = {
17617	        /**
17618	         * Converts a word array to a UTF-16 BE string.
17619	         *
17620	         * @param {WordArray} wordArray The word array.
17621	         *
17622	         * @return {string} The UTF-16 BE string.
17623	         *
17624	         * @static
17625	         *
17626	         * @example
17627	         *
17628	         *     var utf16String = CryptoJS.enc.Utf16.stringify(wordArray);
17629	         */
17630	        stringify: function (wordArray) {
17631	            // Shortcuts
17632	            var words = wordArray.words;
17633	            var sigBytes = wordArray.sigBytes;
17634
17635	            // Convert
17636	            var utf16Chars = [];
17637	            for (var i = 0; i < sigBytes; i += 2) {
17638	                var codePoint = (words[i >>> 2] >>> (16 - (i % 4) * 8)) & 0xffff;
17639	                utf16Chars.push(String.fromCharCode(codePoint));
17640	            }
17641
17642	            return utf16Chars.join('');
17643	        },
17644
17645	        /**
17646	         * Converts a UTF-16 BE string to a word array.
17647	         *
17648	         * @param {string} utf16Str The UTF-16 BE string.
17649	         *
17650	         * @return {WordArray} The word array.
17651	         *
17652	         * @static
17653	         *
17654	         * @example
17655	         *
17656	         *     var wordArray = CryptoJS.enc.Utf16.parse(utf16String);
17657	         */
17658	        parse: function (utf16Str) {
17659	            // Shortcut
17660	            var utf16StrLength = utf16Str.length;
17661
17662	            // Convert
17663	            var words = [];
17664	            for (var i = 0; i < utf16StrLength; i++) {
17665	                words[i >>> 1] |= utf16Str.charCodeAt(i) << (16 - (i % 2) * 16);
17666	            }
17667
17668	            return WordArray.create(words, utf16StrLength * 2);
17669	        }
17670	    };
17671
17672	    /**
17673	     * UTF-16 LE encoding strategy.
17674	     */
17675	    C_enc.Utf16LE = {
17676	        /**
17677	         * Converts a word array to a UTF-16 LE string.
17678	         *
17679	         * @param {WordArray} wordArray The word array.
17680	         *
17681	         * @return {string} The UTF-16 LE string.
17682	         *
17683	         * @static
17684	         *
17685	         * @example
17686	         *
17687	         *     var utf16Str = CryptoJS.enc.Utf16LE.stringify(wordArray);
17688	         */
17689	        stringify: function (wordArray) {
17690	            // Shortcuts
17691	            var words = wordArray.words;
17692	            var sigBytes = wordArray.sigBytes;
17693
17694	            // Convert
17695	            var utf16Chars = [];
17696	            for (var i = 0; i < sigBytes; i += 2) {
17697	                var codePoint = swapEndian((words[i >>> 2] >>> (16 - (i % 4) * 8)) & 0xffff);
17698	                utf16Chars.push(String.fromCharCode(codePoint));
17699	            }
17700
17701	            return utf16Chars.join('');
17702	        },
17703
17704	        /**
17705	         * Converts a UTF-16 LE string to a word array.
17706	         *
17707	         * @param {string} utf16Str The UTF-16 LE string.
17708	         *
17709	         * @return {WordArray} The word array.
17710	         *
17711	         * @static
17712	         *
17713	         * @example
17714	         *
17715	         *     var wordArray = CryptoJS.enc.Utf16LE.parse(utf16Str);
17716	         */
17717	        parse: function (utf16Str) {
17718	            // Shortcut
17719	            var utf16StrLength = utf16Str.length;
17720
17721	            // Convert
17722	            var words = [];
17723	            for (var i = 0; i < utf16StrLength; i++) {
17724	                words[i >>> 1] |= swapEndian(utf16Str.charCodeAt(i) << (16 - (i % 2) * 16));
17725	            }
17726
17727	            return WordArray.create(words, utf16StrLength * 2);
17728	        }
17729	    };
17730
17731	    function swapEndian(word) {
17732	        return ((word << 8) & 0xff00ff00) | ((word >>> 8) & 0x00ff00ff);
17733	    }
17734	}());
17735
17736
17737	(function () {
17738	    // Shortcuts
17739	    var C = CryptoJS;
17740	    var C_lib = C.lib;
17741	    var WordArray = C_lib.WordArray;
17742	    var C_enc = C.enc;
17743
17744	    /**
17745	     * Base64 encoding strategy.
17746	     */
17747	    var Base64 = C_enc.Base64 = {
17748	        /**
17749	         * Converts a word array to a Base64 string.
17750	         *
17751	         * @param {WordArray} wordArray The word array.
17752	         *
17753	         * @return {string} The Base64 string.
17754	         *
17755	         * @static
17756	         *
17757	         * @example
17758	         *
17759	         *     var base64String = CryptoJS.enc.Base64.stringify(wordArray);
17760	         */
17761	        stringify: function (wordArray) {
17762	            // Shortcuts
17763	            var words = wordArray.words;
17764	            var sigBytes = wordArray.sigBytes;
17765	            var map = this._map;
17766
17767	            // Clamp excess bits
17768	            wordArray.clamp();
17769
17770	            // Convert
17771	            var base64Chars = [];
17772	            for (var i = 0; i < sigBytes; i += 3) {
17773	                var byte1 = (words[i >>> 2]       >>> (24 - (i % 4) * 8))       & 0xff;
17774	                var byte2 = (words[(i + 1) >>> 2] >>> (24 - ((i + 1) % 4) * 8)) & 0xff;
17775	                var byte3 = (words[(i + 2) >>> 2] >>> (24 - ((i + 2) % 4) * 8)) & 0xff;
17776
17777	                var triplet = (byte1 << 16) | (byte2 << 8) | byte3;
17778
17779	                for (var j = 0; (j < 4) && (i + j * 0.75 < sigBytes); j++) {
17780	                    base64Chars.push(map.charAt((triplet >>> (6 * (3 - j))) & 0x3f));
17781	                }
17782	            }
17783
17784	            // Add padding
17785	            var paddingChar = map.charAt(64);
17786	            if (paddingChar) {
17787	                while (base64Chars.length % 4) {
17788	                    base64Chars.push(paddingChar);
17789	                }
17790	            }
17791
17792	            return base64Chars.join('');
17793	        },
17794
17795	        /**
17796	         * Converts a Base64 string to a word array.
17797	         *
17798	         * @param {string} base64Str The Base64 string.
17799	         *
17800	         * @return {WordArray} The word array.
17801	         *
17802	         * @static
17803	         *
17804	         * @example
17805	         *
17806	         *     var wordArray = CryptoJS.enc.Base64.parse(base64String);
17807	         */
17808	        parse: function (base64Str) {
17809	            // Shortcuts
17810	            var base64StrLength = base64Str.length;
17811	            var map = this._map;
17812	            var reverseMap = this._reverseMap;
17813
17814	            if (!reverseMap) {
17815	                    reverseMap = this._reverseMap = [];
17816	                    for (var j = 0; j < map.length; j++) {
17817	                        reverseMap[map.charCodeAt(j)] = j;
17818	                    }
17819	            }
17820
17821	            // Ignore padding
17822	            var paddingChar = map.charAt(64);
17823	            if (paddingChar) {
17824	                var paddingIndex = base64Str.indexOf(paddingChar);
17825	                if (paddingIndex !== -1) {
17826	                    base64StrLength = paddingIndex;
17827	                }
17828	            }
17829
17830	            // Convert
17831	            return parseLoop(base64Str, base64StrLength, reverseMap);
17832
17833	        },
17834
17835	        _map: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='
17836	    };
17837
17838	    function parseLoop(base64Str, base64StrLength, reverseMap) {
17839	      var words = [];
17840	      var nBytes = 0;
17841	      for (var i = 0; i < base64StrLength; i++) {
17842	          if (i % 4) {
17843	              var bits1 = reverseMap[base64Str.charCodeAt(i - 1)] << ((i % 4) * 2);
17844	              var bits2 = reverseMap[base64Str.charCodeAt(i)] >>> (6 - (i % 4) * 2);
17845	              var bitsCombined = bits1 | bits2;
17846	              words[nBytes >>> 2] |= bitsCombined << (24 - (nBytes % 4) * 8);
17847	              nBytes++;
17848	          }
17849	      }
17850	      return WordArray.create(words, nBytes);
17851	    }
17852	}());
17853
17854
17855	(function () {
17856	    // Shortcuts
17857	    var C = CryptoJS;
17858	    var C_lib = C.lib;
17859	    var WordArray = C_lib.WordArray;
17860	    var C_enc = C.enc;
17861
17862	    /**
17863	     * Base64url encoding strategy.
17864	     */
17865	    var Base64url = C_enc.Base64url = {
17866	        /**
17867	         * Converts a word array to a Base64url string.
17868	         *
17869	         * @param {WordArray} wordArray The word array.
17870	         *
17871	         * @param {boolean} urlSafe Whether to use url safe
17872	         *
17873	         * @return {string} The Base64url string.
17874	         *
17875	         * @static
17876	         *
17877	         * @example
17878	         *
17879	         *     var base64String = CryptoJS.enc.Base64url.stringify(wordArray);
17880	         */
17881	        stringify: function (wordArray, urlSafe) {
17882	            if (urlSafe === undefined) {
17883	                urlSafe = true
17884	            }
17885	            // Shortcuts
17886	            var words = wordArray.words;
17887	            var sigBytes = wordArray.sigBytes;
17888	            var map = urlSafe ? this._safe_map : this._map;
17889
17890	            // Clamp excess bits
17891	            wordArray.clamp();
17892
17893	            // Convert
17894	            var base64Chars = [];
17895	            for (var i = 0; i < sigBytes; i += 3) {
17896	                var byte1 = (words[i >>> 2]       >>> (24 - (i % 4) * 8))       & 0xff;
17897	                var byte2 = (words[(i + 1) >>> 2] >>> (24 - ((i + 1) % 4) * 8)) & 0xff;
17898	                var byte3 = (words[(i + 2) >>> 2] >>> (24 - ((i + 2) % 4) * 8)) & 0xff;
17899
17900	                var triplet = (byte1 << 16) | (byte2 << 8) | byte3;
17901
17902	                for (var j = 0; (j < 4) && (i + j * 0.75 < sigBytes); j++) {
17903	                    base64Chars.push(map.charAt((triplet >>> (6 * (3 - j))) & 0x3f));
17904	                }
17905	            }
17906
17907	            // Add padding
17908	            var paddingChar = map.charAt(64);
17909	            if (paddingChar) {
17910	                while (base64Chars.length % 4) {
17911	                    base64Chars.push(paddingChar);
17912	                }
17913	            }
17914
17915	            return base64Chars.join('');
17916	        },
17917
17918	        /**
17919	         * Converts a Base64url string to a word array.
17920	         *
17921	         * @param {string} base64Str The Base64url string.
17922	         *
17923	         * @param {boolean} urlSafe Whether to use url safe
17924	         *
17925	         * @return {WordArray} The word array.
17926	         *
17927	         * @static
17928	         *
17929	         * @example
17930	         *
17931	         *     var wordArray = CryptoJS.enc.Base64url.parse(base64String);
17932	         */
17933	        parse: function (base64Str, urlSafe) {
17934	            if (urlSafe === undefined) {
17935	                urlSafe = true
17936	            }
17937
17938	            // Shortcuts
17939	            var base64StrLength = base64Str.length;
17940	            var map = urlSafe ? this._safe_map : this._map;
17941	            var reverseMap = this._reverseMap;
17942
17943	            if (!reverseMap) {
17944	                reverseMap = this._reverseMap = [];
17945	                for (var j = 0; j < map.length; j++) {
17946	                    reverseMap[map.charCodeAt(j)] = j;
17947	                }
17948	            }
17949
17950	            // Ignore padding
17951	            var paddingChar = map.charAt(64);
17952	            if (paddingChar) {
17953	                var paddingIndex = base64Str.indexOf(paddingChar);
17954	                if (paddingIndex !== -1) {
17955	                    base64StrLength = paddingIndex;
17956	                }
17957	            }
17958
17959	            // Convert
17960	            return parseLoop(base64Str, base64StrLength, reverseMap);
17961
17962	        },
17963
17964	        _map: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=',
17965	        _safe_map: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_',
17966	    };
17967
17968	    function parseLoop(base64Str, base64StrLength, reverseMap) {
17969	        var words = [];
17970	        var nBytes = 0;
17971	        for (var i = 0; i < base64StrLength; i++) {
17972	            if (i % 4) {
17973	                var bits1 = reverseMap[base64Str.charCodeAt(i - 1)] << ((i % 4) * 2);
17974	                var bits2 = reverseMap[base64Str.charCodeAt(i)] >>> (6 - (i % 4) * 2);
17975	                var bitsCombined = bits1 | bits2;
17976	                words[nBytes >>> 2] |= bitsCombined << (24 - (nBytes % 4) * 8);
17977	                nBytes++;
17978	            }
17979	        }
17980	        return WordArray.create(words, nBytes);
17981	    }
17982	}());
17983
17984
17985	(function (Math) {
17986	    // Shortcuts
17987	    var C = CryptoJS;
17988	    var C_lib = C.lib;
17989	    var WordArray = C_lib.WordArray;
17990	    var Hasher = C_lib.Hasher;
17991	    var C_algo = C.algo;
17992
17993	    // Constants table
17994	    var T = [];
17995
17996	    // Compute constants
17997	    (function () {
17998	        for (var i = 0; i < 64; i++) {
17999	            T[i] = (Math.abs(Math.sin(i + 1)) * 0x100000000) | 0;
18000	        }
18001	    }());
18002
18003	    /**
18004	     * MD5 hash algorithm.
18005	     */
18006	    var MD5 = C_algo.MD5 = Hasher.extend({
18007	        _doReset: function () {
18008	            this._hash = new WordArray.init([
18009	                0x67452301, 0xefcdab89,
18010	                0x98badcfe, 0x10325476
18011	            ]);
18012	        },
18013
18014	        _doProcessBlock: function (M, offset) {
18015	            // Swap endian
18016	            for (var i = 0; i < 16; i++) {
18017	                // Shortcuts
18018	                var offset_i = offset + i;
18019	                var M_offset_i = M[offset_i];
18020
18021	                M[offset_i] = (
18022	                    (((M_offset_i << 8)  | (M_offset_i >>> 24)) & 0x00ff00ff) |
18023	                    (((M_offset_i << 24) | (M_offset_i >>> 8))  & 0xff00ff00)
18024	                );
18025	            }
18026
18027	            // Shortcuts
18028	            var H = this._hash.words;
18029
18030	            var M_offset_0  = M[offset + 0];
18031	            var M_offset_1  = M[offset + 1];
18032	            var M_offset_2  = M[offset + 2];
18033	            var M_offset_3  = M[offset + 3];
18034	            var M_offset_4  = M[offset + 4];
18035	            var M_offset_5  = M[offset + 5];
18036	            var M_offset_6  = M[offset + 6];
18037	            var M_offset_7  = M[offset + 7];
18038	            var M_offset_8  = M[offset + 8];
18039	            var M_offset_9  = M[offset + 9];
18040	            var M_offset_10 = M[offset + 10];
18041	            var M_offset_11 = M[offset + 11];
18042	            var M_offset_12 = M[offset + 12];
18043	            var M_offset_13 = M[offset + 13];
18044	            var M_offset_14 = M[offset + 14];
18045	            var M_offset_15 = M[offset + 15];
18046
18047	            // Working variables
18048	            var a = H[0];
18049	            var b = H[1];
18050	            var c = H[2];
18051	            var d = H[3];
18052
18053	            // Computation
18054	            a = FF(a, b, c, d, M_offset_0,  7,  T[0]);
18055	            d = FF(d, a, b, c, M_offset_1,  12, T[1]);
18056	            c = FF(c, d, a, b, M_offset_2,  17, T[2]);
18057	            b = FF(b, c, d, a, M_offset_3,  22, T[3]);
18058	            a = FF(a, b, c, d, M_offset_4,  7,  T[4]);
18059	            d = FF(d, a, b, c, M_offset_5,  12, T[5]);
18060	            c = FF(c, d, a, b, M_offset_6,  17, T[6]);
18061	            b = FF(b, c, d, a, M_offset_7,  22, T[7]);
18062	            a = FF(a, b, c, d, M_offset_8,  7,  T[8]);
18063	            d = FF(d, a, b, c, M_offset_9,  12, T[9]);
18064	            c = FF(c, d, a, b, M_offset_10, 17, T[10]);
18065	            b = FF(b, c, d, a, M_offset_11, 22, T[11]);
18066	            a = FF(a, b, c, d, M_offset_12, 7,  T[12]);
18067	            d = FF(d, a, b, c, M_offset_13, 12, T[13]);
18068	            c = FF(c, d, a, b, M_offset_14, 17, T[14]);
18069	            b = FF(b, c, d, a, M_offset_15, 22, T[15]);
18070
18071	            a = GG(a, b, c, d, M_offset_1,  5,  T[16]);
18072	            d = GG(d, a, b, c, M_offset_6,  9,  T[17]);
18073	            c = GG(c, d, a, b, M_offset_11, 14, T[18]);
18074	            b = GG(b, c, d, a, M_offset_0,  20, T[19]);
18075	            a = GG(a, b, c, d, M_offset_5,  5,  T[20]);
18076	            d = GG(d, a, b, c, M_offset_10, 9,  T[21]);
18077	            c = GG(c, d, a, b, M_offset_15, 14, T[22]);
18078	            b = GG(b, c, d, a, M_offset_4,  20, T[23]);
18079	            a = GG(a, b, c, d, M_offset_9,  5,  T[24]);
18080	            d = GG(d, a, b, c, M_offset_14, 9,  T[25]);
18081	            c = GG(c, d, a, b, M_offset_3,  14, T[26]);
18082	            b = GG(b, c, d, a, M_offset_8,  20, T[27]);
18083	            a = GG(a, b, c, d, M_offset_13, 5,  T[28]);
18084	            d = GG(d, a, b, c, M_offset_2,  9,  T[29]);
18085	            c = GG(c, d, a, b, M_offset_7,  14, T[30]);
18086	            b = GG(b, c, d, a, M_offset_12, 20, T[31]);
18087
18088	            a = HH(a, b, c, d, M_offset_5,  4,  T[32]);
18089	            d = HH(d, a, b, c, M_offset_8,  11, T[33]);
18090	            c = HH(c, d, a, b, M_offset_11, 16, T[34]);
18091	            b = HH(b, c, d, a, M_offset_14, 23, T[35]);
18092	            a = HH(a, b, c, d, M_offset_1,  4,  T[36]);
18093	            d = HH(d, a, b, c, M_offset_4,  11, T[37]);
18094	            c = HH(c, d, a, b, M_offset_7,  16, T[38]);
18095	            b = HH(b, c, d, a, M_offset_10, 23, T[39]);
18096	            a = HH(a, b, c, d, M_offset_13, 4,  T[40]);
18097	            d = HH(d, a, b, c, M_offset_0,  11, T[41]);
18098	            c = HH(c, d, a, b, M_offset_3,  16, T[42]);
18099	            b = HH(b, c, d, a, M_offset_6,  23, T[43]);
18100	            a = HH(a, b, c, d, M_offset_9,  4,  T[44]);
18101	            d = HH(d, a, b, c, M_offset_12, 11, T[45]);
18102	            c = HH(c, d, a, b, M_offset_15, 16, T[46]);
18103	            b = HH(b, c, d, a, M_offset_2,  23, T[47]);
18104
18105	            a = II(a, b, c, d, M_offset_0,  6,  T[48]);
18106	            d = II(d, a, b, c, M_offset_7,  10, T[49]);
18107	            c = II(c, d, a, b, M_offset_14, 15, T[50]);
18108	            b = II(b, c, d, a, M_offset_5,  21, T[51]);
18109	            a = II(a, b, c, d, M_offset_12, 6,  T[52]);
18110	            d = II(d, a, b, c, M_offset_3,  10, T[53]);
18111	            c = II(c, d, a, b, M_offset_10, 15, T[54]);
18112	            b = II(b, c, d, a, M_offset_1,  21, T[55]);
18113	            a = II(a, b, c, d, M_offset_8,  6,  T[56]);
18114	            d = II(d, a, b, c, M_offset_15, 10, T[57]);
18115	            c = II(c, d, a, b, M_offset_6,  15, T[58]);
18116	            b = II(b, c, d, a, M_offset_13, 21, T[59]);
18117	            a = II(a, b, c, d, M_offset_4,  6,  T[60]);
18118	            d = II(d, a, b, c, M_offset_11, 10, T[61]);
18119	            c = II(c, d, a, b, M_offset_2,  15, T[62]);
18120	            b = II(b, c, d, a, M_offset_9,  21, T[63]);
18121
18122	            // Intermediate hash value
18123	            H[0] = (H[0] + a) | 0;
18124	            H[1] = (H[1] + b) | 0;
18125	            H[2] = (H[2] + c) | 0;
18126	            H[3] = (H[3] + d) | 0;
18127	        },
18128
18129	        _doFinalize: function () {
18130	            // Shortcuts
18131	            var data = this._data;
18132	            var dataWords = data.words;
18133
18134	            var nBitsTotal = this._nDataBytes * 8;
18135	            var nBitsLeft = data.sigBytes * 8;
18136
18137	            // Add padding
18138	            dataWords[nBitsLeft >>> 5] |= 0x80 << (24 - nBitsLeft % 32);
18139
18140	            var nBitsTotalH = Math.floor(nBitsTotal / 0x100000000);
18141	            var nBitsTotalL = nBitsTotal;
18142	            dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 15] = (
18143	                (((nBitsTotalH << 8)  | (nBitsTotalH >>> 24)) & 0x00ff00ff) |
18144	                (((nBitsTotalH << 24) | (nBitsTotalH >>> 8))  & 0xff00ff00)
18145	            );
18146	            dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 14] = (
18147	                (((nBitsTotalL << 8)  | (nBitsTotalL >>> 24)) & 0x00ff00ff) |
18148	                (((nBitsTotalL << 24) | (nBitsTotalL >>> 8))  & 0xff00ff00)
18149	            );
18150
18151	            data.sigBytes = (dataWords.length + 1) * 4;
18152
18153	            // Hash final blocks
18154	            this._process();
18155
18156	            // Shortcuts
18157	            var hash = this._hash;
18158	            var H = hash.words;
18159
18160	            // Swap endian
18161	            for (var i = 0; i < 4; i++) {
18162	                // Shortcut
18163	                var H_i = H[i];
18164
18165	                H[i] = (((H_i << 8)  | (H_i >>> 24)) & 0x00ff00ff) |
18166	                       (((H_i << 24) | (H_i >>> 8))  & 0xff00ff00);
18167	            }
18168
18169	            // Return final computed hash
18170	            return hash;
18171	        },
18172
18173	        clone: function () {
18174	            var clone = Hasher.clone.call(this);
18175	            clone._hash = this._hash.clone();
18176
18177	            return clone;
18178	        }
18179	    });
18180
18181	    function FF(a, b, c, d, x, s, t) {
18182	        var n = a + ((b & c) | (~b & d)) + x + t;
18183	        return ((n << s) | (n >>> (32 - s))) + b;
18184	    }
18185
18186	    function GG(a, b, c, d, x, s, t) {
18187	        var n = a + ((b & d) | (c & ~d)) + x + t;
18188	        return ((n << s) | (n >>> (32 - s))) + b;
18189	    }
18190
18191	    function HH(a, b, c, d, x, s, t) {
18192	        var n = a + (b ^ c ^ d) + x + t;
18193	        return ((n << s) | (n >>> (32 - s))) + b;
18194	    }
18195
18196	    function II(a, b, c, d, x, s, t) {
18197	        var n = a + (c ^ (b | ~d)) + x + t;
18198	        return ((n << s) | (n >>> (32 - s))) + b;
18199	    }
18200
18201	    /**
18202	     * Shortcut function to the hasher's object interface.
18203	     *
18204	     * @param {WordArray|string} message The message to hash.
18205	     *
18206	     * @return {WordArray} The hash.
18207	     *
18208	     * @static
18209	     *
18210	     * @example
18211	     *
18212	     *     var hash = CryptoJS.MD5('message');
18213	     *     var hash = CryptoJS.MD5(wordArray);
18214	     */
18215	    C.MD5 = Hasher._createHelper(MD5);
18216
18217	    /**
18218	     * Shortcut function to the HMAC's object interface.
18219	     *
18220	     * @param {WordArray|string} message The message to hash.
18221	     * @param {WordArray|string} key The secret key.
18222	     *
18223	     * @return {WordArray} The HMAC.
18224	     *
18225	     * @static
18226	     *
18227	     * @example
18228	     *
18229	     *     var hmac = CryptoJS.HmacMD5(message, key);
18230	     */
18231	    C.HmacMD5 = Hasher._createHmacHelper(MD5);
18232	}(Math));
18233
18234
18235	(function () {
18236	    // Shortcuts
18237	    var C = CryptoJS;
18238	    var C_lib = C.lib;
18239	    var WordArray = C_lib.WordArray;
18240	    var Hasher = C_lib.Hasher;
18241	    var C_algo = C.algo;
18242
18243	    // Reusable object
18244	    var W = [];
18245
18246	    /**
18247	     * SHA-1 hash algorithm.
18248	     */
18249	    var SHA1 = C_algo.SHA1 = Hasher.extend({
18250	        _doReset: function () {
18251	            this._hash = new WordArray.init([
18252	                0x67452301, 0xefcdab89,
18253	                0x98badcfe, 0x10325476,
18254	                0xc3d2e1f0
18255	            ]);
18256	        },
18257
18258	        _doProcessBlock: function (M, offset) {
18259	            // Shortcut
18260	            var H = this._hash.words;
18261
18262	            // Working variables
18263	            var a = H[0];
18264	            var b = H[1];
18265	            var c = H[2];
18266	            var d = H[3];
18267	            var e = H[4];
18268
18269	            // Computation
18270	            for (var i = 0; i < 80; i++) {
18271	                if (i < 16) {
18272	                    W[i] = M[offset + i] | 0;
18273	                } else {
18274	                    var n = W[i - 3] ^ W[i - 8] ^ W[i - 14] ^ W[i - 16];
18275	                    W[i] = (n << 1) | (n >>> 31);
18276	                }
18277
18278	                var t = ((a << 5) | (a >>> 27)) + e + W[i];
18279	                if (i < 20) {
18280	                    t += ((b & c) | (~b & d)) + 0x5a827999;
18281	                } else if (i < 40) {
18282	                    t += (b ^ c ^ d) + 0x6ed9eba1;
18283	                } else if (i < 60) {
18284	                    t += ((b & c) | (b & d) | (c & d)) - 0x70e44324;
18285	                } else /* if (i < 80) */ {
18286	                    t += (b ^ c ^ d) - 0x359d3e2a;
18287	                }
18288
18289	                e = d;
18290	                d = c;
18291	                c = (b << 30) | (b >>> 2);
18292	                b = a;
18293	                a = t;
18294	            }
18295
18296	            // Intermediate hash value
18297	            H[0] = (H[0] + a) | 0;
18298	            H[1] = (H[1] + b) | 0;
18299	            H[2] = (H[2] + c) | 0;
18300	            H[3] = (H[3] + d) | 0;
18301	            H[4] = (H[4] + e) | 0;
18302	        },
18303
18304	        _doFinalize: function () {
18305	            // Shortcuts
18306	            var data = this._data;
18307	            var dataWords = data.words;
18308
18309	            var nBitsTotal = this._nDataBytes * 8;
18310	            var nBitsLeft = data.sigBytes * 8;
18311
18312	            // Add padding
18313	            dataWords[nBitsLeft >>> 5] |= 0x80 << (24 - nBitsLeft % 32);
18314	            dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 14] = Math.floor(nBitsTotal / 0x100000000);
18315	            dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 15] = nBitsTotal;
18316	            data.sigBytes = dataWords.length * 4;
18317
18318	            // Hash final blocks
18319	            this._process();
18320
18321	            // Return final computed hash
18322	            return this._hash;
18323	        },
18324
18325	        clone: function () {
18326	            var clone = Hasher.clone.call(this);
18327	            clone._hash = this._hash.clone();
18328
18329	            return clone;
18330	        }
18331	    });
18332
18333	    /**
18334	     * Shortcut function to the hasher's object interface.
18335	     *
18336	     * @param {WordArray|string} message The message to hash.
18337	     *
18338	     * @return {WordArray} The hash.
18339	     *
18340	     * @static
18341	     *
18342	     * @example
18343	     *
18344	     *     var hash = CryptoJS.SHA1('message');
18345	     *     var hash = CryptoJS.SHA1(wordArray);
18346	     */
18347	    C.SHA1 = Hasher._createHelper(SHA1);
18348
18349	    /**
18350	     * Shortcut function to the HMAC's object interface.
18351	     *
18352	     * @param {WordArray|string} message The message to hash.
18353	     * @param {WordArray|string} key The secret key.
18354	     *
18355	     * @return {WordArray} The HMAC.
18356	     *
18357	     * @static
18358	     *
18359	     * @example
18360	     *
18361	     *     var hmac = CryptoJS.HmacSHA1(message, key);
18362	     */
18363	    C.HmacSHA1 = Hasher._createHmacHelper(SHA1);
18364	}());
18365
18366
18367	(function (Math) {
18368	    // Shortcuts
18369	    var C = CryptoJS;
18370	    var C_lib = C.lib;
18371	    var WordArray = C_lib.WordArray;
18372	    var Hasher = C_lib.Hasher;
18373	    var C_algo = C.algo;
18374
18375	    // Initialization and round constants tables
18376	    var H = [];
18377	    var K = [];
18378
18379	    // Compute constants
18380	    (function () {
18381	        function isPrime(n) {
18382	            var sqrtN = Math.sqrt(n);
18383	            for (var factor = 2; factor <= sqrtN; factor++) {
18384	                if (!(n % factor)) {
18385	                    return false;
18386	                }
18387	            }
18388
18389	            return true;
18390	        }
18391
18392	        function getFractionalBits(n) {
18393	            return ((n - (n | 0)) * 0x100000000) | 0;
18394	        }
18395
18396	        var n = 2;
18397	        var nPrime = 0;
18398	        while (nPrime < 64) {
18399	            if (isPrime(n)) {
18400	                if (nPrime < 8) {
18401	                    H[nPrime] = getFractionalBits(Math.pow(n, 1 / 2));
18402	                }
18403	                K[nPrime] = getFractionalBits(Math.pow(n, 1 / 3));
18404
18405	                nPrime++;
18406	            }
18407
18408	            n++;
18409	        }
18410	    }());
18411
18412	    // Reusable object
18413	    var W = [];
18414
18415	    /**
18416	     * SHA-256 hash algorithm.
18417	     */
18418	    var SHA256 = C_algo.SHA256 = Hasher.extend({
18419	        _doReset: function () {
18420	            this._hash = new WordArray.init(H.slice(0));
18421	        },
18422
18423	        _doProcessBlock: function (M, offset) {
18424	            // Shortcut
18425	            var H = this._hash.words;
18426
18427	            // Working variables
18428	            var a = H[0];
18429	            var b = H[1];
18430	            var c = H[2];
18431	            var d = H[3];
18432	            var e = H[4];
18433	            var f = H[5];
18434	            var g = H[6];
18435	            var h = H[7];
18436
18437	            // Computation
18438	            for (var i = 0; i < 64; i++) {
18439	                if (i < 16) {
18440	                    W[i] = M[offset + i] | 0;
18441	                } else {
18442	                    var gamma0x = W[i - 15];
18443	                    var gamma0  = ((gamma0x << 25) | (gamma0x >>> 7))  ^
18444	                                  ((gamma0x << 14) | (gamma0x >>> 18)) ^
18445	                                   (gamma0x >>> 3);
18446
18447	                    var gamma1x = W[i - 2];
18448	                    var gamma1  = ((gamma1x << 15) | (gamma1x >>> 17)) ^
18449	                                  ((gamma1x << 13) | (gamma1x >>> 19)) ^
18450	                                   (gamma1x >>> 10);
18451
18452	                    W[i] = gamma0 + W[i - 7] + gamma1 + W[i - 16];
18453	                }
18454
18455	                var ch  = (e & f) ^ (~e & g);
18456	                var maj = (a & b) ^ (a & c) ^ (b & c);
18457
18458	                var sigma0 = ((a << 30) | (a >>> 2)) ^ ((a << 19) | (a >>> 13)) ^ ((a << 10) | (a >>> 22));
18459	                var sigma1 = ((e << 26) | (e >>> 6)) ^ ((e << 21) | (e >>> 11)) ^ ((e << 7)  | (e >>> 25));
18460
18461	                var t1 = h + sigma1 + ch + K[i] + W[i];
18462	                var t2 = sigma0 + maj;
18463
18464	                h = g;
18465	                g = f;
18466	                f = e;
18467	                e = (d + t1) | 0;
18468	                d = c;
18469	                c = b;
18470	                b = a;
18471	                a = (t1 + t2) | 0;
18472	            }
18473
18474	            // Intermediate hash value
18475	            H[0] = (H[0] + a) | 0;
18476	            H[1] = (H[1] + b) | 0;
18477	            H[2] = (H[2] + c) | 0;
18478	            H[3] = (H[3] + d) | 0;
18479	            H[4] = (H[4] + e) | 0;
18480	            H[5] = (H[5] + f) | 0;
18481	            H[6] = (H[6] + g) | 0;
18482	            H[7] = (H[7] + h) | 0;
18483	        },
18484
18485	        _doFinalize: function () {
18486	            // Shortcuts
18487	            var data = this._data;
18488	            var dataWords = data.words;
18489
18490	            var nBitsTotal = this._nDataBytes * 8;
18491	            var nBitsLeft = data.sigBytes * 8;
18492
18493	            // Add padding
18494	            dataWords[nBitsLeft >>> 5] |= 0x80 << (24 - nBitsLeft % 32);
18495	            dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 14] = Math.floor(nBitsTotal / 0x100000000);
18496	            dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 15] = nBitsTotal;
18497	            data.sigBytes = dataWords.length * 4;
18498
18499	            // Hash final blocks
18500	            this._process();
18501
18502	            // Return final computed hash
18503	            return this._hash;
18504	        },
18505
18506	        clone: function () {
18507	            var clone = Hasher.clone.call(this);
18508	            clone._hash = this._hash.clone();
18509
18510	            return clone;
18511	        }
18512	    });
18513
18514	    /**
18515	     * Shortcut function to the hasher's object interface.
18516	     *
18517	     * @param {WordArray|string} message The message to hash.
18518	     *
18519	     * @return {WordArray} The hash.
18520	     *
18521	     * @static
18522	     *
18523	     * @example
18524	     *
18525	     *     var hash = CryptoJS.SHA256('message');
18526	     *     var hash = CryptoJS.SHA256(wordArray);
18527	     */
18528	    C.SHA256 = Hasher._createHelper(SHA256);
18529
18530	    /**
18531	     * Shortcut function to the HMAC's object interface.
18532	     *
18533	     * @param {WordArray|string} message The message to hash.
18534	     * @param {WordArray|string} key The secret key.
18535	     *
18536	     * @return {WordArray} The HMAC.
18537	     *
18538	     * @static
18539	     *
18540	     * @example
18541	     *
18542	     *     var hmac = CryptoJS.HmacSHA256(message, key);
18543	     */
18544	    C.HmacSHA256 = Hasher._createHmacHelper(SHA256);
18545	}(Math));
18546
18547
18548	(function () {
18549	    // Shortcuts
18550	    var C = CryptoJS;
18551	    var C_lib = C.lib;
18552	    var WordArray = C_lib.WordArray;
18553	    var C_algo = C.algo;
18554	    var SHA256 = C_algo.SHA256;
18555
18556	    /**
18557	     * SHA-224 hash algorithm.
18558	     */
18559	    var SHA224 = C_algo.SHA224 = SHA256.extend({
18560	        _doReset: function () {
18561	            this._hash = new WordArray.init([
18562	                0xc1059ed8, 0x367cd507, 0x3070dd17, 0xf70e5939,
18563	                0xffc00b31, 0x68581511, 0x64f98fa7, 0xbefa4fa4
18564	            ]);
18565	        },
18566
18567	        _doFinalize: function () {
18568	            var hash = SHA256._doFinalize.call(this);
18569
18570	            hash.sigBytes -= 4;
18571
18572	            return hash;
18573	        }
18574	    });
18575
18576	    /**
18577	     * Shortcut function to the hasher's object interface.
18578	     *
18579	     * @param {WordArray|string} message The message to hash.
18580	     *
18581	     * @return {WordArray} The hash.
18582	     *
18583	     * @static
18584	     *
18585	     * @example
18586	     *
18587	     *     var hash = CryptoJS.SHA224('message');
18588	     *     var hash = CryptoJS.SHA224(wordArray);
18589	     */
18590	    C.SHA224 = SHA256._createHelper(SHA224);
18591
18592	    /**
18593	     * Shortcut function to the HMAC's object interface.
18594	     *
18595	     * @param {WordArray|string} message The message to hash.
18596	     * @param {WordArray|string} key The secret key.
18597	     *
18598	     * @return {WordArray} The HMAC.
18599	     *
18600	     * @static
18601	     *
18602	     * @example
18603	     *
18604	     *     var hmac = CryptoJS.HmacSHA224(message, key);
18605	     */
18606	    C.HmacSHA224 = SHA256._createHmacHelper(SHA224);
18607	}());
18608
18609
18610	(function () {
18611	    // Shortcuts
18612	    var C = CryptoJS;
18613	    var C_lib = C.lib;
18614	    var Hasher = C_lib.Hasher;
18615	    var C_x64 = C.x64;
18616	    var X64Word = C_x64.Word;
18617	    var X64WordArray = C_x64.WordArray;
18618	    var C_algo = C.algo;
18619
18620	    function X64Word_create() {
18621	        return X64Word.create.apply(X64Word, arguments);
18622	    }
18623
18624	    // Constants
18625	    var K = [
18626	        X64Word_create(0x428a2f98, 0xd728ae22), X64Word_create(0x71374491, 0x23ef65cd),
18627	        X64Word_create(0xb5c0fbcf, 0xec4d3b2f), X64Word_create(0xe9b5dba5, 0x8189dbbc),
18628	        X64Word_create(0x3956c25b, 0xf348b538), X64Word_create(0x59f111f1, 0xb605d019),
18629	        X64Word_create(0x923f82a4, 0xaf194f9b), X64Word_create(0xab1c5ed5, 0xda6d8118),
18630	        X64Word_create(0xd807aa98, 0xa3030242), X64Word_create(0x12835b01, 0x45706fbe),
18631	        X64Word_create(0x243185be, 0x4ee4b28c), X64Word_create(0x550c7dc3, 0xd5ffb4e2),
18632	        X64Word_create(0x72be5d74, 0xf27b896f), X64Word_create(0x80deb1fe, 0x3b1696b1),
18633	        X64Word_create(0x9bdc06a7, 0x25c71235), X64Word_create(0xc19bf174, 0xcf692694),
18634	        X64Word_create(0xe49b69c1, 0x9ef14ad2), X64Word_create(0xefbe4786, 0x384f25e3),
18635	        X64Word_create(0x0fc19dc6, 0x8b8cd5b5), X64Word_create(0x240ca1cc, 0x77ac9c65),
18636	        X64Word_create(0x2de92c6f, 0x592b0275), X64Word_create(0x4a7484aa, 0x6ea6e483),
18637	        X64Word_create(0x5cb0a9dc, 0xbd41fbd4), X64Word_create(0x76f988da, 0x831153b5),
18638	        X64Word_create(0x983e5152, 0xee66dfab), X64Word_create(0xa831c66d, 0x2db43210),
18639	        X64Word_create(0xb00327c8, 0x98fb213f), X64Word_create(0xbf597fc7, 0xbeef0ee4),
18640	        X64Word_create(0xc6e00bf3, 0x3da88fc2), X64Word_create(0xd5a79147, 0x930aa725),
18641	        X64Word_create(0x06ca6351, 0xe003826f), X64Word_create(0x14292967, 0x0a0e6e70),
18642	        X64Word_create(0x27b70a85, 0x46d22ffc), X64Word_create(0x2e1b2138, 0x5c26c926),
18643	        X64Word_create(0x4d2c6dfc, 0x5ac42aed), X64Word_create(0x53380d13, 0x9d95b3df),
18644	        X64Word_create(0x650a7354, 0x8baf63de), X64Word_create(0x766a0abb, 0x3c77b2a8),
18645	        X64Word_create(0x81c2c92e, 0x47edaee6), X64Word_create(0x92722c85, 0x1482353b),
18646	        X64Word_create(0xa2bfe8a1, 0x4cf10364), X64Word_create(0xa81a664b, 0xbc423001),
18647	        X64Word_create(0xc24b8b70, 0xd0f89791), X64Word_create(0xc76c51a3, 0x0654be30),
18648	        X64Word_create(0xd192e819, 0xd6ef5218), X64Word_create(0xd6990624, 0x5565a910),
18649	        X64Word_create(0xf40e3585, 0x5771202a), X64Word_create(0x106aa070, 0x32bbd1b8),
18650	        X64Word_create(0x19a4c116, 0xb8d2d0c8), X64Word_create(0x1e376c08, 0x5141ab53),
18651	        X64Word_create(0x2748774c, 0xdf8eeb99), X64Word_create(0x34b0bcb5, 0xe19b48a8),
18652	        X64Word_create(0x391c0cb3, 0xc5c95a63), X64Word_create(0x4ed8aa4a, 0xe3418acb),
18653	        X64Word_create(0x5b9cca4f, 0x7763e373), X64Word_create(0x682e6ff3, 0xd6b2b8a3),
18654	        X64Word_create(0x748f82ee, 0x5defb2fc), X64Word_create(0x78a5636f, 0x43172f60),
18655	        X64Word_create(0x84c87814, 0xa1f0ab72), X64Word_create(0x8cc70208, 0x1a6439ec),
18656	        X64Word_create(0x90befffa, 0x23631e28), X64Word_create(0xa4506ceb, 0xde82bde9),
18657	        X64Word_create(0xbef9a3f7, 0xb2c67915), X64Word_create(0xc67178f2, 0xe372532b),
18658	        X64Word_create(0xca273ece, 0xea26619c), X64Word_create(0xd186b8c7, 0x21c0c207),
18659	        X64Word_create(0xeada7dd6, 0xcde0eb1e), X64Word_create(0xf57d4f7f, 0xee6ed178),
18660	        X64Word_create(0x06f067aa, 0x72176fba), X64Word_create(0x0a637dc5, 0xa2c898a6),
18661	        X64Word_create(0x113f9804, 0xbef90dae), X64Word_create(0x1b710b35, 0x131c471b),
18662	        X64Word_create(0x28db77f5, 0x23047d84), X64Word_create(0x32caab7b, 0x40c72493),
18663	        X64Word_create(0x3c9ebe0a, 0x15c9bebc), X64Word_create(0x431d67c4, 0x9c100d4c),
18664	        X64Word_create(0x4cc5d4be, 0xcb3e42b6), X64Word_create(0x597f299c, 0xfc657e2a),
18665	        X64Word_create(0x5fcb6fab, 0x3ad6faec), X64Word_create(0x6c44198c, 0x4a475817)
18666	    ];
18667
18668	    // Reusable objects
18669	    var W = [];
18670	    (function () {
18671	        for (var i = 0; i < 80; i++) {
18672	            W[i] = X64Word_create();
18673	        }
18674	    }());
18675
18676	    /**
18677	     * SHA-512 hash algorithm.
18678	     */
18679	    var SHA512 = C_algo.SHA512 = Hasher.extend({
18680	        _doReset: function () {
18681	            this._hash = new X64WordArray.init([
18682	                new X64Word.init(0x6a09e667, 0xf3bcc908), new X64Word.init(0xbb67ae85, 0x84caa73b),
18683	                new X64Word.init(0x3c6ef372, 0xfe94f82b), new X64Word.init(0xa54ff53a, 0x5f1d36f1),
18684	                new X64Word.init(0x510e527f, 0xade682d1), new X64Word.init(0x9b05688c, 0x2b3e6c1f),
18685	                new X64Word.init(0x1f83d9ab, 0xfb41bd6b), new X64Word.init(0x5be0cd19, 0x137e2179)
18686	            ]);
18687	        },
18688
18689	        _doProcessBlock: function (M, offset) {
18690	            // Shortcuts
18691	            var H = this._hash.words;
18692
18693	            var H0 = H[0];
18694	            var H1 = H[1];
18695	            var H2 = H[2];
18696	            var H3 = H[3];
18697	            var H4 = H[4];
18698	            var H5 = H[5];
18699	            var H6 = H[6];
18700	            var H7 = H[7];
18701
18702	            var H0h = H0.high;
18703	            var H0l = H0.low;
18704	            var H1h = H1.high;
18705	            var H1l = H1.low;
18706	            var H2h = H2.high;
18707	            var H2l = H2.low;
18708	            var H3h = H3.high;
18709	            var H3l = H3.low;
18710	            var H4h = H4.high;
18711	            var H4l = H4.low;
18712	            var H5h = H5.high;
18713	            var H5l = H5.low;
18714	            var H6h = H6.high;
18715	            var H6l = H6.low;
18716	            var H7h = H7.high;
18717	            var H7l = H7.low;
18718
18719	            // Working variables
18720	            var ah = H0h;
18721	            var al = H0l;
18722	            var bh = H1h;
18723	            var bl = H1l;
18724	            var ch = H2h;
18725	            var cl = H2l;
18726	            var dh = H3h;
18727	            var dl = H3l;
18728	            var eh = H4h;
18729	            var el = H4l;
18730	            var fh = H5h;
18731	            var fl = H5l;
18732	            var gh = H6h;
18733	            var gl = H6l;
18734	            var hh = H7h;
18735	            var hl = H7l;
18736
18737	            // Rounds
18738	            for (var i = 0; i < 80; i++) {
18739	                var Wil;
18740	                var Wih;
18741
18742	                // Shortcut
18743	                var Wi = W[i];
18744
18745	                // Extend message
18746	                if (i < 16) {
18747	                    Wih = Wi.high = M[offset + i * 2]     | 0;
18748	                    Wil = Wi.low  = M[offset + i * 2 + 1] | 0;
18749	                } else {
18750	                    // Gamma0
18751	                    var gamma0x  = W[i - 15];
18752	                    var gamma0xh = gamma0x.high;
18753	                    var gamma0xl = gamma0x.low;
18754	                    var gamma0h  = ((gamma0xh >>> 1) | (gamma0xl << 31)) ^ ((gamma0xh >>> 8) | (gamma0xl << 24)) ^ (gamma0xh >>> 7);
18755	                    var gamma0l  = ((gamma0xl >>> 1) | (gamma0xh << 31)) ^ ((gamma0xl >>> 8) | (gamma0xh << 24)) ^ ((gamma0xl >>> 7) | (gamma0xh << 25));
18756
18757	                    // Gamma1
18758	                    var gamma1x  = W[i - 2];
18759	                    var gamma1xh = gamma1x.high;
18760	                    var gamma1xl = gamma1x.low;
18761	                    var gamma1h  = ((gamma1xh >>> 19) | (gamma1xl << 13)) ^ ((gamma1xh << 3) | (gamma1xl >>> 29)) ^ (gamma1xh >>> 6);
18762	                    var gamma1l  = ((gamma1xl >>> 19) | (gamma1xh << 13)) ^ ((gamma1xl << 3) | (gamma1xh >>> 29)) ^ ((gamma1xl >>> 6) | (gamma1xh << 26));
18763
18764	                    // W[i] = gamma0 + W[i - 7] + gamma1 + W[i - 16]
18765	                    var Wi7  = W[i - 7];
18766	                    var Wi7h = Wi7.high;
18767	                    var Wi7l = Wi7.low;
18768
18769	                    var Wi16  = W[i - 16];
18770	                    var Wi16h = Wi16.high;
18771	                    var Wi16l = Wi16.low;
18772
18773	                    Wil = gamma0l + Wi7l;
18774	                    Wih = gamma0h + Wi7h + ((Wil >>> 0) < (gamma0l >>> 0) ? 1 : 0);
18775	                    Wil = Wil + gamma1l;
18776	                    Wih = Wih + gamma1h + ((Wil >>> 0) < (gamma1l >>> 0) ? 1 : 0);
18777	                    Wil = Wil + Wi16l;
18778	                    Wih = Wih + Wi16h + ((Wil >>> 0) < (Wi16l >>> 0) ? 1 : 0);
18779
18780	                    Wi.high = Wih;
18781	                    Wi.low  = Wil;
18782	                }
18783
18784	                var chh  = (eh & fh) ^ (~eh & gh);
18785	                var chl  = (el & fl) ^ (~el & gl);
18786	                var majh = (ah & bh) ^ (ah & ch) ^ (bh & ch);
18787	                var majl = (al & bl) ^ (al & cl) ^ (bl & cl);
18788
18789	                var sigma0h = ((ah >>> 28) | (al << 4))  ^ ((ah << 30)  | (al >>> 2)) ^ ((ah << 25) | (al >>> 7));
18790	                var sigma0l = ((al >>> 28) | (ah << 4))  ^ ((al << 30)  | (ah >>> 2)) ^ ((al << 25) | (ah >>> 7));
18791	                var sigma1h = ((eh >>> 14) | (el << 18)) ^ ((eh >>> 18) | (el << 14)) ^ ((eh << 23) | (el >>> 9));
18792	                var sigma1l = ((el >>> 14) | (eh << 18)) ^ ((el >>> 18) | (eh << 14)) ^ ((el << 23) | (eh >>> 9));
18793
18794	                // t1 = h + sigma1 + ch + K[i] + W[i]
18795	                var Ki  = K[i];
18796	                var Kih = Ki.high;
18797	                var Kil = Ki.low;
18798
18799	                var t1l = hl + sigma1l;
18800	                var t1h = hh + sigma1h + ((t1l >>> 0) < (hl >>> 0) ? 1 : 0);
18801	                var t1l = t1l + chl;
18802	                var t1h = t1h + chh + ((t1l >>> 0) < (chl >>> 0) ? 1 : 0);
18803	                var t1l = t1l + Kil;
18804	                var t1h = t1h + Kih + ((t1l >>> 0) < (Kil >>> 0) ? 1 : 0);
18805	                var t1l = t1l + Wil;
18806	                var t1h = t1h + Wih + ((t1l >>> 0) < (Wil >>> 0) ? 1 : 0);
18807
18808	                // t2 = sigma0 + maj
18809	                var t2l = sigma0l + majl;
18810	                var t2h = sigma0h + majh + ((t2l >>> 0) < (sigma0l >>> 0) ? 1 : 0);
18811
18812	                // Update working variables
18813	                hh = gh;
18814	                hl = gl;
18815	                gh = fh;
18816	                gl = fl;
18817	                fh = eh;
18818	                fl = el;
18819	                el = (dl + t1l) | 0;
18820	                eh = (dh + t1h + ((el >>> 0) < (dl >>> 0) ? 1 : 0)) | 0;
18821	                dh = ch;
18822	                dl = cl;
18823	                ch = bh;
18824	                cl = bl;
18825	                bh = ah;
18826	                bl = al;
18827	                al = (t1l + t2l) | 0;
18828	                ah = (t1h + t2h + ((al >>> 0) < (t1l >>> 0) ? 1 : 0)) | 0;
18829	            }
18830
18831	            // Intermediate hash value
18832	            H0l = H0.low  = (H0l + al);
18833	            H0.high = (H0h + ah + ((H0l >>> 0) < (al >>> 0) ? 1 : 0));
18834	            H1l = H1.low  = (H1l + bl);
18835	            H1.high = (H1h + bh + ((H1l >>> 0) < (bl >>> 0) ? 1 : 0));
18836	            H2l = H2.low  = (H2l + cl);
18837	            H2.high = (H2h + ch + ((H2l >>> 0) < (cl >>> 0) ? 1 : 0));
18838	            H3l = H3.low  = (H3l + dl);
18839	            H3.high = (H3h + dh + ((H3l >>> 0) < (dl >>> 0) ? 1 : 0));
18840	            H4l = H4.low  = (H4l + el);
18841	            H4.high = (H4h + eh + ((H4l >>> 0) < (el >>> 0) ? 1 : 0));
18842	            H5l = H5.low  = (H5l + fl);
18843	            H5.high = (H5h + fh + ((H5l >>> 0) < (fl >>> 0) ? 1 : 0));
18844	            H6l = H6.low  = (H6l + gl);
18845	            H6.high = (H6h + gh + ((H6l >>> 0) < (gl >>> 0) ? 1 : 0));
18846	            H7l = H7.low  = (H7l + hl);
18847	            H7.high = (H7h + hh + ((H7l >>> 0) < (hl >>> 0) ? 1 : 0));
18848	        },
18849
18850	        _doFinalize: function () {
18851	            // Shortcuts
18852	            var data = this._data;
18853	            var dataWords = data.words;
18854
18855	            var nBitsTotal = this._nDataBytes * 8;
18856	            var nBitsLeft = data.sigBytes * 8;
18857
18858	            // Add padding
18859	            dataWords[nBitsLeft >>> 5] |= 0x80 << (24 - nBitsLeft % 32);
18860	            dataWords[(((nBitsLeft + 128) >>> 10) << 5) + 30] = Math.floor(nBitsTotal / 0x100000000);
18861	            dataWords[(((nBitsLeft + 128) >>> 10) << 5) + 31] = nBitsTotal;
18862	            data.sigBytes = dataWords.length * 4;
18863
18864	            // Hash final blocks
18865	            this._process();
18866
18867	            // Convert hash to 32-bit word array before returning
18868	            var hash = this._hash.toX32();
18869
18870	            // Return final computed hash
18871	            return hash;
18872	        },
18873
18874	        clone: function () {
18875	            var clone = Hasher.clone.call(this);
18876	            clone._hash = this._hash.clone();
18877
18878	            return clone;
18879	        },
18880
18881	        blockSize: 1024/32
18882	    });
18883
18884	    /**
18885	     * Shortcut function to the hasher's object interface.
18886	     *
18887	     * @param {WordArray|string} message The message to hash.
18888	     *
18889	     * @return {WordArray} The hash.
18890	     *
18891	     * @static
18892	     *
18893	     * @example
18894	     *
18895	     *     var hash = CryptoJS.SHA512('message');
18896	     *     var hash = CryptoJS.SHA512(wordArray);
18897	     */
18898	    C.SHA512 = Hasher._createHelper(SHA512);
18899
18900	    /**
18901	     * Shortcut function to the HMAC's object interface.
18902	     *
18903	     * @param {WordArray|string} message The message to hash.
18904	     * @param {WordArray|string} key The secret key.
18905	     *
18906	     * @return {WordArray} The HMAC.
18907	     *
18908	     * @static
18909	     *
18910	     * @example
18911	     *
18912	     *     var hmac = CryptoJS.HmacSHA512(message, key);
18913	     */
18914	    C.HmacSHA512 = Hasher._createHmacHelper(SHA512);
18915	}());
18916
18917
18918	(function () {
18919	    // Shortcuts
18920	    var C = CryptoJS;
18921	    var C_x64 = C.x64;
18922	    var X64Word = C_x64.Word;
18923	    var X64WordArray = C_x64.WordArray;
18924	    var C_algo = C.algo;
18925	    var SHA512 = C_algo.SHA512;
18926
18927	    /**
18928	     * SHA-384 hash algorithm.
18929	     */
18930	    var SHA384 = C_algo.SHA384 = SHA512.extend({
18931	        _doReset: function () {
18932	            this._hash = new X64WordArray.init([
18933	                new X64Word.init(0xcbbb9d5d, 0xc1059ed8), new X64Word.init(0x629a292a, 0x367cd507),
18934	                new X64Word.init(0x9159015a, 0x3070dd17), new X64Word.init(0x152fecd8, 0xf70e5939),
18935	                new X64Word.init(0x67332667, 0xffc00b31), new X64Word.init(0x8eb44a87, 0x68581511),
18936	                new X64Word.init(0xdb0c2e0d, 0x64f98fa7), new X64Word.init(0x47b5481d, 0xbefa4fa4)
18937	            ]);
18938	        },
18939
18940	        _doFinalize: function () {
18941	            var hash = SHA512._doFinalize.call(this);
18942
18943	            hash.sigBytes -= 16;
18944
18945	            return hash;
18946	        }
18947	    });
18948
18949	    /**
18950	     * Shortcut function to the hasher's object interface.
18951	     *
18952	     * @param {WordArray|string} message The message to hash.
18953	     *
18954	     * @return {WordArray} The hash.
18955	     *
18956	     * @static
18957	     *
18958	     * @example
18959	     *
18960	     *     var hash = CryptoJS.SHA384('message');
18961	     *     var hash = CryptoJS.SHA384(wordArray);
18962	     */
18963	    C.SHA384 = SHA512._createHelper(SHA384);
18964
18965	    /**
18966	     * Shortcut function to the HMAC's object interface.
18967	     *
18968	     * @param {WordArray|string} message The message to hash.
18969	     * @param {WordArray|string} key The secret key.
18970	     *
18971	     * @return {WordArray} The HMAC.
18972	     *
18973	     * @static
18974	     *
18975	     * @example
18976	     *
18977	     *     var hmac = CryptoJS.HmacSHA384(message, key);
18978	     */
18979	    C.HmacSHA384 = SHA512._createHmacHelper(SHA384);
18980	}());
18981
18982
18983	(function (Math) {
18984	    // Shortcuts
18985	    var C = CryptoJS;
18986	    var C_lib = C.lib;
18987	    var WordArray = C_lib.WordArray;
18988	    var Hasher = C_lib.Hasher;
18989	    var C_x64 = C.x64;
18990	    var X64Word = C_x64.Word;
18991	    var C_algo = C.algo;
18992
18993	    // Constants tables
18994	    var RHO_OFFSETS = [];
18995	    var PI_INDEXES  = [];
18996	    var ROUND_CONSTANTS = [];
18997
18998	    // Compute Constants
18999	    (function () {
19000	        // Compute rho offset constants
19001	        var x = 1, y = 0;
19002	        for (var t = 0; t < 24; t++) {
19003	            RHO_OFFSETS[x + 5 * y] = ((t + 1) * (t + 2) / 2) % 64;
19004
19005	            var newX = y % 5;
19006	            var newY = (2 * x + 3 * y) % 5;
19007	            x = newX;
19008	            y = newY;
19009	        }
19010
19011	        // Compute pi index constants
19012	        for (var x = 0; x < 5; x++) {
19013	            for (var y = 0; y < 5; y++) {
19014	                PI_INDEXES[x + 5 * y] = y + ((2 * x + 3 * y) % 5) * 5;
19015	            }
19016	        }
19017
19018	        // Compute round constants
19019	        var LFSR = 0x01;
19020	        for (var i = 0; i < 24; i++) {
19021	            var roundConstantMsw = 0;
19022	            var roundConstantLsw = 0;
19023
19024	            for (var j = 0; j < 7; j++) {
19025	                if (LFSR & 0x01) {
19026	                    var bitPosition = (1 << j) - 1;
19027	                    if (bitPosition < 32) {
19028	                        roundConstantLsw ^= 1 << bitPosition;
19029	                    } else /* if (bitPosition >= 32) */ {
19030	                        roundConstantMsw ^= 1 << (bitPosition - 32);
19031	                    }
19032	                }
19033
19034	                // Compute next LFSR
19035	                if (LFSR & 0x80) {
19036	                    // Primitive polynomial over GF(2): x^8 + x^6 + x^5 + x^4 + 1
19037	                    LFSR = (LFSR << 1) ^ 0x71;
19038	                } else {
19039	                    LFSR <<= 1;
19040	                }
19041	            }
19042
19043	            ROUND_CONSTANTS[i] = X64Word.create(roundConstantMsw, roundConstantLsw);
19044	        }
19045	    }());
19046
19047	    // Reusable objects for temporary values
19048	    var T = [];
19049	    (function () {
19050	        for (var i = 0; i < 25; i++) {
19051	            T[i] = X64Word.create();
19052	        }
19053	    }());
19054
19055	    /**
19056	     * SHA-3 hash algorithm.
19057	     */
19058	    var SHA3 = C_algo.SHA3 = Hasher.extend({
19059	        /**
19060	         * Configuration options.
19061	         *
19062	         * @property {number} outputLength
19063	         *   The desired number of bits in the output hash.
19064	         *   Only values permitted are: 224, 256, 384, 512.
19065	         *   Default: 512
19066	         */
19067	        cfg: Hasher.cfg.extend({
19068	            outputLength: 512
19069	        }),
19070
19071	        _doReset: function () {
19072	            var state = this._state = []
19073	            for (var i = 0; i < 25; i++) {
19074	                state[i] = new X64Word.init();
19075	            }
19076
19077	            this.blockSize = (1600 - 2 * this.cfg.outputLength) / 32;
19078	        },
19079
19080	        _doProcessBlock: function (M, offset) {
19081	            // Shortcuts
19082	            var state = this._state;
19083	            var nBlockSizeLanes = this.blockSize / 2;
19084
19085	            // Absorb
19086	            for (var i = 0; i < nBlockSizeLanes; i++) {
19087	                // Shortcuts
19088	                var M2i  = M[offset + 2 * i];
19089	                var M2i1 = M[offset + 2 * i + 1];
19090
19091	                // Swap endian
19092	                M2i = (
19093	                    (((M2i << 8)  | (M2i >>> 24)) & 0x00ff00ff) |
19094	                    (((M2i << 24) | (M2i >>> 8))  & 0xff00ff00)
19095	                );
19096	                M2i1 = (
19097	                    (((M2i1 << 8)  | (M2i1 >>> 24)) & 0x00ff00ff) |
19098	                    (((M2i1 << 24) | (M2i1 >>> 8))  & 0xff00ff00)
19099	                );
19100
19101	                // Absorb message into state
19102	                var lane = state[i];
19103	                lane.high ^= M2i1;
19104	                lane.low  ^= M2i;
19105	            }
19106
19107	            // Rounds
19108	            for (var round = 0; round < 24; round++) {
19109	                // Theta
19110	                for (var x = 0; x < 5; x++) {
19111	                    // Mix column lanes
19112	                    var tMsw = 0, tLsw = 0;
19113	                    for (var y = 0; y < 5; y++) {
19114	                        var lane = state[x + 5 * y];
19115	                        tMsw ^= lane.high;
19116	                        tLsw ^= lane.low;
19117	                    }
19118
19119	                    // Temporary values
19120	                    var Tx = T[x];
19121	                    Tx.high = tMsw;
19122	                    Tx.low  = tLsw;
19123	                }
19124	                for (var x = 0; x < 5; x++) {
19125	                    // Shortcuts
19126	                    var Tx4 = T[(x + 4) % 5];
19127	                    var Tx1 = T[(x + 1) % 5];
19128	                    var Tx1Msw = Tx1.high;
19129	                    var Tx1Lsw = Tx1.low;
19130
19131	                    // Mix surrounding columns
19132	                    var tMsw = Tx4.high ^ ((Tx1Msw << 1) | (Tx1Lsw >>> 31));
19133	                    var tLsw = Tx4.low  ^ ((Tx1Lsw << 1) | (Tx1Msw >>> 31));
19134	                    for (var y = 0; y < 5; y++) {
19135	                        var lane = state[x + 5 * y];
19136	                        lane.high ^= tMsw;
19137	                        lane.low  ^= tLsw;
19138	                    }
19139	                }
19140
19141	                // Rho Pi
19142	                for (var laneIndex = 1; laneIndex < 25; laneIndex++) {
19143	                    var tMsw;
19144	                    var tLsw;
19145
19146	                    // Shortcuts
19147	                    var lane = state[laneIndex];
19148	                    var laneMsw = lane.high;
19149	                    var laneLsw = lane.low;
19150	                    var rhoOffset = RHO_OFFSETS[laneIndex];
19151
19152	                    // Rotate lanes
19153	                    if (rhoOffset < 32) {
19154	                        tMsw = (laneMsw << rhoOffset) | (laneLsw >>> (32 - rhoOffset));
19155	                        tLsw = (laneLsw << rhoOffset) | (laneMsw >>> (32 - rhoOffset));
19156	                    } else /* if (rhoOffset >= 32) */ {
19157	                        tMsw = (laneLsw << (rhoOffset - 32)) | (laneMsw >>> (64 - rhoOffset));
19158	                        tLsw = (laneMsw << (rhoOffset - 32)) | (laneLsw >>> (64 - rhoOffset));
19159	                    }
19160
19161	                    // Transpose lanes
19162	                    var TPiLane = T[PI_INDEXES[laneIndex]];
19163	                    TPiLane.high = tMsw;
19164	                    TPiLane.low  = tLsw;
19165	                }
19166
19167	                // Rho pi at x = y = 0
19168	                var T0 = T[0];
19169	                var state0 = state[0];
19170	                T0.high = state0.high;
19171	                T0.low  = state0.low;
19172
19173	                // Chi
19174	                for (var x = 0; x < 5; x++) {
19175	                    for (var y = 0; y < 5; y++) {
19176	                        // Shortcuts
19177	                        var laneIndex = x + 5 * y;
19178	                        var lane = state[laneIndex];
19179	                        var TLane = T[laneIndex];
19180	                        var Tx1Lane = T[((x + 1) % 5) + 5 * y];
19181	                        var Tx2Lane = T[((x + 2) % 5) + 5 * y];
19182
19183	                        // Mix rows
19184	                        lane.high = TLane.high ^ (~Tx1Lane.high & Tx2Lane.high);
19185	                        lane.low  = TLane.low  ^ (~Tx1Lane.low  & Tx2Lane.low);
19186	                    }
19187	                }
19188
19189	                // Iota
19190	                var lane = state[0];
19191	                var roundConstant = ROUND_CONSTANTS[round];
19192	                lane.high ^= roundConstant.high;
19193	                lane.low  ^= roundConstant.low;
19194	            }
19195	        },
19196
19197	        _doFinalize: function () {
19198	            // Shortcuts
19199	            var data = this._data;
19200	            var dataWords = data.words;
19201	            var nBitsTotal = this._nDataBytes * 8;
19202	            var nBitsLeft = data.sigBytes * 8;
19203	            var blockSizeBits = this.blockSize * 32;
19204
19205	            // Add padding
19206	            dataWords[nBitsLeft >>> 5] |= 0x1 << (24 - nBitsLeft % 32);
19207	            dataWords[((Math.ceil((nBitsLeft + 1) / blockSizeBits) * blockSizeBits) >>> 5) - 1] |= 0x80;
19208	            data.sigBytes = dataWords.length * 4;
19209
19210	            // Hash final blocks
19211	            this._process();
19212
19213	            // Shortcuts
19214	            var state = this._state;
19215	            var outputLengthBytes = this.cfg.outputLength / 8;
19216	            var outputLengthLanes = outputLengthBytes / 8;
19217
19218	            // Squeeze
19219	            var hashWords = [];
19220	            for (var i = 0; i < outputLengthLanes; i++) {
19221	                // Shortcuts
19222	                var lane = state[i];
19223	                var laneMsw = lane.high;
19224	                var laneLsw = lane.low;
19225
19226	                // Swap endian
19227	                laneMsw = (
19228	                    (((laneMsw << 8)  | (laneMsw >>> 24)) & 0x00ff00ff) |
19229	                    (((laneMsw << 24) | (laneMsw >>> 8))  & 0xff00ff00)
19230	                );
19231	                laneLsw = (
19232	                    (((laneLsw << 8)  | (laneLsw >>> 24)) & 0x00ff00ff) |
19233	                    (((laneLsw << 24) | (laneLsw >>> 8))  & 0xff00ff00)
19234	                );
19235
19236	                // Squeeze state to retrieve hash
19237	                hashWords.push(laneLsw);
19238	                hashWords.push(laneMsw);
19239	            }
19240
19241	            // Return final computed hash
19242	            return new WordArray.init(hashWords, outputLengthBytes);
19243	        },
19244
19245	        clone: function () {
19246	            var clone = Hasher.clone.call(this);
19247
19248	            var state = clone._state = this._state.slice(0);
19249	            for (var i = 0; i < 25; i++) {
19250	                state[i] = state[i].clone();
19251	            }
19252
19253	            return clone;
19254	        }
19255	    });
19256
19257	    /**
19258	     * Shortcut function to the hasher's object interface.
19259	     *
19260	     * @param {WordArray|string} message The message to hash.
19261	     *
19262	     * @return {WordArray} The hash.
19263	     *
19264	     * @static
19265	     *
19266	     * @example
19267	     *
19268	     *     var hash = CryptoJS.SHA3('message');
19269	     *     var hash = CryptoJS.SHA3(wordArray);
19270	     */
19271	    C.SHA3 = Hasher._createHelper(SHA3);
19272
19273	    /**
19274	     * Shortcut function to the HMAC's object interface.
19275	     *
19276	     * @param {WordArray|string} message The message to hash.
19277	     * @param {WordArray|string} key The secret key.
19278	     *
19279	     * @return {WordArray} The HMAC.
19280	     *
19281	     * @static
19282	     *
19283	     * @example
19284	     *
19285	     *     var hmac = CryptoJS.HmacSHA3(message, key);
19286	     */
19287	    C.HmacSHA3 = Hasher._createHmacHelper(SHA3);
19288	}(Math));
19289
19290
19291	/** @preserve
19292	(c) 2012 by Cédric Mesnil. All rights reserved.
19293
19294	Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
19295
19296	    - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
19297	    - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
19298
19299	THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
19300	*/
19301
19302	(function (Math) {
19303	    // Shortcuts
19304	    var C = CryptoJS;
19305	    var C_lib = C.lib;
19306	    var WordArray = C_lib.WordArray;
19307	    var Hasher = C_lib.Hasher;
19308	    var C_algo = C.algo;
19309
19310	    // Constants table
19311	    var _zl = WordArray.create([
19312	        0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 14, 15,
19313	        7,  4, 13,  1, 10,  6, 15,  3, 12,  0,  9,  5,  2, 14, 11,  8,
19314	        3, 10, 14,  4,  9, 15,  8,  1,  2,  7,  0,  6, 13, 11,  5, 12,
19315	        1,  9, 11, 10,  0,  8, 12,  4, 13,  3,  7, 15, 14,  5,  6,  2,
19316	        4,  0,  5,  9,  7, 12,  2, 10, 14,  1,  3,  8, 11,  6, 15, 13]);
19317	    var _zr = WordArray.create([
19318	        5, 14,  7,  0,  9,  2, 11,  4, 13,  6, 15,  8,  1, 10,  3, 12,
19319	        6, 11,  3,  7,  0, 13,  5, 10, 14, 15,  8, 12,  4,  9,  1,  2,
19320	        15,  5,  1,  3,  7, 14,  6,  9, 11,  8, 12,  2, 10,  0,  4, 13,
19321	        8,  6,  4,  1,  3, 11, 15,  0,  5, 12,  2, 13,  9,  7, 10, 14,
19322	        12, 15, 10,  4,  1,  5,  8,  7,  6,  2, 13, 14,  0,  3,  9, 11]);
19323	    var _sl = WordArray.create([
19324	         11, 14, 15, 12,  5,  8,  7,  9, 11, 13, 14, 15,  6,  7,  9,  8,
19325	        7, 6,   8, 13, 11,  9,  7, 15,  7, 12, 15,  9, 11,  7, 13, 12,
19326	        11, 13,  6,  7, 14,  9, 13, 15, 14,  8, 13,  6,  5, 12,  7,  5,
19327	          11, 12, 14, 15, 14, 15,  9,  8,  9, 14,  5,  6,  8,  6,  5, 12,
19328	        9, 15,  5, 11,  6,  8, 13, 12,  5, 12, 13, 14, 11,  8,  5,  6 ]);
19329	    var _sr = WordArray.create([
19330	        8,  9,  9, 11, 13, 15, 15,  5,  7,  7,  8, 11, 14, 14, 12,  6,
19331	        9, 13, 15,  7, 12,  8,  9, 11,  7,  7, 12,  7,  6, 15, 13, 11,
19332	        9,  7, 15, 11,  8,  6,  6, 14, 12, 13,  5, 14, 13, 13,  7,  5,
19333	        15,  5,  8, 11, 14, 14,  6, 14,  6,  9, 12,  9, 12,  5, 15,  8,
19334	        8,  5, 12,  9, 12,  5, 14,  6,  8, 13,  6,  5, 15, 13, 11, 11 ]);
19335
19336	    var _hl =  WordArray.create([ 0x00000000, 0x5A827999, 0x6ED9EBA1, 0x8F1BBCDC, 0xA953FD4E]);
19337	    var _hr =  WordArray.create([ 0x50A28BE6, 0x5C4DD124, 0x6D703EF3, 0x7A6D76E9, 0x00000000]);
19338
19339	    /**
19340	     * RIPEMD160 hash algorithm.
19341	     */
19342	    var RIPEMD160 = C_algo.RIPEMD160 = Hasher.extend({
19343	        _doReset: function () {
19344	            this._hash  = WordArray.create([0x67452301, 0xEFCDAB89, 0x98BADCFE, 0x10325476, 0xC3D2E1F0]);
19345	        },
19346
19347	        _doProcessBlock: function (M, offset) {
19348
19349	            // Swap endian
19350	            for (var i = 0; i < 16; i++) {
19351	                // Shortcuts
19352	                var offset_i = offset + i;
19353	                var M_offset_i = M[offset_i];
19354
19355	                // Swap
19356	                M[offset_i] = (
19357	                    (((M_offset_i << 8)  | (M_offset_i >>> 24)) & 0x00ff00ff) |
19358	                    (((M_offset_i << 24) | (M_offset_i >>> 8))  & 0xff00ff00)
19359	                );
19360	            }
19361	            // Shortcut
19362	            var H  = this._hash.words;
19363	            var hl = _hl.words;
19364	            var hr = _hr.words;
19365	            var zl = _zl.words;
19366	            var zr = _zr.words;
19367	            var sl = _sl.words;
19368	            var sr = _sr.words;
19369
19370	            // Working variables
19371	            var al, bl, cl, dl, el;
19372	            var ar, br, cr, dr, er;
19373
19374	            ar = al = H[0];
19375	            br = bl = H[1];
19376	            cr = cl = H[2];
19377	            dr = dl = H[3];
19378	            er = el = H[4];
19379	            // Computation
19380	            var t;
19381	            for (var i = 0; i < 80; i += 1) {
19382	                t = (al +  M[offset+zl[i]])|0;
19383	                if (i<16){
19384		            t +=  f1(bl,cl,dl) + hl[0];
19385	                } else if (i<32) {
19386		            t +=  f2(bl,cl,dl) + hl[1];
19387	                } else if (i<48) {
19388		            t +=  f3(bl,cl,dl) + hl[2];
19389	                } else if (i<64) {
19390		            t +=  f4(bl,cl,dl) + hl[3];
19391	                } else {// if (i<80) {
19392		            t +=  f5(bl,cl,dl) + hl[4];
19393	                }
19394	                t = t|0;
19395	                t =  rotl(t,sl[i]);
19396	                t = (t+el)|0;
19397	                al = el;
19398	                el = dl;
19399	                dl = rotl(cl, 10);
19400	                cl = bl;
19401	                bl = t;
19402
19403	                t = (ar + M[offset+zr[i]])|0;
19404	                if (i<16){
19405		            t +=  f5(br,cr,dr) + hr[0];
19406	                } else if (i<32) {
19407		            t +=  f4(br,cr,dr) + hr[1];
19408	                } else if (i<48) {
19409		            t +=  f3(br,cr,dr) + hr[2];
19410	                } else if (i<64) {
19411		            t +=  f2(br,cr,dr) + hr[3];
19412	                } else {// if (i<80) {
19413		            t +=  f1(br,cr,dr) + hr[4];
19414	                }
19415	                t = t|0;
19416	                t =  rotl(t,sr[i]) ;
19417	                t = (t+er)|0;
19418	                ar = er;
19419	                er = dr;
19420	                dr = rotl(cr, 10);
19421	                cr = br;
19422	                br = t;
19423	            }
19424	            // Intermediate hash value
19425	            t    = (H[1] + cl + dr)|0;
19426	            H[1] = (H[2] + dl + er)|0;
19427	            H[2] = (H[3] + el + ar)|0;
19428	            H[3] = (H[4] + al + br)|0;
19429	            H[4] = (H[0] + bl + cr)|0;
19430	            H[0] =  t;
19431	        },
19432
19433	        _doFinalize: function () {
19434	            // Shortcuts
19435	            var data = this._data;
19436	            var dataWords = data.words;
19437
19438	            var nBitsTotal = this._nDataBytes * 8;
19439	            var nBitsLeft = data.sigBytes * 8;
19440
19441	            // Add padding
19442	            dataWords[nBitsLeft >>> 5] |= 0x80 << (24 - nBitsLeft % 32);
19443	            dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 14] = (
19444	                (((nBitsTotal << 8)  | (nBitsTotal >>> 24)) & 0x00ff00ff) |
19445	                (((nBitsTotal << 24) | (nBitsTotal >>> 8))  & 0xff00ff00)
19446	            );
19447	            data.sigBytes = (dataWords.length + 1) * 4;
19448
19449	            // Hash final blocks
19450	            this._process();
19451
19452	            // Shortcuts
19453	            var hash = this._hash;
19454	            var H = hash.words;
19455
19456	            // Swap endian
19457	            for (var i = 0; i < 5; i++) {
19458	                // Shortcut
19459	                var H_i = H[i];
19460
19461	                // Swap
19462	                H[i] = (((H_i << 8)  | (H_i >>> 24)) & 0x00ff00ff) |
19463	                       (((H_i << 24) | (H_i >>> 8))  & 0xff00ff00);
19464	            }
19465
19466	            // Return final computed hash
19467	            return hash;
19468	        },
19469
19470	        clone: function () {
19471	            var clone = Hasher.clone.call(this);
19472	            clone._hash = this._hash.clone();
19473
19474	            return clone;
19475	        }
19476	    });
19477
19478
19479	    function f1(x, y, z) {
19480	        return ((x) ^ (y) ^ (z));
19481
19482	    }
19483
19484	    function f2(x, y, z) {
19485	        return (((x)&(y)) | ((~x)&(z)));
19486	    }
19487
19488	    function f3(x, y, z) {
19489	        return (((x) | (~(y))) ^ (z));
19490	    }
19491
19492	    function f4(x, y, z) {
19493	        return (((x) & (z)) | ((y)&(~(z))));
19494	    }
19495
19496	    function f5(x, y, z) {
19497	        return ((x) ^ ((y) |(~(z))));
19498
19499	    }
19500
19501	    function rotl(x,n) {
19502	        return (x<<n) | (x>>>(32-n));
19503	    }
19504
19505
19506	    /**
19507	     * Shortcut function to the hasher's object interface.
19508	     *
19509	     * @param {WordArray|string} message The message to hash.
19510	     *
19511	     * @return {WordArray} The hash.
19512	     *
19513	     * @static
19514	     *
19515	     * @example
19516	     *
19517	     *     var hash = CryptoJS.RIPEMD160('message');
19518	     *     var hash = CryptoJS.RIPEMD160(wordArray);
19519	     */
19520	    C.RIPEMD160 = Hasher._createHelper(RIPEMD160);
19521
19522	    /**
19523	     * Shortcut function to the HMAC's object interface.
19524	     *
19525	     * @param {WordArray|string} message The message to hash.
19526	     * @param {WordArray|string} key The secret key.
19527	     *
19528	     * @return {WordArray} The HMAC.
19529	     *
19530	     * @static
19531	     *
19532	     * @example
19533	     *
19534	     *     var hmac = CryptoJS.HmacRIPEMD160(message, key);
19535	     */
19536	    C.HmacRIPEMD160 = Hasher._createHmacHelper(RIPEMD160);
19537	}(Math));
19538
19539
19540	(function () {
19541	    // Shortcuts
19542	    var C = CryptoJS;
19543	    var C_lib = C.lib;
19544	    var Base = C_lib.Base;
19545	    var C_enc = C.enc;
19546	    var Utf8 = C_enc.Utf8;
19547	    var C_algo = C.algo;
19548
19549	    /**
19550	     * HMAC algorithm.
19551	     */
19552	    var HMAC = C_algo.HMAC = Base.extend({
19553	        /**
19554	         * Initializes a newly created HMAC.
19555	         *
19556	         * @param {Hasher} hasher The hash algorithm to use.
19557	         * @param {WordArray|string} key The secret key.
19558	         *
19559	         * @example
19560	         *
19561	         *     var hmacHasher = CryptoJS.algo.HMAC.create(CryptoJS.algo.SHA256, key);
19562	         */
19563	        init: function (hasher, key) {
19564	            // Init hasher
19565	            hasher = this._hasher = new hasher.init();
19566
19567	            // Convert string to WordArray, else assume WordArray already
19568	            if (typeof key == 'string') {
19569	                key = Utf8.parse(key);
19570	            }
19571
19572	            // Shortcuts
19573	            var hasherBlockSize = hasher.blockSize;
19574	            var hasherBlockSizeBytes = hasherBlockSize * 4;
19575
19576	            // Allow arbitrary length keys
19577	            if (key.sigBytes > hasherBlockSizeBytes) {
19578	                key = hasher.finalize(key);
19579	            }
19580
19581	            // Clamp excess bits
19582	            key.clamp();
19583
19584	            // Clone key for inner and outer pads
19585	            var oKey = this._oKey = key.clone();
19586	            var iKey = this._iKey = key.clone();
19587
19588	            // Shortcuts
19589	            var oKeyWords = oKey.words;
19590	            var iKeyWords = iKey.words;
19591
19592	            // XOR keys with pad constants
19593	            for (var i = 0; i < hasherBlockSize; i++) {
19594	                oKeyWords[i] ^= 0x5c5c5c5c;
19595	                iKeyWords[i] ^= 0x36363636;
19596	            }
19597	            oKey.sigBytes = iKey.sigBytes = hasherBlockSizeBytes;
19598
19599	            // Set initial values
19600	            this.reset();
19601	        },
19602
19603	        /**
19604	         * Resets this HMAC to its initial state.
19605	         *
19606	         * @example
19607	         *
19608	         *     hmacHasher.reset();
19609	         */
19610	        reset: function () {
19611	            // Shortcut
19612	            var hasher = this._hasher;
19613
19614	            // Reset
19615	            hasher.reset();
19616	            hasher.update(this._iKey);
19617	        },
19618
19619	        /**
19620	         * Updates this HMAC with a message.
19621	         *
19622	         * @param {WordArray|string} messageUpdate The message to append.
19623	         *
19624	         * @return {HMAC} This HMAC instance.
19625	         *
19626	         * @example
19627	         *
19628	         *     hmacHasher.update('message');
19629	         *     hmacHasher.update(wordArray);
19630	         */
19631	        update: function (messageUpdate) {
19632	            this._hasher.update(messageUpdate);
19633
19634	            // Chainable
19635	            return this;
19636	        },
19637
19638	        /**
19639	         * Finalizes the HMAC computation.
19640	         * Note that the finalize operation is effectively a destructive, read-once operation.
19641	         *
19642	         * @param {WordArray|string} messageUpdate (Optional) A final message update.
19643	         *
19644	         * @return {WordArray} The HMAC.
19645	         *
19646	         * @example
19647	         *
19648	         *     var hmac = hmacHasher.finalize();
19649	         *     var hmac = hmacHasher.finalize('message');
19650	         *     var hmac = hmacHasher.finalize(wordArray);
19651	         */
19652	        finalize: function (messageUpdate) {
19653	            // Shortcut
19654	            var hasher = this._hasher;
19655
19656	            // Compute HMAC
19657	            var innerHash = hasher.finalize(messageUpdate);
19658	            hasher.reset();
19659	            var hmac = hasher.finalize(this._oKey.clone().concat(innerHash));
19660
19661	            return hmac;
19662	        }
19663	    });
19664	}());
19665
19666
19667	(function () {
19668	    // Shortcuts
19669	    var C = CryptoJS;
19670	    var C_lib = C.lib;
19671	    var Base = C_lib.Base;
19672	    var WordArray = C_lib.WordArray;
19673	    var C_algo = C.algo;
19674	    var SHA256 = C_algo.SHA256;
19675	    var HMAC = C_algo.HMAC;
19676
19677	    /**
19678	     * Password-Based Key Derivation Function 2 algorithm.
19679	     */
19680	    var PBKDF2 = C_algo.PBKDF2 = Base.extend({
19681	        /**
19682	         * Configuration options.
19683	         *
19684	         * @property {number} keySize The key size in words to generate. Default: 4 (128 bits)
19685	         * @property {Hasher} hasher The hasher to use. Default: SHA256
19686	         * @property {number} iterations The number of iterations to perform. Default: 250000
19687	         */
19688	        cfg: Base.extend({
19689	            keySize: 128/32,
19690	            hasher: SHA256,
19691	            iterations: 250000
19692	        }),
19693
19694	        /**
19695	         * Initializes a newly created key derivation function.
19696	         *
19697	         * @param {Object} cfg (Optional) The configuration options to use for the derivation.
19698	         *
19699	         * @example
19700	         *
19701	         *     var kdf = CryptoJS.algo.PBKDF2.create();
19702	         *     var kdf = CryptoJS.algo.PBKDF2.create({ keySize: 8 });
19703	         *     var kdf = CryptoJS.algo.PBKDF2.create({ keySize: 8, iterations: 1000 });
19704	         */
19705	        init: function (cfg) {
19706	            this.cfg = this.cfg.extend(cfg);
19707	        },
19708
19709	        /**
19710	         * Computes the Password-Based Key Derivation Function 2.
19711	         *
19712	         * @param {WordArray|string} password The password.
19713	         * @param {WordArray|string} salt A salt.
19714	         *
19715	         * @return {WordArray} The derived key.
19716	         *
19717	         * @example
19718	         *
19719	         *     var key = kdf.compute(password, salt);
19720	         */
19721	        compute: function (password, salt) {
19722	            // Shortcut
19723	            var cfg = this.cfg;
19724
19725	            // Init HMAC
19726	            var hmac = HMAC.create(cfg.hasher, password);
19727
19728	            // Initial values
19729	            var derivedKey = WordArray.create();
19730	            var blockIndex = WordArray.create([0x00000001]);
19731
19732	            // Shortcuts
19733	            var derivedKeyWords = derivedKey.words;
19734	            var blockIndexWords = blockIndex.words;
19735	            var keySize = cfg.keySize;
19736	            var iterations = cfg.iterations;
19737
19738	            // Generate key
19739	            while (derivedKeyWords.length < keySize) {
19740	                var block = hmac.update(salt).finalize(blockIndex);
19741	                hmac.reset();
19742
19743	                // Shortcuts
19744	                var blockWords = block.words;
19745	                var blockWordsLength = blockWords.length;
19746
19747	                // Iterations
19748	                var intermediate = block;
19749	                for (var i = 1; i < iterations; i++) {
19750	                    intermediate = hmac.finalize(intermediate);
19751	                    hmac.reset();
19752
19753	                    // Shortcut
19754	                    var intermediateWords = intermediate.words;
19755
19756	                    // XOR intermediate with block
19757	                    for (var j = 0; j < blockWordsLength; j++) {
19758	                        blockWords[j] ^= intermediateWords[j];
19759	                    }
19760	                }
19761
19762	                derivedKey.concat(block);
19763	                blockIndexWords[0]++;
19764	            }
19765	            derivedKey.sigBytes = keySize * 4;
19766
19767	            return derivedKey;
19768	        }
19769	    });
19770
19771	    /**
19772	     * Computes the Password-Based Key Derivation Function 2.
19773	     *
19774	     * @param {WordArray|string} password The password.
19775	     * @param {WordArray|string} salt A salt.
19776	     * @param {Object} cfg (Optional) The configuration options to use for this computation.
19777	     *
19778	     * @return {WordArray} The derived key.
19779	     *
19780	     * @static
19781	     *
19782	     * @example
19783	     *
19784	     *     var key = CryptoJS.PBKDF2(password, salt);
19785	     *     var key = CryptoJS.PBKDF2(password, salt, { keySize: 8 });
19786	     *     var key = CryptoJS.PBKDF2(password, salt, { keySize: 8, iterations: 1000 });
19787	     */
19788	    C.PBKDF2 = function (password, salt, cfg) {
19789	        return PBKDF2.create(cfg).compute(password, salt);
19790	    };
19791	}());
19792
19793
19794	(function () {
19795	    // Shortcuts
19796	    var C = CryptoJS;
19797	    var C_lib = C.lib;
19798	    var Base = C_lib.Base;
19799	    var WordArray = C_lib.WordArray;
19800	    var C_algo = C.algo;
19801	    var MD5 = C_algo.MD5;
19802
19803	    /**
19804	     * This key derivation function is meant to conform with EVP_BytesToKey.
19805	     * www.openssl.org/docs/crypto/EVP_BytesToKey.html
19806	     */
19807	    var EvpKDF = C_algo.EvpKDF = Base.extend({
19808	        /**
19809	         * Configuration options.
19810	         *
19811	         * @property {number} keySize The key size in words to generate. Default: 4 (128 bits)
19812	         * @property {Hasher} hasher The hash algorithm to use. Default: MD5
19813	         * @property {number} iterations The number of iterations to perform. Default: 1
19814	         */
19815	        cfg: Base.extend({
19816	            keySize: 128/32,
19817	            hasher: MD5,
19818	            iterations: 1
19819	        }),
19820
19821	        /**
19822	         * Initializes a newly created key derivation function.
19823	         *
19824	         * @param {Object} cfg (Optional) The configuration options to use for the derivation.
19825	         *
19826	         * @example
19827	         *
19828	         *     var kdf = CryptoJS.algo.EvpKDF.create();
19829	         *     var kdf = CryptoJS.algo.EvpKDF.create({ keySize: 8 });
19830	         *     var kdf = CryptoJS.algo.EvpKDF.create({ keySize: 8, iterations: 1000 });
19831	         */
19832	        init: function (cfg) {
19833	            this.cfg = this.cfg.extend(cfg);
19834	        },
19835
19836	        /**
19837	         * Derives a key from a password.
19838	         *
19839	         * @param {WordArray|string} password The password.
19840	         * @param {WordArray|string} salt A salt.
19841	         *
19842	         * @return {WordArray} The derived key.
19843	         *
19844	         * @example
19845	         *
19846	         *     var key = kdf.compute(password, salt);
19847	         */
19848	        compute: function (password, salt) {
19849	            var block;
19850
19851	            // Shortcut
19852	            var cfg = this.cfg;
19853
19854	            // Init hasher
19855	            var hasher = cfg.hasher.create();
19856
19857	            // Initial values
19858	            var derivedKey = WordArray.create();
19859
19860	            // Shortcuts
19861	            var derivedKeyWords = derivedKey.words;
19862	            var keySize = cfg.keySize;
19863	            var iterations = cfg.iterations;
19864
19865	            // Generate key
19866	            while (derivedKeyWords.length < keySize) {
19867	                if (block) {
19868	                    hasher.update(block);
19869	                }
19870	                block = hasher.update(password).finalize(salt);
19871	                hasher.reset();
19872
19873	                // Iterations
19874	                for (var i = 1; i < iterations; i++) {
19875	                    block = hasher.finalize(block);
19876	                    hasher.reset();
19877	                }
19878
19879	                derivedKey.concat(block);
19880	            }
19881	            derivedKey.sigBytes = keySize * 4;
19882
19883	            return derivedKey;
19884	        }
19885	    });
19886
19887	    /**
19888	     * Derives a key from a password.
19889	     *
19890	     * @param {WordArray|string} password The password.
19891	     * @param {WordArray|string} salt A salt.
19892	     * @param {Object} cfg (Optional) The configuration options to use for this computation.
19893	     *
19894	     * @return {WordArray} The derived key.
19895	     *
19896	     * @static
19897	     *
19898	     * @example
19899	     *
19900	     *     var key = CryptoJS.EvpKDF(password, salt);
19901	     *     var key = CryptoJS.EvpKDF(password, salt, { keySize: 8 });
19902	     *     var key = CryptoJS.EvpKDF(password, salt, { keySize: 8, iterations: 1000 });
19903	     */
19904	    C.EvpKDF = function (password, salt, cfg) {
19905	        return EvpKDF.create(cfg).compute(password, salt);
19906	    };
19907	}());
19908
19909
19910	/**
19911	 * Cipher core components.
19912	 */
19913	CryptoJS.lib.Cipher || (function (undefined) {
19914	    // Shortcuts
19915	    var C = CryptoJS;
19916	    var C_lib = C.lib;
19917	    var Base = C_lib.Base;
19918	    var WordArray = C_lib.WordArray;
19919	    var BufferedBlockAlgorithm = C_lib.BufferedBlockAlgorithm;
19920	    var C_enc = C.enc;
19921	    var Utf8 = C_enc.Utf8;
19922	    var Base64 = C_enc.Base64;
19923	    var C_algo = C.algo;
19924	    var EvpKDF = C_algo.EvpKDF;
19925
19926	    /**
19927	     * Abstract base cipher template.
19928	     *
19929	     * @property {number} keySize This cipher's key size. Default: 4 (128 bits)
19930	     * @property {number} ivSize This cipher's IV size. Default: 4 (128 bits)
19931	     * @property {number} _ENC_XFORM_MODE A constant representing encryption mode.
19932	     * @property {number} _DEC_XFORM_MODE A constant representing decryption mode.
19933	     */
19934	    var Cipher = C_lib.Cipher = BufferedBlockAlgorithm.extend({
19935	        /**
19936	         * Configuration options.
19937	         *
19938	         * @property {WordArray} iv The IV to use for this operation.
19939	         */
19940	        cfg: Base.extend(),
19941
19942	        /**
19943	         * Creates this cipher in encryption mode.
19944	         *
19945	         * @param {WordArray} key The key.
19946	         * @param {Object} cfg (Optional) The configuration options to use for this operation.
19947	         *
19948	         * @return {Cipher} A cipher instance.
19949	         *
19950	         * @static
19951	         *
19952	         * @example
19953	         *
19954	         *     var cipher = CryptoJS.algo.AES.createEncryptor(keyWordArray, { iv: ivWordArray });
19955	         */
19956	        createEncryptor: function (key, cfg) {
19957	            return this.create(this._ENC_XFORM_MODE, key, cfg);
19958	        },
19959
19960	        /**
19961	         * Creates this cipher in decryption mode.
19962	         *
19963	         * @param {WordArray} key The key.
19964	         * @param {Object} cfg (Optional) The configuration options to use for this operation.
19965	         *
19966	         * @return {Cipher} A cipher instance.
19967	         *
19968	         * @static
19969	         *
19970	         * @example
19971	         *
19972	         *     var cipher = CryptoJS.algo.AES.createDecryptor(keyWordArray, { iv: ivWordArray });
19973	         */
19974	        createDecryptor: function (key, cfg) {
19975	            return this.create(this._DEC_XFORM_MODE, key, cfg);
19976	        },
19977
19978	        /**
19979	         * Initializes a newly created cipher.
19980	         *
19981	         * @param {number} xformMode Either the encryption or decryption transormation mode constant.
19982	         * @param {WordArray} key The key.
19983	         * @param {Object} cfg (Optional) The configuration options to use for this operation.
19984	         *
19985	         * @example
19986	         *
19987	         *     var cipher = CryptoJS.algo.AES.create(CryptoJS.algo.AES._ENC_XFORM_MODE, keyWordArray, { iv: ivWordArray });
19988	         */
19989	        init: function (xformMode, key, cfg) {
19990	            // Apply config defaults
19991	            this.cfg = this.cfg.extend(cfg);
19992
19993	            // Store transform mode and key
19994	            this._xformMode = xformMode;
19995	            this._key = key;
19996
19997	            // Set initial values
19998	            this.reset();
19999	        },
20000
20001	        /**
20002	         * Resets this cipher to its initial state.
20003	         *
20004	         * @example
20005	         *
20006	         *     cipher.reset();
20007	         */
20008	        reset: function () {
20009	            // Reset data buffer
20010	            BufferedBlockAlgorithm.reset.call(this);
20011
20012	            // Perform concrete-cipher logic
20013	            this._doReset();
20014	        },
20015
20016	        /**
20017	         * Adds data to be encrypted or decrypted.
20018	         *
20019	         * @param {WordArray|string} dataUpdate The data to encrypt or decrypt.
20020	         *
20021	         * @return {WordArray} The data after processing.
20022	         *
20023	         * @example
20024	         *
20025	         *     var encrypted = cipher.process('data');
20026	         *     var encrypted = cipher.process(wordArray);
20027	         */
20028	        process: function (dataUpdate) {
20029	            // Append
20030	            this._append(dataUpdate);
20031
20032	            // Process available blocks
20033	            return this._process();
20034	        },
20035
20036	        /**
20037	         * Finalizes the encryption or decryption process.
20038	         * Note that the finalize operation is effectively a destructive, read-once operation.
20039	         *
20040	         * @param {WordArray|string} dataUpdate The final data to encrypt or decrypt.
20041	         *
20042	         * @return {WordArray} The data after final processing.
20043	         *
20044	         * @example
20045	         *
20046	         *     var encrypted = cipher.finalize();
20047	         *     var encrypted = cipher.finalize('data');
20048	         *     var encrypted = cipher.finalize(wordArray);
20049	         */
20050	        finalize: function (dataUpdate) {
20051	            // Final data update
20052	            if (dataUpdate) {
20053	                this._append(dataUpdate);
20054	            }
20055
20056	            // Perform concrete-cipher logic
20057	            var finalProcessedData = this._doFinalize();
20058
20059	            return finalProcessedData;
20060	        },
20061
20062	        keySize: 128/32,
20063
20064	        ivSize: 128/32,
20065
20066	        _ENC_XFORM_MODE: 1,
20067
20068	        _DEC_XFORM_MODE: 2,
20069
20070	        /**
20071	         * Creates shortcut functions to a cipher's object interface.
20072	         *
20073	         * @param {Cipher} cipher The cipher to create a helper for.
20074	         *
20075	         * @return {Object} An object with encrypt and decrypt shortcut functions.
20076	         *
20077	         * @static
20078	         *
20079	         * @example
20080	         *
20081	         *     var AES = CryptoJS.lib.Cipher._createHelper(CryptoJS.algo.AES);
20082	         */
20083	        _createHelper: (function () {
20084	            function selectCipherStrategy(key) {
20085	                if (typeof key == 'string') {
20086	                    return PasswordBasedCipher;
20087	                } else {
20088	                    return SerializableCipher;
20089	                }
20090	            }
20091
20092	            return function (cipher) {
20093	                return {
20094	                    encrypt: function (message, key, cfg) {
20095	                        return selectCipherStrategy(key).encrypt
vendor: 11,908 bytes, lines 20095-20474
20095(cipher, message, key, cfg);
20096	                    },
20097
20098	                    decrypt: function (ciphertext, key, cfg) {
20099	                        return selectCipherStrategy(key).decrypt(cipher, ciphertext, key, cfg);
20100	                    }
20101	                };
20102	            };
20103	        }())
20104	    });
20105
20106	    /**
20107	     * Abstract base stream cipher template.
20108	     *
20109	     * @property {number} blockSize The number of 32-bit words this cipher operates on. Default: 1 (32 bits)
20110	     */
20111	    var StreamCipher = C_lib.StreamCipher = Cipher.extend({
20112	        _doFinalize: function () {
20113	            // Process partial blocks
20114	            var finalProcessedBlocks = this._process(!!'flush');
20115
20116	            return finalProcessedBlocks;
20117	        },
20118
20119	        blockSize: 1
20120	    });
20121
20122	    /**
20123	     * Mode namespace.
20124	     */
20125	    var C_mode = C.mode = {};
20126
20127	    /**
20128	     * Abstract base block cipher mode template.
20129	     */
20130	    var BlockCipherMode = C_lib.BlockCipherMode = Base.extend({
20131	        /**
20132	         * Creates this mode for encryption.
20133	         *
20134	         * @param {Cipher} cipher A block cipher instance.
20135	         * @param {Array} iv The IV words.
20136	         *
20137	         * @static
20138	         *
20139	         * @example
20140	         *
20141	         *     var mode = CryptoJS.mode.CBC.createEncryptor(cipher, iv.words);
20142	         */
20143	        createEncryptor: function (cipher, iv) {
20144	            return this.Encryptor.create(cipher, iv);
20145	        },
20146
20147	        /**
20148	         * Creates this mode for decryption.
20149	         *
20150	         * @param {Cipher} cipher A block cipher instance.
20151	         * @param {Array} iv The IV words.
20152	         *
20153	         * @static
20154	         *
20155	         * @example
20156	         *
20157	         *     var mode = CryptoJS.mode.CBC.createDecryptor(cipher, iv.words);
20158	         */
20159	        createDecryptor: function (cipher, iv) {
20160	            return this.Decryptor.create(cipher, iv);
20161	        },
20162
20163	        /**
20164	         * Initializes a newly created mode.
20165	         *
20166	         * @param {Cipher} cipher A block cipher instance.
20167	         * @param {Array} iv The IV words.
20168	         *
20169	         * @example
20170	         *
20171	         *     var mode = CryptoJS.mode.CBC.Encryptor.create(cipher, iv.words);
20172	         */
20173	        init: function (cipher, iv) {
20174	            this._cipher = cipher;
20175	            this._iv = iv;
20176	        }
20177	    });
20178
20179	    /**
20180	     * Cipher Block Chaining mode.
20181	     */
20182	    var CBC = C_mode.CBC = (function () {
20183	        /**
20184	         * Abstract base CBC mode.
20185	         */
20186	        var CBC = BlockCipherMode.extend();
20187
20188	        /**
20189	         * CBC encryptor.
20190	         */
20191	        CBC.Encryptor = CBC.extend({
20192	            /**
20193	             * Processes the data block at offset.
20194	             *
20195	             * @param {Array} words The data words to operate on.
20196	             * @param {number} offset The offset where the block starts.
20197	             *
20198	             * @example
20199	             *
20200	             *     mode.processBlock(data.words, offset);
20201	             */
20202	            processBlock: function (words, offset) {
20203	                // Shortcuts
20204	                var cipher = this._cipher;
20205	                var blockSize = cipher.blockSize;
20206
20207	                // XOR and encrypt
20208	                xorBlock.call(this, words, offset, blockSize);
20209	                cipher.encryptBlock(words, offset);
20210
20211	                // Remember this block to use with next block
20212	                this._prevBlock = words.slice(offset, offset + blockSize);
20213	            }
20214	        });
20215
20216	        /**
20217	         * CBC decryptor.
20218	         */
20219	        CBC.Decryptor = CBC.extend({
20220	            /**
20221	             * Processes the data block at offset.
20222	             *
20223	             * @param {Array} words The data words to operate on.
20224	             * @param {number} offset The offset where the block starts.
20225	             *
20226	             * @example
20227	             *
20228	             *     mode.processBlock(data.words, offset);
20229	             */
20230	            processBlock: function (words, offset) {
20231	                // Shortcuts
20232	                var cipher = this._cipher;
20233	                var blockSize = cipher.blockSize;
20234
20235	                // Remember this block to use with next block
20236	                var thisBlock = words.slice(offset, offset + blockSize);
20237
20238	                // Decrypt and XOR
20239	                cipher.decryptBlock(words, offset);
20240	                xorBlock.call(this, words, offset, blockSize);
20241
20242	                // This block becomes the previous block
20243	                this._prevBlock = thisBlock;
20244	            }
20245	        });
20246
20247	        function xorBlock(words, offset, blockSize) {
20248	            var block;
20249
20250	            // Shortcut
20251	            var iv = this._iv;
20252
20253	            // Choose mixing block
20254	            if (iv) {
20255	                block = iv;
20256
20257	                // Remove IV for subsequent blocks
20258	                this._iv = undefined;
20259	            } else {
20260	                block = this._prevBlock;
20261	            }
20262
20263	            // XOR blocks
20264	            for (var i = 0; i < blockSize; i++) {
20265	                words[offset + i] ^= block[i];
20266	            }
20267	        }
20268
20269	        return CBC;
20270	    }());
20271
20272	    /**
20273	     * Padding namespace.
20274	     */
20275	    var C_pad = C.pad = {};
20276
20277	    /**
20278	     * PKCS #5/7 padding strategy.
20279	     */
20280	    var Pkcs7 = C_pad.Pkcs7 = {
20281	        /**
20282	         * Pads data using the algorithm defined in PKCS #5/7.
20283	         *
20284	         * @param {WordArray} data The data to pad.
20285	         * @param {number} blockSize The multiple that the data should be padded to.
20286	         *
20287	         * @static
20288	         *
20289	         * @example
20290	         *
20291	         *     CryptoJS.pad.Pkcs7.pad(wordArray, 4);
20292	         */
20293	        pad: function (data, blockSize) {
20294	            // Shortcut
20295	            var blockSizeBytes = blockSize * 4;
20296
20297	            // Count padding bytes
20298	            var nPaddingBytes = blockSizeBytes - data.sigBytes % blockSizeBytes;
20299
20300	            // Create padding word
20301	            var paddingWord = (nPaddingBytes << 24) | (nPaddingBytes << 16) | (nPaddingBytes << 8) | nPaddingBytes;
20302
20303	            // Create padding
20304	            var paddingWords = [];
20305	            for (var i = 0; i < nPaddingBytes; i += 4) {
20306	                paddingWords.push(paddingWord);
20307	            }
20308	            var padding = WordArray.create(paddingWords, nPaddingBytes);
20309
20310	            // Add padding
20311	            data.concat(padding);
20312	        },
20313
20314	        /**
20315	         * Unpads data that had been padded using the algorithm defined in PKCS #5/7.
20316	         *
20317	         * @param {WordArray} data The data to unpad.
20318	         *
20319	         * @static
20320	         *
20321	         * @example
20322	         *
20323	         *     CryptoJS.pad.Pkcs7.unpad(wordArray);
20324	         */
20325	        unpad: function (data) {
20326	            // Get number of padding bytes from last byte
20327	            var nPaddingBytes = data.words[(data.sigBytes - 1) >>> 2] & 0xff;
20328
20329	            // Remove padding
20330	            data.sigBytes -= nPaddingBytes;
20331	        }
20332	    };
20333
20334	    /**
20335	     * Abstract base block cipher template.
20336	     *
20337	     * @property {number} blockSize The number of 32-bit words this cipher operates on. Default: 4 (128 bits)
20338	     */
20339	    var BlockCipher = C_lib.BlockCipher = Cipher.extend({
20340	        /**
20341	         * Configuration options.
20342	         *
20343	         * @property {Mode} mode The block mode to use. Default: CBC
20344	         * @property {Padding} padding The padding strategy to use. Default: Pkcs7
20345	         */
20346	        cfg: Cipher.cfg.extend({
20347	            mode: CBC,
20348	            padding: Pkcs7
20349	        }),
20350
20351	        reset: function () {
20352	            var modeCreator;
20353
20354	            // Reset cipher
20355	            Cipher.reset.call(this);
20356
20357	            // Shortcuts
20358	            var cfg = this.cfg;
20359	            var iv = cfg.iv;
20360	            var mode = cfg.mode;
20361
20362	            // Reset block mode
20363	            if (this._xformMode == this._ENC_XFORM_MODE) {
20364	                modeCreator = mode.createEncryptor;
20365	            } else /* if (this._xformMode == this._DEC_XFORM_MODE) */ {
20366	                modeCreator = mode.createDecryptor;
20367	                // Keep at least one block in the buffer for unpadding
20368	                this._minBufferSize = 1;
20369	            }
20370
20371	            if (this._mode && this._mode.__creator == modeCreator) {
20372	                this._mode.init(this, iv && iv.words);
20373	            } else {
20374	                this._mode = modeCreator.call(mode, this, iv && iv.words);
20375	                this._mode.__creator = modeCreator;
20376	            }
20377	        },
20378
20379	        _doProcessBlock: function (words, offset) {
20380	            this._mode.processBlock(words, offset);
20381	        },
20382
20383	        _doFinalize: function () {
20384	            var finalProcessedBlocks;
20385
20386	            // Shortcut
20387	            var padding = this.cfg.padding;
20388
20389	            // Finalize
20390	            if (this._xformMode == this._ENC_XFORM_MODE) {
20391	                // Pad data
20392	                padding.pad(this._data, this.blockSize);
20393
20394	                // Process final blocks
20395	                finalProcessedBlocks = this._process(!!'flush');
20396	            } else /* if (this._xformMode == this._DEC_XFORM_MODE) */ {
20397	                // Process final blocks
20398	                finalProcessedBlocks = this._process(!!'flush');
20399
20400	                // Unpad data
20401	                padding.unpad(finalProcessedBlocks);
20402	            }
20403
20404	            return finalProcessedBlocks;
20405	        },
20406
20407	        blockSize: 128/32
20408	    });
20409
20410	    /**
20411	     * A collection of cipher parameters.
20412	     *
20413	     * @property {WordArray} ciphertext The raw ciphertext.
20414	     * @property {WordArray} key The key to this ciphertext.
20415	     * @property {WordArray} iv The IV used in the ciphering operation.
20416	     * @property {WordArray} salt The salt used with a key derivation function.
20417	     * @property {Cipher} algorithm The cipher algorithm.
20418	     * @property {Mode} mode The block mode used in the ciphering operation.
20419	     * @property {Padding} padding The padding scheme used in the ciphering operation.
20420	     * @property {number} blockSize The block size of the cipher.
20421	     * @property {Format} formatter The default formatting strategy to convert this cipher params object to a string.
20422	     */
20423	    var CipherParams = C_lib.CipherParams = Base.extend({
20424	        /**
20425	         * Initializes a newly created cipher params object.
20426	         *
20427	         * @param {Object} cipherParams An object with any of the possible cipher parameters.
20428	         *
20429	         * @example
20430	         *
20431	         *     var cipherParams = CryptoJS.lib.CipherParams.create({
20432	         *         ciphertext: ciphertextWordArray,
20433	         *         key: keyWordArray,
20434	         *         iv: ivWordArray,
20435	         *         salt: saltWordArray,
20436	         *         algorithm: CryptoJS.algo.AES,
20437	         *         mode: CryptoJS.mode.CBC,
20438	         *         padding: CryptoJS.pad.PKCS7,
20439	         *         blockSize: 4,
20440	         *         formatter: CryptoJS.format.OpenSSL
20441	         *     });
20442	         */
20443	        init: function (cipherParams) {
20444	            this.mixIn(cipherParams);
20445	        },
20446
20447	        /**
20448	         * Converts this cipher params object to a string.
20449	         *
20450	         * @param {Format} formatter (Optional) The formatting strategy to use.
20451	         *
20452	         * @return {string} The stringified cipher params.
20453	         *
20454	         * @throws Error If neither the formatter nor the default formatter is set.
20455	         *
20456	         * @example
20457	         *
20458	         *     var string = cipherParams + '';
20459	         *     var string = cipherParams.toString();
20460	         *     var string = cipherParams.toString(CryptoJS.format.OpenSSL);
20461	         */
20462	        toString: function (formatter) {
20463	            return (formatter || this.formatter).stringify(this);
20464	        }
20465	    });
20466
20467	    /**
20468	     * Format namespace.
20469	     */
20470	    var C_format = C.format = {};
20471
20472	    /**
20473	     * OpenSSL formatting strategy.
20474	     */
vendor: 7,596 bytes, lines 20475-20684
20475	    var OpenSSLFormatter = C_format.OpenSSL = {
20476	        /**
20477	         * Converts a cipher params object to an OpenSSL-compatible string.
20478	         *
20479	         * @param {CipherParams} cipherParams The cipher params object.
20480	         *
20481	         * @return {string} The OpenSSL-compatible string.
20482	         *
20483	         * @static
20484	         *
20485	         * @example
20486	         *
20487	         *     var openSSLString = CryptoJS.format.OpenSSL.stringify(cipherParams);
20488	         */
20489	        stringify: function (cipherParams) {
20490	            var wordArray;
20491
20492	            // Shortcuts
20493	            var ciphertext = cipherParams.ciphertext;
20494	            var salt = cipherParams.salt;
20495
20496	            // Format
20497	            if (salt) {
20498	                wordArray = WordArray.create([0x53616c74, 0x65645f5f]).concat(salt).concat(ciphertext);
20499	            } else {
20500	                wordArray = ciphertext;
20501	            }
20502
20503	            return wordArray.toString(Base64);
20504	        },
20505
20506	        /**
20507	         * Converts an OpenSSL-compatible string to a cipher params object.
20508	         *
20509	         * @param {string} openSSLStr The OpenSSL-compatible string.
20510	         *
20511	         * @return {CipherParams} The cipher params object.
20512	         *
20513	         * @static
20514	         *
20515	         * @example
20516	         *
20517	         *     var cipherParams = CryptoJS.format.OpenSSL.parse(openSSLString);
20518	         */
20519	        parse: function (openSSLStr) {
20520	            var salt;
20521
20522	            // Parse base64
20523	            var ciphertext = Base64.parse(openSSLStr);
20524
20525	            // Shortcut
20526	            var ciphertextWords = ciphertext.words;
20527
20528	            // Test for salt
20529	            if (ciphertextWords[0] == 0x53616c74 && ciphertextWords[1] == 0x65645f5f) {
20530	                // Extract salt
20531	                salt = WordArray.create(ciphertextWords.slice(2, 4));
20532
20533	                // Remove salt from ciphertext
20534	                ciphertextWords.splice(0, 4);
20535	                ciphertext.sigBytes -= 16;
20536	            }
20537
20538	            return CipherParams.create({ ciphertext: ciphertext, salt: salt });
20539	        }
20540	    };
20541
20542	    /**
20543	     * A cipher wrapper that returns ciphertext as a serializable cipher params object.
20544	     */
20545	    var SerializableCipher = C_lib.SerializableCipher = Base.extend({
20546	        /**
20547	         * Configuration options.
20548	         *
20549	         * @property {Formatter} format The formatting strategy to convert cipher param objects to and from a string. Default: OpenSSL
20550	         */
20551	        cfg: Base.extend({
20552	            format: OpenSSLFormatter
20553	        }),
20554
20555	        /**
20556	         * Encrypts a message.
20557	         *
20558	         * @param {Cipher} cipher The cipher algorithm to use.
20559	         * @param {WordArray|string} message The message to encrypt.
20560	         * @param {WordArray} key The key.
20561	         * @param {Object} cfg (Optional) The configuration options to use for this operation.
20562	         *
20563	         * @return {CipherParams} A cipher params object.
20564	         *
20565	         * @static
20566	         *
20567	         * @example
20568	         *
20569	         *     var ciphertextParams = CryptoJS.lib.SerializableCipher.encrypt(CryptoJS.algo.AES, message, key);
20570	         *     var ciphertextParams = CryptoJS.lib.SerializableCipher.encrypt(CryptoJS.algo.AES, message, key, { iv: iv });
20571	         *     var ciphertextParams = CryptoJS.lib.SerializableCipher.encrypt(CryptoJS.algo.AES, message, key, { iv: iv, format: CryptoJS.format.OpenSSL });
20572	         */
20573	        encrypt: function (cipher, message, key, cfg) {
20574	            // Apply config defaults
20575	            cfg = this.cfg.extend(cfg);
20576
20577	            // Encrypt
20578	            var encryptor = cipher.createEncryptor(key, cfg);
20579	            var ciphertext = encryptor.finalize(message);
20580
20581	            // Shortcut
20582	            var cipherCfg = encryptor.cfg;
20583
20584	            // Create and return serializable cipher params
20585	            return CipherParams.create({
20586	                ciphertext: ciphertext,
20587	                key: key,
20588	                iv: cipherCfg.iv,
20589	                algorithm: cipher,
20590	                mode: cipherCfg.mode,
20591	                padding: cipherCfg.padding,
20592	                blockSize: cipher.blockSize,
20593	                formatter: cfg.format
20594	            });
20595	        },
20596
20597	        /**
20598	         * Decrypts serialized ciphertext.
20599	         *
20600	         * @param {Cipher} cipher The cipher algorithm to use.
20601	         * @param {CipherParams|string} ciphertext The ciphertext to decrypt.
20602	         * @param {WordArray} key The key.
20603	         * @param {Object} cfg (Optional) The configuration options to use for this operation.
20604	         *
20605	         * @return {WordArray} The plaintext.
20606	         *
20607	         * @static
20608	         *
20609	         * @example
20610	         *
20611	         *     var plaintext = CryptoJS.lib.SerializableCipher.decrypt(CryptoJS.algo.AES, formattedCiphertext, key, { iv: iv, format: CryptoJS.format.OpenSSL });
20612	         *     var plaintext = CryptoJS.lib.SerializableCipher.decrypt(CryptoJS.algo.AES, ciphertextParams, key, { iv: iv, format: CryptoJS.format.OpenSSL });
20613	         */
20614	        decrypt: function (cipher, ciphertext, key, cfg) {
20615	            // Apply config defaults
20616	            cfg = this.cfg.extend(cfg);
20617
20618	            // Convert string to CipherParams
20619	            ciphertext = this._parse(ciphertext, cfg.format);
20620
20621	            // Decrypt
20622	            var plaintext = cipher.createDecryptor(key, cfg).finalize(ciphertext.ciphertext);
20623
20624	            return plaintext;
20625	        },
20626
20627	        /**
20628	         * Converts serialized ciphertext to CipherParams,
20629	         * else assumed CipherParams already and returns ciphertext unchanged.
20630	         *
20631	         * @param {CipherParams|string} ciphertext The ciphertext.
20632	         * @param {Formatter} format The formatting strategy to use to parse serialized ciphertext.
20633	         *
20634	         * @return {CipherParams} The unserialized ciphertext.
20635	         *
20636	         * @static
20637	         *
20638	         * @example
20639	         *
20640	         *     var ciphertextParams = CryptoJS.lib.SerializableCipher._parse(ciphertextStringOrParams, format);
20641	         */
20642	        _parse: function (ciphertext, format) {
20643	            if (typeof ciphertext == 'string') {
20644	                return format.parse(ciphertext, this);
20645	            } else {
20646	                return ciphertext;
20647	            }
20648	        }
20649	    });
20650
20651	    /**
20652	     * Key derivation function namespace.
20653	     */
20654	    var C_kdf = C.kdf = {};
20655
20656	    /**
20657	     * OpenSSL key derivation function.
20658	     */
20659	    var OpenSSLKdf = C_kdf.OpenSSL = {
20660	        /**
20661	         * Derives a key and IV from a password.
20662	         *
20663	         * @param {string} password The password to derive from.
20664	         * @param {number} keySize The size in words of the key to generate.
20665	         * @param {number} ivSize The size in words of the IV to generate.
20666	         * @param {WordArray|string} salt (Optional) A 64-bit salt to use. If omitted, a salt will be generated randomly.
20667	         *
20668	         * @return {CipherParams} A cipher params object with the key, IV, and salt.
20669	         *
20670	         * @static
20671	         *
20672	         * @example
20673	         *
20674	         *     var derivedParams = CryptoJS.kdf.OpenSSL.execute('Password', 256/32, 128/32);
20675	         *     var derivedParams = CryptoJS.kdf.OpenSSL.execute('Password', 256/32, 128/32, 'saltsalt');
20676	         */
20677	        execute: function (password, keySize, ivSize, salt, hasher) {
20678	            // Generate random salt
20679	            if (!salt) {
20680	                salt = WordArray.random(64/8);
20681	            }
20682
20683	            // Derive key and IV
20684	            if (!hasher) {
vendor: 17,073 bytes, lines 20685-21302
20685	                var key = EvpKDF.create({ keySize: keySize + ivSize }).compute(password, salt);
20686	            } else {
20687	                var key = EvpKDF.create({ keySize: keySize + ivSize, hasher: hasher }).compute(password, salt);
20688	            }
20689
20690
20691	            // Separate key and IV
20692	            var iv = WordArray.create(key.words.slice(keySize), ivSize * 4);
20693	            key.sigBytes = keySize * 4;
20694
20695	            // Return params
20696	            return CipherParams.create({ key: key, iv: iv, salt: salt });
20697	        }
20698	    };
20699
20700	    /**
20701	     * A serializable cipher wrapper that derives the key from a password,
20702	     * and returns ciphertext as a serializable cipher params object.
20703	     */
20704	    var PasswordBasedCipher = C_lib.PasswordBasedCipher = SerializableCipher.extend({
20705	        /**
20706	         * Configuration options.
20707	         *
20708	         * @property {KDF} kdf The key derivation function to use to generate a key and IV from a password. Default: OpenSSL
20709	         */
20710	        cfg: SerializableCipher.cfg.extend({
20711	            kdf: OpenSSLKdf
20712	        }),
20713
20714	        /**
20715	         * Encrypts a message using a password.
20716	         *
20717	         * @param {Cipher} cipher The cipher algorithm to use.
20718	         * @param {WordArray|string} message The message to encrypt.
20719	         * @param {string} password The password.
20720	         * @param {Object} cfg (Optional) The configuration options to use for this operation.
20721	         *
20722	         * @return {CipherParams} A cipher params object.
20723	         *
20724	         * @static
20725	         *
20726	         * @example
20727	         *
20728	         *     var ciphertextParams = CryptoJS.lib.PasswordBasedCipher.encrypt(CryptoJS.algo.AES, message, 'password');
20729	         *     var ciphertextParams = CryptoJS.lib.PasswordBasedCipher.encrypt(CryptoJS.algo.AES, message, 'password', { format: CryptoJS.format.OpenSSL });
20730	         */
20731	        encrypt: function (cipher, message, password, cfg) {
20732	            // Apply config defaults
20733	            cfg = this.cfg.extend(cfg);
20734
20735	            // Derive key and other params
20736	            var derivedParams = cfg.kdf.execute(password, cipher.keySize, cipher.ivSize, cfg.salt, cfg.hasher);
20737
20738	            // Add IV to config
20739	            cfg.iv = derivedParams.iv;
20740
20741	            // Encrypt
20742	            var ciphertext = SerializableCipher.encrypt.call(this, cipher, message, derivedParams.key, cfg);
20743
20744	            // Mix in derived params
20745	            ciphertext.mixIn(derivedParams);
20746
20747	            return ciphertext;
20748	        },
20749
20750	        /**
20751	         * Decrypts serialized ciphertext using a password.
20752	         *
20753	         * @param {Cipher} cipher The cipher algorithm to use.
20754	         * @param {CipherParams|string} ciphertext The ciphertext to decrypt.
20755	         * @param {string} password The password.
20756	         * @param {Object} cfg (Optional) The configuration options to use for this operation.
20757	         *
20758	         * @return {WordArray} The plaintext.
20759	         *
20760	         * @static
20761	         *
20762	         * @example
20763	         *
20764	         *     var plaintext = CryptoJS.lib.PasswordBasedCipher.decrypt(CryptoJS.algo.AES, formattedCiphertext, 'password', { format: CryptoJS.format.OpenSSL });
20765	         *     var plaintext = CryptoJS.lib.PasswordBasedCipher.decrypt(CryptoJS.algo.AES, ciphertextParams, 'password', { format: CryptoJS.format.OpenSSL });
20766	         */
20767	        decrypt: function (cipher, ciphertext, password, cfg) {
20768	            // Apply config defaults
20769	            cfg = this.cfg.extend(cfg);
20770
20771	            // Convert string to CipherParams
20772	            ciphertext = this._parse(ciphertext, cfg.format);
20773
20774	            // Derive key and other params
20775	            var derivedParams = cfg.kdf.execute(password, cipher.keySize, cipher.ivSize, ciphertext.salt, cfg.hasher);
20776
20777	            // Add IV to config
20778	            cfg.iv = derivedParams.iv;
20779
20780	            // Decrypt
20781	            var plaintext = SerializableCipher.decrypt.call(this, cipher, ciphertext, derivedParams.key, cfg);
20782
20783	            return plaintext;
20784	        }
20785	    });
20786	}());
20787
20788
20789	/**
20790	 * Cipher Feedback block mode.
20791	 */
20792	CryptoJS.mode.CFB = (function () {
20793	    var CFB = CryptoJS.lib.BlockCipherMode.extend();
20794
20795	    CFB.Encryptor = CFB.extend({
20796	        processBlock: function (words, offset) {
20797	            // Shortcuts
20798	            var cipher = this._cipher;
20799	            var blockSize = cipher.blockSize;
20800
20801	            generateKeystreamAndEncrypt.call(this, words, offset, blockSize, cipher);
20802
20803	            // Remember this block to use with next block
20804	            this._prevBlock = words.slice(offset, offset + blockSize);
20805	        }
20806	    });
20807
20808	    CFB.Decryptor = CFB.extend({
20809	        processBlock: function (words, offset) {
20810	            // Shortcuts
20811	            var cipher = this._cipher;
20812	            var blockSize = cipher.blockSize;
20813
20814	            // Remember this block to use with next block
20815	            var thisBlock = words.slice(offset, offset + blockSize);
20816
20817	            generateKeystreamAndEncrypt.call(this, words, offset, blockSize, cipher);
20818
20819	            // This block becomes the previous block
20820	            this._prevBlock = thisBlock;
20821	        }
20822	    });
20823
20824	    function generateKeystreamAndEncrypt(words, offset, blockSize, cipher) {
20825	        var keystream;
20826
20827	        // Shortcut
20828	        var iv = this._iv;
20829
20830	        // Generate keystream
20831	        if (iv) {
20832	            keystream = iv.slice(0);
20833
20834	            // Remove IV for subsequent blocks
20835	            this._iv = undefined;
20836	        } else {
20837	            keystream = this._prevBlock;
20838	        }
20839	        cipher.encryptBlock(keystream, 0);
20840
20841	        // Encrypt
20842	        for (var i = 0; i < blockSize; i++) {
20843	            words[offset + i] ^= keystream[i];
20844	        }
20845	    }
20846
20847	    return CFB;
20848	}());
20849
20850
20851	/**
20852	 * Counter block mode.
20853	 */
20854	CryptoJS.mode.CTR = (function () {
20855	    var CTR = CryptoJS.lib.BlockCipherMode.extend();
20856
20857	    var Encryptor = CTR.Encryptor = CTR.extend({
20858	        processBlock: function (words, offset) {
20859	            // Shortcuts
20860	            var cipher = this._cipher
20861	            var blockSize = cipher.blockSize;
20862	            var iv = this._iv;
20863	            var counter = this._counter;
20864
20865	            // Generate keystream
20866	            if (iv) {
20867	                counter = this._counter = iv.slice(0);
20868
20869	                // Remove IV for subsequent blocks
20870	                this._iv = undefined;
20871	            }
20872	            var keystream = counter.slice(0);
20873	            cipher.encryptBlock(keystream, 0);
20874
20875	            // Increment counter
20876	            counter[blockSize - 1] = (counter[blockSize - 1] + 1) | 0
20877
20878	            // Encrypt
20879	            for (var i = 0; i < blockSize; i++) {
20880	                words[offset + i] ^= keystream[i];
20881	            }
20882	        }
20883	    });
20884
20885	    CTR.Decryptor = Encryptor;
20886
20887	    return CTR;
20888	}());
20889
20890
20891	/** @preserve
20892	 * Counter block mode compatible with  Dr Brian Gladman fileenc.c
20893	 * derived from CryptoJS.mode.CTR
20894	 * Jan Hruby [email protected]
20895	 */
20896	CryptoJS.mode.CTRGladman = (function () {
20897	    var CTRGladman = CryptoJS.lib.BlockCipherMode.extend();
20898
20899		function incWord(word)
20900		{
20901			if (((word >> 24) & 0xff) === 0xff) { //overflow
20902			var b1 = (word >> 16)&0xff;
20903			var b2 = (word >> 8)&0xff;
20904			var b3 = word & 0xff;
20905
20906			if (b1 === 0xff) // overflow b1
20907			{
20908			b1 = 0;
20909			if (b2 === 0xff)
20910			{
20911				b2 = 0;
20912				if (b3 === 0xff)
20913				{
20914					b3 = 0;
20915				}
20916				else
20917				{
20918					++b3;
20919				}
20920			}
20921			else
20922			{
20923				++b2;
20924			}
20925			}
20926			else
20927			{
20928			++b1;
20929			}
20930
20931			word = 0;
20932			word += (b1 << 16);
20933			word += (b2 << 8);
20934			word += b3;
20935			}
20936			else
20937			{
20938			word += (0x01 << 24);
20939			}
20940			return word;
20941		}
20942
20943		function incCounter(counter)
20944		{
20945			if ((counter[0] = incWord(counter[0])) === 0)
20946			{
20947				// encr_data in fileenc.c from  Dr Brian Gladman's counts only with DWORD j < 8
20948				counter[1] = incWord(counter[1]);
20949			}
20950			return counter;
20951		}
20952
20953	    var Encryptor = CTRGladman.Encryptor = CTRGladman.extend({
20954	        processBlock: function (words, offset) {
20955	            // Shortcuts
20956	            var cipher = this._cipher
20957	            var blockSize = cipher.blockSize;
20958	            var iv = this._iv;
20959	            var counter = this._counter;
20960
20961	            // Generate keystream
20962	            if (iv) {
20963	                counter = this._counter = iv.slice(0);
20964
20965	                // Remove IV for subsequent blocks
20966	                this._iv = undefined;
20967	            }
20968
20969				incCounter(counter);
20970
20971				var keystream = counter.slice(0);
20972	            cipher.encryptBlock(keystream, 0);
20973
20974	            // Encrypt
20975	            for (var i = 0; i < blockSize; i++) {
20976	                words[offset + i] ^= keystream[i];
20977	            }
20978	        }
20979	    });
20980
20981	    CTRGladman.Decryptor = Encryptor;
20982
20983	    return CTRGladman;
20984	}());
20985
20986
20987
20988
20989	/**
20990	 * Output Feedback block mode.
20991	 */
20992	CryptoJS.mode.OFB = (function () {
20993	    var OFB = CryptoJS.lib.BlockCipherMode.extend();
20994
20995	    var Encryptor = OFB.Encryptor = OFB.extend({
20996	        processBlock: function (words, offset) {
20997	            // Shortcuts
20998	            var cipher = this._cipher
20999	            var blockSize = cipher.blockSize;
21000	            var iv = this._iv;
21001	            var keystream = this._keystream;
21002
21003	            // Generate keystream
21004	            if (iv) {
21005	                keystream = this._keystream = iv.slice(0);
21006
21007	                // Remove IV for subsequent blocks
21008	                this._iv = undefined;
21009	            }
21010	            cipher.encryptBlock(keystream, 0);
21011
21012	            // Encrypt
21013	            for (var i = 0; i < blockSize; i++) {
21014	                words[offset + i] ^= keystream[i];
21015	            }
21016	        }
21017	    });
21018
21019	    OFB.Decryptor = Encryptor;
21020
21021	    return OFB;
21022	}());
21023
21024
21025	/**
21026	 * Electronic Codebook block mode.
21027	 */
21028	CryptoJS.mode.ECB = (function () {
21029	    var ECB = CryptoJS.lib.BlockCipherMode.extend();
21030
21031	    ECB.Encryptor = ECB.extend({
21032	        processBlock: function (words, offset) {
21033	            this._cipher.encryptBlock(words, offset);
21034	        }
21035	    });
21036
21037	    ECB.Decryptor = ECB.extend({
21038	        processBlock: function (words, offset) {
21039	            this._cipher.decryptBlock(words, offset);
21040	        }
21041	    });
21042
21043	    return ECB;
21044	}());
21045
21046
21047	/**
21048	 * ANSI X.923 padding strategy.
21049	 */
21050	CryptoJS.pad.AnsiX923 = {
21051	    pad: function (data, blockSize) {
21052	        // Shortcuts
21053	        var dataSigBytes = data.sigBytes;
21054	        var blockSizeBytes = blockSize * 4;
21055
21056	        // Count padding bytes
21057	        var nPaddingBytes = blockSizeBytes - dataSigBytes % blockSizeBytes;
21058
21059	        // Compute last byte position
21060	        var lastBytePos = dataSigBytes + nPaddingBytes - 1;
21061
21062	        // Pad
21063	        data.clamp();
21064	        data.words[lastBytePos >>> 2] |= nPaddingBytes << (24 - (lastBytePos % 4) * 8);
21065	        data.sigBytes += nPaddingBytes;
21066	    },
21067
21068	    unpad: function (data) {
21069	        // Get number of padding bytes from last byte
21070	        var nPaddingBytes = data.words[(data.sigBytes - 1) >>> 2] & 0xff;
21071
21072	        // Remove padding
21073	        data.sigBytes -= nPaddingBytes;
21074	    }
21075	};
21076
21077
21078	/**
21079	 * ISO 10126 padding strategy.
21080	 */
21081	CryptoJS.pad.Iso10126 = {
21082	    pad: function (data, blockSize) {
21083	        // Shortcut
21084	        var blockSizeBytes = blockSize * 4;
21085
21086	        // Count padding bytes
21087	        var nPaddingBytes = blockSizeBytes - data.sigBytes % blockSizeBytes;
21088
21089	        // Pad
21090	        data.concat(CryptoJS.lib.WordArray.random(nPaddingBytes - 1)).
21091	             concat(CryptoJS.lib.WordArray.create([nPaddingBytes << 24], 1));
21092	    },
21093
21094	    unpad: function (data) {
21095	        // Get number of padding bytes from last byte
21096	        var nPaddingBytes = data.words[(data.sigBytes - 1) >>> 2] & 0xff;
21097
21098	        // Remove padding
21099	        data.sigBytes -= nPaddingBytes;
21100	    }
21101	};
21102
21103
21104	/**
21105	 * ISO/IEC 9797-1 Padding Method 2.
21106	 */
21107	CryptoJS.pad.Iso97971 = {
21108	    pad: function (data, blockSize) {
21109	        // Add 0x80 byte
21110	        data.concat(CryptoJS.lib.WordArray.create([0x80000000], 1));
21111
21112	        // Zero pad the rest
21113	        CryptoJS.pad.ZeroPadding.pad(data, blockSize);
21114	    },
21115
21116	    unpad: function (data) {
21117	        // Remove zero padding
21118	        CryptoJS.pad.ZeroPadding.unpad(data);
21119
21120	        // Remove one more byte -- the 0x80 byte
21121	        data.sigBytes--;
21122	    }
21123	};
21124
21125
21126	/**
21127	 * Zero padding strategy.
21128	 */
21129	CryptoJS.pad.ZeroPadding = {
21130	    pad: function (data, blockSize) {
21131	        // Shortcut
21132	        var blockSizeBytes = blockSize * 4;
21133
21134	        // Pad
21135	        data.clamp();
21136	        data.sigBytes += blockSizeBytes - ((data.sigBytes % blockSizeBytes) || blockSizeBytes);
21137	    },
21138
21139	    unpad: function (data) {
21140	        // Shortcut
21141	        var dataWords = data.words;
21142
21143	        // Unpad
21144	        var i = data.sigBytes - 1;
21145	        for (var i = data.sigBytes - 1; i >= 0; i--) {
21146	            if (((dataWords[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff)) {
21147	                data.sigBytes = i + 1;
21148	                break;
21149	            }
21150	        }
21151	    }
21152	};
21153
21154
21155	/**
21156	 * A noop padding strategy.
21157	 */
21158	CryptoJS.pad.NoPadding = {
21159	    pad: function () {
21160	    },
21161
21162	    unpad: function () {
21163	    }
21164	};
21165
21166
21167	(function (undefined) {
21168	    // Shortcuts
21169	    var C = CryptoJS;
21170	    var C_lib = C.lib;
21171	    var CipherParams = C_lib.CipherParams;
21172	    var C_enc = C.enc;
21173	    var Hex = C_enc.Hex;
21174	    var C_format = C.format;
21175
21176	    var HexFormatter = C_format.Hex = {
21177	        /**
21178	         * Converts the ciphertext of a cipher params object to a hexadecimally encoded string.
21179	         *
21180	         * @param {CipherParams} cipherParams The cipher params object.
21181	         *
21182	         * @return {string} The hexadecimally encoded string.
21183	         *
21184	         * @static
21185	         *
21186	         * @example
21187	         *
21188	         *     var hexString = CryptoJS.format.Hex.stringify(cipherParams);
21189	         */
21190	        stringify: function (cipherParams) {
21191	            return cipherParams.ciphertext.toString(Hex);
21192	        },
21193
21194	        /**
21195	         * Converts a hexadecimally encoded ciphertext string to a cipher params object.
21196	         *
21197	         * @param {string} input The hexadecimally encoded string.
21198	         *
21199	         * @return {CipherParams} The cipher params object.
21200	         *
21201	         * @static
21202	         *
21203	         * @example
21204	         *
21205	         *     var cipherParams = CryptoJS.format.Hex.parse(hexString);
21206	         */
21207	        parse: function (input) {
21208	            var ciphertext = Hex.parse(input);
21209	            return CipherParams.create({ ciphertext: ciphertext });
21210	        }
21211	    };
21212	}());
21213
21214
21215	(function () {
21216	    // Shortcuts
21217	    var C = CryptoJS;
21218	    var C_lib = C.lib;
21219	    var BlockCipher = C_lib.BlockCipher;
21220	    var C_algo = C.algo;
21221
21222	    // Lookup tables
21223	    var SBOX = [];
21224	    var INV_SBOX = [];
21225	    var SUB_MIX_0 = [];
21226	    var SUB_MIX_1 = [];
21227	    var SUB_MIX_2 = [];
21228	    var SUB_MIX_3 = [];
21229	    var INV_SUB_MIX_0 = [];
21230	    var INV_SUB_MIX_1 = [];
21231	    var INV_SUB_MIX_2 = [];
21232	    var INV_SUB_MIX_3 = [];
21233
21234	    // Compute lookup tables
21235	    (function () {
21236	        // Compute double table
21237	        var d = [];
21238	        for (var i = 0; i < 256; i++) {
21239	            if (i < 128) {
21240	                d[i] = i << 1;
21241	            } else {
21242	                d[i] = (i << 1) ^ 0x11b;
21243	            }
21244	        }
21245
21246	        // Walk GF(2^8)
21247	        var x = 0;
21248	        var xi = 0;
21249	        for (var i = 0; i < 256; i++) {
21250	            // Compute sbox
21251	            var sx = xi ^ (xi << 1) ^ (xi << 2) ^ (xi << 3) ^ (xi << 4);
21252	            sx = (sx >>> 8) ^ (sx & 0xff) ^ 0x63;
21253	            SBOX[x] = sx;
21254	            INV_SBOX[sx] = x;
21255
21256	            // Compute multiplication
21257	            var x2 = d[x];
21258	            var x4 = d[x2];
21259	            var x8 = d[x4];
21260
21261	            // Compute sub bytes, mix columns tables
21262	            var t = (d[sx] * 0x101) ^ (sx * 0x1010100);
21263	            SUB_MIX_0[x] = (t << 24) | (t >>> 8);
21264	            SUB_MIX_1[x] = (t << 16) | (t >>> 16);
21265	            SUB_MIX_2[x] = (t << 8)  | (t >>> 24);
21266	            SUB_MIX_3[x] = t;
21267
21268	            // Compute inv sub bytes, inv mix columns tables
21269	            var t = (x8 * 0x1010101) ^ (x4 * 0x10001) ^ (x2 * 0x101) ^ (x * 0x1010100);
21270	            INV_SUB_MIX_0[sx] = (t << 24) | (t >>> 8);
21271	            INV_SUB_MIX_1[sx] = (t << 16) | (t >>> 16);
21272	            INV_SUB_MIX_2[sx] = (t << 8)  | (t >>> 24);
21273	            INV_SUB_MIX_3[sx] = t;
21274
21275	            // Compute next counter
21276	            if (!x) {
21277	                x = xi = 1;
21278	            } else {
21279	                x = x2 ^ d[d[d[x8 ^ x2]]];
21280	                xi ^= d[d[xi]];
21281	            }
21282	        }
21283	    }());
21284
21285	    // Precomputed Rcon lookup
21286	    var RCON = [0x00, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36];
21287
21288	    /**
21289	     * AES block cipher algorithm.
21290	     */
21291	    var AES = C_algo.AES = BlockCipher.extend({
21292	        _doReset: function () {
21293	            var t;
21294
21295	            // Skip reset of nRounds has been set before and key did not change
21296	            if (this._nRounds && this._keyPriorReset === this._key) {
21297	                return;
21298	            }
21299
21300	            // Shortcuts
21301	            var key = this._keyPriorReset = this._key;
21302	            var keyWords = key.words;
vendor: 2,989 bytes, lines 21303-21376
21303	            var keySize = key.sigBytes / 4;
21304
21305	            // Compute number of rounds
21306	            var nRounds = this._nRounds = keySize + 6;
21307
21308	            // Compute number of key schedule rows
21309	            var ksRows = (nRounds + 1) * 4;
21310
21311	            // Compute key schedule
21312	            var keySchedule = this._keySchedule = [];
21313	            for (var ksRow = 0; ksRow < ksRows; ksRow++) {
21314	                if (ksRow < keySize) {
21315	                    keySchedule[ksRow] = keyWords[ksRow];
21316	                } else {
21317	                    t = keySchedule[ksRow - 1];
21318
21319	                    if (!(ksRow % keySize)) {
21320	                        // Rot word
21321	                        t = (t << 8) | (t >>> 24);
21322
21323	                        // Sub word
21324	                        t = (SBOX[t >>> 24] << 24) | (SBOX[(t >>> 16) & 0xff] << 16) | (SBOX[(t >>> 8) & 0xff] << 8) | SBOX[t & 0xff];
21325
21326	                        // Mix Rcon
21327	                        t ^= RCON[(ksRow / keySize) | 0] << 24;
21328	                    } else if (keySize > 6 && ksRow % keySize == 4) {
21329	                        // Sub word
21330	                        t = (SBOX[t >>> 24] << 24) | (SBOX[(t >>> 16) & 0xff] << 16) | (SBOX[(t >>> 8) & 0xff] << 8) | SBOX[t & 0xff];
21331	                    }
21332
21333	                    keySchedule[ksRow] = keySchedule[ksRow - keySize] ^ t;
21334	                }
21335	            }
21336
21337	            // Compute inv key schedule
21338	            var invKeySchedule = this._invKeySchedule = [];
21339	            for (var invKsRow = 0; invKsRow < ksRows; invKsRow++) {
21340	                var ksRow = ksRows - invKsRow;
21341
21342	                if (invKsRow % 4) {
21343	                    var t = keySchedule[ksRow];
21344	                } else {
21345	                    var t = keySchedule[ksRow - 4];
21346	                }
21347
21348	                if (invKsRow < 4 || ksRow <= 4) {
21349	                    invKeySchedule[invKsRow] = t;
21350	                } else {
21351	                    invKeySchedule[invKsRow] = INV_SUB_MIX_0[SBOX[t >>> 24]] ^ INV_SUB_MIX_1[SBOX[(t >>> 16) & 0xff]] ^
21352	                                               INV_SUB_MIX_2[SBOX[(t >>> 8) & 0xff]] ^ INV_SUB_MIX_3[SBOX[t & 0xff]];
21353	                }
21354	            }
21355	        },
21356
21357	        encryptBlock: function (M, offset) {
21358	            this._doCryptBlock(M, offset, this._keySchedule, SUB_MIX_0, SUB_MIX_1, SUB_MIX_2, SUB_MIX_3, SBOX);
21359	        },
21360
21361	        decryptBlock: function (M, offset) {
21362	            // Swap 2nd and 4th rows
21363	            var t = M[offset + 1];
21364	            M[offset + 1] = M[offset + 3];
21365	            M[offset + 3] = t;
21366
21367	            this._doCryptBlock(M, offset, this._invKeySchedule, INV_SUB_MIX_0, INV_SUB_MIX_1, INV_SUB_MIX_2, INV_SUB_MIX_3, INV_SBOX);
21368
21369	            // Inv swap 2nd and 4th rows
21370	            var t = M[offset + 1];
21371	            M[offset + 1] = M[offset + 3];
21372	            M[offset + 3] = t;
21373	        },
21374
21375	        _doCryptBlock: function (M, offset, keySchedule, SUB_MIX_0, SUB_MIX_1, SUB_MIX_2, SUB_MIX_3, SBOX) {
21376	            // Shortcut
vendor: 14,827 bytes, lines 21377-21817
21377	            var nRounds = this._nRounds;
21378
21379	            // Get input, add round key
21380	            var s0 = M[offset]     ^ keySchedule[0];
21381	            var s1 = M[offset + 1] ^ keySchedule[1];
21382	            var s2 = M[offset + 2] ^ keySchedule[2];
21383	            var s3 = M[offset + 3] ^ keySchedule[3];
21384
21385	            // Key schedule row counter
21386	            var ksRow = 4;
21387
21388	            // Rounds
21389	            for (var round = 1; round < nRounds; round++) {
21390	                // Shift rows, sub bytes, mix columns, add round key
21391	                var t0 = SUB_MIX_0[s0 >>> 24] ^ SUB_MIX_1[(s1 >>> 16) & 0xff] ^ SUB_MIX_2[(s2 >>> 8) & 0xff] ^ SUB_MIX_3[s3 & 0xff] ^ keySchedule[ksRow++];
21392	                var t1 = SUB_MIX_0[s1 >>> 24] ^ SUB_MIX_1[(s2 >>> 16) & 0xff] ^ SUB_MIX_2[(s3 >>> 8) & 0xff] ^ SUB_MIX_3[s0 & 0xff] ^ keySchedule[ksRow++];
21393	                var t2 = SUB_MIX_0[s2 >>> 24] ^ SUB_MIX_1[(s3 >>> 16) & 0xff] ^ SUB_MIX_2[(s0 >>> 8) & 0xff] ^ SUB_MIX_3[s1 & 0xff] ^ keySchedule[ksRow++];
21394	                var t3 = SUB_MIX_0[s3 >>> 24] ^ SUB_MIX_1[(s0 >>> 16) & 0xff] ^ SUB_MIX_2[(s1 >>> 8) & 0xff] ^ SUB_MIX_3[s2 & 0xff] ^ keySchedule[ksRow++];
21395
21396	                // Update state
21397	                s0 = t0;
21398	                s1 = t1;
21399	                s2 = t2;
21400	                s3 = t3;
21401	            }
21402
21403	            // Shift rows, sub bytes, add round key
21404	            var t0 = ((SBOX[s0 >>> 24] << 24) | (SBOX[(s1 >>> 16) & 0xff] << 16) | (SBOX[(s2 >>> 8) & 0xff] << 8) | SBOX[s3 & 0xff]) ^ keySchedule[ksRow++];
21405	            var t1 = ((SBOX[s1 >>> 24] << 24) | (SBOX[(s2 >>> 16) & 0xff] << 16) | (SBOX[(s3 >>> 8) & 0xff] << 8) | SBOX[s0 & 0xff]) ^ keySchedule[ksRow++];
21406	            var t2 = ((SBOX[s2 >>> 24] << 24) | (SBOX[(s3 >>> 16) & 0xff] << 16) | (SBOX[(s0 >>> 8) & 0xff] << 8) | SBOX[s1 & 0xff]) ^ keySchedule[ksRow++];
21407	            var t3 = ((SBOX[s3 >>> 24] << 24) | (SBOX[(s0 >>> 16) & 0xff] << 16) | (SBOX[(s1 >>> 8) & 0xff] << 8) | SBOX[s2 & 0xff]) ^ keySchedule[ksRow++];
21408
21409	            // Set output
21410	            M[offset]     = t0;
21411	            M[offset + 1] = t1;
21412	            M[offset + 2] = t2;
21413	            M[offset + 3] = t3;
21414	        },
21415
21416	        keySize: 256/32
21417	    });
21418
21419	    /**
21420	     * Shortcut functions to the cipher's object interface.
21421	     *
21422	     * @example
21423	     *
21424	     *     var ciphertext = CryptoJS.AES.encrypt(message, key, cfg);
21425	     *     var plaintext  = CryptoJS.AES.decrypt(ciphertext, key, cfg);
21426	     */
21427	    C.AES = BlockCipher._createHelper(AES);
21428	}());
21429
21430
21431	(function () {
21432	    // Shortcuts
21433	    var C = CryptoJS;
21434	    var C_lib = C.lib;
21435	    var WordArray = C_lib.WordArray;
21436	    var BlockCipher = C_lib.BlockCipher;
21437	    var C_algo = C.algo;
21438
21439	    // Permuted Choice 1 constants
21440	    var PC1 = [
21441	        57, 49, 41, 33, 25, 17, 9,  1,
21442	        58, 50, 42, 34, 26, 18, 10, 2,
21443	        59, 51, 43, 35, 27, 19, 11, 3,
21444	        60, 52, 44, 36, 63, 55, 47, 39,
21445	        31, 23, 15, 7,  62, 54, 46, 38,
21446	        30, 22, 14, 6,  61, 53, 45, 37,
21447	        29, 21, 13, 5,  28, 20, 12, 4
21448	    ];
21449
21450	    // Permuted Choice 2 constants
21451	    var PC2 = [
21452	        14, 17, 11, 24, 1,  5,
21453	        3,  28, 15, 6,  21, 10,
21454	        23, 19, 12, 4,  26, 8,
21455	        16, 7,  27, 20, 13, 2,
21456	        41, 52, 31, 37, 47, 55,
21457	        30, 40, 51, 45, 33, 48,
21458	        44, 49, 39, 56, 34, 53,
21459	        46, 42, 50, 36, 29, 32
21460	    ];
21461
21462	    // Cumulative bit shift constants
21463	    var BIT_SHIFTS = [1,  2,  4,  6,  8,  10, 12, 14, 15, 17, 19, 21, 23, 25, 27, 28];
21464
21465	    // SBOXes and round permutation constants
21466	    var SBOX_P = [
21467	        {
21468	            0x0: 0x808200,
21469	            0x10000000: 0x8000,
21470	            0x20000000: 0x808002,
21471	            0x30000000: 0x2,
21472	            0x40000000: 0x200,
21473	            0x50000000: 0x808202,
21474	            0x60000000: 0x800202,
21475	            0x70000000: 0x800000,
21476	            0x80000000: 0x202,
21477	            0x90000000: 0x800200,
21478	            0xa0000000: 0x8200,
21479	            0xb0000000: 0x808000,
21480	            0xc0000000: 0x8002,
21481	            0xd0000000: 0x800002,
21482	            0xe0000000: 0x0,
21483	            0xf0000000: 0x8202,
21484	            0x8000000: 0x0,
21485	            0x18000000: 0x808202,
21486	            0x28000000: 0x8202,
21487	            0x38000000: 0x8000,
21488	            0x48000000: 0x808200,
21489	            0x58000000: 0x200,
21490	            0x68000000: 0x808002,
21491	            0x78000000: 0x2,
21492	            0x88000000: 0x800200,
21493	            0x98000000: 0x8200,
21494	            0xa8000000: 0x808000,
21495	            0xb8000000: 0x800202,
21496	            0xc8000000: 0x800002,
21497	            0xd8000000: 0x8002,
21498	            0xe8000000: 0x202,
21499	            0xf8000000: 0x800000,
21500	            0x1: 0x8000,
21501	            0x10000001: 0x2,
21502	            0x20000001: 0x808200,
21503	            0x30000001: 0x800000,
21504	            0x40000001: 0x808002,
21505	            0x50000001: 0x8200,
21506	            0x60000001: 0x200,
21507	            0x70000001: 0x800202,
21508	            0x80000001: 0x808202,
21509	            0x90000001: 0x808000,
21510	            0xa0000001: 0x800002,
21511	            0xb0000001: 0x8202,
21512	            0xc0000001: 0x202,
21513	            0xd0000001: 0x800200,
21514	            0xe0000001: 0x8002,
21515	            0xf0000001: 0x0,
21516	            0x8000001: 0x808202,
21517	            0x18000001: 0x808000,
21518	            0x28000001: 0x800000,
21519	            0x38000001: 0x200,
21520	            0x48000001: 0x8000,
21521	            0x58000001: 0x800002,
21522	            0x68000001: 0x2,
21523	            0x78000001: 0x8202,
21524	            0x88000001: 0x8002,
21525	            0x98000001: 0x800202,
21526	            0xa8000001: 0x202,
21527	            0xb8000001: 0x808200,
21528	            0xc8000001: 0x800200,
21529	            0xd8000001: 0x0,
21530	            0xe8000001: 0x8200,
21531	            0xf8000001: 0x808002
21532	        },
21533	        {
21534	            0x0: 0x40084010,
21535	            0x1000000: 0x4000,
21536	            0x2000000: 0x80000,
21537	            0x3000000: 0x40080010,
21538	            0x4000000: 0x40000010,
21539	            0x5000000: 0x40084000,
21540	            0x6000000: 0x40004000,
21541	            0x7000000: 0x10,
21542	            0x8000000: 0x84000,
21543	            0x9000000: 0x40004010,
21544	            0xa000000: 0x40000000,
21545	            0xb000000: 0x84010,
21546	            0xc000000: 0x80010,
21547	            0xd000000: 0x0,
21548	            0xe000000: 0x4010,
21549	            0xf000000: 0x40080000,
21550	            0x800000: 0x40004000,
21551	            0x1800000: 0x84010,
21552	            0x2800000: 0x10,
21553	            0x3800000: 0x40004010,
21554	            0x4800000: 0x40084010,
21555	            0x5800000: 0x40000000,
21556	            0x6800000: 0x80000,
21557	            0x7800000: 0x40080010,
21558	            0x8800000: 0x80010,
21559	            0x9800000: 0x0,
21560	            0xa800000: 0x4000,
21561	            0xb800000: 0x40080000,
21562	            0xc800000: 0x40000010,
21563	            0xd800000: 0x84000,
21564	            0xe800000: 0x40084000,
21565	            0xf800000: 0x4010,
21566	            0x10000000: 0x0,
21567	            0x11000000: 0x40080010,
21568	            0x12000000: 0x40004010,
21569	            0x13000000: 0x40084000,
21570	            0x14000000: 0x40080000,
21571	            0x15000000: 0x10,
21572	            0x16000000: 0x84010,
21573	            0x17000000: 0x4000,
21574	            0x18000000: 0x4010,
21575	            0x19000000: 0x80000,
21576	            0x1a000000: 0x80010,
21577	            0x1b000000: 0x40000010,
21578	            0x1c000000: 0x84000,
21579	            0x1d000000: 0x40004000,
21580	            0x1e000000: 0x40000000,
21581	            0x1f000000: 0x40084010,
21582	            0x10800000: 0x84010,
21583	            0x11800000: 0x80000,
21584	            0x12800000: 0x40080000,
21585	            0x13800000: 0x4000,
21586	            0x14800000: 0x40004000,
21587	            0x15800000: 0x40084010,
21588	            0x16800000: 0x10,
21589	            0x17800000: 0x40000000,
21590	            0x18800000: 0x40084000,
21591	            0x19800000: 0x40000010,
21592	            0x1a800000: 0x40004010,
21593	            0x1b800000: 0x80010,
21594	            0x1c800000: 0x0,
21595	            0x1d800000: 0x4010,
21596	            0x1e800000: 0x40080010,
21597	            0x1f800000: 0x84000
21598	        },
21599	        {
21600	            0x0: 0x104,
21601	            0x100000: 0x0,
21602	            0x200000: 0x4000100,
21603	            0x300000: 0x10104,
21604	            0x400000: 0x10004,
21605	            0x500000: 0x4000004,
21606	            0x600000: 0x4010104,
21607	            0x700000: 0x4010000,
21608	            0x800000: 0x4000000,
21609	            0x900000: 0x4010100,
21610	            0xa00000: 0x10100,
21611	            0xb00000: 0x4010004,
21612	            0xc00000: 0x4000104,
21613	            0xd00000: 0x10000,
21614	            0xe00000: 0x4,
21615	            0xf00000: 0x100,
21616	            0x80000: 0x4010100,
21617	            0x180000: 0x4010004,
21618	            0x280000: 0x0,
21619	            0x380000: 0x4000100,
21620	            0x480000: 0x4000004,
21621	            0x580000: 0x10000,
21622	            0x680000: 0x10004,
21623	            0x780000: 0x104,
21624	            0x880000: 0x4,
21625	            0x980000: 0x100,
21626	            0xa80000: 0x4010000,
21627	            0xb80000: 0x10104,
21628	            0xc80000: 0x10100,
21629	            0xd80000: 0x4000104,
21630	            0xe80000: 0x4010104,
21631	            0xf80000: 0x4000000,
21632	            0x1000000: 0x4010100,
21633	            0x1100000: 0x10004,
21634	            0x1200000: 0x10000,
21635	            0x1300000: 0x4000100,
21636	            0x1400000: 0x100,
21637	            0x1500000: 0x4010104,
21638	            0x1600000: 0x4000004,
21639	            0x1700000: 0x0,
21640	            0x1800000: 0x4000104,
21641	            0x1900000: 0x4000000,
21642	            0x1a00000: 0x4,
21643	            0x1b00000: 0x10100,
21644	            0x1c00000: 0x4010000,
21645	            0x1d00000: 0x104,
21646	            0x1e00000: 0x10104,
21647	            0x1f00000: 0x4010004,
21648	            0x1080000: 0x4000000,
21649	            0x1180000: 0x104,
21650	            0x1280000: 0x4010100,
21651	            0x1380000: 0x0,
21652	            0x1480000: 0x10004,
21653	            0x1580000: 0x4000100,
21654	            0x1680000: 0x100,
21655	            0x1780000: 0x4010004,
21656	            0x1880000: 0x10000,
21657	            0x1980000: 0x4010104,
21658	            0x1a80000: 0x10104,
21659	            0x1b80000: 0x4000004,
21660	            0x1c80000: 0x4000104,
21661	            0x1d80000: 0x4010000,
21662	            0x1e80000: 0x4,
21663	            0x1f80000: 0x10100
21664	        },
21665	        {
21666	            0x0: 0x80401000,
21667	            0x10000: 0x80001040,
21668	            0x20000: 0x401040,
21669	            0x30000: 0x80400000,
21670	            0x40000: 0x0,
21671	            0x50000: 0x401000,
21672	            0x60000: 0x80000040,
21673	            0x70000: 0x400040,
21674	            0x80000: 0x80000000,
21675	            0x90000: 0x400000,
21676	            0xa0000: 0x40,
21677	            0xb0000: 0x80001000,
21678	            0xc0000: 0x80400040,
21679	            0xd0000: 0x1040,
21680	            0xe0000: 0x1000,
21681	            0xf0000: 0x80401040,
21682	            0x8000: 0x80001040,
21683	            0x18000: 0x40,
21684	            0x28000: 0x80400040,
21685	            0x38000: 0x80001000,
21686	            0x48000: 0x401000,
21687	            0x58000: 0x80401040,
21688	            0x68000: 0x0,
21689	            0x78000: 0x80400000,
21690	            0x88000: 0x1000,
21691	            0x98000: 0x80401000,
21692	            0xa8000: 0x400000,
21693	            0xb8000: 0x1040,
21694	            0xc8000: 0x80000000,
21695	            0xd8000: 0x400040,
21696	            0xe8000: 0x401040,
21697	            0xf8000: 0x80000040,
21698	            0x100000: 0x400040,
21699	            0x110000: 0x401000,
21700	            0x120000: 0x80000040,
21701	            0x130000: 0x0,
21702	            0x140000: 0x1040,
21703	            0x150000: 0x80400040,
21704	            0x160000: 0x80401000,
21705	            0x170000: 0x80001040,
21706	            0x180000: 0x80401040,
21707	            0x190000: 0x80000000,
21708	            0x1a0000: 0x80400000,
21709	            0x1b0000: 0x401040,
21710	            0x1c0000: 0x80001000,
21711	            0x1d0000: 0x400000,
21712	            0x1e0000: 0x40,
21713	            0x1f0000: 0x1000,
21714	            0x108000: 0x80400000,
21715	            0x118000: 0x80401040,
21716	            0x128000: 0x0,
21717	            0x138000: 0x401000,
21718	            0x148000: 0x400040,
21719	            0x158000: 0x80000000,
21720	            0x168000: 0x80001040,
21721	            0x178000: 0x40,
21722	            0x188000: 0x80000040,
21723	            0x198000: 0x1000,
21724	            0x1a8000: 0x80001000,
21725	            0x1b8000: 0x80400040,
21726	            0x1c8000: 0x1040,
21727	            0x1d8000: 0x80401000,
21728	            0x1e8000: 0x400000,
21729	            0x1f8000: 0x401040
21730	        },
21731	        {
21732	            0x0: 0x80,
21733	            0x1000: 0x1040000,
21734	            0x2000: 0x40000,
21735	            0x3000: 0x20000000,
21736	            0x4000: 0x20040080,
21737	            0x5000: 0x1000080,
21738	            0x6000: 0x21000080,
21739	            0x7000: 0x40080,
21740	            0x8000: 0x1000000,
21741	            0x9000: 0x20040000,
21742	            0xa000: 0x20000080,
21743	            0xb000: 0x21040080,
21744	            0xc000: 0x21040000,
21745	            0xd000: 0x0,
21746	            0xe000: 0x1040080,
21747	            0xf000: 0x21000000,
21748	            0x800: 0x1040080,
21749	            0x1800: 0x21000080,
21750	            0x2800: 0x80,
21751	            0x3800: 0x1040000,
21752	            0x4800: 0x40000,
21753	            0x5800: 0x20040080,
21754	            0x6800: 0x21040000,
21755	            0x7800: 0x20000000,
21756	            0x8800: 0x20040000,
21757	            0x9800: 0x0,
21758	            0xa800: 0x21040080,
21759	            0xb800: 0x1000080,
21760	            0xc800: 0x20000080,
21761	            0xd800: 0x21000000,
21762	            0xe800: 0x1000000,
21763	            0xf800: 0x40080,
21764	            0x10000: 0x40000,
21765	            0x11000: 0x80,
21766	            0x12000: 0x20000000,
21767	            0x13000: 0x21000080,
21768	            0x14000: 0x1000080,
21769	            0x15000: 0x21040000,
21770	            0x16000: 0x20040080,
21771	            0x17000: 0x1000000,
21772	            0x18000: 0x21040080,
21773	            0x19000: 0x21000000,
21774	            0x1a000: 0x1040000,
21775	            0x1b000: 0x20040000,
21776	            0x1c000: 0x40080,
21777	            0x1d000: 0x20000080,
21778	            0x1e000: 0x0,
21779	            0x1f000: 0x1040080,
21780	            0x10800: 0x21000080,
21781	            0x11800: 0x1000000,
21782	            0x12800: 0x1040000,
21783	            0x13800: 0x20040080,
21784	            0x14800: 0x20000000,
21785	            0x15800: 0x1040080,
21786	            0x16800: 0x80,
21787	            0x17800: 0x21040000,
21788	            0x18800: 0x40080,
21789	            0x19800: 0x21040080,
21790	            0x1a800: 0x0,
21791	            0x1b800: 0x21000000,
21792	            0x1c800: 0x1000080,
21793	            0x1d800: 0x40000,
21794	            0x1e800: 0x20040000,
21795	            0x1f800: 0x20000080
21796	        },
21797	        {
21798	            0x0: 0x10000008,
21799	            0x100: 0x2000,
21800	            0x200: 0x10200000,
21801	            0x300: 0x10202008,
21802	            0x400: 0x10002000,
21803	            0x500: 0x200000,
21804	            0x600: 0x200008,
21805	            0x700: 0x10000000,
21806	            0x800: 0x0,
21807	            0x900: 0x10002008,
21808	            0xa00: 0x202000,
21809	            0xb00: 0x8,
21810	            0xc00: 0x10200008,
21811	            0xd00: 0x202008,
21812	            0xe00: 0x2008,
21813	            0xf00: 0x10202000,
21814	            0x80: 0x10200000,
21815	            0x180: 0x10202008,
21816	            0x280: 0x8,
21817	            0x380: 0x200000,
vendor: 9,888 bytes, lines 21818-22131
21818	            0x480: 0x202008,
21819	            0x580: 0x10000008,
21820	            0x680: 0x10002000,
21821	            0x780: 0x2008,
21822	            0x880: 0x200008,
21823	            0x980: 0x2000,
21824	            0xa80: 0x10002008,
21825	            0xb80: 0x10200008,
21826	            0xc80: 0x0,
21827	            0xd80: 0x10202000,
21828	            0xe80: 0x202000,
21829	            0xf80: 0x10000000,
21830	            0x1000: 0x10002000,
21831	            0x1100: 0x10200008,
21832	            0x1200: 0x10202008,
21833	            0x1300: 0x2008,
21834	            0x1400: 0x200000,
21835	            0x1500: 0x10000000,
21836	            0x1600: 0x10000008,
21837	            0x1700: 0x202000,
21838	            0x1800: 0x202008,
21839	            0x1900: 0x0,
21840	            0x1a00: 0x8,
21841	            0x1b00: 0x10200000,
21842	            0x1c00: 0x2000,
21843	            0x1d00: 0x10002008,
21844	            0x1e00: 0x10202000,
21845	            0x1f00: 0x200008,
21846	            0x1080: 0x8,
21847	            0x1180: 0x202000,
21848	            0x1280: 0x200000,
21849	            0x1380: 0x10000008,
21850	            0x1480: 0x10002000,
21851	            0x1580: 0x2008,
21852	            0x1680: 0x10202008,
21853	            0x1780: 0x10200000,
21854	            0x1880: 0x10202000,
21855	            0x1980: 0x10200008,
21856	            0x1a80: 0x2000,
21857	            0x1b80: 0x202008,
21858	            0x1c80: 0x200008,
21859	            0x1d80: 0x0,
21860	            0x1e80: 0x10000000,
21861	            0x1f80: 0x10002008
21862	        },
21863	        {
21864	            0x0: 0x100000,
21865	            0x10: 0x2000401,
21866	            0x20: 0x400,
21867	            0x30: 0x100401,
21868	            0x40: 0x2100401,
21869	            0x50: 0x0,
21870	            0x60: 0x1,
21871	            0x70: 0x2100001,
21872	            0x80: 0x2000400,
21873	            0x90: 0x100001,
21874	            0xa0: 0x2000001,
21875	            0xb0: 0x2100400,
21876	            0xc0: 0x2100000,
21877	            0xd0: 0x401,
21878	            0xe0: 0x100400,
21879	            0xf0: 0x2000000,
21880	            0x8: 0x2100001,
21881	            0x18: 0x0,
21882	            0x28: 0x2000401,
21883	            0x38: 0x2100400,
21884	            0x48: 0x100000,
21885	            0x58: 0x2000001,
21886	            0x68: 0x2000000,
21887	            0x78: 0x401,
21888	            0x88: 0x100401,
21889	            0x98: 0x2000400,
21890	            0xa8: 0x2100000,
21891	            0xb8: 0x100001,
21892	            0xc8: 0x400,
21893	            0xd8: 0x2100401,
21894	            0xe8: 0x1,
21895	            0xf8: 0x100400,
21896	            0x100: 0x2000000,
21897	            0x110: 0x100000,
21898	            0x120: 0x2000401,
21899	            0x130: 0x2100001,
21900	            0x140: 0x100001,
21901	            0x150: 0x2000400,
21902	            0x160: 0x2100400,
21903	            0x170: 0x100401,
21904	            0x180: 0x401,
21905	            0x190: 0x2100401,
21906	            0x1a0: 0x100400,
21907	            0x1b0: 0x1,
21908	            0x1c0: 0x0,
21909	            0x1d0: 0x2100000,
21910	            0x1e0: 0x2000001,
21911	            0x1f0: 0x400,
21912	            0x108: 0x100400,
21913	            0x118: 0x2000401,
21914	            0x128: 0x2100001,
21915	            0x138: 0x1,
21916	            0x148: 0x2000000,
21917	            0x158: 0x100000,
21918	            0x168: 0x401,
21919	            0x178: 0x2100400,
21920	            0x188: 0x2000001,
21921	            0x198: 0x2100000,
21922	            0x1a8: 0x0,
21923	            0x1b8: 0x2100401,
21924	            0x1c8: 0x100401,
21925	            0x1d8: 0x400,
21926	            0x1e8: 0x2000400,
21927	            0x1f8: 0x100001
21928	        },
21929	        {
21930	            0x0: 0x8000820,
21931	            0x1: 0x20000,
21932	            0x2: 0x8000000,
21933	            0x3: 0x20,
21934	            0x4: 0x20020,
21935	            0x5: 0x8020820,
21936	            0x6: 0x8020800,
21937	            0x7: 0x800,
21938	            0x8: 0x8020000,
21939	            0x9: 0x8000800,
21940	            0xa: 0x20800,
21941	            0xb: 0x8020020,
21942	            0xc: 0x820,
21943	            0xd: 0x0,
21944	            0xe: 0x8000020,
21945	            0xf: 0x20820,
21946	            0x80000000: 0x800,
21947	            0x80000001: 0x8020820,
21948	            0x80000002: 0x8000820,
21949	            0x80000003: 0x8000000,
21950	            0x80000004: 0x8020000,
21951	            0x80000005: 0x20800,
21952	            0x80000006: 0x20820,
21953	            0x80000007: 0x20,
21954	            0x80000008: 0x8000020,
21955	            0x80000009: 0x820,
21956	            0x8000000a: 0x20020,
21957	            0x8000000b: 0x8020800,
21958	            0x8000000c: 0x0,
21959	            0x8000000d: 0x8020020,
21960	            0x8000000e: 0x8000800,
21961	            0x8000000f: 0x20000,
21962	            0x10: 0x20820,
21963	            0x11: 0x8020800,
21964	            0x12: 0x20,
21965	            0x13: 0x800,
21966	            0x14: 0x8000800,
21967	            0x15: 0x8000020,
21968	            0x16: 0x8020020,
21969	            0x17: 0x20000,
21970	            0x18: 0x0,
21971	            0x19: 0x20020,
21972	            0x1a: 0x8020000,
21973	            0x1b: 0x8000820,
21974	            0x1c: 0x8020820,
21975	            0x1d: 0x20800,
21976	            0x1e: 0x820,
21977	            0x1f: 0x8000000,
21978	            0x80000010: 0x20000,
21979	            0x80000011: 0x800,
21980	            0x80000012: 0x8020020,
21981	            0x80000013: 0x20820,
21982	            0x80000014: 0x20,
21983	            0x80000015: 0x8020000,
21984	            0x80000016: 0x8000000,
21985	            0x80000017: 0x8000820,
21986	            0x80000018: 0x8020820,
21987	            0x80000019: 0x8000020,
21988	            0x8000001a: 0x8000800,
21989	            0x8000001b: 0x0,
21990	            0x8000001c: 0x20800,
21991	            0x8000001d: 0x820,
21992	            0x8000001e: 0x20020,
21993	            0x8000001f: 0x8020800
21994	        }
21995	    ];
21996
21997	    // Masks that select the SBOX input
21998	    var SBOX_MASK = [
21999	        0xf8000001, 0x1f800000, 0x01f80000, 0x001f8000,
22000	        0x0001f800, 0x00001f80, 0x000001f8, 0x8000001f
22001	    ];
22002
22003	    /**
22004	     * DES block cipher algorithm.
22005	     */
22006	    var DES = C_algo.DES = BlockCipher.extend({
22007	        _doReset: function () {
22008	            // Shortcuts
22009	            var key = this._key;
22010	            var keyWords = key.words;
22011
22012	            // Select 56 bits according to PC1
22013	            var keyBits = [];
22014	            for (var i = 0; i < 56; i++) {
22015	                var keyBitPos = PC1[i] - 1;
22016	                keyBits[i] = (keyWords[keyBitPos >>> 5] >>> (31 - keyBitPos % 32)) & 1;
22017	            }
22018
22019	            // Assemble 16 subkeys
22020	            var subKeys = this._subKeys = [];
22021	            for (var nSubKey = 0; nSubKey < 16; nSubKey++) {
22022	                // Create subkey
22023	                var subKey = subKeys[nSubKey] = [];
22024
22025	                // Shortcut
22026	                var bitShift = BIT_SHIFTS[nSubKey];
22027
22028	                // Select 48 bits according to PC2
22029	                for (var i = 0; i < 24; i++) {
22030	                    // Select from the left 28 key bits
22031	                    subKey[(i / 6) | 0] |= keyBits[((PC2[i] - 1) + bitShift) % 28] << (31 - i % 6);
22032
22033	                    // Select from the right 28 key bits
22034	                    subKey[4 + ((i / 6) | 0)] |= keyBits[28 + (((PC2[i + 24] - 1) + bitShift) % 28)] << (31 - i % 6);
22035	                }
22036
22037	                // Since each subkey is applied to an expanded 32-bit input,
22038	                // the subkey can be broken into 8 values scaled to 32-bits,
22039	                // which allows the key to be used without expansion
22040	                subKey[0] = (subKey[0] << 1) | (subKey[0] >>> 31);
22041	                for (var i = 1; i < 7; i++) {
22042	                    subKey[i] = subKey[i] >>> ((i - 1) * 4 + 3);
22043	                }
22044	                subKey[7] = (subKey[7] << 5) | (subKey[7] >>> 27);
22045	            }
22046
22047	            // Compute inverse subkeys
22048	            var invSubKeys = this._invSubKeys = [];
22049	            for (var i = 0; i < 16; i++) {
22050	                invSubKeys[i] = subKeys[15 - i];
22051	            }
22052	        },
22053
22054	        encryptBlock: function (M, offset) {
22055	            this._doCryptBlock(M, offset, this._subKeys);
22056	        },
22057
22058	        decryptBlock: function (M, offset) {
22059	            this._doCryptBlock(M, offset, this._invSubKeys);
22060	        },
22061
22062	        _doCryptBlock: function (M, offset, subKeys) {
22063	            // Get input
22064	            this._lBlock = M[offset];
22065	            this._rBlock = M[offset + 1];
22066
22067	            // Initial permutation
22068	            exchangeLR.call(this, 4,  0x0f0f0f0f);
22069	            exchangeLR.call(this, 16, 0x0000ffff);
22070	            exchangeRL.call(this, 2,  0x33333333);
22071	            exchangeRL.call(this, 8,  0x00ff00ff);
22072	            exchangeLR.call(this, 1,  0x55555555);
22073
22074	            // Rounds
22075	            for (var round = 0; round < 16; round++) {
22076	                // Shortcuts
22077	                var subKey = subKeys[round];
22078	                var lBlock = this._lBlock;
22079	                var rBlock = this._rBlock;
22080
22081	                // Feistel function
22082	                var f = 0;
22083	                for (var i = 0; i < 8; i++) {
22084	                    f |= SBOX_P[i][((rBlock ^ subKey[i]) & SBOX_MASK[i]) >>> 0];
22085	                }
22086	                this._lBlock = rBlock;
22087	                this._rBlock = lBlock ^ f;
22088	            }
22089
22090	            // Undo swap from last round
22091	            var t = this._lBlock;
22092	            this._lBlock = this._rBlock;
22093	            this._rBlock = t;
22094
22095	            // Final permutation
22096	            exchangeLR.call(this, 1,  0x55555555);
22097	            exchangeRL.call(this, 8,  0x00ff00ff);
22098	            exchangeRL.call(this, 2,  0x33333333);
22099	            exchangeLR.call(this, 16, 0x0000ffff);
22100	            exchangeLR.call(this, 4,  0x0f0f0f0f);
22101
22102	            // Set output
22103	            M[offset] = this._lBlock;
22104	            M[offset + 1] = this._rBlock;
22105	        },
22106
22107	        keySize: 64/32,
22108
22109	        ivSize: 64/32,
22110
22111	        blockSize: 64/32
22112	    });
22113
22114	    // Swap bits across the left and right words
22115	    function exchangeLR(offset, mask) {
22116	        var t = ((this._lBlock >>> offset) ^ this._rBlock) & mask;
22117	        this._rBlock ^= t;
22118	        this._lBlock ^= t << offset;
22119	    }
22120
22121	    function exchangeRL(offset, mask) {
22122	        var t = ((this._rBlock >>> offset) ^ this._lBlock) & mask;
22123	        this._lBlock ^= t;
22124	        this._rBlock ^= t << offset;
22125	    }
22126
22127	    /**
22128	     * Shortcut functions to the cipher's object interface.
22129	     *
22130	     * @example
22131	     *
vendor: 38,179 bytes, lines 22132-23114
22132	     *     var ciphertext = CryptoJS.DES.encrypt(message, key, cfg);
22133	     *     var plaintext  = CryptoJS.DES.decrypt(ciphertext, key, cfg);
22134	     */
22135	    C.DES = BlockCipher._createHelper(DES);
22136
22137	    /**
22138	     * Triple-DES block cipher algorithm.
22139	     */
22140	    var TripleDES = C_algo.TripleDES = BlockCipher.extend({
22141	        _doReset: function () {
22142	            // Shortcuts
22143	            var key = this._key;
22144	            var keyWords = key.words;
22145	            // Make sure the key length is valid (64, 128 or >= 192 bit)
22146	            if (keyWords.length !== 2 && keyWords.length !== 4 && keyWords.length < 6) {
22147	                throw new Error('Invalid key length - 3DES requires the key length to be 64, 128, 192 or >192.');
22148	            }
22149
22150	            // Extend the key according to the keying options defined in 3DES standard
22151	            var key1 = keyWords.slice(0, 2);
22152	            var key2 = keyWords.length < 4 ? keyWords.slice(0, 2) : keyWords.slice(2, 4);
22153	            var key3 = keyWords.length < 6 ? keyWords.slice(0, 2) : keyWords.slice(4, 6);
22154
22155	            // Create DES instances
22156	            this._des1 = DES.createEncryptor(WordArray.create(key1));
22157	            this._des2 = DES.createEncryptor(WordArray.create(key2));
22158	            this._des3 = DES.createEncryptor(WordArray.create(key3));
22159	        },
22160
22161	        encryptBlock: function (M, offset) {
22162	            this._des1.encryptBlock(M, offset);
22163	            this._des2.decryptBlock(M, offset);
22164	            this._des3.encryptBlock(M, offset);
22165	        },
22166
22167	        decryptBlock: function (M, offset) {
22168	            this._des3.decryptBlock(M, offset);
22169	            this._des2.encryptBlock(M, offset);
22170	            this._des1.decryptBlock(M, offset);
22171	        },
22172
22173	        keySize: 192/32,
22174
22175	        ivSize: 64/32,
22176
22177	        blockSize: 64/32
22178	    });
22179
22180	    /**
22181	     * Shortcut functions to the cipher's object interface.
22182	     *
22183	     * @example
22184	     *
22185	     *     var ciphertext = CryptoJS.TripleDES.encrypt(message, key, cfg);
22186	     *     var plaintext  = CryptoJS.TripleDES.decrypt(ciphertext, key, cfg);
22187	     */
22188	    C.TripleDES = BlockCipher._createHelper(TripleDES);
22189	}());
22190
22191
22192	(function () {
22193	    // Shortcuts
22194	    var C = CryptoJS;
22195	    var C_lib = C.lib;
22196	    var StreamCipher = C_lib.StreamCipher;
22197	    var C_algo = C.algo;
22198
22199	    /**
22200	     * RC4 stream cipher algorithm.
22201	     */
22202	    var RC4 = C_algo.RC4 = StreamCipher.extend({
22203	        _doReset: function () {
22204	            // Shortcuts
22205	            var key = this._key;
22206	            var keyWords = key.words;
22207	            var keySigBytes = key.sigBytes;
22208
22209	            // Init sbox
22210	            var S = this._S = [];
22211	            for (var i = 0; i < 256; i++) {
22212	                S[i] = i;
22213	            }
22214
22215	            // Key setup
22216	            for (var i = 0, j = 0; i < 256; i++) {
22217	                var keyByteIndex = i % keySigBytes;
22218	                var keyByte = (keyWords[keyByteIndex >>> 2] >>> (24 - (keyByteIndex % 4) * 8)) & 0xff;
22219
22220	                j = (j + S[i] + keyByte) % 256;
22221
22222	                // Swap
22223	                var t = S[i];
22224	                S[i] = S[j];
22225	                S[j] = t;
22226	            }
22227
22228	            // Counters
22229	            this._i = this._j = 0;
22230	        },
22231
22232	        _doProcessBlock: function (M, offset) {
22233	            M[offset] ^= generateKeystreamWord.call(this);
22234	        },
22235
22236	        keySize: 256/32,
22237
22238	        ivSize: 0
22239	    });
22240
22241	    function generateKeystreamWord() {
22242	        // Shortcuts
22243	        var S = this._S;
22244	        var i = this._i;
22245	        var j = this._j;
22246
22247	        // Generate keystream word
22248	        var keystreamWord = 0;
22249	        for (var n = 0; n < 4; n++) {
22250	            i = (i + 1) % 256;
22251	            j = (j + S[i]) % 256;
22252
22253	            // Swap
22254	            var t = S[i];
22255	            S[i] = S[j];
22256	            S[j] = t;
22257
22258	            keystreamWord |= S[(S[i] + S[j]) % 256] << (24 - n * 8);
22259	        }
22260
22261	        // Update counters
22262	        this._i = i;
22263	        this._j = j;
22264
22265	        return keystreamWord;
22266	    }
22267
22268	    /**
22269	     * Shortcut functions to the cipher's object interface.
22270	     *
22271	     * @example
22272	     *
22273	     *     var ciphertext = CryptoJS.RC4.encrypt(message, key, cfg);
22274	     *     var plaintext  = CryptoJS.RC4.decrypt(ciphertext, key, cfg);
22275	     */
22276	    C.RC4 = StreamCipher._createHelper(RC4);
22277
22278	    /**
22279	     * Modified RC4 stream cipher algorithm.
22280	     */
22281	    var RC4Drop = C_algo.RC4Drop = RC4.extend({
22282	        /**
22283	         * Configuration options.
22284	         *
22285	         * @property {number} drop The number of keystream words to drop. Default 192
22286	         */
22287	        cfg: RC4.cfg.extend({
22288	            drop: 192
22289	        }),
22290
22291	        _doReset: function () {
22292	            RC4._doReset.call(this);
22293
22294	            // Drop
22295	            for (var i = this.cfg.drop; i > 0; i--) {
22296	                generateKeystreamWord.call(this);
22297	            }
22298	        }
22299	    });
22300
22301	    /**
22302	     * Shortcut functions to the cipher's object interface.
22303	     *
22304	     * @example
22305	     *
22306	     *     var ciphertext = CryptoJS.RC4Drop.encrypt(message, key, cfg);
22307	     *     var plaintext  = CryptoJS.RC4Drop.decrypt(ciphertext, key, cfg);
22308	     */
22309	    C.RC4Drop = StreamCipher._createHelper(RC4Drop);
22310	}());
22311
22312
22313	(function () {
22314	    // Shortcuts
22315	    var C = CryptoJS;
22316	    var C_lib = C.lib;
22317	    var StreamCipher = C_lib.StreamCipher;
22318	    var C_algo = C.algo;
22319
22320	    // Reusable objects
22321	    var S  = [];
22322	    var C_ = [];
22323	    var G  = [];
22324
22325	    /**
22326	     * Rabbit stream cipher algorithm
22327	     */
22328	    var Rabbit = C_algo.Rabbit = StreamCipher.extend({
22329	        _doReset: function () {
22330	            // Shortcuts
22331	            var K = this._key.words;
22332	            var iv = this.cfg.iv;
22333
22334	            // Swap endian
22335	            for (var i = 0; i < 4; i++) {
22336	                K[i] = (((K[i] << 8)  | (K[i] >>> 24)) & 0x00ff00ff) |
22337	                       (((K[i] << 24) | (K[i] >>> 8))  & 0xff00ff00);
22338	            }
22339
22340	            // Generate initial state values
22341	            var X = this._X = [
22342	                K[0], (K[3] << 16) | (K[2] >>> 16),
22343	                K[1], (K[0] << 16) | (K[3] >>> 16),
22344	                K[2], (K[1] << 16) | (K[0] >>> 16),
22345	                K[3], (K[2] << 16) | (K[1] >>> 16)
22346	            ];
22347
22348	            // Generate initial counter values
22349	            var C = this._C = [
22350	                (K[2] << 16) | (K[2] >>> 16), (K[0] & 0xffff0000) | (K[1] & 0x0000ffff),
22351	                (K[3] << 16) | (K[3] >>> 16), (K[1] & 0xffff0000) | (K[2] & 0x0000ffff),
22352	                (K[0] << 16) | (K[0] >>> 16), (K[2] & 0xffff0000) | (K[3] & 0x0000ffff),
22353	                (K[1] << 16) | (K[1] >>> 16), (K[3] & 0xffff0000) | (K[0] & 0x0000ffff)
22354	            ];
22355
22356	            // Carry bit
22357	            this._b = 0;
22358
22359	            // Iterate the system four times
22360	            for (var i = 0; i < 4; i++) {
22361	                nextState.call(this);
22362	            }
22363
22364	            // Modify the counters
22365	            for (var i = 0; i < 8; i++) {
22366	                C[i] ^= X[(i + 4) & 7];
22367	            }
22368
22369	            // IV setup
22370	            if (iv) {
22371	                // Shortcuts
22372	                var IV = iv.words;
22373	                var IV_0 = IV[0];
22374	                var IV_1 = IV[1];
22375
22376	                // Generate four subvectors
22377	                var i0 = (((IV_0 << 8) | (IV_0 >>> 24)) & 0x00ff00ff) | (((IV_0 << 24) | (IV_0 >>> 8)) & 0xff00ff00);
22378	                var i2 = (((IV_1 << 8) | (IV_1 >>> 24)) & 0x00ff00ff) | (((IV_1 << 24) | (IV_1 >>> 8)) & 0xff00ff00);
22379	                var i1 = (i0 >>> 16) | (i2 & 0xffff0000);
22380	                var i3 = (i2 << 16)  | (i0 & 0x0000ffff);
22381
22382	                // Modify counter values
22383	                C[0] ^= i0;
22384	                C[1] ^= i1;
22385	                C[2] ^= i2;
22386	                C[3] ^= i3;
22387	                C[4] ^= i0;
22388	                C[5] ^= i1;
22389	                C[6] ^= i2;
22390	                C[7] ^= i3;
22391
22392	                // Iterate the system four times
22393	                for (var i = 0; i < 4; i++) {
22394	                    nextState.call(this);
22395	                }
22396	            }
22397	        },
22398
22399	        _doProcessBlock: function (M, offset) {
22400	            // Shortcut
22401	            var X = this._X;
22402
22403	            // Iterate the system
22404	            nextState.call(this);
22405
22406	            // Generate four keystream words
22407	            S[0] = X[0] ^ (X[5] >>> 16) ^ (X[3] << 16);
22408	            S[1] = X[2] ^ (X[7] >>> 16) ^ (X[5] << 16);
22409	            S[2] = X[4] ^ (X[1] >>> 16) ^ (X[7] << 16);
22410	            S[3] = X[6] ^ (X[3] >>> 16) ^ (X[1] << 16);
22411
22412	            for (var i = 0; i < 4; i++) {
22413	                // Swap endian
22414	                S[i] = (((S[i] << 8)  | (S[i] >>> 24)) & 0x00ff00ff) |
22415	                       (((S[i] << 24) | (S[i] >>> 8))  & 0xff00ff00);
22416
22417	                // Encrypt
22418	                M[offset + i] ^= S[i];
22419	            }
22420	        },
22421
22422	        blockSize: 128/32,
22423
22424	        ivSize: 64/32
22425	    });
22426
22427	    function nextState() {
22428	        // Shortcuts
22429	        var X = this._X;
22430	        var C = this._C;
22431
22432	        // Save old counter values
22433	        for (var i = 0; i < 8; i++) {
22434	            C_[i] = C[i];
22435	        }
22436
22437	        // Calculate new counter values
22438	        C[0] = (C[0] + 0x4d34d34d + this._b) | 0;
22439	        C[1] = (C[1] + 0xd34d34d3 + ((C[0] >>> 0) < (C_[0] >>> 0) ? 1 : 0)) | 0;
22440	        C[2] = (C[2] + 0x34d34d34 + ((C[1] >>> 0) < (C_[1] >>> 0) ? 1 : 0)) | 0;
22441	        C[3] = (C[3] + 0x4d34d34d + ((C[2] >>> 0) < (C_[2] >>> 0) ? 1 : 0)) | 0;
22442	        C[4] = (C[4] + 0xd34d34d3 + ((C[3] >>> 0) < (C_[3] >>> 0) ? 1 : 0)) | 0;
22443	        C[5] = (C[5] + 0x34d34d34 + ((C[4] >>> 0) < (C_[4] >>> 0) ? 1 : 0)) | 0;
22444	        C[6] = (C[6] + 0x4d34d34d + ((C[5] >>> 0) < (C_[5] >>> 0) ? 1 : 0)) | 0;
22445	        C[7] = (C[7] + 0xd34d34d3 + ((C[6] >>> 0) < (C_[6] >>> 0) ? 1 : 0)) | 0;
22446	        this._b = (C[7] >>> 0) < (C_[7] >>> 0) ? 1 : 0;
22447
22448	        // Calculate the g-values
22449	        for (var i = 0; i < 8; i++) {
22450	            var gx = X[i] + C[i];
22451
22452	            // Construct high and low argument for squaring
22453	            var ga = gx & 0xffff;
22454	            var gb = gx >>> 16;
22455
22456	            // Calculate high and low result of squaring
22457	            var gh = ((((ga * ga) >>> 17) + ga * gb) >>> 15) + gb * gb;
22458	            var gl = (((gx & 0xffff0000) * gx) | 0) + (((gx & 0x0000ffff) * gx) | 0);
22459
22460	            // High XOR low
22461	            G[i] = gh ^ gl;
22462	        }
22463
22464	        // Calculate new state values
22465	        X[0] = (G[0] + ((G[7] << 16) | (G[7] >>> 16)) + ((G[6] << 16) | (G[6] >>> 16))) | 0;
22466	        X[1] = (G[1] + ((G[0] << 8)  | (G[0] >>> 24)) + G[7]) | 0;
22467	        X[2] = (G[2] + ((G[1] << 16) | (G[1] >>> 16)) + ((G[0] << 16) | (G[0] >>> 16))) | 0;
22468	        X[3] = (G[3] + ((G[2] << 8)  | (G[2] >>> 24)) + G[1]) | 0;
22469	        X[4] = (G[4] + ((G[3] << 16) | (G[3] >>> 16)) + ((G[2] << 16) | (G[2] >>> 16))) | 0;
22470	        X[5] = (G[5] + ((G[4] << 8)  | (G[4] >>> 24)) + G[3]) | 0;
22471	        X[6] = (G[6] + ((G[5] << 16) | (G[5] >>> 16)) + ((G[4] << 16) | (G[4] >>> 16))) | 0;
22472	        X[7] = (G[7] + ((G[6] << 8)  | (G[6] >>> 24)) + G[5]) | 0;
22473	    }
22474
22475	    /**
22476	     * Shortcut functions to the cipher's object interface.
22477	     *
22478	     * @example
22479	     *
22480	     *     var ciphertext = CryptoJS.Rabbit.encrypt(message, key, cfg);
22481	     *     var plaintext  = CryptoJS.Rabbit.decrypt(ciphertext, key, cfg);
22482	     */
22483	    C.Rabbit = StreamCipher._createHelper(Rabbit);
22484	}());
22485
22486
22487	(function () {
22488	    // Shortcuts
22489	    var C = CryptoJS;
22490	    var C_lib = C.lib;
22491	    var StreamCipher = C_lib.StreamCipher;
22492	    var C_algo = C.algo;
22493
22494	    // Reusable objects
22495	    var S  = [];
22496	    var C_ = [];
22497	    var G  = [];
22498
22499	    /**
22500	     * Rabbit stream cipher algorithm.
22501	     *
22502	     * This is a legacy version that neglected to convert the key to little-endian.
22503	     * This error doesn't affect the cipher's security,
22504	     * but it does affect its compatibility with other implementations.
22505	     */
22506	    var RabbitLegacy = C_algo.RabbitLegacy = StreamCipher.extend({
22507	        _doReset: function () {
22508	            // Shortcuts
22509	            var K = this._key.words;
22510	            var iv = this.cfg.iv;
22511
22512	            // Generate initial state values
22513	            var X = this._X = [
22514	                K[0], (K[3] << 16) | (K[2] >>> 16),
22515	                K[1], (K[0] << 16) | (K[3] >>> 16),
22516	                K[2], (K[1] << 16) | (K[0] >>> 16),
22517	                K[3], (K[2] << 16) | (K[1] >>> 16)
22518	            ];
22519
22520	            // Generate initial counter values
22521	            var C = this._C = [
22522	                (K[2] << 16) | (K[2] >>> 16), (K[0] & 0xffff0000) | (K[1] & 0x0000ffff),
22523	                (K[3] << 16) | (K[3] >>> 16), (K[1] & 0xffff0000) | (K[2] & 0x0000ffff),
22524	                (K[0] << 16) | (K[0] >>> 16), (K[2] & 0xffff0000) | (K[3] & 0x0000ffff),
22525	                (K[1] << 16) | (K[1] >>> 16), (K[3] & 0xffff0000) | (K[0] & 0x0000ffff)
22526	            ];
22527
22528	            // Carry bit
22529	            this._b = 0;
22530
22531	            // Iterate the system four times
22532	            for (var i = 0; i < 4; i++) {
22533	                nextState.call(this);
22534	            }
22535
22536	            // Modify the counters
22537	            for (var i = 0; i < 8; i++) {
22538	                C[i] ^= X[(i + 4) & 7];
22539	            }
22540
22541	            // IV setup
22542	            if (iv) {
22543	                // Shortcuts
22544	                var IV = iv.words;
22545	                var IV_0 = IV[0];
22546	                var IV_1 = IV[1];
22547
22548	                // Generate four subvectors
22549	                var i0 = (((IV_0 << 8) | (IV_0 >>> 24)) & 0x00ff00ff) | (((IV_0 << 24) | (IV_0 >>> 8)) & 0xff00ff00);
22550	                var i2 = (((IV_1 << 8) | (IV_1 >>> 24)) & 0x00ff00ff) | (((IV_1 << 24) | (IV_1 >>> 8)) & 0xff00ff00);
22551	                var i1 = (i0 >>> 16) | (i2 & 0xffff0000);
22552	                var i3 = (i2 << 16)  | (i0 & 0x0000ffff);
22553
22554	                // Modify counter values
22555	                C[0] ^= i0;
22556	                C[1] ^= i1;
22557	                C[2] ^= i2;
22558	                C[3] ^= i3;
22559	                C[4] ^= i0;
22560	                C[5] ^= i1;
22561	                C[6] ^= i2;
22562	                C[7] ^= i3;
22563
22564	                // Iterate the system four times
22565	                for (var i = 0; i < 4; i++) {
22566	                    nextState.call(this);
22567	                }
22568	            }
22569	        },
22570
22571	        _doProcessBlock: function (M, offset) {
22572	            // Shortcut
22573	            var X = this._X;
22574
22575	            // Iterate the system
22576	            nextState.call(this);
22577
22578	            // Generate four keystream words
22579	            S[0] = X[0] ^ (X[5] >>> 16) ^ (X[3] << 16);
22580	            S[1] = X[2] ^ (X[7] >>> 16) ^ (X[5] << 16);
22581	            S[2] = X[4] ^ (X[1] >>> 16) ^ (X[7] << 16);
22582	            S[3] = X[6] ^ (X[3] >>> 16) ^ (X[1] << 16);
22583
22584	            for (var i = 0; i < 4; i++) {
22585	                // Swap endian
22586	                S[i] = (((S[i] << 8)  | (S[i] >>> 24)) & 0x00ff00ff) |
22587	                       (((S[i] << 24) | (S[i] >>> 8))  & 0xff00ff00);
22588
22589	                // Encrypt
22590	                M[offset + i] ^= S[i];
22591	            }
22592	        },
22593
22594	        blockSize: 128/32,
22595
22596	        ivSize: 64/32
22597	    });
22598
22599	    function nextState() {
22600	        // Shortcuts
22601	        var X = this._X;
22602	        var C = this._C;
22603
22604	        // Save old counter values
22605	        for (var i = 0; i < 8; i++) {
22606	            C_[i] = C[i];
22607	        }
22608
22609	        // Calculate new counter values
22610	        C[0] = (C[0] + 0x4d34d34d + this._b) | 0;
22611	        C[1] = (C[1] + 0xd34d34d3 + ((C[0] >>> 0) < (C_[0] >>> 0) ? 1 : 0)) | 0;
22612	        C[2] = (C[2] + 0x34d34d34 + ((C[1] >>> 0) < (C_[1] >>> 0) ? 1 : 0)) | 0;
22613	        C[3] = (C[3] + 0x4d34d34d + ((C[2] >>> 0) < (C_[2] >>> 0) ? 1 : 0)) | 0;
22614	        C[4] = (C[4] + 0xd34d34d3 + ((C[3] >>> 0) < (C_[3] >>> 0) ? 1 : 0)) | 0;
22615	        C[5] = (C[5] + 0x34d34d34 + ((C[4] >>> 0) < (C_[4] >>> 0) ? 1 : 0)) | 0;
22616	        C[6] = (C[6] + 0x4d34d34d + ((C[5] >>> 0) < (C_[5] >>> 0) ? 1 : 0)) | 0;
22617	        C[7] = (C[7] + 0xd34d34d3 + ((C[6] >>> 0) < (C_[6] >>> 0) ? 1 : 0)) | 0;
22618	        this._b = (C[7] >>> 0) < (C_[7] >>> 0) ? 1 : 0;
22619
22620	        // Calculate the g-values
22621	        for (var i = 0; i < 8; i++) {
22622	            var gx = X[i] + C[i];
22623
22624	            // Construct high and low argument for squaring
22625	            var ga = gx & 0xffff;
22626	            var gb = gx >>> 16;
22627
22628	            // Calculate high and low result of squaring
22629	            var gh = ((((ga * ga) >>> 17) + ga * gb) >>> 15) + gb * gb;
22630	            var gl = (((gx & 0xffff0000) * gx) | 0) + (((gx & 0x0000ffff) * gx) | 0);
22631
22632	            // High XOR low
22633	            G[i] = gh ^ gl;
22634	        }
22635
22636	        // Calculate new state values
22637	        X[0] = (G[0] + ((G[7] << 16) | (G[7] >>> 16)) + ((G[6] << 16) | (G[6] >>> 16))) | 0;
22638	        X[1] = (G[1] + ((G[0] << 8)  | (G[0] >>> 24)) + G[7]) | 0;
22639	        X[2] = (G[2] + ((G[1] << 16) | (G[1] >>> 16)) + ((G[0] << 16) | (G[0] >>> 16))) | 0;
22640	        X[3] = (G[3] + ((G[2] << 8)  | (G[2] >>> 24)) + G[1]) | 0;
22641	        X[4] = (G[4] + ((G[3] << 16) | (G[3] >>> 16)) + ((G[2] << 16) | (G[2] >>> 16))) | 0;
22642	        X[5] = (G[5] + ((G[4] << 8)  | (G[4] >>> 24)) + G[3]) | 0;
22643	        X[6] = (G[6] + ((G[5] << 16) | (G[5] >>> 16)) + ((G[4] << 16) | (G[4] >>> 16))) | 0;
22644	        X[7] = (G[7] + ((G[6] << 8)  | (G[6] >>> 24)) + G[5]) | 0;
22645	    }
22646
22647	    /**
22648	     * Shortcut functions to the cipher's object interface.
22649	     *
22650	     * @example
22651	     *
22652	     *     var ciphertext = CryptoJS.RabbitLegacy.encrypt(message, key, cfg);
22653	     *     var plaintext  = CryptoJS.RabbitLegacy.decrypt(ciphertext, key, cfg);
22654	     */
22655	    C.RabbitLegacy = StreamCipher._createHelper(RabbitLegacy);
22656	}());
22657
22658
22659	(function () {
22660	    // Shortcuts
22661	    var C = CryptoJS;
22662	    var C_lib = C.lib;
22663	    var BlockCipher = C_lib.BlockCipher;
22664	    var C_algo = C.algo;
22665
22666	    const N = 16;
22667
22668	    //Origin pbox and sbox, derived from PI
22669	    const ORIG_P = [
22670	        0x243F6A88, 0x85A308D3, 0x13198A2E, 0x03707344,
22671	        0xA4093822, 0x299F31D0, 0x082EFA98, 0xEC4E6C89,
22672	        0x452821E6, 0x38D01377, 0xBE5466CF, 0x34E90C6C,
22673	        0xC0AC29B7, 0xC97C50DD, 0x3F84D5B5, 0xB5470917,
22674	        0x9216D5D9, 0x8979FB1B
22675	    ];
22676
22677	    const ORIG_S = [
22678	        [   0xD1310BA6, 0x98DFB5AC, 0x2FFD72DB, 0xD01ADFB7,
22679	            0xB8E1AFED, 0x6A267E96, 0xBA7C9045, 0xF12C7F99,
22680	            0x24A19947, 0xB3916CF7, 0x0801F2E2, 0x858EFC16,
22681	            0x636920D8, 0x71574E69, 0xA458FEA3, 0xF4933D7E,
22682	            0x0D95748F, 0x728EB658, 0x718BCD58, 0x82154AEE,
22683	            0x7B54A41D, 0xC25A59B5, 0x9C30D539, 0x2AF26013,
22684	            0xC5D1B023, 0x286085F0, 0xCA417918, 0xB8DB38EF,
22685	            0x8E79DCB0, 0x603A180E, 0x6C9E0E8B, 0xB01E8A3E,
22686	            0xD71577C1, 0xBD314B27, 0x78AF2FDA, 0x55605C60,
22687	            0xE65525F3, 0xAA55AB94, 0x57489862, 0x63E81440,
22688	            0x55CA396A, 0x2AAB10B6, 0xB4CC5C34, 0x1141E8CE,
22689	            0xA15486AF, 0x7C72E993, 0xB3EE1411, 0x636FBC2A,
22690	            0x2BA9C55D, 0x741831F6, 0xCE5C3E16, 0x9B87931E,
22691	            0xAFD6BA33, 0x6C24CF5C, 0x7A325381, 0x28958677,
22692	            0x3B8F4898, 0x6B4BB9AF, 0xC4BFE81B, 0x66282193,
22693	            0x61D809CC, 0xFB21A991, 0x487CAC60, 0x5DEC8032,
22694	            0xEF845D5D, 0xE98575B1, 0xDC262302, 0xEB651B88,
22695	            0x23893E81, 0xD396ACC5, 0x0F6D6FF3, 0x83F44239,
22696	            0x2E0B4482, 0xA4842004, 0x69C8F04A, 0x9E1F9B5E,
22697	            0x21C66842, 0xF6E96C9A, 0x670C9C61, 0xABD388F0,
22698	            0x6A51A0D2, 0xD8542F68, 0x960FA728, 0xAB5133A3,
22699	            0x6EEF0B6C, 0x137A3BE4, 0xBA3BF050, 0x7EFB2A98,
22700	            0xA1F1651D, 0x39AF0176, 0x66CA593E, 0x82430E88,
22701	            0x8CEE8619, 0x456F9FB4, 0x7D84A5C3, 0x3B8B5EBE,
22702	            0xE06F75D8, 0x85C12073, 0x401A449F, 0x56C16AA6,
22703	            0x4ED3AA62, 0x363F7706, 0x1BFEDF72, 0x429B023D,
22704	            0x37D0D724, 0xD00A1248, 0xDB0FEAD3, 0x49F1C09B,
22705	            0x075372C9, 0x80991B7B, 0x25D479D8, 0xF6E8DEF7,
22706	            0xE3FE501A, 0xB6794C3B, 0x976CE0BD, 0x04C006BA,
22707	            0xC1A94FB6, 0x409F60C4, 0x5E5C9EC2, 0x196A2463,
22708	            0x68FB6FAF, 0x3E6C53B5, 0x1339B2EB, 0x3B52EC6F,
22709	            0x6DFC511F, 0x9B30952C, 0xCC814544, 0xAF5EBD09,
22710	            0xBEE3D004, 0xDE334AFD, 0x660F2807, 0x192E4BB3,
22711	            0xC0CBA857, 0x45C8740F, 0xD20B5F39, 0xB9D3FBDB,
22712	            0x5579C0BD, 0x1A60320A, 0xD6A100C6, 0x402C7279,
22713	            0x679F25FE, 0xFB1FA3CC, 0x8EA5E9F8, 0xDB3222F8,
22714	            0x3C7516DF, 0xFD616B15, 0x2F501EC8, 0xAD0552AB,
22715	            0x323DB5FA, 0xFD238760, 0x53317B48, 0x3E00DF82,
22716	            0x9E5C57BB, 0xCA6F8CA0, 0x1A87562E, 0xDF1769DB,
22717	            0xD542A8F6, 0x287EFFC3, 0xAC6732C6, 0x8C4F5573,
22718	            0x695B27B0, 0xBBCA58C8, 0xE1FFA35D, 0xB8F011A0,
22719	            0x10FA3D98, 0xFD2183B8, 0x4AFCB56C, 0x2DD1D35B,
22720	            0x9A53E479, 0xB6F84565, 0xD28E49BC, 0x4BFB9790,
22721	            0xE1DDF2DA, 0xA4CB7E33, 0x62FB1341, 0xCEE4C6E8,
22722	            0xEF20CADA, 0x36774C01, 0xD07E9EFE, 0x2BF11FB4,
22723	            0x95DBDA4D, 0xAE909198, 0xEAAD8E71, 0x6B93D5A0,
22724	            0xD08ED1D0, 0xAFC725E0, 0x8E3C5B2F, 0x8E7594B7,
22725	            0x8FF6E2FB, 0xF2122B64, 0x8888B812, 0x900DF01C,
22726	            0x4FAD5EA0, 0x688FC31C, 0xD1CFF191, 0xB3A8C1AD,
22727	            0x2F2F2218, 0xBE0E1777, 0xEA752DFE, 0x8B021FA1,
22728	            0xE5A0CC0F, 0xB56F74E8, 0x18ACF3D6, 0xCE89E299,
22729	            0xB4A84FE0, 0xFD13E0B7, 0x7CC43B81, 0xD2ADA8D9,
22730	            0x165FA266, 0x80957705, 0x93CC7314, 0x211A1477,
22731	            0xE6AD2065, 0x77B5FA86, 0xC75442F5, 0xFB9D35CF,
22732	            0xEBCDAF0C, 0x7B3E89A0, 0xD6411BD3, 0xAE1E7E49,
22733	            0x00250E2D, 0x2071B35E, 0x226800BB, 0x57B8E0AF,
22734	            0x2464369B, 0xF009B91E, 0x5563911D, 0x59DFA6AA,
22735	            0x78C14389, 0xD95A537F, 0x207D5BA2, 0x02E5B9C5,
22736	            0x83260376, 0x6295CFA9, 0x11C81968, 0x4E734A41,
22737	            0xB3472DCA, 0x7B14A94A, 0x1B510052, 0x9A532915,
22738	            0xD60F573F, 0xBC9BC6E4, 0x2B60A476, 0x81E67400,
22739	            0x08BA6FB5, 0x571BE91F, 0xF296EC6B, 0x2A0DD915,
22740	            0xB6636521, 0xE7B9F9B6, 0xFF34052E, 0xC5855664,
22741	            0x53B02D5D, 0xA99F8FA1, 0x08BA4799, 0x6E85076A   ],
22742	        [   0x4B7A70E9, 0xB5B32944, 0xDB75092E, 0xC4192623,
22743	            0xAD6EA6B0, 0x49A7DF7D, 0x9CEE60B8, 0x8FEDB266,
22744	            0xECAA8C71, 0x699A17FF, 0x5664526C, 0xC2B19EE1,
22745	            0x193602A5, 0x75094C29, 0xA0591340, 0xE4183A3E,
22746	            0x3F54989A, 0x5B429D65, 0x6B8FE4D6, 0x99F73FD6,
22747	            0xA1D29C07, 0xEFE830F5, 0x4D2D38E6, 0xF0255DC1,
22748	            0x4CDD2086, 0x8470EB26, 0x6382E9C6, 0x021ECC5E,
22749	            0x09686B3F, 0x3EBAEFC9, 0x3C971814, 0x6B6A70A1,
22750	            0x687F3584, 0x52A0E286, 0xB79C5305, 0xAA500737,
22751	            0x3E07841C, 0x7FDEAE5C, 0x8E7D44EC, 0x5716F2B8,
22752	            0xB03ADA37, 0xF0500C0D, 0xF01C1F04, 0x0200B3FF,
22753	            0xAE0CF51A, 0x3CB574B2, 0x25837A58, 0xDC0921BD,
22754	            0xD19113F9, 0x7CA92FF6, 0x94324773, 0x22F54701,
22755	            0x3AE5E581, 0x37C2DADC, 0xC8B57634, 0x9AF3DDA7,
22756	            0xA9446146, 0x0FD0030E, 0xECC8C73E, 0xA4751E41,
22757	            0xE238CD99, 0x3BEA0E2F, 0x3280BBA1, 0x183EB331,
22758	            0x4E548B38, 0x4F6DB908, 0x6F420D03, 0xF60A04BF,
22759	            0x2CB81290, 0x24977C79, 0x5679B072, 0xBCAF89AF,
22760	            0xDE9A771F, 0xD9930810, 0xB38BAE12, 0xDCCF3F2E,
22761	            0x5512721F, 0x2E6B7124, 0x501ADDE6, 0x9F84CD87,
22762	            0x7A584718, 0x7408DA17, 0xBC9F9ABC, 0xE94B7D8C,
22763	            0xEC7AEC3A, 0xDB851DFA, 0x63094366, 0xC464C3D2,
22764	            0xEF1C1847, 0x3215D908, 0xDD433B37, 0x24C2BA16,
22765	            0x12A14D43, 0x2A65C451, 0x50940002, 0x133AE4DD,
22766	            0x71DFF89E, 0x10314E55, 0x81AC77D6, 0x5F11199B,
22767	            0x043556F1, 0xD7A3C76B, 0x3C11183B, 0x5924A509,
22768	            0xF28FE6ED, 0x97F1FBFA, 0x9EBABF2C, 0x1E153C6E,
22769	            0x86E34570, 0xEAE96FB1, 0x860E5E0A, 0x5A3E2AB3,
22770	            0x771FE71C, 0x4E3D06FA, 0x2965DCB9, 0x99E71D0F,
22771	            0x803E89D6, 0x5266C825, 0x2E4CC978, 0x9C10B36A,
22772	            0xC6150EBA, 0x94E2EA78, 0xA5FC3C53, 0x1E0A2DF4,
22773	            0xF2F74EA7, 0x361D2B3D, 0x1939260F, 0x19C27960,
22774	            0x5223A708, 0xF71312B6, 0xEBADFE6E, 0xEAC31F66,
22775	            0xE3BC4595, 0xA67BC883, 0xB17F37D1, 0x018CFF28,
22776	            0xC332DDEF, 0xBE6C5AA5, 0x65582185, 0x68AB9802,
22777	            0xEECEA50F, 0xDB2F953B, 0x2AEF7DAD, 0x5B6E2F84,
22778	            0x1521B628, 0x29076170, 0xECDD4775, 0x619F1510,
22779	            0x13CCA830, 0xEB61BD96, 0x0334FE1E, 0xAA0363CF,
22780	            0xB5735C90, 0x4C70A239, 0xD59E9E0B, 0xCBAADE14,
22781	            0xEECC86BC, 0x60622CA7, 0x9CAB5CAB, 0xB2F3846E,
22782	            0x648B1EAF, 0x19BDF0CA, 0xA02369B9, 0x655ABB50,
22783	            0x40685A32, 0x3C2AB4B3, 0x319EE9D5, 0xC021B8F7,
22784	            0x9B540B19, 0x875FA099, 0x95F7997E, 0x623D7DA8,
22785	            0xF837889A, 0x97E32D77, 0x11ED935F, 0x16681281,
22786	            0x0E358829, 0xC7E61FD6, 0x96DEDFA1, 0x7858BA99,
22787	            0x57F584A5, 0x1B227263, 0x9B83C3FF, 0x1AC24696,
22788	            0xCDB30AEB, 0x532E3054, 0x8FD948E4, 0x6DBC3128,
22789	            0x58EBF2EF, 0x34C6FFEA, 0xFE28ED61, 0xEE7C3C73,
22790	            0x5D4A14D9, 0xE864B7E3, 0x42105D14, 0x203E13E0,
22791	            0x45EEE2B6, 0xA3AAABEA, 0xDB6C4F15, 0xFACB4FD0,
22792	            0xC742F442, 0xEF6ABBB5, 0x654F3B1D, 0x41CD2105,
22793	            0xD81E799E, 0x86854DC7, 0xE44B476A, 0x3D816250,
22794	            0xCF62A1F2, 0x5B8D2646, 0xFC8883A0, 0xC1C7B6A3,
22795	            0x7F1524C3, 0x69CB7492, 0x47848A0B, 0x5692B285,
22796	            0x095BBF00, 0xAD19489D, 0x1462B174, 0x23820E00,
22797	            0x58428D2A, 0x0C55F5EA, 0x1DADF43E, 0x233F7061,
22798	            0x3372F092, 0x8D937E41, 0xD65FECF1, 0x6C223BDB,
22799	            0x7CDE3759, 0xCBEE7460, 0x4085F2A7, 0xCE77326E,
22800	            0xA6078084, 0x19F8509E, 0xE8EFD855, 0x61D99735,
22801	            0xA969A7AA, 0xC50C06C2, 0x5A04ABFC, 0x800BCADC,
22802	            0x9E447A2E, 0xC3453484, 0xFDD56705, 0x0E1E9EC9,
22803	            0xDB73DBD3, 0x105588CD, 0x675FDA79, 0xE3674340,
22804	            0xC5C43465, 0x713E38D8, 0x3D28F89E, 0xF16DFF20,
22805	            0x153E21E7, 0x8FB03D4A, 0xE6E39F2B, 0xDB83ADF7   ],
22806	        [   0xE93D5A68, 0x948140F7, 0xF64C261C, 0x94692934,
22807	            0x411520F7, 0x7602D4F7, 0xBCF46B2E, 0xD4A20068,
22808	            0xD4082471, 0x3320F46A, 0x43B7D4B7, 0x500061AF,
22809	            0x1E39F62E, 0x97244546, 0x14214F74, 0xBF8B8840,
22810	            0x4D95FC1D, 0x96B591AF, 0x70F4DDD3, 0x66A02F45,
22811	            0xBFBC09EC, 0x03BD9785, 0x7FAC6DD0, 0x31CB8504,
22812	            0x96EB27B3, 0x55FD3941, 0xDA2547E6, 0xABCA0A9A,
22813	            0x28507825, 0x530429F4, 0x0A2C86DA, 0xE9B66DFB,
22814	            0x68DC1462, 0xD7486900, 0x680EC0A4, 0x27A18DEE,
22815	            0x4F3FFEA2, 0xE887AD8C, 0xB58CE006, 0x7AF4D6B6,
22816	            0xAACE1E7C, 0xD3375FEC, 0xCE78A399, 0x406B2A42,
22817	            0x20FE9E35, 0xD9F385B9, 0xEE39D7AB, 0x3B124E8B,
22818	            0x1DC9FAF7, 0x4B6D1856, 0x26A36631, 0xEAE397B2,
22819	            0x3A6EFA74, 0xDD5B4332, 0x6841E7F7, 0xCA7820FB,
22820	            0xFB0AF54E, 0xD8FEB397, 0x454056AC, 0xBA489527,
22821	            0x55533A3A, 0x20838D87, 0xFE6BA9B7, 0xD096954B,
22822	            0x55A867BC, 0xA1159A58, 0xCCA92963, 0x99E1DB33,
22823	            0xA62A4A56, 0x3F3125F9, 0x5EF47E1C, 0x9029317C,
22824	            0xFDF8E802, 0x04272F70, 0x80BB155C, 0x05282CE3,
22825	            0x95C11548, 0xE4C66D22, 0x48C1133F, 0xC70F86DC,
22826	            0x07F9C9EE, 0x41041F0F, 0x404779A4, 0x5D886E17,
22827	            0x325F51EB, 0xD59BC0D1, 0xF2BCC18F, 0x41113564,
22828	            0x257B7834, 0x602A9C60, 0xDFF8E8A3, 0x1F636C1B,
22829	            0x0E12B4C2, 0x02E1329E, 0xAF664FD1, 0xCAD18115,
22830	            0x6B2395E0, 0x333E92E1, 0x3B240B62, 0xEEBEB922,
22831	            0x85B2A20E, 0xE6BA0D99, 0xDE720C8C, 0x2DA2F728,
22832	            0xD0127845, 0x95B794FD, 0x647D0862, 0xE7CCF5F0,
22833	            0x5449A36F, 0x877D48FA, 0xC39DFD27, 0xF33E8D1E,
22834	            0x0A476341, 0x992EFF74, 0x3A6F6EAB, 0xF4F8FD37,
22835	            0xA812DC60, 0xA1EBDDF8, 0x991BE14C, 0xDB6E6B0D,
22836	            0xC67B5510, 0x6D672C37, 0x2765D43B, 0xDCD0E804,
22837	            0xF1290DC7, 0xCC00FFA3, 0xB5390F92, 0x690FED0B,
22838	            0x667B9FFB, 0xCEDB7D9C, 0xA091CF0B, 0xD9155EA3,
22839	            0xBB132F88, 0x515BAD24, 0x7B9479BF, 0x763BD6EB,
22840	            0x37392EB3, 0xCC115979, 0x8026E297, 0xF42E312D,
22841	            0x6842ADA7, 0xC66A2B3B, 0x12754CCC, 0x782EF11C,
22842	            0x6A124237, 0xB79251E7, 0x06A1BBE6, 0x4BFB6350,
22843	            0x1A6B1018, 0x11CAEDFA, 0x3D25BDD8, 0xE2E1C3C9,
22844	            0x44421659, 0x0A121386, 0xD90CEC6E, 0xD5ABEA2A,
22845	            0x64AF674E, 0xDA86A85F, 0xBEBFE988, 0x64E4C3FE,
22846	            0x9DBC8057, 0xF0F7C086, 0x60787BF8, 0x6003604D,
22847	            0xD1FD8346, 0xF6381FB0, 0x7745AE04, 0xD736FCCC,
22848	            0x83426B33, 0xF01EAB71, 0xB0804187, 0x3C005E5F,
22849	            0x77A057BE, 0xBDE8AE24, 0x55464299, 0xBF582E61,
22850	            0x4E58F48F, 0xF2DDFDA2, 0xF474EF38, 0x8789BDC2,
22851	            0x5366F9C3, 0xC8B38E74, 0xB475F255, 0x46FCD9B9,
22852	            0x7AEB2661, 0x8B1DDF84, 0x846A0E79, 0x915F95E2,
22853	            0x466E598E, 0x20B45770, 0x8CD55591, 0xC902DE4C,
22854	            0xB90BACE1, 0xBB8205D0, 0x11A86248, 0x7574A99E,
22855	            0xB77F19B6, 0xE0A9DC09, 0x662D09A1, 0xC4324633,
22856	            0xE85A1F02, 0x09F0BE8C, 0x4A99A025, 0x1D6EFE10,
22857	            0x1AB93D1D, 0x0BA5A4DF, 0xA186F20F, 0x2868F169,
22858	            0xDCB7DA83, 0x573906FE, 0xA1E2CE9B, 0x4FCD7F52,
22859	            0x50115E01, 0xA70683FA, 0xA002B5C4, 0x0DE6D027,
22860	            0x9AF88C27, 0x773F8641, 0xC3604C06, 0x61A806B5,
22861	            0xF0177A28, 0xC0F586E0, 0x006058AA, 0x30DC7D62,
22862	            0x11E69ED7, 0x2338EA63, 0x53C2DD94, 0xC2C21634,
22863	            0xBBCBEE56, 0x90BCB6DE, 0xEBFC7DA1, 0xCE591D76,
22864	            0x6F05E409, 0x4B7C0188, 0x39720A3D, 0x7C927C24,
22865	            0x86E3725F, 0x724D9DB9, 0x1AC15BB4, 0xD39EB8FC,
22866	            0xED545578, 0x08FCA5B5, 0xD83D7CD3, 0x4DAD0FC4,
22867	            0x1E50EF5E, 0xB161E6F8, 0xA28514D9, 0x6C51133C,
22868	            0x6FD5C7E7, 0x56E14EC4, 0x362ABFCE, 0xDDC6C837,
22869	            0xD79A3234, 0x92638212, 0x670EFA8E, 0x406000E0  ],
22870	        [   0x3A39CE37, 0xD3FAF5CF, 0xABC27737, 0x5AC52D1B,
22871	            0x5CB0679E, 0x4FA33742, 0xD3822740, 0x99BC9BBE,
22872	            0xD5118E9D, 0xBF0F7315, 0xD62D1C7E, 0xC700C47B,
22873	            0xB78C1B6B, 0x21A19045, 0xB26EB1BE, 0x6A366EB4,
22874	            0x5748AB2F, 0xBC946E79, 0xC6A376D2, 0x6549C2C8,
22875	            0x530FF8EE, 0x468DDE7D, 0xD5730A1D, 0x4CD04DC6,
22876	            0x2939BBDB, 0xA9BA4650, 0xAC9526E8, 0xBE5EE304,
22877	            0xA1FAD5F0, 0x6A2D519A, 0x63EF8CE2, 0x9A86EE22,
22878	            0xC089C2B8, 0x43242EF6, 0xA51E03AA, 0x9CF2D0A4,
22879	            0x83C061BA, 0x9BE96A4D, 0x8FE51550, 0xBA645BD6,
22880	            0x2826A2F9, 0xA73A3AE1, 0x4BA99586, 0xEF5562E9,
22881	            0xC72FEFD3, 0xF752F7DA, 0x3F046F69, 0x77FA0A59,
22882	            0x80E4A915, 0x87B08601, 0x9B09E6AD, 0x3B3EE593,
22883	            0xE990FD5A, 0x9E34D797, 0x2CF0B7D9, 0x022B8B51,
22884	            0x96D5AC3A, 0x017DA67D, 0xD1CF3ED6, 0x7C7D2D28,
22885	            0x1F9F25CF, 0xADF2B89B, 0x5AD6B472, 0x5A88F54C,
22886	            0xE029AC71, 0xE019A5E6, 0x47B0ACFD, 0xED93FA9B,
22887	            0xE8D3C48D, 0x283B57CC, 0xF8D56629, 0x79132E28,
22888	            0x785F0191, 0xED756055, 0xF7960E44, 0xE3D35E8C,
22889	            0x15056DD4, 0x88F46DBA, 0x03A16125, 0x0564F0BD,
22890	            0xC3EB9E15, 0x3C9057A2, 0x97271AEC, 0xA93A072A,
22891	            0x1B3F6D9B, 0x1E6321F5, 0xF59C66FB, 0x26DCF319,
22892	            0x7533D928, 0xB155FDF5, 0x03563482, 0x8ABA3CBB,
22893	            0x28517711, 0xC20AD9F8, 0xABCC5167, 0xCCAD925F,
22894	            0x4DE81751, 0x3830DC8E, 0x379D5862, 0x9320F991,
22895	            0xEA7A90C2, 0xFB3E7BCE, 0x5121CE64, 0x774FBE32,
22896	            0xA8B6E37E, 0xC3293D46, 0x48DE5369, 0x6413E680,
22897	            0xA2AE0810, 0xDD6DB224, 0x69852DFD, 0x09072166,
22898	            0xB39A460A, 0x6445C0DD, 0x586CDECF, 0x1C20C8AE,
22899	            0x5BBEF7DD, 0x1B588D40, 0xCCD2017F, 0x6BB4E3BB,
22900	            0xDDA26A7E, 0x3A59FF45, 0x3E350A44, 0xBCB4CDD5,
22901	            0x72EACEA8, 0xFA6484BB, 0x8D6612AE, 0xBF3C6F47,
22902	            0xD29BE463, 0x542F5D9E, 0xAEC2771B, 0xF64E6370,
22903	            0x740E0D8D, 0xE75B1357, 0xF8721671, 0xAF537D5D,
22904	            0x4040CB08, 0x4EB4E2CC, 0x34D2466A, 0x0115AF84,
22905	            0xE1B00428, 0x95983A1D, 0x06B89FB4, 0xCE6EA048,
22906	            0x6F3F3B82, 0x3520AB82, 0x011A1D4B, 0x277227F8,
22907	            0x611560B1, 0xE7933FDC, 0xBB3A792B, 0x344525BD,
22908	            0xA08839E1, 0x51CE794B, 0x2F32C9B7, 0xA01FBAC9,
22909	            0xE01CC87E, 0xBCC7D1F6, 0xCF0111C3, 0xA1E8AAC7,
22910	            0x1A908749, 0xD44FBD9A, 0xD0DADECB, 0xD50ADA38,
22911	            0x0339C32A, 0xC6913667, 0x8DF9317C, 0xE0B12B4F,
22912	            0xF79E59B7, 0x43F5BB3A, 0xF2D519FF, 0x27D9459C,
22913	            0xBF97222C, 0x15E6FC2A, 0x0F91FC71, 0x9B941525,
22914	            0xFAE59361, 0xCEB69CEB, 0xC2A86459, 0x12BAA8D1,
22915	            0xB6C1075E, 0xE3056A0C, 0x10D25065, 0xCB03A442,
22916	            0xE0EC6E0E, 0x1698DB3B, 0x4C98A0BE, 0x3278E964,
22917	            0x9F1F9532, 0xE0D392DF, 0xD3A0342B, 0x8971F21E,
22918	            0x1B0A7441, 0x4BA3348C, 0xC5BE7120, 0xC37632D8,
22919	            0xDF359F8D, 0x9B992F2E, 0xE60B6F47, 0x0FE3F11D,
22920	            0xE54CDA54, 0x1EDAD891, 0xCE6279CF, 0xCD3E7E6F,
22921	            0x1618B166, 0xFD2C1D05, 0x848FD2C5, 0xF6FB2299,
22922	            0xF523F357, 0xA6327623, 0x93A83531, 0x56CCCD02,
22923	            0xACF08162, 0x5A75EBB5, 0x6E163697, 0x88D273CC,
22924	            0xDE966292, 0x81B949D0, 0x4C50901B, 0x71C65614,
22925	            0xE6C6C7BD, 0x327A140A, 0x45E1D006, 0xC3F27B9A,
22926	            0xC9AA53FD, 0x62A80F00, 0xBB25BFE2, 0x35BDD2F6,
22927	            0x71126905, 0xB2040222, 0xB6CBCF7C, 0xCD769C2B,
22928	            0x53113EC0, 0x1640E3D3, 0x38ABBD60, 0x2547ADF0,
22929	            0xBA38209C, 0xF746CE76, 0x77AFA1C5, 0x20756060,
22930	            0x85CBFE4E, 0x8AE88DD8, 0x7AAAF9B0, 0x4CF9AA7E,
22931	            0x1948C25C, 0x02FB8A8C, 0x01C36AE4, 0xD6EBE1F9,
22932	            0x90D4F869, 0xA65CDEA0, 0x3F09252D, 0xC208E69F,
22933	            0xB74E6132, 0xCE77E25B, 0x578FDFE3, 0x3AC372E6  ]
22934	    ];
22935
22936	    var BLOWFISH_CTX = {
22937	        pbox: [],
22938	        sbox: []
22939	    }
22940
22941	    function F(ctx, x){
22942	        let a = (x >> 24) & 0xFF;
22943	        let b = (x >> 16) & 0xFF;
22944	        let c = (x >> 8) & 0xFF;
22945	        let d = x & 0xFF;
22946
22947	        let y = ctx.sbox[0][a] + ctx.sbox[1][b];
22948	        y = y ^ ctx.sbox[2][c];
22949	        y = y + ctx.sbox[3][d];
22950
22951	        return y;
22952	    }
22953
22954	    function BlowFish_Encrypt(ctx, left, right){
22955	        let Xl = left;
22956	        let Xr = right;
22957	        let temp;
22958
22959	        for(let i = 0; i < N; ++i){
22960	            Xl = Xl ^ ctx.pbox[i];
22961	            Xr = F(ctx, Xl) ^ Xr;
22962
22963	            temp = Xl;
22964	            Xl = Xr;
22965	            Xr = temp;
22966	        }
22967
22968	        temp = Xl;
22969	        Xl = Xr;
22970	        Xr = temp;
22971
22972	        Xr = Xr ^ ctx.pbox[N];
22973	        Xl = Xl ^ ctx.pbox[N + 1];
22974
22975	        return {left: Xl, right: Xr};
22976	    }
22977
22978	    function BlowFish_Decrypt(ctx, left, right){
22979	        let Xl = left;
22980	        let Xr = right;
22981	        let temp;
22982
22983	        for(let i = N + 1; i > 1; --i){
22984	            Xl = Xl ^ ctx.pbox[i];
22985	            Xr = F(ctx, Xl) ^ Xr;
22986
22987	            temp = Xl;
22988	            Xl = Xr;
22989	            Xr = temp;
22990	        }
22991
22992	        temp = Xl;
22993	        Xl = Xr;
22994	        Xr = temp;
22995
22996	        Xr = Xr ^ ctx.pbox[1];
22997	        Xl = Xl ^ ctx.pbox[0];
22998
22999	        return {left: Xl, right: Xr};
23000	    }
23001
23002	    /**
23003	     * Initialization ctx's pbox and sbox.
23004	     *
23005	     * @param {Object} ctx The object has pbox and sbox.
23006	     * @param {Array} key An array of 32-bit words.
23007	     * @param {int} keysize The length of the key.
23008	     *
23009	     * @example
23010	     *
23011	     *     BlowFishInit(BLOWFISH_CTX, key, 128/32);
23012	     */
23013	    function BlowFishInit(ctx, key, keysize)
23014	    {
23015	        for(let Row = 0; Row < 4; Row++)
23016	        {
23017	            ctx.sbox[Row] = [];
23018	            for(let Col = 0; Col < 256; Col++)
23019	            {
23020	                ctx.sbox[Row][Col] = ORIG_S[Row][Col];
23021	            }
23022	        }
23023
23024	        let keyIndex = 0;
23025	        for(let index = 0; index < N + 2; index++)
23026	        {
23027	            ctx.pbox[index] = ORIG_P[index] ^ key[keyIndex];
23028	            keyIndex++;
23029	            if(keyIndex >= keysize)
23030	            {
23031	                keyIndex = 0;
23032	            }
23033	        }
23034
23035	        let Data1 = 0;
23036	        let Data2 = 0;
23037	        let res = 0;
23038	        for(let i = 0; i < N + 2; i += 2)
23039	        {
23040	            res = BlowFish_Encrypt(ctx, Data1, Data2);
23041	            Data1 = res.left;
23042	            Data2 = res.right;
23043	            ctx.pbox[i] = Data1;
23044	            ctx.pbox[i + 1] = Data2;
23045	        }
23046
23047	        for(let i = 0; i < 4; i++)
23048	        {
23049	            for(let j = 0; j < 256; j += 2)
23050	            {
23051	                res = BlowFish_Encrypt(ctx, Data1, Data2);
23052	                Data1 = res.left;
23053	                Data2 = res.right;
23054	                ctx.sbox[i][j] = Data1;
23055	                ctx.sbox[i][j + 1] = Data2;
23056	            }
23057	        }
23058
23059	        return true;
23060	    }
23061
23062	    /**
23063	     * Blowfish block cipher algorithm.
23064	     */
23065	    var Blowfish = C_algo.Blowfish = BlockCipher.extend({
23066	        _doReset: function () {
23067	            // Skip reset of nRounds has been set before and key did not change
23068	            if (this._keyPriorReset === this._key) {
23069	                return;
23070	            }
23071
23072	            // Shortcuts
23073	            var key = this._keyPriorReset = this._key;
23074	            var keyWords = key.words;
23075	            var keySize = key.sigBytes / 4;
23076
23077	            //Initialization pbox and sbox
23078	            BlowFishInit(BLOWFISH_CTX, keyWords, keySize);
23079	        },
23080
23081	        encryptBlock: function (M, offset) {
23082	            var res = BlowFish_Encrypt(BLOWFISH_CTX, M[offset], M[offset + 1]);
23083	            M[offset] = res.left;
23084	            M[offset + 1] = res.right;
23085	        },
23086
23087	        decryptBlock: function (M, offset) {
23088	            var res = BlowFish_Decrypt(BLOWFISH_CTX, M[offset], M[offset + 1]);
23089	            M[offset] = res.left;
23090	            M[offset + 1] = res.right;
23091	        },
23092
23093	        blockSize: 64/32,
23094
23095	        keySize: 128/32,
23096
23097	        ivSize: 64/32
23098	    });
23099
23100	    /**
23101	     * Shortcut functions to the cipher's object interface.
23102	     *
23103	     * @example
23104	     *
23105	     *     var ciphertext = CryptoJS.Blowfish.encrypt(message, key, cfg);
23106	     *     var plaintext  = CryptoJS.Blowfish.decrypt(ciphertext, key, cfg);
23107	     */
23108	    C.Blowfish = BlockCipher._createHelper(Blowfish);
23109	}());
23110
23111
23112	return CryptoJS;
23113
23114}));
23114
23115// ==ClosureCompiler==
23116// @compilation_level ADVANCED_OPTIMIZATIONS
23117// @externs_url https://raw.githubusercontent.com/google/closure-compiler/master/contrib/externs/maps/google_maps_api_v3.js
23118// ==/ClosureCompiler==
23119
23120/**
23121 * @name Gmaps MarkerClusterer for Google Maps v3
23122 * @version version 1.2.0
23123 * @author Luke Mahe
23124 * @author Sebastian Hösl <[email protected]>
23125 * @fileoverview
23126 * The library creates and manages per-zoom-level clusters for large amounts of
23127 * markers.
23128 * This is a v3 implementation of the v2 MarkerClusterer
23129 * {@link http://gmaps-utility-library-dev.googlecode.com/svn/tags/markerclusterer/}
23130 * ></a>.
23131 */
23132
23133/**
23134 * @license
23135 *
23136 * Licensed under the Apache License, Version 2.0 (the "License");
23137 * you may not use this file except in compliance with the License.
23138 * You may obtain a copy of the License at
23139 *
23140 *     http://www.apache.org/licenses/LICENSE-2.0
23141 *
23142 * Unless required by applicable law or agreed to in writing, software
23143 * distributed under the License is distributed on an "AS IS" BASIS,
23144 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
23145 * See the License for the specific language governing permissions and
23146 * limitations under the License.
23147 */
23148
23149/**
23150 * A Marker Clusterer that clusters markers.
23151 *
23152 * @param {google.maps.Map} map The Google map to attach to.
23153 * @param {Array.<google.maps.Marker>=} opt_markers Optional markers to add to
23154 *   the cluster.
23155 * @param {Object=} opt_options support the following options:
23156 *     'gridSize': (number) The grid size of a cluster in pixels.
23157 *     'maxZoom': (number) The maximum zoom level that a marker can be part of a
23158 *                cluster.
23159 *     'zoomOnClick': (boolean) Whether the default behaviour of clicking on a
23160 *                    cluster is to zoom into it.
23161 *     'averageCenter': (boolean) Whether the center of each cluster should be
23162 *                      the average of all markers in the cluster.
23163 *     'minimumClusterSize': (number) The minimum number of markers to be in a
23164 *                           cluster before the markers are hidden and a count
23165 *                           is shown.
23166 *     'ignoreHiddenMarkers': (boolean) Whether to ignore markers that are not
23167 *                            visible or count and cluster them anyway
23168 *     'styles': (Array) An array of objects with these properties:
23169 *       'url': (string) The image url.
23170 *       'height': (number) The image height.
23171 *       'width': (number) The image width.
23172 *       'anchor': (Array) The anchor position of the label text.
23173 *       'textColor': (string) The text color.
23174 *       'textSize': (number) The text size.
23175 *       'backgroundPosition': (string) The position of the backgound x, y.
23176 *       'iconAnchor': (Array) The anchor position of the icon x, y.
23177 *       'cssClass': (string) One or more CSS class for styling this marker.
23178 *     'onMouseoverCluster': (function) The event handler used for onmouseover
23179 *                           each cluster
23180 *     'onMouseoutCluster': (function) The event handler used for onmouseout
23181 *                          each cluster
23182 *     'drawCluster': (function) Custom draw method for ClusterIcon
23183 *     'hideCluster': (function) Custom hide method for ClusterIcon
23184 *     'showCluster': (function) Custom hide method for ClusterIcon
23185 *     'onAddCluster': (function) Custom onAdd method for ClusterIcon
23186 *     'onRemoveCluster': (function) Custom onRemove method for ClusterIcon
23187 * @constructor
23188 * @extends google.maps.OverlayView
23189 */
23190function MarkerClusterer(map, opt_markers, opt_options) {
23191    // MarkerClusterer implements google.maps.OverlayView interface. We use the
23192    // extend function to extend MarkerClusterer with google.maps.OverlayView
23193    // because it might not always be available when the code is defined so we
23194    // look for it at the last possible moment. If it doesn't exist now then
23195    // there is no point going ahead :)
23196    this.extend(MarkerClusterer, google.maps.OverlayView);
23197    this.map_ = map;
23198
23199    /**
23200     * @type {Array.<google.maps.Marker>}
23201     * @private
23202     */
23203    this.markers_ = [];
23204
23205    /**
23206     *  @type {Array.<Cluster>}
23207     */
23208    this.clusters_ = [];
23209
23210    /**
23211     * @type {Object} holding information about every markers cluster
23212     */
23213    this.markersCluster_ = {};
23214
23215    /**
23216     * @type {Number} Unique markers ID
23217     */
23218    this.markersUniqueID = 1;
23219
23220    this.sizes = [53, 56, 66, 78, 90];
23221
23222    /**
23223     * @private
23224     */
23225    this.styles_ = [];
23226
23227    /**
23228     * @private
23229     */
23230    this.cssClass_ = '';
23231
23232    /**
23233     * @private
23234     * @type {string} Set a default Cluster Class
23235     */
23236    this.cssDefaultClass_ = 'cluster';
23237
23238    /**
23239     * @private
23240     */
23241    this.setIndex_ = 0;
23242
23243    /**
23244     * @type {boolean}
23245     * @private
23246     */
23247    this.ready_ = false;
23248
23249    var options = opt_options || {};
23250
23251    /**
23252     * @type {number}
23253     * @private
23254     */
23255    this.gridSize_ = (options['gridSize'] !== undefined) ? options['gridSize'] : 60;
23256
23257    /**
23258     * @private
23259     */
23260    this.minClusterSize_ = options['minimumClusterSize'] || 2;
23261
23262    /**
23263     * @type {boolean}
23264     * @private
23265     */
23266    this.ignoreHiddenMarkers_ = options['ignoreHiddenMarkers'] || false;
23267
23268    /**
23269     * @type {?number}
23270     * @private
23271     */
23272    this.maxZoom_ = options['maxZoom'] || null;
23273
23274    this.styles_ = options['styles'] || [];
23275
23276    this.cssClass_ = options['cssClass'] || null;
23277
23278    /**
23279     * @type {string}
23280     * @private
23281     */
23282    this.imagePath_ = options['imagePath'] ||
23283        this.MARKER_CLUSTER_IMAGE_PATH_;
23284
23285    /**
23286     * @type {string}
23287     * @private
23288     */
23289    this.imageExtension_ = options['imageExtension'] ||
23290        this.MARKER_CLUSTER_IMAGE_EXTENSION_;
23291
23292    /**
23293     * @type {boolean}
23294     * @private
23295     */
23296    this.zoomOnClick_ = true;
23297
23298    if (options['zoomOnClick'] != undefined) {
23299        this.zoomOnClick_ = options['zoomOnClick'];
23300    }
23301
23302    /**
23303     * @type {boolean}
23304     * @private
23305     */
23306    this.averageCenter_ = false;
23307
23308    if (options['averageCenter'] != undefined) {
23309        this.averageCenter_ = options['averageCenter'];
23310    }
23311
23312    /**
23313     * @type {function}
23314     * @private
23315     */
23316    this.onMouseoverCluster_ = options['onMouseoverCluster'];
23317
23318    /**
23319     * @type {function}
23320     * @private
23321     */
23322    this.onMouseoutCluster_ = options['onMouseoutCluster'];
23323
23324    /**
23325     * @type {function}
23326     * @private
23327     */
23328    this.drawCluster_ = options['drawCluster'];
23329
23330    /**
23331     * @type {function}
23332     * @private
23333     */
23334    this.hideCluster_ = options['hideCluster'];
23335
23336    /**
23337     * @type {function}
23338     * @private
23339     */
23340    this.showCluster_ = options['showCluster'];
23341
23342    /**
23343     * @type {function}
23344     * @private
23345     */
23346    this.onAddCluster_ = options['onAddCluster'];
23347
23348    /**
23349     * @type {function}
23350     * @private
23351     */
23352    this.onRemoveCluster_ = options['onRemoveCluster'];
23353
23354    this.setupStyles_();
23355
23356    this.setMap(map);
23357
23358    /**
23359     * @type {number}
23360     * @private
23361     */
23362    this.prevZoom_ = this.map_.getZoom();
23363
23364    // Add the map event listeners
23365    var that = this;
23366    google.maps.event.addListener(this.map_, 'zoom_changed', function() {
23367        var zoom = that.map_.getZoom();
23368
23369        if (that.prevZoom_ != zoom) {
23370            that.prevZoom_ = zoom;
23371            that.resetViewport();
23372        }
23373    });
23374
23375    google.maps.event.addListener(this.map_, 'idle', function() {
23376        that.redraw();
23377    });
23378
23379    // Finally, add the markers
23380    if (opt_markers && opt_markers.length) {
23381        this.addMarkers(opt_markers, false);
23382    }
23383}
23384
23385
23386/**
23387 * The marker cluster image path.
23388 *
23389 * @type {string}
23390 * @private
23391 */
23392MarkerClusterer.prototype.MARKER_CLUSTER_IMAGE_PATH_ = 'https://raw.githubusercontent.com/gmaps-marker-clusterer/gmaps-marker-clusterer/master/images/m';
23393
23394
23395/**
23396 * The marker cluster image path.
23397 *
23398 * @type {string}
23399 * @private
23400 */
23401MarkerClusterer.prototype.MARKER_CLUSTER_IMAGE_EXTENSION_ = 'png';
23402
23403
23404/**
23405 * Extends a objects prototype by anothers.
23406 *
23407 * @param {Object} obj1 The object to be extended.
23408 * @param {Object} obj2 The object to extend with.
23409 * @return {Object} The new extended object.
23410 * @ignore
23411 */
23412MarkerClusterer.prototype.extend = function(obj1, obj2) {
23413    return (function(object) {
23414        for (var property in object.prototype) {
23415            this.prototype[property] = object.prototype[property];
23416        }
23417        return this;
23418    }).apply(obj1, [obj2]);
23419};
23420
23421
23422/**
23423 * Implementaion of the interface method.
23424 * @ignore
23425 */
23426MarkerClusterer.prototype.onAdd = function() {
23427    this.setReady_(true);
23428};
23429
23430/**
23431 * Implementaion of the interface method.
23432 * @ignore
23433 */
23434MarkerClusterer.prototype.draw = function() {};
23435
23436/**
23437 * Sets up the styles object.
23438 *
23439 * @private
23440 */
23441MarkerClusterer.prototype.setupStyles_ = function() {
23442    if (this.styles_.length) {
23443        return;
23444    }
23445
23446    for (var i = 0, size; size = this.sizes[i]; i++) {
23447        var url = '';
23448        if (typeof this.imagePath_ === 'function') {
23449            url = this.imagePath_(i, size);
23450        } else {
23451            url = this.imagePath_ + (i + 1) + '.' + this.imageExtension_;
23452        }
23453        this.styles_.push({
23454            url: url,
23455            height: size,
23456            width: size
23457        });
23458    }
23459};
23460
23461/**
23462 *  Fit the map to the bounds of the markers in the clusterer.
23463 */
23464MarkerClusterer.prototype.fitMapToMarkers = function() {
23465    var markers = this.getMarkers();
23466    var bounds = new google.maps.LatLngBounds();
23467    for (var i = 0, marker; marker = markers[i]; i++) {
23468        bounds.extend(marker.getPosition());
23469    }
23470
23471    this.map_.fitBounds(bounds);
23472};
23473
23474
23475/**
23476 *  Sets the styles.
23477 *
23478 *  @param {Object} styles The style to set.
23479 */
23480MarkerClusterer.prototype.setStyles = function(styles) {
23481    this.styles_ = styles;
23482};
23483
23484
23485/**
23486 *  Gets the styles.
23487 *
23488 *  @return {Object} The styles object.
23489 */
23490MarkerClusterer.prototype.getStyles = function() {
23491    return this.styles_;
23492};
23493
23494
23495/**
23496 * Whether zoom on click is set.
23497 *
23498 * @return {boolean} True if zoomOnClick_ is set.
23499 */
23500MarkerClusterer.prototype.isZoomOnClick = function() {
23501    return this.zoomOnClick_;
23502};
23503
23504/**
23505 * Whether average center is set.
23506 *
23507 * @return {boolean} True if averageCenter_ is set.
23508 */
23509MarkerClusterer.prototype.isAverageCenter = function() {
23510    return this.averageCenter_;
23511};
23512
23513
23514/**
23515 *  Returns the array of markers in the clusterer.
23516 *
23517 *  @return {Array.<google.maps.Marker>} The markers.
23518 */
23519MarkerClusterer.prototype.getMarkers = function() {
23520    return this.markers_;
23521};
23522
23523
23524/**
23525 *  Returns the number of markers in the clusterer
23526 *
23527 *  @return {Number} The number of markers.
23528 */
23529MarkerClusterer.prototype.getTotalMarkers = function() {
23530    return this.markers_.length;
23531};
23532
23533
23534/**
23535 *  Sets the max zoom for the clusterer.
23536 *
23537 *  @param {number} maxZoom The max zoom level.
23538 */
23539MarkerClusterer.prototype.setMaxZoom = function(maxZoom) {
23540    this.maxZoom_ = maxZoom;
23541};
23542
23543
23544/**
23545 *  Gets the max zoom for the clusterer.
23546 *
23547 *  @return {number} The max zoom level.
23548 */
23549MarkerClusterer.prototype.getMaxZoom = function() {
23550    return this.maxZoom_;
23551};
23552
23553/**
23554 * Gets marker's cluster object based on given marker
23555 *
23556 * @param  {google.maps.Marker} marker
23557 *
23558 * @return {Cluster}
23559 */
23560MarkerClusterer.prototype.getMarkersCluster = function(marker) {
23561    return this.clusters_[this.markersCluster_[marker.uniqueID]];
23562};
23563
23564/**
23565 *  The function for calculating the cluster icon image.
23566 *
23567 *  @param {Array.<google.maps.Marker>} markers The markers in the clusterer.
23568 *  @param {number} numStyles The number of styles available.
23569 *  @return {Object} A object properties: 'text' (string) and 'index' (number).
23570 *  @private
23571 */
23572MarkerClusterer.prototype.calculator_ = function(markers, numStyles) {
23573    var index = 0;
23574    var count = markers.length;
23575    var dv = count;
23576    while (dv !== 0) {
23577        dv = parseInt(dv / 10, 10);
23578        index++;
23579    }
23580
23581    index = Math.min(index, numStyles);
23582
23583    return {
23584        text: count,
23585        index: index
23586    };
23587};
23588
23589
23590/**
23591 * Set the calculator function.
23592 *
23593 * @param {function(Array, number)} calculator The function to set as the
23594 *     calculator. The function should return a object properties:
23595 *     'text' (string) and 'index' (number).
23596 *
23597 */
23598MarkerClusterer.prototype.setCalculator = function(calculator) {
23599    this.calculator_ = calculator;
23600};
23601
23602
23603/**
23604 * Get the calculator function.
23605 *
23606 * @return {function(Array, number)} the calculator function.
23607 */
23608MarkerClusterer.prototype.getCalculator = function() {
23609    return this.calculator_;
23610};
23611
23612
23613/**
23614 * Add an array of markers to the clusterer.
23615 *
23616 * @param {Array.<google.maps.Marker>} markers The markers to add.
23617 * @param {boolean=} opt_nodraw Whether to redraw the clusters.
23618 */
23619MarkerClusterer.prototype.addMarkers = function(markers, opt_nodraw) {
23620    for (var i = 0, marker; marker = markers[i]; i++) {
23621        this.pushMarkerTo_(marker);
23622    }
23623    if (!opt_nodraw) {
23624        this.redraw();
23625    }
23626};
23627
23628
23629/**
23630 * Pushes a marker to the clusterer.
23631 *
23632 * @param {google.maps.Marker} marker The marker to add.
23633 * @private
23634 */
23635MarkerClusterer.prototype.pushMarkerTo_ = function(marker) {
23636    marker.isAdded = false;
23637    if (marker['draggable']) {
23638        // If the marker is draggable add a listener so we update the clusters on
23639        // the drag end.
23640        var that = this;
23641        google.maps.event.addListener(marker, 'dragend', function() {
23642            marker.isAdded = false;
23643            that.repaint();
23644        });
23645    }
23646    marker.uniqueID = this.markersUniqueID;
23647    this.markersUniqueID++;
23648    this.markers_.push(marker);
23649};
23650
23651
23652/**
23653 * Adds a marker to the clusterer and redraws if needed.
23654 *
23655 * @param {google.maps.Marker} marker The marker to add.
23656 * @param {boolean=} opt_nodraw Whether to redraw the clusters.
23657 */
23658MarkerClusterer.prototype.addMarker = function(marker, opt_nodraw) {
23659    this.pushMarkerTo_(marker);
23660    if (!opt_nodraw) {
23661        this.redraw();
23662    }
23663};
23664
23665
23666/**
23667 * Removes a marker and returns true if removed, false if not
23668 *
23669 * @param {google.maps.Marker} marker The marker to remove
23670 * @return {boolean} Whether the marker was removed or not
23671 * @private
23672 */
23673MarkerClusterer.prototype.removeMarker_ = function(marker) {
23674    var index = -1;
23675    if (this.markers_.indexOf) {
23676        index = this.markers_.indexOf(marker);
23677    } else {
23678        for (var i = 0, m; m = this.markers_[i]; i++) {
23679            if (m == marker) {
23680                index = i;
23681                break;
23682            }
23683        }
23684    }
23685
23686    if (index == -1) {
23687        // Marker is not in our list of markers.
23688        return false;
23689    }
23690
23691    marker.setMap(null);
23692
23693    this.markers_.splice(index, 1);
23694    delete this.markersCluster_[marker.uniqueID];
23695
23696    return true;
23697};
23698
23699
23700/**
23701 * Remove a marker from the cluster.
23702 *
23703 * @param {google.maps.Marker} marker The marker to remove.
23704 * @param {boolean=} opt_nodraw Optional boolean to force no redraw.
23705 * @return {boolean} True if the marker was removed.
23706 */
23707MarkerClusterer.prototype.removeMarker = function(marker, opt_nodraw) {
23708    var removed = this.removeMarker_(marker);
23709
23710    if (!opt_nodraw && removed) {
23711        this.resetViewport();
23712        this.redraw();
23713        return true;
23714    } else {
23715        return false;
23716    }
23717};
23718
23719
23720/**
23721 * Removes an array of markers from the cluster.
23722 *
23723 * @param {Array.<google.maps.Marker>} markers The markers to remove.
23724 * @param {boolean=} opt_nodraw Optional boolean to force no redraw.
23725 */
23726MarkerClusterer.prototype.removeMarkers = function(markers, opt_nodraw) {
23727    var removed = false;
23728
23729    for (var i = markers.length; i >= 0; i--) {
23730        var marker = markers[i];
23731        var r = this.removeMarker_(marker);
23732        removed = removed || r;
23733    }
23734
23735    if (!opt_nodraw && removed) {
23736        this.resetViewport();
23737        this.redraw();
23738        return true;
23739    }
23740};
23741
23742
23743/**
23744 * Sets the clusterer's ready state.
23745 *
23746 * @param {boolean} ready The state.
23747 * @private
23748 */
23749MarkerClusterer.prototype.setReady_ = function(ready) {
23750    if (!this.ready_) {
23751        this.ready_ = ready;
23752        this.createClusters_();
23753    }
23754};
23755
23756
23757/**
23758 * Returns the number of clusters in the clusterer.
23759 *
23760 * @return {number} The number of clusters.
23761 */
23762MarkerClusterer.prototype.getTotalClusters = function() {
23763    return this.clusters_.length;
23764};
23765
23766
23767/**
23768 *  Returns the list of clusters in the clusterer
23769 *
23770 *  @return {Array.<Cluster>} The list of clusters.
23771 */
23772MarkerClusterer.prototype.getClusters = function() {
23773    return this.clusters_;
23774};
23775
23776
23777/**
23778 * Returns the google map that the clusterer is associated with.
23779 *
23780 * @return {google.maps.Map} The map.
23781 */
23782MarkerClusterer.prototype.getMap = function() {
23783    return this.map_;
23784};
23785
23786
23787/**
23788 * Sets the google map that the clusterer is associated with.
23789 *
23790 * @param {google.maps.Map} map The map.
23791 */
23792MarkerClusterer.prototype.setMap = function(map) {
23793    this.map_ = map;
23794};
23795
23796
23797/**
23798 * Returns the size of the grid.
23799 *
23800 * @return {number} The grid size.
23801 */
23802MarkerClusterer.prototype.getGridSize = function() {
23803    return this.gridSize_;
23804};
23805
23806
23807/**
23808 * Sets the size of the grid.
23809 *
23810 * @param {number} size The grid size.
23811 */
23812MarkerClusterer.prototype.setGridSize = function(size) {
23813    this.gridSize_ = size;
23814};
23815
23816
23817/**
23818 * Returns the min cluster size.
23819 *
23820 * @return {number} The grid size.
23821 */
23822MarkerClusterer.prototype.getMinClusterSize = function() {
23823    return this.minClusterSize_;
23824};
23825
23826/**
23827 * Sets the min cluster size.
23828 *
23829 * @param {number} size The grid size.
23830 */
23831MarkerClusterer.prototype.setMinClusterSize = function(size) {
23832    this.minClusterSize_ = size;
23833};
23834
23835
23836/**
23837 * Extends a bounds object by the grid size.
23838 *
23839 * @param {google.maps.LatLngBounds} bounds The bounds to extend.
23840 * @return {google.maps.LatLngBounds}
23840 The extended bounds.
23841 */
23842MarkerClusterer.prototype.getExtendedBounds = function(bounds) {
23843    var projection = this.getProjection();
23844
23845    // Turn the bounds into latlng.
23846    var tr = new google.maps.LatLng(bounds.getNorthEast().lat(),
23847        bounds.getNorthEast().lng());
23848    var bl = new google.maps.LatLng(bounds.getSouthWest().lat(),
23849        bounds.getSouthWest().lng());
23850
23851    // Convert the points to pixels and the extend out by the grid size.
23852    var trPix = projection.fromLatLngToDivPixel(tr);
23853    trPix.x += this.gridSize_;
23854    trPix.y -= this.gridSize_;
23855
23856    var blPix = projection.fromLatLngToDivPixel(bl);
23857    blPix.x -= this.gridSize_;
23858    blPix.y += this.gridSize_;
23859
23860    // Convert the pixel points back to LatLng
23861    var ne = projection.fromDivPixelToLatLng(trPix);
23862    var sw = projection.fromDivPixelToLatLng(blPix);
23863
23864    // Extend the bounds to contain the new bounds.
23865    bounds.extend(ne);
23866    bounds.extend(sw);
23867
23868    return bounds;
23869};
23870
23871
23872/**
23873 * Determins if a marker is contained in a bounds.
23874 *
23875 * @param {google.maps.Marker} marker The marker to check.
23876 * @param {google.maps.LatLngBounds} bounds The bounds to check against.
23877 * @return {boolean} True if the marker is in the bounds.
23878 * @private
23879 */
23880MarkerClusterer.prototype.isMarkerInBounds_ = function(marker, bounds) {
23881    return bounds.contains(marker.getPosition());
23882};
23883
23884
23885/**
23886 * Clears all clusters and markers from the clusterer.
23887 */
23888MarkerClusterer.prototype.clearMarkers = function() {
23889    this.resetViewport(true);
23890
23891    // Set the markers a empty array.
23892    this.markers_ = [];
23893    this.markersCluster_ = {};
23894    this.markersUniqueID = 1;
23895};
23896
23897
23898/**
23899 * Clears all existing clusters and recreates them.
23900 * @param {boolean} opt_hide To also hide the marker.
23901 */
23902MarkerClusterer.prototype.resetViewport = function(opt_hide) {
23903    // Remove all the clusters
23904    for (var i = 0, cluster; cluster = this.clusters_[i]; i++) {
23905        cluster.remove();
23906    }
23907
23908    // Reset the markers to not be added and to be invisible.
23909    for (var i = 0, marker; marker = this.markers_[i]; i++) {
23910        marker.isAdded = false;
23911        if (opt_hide) {
23912            marker.setMap(null);
23913        }
23914    }
23915
23916    this.clusters_ = [];
23917    this.markersCluster_ = {};
23918    this.markersUniqueID = 1;
23919};
23920
23921/**
23922 *
23923 */
23924MarkerClusterer.prototype.repaint = function() {
23925    var oldClusters = this.clusters_.slice();
23926    this.clusters_.length = 0;
23927    this.resetViewport();
23928    this.redraw();
23929
23930    // Remove the old clusters.
23931    // Do it in a timeout so the other clusters have been drawn first.
23932    window.setTimeout(function() {
23933        for (var i = 0, cluster; cluster = oldClusters[i]; i++) {
23934            cluster.remove();
23935        }
23936    }, 0);
23937};
23938
23939
23940/**
23941 * Redraws the clusters.
23942 */
23943MarkerClusterer.prototype.redraw = function() {
23944    this.createClusters_();
23945};
23946
23947
23948/**
23949 * Calculates the distance between two latlng locations in km.
23950 * @see http://www.movable-type.co.uk/scripts/latlong.html
23951 *
23952 * @param {google.maps.LatLng} p1 The first lat lng point.
23953 * @param {google.maps.LatLng} p2 The second lat lng point.
23954 * @return {number} The distance between the two points in km.
23955 * @private
23956 */
23957MarkerClusterer.prototype.distanceBetweenPoints_ = function(p1, p2) {
23958    if (!p1 || !p2) {
23959        return 0;
23960    }
23961
23962    var R = 6371; // Radius of the Earth in km
23963    var dLat = (p2.lat() - p1.lat()) * Math.PI / 180;
23964    var dLon = (p2.lng() - p1.lng()) * Math.PI / 180;
23965    var a = Math.sin(dLat / 2) * Math.sin(dLat / 2) +
23966        Math.cos(p1.lat() * Math.PI / 180) * Math.cos(p2.lat() * Math.PI / 180) *
23967        Math.sin(dLon / 2) * Math.sin(dLon / 2);
23968    var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
23969    var d = R * c;
23970    return d;
23971};
23972
23973
23974/**
23975 * Add a marker to a cluster, or creates a new cluster.
23976 *
23977 * @param {google.maps.Marker} marker The marker to add.
23978 * @private
23979 */
23980MarkerClusterer.prototype.addToClosestCluster_ = function(marker) {
23981    var distance = 40000; // Some large number
23982    var clusterToAddTo = null;
23983    var pos = marker.getPosition();
23984    var clusterIndex = null;
23985    for (var i = 0, cluster; cluster = this.clusters_[i]; i++) {
23986        var center = cluster.getCenter();
23987        if (center) {
23988            var d = this.distanceBetweenPoints_(center, marker.getPosition());
23989            if (d < distance) {
23990                distance = d;
23991                clusterToAddTo = cluster;
23992                clusterIndex = i;
23993            }
23994        }
23995    }
23996
23997    if (clusterToAddTo && clusterToAddTo.isMarkerInClusterBounds(marker)) {
23998        clusterToAddTo.addMarker(marker);
23999    } else {
24000        var cluster = new Cluster(this);
24001        cluster.addMarker(marker);
24002        this.clusters_.push(cluster);
24003        clusterIndex = this.clusters_.length - 1;
24004    }
24005
24006    if (marker.isAdded) {
24007        this.markersCluster_[marker.uniqueID] = clusterIndex;
24008    }
24009};
24010
24011
24012/**
24013 * Creates the clusters.
24014 *
24015 * @private
24016 */
24017MarkerClusterer.prototype.createClusters_ = function() {
24018    if (!this.ready_) {
24019        return;
24020    }
24021
24022    // Get our current map view bounds.
24023    // Create a new bounds object so we don't affect the map.
24024    var mapBounds = new google.maps.LatLngBounds(this.map_.getBounds().getSouthWest(),
24025        this.map_.getBounds().getNorthEast());
24026    var bounds = this.getExtendedBounds(mapBounds);
24027
24028    for (var i = 0, marker; marker = this.markers_[i]; i++) {
24029        if (!marker.isAdded && this.isMarkerInBounds_(marker, bounds) && (!this.ignoreHiddenMarkers_ || marker.getVisible())) {
24030            this.addToClosestCluster_(marker);
24031        }
24032    }
24033};
24034
24035
24036/**
24037 * A cluster that contains markers.
24038 *
24039 * @param {MarkerClusterer} markerClusterer The markerclusterer that this
24040 *     cluster is associated with.
24041 * @constructor
24042 * @ignore
24043 */
24044function Cluster(markerClusterer) {
24045    this.markerClusterer_ = markerClusterer;
24046    this.map_ = markerClusterer.getMap();
24047    this.gridSize_ = markerClusterer.getGridSize();
24048    this.minClusterSize_ = markerClusterer.getMinClusterSize();
24049    this.averageCenter_ = markerClusterer.isAverageCenter();
24050    this.center_ = null;
24051    this.markers_ = [];
24052    this.bounds_ = null;
24053    this.clusterIcon_ = new ClusterIcon(this, markerClusterer.getStyles(),
24054        markerClusterer.getGridSize());
24055}
24056
24057/**
24058 * Determins if a marker is already added to the cluster.
24059 *
24060 * @param {google.maps.Marker} marker The marker to check.
24061 * @return {boolean} True if the marker is already added.
24062 */
24063Cluster.prototype.isMarkerAlreadyAdded = function(marker) {
24064    if (this.markers_.indexOf) {
24065        return this.markers_.indexOf(marker) != -1;
24066    } else {
24067        for (var i = 0, m; m = this.markers_[i]; i++) {
24068            if (m == marker) {
24069                return true;
24070            }
24071        }
24072    }
24073    return false;
24074};
24075
24076
24077/**
24078 * Add a marker the cluster.
24079 *
24080 * @param {google.maps.Marker} marker The marker to add.
24081 * @return {boolean} True if the marker was added.
24082 */
24083Cluster.prototype.addMarker = function(marker) {
24084    if (this.isMarkerAlreadyAdded(marker)) {
24085        return false;
24086    }
24087
24088    if (!this.center_) {
24089        this.center_ = marker.getPosition();
24090        this.calculateBounds_();
24091    } else {
24092        if (this.averageCenter_) {
24093            var l = this.markers_.length + 1;
24094            var lat = (this.center_.lat() * (l - 1) + marker.getPosition().lat()) / l;
24095            var lng = (this.center_.lng() * (l - 1) + marker.getPosition().lng()) / l;
24096            this.center_ = new google.maps.LatLng(lat, lng);
24097            this.calculateBounds_();
24098        }
24099    }
24100
24101    marker.isAdded = true;
24102    this.markers_.push(marker);
24103
24104    var len = this.markers_.length;
24105    if (len < this.minClusterSize_ && marker.getMap() != this.map_) {
24106        // Min cluster size not reached so show the marker.
24107        marker.setMap(this.map_);
24108    }
24109
24110    if (len == this.minClusterSize_) {
24111        // Hide the markers that were showing.
24112        for (var i = 0; i < len; i++) {
24113            this.markers_[i].setMap(null);
24114        }
24115    }
24116
24117    if (len >= this.minClusterSize_) {
24118        marker.setMap(null);
24119    }
24120
24121    this.updateIcon();
24122    return true;
24123};
24124
24125
24126/**
24127 * Returns the marker clusterer that the cluster is associated with.
24128 *
24129 * @return {MarkerClusterer} The associated marker clusterer.
24130 */
24131Cluster.prototype.getMarkerClusterer = function() {
24132    return this.markerClusterer_;
24133};
24134
24135
24136/**
24137 * Returns the bounds of the cluster.
24138 *
24139 * @return {google.maps.LatLngBounds} the cluster bounds.
24140 */
24141Cluster.prototype.getBounds = function() {
24142    var bounds = new google.maps.LatLngBounds(this.center_, this.center_);
24143    var markers = this.getMarkers();
24144    for (var i = 0, marker; marker = markers[i]; i++) {
24145        bounds.extend(marker.getPosition());
24146    }
24147    return bounds;
24148};
24149
24150
24151/**
24152 * Removes the cluster
24153 */
24154Cluster.prototype.remove = function() {
24155    this.clusterIcon_.remove();
24156    this.markers_.length = 0;
24157    delete this.markers_;
24158};
24159
24160
24161/**
24162 * Returns the center of the cluster.
24163 *
24164 * @return {number} The cluster center.
24165 */
24166Cluster.prototype.getSize = function() {
24167    return this.markers_.length;
24168};
24169
24170
24171/**
24172 * Returns the center of the cluster.
24173 *
24174 * @return {Array.<google.maps.Marker>} The cluster center.
24175 */
24176Cluster.prototype.getMarkers = function() {
24177    return this.markers_;
24178};
24179
24180
24181/**
24182 * Returns the center of the cluster.
24183 *
24184 * @return {google.maps.LatLng} The cluster center.
24185 */
24186Cluster.prototype.getCenter = function() {
24187    return this.center_;
24188};
24189
24190
24191/**
24192 * Calculated the extended bounds of the cluster with the grid.
24193 *
24194 * @private
24195 */
24196Cluster.prototype.calculateBounds_ = function() {
24197    var bounds = new google.maps.LatLngBounds(this.center_, this.center_);
24198    this.bounds_ = this.markerClusterer_.getExtendedBounds(bounds);
24199};
24200
24201
24202/**
24203 * Determines if a marker lies in the clusters bounds.
24204 *
24205 * @param {google.maps.Marker} marker The marker to check.
24206 * @return {boolean} True if the marker lies in the bounds.
24207 */
24208Cluster.prototype.isMarkerInClusterBounds = function(marker) {
24209    return this.bounds_.contains(marker.getPosition());
24210};
24211
24212
24213/**
24214 * Returns the map that the cluster is associated with.
24215 *
24216 * @return {google.maps.Map} The map.
24217 */
24218Cluster.prototype.getMap = function() {
24219    return this.map_;
24220};
24221
24222
24223/**
24224 * Updates the cluster icon
24225 */
24226Cluster.prototype.updateIcon = function() {
24227    var zoom = this.map_.getZoom();
24228    var mz = this.markerClusterer_.getMaxZoom();
24229
24230    if (mz && zoom > mz) {
24231        // The zoom is greater than our max zoom so show all the markers in cluster.
24232        for (var i = 0, marker; marker = this.markers_[i]; i++) {
24233            marker.setMap(this.map_);
24234        }
24235        return;
24236    }
24237
24238    if (this.markers_.length < this.minClusterSize_) {
24239        // Min cluster size not yet reached.
24240        this.clusterIcon_.hide();
24241        return;
24242    }
24243
24244    var numStyles = this.markerClusterer_.getStyles().length;
24245    var sums = this.markerClusterer_.getCalculator()(this.markers_, numStyles);
24246    this.clusterIcon_.setCenter(this.center_);
24247    this.clusterIcon_.setSums(sums);
24248    this.clusterIcon_.show();
24249};
24250
24251
24252/**
24253 * A cluster icon
24254 *
24255 * @param {Cluster} cluster The cluster to be associated with.
24256 * @param {Object} styles An object that has style properties:
24257 *     'url': (string) The image url.
24258 *     'height': (number) The image height.
24259 *     'width': (number) The image width.
24260 *     'anchor': (Array) The anchor position of the label text.
24261 *     'textColor': (string) The text color.
24262 *     'textSize': (number) The text size.
24263 *     'backgroundPosition: (string) The background postition x, y.
24264 * @param {number=} opt_padding Optional padding to apply to the cluster icon.
24265 * @constructor
24266 * @extends google.maps.OverlayView
24267 * @ignore
24268 */
24269function ClusterIcon(cluster, styles, opt_padding) {
24270    cluster.getMarkerClusterer().extend(ClusterIcon, google.maps.OverlayView);
24271
24272    this.styles_ = styles;
24273    this.padding_ = opt_padding || 0;
24274    this.cluster_ = cluster;
24275    this.center_ = null;
24276    this.map_ = cluster.getMap();
24277    this.div_ = null;
24278    this.sums_ = null;
24279    this.visible_ = false;
24280
24281    this.setMap(this.map_);
24282}
24283
24284/**
24285 * Triggers the clusterclick event and zoom's if the option is set.
24286 *
24287 * @param {google.maps.MouseEvent} event The event to propagate
24288 */
24289ClusterIcon.prototype.triggerClusterClick = function(event) {
24290    var markerClusterer = this.cluster_.getMarkerClusterer();
24291
24292    // Trigger the clusterclick event.
24293    google.maps.event.trigger(markerClusterer, 'clusterclick', this.cluster_, event);
24294
24295    if (markerClusterer.isZoomOnClick()) {
24296        // Zoom into the cluster.
24297        this.map_.fitBounds(this.cluster_.getBounds());
24298    }
24299};
24300
24301/**
24302 * Triggers the clustermouseover event.
24303 * @param {google.maps.MouseEvent} event The event to propagate
24304 */
24305ClusterIcon.prototype.triggerClusterMouseover = function(event) {
24306    var markerClusterer = this.cluster_.getMarkerClusterer();
24307
24308    // Trigger the clustermouseover event.
24309    google.maps.event.trigger(markerClusterer, 'clustermouseover', this.cluster_, event);
24310
24311    if (typeof this.cluster_.markerClusterer_.onMouseoverCluster_ === 'function') {
24312        this.cluster_.markerClusterer_.onMouseoverCluster_(this, event);
24313    }
24314};
24315
24316/**
24317 * Triggers the clustermouseout event.
24318 * @param {google.maps.MouseEvent} event The event to propagate
24319 */
24320ClusterIcon.prototype.triggerClusterMouseout = function(event) {
24321    var markerClusterer = this.cluster_.getMarkerClusterer();
24322
24323    // Trigger the clustermouseout event.
24324    google.maps.event.trigger(markerClusterer, 'clustermouseout', this.cluster_, event);
24325
24326    if (typeof this.cluster_.markerClusterer_.onMouseoutCluster_ === 'function') {
24327        this.cluster_.markerClusterer_.onMouseoutCluster_(this, event);
24328    }
24329};
24330
24331/**
24332 * Adding the cluster icon to the dom.
24333 * @ignore
24334 */
24335ClusterIcon.prototype.onAdd = function () {
24336    if (typeof this.cluster_.markerClusterer_.onAddCluster_ === 'function') {
24337        this.cluster_.markerClusterer_.onAddCluster_(this);
24338    }
24339    else {
24340        defaultClusterOnAdd(this);
24341    }
24342};
24343
24344/**
24345 * Default onAdd function
24346 * @ignore
24347 */
24348function defaultClusterOnAdd(clusterIcon) {
24349    clusterIcon.div_ = document.createElement('DIV');
24350    if (clusterIcon.visible_) {
24351        var pos = clusterIcon.getPosFromLatLng_(clusterIcon.center_);
24352        clusterIcon.div_.style.cssText = clusterIcon.createCss(pos);
24353        clusterIcon.div_.innerHTML = clusterIcon.sums_.text;
24354        clusterIcon.addClass();
24355    }
24356
24357    var panes = clusterIcon.getPanes();
24358
24359    panes.overlayMouseTarget.appendChild(clusterIcon.div_);
24360
24361    var isDragging = false;
24362    var isMouseDown = false;
24363
24364    google.maps.event.addDomListener(clusterIcon.div_, 'click', function(event) {
24365        // Only perform click when not preceded by a drag
24366        if (!isDragging) {
24367            clusterIcon.triggerClusterClick(event);
24368        }
24369    });
24370
24371    google.maps.event.addDomListener(clusterIcon.div_, 'mousedown', function() {
24372        isDragging = false;
24373        isMouseDown = true;
24374    });
24375
24376    google.maps.event.addDomListener(clusterIcon.div_, 'mouseup', function() {
24377        isDragging = false;
24378        isMouseDown = false;
24379    });
24380
24381    google.maps.event.addDomListener(clusterIcon.div_, 'mousemove', function() {
24382        if (isMouseDown) {
24383            isDragging = true;
24384        }
24385    });
24386
24387    google.maps.event.addDomListener(clusterIcon.div_, 'mouseover', function(event) {
24388        clusterIcon.triggerClusterMouseover(event);
24389    });
24390
24391    google.maps.event.addDomListener(clusterIcon.div_, 'mouseout', function(event) {
24392        clusterIcon.triggerClusterMouseout(event);
24393    });
24394}
24395
24396/**
24397 * Returns the position to place the div dending on the latlng.
24398 *
24399 * @param {google.maps.LatLng} latlng The position in latlng.
24400 * @return {google.maps.Point} The position in pixels.
24401 * @private
24402 */
24403ClusterIcon.prototype.getPosFromLatLng_ = function(latlng) {
24404    var pos = this.getProjection().fromLatLngToDivPixel(latlng);
24405
24406    if (typeof this.iconAnchor_ === 'object' && this.iconAnchor_.length === 2) {
24407        pos.x -= this.iconAnchor_[0];
24408        pos.y -= this.iconAnchor_[1];
24409    } else {
24410        pos.x -= parseInt(this.width_ / 2, 10);
24411        pos.y -= parseInt(this.height_ / 2, 10);
24412    }
24413    return pos;
24414};
24415
24416
24417/**
24418 * Draw the icon.
24419 * @ignore
24420 */
24421ClusterIcon.prototype.draw = function () {
24422    if (typeof this.cluster_.markerClusterer_.drawCluster_ === 'function') {
24423        this.cluster_.markerClusterer_.drawCluster_(this);
24424    }
24425    else {
24426        defaultClusterDraw(this);
24427    }
24428};
24429
24430/**
24431 * Default draw function
24432 * @ignore
24433 */
24434function defaultClusterDraw(clusterIcon) {
24435    if (clusterIcon.visible_) {
24436        var pos = clusterIcon.getPosFromLatLng_(clusterIcon.center_);
24437        clusterIcon.div_.style.top = pos.y + 'px';
24438        clusterIcon.div_.style.left = pos.x + 'px';
24439    }
24440}
24441
24442
24443/**
24444 * Hide the icon.
24445 */
24446ClusterIcon.prototype.hide = function() {
24447    if (typeof this.cluster_.markerClusterer_.hideCluster_ === 'function') {
24448        this.cluster_.markerClusterer_.hideCluster_(this);
24449    }
24450    else {
24451        defaultClusterHide(this);
24452    }
24453};
24454
24455
24456/**
24457 * Default hide function
24458 * @ignore
24459 */
24460function defaultClusterHide(clusterIcon) {
24461    if (clusterIcon.div_) {
24462        clusterIcon.div_.style.display = 'none';
24463        clusterIcon.div_.className = '';
24464    }
24465    clusterIcon.visible_ = false;
24466}
24467
24468
24469/**
24470 * Position and show the icon.
24471 */
24472ClusterIcon.prototype.show = function() {
24473    if (typeof this.cluster_.markerClusterer_.showCluster_ === 'function') {
24474        this.cluster_.markerClusterer_.showCluster_(this);
24475    }
24476    else {
24477        defaultClusterShow(this);
24478    }
24479};
24480
24481/**
24482 * Default show function
24483 * @ignore
24484 */
24485function defaultClusterShow(clusterIcon) {
24486    if (clusterIcon.div_) {
24487        var pos = clusterIcon.getPosFromLatLng_(clusterIcon.center_);
24488        clusterIcon.div_.style.cssText = clusterIcon.createCss(pos);
24489        clusterIcon.div_.style.display = '';
24490        clusterIcon.addClass();
24491    }
24492    clusterIcon.visible_ = true;
24493}
24494
24495
24496/**
24497 * Remove the icon from the map
24498 */
24499ClusterIcon.prototype.remove = function() {
24500    this.setMap(null);
24501};
24502
24503
24504/**
24505 * Implementation of the onRemove interface.
24506 * @ignore
24507 */
24508ClusterIcon.prototype.onRemove = function() {
24509    if (typeof this.cluster_.markerClusterer_.onRemoveCluster_ === 'function') {
24510        this.cluster_.markerClusterer_.onRemoveCluster_(this);
24511    }
24512    else {
24513        defaultClusterOnRemove(this);
24514    }
24515};
24516
24517/**
24518 * Default onRemove function
24519 * @ignore
24520 */
24521function defaultClusterOnRemove(clusterIcon) {
24522    if (clusterIcon.div_ && clusterIcon.div_.parentNode) {
24523        clusterIcon.hide();
24524        clusterIcon.div_.parentNode.removeChild(clusterIcon.div_);
24525        clusterIcon.div_ = null;
24526    }
24527}
24528
24529
24530/**
24531 * Set the sums of the icon.
24532 *
24533 * @param {Object} sums The sums containing:
24534 *   'text': (string) The text to display in the icon.
24535 *   'index': (number) The style index of the icon.
24536 */
24537ClusterIcon.prototype.setSums = function(sums) {
24538    this.sums_ = sums;
24539    this.text_ = sums.text;
24540    this.index_ = sums.index;
24541    if (this.div_) {
24542        this.div_.innerHTML = sums.text;
24543    }
24544
24545    this.useStyle();
24546};
24547
24548
24549/**
24550 * Sets the icon to the the styles.
24551 */
24552ClusterIcon.prototype.useStyle = function() {
24553    var index = Math.max(0, this.sums_.index - 1);
24554    index = Math.min(this.styles_.length - 1, index);
24555    var style = this.styles_[index];
24556    this.url_ = style['url'];
24557    this.height_ = style['height'];
24558    this.width_ = style['width'];
24559    this.textColor_ = style['textColor'];
24560    this.anchor_ = style['anchor'];
24561    this.textSize_ = style['textSize'];
24562    this.backgroundPosition_ = style['backgroundPosition'];
24563    this.iconAnchor_ = style['iconAnchor'];
24564    this.setIndex_ = index;
24565};
24566
24567
24568/**
24569 * Sets the center of the icon.
24570 *
24571 * @param {google.maps.LatLng} center The latlng to set as the center.
24572 */
24573ClusterIcon.prototype.setCenter = function(center) {
24574    this.center_ = center;
24575};
24576
24577
24578/**
24579 * Create the css text based on the position of the icon.
24580 *
24581 * @param {google.maps.Point} pos The position.
24582 * @return {string} The css style text.
24583 */
24584ClusterIcon.prototype.createCss = function(pos) {
24585    var style = [];
24586    var markerClusterer = this.cluster_.getMarkerClusterer();
24587
24588    if (!markerClusterer.cssClass_) {
24589        style.push('background-image:url(' + this.url_ + ');');
24590        var backgroundPosition = this.backgroundPosition_ ? this.backgroundPosition_ : '0 0';
24591        style.push('background-position:' + backgroundPosition + ';');
24592
24593        if (typeof this.anchor_ === 'object') {
24594            if (typeof this.anchor_[0] === 'number' && this.anchor_[0] > 0 &&
24595                this.anchor_[0] < this.height_) {
24596                style.push('height:' + (this.height_ - this.anchor_[0]) +
24597                    'px; padding-top:' + this.anchor_[0] + 'px;');
24598            } else if (typeof this.anchor_[0] === 'number' && this.anchor_[0] < 0 &&
24599                -this.anchor_[0] < this.height_) {
24600                style.push('height:' + this.height_ + 'px; line-height:' + (this.height_ + this.anchor_[0]) +
24601                    'px;');
24602            } else {
24603                style.push('height:' + this.height_ + 'px; line-height:' + this.height_ +
24604                    'px;');
24605            }
24606            if (typeof this.anchor_[1] === 'number' && this.anchor_[1] > 0 &&
24607                this.anchor_[1] < this.width_) {
24608                style.push('width:' + (this.width_ - this.anchor_[1]) +
24609                    'px; padding-left:' + this.anchor_[1] + 'px;');
24610            } else {
24611                style.push('width:' + this.width_ + 'px; text-align:center;');
24612            }
24613        } else {
24614            style.push('height:' + this.height_ + 'px; line-height:' +
24615                this.height_ + 'px; width:' + this.width_ + 'px; text-align:center;');
24616        }
24617
24618        var txtColor = this.textColor_ ? this.textColor_ : 'black';
24619        var txtSize = this.textSize_ ? this.textSize_ : 11;
24620
24621        style.push('cursor:pointer; top:' + pos.y + 'px; left:' +
24622            pos.x + 'px; color:' + txtColor + '; position:absolute; font-size:' +
24623            txtSize + 'px; font-family:Arial,sans-serif; font-weight:bold');
24624
24625    } else {
24626        style.push('top:' + pos.y + 'px; left:' + pos.x + 'px;');
24627    }
24628
24629    return style.join('');
24630};
24631
24632/**
24633 * Set the class for the cluster icon
24634 * @ignore
24635 */
24636ClusterIcon.prototype.addClass = function() {
24637    var markerClusterer = this.cluster_.getMarkerClusterer();
24638
24639    if (markerClusterer.cssClass_) {
24640        this.div_.className = markerClusterer.cssClass_ + ' ' + markerClusterer.cssDefaultClass_ + this.setIndex_;
24641    } else {
24642        this.div_.className = markerClusterer.cssDefaultClass_ + this.setIndex_;
24643    }
24644}
24645
24646
24647// Export Symbols for Closure
24648// If you are not going to compile with closure then you can remove the
24649// code below.
24650window['MarkerClusterer'] = MarkerClusterer;
24651MarkerClusterer.prototype['addMarker'] = MarkerClusterer.prototype.addMarker;
24652MarkerClusterer.prototype['addMarkers'] = MarkerClusterer.prototype.addMarkers;
24653MarkerClusterer.prototype['clearMarkers'] =
24654    MarkerClusterer.prototype.clearMarkers;
24655MarkerClusterer.prototype['fitMapToMarkers'] =
24656    MarkerClusterer.prototype.fitMapToMarkers;
24657MarkerClusterer.prototype['getCalculator'] =
24658    MarkerClusterer.prototype.getCalculator;
24659MarkerClusterer.prototype['getGridSize'] =
24660    MarkerClusterer.prototype.getGridSize;
24661MarkerClusterer.prototype['getExtendedBounds'] =
24662    MarkerClusterer.prototype.getExtendedBounds;
24663MarkerClusterer.prototype['getMap'] = MarkerClusterer.prototype.getMap;
24664MarkerClusterer.prototype['getMarkers'] = MarkerClusterer.prototype.getMarkers;
24665MarkerClusterer.prototype['getMaxZoom'] = MarkerClusterer.prototype.getMaxZoom;
24666MarkerClusterer.prototype['getMarkersCluster'] = MarkerClusterer.prototype.getMarkersCluster;
24667MarkerClusterer.prototype['getStyles'] = MarkerClusterer.prototype.getStyles;
24668MarkerClusterer.prototype['getTotalClusters'] =
24669    MarkerClusterer.prototype.getTotalClusters;
24670MarkerClusterer.prototype['getTotalMarkers'] =
24671    MarkerClusterer.prototype.getTotalMarkers;
24672MarkerClusterer.prototype['redraw'] = MarkerClusterer.prototype.redraw;
24673MarkerClusterer.prototype['removeMarker'] =
24674    MarkerClusterer.prototype.removeMarker;
24675MarkerClusterer.prototype['removeMarkers'] =
24676    MarkerClusterer.prototype.removeMarkers;
24677MarkerClusterer.prototype['resetViewport'] =
24678    MarkerClusterer.prototype.resetViewport;
24679MarkerClusterer.prototype['repaint'] =
24680    MarkerClusterer.prototype.repaint;
24681MarkerClusterer.prototype['setCalculator'] =
24682    MarkerClusterer.prototype.setCalculator;
24683MarkerClusterer.prototype['setGridSize'] =
24684    MarkerClusterer.prototype.setGridSize;
24685MarkerClusterer.prototype['setMaxZoom'] =
24686    MarkerClusterer.prototype.setMaxZoom;
24687MarkerClusterer.prototype['onAdd'] = MarkerClusterer.prototype.onAdd;
24688MarkerClusterer.prototype['draw'] = MarkerClusterer.prototype.draw;
24689
24690Cluster.prototype['getCenter'] = Cluster.prototype.getCenter;
24691Cluster.prototype['getSize'] = Cluster.prototype.getSize;
24692Cluster.prototype['getMarkers'] = Cluster.prototype.getMarkers;
24693
24694ClusterIcon.prototype['onAdd'] = ClusterIcon.prototype.onAdd;
24695ClusterIcon.prototype['draw'] = ClusterIcon.prototype.draw;
24696ClusterIcon.prototype['onRemove'] = ClusterIcon.prototype.onRemove;
24697this.SS = (function () {
24698  function SS() {
24699  }
24700
24701  SS.config = {};
24702
24703  SS.head = "";
24704
24705  SS.href = "";
24706
24707  SS.loading = "\u003cimg style=\"vertical-align:middle\" alt=\"loading..\" border=\"0\" width=\"16\" height=\"11\" class=\"ss-base-loading\" src=\"/assets/img/loading.gif\" /\u003e";
24708
24709  SS.noticeTimeoutId = null;
24710
24711  SS.page = "";
24712
24713  SS.pageName = null;
24714
24715  SS.parts = null;
24716
24717  SS.siteName = null;
24718
24719  SS.debug = false;
24720
24721  SS.defaultTimeoutMillis = 5000;
24722
24723  SS.KEY_ENTER = 13;
24724  SS.DEFAULT_DATE_FORMAT = '%Y/%m/%d';
24725  SS.DEFAULT_TIME_FORMAT = '%Y/%m/%d %H:%M';
24726
24727  SS.isReady = false;
24728  var readyPromise = new Promise(function(resolve, _reject) {
24729    // 5秒以内に doneReady が呼ばれない場合、強制的に呼ぶ
24730    SS.readyTimeout = setTimeout(function() {
24731      console.error("'application.js' wasn't loaded within 10 secs. please check your 'config/ss.yml'.");
24732      resolve();
24733    }, 10000);
24734
24735    SS.doneReady = function() {
24736      if (SS.isReady) {
24737        return;
24738      }
24739
24740      SS.isReady = true;
24741      if (SS.readyTimeout) {
24742        clearTimeout(SS.readyTimeout);
24743        SS.readyTimeout = null;
24744      }
24745
24746      resolve();
24747    }
24748  });
24749
24750  SS.ready = readyPromise.then.bind(readyPromise);
24751
24752  // $.isEmptyObject には IE11 で非互換がある。
24753  //
24754  //                            | Chrome 84 | IE 11  |
24755  // ===========================|===========|========|
24756  // $.isEmptyObject()          | true      | true   |
24757  // $.isEmptyObject(undefined) | true      | true   |
24758  // $.isEmptyObject(null)      | true      | true   |
24759  // $.isEmptyObject([])        | true      | false  |
24760  // $.isEmptyObject({})        | true      | true   |
24761  // $.isEmptyObject(0)         | true      | true   |
24762  // $.isEmptyObject("")        | true      | false  |
24763  // $.isEmptyObject([0])       | false     | false  |
24764  // $.isEmptyObject({a:0})     | false     | false  |
24765  // $.isEmptyObject(1)         | true      | true   |
24766  // $.isEmptyObject(-1)        | true      | true   |
24767  // $.isEmptyObject("a")       | false     | false  |
24768  // * `[]` と `""` との場合で非互換がある。
24769  //
24770  // 本来の $.isEmptyObject には上記のような非互換は存在しないが、
24771  // IE 11 向けにポリフィルを組み込むと、上記のような非互換が発生する。
24772  //
24773  // IE 11 でも isEmptyObject が動作するように本メソッドを提供する。
24774  SS.isEmptyObject = function (objectOrArray) {
24775    if ($.isEmptyObject(objectOrArray)) {
24776      return true;
24777    }
24778    if ($.isArray(objectOrArray) && objectOrArray.length === 0) {
24779      return true;
24780    }
24781    if ($.type(objectOrArray) === "string" && objectOrArray.length === 0) {
24782      return true;
24783    }
24784
24785    return false;
24786  };
24787
24788  SS.disableClick = function (el) {
24789    if (el.data('clicked')) {
24790      return false;
24791    }
24792    el.data('clicked', true);
24793    return true;
24794  };
24795
24796  SS.load = function () {
24797  };
24798
24799  SS.justOnce = function(element, key, callback, alreadyInitializedCallback) {
24800    if (!element.ss) {
24801      element.ss = {};
24802    }
24803
24804    var ret = element.ss[key];
24805    if (ret) {
24806      if (alreadyInitializedCallback) {
24807        alreadyInitializedCallback(ret);
24808      }
24809      return ret;
24810    }
24811
24812    ret = callback();
24813    if (!ret) {
24814      ret = true;
24815    }
24816
24817    element.ss[key] = ret;
24818    return ret;
24819  };
24820
24821  SS.deleteJustOnce = function(element, key) {
24822    if (!element.ss) {
24823      return;
24824    }
24825
24826    delete element.ss[key];
24827  }
24828
24829  SS.render = function (box) {
24830    if (box == null) {
24831      box = null;
24832    }
24833    if (box) {
24834      this.renderInBox(box);
24835    } else {
24836      this.renderNotInBox();
24837    }
24838    //default
24839    box = $(document);
24840    //eternal links
24841    box.find("a[href^=http]").each(function () {
24842      return $(this).addClass("external");
24843    });
24844    this.renderAjaxBox();
24845    SS_DateTimePicker.render();
24846    this.renderFileUpload();
24847  };
24848
24849  SS.renderNotInBox = function () {
24850    return SS_Login.render();
24851  };
24852
24853  SS.renderInBox = function (box) {
24854    var anchorCallback;
24855    anchorCallback = function () {
24856      return $("#cboxLoadedContent .ajax-box:not(.cboxElement)").each(function () {
24857        var elem;
24858        elem = $(this);
24859        elem.addClass("cboxElement");
24860        if (!elem.attr("target") && !elem.data("target")) {
24861          return elem.colorbox({
24862            fixed: true,
24863            width: "90%",
24864            height: "90%",
24865            onComplete: anchorCallback
24866          });
24867        }
24868      });
24869    };
24870    return $(box).find(".ajax-box:not(.cboxElement)").each(function () {
24871      var elem;
24872      elem = $(this);
24873      if (!elem.attr("target") && !elem.data("target")) {
24874        return elem.colorbox({
24875          fixed: true,
24876          width: "90%",
24877          height: "90%",
24878          onComplete: anchorCallback
24879        });
24880      }
24881    });
24882  };
24883
24884  SS.renderClipboardCopy = function () {
24885    $(".ss-clipboard-copy").on("click", function () {
24886      var clip_attr = $(this).attr("data-clip-attr");
24887      if (clip_attr) {
24888        SS_Clipboard.copy($(this).attr(clip_attr), { "success_alert": true });
24889      } else {
24890        SS_Clipboard.copy($(this).text(), { "success_alert": true });
24891      }
24892      return false;
24893    })
24894  };
24895
24896  SS.renderLayout = function (url) {
24897    var body, head;
24898    head = $("head");
24899    body = $("body");
24900    SS.head = head.html();
24901    SS.page = $("#page").html();
24902    body.html(SS.loading);
24903    return $.ajax({
24904      type: "GET",
24905      url: SS_Kana.url(url),
24906      dataType: "json",
24907      cache: true,
24908      success: function (data) {
24909        var cache;
24910        body.append(data.body.replace("</ yield />", SS.page));
24911        $("#ss-site-name").html(SS.siteName);
24912        $("#ss-page-name").html(SS.pageName);
24913        if (data.href !== SS.href) {
24914          cache = $.ajaxSettings.cache;
24915          $.ajaxSettings.cache = true;
24916          if (SS.href) {
24917            head.children("link").remove();
24918            head.children("script").remove();
24919          }
24920          head.append(data.head);
24921          $.ajaxSettings.cache = cache;
24922        }
24923        SS.href = data.href;
24924        return SS.renderTools();
24925      },
24926      error: function (_req, _status, _error) {
24927        return body.html(SS.page);
24928      },
24929      complete: function () {
24930        $(".ss-part").each(function () {
24931          SS.renderPart($(this));
24932        });
24933      }
24934    });
24935  };
24936
24937  SS.renderPart = function ($elem) {
24938    var url = $elem.data("href") || $elem.attr("href");
24939    url = SS_Kana.url(url.replace(/\.html/, ".json"));
24940    url = SS_Translate.url(url.replace(/\.html/, ".json"), $("body").data("translate"));
24941
24942    var ref = SS_Translate.url(location.pathname, false);
24943
24944    $elem.append(" " + SS.loading);
24945    var $elemParent = $elem.parent();
24946    $.ajax({
24947      type: "GET",
24948      url: url,
24949      dataType: "json",
24950      data: "ref=" + ref,
24951      success: function (data) {
24952        $elem.replaceWith(data);
24953      },
24954      error: function (_xhr, _status, _error) {
24955        $elem.remove();
24956      },
24957      complete: function () {
24958        SS.partCountToLoad = SS.partCountToLoad - 1;
24959        // $elem は、ロードに成功した場合は replaceWith により、ロードに失敗した場合は remove() により DOM ツリーから削除されている。
24960        // DOM ツリーから削除されているので、$elem でイベントを発生させても無駄。誰もイベントを補足できない。
24961        // そこで $elem の親ノードでイベントを発生させる。
24962        $elemParent.trigger("ss:ajaxPartComplete");
24963        if (SS.partCountToLoad === 0) {
24964          SS_Recommend.render();
24965        }
24966      }
24967    });
24968  };
24969
24970  SS.ajaxForm = function (elem, selector, params) {
24971    if (typeof selector !== "string") {
24972      params = params || selector;
24973      selector = undefined;
24974    }
24975    if (!params) {
24976      params = {};
24977    }
24978    elem = $(elem);
24979    var defaults = {
24980      url: elem.attr("action") + ".json",
24981      dataType: "json",
24982      success: function () {
24983      },
24984      error: function (data, _status) {
24985        alert([ "== Error(AjaxForm) ==" ].concat(data.responseJSON).join("\n"));
24986      }
24987    };
24988    elem.on("submit", selector, function (e) {
24989      var options;
24990
24991      if ($.isFunction(params)) {
24992        options = params();
24993      } else {
24994        options = params;
24995      }
24996
24997      $(this).ajaxSubmit($.extend(true, defaults, options));
24998      e.preventDefault();
24999    });
25000  };
25001
25002  SS.ajax = function (elem, selector, params) {
25003    if (typeof selector !== "string") {
25004      params = params || selector;
25005      selector = undefined;
25006    }
25007    if (!params) {
25008      params = {};
25009    }
25010    return $(elem).on("click", selector, function (e) {
25011      var defaults, self;
25012      self = $(this);
25013      defaults = {
25014        url: self.attr("href"),
25015        beforeSend: function () {
25016          return self.html(SS.loading);
25017        },
25018        success: function () {
25019        },
25020        error: function (_data, _status) {
25021          return alert("== Error(Ajax) ==");
25022        }
25023      };
25024      $.ajax($.extend(true, defaults, params));
25025      e.preventDefault();
25026      return false;
25027    });
25028  };
25029
25030  SS.ajaxDelete = function (elem, selector, params) {
25031    if (typeof selector !== "string") {
25032      params = params || selector;
25033      selector = undefined;
25034    }
25035    if (!params) {
25036      params = {};
25037    }
25038
25039    $(elem).on("click", selector, function (e) {
25040      var defaults, self;
25041      if (!confirm(i18next.t('ss.confirm.delete'))) {
25042        return false;
25043      }
25044      self = $(this);
25045      defaults = {
25046        type: "POST",
25047        data: "_method=delete",
25048        url: self.attr("href") + ".json",
25049        dataType: "json",
25050        beforeSend: function () {
25051          self.html(SS.loading);
25052        },
25053        success: function () {
25054          if (self.data("remove")) {
25055            $(self.data("remove")).remove();
25056          }
25057        },
25058        error: function (data, _status) {
25059          alert([ "== Error(AjaxDelete) ==" ].concat(data.responseJSON).join("\n"));
25060        }
25061      };
25062      $.ajax($.extend(true, defaults, params));
25063      e.preventDefault();
25064      return false;
25065    });
25066  };
25067
25068  SS.notice = function (message, opts) {
25069    if (!opts) {
25070      opts = {};
25071    }
25072
25073    SS.clearNotice(message);
25074
25075    var notice = $('#notice');
25076    if (!notice.hasClass('js-notice')) {
25077      notice.addClass('js-notice').on("click", function () {
25078        return notice.slideUp('normal');
25079      });
25080    }
25081    notice.find('.wrap').html(message);
25082    notice.slideDown('normal');
25083    if (opts) {
25084      if (opts.timeout === 0) {
25085        return;
25086      }
25087    }
25088    SS.noticeTimeoutId = setTimeout((function () {
25089      return $('#notice').slideUp('normal');
25090    }), 1800);
25091
25092    return SS.noticeTimeoutId;
25093  };
25094
25095  SS.clearNotice = function (message) {
25096    if (SS.noticeTimeoutId) {
25097      clearTimeout(SS.noticeTimeoutId);
25098      SS.noticeTimeoutId = null;
25099    }
25100
25101    var $notice = $('#notice');
25102    $notice.hide();
25103
25104    var $wrap = $notice.find('.wrap');
25105    var save = $wrap.html();
25106    $wrap.html(message || '');
25107
25108    return save;
25109  };
25110
25111  SS.formChanged = undefined;
25112  SS.disableConfirmUnloading = false;
25113  $(window).on("beforeunload", function () {
25114    if (SS.formChanged && !SS.disableConfirmUnloading) {
25115      return i18next.t('ss.confirm.unload');
25116    }
25117  });
25118
25119  SS.confirmUnloading = function () {
25120    $("#item-form").each(function() {
25121      if (this.dataset.controller) {
25122        if (this.dataset.controller.includes("ss--confirm-unloading")) {
25123          return;
25124        } else {
25125          this.dataset.controller = this.dataset.controller + " ss--confirm-unloading";
25126        }
25127      } else {
25128        this.dataset.controller = "ss--confirm-unloading";
25129      }
25130    });
25131    SS.formChanged = undefined;
25132  };
25133
25134  SS.randomPassword = function (length) {
25135    var chars, i, j, pass, ref1;
25136    if (length == null) {
25137      length = 8;
25138    }
25139    chars = 'abcdefghijkmnopqrstuvwxyz!@#$%&-+ABCDEFGHIJKLMNOP234567890';
25140    pass = '';
25141    for (i = j = 0, ref1 = length; 0 <= ref1 ? j <= ref1 : j >= ref1; i = 0 <= ref1 ? ++j : --j) {
25142      i = Math.floor(Math.random() * chars.length);
25143      pass += chars.charAt(i);
25144    }
25145    return pass;
25146  };
25147
25148  SS.fileCheck = function () {
25149    $('#item_files').on("change", function () {
25150      var $uploaderAlertMessage = $(".js-uploader-alert-message");
25151
25152      var uploadedFile = $(this).val();
25153      if (!uploadedFile) {
25154        return;
25155      }
25156
25157      $uploaderAlertMessage.html(SS.loading);
25158      $uploaderAlertMessage.show();
25159
25160      $.ajax({
25161        type: "get",
25162        url: location.pathname,
25163        dataType: "json",
25164        data: {
25165          "do": "check",
25166          item_files: uploadedFile
25167        },
25168        success: function (data) {
25169          if (data["message"]) {
25170            $uploaderAlertMessage.html(data["message"]);
25171            $uploaderAlertMessage.show();
25172          } else {
25173            $uploaderAlertMessage.html('ok');
25174            $uploaderAlertMessage.show();
25175          }
25176        },
25177        error: function (xhr, _status) {
25178          var errors;
25179          try {
25180            errors = $.parseJSON(xhr.responseText);
25181          } catch (_error) {
25182            errors = xhr["statusText"]
25183          }
25184          var message = [ "== Error(FileCheck) ==" ].concat(errors).join("\n");
25185          $uploaderAlertMessage.html(message);
25186          $uploaderAlertMessage.show();
25187          if (SS.env !== 'test') {
25188            alert(message);
25189          }
25190        }
25191      });
25192    });
25193  };
25194
25195  // renderAjaxBox([box][, params])
25196  SS.renderAjaxBox = function () {
25197    var box = null;
25198    var params = null;
25199
25200    // parse arguments
25201    if (arguments.length > 0) {
25202      if (typeof (arguments[0]) === "object") {
25203        if (arguments[0].jquery) {
25204          box = arguments[0];
25205        } else {
25206          params = arguments[0];
25207        }
25208      } else {
25209        box = $(arguments[0]);
25210      }
25211
25212      if (!params && arguments.length > 1) {
25213        params = arguments[1];
25214      }
25215    }
25216
25217    if (!box) {
25218      box = $(document);
25219    }
25220
25221    if (!params) {
25222      params = {
25223        fixed: true,
25224        width: "90%",
25225        height: "90%",
25226        onOpen: function () {
25227          $("#cboxContent").data('on-select', null);
25228        }
25229      };
25230    }
25231
25232    box.find(".ajax-box:not(.cboxElement)").each(function () {
25233      var elem = $(this);
25234      if (elem.attr("target") || elem.data("target") || typeof elem.colorbox === 'undefined') {
25235        return;
25236      }
25237
25238      elem.colorbox(params);
25239    });
25240  };
25241
25242  // datetimepicker
25243
25244  SS.rubyToMomenFormatMap = [
25245    [ "%Y", "YYYY" ],
25246    [ "%y", "YY" ],
25247    [ "%m", "MM" ],
25248    [ "%1m", "M" ],
25249    [ "%B", "MMMM" ],
25250    [ "%b", "MMM" ],
25251    [ "%d", "DD" ],
25252    [ "%1d", "D" ],
25253    [ "%H", "HH" ],
25254    [ "%1H", "H" ],
25255    [ "%I", "hh" ],
25256    [ "%1I", "h" ],
25257    [ "%P", "a" ],
25258    [ "%p", "A" ],
25259    [ "%M", "mm" ],
25260    [ "%A", "dddd" ],
25261    [ "%a", "ddd" ],
25262  ];
25263
25264  SS.convertDateTimeFormat = function(format) {
25265    $.each(SS.rubyToMomenFormatMap, function() {
25266      var from = this[0];
25267      var to = this[1];
25268
25269      from = new RegExp(from, "g");
25270      format = format.replace(from, to);
25271    });
25272
25273    // "(" のような文字をエスケープする(moment のエスケープはエスケープしたい文字列を "[" と "]" で囲む)
25274    format = format.replaceAll(/[^A-Za-z ,/:]+/g, function(match) { return "[" + match + "]"; });
25275
25276    return format;
25277  };
25278
25279  SS.renderDateTimePicker = function (rooElement) { SS_DateTimePicker.render(rooElement) }
25280
25281  // SS.formatTime("2019-07-09T14:33:38+0900") = "2019/7/9 14:33"
25282  // SS.formatTime("2019-07-09T14:33:38+0900", "default") = "2019/7/9 14:33"
25283  //
25284  // You can pass a Date or moment instance to 1st argument
25285  //
25286  // SS.formatTime(new Date())
25287  // SS.formatTime(moment())
25288  SS.formatTime = function (time, format) {
25289    if (!time) {
25290      return time;
25291    }
25292    if ("i18next" in window) {
25293      if (!format) {
25294        format = "default"
25295      }
25296      format = i18next.t("time.formats." + format, format);
25297    } else {
25298      format = SS.DEFAULT_TIME_FORMAT;
25299    }
25300    format = SS.convertDateTimeFormat(format);
25301
25302    return moment(time).format(format);
25303  };
25304
25305  SS.formatDate = function (date, format) {
25306    if (!date) {
25307      return date;
25308    }
25309    if ("i18next" in window) {
25310      if (!format) {
25311        format = "default"
25312      }
25313      format = i18next.t("date.formats." + format, format);
25314    } else {
25315      format = SS.DEFAULT_DATE_FORMAT;
25316    }
25317    format = SS.convertDateTimeFormat(format);
25318
25319    return moment(date).format(format);
25320  };
25321
25322  SS.renderFileUpload = function () {
25323    $(".ss-file-field .btn-file-upload").each(function () {
25324      var $uploadBtn = $(this);
25325      SS.justOnce(this, "ss-file-field", function() {
25326        if ($uploadBtn.data("on-select")) {
25327          return;
25328        }
25329
25330        var $container = $uploadBtn.closest(".ss-file-field")
25331        var onSelect = function ($item) {
25332          $.colorbox.close();
25333
25334          var $data = $item.closest("[data-id]");
25335          var fileId = $data.data('id');
25336          var fileName = $data.data("humanizedName") || $data.data("name") || $data.find(".select-item").text() || $item.text() || $data.text();
25337          if (!fileId || !fileName) {
25338            return;
25339          }
25340
25341          $container.find(".humanized-name").text(fileName);
25342          $container.find(".file-id").val(fileId);
25343          $container.find(".sanitizer-status").replaceWith($data.find('.sanitizer-status'));
25344          $container.find(".btn-file-delete").removeClass("hide");
25345          $container.find(".upload-drop-notice").addClass("hide");
25346        };
25347
25348        $uploadBtn.data("on-select", onSelect);
25349
25350        $container.find(".dropdown-item").on("click", function (ev) {
25351          ev.preventDefault();
25352
25353          var $el = $(this);
25354          var href = $el.attr("href");
25355
25356          $uploadBtn.attr("href", href).text($el.text()).trigger("click");
25357
25358          var $dropdown = $el.closest(".dropdown")
25359          $dropdown.removeClass('active');
25360          $dropdown.find(".dropdown-menu").removeClass('active');
25361
25362          return false;
25363        });
25364
25365        var dropEventTriggered = false;
25366        var dropNoticeHtml = $container.find(".upload-drop-notice").html();
25367        $container.on("dragenter", function (_ev) {
25368          if (!dropEventTriggered) {
25369            $container.addClass('file-dragenter');
25370          }
25371          return false;
25372        });
25373        $container.on("dragleave", function (_ev) {
25374          $container.removeClass('file-dragenter');
25375          return false;
25376        });
25377        $container.on("dragover", function (_ev) {
25378          if (!dropEventTriggered) {
25379            $container.addClass('file-dragenter');
25380          }
25381          return false;
25382        });
25383        $container.on("drop", function (ev) {
25384          $container.removeClass('file-dragenter');
25385
25386          var files = ev.originalEvent.dataTransfer.files;
25387          if (files.length === 0) {
25388            return false;
25389          }
25390
25391          if (dropEventTriggered) {
25392            return false;
25393          }
25394          dropEventTriggered = true;
25395          $container.find(".upload-drop-notice").html(SS.loading).removeClass("hide");
25396          $container.css("cursor", "progress");
25397
25398          var token = $('meta[name="csrf-token"]').attr('content');
25399          var formData = new FormData();
25400          formData.append('authenticity_token', token);
25401          var defaultFileResizing = SS_AjaxFile.defaultFileResizing();
25402          if (defaultFileResizing) {
25403            formData.append('item[resizing]', defaultFileResizing);
25404          }
25405          for (var j = 0, len = files.length; j < len; j++) {
25406            formData.append('item[in_files][]', files[j]);
25407          }
25408
25409          var uploadUrl = $uploadBtn.attr("href");
25410          $.ajax({
25411            url: uploadUrl,
25412            type: "POST",
25413            dataType: "JSON",
25414            data: formData,
25415            processData: false,
25416            contentType: false
25417          }).then(function (data) {
25418            // success
25419            var fileData = data[0];
25420            if (!fileData) {
25421              return;
25422            }
25423
25424            $container.find(".humanized-name").text(fileData["humanized_name"]);
25425            $container.find(".file-id").val(fileData["id"] || fileData["_id"]);
25426            $container.find(".sanitizer-status").addClass("hide");
25427            $container.find(".btn-file-delete").removeClass("hide");
25428            $container.find(".upload-drop-notice").addClass("hide");
25429          }, function (xhr, _textStatus, _errorThrown) {
25430            // error
25431            if (xhr.status === 413) {
25432              alert([ "== Error(FileUpload) ==" ].concat(i18next.t('errors.messages.request_entity_too_large')).join("\n"));
25433            } else if (xhr.responseJSON && Array.isArray(xhr.responseJSON)) {
25434              alert([ "== Error(FileUpload) ==" ].concat(xhr.responseJSON).join("\n"));
25435            } else {
25436              alert([ "== Error(FileUpload) ==" ].concat(xhr.statusText).join("\n"));
25437            }
25438          }).then(function () {
25439            // complete
25440            dropEventTriggered = false;
25441            $container.find(".upload-drop-notice").html(dropNoticeHtml);
25442            $container.css("cursor", "auto");
25443          });
25444
25445          return false;
25446        });
25447      });
25448    });
25449
25450    SS.justOnce(document, "ss-file-field", function() {
25451      $(document).on("click", ".ss-file-field .btn-file-delete", function () {
25452        var $this = $(this);
25453        var $container = $this.closest(".ss-file-field")
25454        $container.find(".humanized-name").text("");
25455        $container.find(".file-id").val("");
25456        $container.find(".sanitizer-status").addClass("hide");
25457        $container.find(".btn-file-delete").addClass("hide");
25458        $container.find(".upload-drop-notice").removeClass("hide");
25459
25460        return false;
25461      });
25462    });
25463  };
25464
25465  SS.timeoutAfterSubmit = function() {
25466    $(document).on("submit", "form", function (ev) {
25467      var $form = $(ev.target);
25468      var timeout = $form.data("ss-timeout") || SS.defaultTimeoutMillis;
25469
25470      if (timeout > -1) {
25471        setTimeout(function () {
25472          $form.trigger("ss:submitTimeout");
25473        }, timeout);
25474      }
25475    });
25476  };
25477
25478  SS.enableFormElementsOnTimeoutSubmit = function() {
25479    $(document).on("ss:submitTimeout", function (ev) {
25480      var $form = $(ev.target);
25481      $.rails.enableFormElements($form);
25482    });
25483  };
25484
25485  SS.onDoubleClickGuardClick = function(ev) {
25486    var $element = $(ev.target);
25487    var timeout = $element.data("ss-timeout") || SS.defaultTimeoutMillis;
25488
25489    $.rails.disableFormElement($element);
25490    if (timeout > -1) {
25491      setTimeout(function () {
25492        $element.trigger("ss:clickTimeout");
25493      }, timeout);
25494    }
25495  };
25496
25497  SS.onClickTimeout = function(ev) {
25498    var $element = $(ev.target);
25499    $.rails.enableFormElement($element);
25500  };
25501
25502  SS.enableDoubleClickGuard = function () {
25503    SS.timeoutAfterSubmit();
25504    SS.enableFormElementsOnTimeoutSubmit();
25505
25506    $(document).on("click", ".ss-dc-guard", SS.onDoubleClickGuardClick);
25507    $(document).on("ss:clickTimeout", SS.onClickTimeout);
25508  };
25509
25510  SS.debugLog = function () {
25511    if (SS.debug) {
25512      console.log.apply(console, arguments);
25513    }
25514  };
25515
25516  return SS;
25517
25518})();
25519
25520
25521
25522
25523
25524
25525
25526
25527
25528
25529
25530
25531
25532
25533
25534
25535
25536
25537
25538
25539
25540
25541
25542
25543
25544
25545
25546
25547
25548
25549
25550
25551
25552
25553
25554
25555
25556
25557
25558
25559
25560SS.ready(function () {
25561  SS_Kana.render();
25562  SS_Translate.render();
25563  SS_Font.render();
25564  SS_AdobeReader.render();
25565  SS_Mobile.render();
25566  var $voiceTags = $('#ss-voice,[data-tool="ss-voice"]');
25567  $voiceTags.each(function (index, voiceTag) {
25568    SS.justOnce(voiceTag, "ss-voice", function() {
25569      var voiceInstance = new SS_Voice(); // Instantiate SS_Voice for each voiceTag
25570      voiceInstance.render($(voiceTag), index); // Pass the voiceTag to the render method
25571    });
25572  });
25573  SS_Theme.render();
25574  SS.renderAjaxBox();
25575  SS.partCountToLoad = $(".ss-part").length;
25576  if (SS.partCountToLoad === 0) {
25577    SS_Recommend.render();
25578  }
25579  $(".ss-part").each(function () {
25580    SS.renderPart($(this));
25581  });
25582  SS_DateTimePicker.render();
25583  SS_SearchUI.render();
25584  SS.enableDoubleClickGuard();
25585  SS_Print.render();
25586  SS_ClipboardCopy.render();
25587});
25588
25589this.SS_Kana = (function () {
25590  function SS_Kana() {
25591  }
25592
25593  SS_Kana.dir = "/kana";
25594
25595  SS_Kana.siteUrl = "/";
25596
25597  SS_Kana.kanaUrl = "/kana" + "/";
25598
25599  SS_Kana.render = function () {
25600    if (SS.config["site_url"] && SS.config["kana_url"]) {
25601      SS_Kana.siteUrl = SS.config["site_url"];
25602      SS_Kana.kanaUrl = SS.config["kana_url"];
25603    }
25604
25605    const kanaElements = document.querySelectorAll('#ss-kana, [data-tool="ss-kana"]');
25606    kanaElements.forEach((kanaElement, index) => {
25607      if (!kanaElement) return;
25608
25609      SS.justOnce(kanaElement, "ss-kana", function() {
25610        const pathname = location.pathname;
25611        let url, cssClass;
25612        if (document.body.dataset.kana) {
25613          url = SS_Kana.url(pathname, false);
25614          url = SS_Translate.url(url);
25615          cssClass = "off";
25616        } else {
25617          url = SS_Translate.url(pathname, false)
25618          url = SS_Kana.url(url, true);
25619          cssClass = "on";
25620        }
25621        if (url[0] !== '/') {
25622          // "javascript:alert('xss')" のような URL を location.href にセットしてしまうと xss とダイアログが表示されてしまう。
25623          // 先頭が "/" かどうかをチェックすることで、この種の脆弱性を防ぐ。
25624          return;
25625        }
25626
25627        // legacy:htmlにbuttonが含まれていない → a タグを生成
25628        if (kanaElement.dataset.toolType === "button") {
25629          const buttonId = 'kana_button_' + index;
25630          const content = kanaElement.innerHTML;
25631          const button = document.createElement('button');
25632          button.id = buttonId;
25633          button.className = cssClass;
25634          button.setAttribute('name', 'kana');
25635          button.setAttribute('type', 'button');
25636          button.setAttribute('aria-pressed', (cssClass === 'on') ? 'false' : 'true');
25637          button.innerHTML = content;
25638          kanaElement.innerHTML = '';
25639          kanaElement.appendChild(button);
25640
25641          button.addEventListener('click', function(ev){
25642            ev.preventDefault();
25643            const expressed = (this.getAttribute('aria-pressed') === 'true') ? 'false' : 'true';
25644            this.setAttribute('aria-pressed', expressed);
25645            location.href = url;
25646          });
25647        } else {
25648          const anchorId = 'kana_a_' + index;
25649          const content = kanaElement.innerHTML;
25650          const anchor = document.createElement('a');
25651          anchor.id = anchorId;
25652          anchor.className = cssClass;
25653          anchor.href = '#' + url;
25654          anchor.rel = 'nofollow';
25655          anchor.innerHTML = content;
25656          kanaElement.innerHTML = '';
25657          kanaElement.appendChild(anchor);
25658
25659          anchor.addEventListener("click", function (ev) {
25660            ev.preventDefault();
25661            const clickedUrl = this.getAttribute('href').substring(1); // Remove '#'
25662            location.href = clickedUrl;
25663            return false;
25664          });
25665        }
25666      });
25667    });
25668  };
25669
25670  SS_Kana.url = function (url, bool) {
25671    if (bool == null) {
25672      bool = null;
25673    }
25674    if (bool === null) {
25675      bool = $("body").data("kana");
25676    }
25677    if (bool) {
25678      url = url.replace(RegExp("^(\\/\\.s\\d+?\\/preview\\d*)?" + this.siteUrl), "$1" + this.kanaUrl);
25679    } else {
25680      url = url.replace(RegExp("^(\\/\\.s\\d+?\\/preview\\d*)?" + this.kanaUrl), "$1" + this.siteUrl);
25681    }
25682    return url;
25683  };
25684
25685  SS_Kana.loadPage = function (elem) {
25686    $.ajax({
25687      type: "GET",
25688      url: elem.attr("href"),
25689      dataType: "html",
25690      success: function (data) {
25691        let body;
25692        body = $("body");
25693        body.data("kana", elem.hasClass("on"));
25694        return body.html(data.replace(/[\s\S]*<body.*?>([\s\S]*)<\/body>[\s\S]*/, "$1"));
25695      }
25696    });
25697    return false;
25698  };
25699
25700  return SS_Kana;
25701
25702})();
25703
25704this.SS_Translate = (function () {
25705  function SS_Translate() {
25706  }
25707
25708  SS_Translate.dir = "/translate";
25709
25710  SS_Translate.siteUrl = "/";
25711
25712  SS_Translate.translateUrl = "/translate" + "/";
25713
25714  SS_Translate.url = function (url, target) {
25715    if (target) {
25716      var targetUrl = this.translateUrl + target + "/";
25717      url = url.replace(RegExp("^(\\/\\.s\\d+?\\/preview\\d*)?" + this.siteUrl), "$1" + targetUrl);
25718    } else {
25719      var targetUrl = this.translateUrl + $("body").data("translate") + "/";
25720      url = url.replace(RegExp("^(\\/\\.s\\d+?\\/preview\\d*)?" + targetUrl), "$1" + this.siteUrl);
25721    }
25722    return url;
25723  };
25724
25725  SS_Translate.render = function () {
25726    if (SS.config["site_url"] && SS.config["translate_url"]) {
25727      SS_Translate.siteUrl = SS.config["site_url"];
25728      SS_Translate.translateUrl = SS.config["translate_url"];
25729    }
25730  };
25731
25732  return SS_Translate;
25733
25734})();
25735
25736//背景色
25737this.SS_Theme = (function () {
25738  function SS_Theme() {
25739  }
25740
25741  SS_Theme.render = function () {
25742    const $themes = $('#ss-theme,[data-tool="ss-theme"]');
25743    if ($themes.length === 0) {
25744      return;
25745    }
25746
25747    $themes.each(function(index) {
25748      const $theme = $(this);
25749      SS.justOnce(this, "ss-theme", function() {
25750        $theme.attr("aria-busy", "true");
25751
25752        let cls;
25753        const theme = SS.config["theme"];
25754        let inlineStyle = '';
25755        const isButton = $theme.is('[data-tool-type="button"]');
25756        for (const cls in theme) {
25757          let $el = $theme.find("." + $.escapeSelector(cls));
25758          if (!$el.length) continue;
25759
25760          if (isButton) {
25761            $el.each(function () {
25762              const $el = $(this);
25763              // 元の要素(または子要素)に aria-label があれば取得
25764              let ariaLabel = $el.attr("aria-label");
25765              if (!ariaLabel) {
25766                const $labelEl = $el.find("[aria-label]").first();
25767                if ($labelEl.length > 0) {
25768                  ariaLabel = $labelEl.attr("aria-label");
25769                }
25770              }
25771              const $btn = $("<button>", {
25772                type: "button",
25773                name: $el.attr("class"),
25774                class: $el.attr("class"),
25775                "data-ss-theme": cls,
25776                "aria-pressed": "false"
25777              }).html($el.html());
25778              if (ariaLabel) {
25779                $btn.attr("aria-label", ariaLabel);
25780              }
25781              $el.replaceWith($btn);
25782            });
25783            $el = $theme.find("button." + $.escapeSelector(cls));
25784          } else {
25785            $el.each(function () {
25786              const $el = $(this);
25787              const $a = $("<a>", {
25788                href: "#",
25789                name: $el.attr("class"),
25790                class: $el.attr("class"),
25791                "data-ss-theme": cls,
25792                "aria-pressed": "false"
25793              }).html($el.html());
25794              $el.replaceWith($a);
25795            });
25796            $el = $theme.find("a." + $.escapeSelector(cls));
25797          }
25798          const elId = "ss-theme-" + index + "-" + cls;
25798 // Unique ID for the anchor
25799          $el.attr("id", elId); // Assign the unique ID to the anchor
25800          const v = theme[cls];
25801          if (v["css_path"]) {
25802            const $styleSheetLink = $('<link />', {
25803              rel: "alternate stylesheet",
25804              type: "text/css",
25805              title: v["name"],
25806              href: v["css_path"],
25807              class: "ss-theme " + $.escapeSelector(cls),
25808              disabled: true
25809            });
25810            $('head').append($styleSheetLink);
25811          }
25812          if (v["font_color"] && v["background_color"]) {
25813            inlineStyle += SS_Theme.cssTemplate(cls, v["font_color"], v["background_color"]) + "\n";
25814          }
25815          if (v["default_theme"]) {
25816            $theme.find("[data-ss-theme]").removeClass('active');
25817            $el.addClass('active').attr('aria-pressed', true);
25818            SS_Theme.switchTheme(cls);
25819          }
25820          $el.on("click", function () {
25821            const $this = $(this);
25822            const cls = $this.data("ss-theme");
25823            $themes.find("[data-ss-theme]").removeClass('active').attr('aria-pressed', false);
25824            $themes.find("[data-ss-theme='" + $.escapeSelector(cls) + "']").addClass('active').attr('aria-pressed', true);
25825            Cookies.set("ss-theme", cls, {
25826              expires: 7,
25827              path: '/'
25828            });
25829            SS_Theme.switchTheme(cls);
25830            return false;
25831          });
25832        }
25833
25834        if (inlineStyle) {
25835          const $inlineStyle = $("<style />", {type: "text/css", class: "ss-theme"}).text(inlineStyle);
25836          $("head").append($inlineStyle);
25837        }
25838
25839        cls = Cookies.get("ss-theme");
25840        if (!theme[cls]) {
25841          Cookies.remove("ss-theme");
25842          cls = null;
25843        }
25844        if (cls) {
25845          $theme.find('[data-ss-theme]').removeClass('active').attr('aria-pressed', false);
25846          $theme.find('[data-ss-theme="' + $.escapeSelector(cls) + '"]').addClass('active').attr('aria-pressed', true);
25847          SS_Theme.switchTheme(cls);
25848        }
25849
25850        $theme.attr("aria-busy", "false").trigger("ss:ready");
25851      });
25852    });
25853  };
25854
25855  SS_Theme.cssTemplate = function (cls, color, backgroundColor) {
25856    return "body[data-ss-theme=\"" + $.escapeSelector(cls) + "\"] * {\n  border-color: " + color + " !important;\n  background-color: " + backgroundColor + " !important;\n  color: " + color + " !important;\n}";
25857  };
25858
25859  SS_Theme.switchTheme = function (cls) {
25860    $('head link.ss-theme').prop("disabled", true);
25861    $('head link.ss-theme.' + $.escapeSelector(cls)).prop("disabled", false);
25862    $("body").attr("data-ss-theme", cls);
25863  };
25864
25865  return SS_Theme;
25866
25867})();
25868
25869this.SS_AdobeReader = (function () {
25870  function SS_AdobeReader() {
25871  }
25872
25873  SS_AdobeReader.render = function () {
25874    if ($("a[href$='.pdf']").length) {
25875      return $("#ss-adobe-reader, .ss-adobe-reader").each(function () {
25876        return $(this).html("\u003cdiv\u003ePDFファイルをご覧いただくためには、Adobe Readerのプラグイン(無償)が必要となります。お持ちでない場合は、お使いの機種とスペックに合わせたプラグインをインストールしてください。\u003c/div\u003e\u003ca href=\"https://get.adobe.com/jp/reader/\"\u003eAdobe Readerをダウンロードする\u003c/a\u003e").show();
25877      });
25878    }
25879  };
25880
25881  return SS_AdobeReader;
25882
25883})();
25884
25885this.SS_Tabs = (function () {
25886  function SS_Tabs() {
25887  }
25888
25889  SS_Tabs.render = function (box) {
25890    var $box = $(box);
25891    var anchors = [];
25892    $box.find(".tab").each(function (index) {
25893      var $tab = $(this);
25894      var name = $tab.find('> header h2').text();
25895      var $nav = $tab.find('nav');
25896      var url = $nav.find(".more").attr("href");
25897      var altClass = $tab.attr('data-class');
25898      var baseId = $tab.attr("id");
25899      var nameId = baseId + "-name";
25900      var viewId = baseId + "-view";
25901      if (!url) {
25902        url = "#" + viewId;
25903      }
25904      var tabCls = index === 0 ? "name current" : "name";
25905      if (altClass) {
25906        tabCls = tabCls + " " + altClass;
25907      }
25908
25909      var $anchor = $("<a />", { id: nameId, class: tabCls, href: url }).text(name);
25910      $anchor.on("click", function() {
25911        return SS_Tabs.select(box, "#" + nameId, "#" + viewId);
25912      });
25913      anchors.push($anchor);
25914
25915      var bodyCls = 'view';
25916      if (altClass) {
25917        bodyCls = bodyCls + " " + altClass;
25918      }
25919
25920      var $html = $("<article />", { id: viewId, class: bodyCls });
25921      if (index !== 0) {
25922        $html.css("display", "none")
25923      }
25924      $html.append($("<h2 />", { style: "display: none;" }).text(name));
25925      $html.append($("<div />", { class: "pages" }).html($tab.find(".pages").html()));
25926      if ($tab.find('nav').length) {
25927        $html.append($("<nav />").html($tab.find('nav').html()));
25928      }
25929      $box.append($html);
25930      $tab.remove();
25931    });
25932
25933    $box.prepend($("<nav />", { class: 'names' }).html(anchors));
25934  };
25935
25936  SS_Tabs.select = function (box, name, view) {
25937    $(box).find(".name").each(function () {
25938      return $(this).removeClass("current");
25939    });
25940    $(box).find(".view").each(function () {
25941      return $(this).hide();
25942    });
25943    $(name).addClass("current");
25944    $(view).show();
25945    return false;
25946  };
25947
25948  return SS_Tabs;
25949
25950})();
25951function SS_Voice() {
25952  this.voiceConfig = {
25953    'location': "/.voice",
25954    'loading-resource': "/assets/voice/voice-loading.mp3",
25955    'disabled-resource': "/assets/voice/voice-disabled.mp3",
25956    'overload-resource': "/assets/voice/voice-overload.mp3"
25957  };
25958
25959  this.url = null;
25960
25961  this.$voiceTag = null;
25962
25963  this.voiceController = null;
25964
25965  this.state = null;
25966
25967  this.cancelLoading = null;
25968
25969  this.timerId = null;
25970}
25971
25972SS_Voice.prototype.render = function ($voiceTag, index_1)  {
25973  const self = this;
25974  const index = index_1;
25975  self.url = self.requestUrl();
25976
25977  if ($voiceTag.is('[data-tool-type="button"]')) {
25978    const button = $('<button/>', {
25979      type: "button",
25980      name: "voice",
25981      "aria-expanded": "false",
25982      "aria-haspopup": "dialog"
25983    }).html($voiceTag.html());
25984    $voiceTag.html('');
25985    button.appendTo($voiceTag);
25986    self.$voiceTag = button;
25987  } else {
25988    const anchor = $('<a rel="nofollow"/>').attr('href', "#/voice/").html($voiceTag.html());
25989    $voiceTag.html('');
25990    anchor.appendTo($voiceTag);
25991    self.$voiceTag = anchor;
25992  }
25993
25994  const controllerId = 'ss-voice-controller-' + index;
25995  const voice_controller = $('<div id="' + controllerId + '" class="ss-voice-controller" style="display: none;"/>');
25996  self.$voiceTag.attr("aria-controls", controllerId);
25997  self.$voiceTag.after(voice_controller);
25998  self.voiceController = new SS_VoiceController(voice_controller[0], index);
25999  self.state = null;
26000  self.cancelLoading = false;
26001  self.timerId = null;
26002  self.init();
26003  voice_controller.find('.ss-jp-close').on('click', self.cancel.bind(self));
26004};
26005
26006SS_Voice.prototype.init = function () {
26007  this.state = 'init';
26008  this.voiceController.stop();
26009  this.setAction(this.load.bind(this));
26010  this.cancelLoading = false;
26011  return false;
26012};
26013
26014SS_Voice.prototype.setAction = function (action) {
26015  this.$voiceTag.off('click');
26016  this.$voiceTag.on('click', action);
26017};
26018
26019SS_Voice.prototype.load = function (ev) {
26020  const self = this;
26021  this.$voiceTag.attr("aria-expanded", "true");
26022  if (this.cancelLoading) {
26023    if (ev) {
26024      ev.preventDefault();
26025    }
26026    return false;
26027  }
26028
26029  $.ajax({
26030    type: 'HEAD',
26031    url: this.url,
26032    cache: false,
26033    statusCode: {
26034      200: function () {
26035        return self.playAudio();
26036      },
26037      202: function (data, status, xhr) {
26038        let retry_after;
26039        self.renderLoading();
26040        retry_after = xhr.getResponseHeader('Retry-After');
26041        if (!retry_after) {
26042          retry_after = 5;
26043        }
26044        return self.timerId = setTimeout(self.load.bind(self), retry_after * 1000);
26045      }
26046    },
26047    error: function (xhr, status, error) {
26048      return self.renderError(xhr.status);
26049    }
26050  });
26051
26052  if (ev) {
26053    ev.preventDefault();
26054  }
26055  return false;
26056};
26057
26058SS_Voice.prototype.renderLoading = function () {
26059  let url;
26060  if (this.state === 'loading') {
26061    return false;
26062  }
26063  url = this.voiceConfig['loading-resource'];
26064  this.state = 'loading';
26065  this.setAction(this.cancel.bind(this));
26066  this.voiceController.play(url);
26067  return false;
26068};
26069
26070SS_Voice.prototype.renderError = function (status) {
26071  let url;
26072  if (this.state === 'error') {
26073    return false;
26074  }
26075  if (this.timerId >= 0) {
26076    clearTimeout(this.timerId);
26077  }
26078  this.timerId = -1;
26079  if (status === 429) {
26080    url = this.voiceConfig['overload-resource'];
26081  } else {
26082    url = this.voiceConfig['disabled-resource'];
26083  }
26084  this.state = 'error';
26085  this.setAction(this.cancel.bind(this));
26086  this.voiceController.play(url);
26087  return false;
26088};
26089
26090SS_Voice.prototype.cancel = function (ev) {
26091  this.cancelLoading = true;
26092  if (this.timerId !== null) {
26093    clearTimeout(this.timerId);
26094  }
26095  this.timerId = null;
26096  this.init();
26097  this.$voiceTag.attr("aria-expanded", "false");
26098  if (ev) {
26099    ev.preventDefault();
26100  }
26101  return false;
26102};
26103
26104SS_Voice.prototype.playAudio = function () {
26105  this.state = 'playing';
26106  this.voiceController.play(this.url);
26107  this.setAction(this.cancel.bind(this));
26108  return false;
26109};
26110
26111SS_Voice.prototype.requestUrl = function () {
26112  let path, url;
26113  path = this.trimKanaDir(location.pathname);
26114  if (path === "/") {
26115    path = "/index.html";
26116  }
26117  url = encodeURIComponent(this.normalizeProtocol(location.protocol) + '://' + location.host + path);
26118  url = this.normalizeLocation(this.voiceConfig['location']) + '/' + url;
26119  return url;
26120};
26121
26122SS_Voice.prototype.trimKanaDir = function (path, kana_dir) {
26123  if (kana_dir == null) {
26124    kana_dir = SS_Kana.dir;
26125  }
26126  return path.replace(new RegExp('^' + kana_dir.replace('/', '\/') + '\/'), '/');
26127};
26128
26129SS_Voice.prototype.normalizeProtocol = function (protocol) {
26130  return protocol.replace(new RegExp(':$'), '');
26131};
26132
26133SS_Voice.prototype.normalizeLocation = function (location) {
26134  return location.replace(new RegExp('/$'), '');
26135};
26136
26137
26138this.SS_VoiceController = (function () {
26139  function SS_VoiceController(container, index) {
26140    this.status = 'stopped';
26141    this.index = index || 0;
26142    this.container = $(container);
26143    this.initialized = false;
26144    this.container.html(this.template());
26145    this.player = this.container.children('.jp-jplayer');
26146    this.controller = this.container.children('.jp-audio');
26147  }
26148
26149  SS_VoiceController.prototype.play = function (source) {
26150    this.stop();
26151    this.status = 'playing';
26152    this.container.show();
26153    if (this.initialized) {
26154      this.player.jPlayer("setMedia", {
26155        title: document.title,
26156        mp3: source
26157      });
26158      return this.player.jPlayer("play");
26159    } else {
26160      return this.player.jPlayer({
26161        ready: (function (_this) {
26162          return function () {
26163            _this.player.jPlayer("setMedia", {
26164              title: document.title,
26165              mp3: source
26166            });
26167            if (_this.status === 'playing') {
26168              _this.player.jPlayer("play");
26169            }
26170            return _this.initialized = true;
26171          };
26172        })(this),
26173        autoBlur: false,
26174        cssSelectorAncestor: "#" + this.controller[0].id,
26175        keyEnabled: false,
26176        loop: true,
26177        remainingDuration: true,
26178        smoothPlayBar: true,
26179        supplied: "mp3",
26180        swfPath: "/assets/js/jplayer",
26181        toggleDuration: true,
26182        useStateClassSkin: true
26183      });
26184    }
26185  };
26186
26187  SS_VoiceController.prototype.stop = function () {
26188    if (!this.initialized) {
26189      return;
26190    }
26191    if (this.status === 'stopped') {
26192      return;
26193    }
26194    this.player.jPlayer("stop");
26195    this.container.hide();
26196    return this.status = 'stopped';
26197  };
26198
26199  SS_VoiceController.prototype.template = function () {
26200    let template = "<div id=\"jquery_jplayer_:TIMESTAMP:\" class=\"jp-jplayer\"></div>\n" +
26201      "<div id=\"jp_container_:TIMESTAMP:\" class=\"jp-audio\" role=\"application\" aria-label=\"media player\">\n" +
26202      "  <div class=\"jp-type-single\">\n" +
26203      "    <div class=\"jp-gui jp-interface\">\n" +
26204      "      <div class=\"jp-controls\">\n" +
26205      "        <button class=\"jp-play\" role=\"button\" tabindex=\"0\">play</button>\n" +
26206      "        <button class=\"jp-stop\" role=\"button\" tabindex=\"0\">stop</button>\n" +
26207      "      </div>\n" +
26208      "      <div class=\"jp-progress\">\n" +
26209      "        <div class=\"jp-seek-bar\">\n" +
26210      "          <div class=\"jp-play-bar\"></div>\n" +
26211      "        </div>\n" +
26212      "      </div>\n" +
26213      "      <div class=\"jp-volume-controls\">\n" +
26214      "        <button class=\"jp-mute\" role=\"button\" tabindex=\"0\">mute</button>\n" +
26215      "        <button class=\"jp-volume-max\" role=\"button\" tabindex=\"0\">max volume</button>\n" +
26216      "        <div class=\"jp-volume-bar\">\n" +
26217      "          <div class=\"jp-volume-bar-value\"></div>\n" +
26218      "        </div>\n" +
26219      "      </div>\n" +
26220      "      <div class=\"jp-time-holder\">\n" +
26221      "        <div class=\"jp-current-time\" role=\"timer\" aria-label=\"time\">&nbsp;</div>\n" +
26222      "        <div class=\"jp-toggles\">\n" +
26223      "          <button class=\"jp-repeat\" role=\"button\" tabindex=\"0\">repeat</button>\n" +
26224      "        </div>\n" +
26225      "      </div>\n" +
26226      "      <div class=\"ss-jp-dismiss\">\n" +
26227      "        <button class=\"ss-jp-close\" role=\"button\" tabindex=\"0\">&times;</button>\n" +
26228      "      </div>\n" +
26229      "    </div>\n" +
26230      "  </div>\n" +
26231      "</div>";
26232    const timestamp = (new Date).getTime() + "_" + this.index;
26233
26234    template = template.replace(new RegExp(":TIMESTAMP:", 'g'), timestamp);
26235    return template;
26236  };
26237
26238  return SS_VoiceController;
26239
26240})();
26241
26242this.SS_Recommend = (function () {
26243  function SS_Recommend() {
26244  }
26245
26246  SS_Recommend.render = function () {
26247    var params, receiver_url, recommend;
26248    recommend = SS.config["recommend"];
26249    if (!recommend) {
26250      return;
26251    }
26252    receiver_url = recommend["receiver_url"];
26253    params = recommend["params"];
26254    if (!(receiver_url && params)) {
26255      return;
26256    }
26257    params["access_url"] = location.href;
26258    return $.ajax({
26259      type: 'GET',
26260      url: receiver_url,
26261      cache: false,
26262      dataType: 'json',
26263      data: params,
26264      error: function (req, status, error) {
26265      }
26266    });
26267  };
26268
26269  return SS_Recommend;
26270
26271})();
26272
26273this.SS_Print = (function () {
26274  function SS_Print() {
26275  }
26276
26277  SS_Print.render = function () {
26278    if (! window.print) {
26279      $(".btn-ss-print").addClass("unsupported");
26280    }
26281
26282    $(document).on("click", ".btn-ss-print", function() {
26283      try {
26284        window.print();
26285        return false;
26286      } catch (ex) {
26287        console.info("print is unsupported")
26288      }
26289    })
26290  };
26291
26292  return SS_Print;
26293
26294})();
26295
26296this.SS_ClipboardCopy = (function () {
26297  function SS_ClipboardCopy() {
26298  }
26299
26300  var getText = function(ev) {
26301    var target = ev.target.dataset.target;
26302    if (!target) {
26303      return;
26304    }
26305
26306    var text;
26307    if (target === "css_selector") {
26308      var selector = ev.target.dataset.selector;
26309      if (!selector) {
26310        selector = "title"
26311      }
26312
26313      var el = document.querySelector(selector);
26314      if (el) {
26315        text = el.text;
26316      }
26317    } else {
26318      // url
26319      text = location.href
26320    }
26321
26322    return text;
26323  };
26324
26325  SS_ClipboardCopy.render = function () {
26326    if (! navigator.clipboard) {
26327      $(".btn-ss-clipboard-copy").addClass("unsupported");
26328    }
26329
26330    $(document).on("click", ".btn-ss-clipboard-copy", function(ev) {
26331      try {
26332        var text = getText(ev);
26333        navigator.clipboard.writeText(text || '').then(function() {
26334          $(".btn-ss-clipboard-copy.copied").removeClass("copied");
26335          ev.target.classList.add("copied");
26336        });
26337        return false;
26338      } catch (_ex) {
26339        console.info("copy to clipboard is unsupported");
26340      }
26341    });
26342
26343    $(document).on("copy cut", function() {
26344      $(".btn-ss-clipboard-copy.copied").removeClass("copied");
26345    });
26346  };
26347
26348  return SS_ClipboardCopy;
26349
26350})();
26351this.SS_Font = (function () {
26352  function SS_Font() {
26353  }
26354
26355  SS_Font.size = null; //%
26356
26357  SS_Font.render = function () {
26358    this.size = parseInt(Cookies.get("ss-font")) || 100;
26359    if (this.size !== 100) {
26360      this.set(this.size);
26361    } else {
26362      $('[data-tool="ss-medium"]').attr("aria-pressed", "true");
26363    }
26364
26365    $('#ss-medium,[data-tool="ss-medium"]').each(function() {
26366      const $this = $(this);
26367      SS.justOnce(this, "ss-font", function() {
26368        SS_Font.embed($this, function () { return SS_Font.set(100); });
26369      });
26370    });
26371
26372    $('#ss-small,[data-tool="ss-small"]').each(function() {
26373      const $this = $(this);
26374      SS.justOnce(this, "ss-font", function() {
26375        SS_Font.embed($this, function () { return SS_Font.set(false); });
26376      });
26377    });
26378
26379    $('#ss-large,[data-tool="ss-large"]').each(function() {
26380      const $this = $(this);
26381      SS.justOnce(this, "ss-font", function() {
26382        SS_Font.embed($this, function () { return SS_Font.set(true); });
26383      });
26384    });
26385  };
26386
26387  SS_Font.embed = function($elements, callback) {
26388    $elements.each(function() {
26389      const $el = $(this);
26390      if ($el.is('[data-tool-type="button"]')) {
26391        SS.justOnce(this, "font", function() {
26392          const $btn = $("<button/>", {
26393            type: "button",
26394            name: $el.attr("data-tool"),
26395            "data-tool": $el.attr("data-tool")
26396          });
26397          // 「標準」のみ aria-pressed 属性を付与 https://github.com/shirasagi/shirasagi/pull/5572
26398          if ($el.attr("data-tool") === "ss-medium") {
26399            $btn.attr("aria-pressed", (SS_Font.size === 100 ? "true" : "false"));
26400          }
26401          $btn.on("click", callback);
26402          $btn.html($el.html());
26403
26404          $el.replaceWith($btn);
26405        });
26406      } else {
26407        SS.justOnce(this, "font", function() {
26408          const $anchor = $("<a/>", {href: "#"});
26409          $anchor.on("click", callback);
26410          $anchor.html($el.html());
26411
26412          $el.replaceWith($anchor);
26413        });
26414      }
26415    });
26416  }
26417
26418  SS_Font.set = function (size) {
26419    if (size === true) {
26420      size = this.size + 20;
26421      if (size > 200) {
26422        return false;
26423      }
26424    } else if (size === false) {
26425      size = this.size - 20;
26426      if (size < 60) {
26427        return false;
26428      }
26429    }
26430    this.size = size;
26431    $("body").css("font-size", size + "%");
26432    Cookies.set("ss-font", size, {
26433      expires: 7,
26434      path: '/'
26435    });
26436
26437    $('[data-tool="ss-medium"]').each(function() {
26438      const $btn = $(this);
26439      if (size === 100) {
26440        $btn.attr('aria-pressed', 'true');
26441      } else {
26442        $btn.attr('aria-pressed', 'false');
26443      }
26444    });
26445    return false;
26446  };
26447
26448  return SS_Font;
26449
26450})();
26451
26452// ---
26453// generated by coffee-script 1.9.2;
26454// ref: http://minghai.github.io/library/coffeescript/03_classes.html
26455
26456  var moduleKeywords,
26457  indexOf = [].indexOf || function (item) {
26458    for (var i = 0, l = this.length; i < l; i++) {
26459      if (i in this && this[i] === item) return i;
26460    }
26461    return -1;
26462  };
26463
26464moduleKeywords = ['extended', 'included'];
26465
26466this.SS_Module = (function () {
26467  function SS_Module() {
26468  }
26469
26470  SS_Module.extend = function (obj) {
26471    var key, ref, value;
26472    for (key in obj) {
26473      value = obj[key];
26474      if (indexOf.call(moduleKeywords, key) < 0) {
26475        this[key] = value;
26476      }
26477    }
26478    if ((ref = obj.extended) != null) {
26479      ref.apply(this);
26480    }
26481    return this;
26482  };
26483
26484  SS_Module.include = function (obj) {
26485    var key, ref, value;
26486    for (key in obj) {
26487      value = obj[key];
26488      if (indexOf.call(moduleKeywords, key) < 0) {
26489        this.prototype[key] = value;
26490      }
26491    }
26492    if ((ref = obj.included) != null) {
26493      ref.apply(this);
26494    }
26495    return this;
26496  };
26497
26498  return SS_Module;
26499
26500})();
26501
26502this.SS_Mobile = (function () {
26503  function SS_Mobile() {
26504  }
26505
26506  SS_Mobile.render = function () {
26507    var head, vr;
26508    if (navigator.userAgent.match(/(Android|iPad|iPhone)/)) {
26509      if (Cookies.get("ss-mobile") === "pc") {
26510        head = $("head");
26511        head.children("meta[name=viewport]").remove();
26512        head.append('<meta name="viewport" content="width=1024" />');
26513        vr = $("#ss-mb");
26514        return vr.html('<a href="#" onclick="return SS_Mobile.unset()">' + vr.text() + '</a>').show();
26515      } else {
26516        vr = $("#ss-pc");
26517        return vr.html('<a href="#" onclick="return SS_Mobile.setPc()">' + vr.text() + '</a>').show();
26518      }
26519    }
26520  };
26521
26522  SS_Mobile.unset = function () {
26523    Cookies.remove("ss-mobile", {
26524      path: '/'
26525    });
26526    location.reload();
26527    return false;
26528  };
26529
26530  SS_Mobile.setPc = function () {
26531    Cookies.set("ss-mobile", "pc", {
26532      expires: 7,
26533      path: '/'
26534    });
26535    location.reload();
26536    return false;
26537  };
26538
26539  return SS_Mobile;
26540
26541})();
26542
26543this.SS_Clipboard = (function () {
26544  function SS_Clipboard() {
26545  }
26546
26547  SS_Clipboard.successAlertMessage = 'コピーしました。';
26548
26549  SS_Clipboard.failedAlertMessage = 'コピーできませんでした。クリップボードがサポートされていません。';
26550
26551  SS_Clipboard.copyButtonLabel = 'コピー';
26552
26553  SS_Clipboard.copy = function (text, opts) {
26554    var copy, e, message, style, $body;
26555
26556    if (opts == null) {
26557      opts = {};
26558    }
26559    if (document.queryCommandSupported('copy')) {
26560      try {
26561        style = 'position: absolute; overflow: hidden; width: 0; height: 0;';
26562        style += 'border: none; box-shadow: none; background: transparent; resize: none;';
26563        copy = $("<textarea style='" + style + "'>" + text + "</textarea>");
26564        $body = ($("#ajax-box").length > 0) ? $("#ajax-box") : $('body');
26565        $body.after(copy);
26566        copy.select();
26567        document.execCommand('copy');
26568        copy.remove();
26569        if (opts["success_alert"]) {
26570          message = SS_Clipboard.successAlertMessage;
26571          if ("i18next" in window) {
26572            message = i18next.t("ss.notice.clipboard_copied");
26573          }
26574          alert(message);
26575        }
26576        return true;
26577      } catch (_error) {
26578        e = _error;
26579        console.warn(e);
26580        message = SS_Clipboard.failedAlertMessage;
26581        if ("i18next" in window) {
26582          message = i18next.t("ss.notice.clipboard_copy_failed");
26583        }
26584        alert(message);
26585        return false;
26586      }
26587    }
26588  };
26589
26590  SS_Clipboard.renderCopy = function () {
26591    $('.js-clipboard-copy').each(function () {
26592      var label, text;
26593      text = $(this).text();
26594      if (!text) {
26595        return true;
26596      }
26597      label = SS_Clipboard.copyButtonLabel;
26598      if ("i18next" in window) {
26599        label = i18next.t("ss.buttons.copy");
26600      }
26601      return $(this).append("<a href='#' class='clipboard-copy-button' data-text='" + text + "'>" + label + "</a>");
26602    });
26603    return $('.clipboard-copy-button').on("click", function () {
26604      $('.clipboard-copy-button').removeClass('copied');
26605      if (SS_Clipboard.copy($(this).data('text'))) {
26606        $(this).addClass('copied');
26607      }
26608      return false;
26609    });
26610  };
26611
26612  return SS_Clipboard;
26613
26614})();
26615
26616function SS_FileView(el, options) {
26617  this.$el = $(el);
26618  this.options = options;
26619
26620  this.$canvasContainer = this.$el.find(".canvas-container");
26621  this.$canvasContainer.html(SS.loading);
26622
26623  this.canvas = document.createElement("canvas");
26624  this.ctx = this.canvas.getContext("2d");
26625
26626  this.scale = 1;
26627  this.$slider = this.$el.find("#zoom-slider");
26628  this.$slider.prop({ value: this.scale * 100, min: SS_FileView.MIN_SCALE * 100, max: SS_FileView.MAX_SCALE * 100, step: "any" });
26629  this.$slider.on("input", this.zooming.bind(this)).on("change", this.zoomChanged.bind(this));
26630
26631  this.dragInfo = {
26632    isDragging: false,
26633    start: { x: 0, y: 0 },
26634    diff: { x: 0, y: 0 },
26635    canvas: { x: 0, y: 0 }
26636  };
26637
26638  var self = this;
26639
26640  // ダイアログが完全に開かないと、キャンバスサイズを計算できないので、完全に開くまで待つ
26641  var d1 = $.Deferred();
26642  this.$el.one("ss:cboxCompleted", function() { d1.resolve(); });
26643  // // 3 秒以内にダイアログが開かなければ失敗。
26644  // setTimeout(function() { d1.rejectWith(self, [ "failed to open dialog" ]); }, 3000);
26645  // 3 秒以内にダイアログが開かなければダイアログが開いたとみなす。
26646  setTimeout(function() { d1.resolve(); }, 3000);
26647
26648  // 仕様で画像は非同期で読み込まれるので、画像読み込み完了まで待つ
26649  var d2 = $.Deferred();
26650  this.image = new Image();
26651  this.image.src = this.options.itemUrl;
26652  this.image.onload = function() { d2.resolve(); };
26653  this.image.onerror = function() { d2.rejectWith(self, [ "failed to load image" ]); };
26654
26655  // ダイアログが完全に開いて、かつ、画像の読み込みが完了したら、残りの初期化が可能となる。
26656  $.when(d1.promise(), d2.promise())
26657    .done(this.initializationComplete.bind(this))
26658    .fail(function(msg) { self.$canvasContainer.html(msg); });
26659
26660  SS_Color.render();
26661}
26662
26663SS_FileView.HEX_DECIMAL = "0123456789abcdef";
26664SS_FileView.CANVAS_SAFE_MARGIN = 10;
26665SS_FileView.MIN_SCALE = 0.1;
26666SS_FileView.MAX_SCALE = 2;
26667SS_FileView.SCALE_STEPS = [ 0.1, 0.25, 0.5, 0.75, 1, 1.25, 1.5, 1.75, 2.0 ];
26668
26669SS_FileView.listenTo = function(el, options) {
26670  $(el).on("click", function(ev) {
26671    SS_FileView.open(ev, options);
26672  });
26673};
26674
26675SS_FileView.renderFileView = function($el, options) {
26676  $el.on("click", ".file-view a.thumb", function(ev) {
26677    SS_FileView.open(ev, options);
26678  });
26679  $el.on("click", ".file-view .action-attach", function(ev) {
26680    // 添付貼付
26681    SS_FileView.pasteFile(ev, options);
26682  });
26683  $el.on("click", ".file-view .action-paste", function(ev) {
26684    // 画像貼付
26685    SS_FileView.pasteImage(ev, options);
26686  });
26687  $el.on("click", ".file-view .action-thumb", function(ev) {
26688    // サムネイル貼付
26689    SS_FileView.pasteThumbnail(ev, options);
26690  });
26691  $el.on("click", ".file-view .action-delete", function(ev) {
26692    // 削除
26693    SS_FileView.deleteFile(ev, options);
26694  });
26695};
26696
26697SS_FileView.open = function(ev, options) {
26698  var $this = $(ev.currentTarget);
26699  if ($this.find("img").length === 0) {
26700    return true;
26701  }
26702
26703  var path = $this.attr("href");
26704  if (path.startsWith("/fs/")) {
26705    if (options && options.viewPath) {
26706      var $fileView = $this.closest(".file-view");
26707      if ($fileView.length > 0) {
26708        var fileId = $fileView.data("file-id");
26709        if (fileId) {
26710          path = options.viewPath.replace(":id", fileId);
26711        }
26712      }
26713    }
26714  }
26715  if (path.startsWith("/fs/")) {
26716    return true;
26717  }
26718
26719  $.colorbox({
26720    href: path,
26721    width: "90%",
26722    height: "90%",
26723    fixed: true,
26724    open: true,
26725    onComplete: function() { $("#ss-file-view").trigger("ss:cboxCompleted"); }
26726  });
26727
26728  ev.preventDefault();
26729  return false;
26730};
26731
26732SS_FileView.getContent = function() {
26733  var editor = null;
26734
26735  if ((typeof tinymce) != "undefined") {
26736    editor = tinymce.get(Cms_Form.editorId);
26737    if (editor) {
26738      return editor.getContent();
26739    }
26740  } else if ((typeof CKEDITOR) != "undefined") {
26741    if (Cms_Form.editorId) {
26742      editor = CKEDITOR.instances[Cms_Form.editorId];
26743      if (editor) {
26744        return editor.getData();
26745      }
26746    }
26747  }
26748
26749  return null;
26750}
26751
26752SS_FileView.insertContent = function(content) {
26753  if ((typeof tinymce) != "undefined") {
26754    tinymce.get(Cms_Form.editorId).execCommand("mceInsertContent", false, content);
26755  } else if (typeof CKEDITOR != "undefined") {
26756    CKEDITOR.instances[Cms_Form.editorId].insertHtml(content);
26757  }
26758};
26759
26760SS_FileView.pasteFile = function(ev, options) {
26761  var $fileView = $(ev.currentTarget).closest(".file-view");
26762  if (!$fileView[0]) {
26763    return;
26764  }
26765
26766  // link_to file.humanized_name, file.url, class: "icon-#{file.extname}"
26767  var $content = $("<a/>", { href: $fileView.data("url"), class: "icon-" + $fileView.data("extname") })
26768    .html($fileView.data("humanizedName"));
26769
26770  var insertContent;
26771  if (options && options.insertContent) {
26772    insertContent = options.insertContent;
26773  } else {
26774    insertContent = SS_FileView.insertContent;
26775  }
26776
26777  insertContent($content.prop("outerHTML"));
26778
26779  ev.preventDefault();
26780  return false;
26781};
26782
26783SS_FileView.pasteImage = function(ev, options) {
26784  var $fileView = $(ev.currentTarget).closest(".file-view");
26785  if (!$fileView[0]) {
26786    return;
26787  }
26788
26789  // image_tag file.url, alt: file.name
26790  var $content = $("<img/>", { src: $fileView.data("url"), alt: $fileView.data("name") });
26791
26792  var insertContent;
26793  if (options && options.insertContent) {
26794    insertContent = options.insertContent;
26795  } else {
26796    insertContent = SS_FileView.insertContent;
26797  }
26798
26799  insertContent($content.prop("outerHTML"));
26800
26801  ev.preventDefault();
26802  return false;
26803};
26804
26805SS_FileView.pasteThumbnail = function(ev, options) {
26806  var $fileView = $(ev.currentTarget).closest(".file-view");
26807  if (!$fileView[0]) {
26808    return;
26809  }
26810
26811  // link_to(file.url, alt: file.name, class: "ajax-box") { image_tag(file.thumb_url, alt: file.name) }
26812  var $img = $("<img/>", { src: $fileView.data("thumbUrl"), alt: $fileView.data("name") });
26813  var $content = $("<a/>", { href: $fileView.data("url"), alt: $fileView.data("name"), class: "ajax-box" }).html($img);
26814
26815  var insertContent;
26816  if (options && options.insertContent) {
26817    insertContent = options.insertContent;
26818  } else {
26819    insertContent = SS_FileView.insertContent;
26820  }
26821
26822  insertContent($content.prop("outerHTML"));
26823
26824  ev.preventDefault();
26825  return false;
26826};
26827
26828SS_FileView.deleteFile = function(ev, options) {
26829  var $fileView = $(ev.currentTarget).closest(".file-view");
26830  if (!$fileView[0]) {
26831    return;
26832  }
26833
26834  var path = $fileView.data("url").replace(/\/[^/]*$/, "/");
26835
26836  var getContent;
26837  if (options && options.getContent) {
26838    getContent = options.getContent;
26839  } else {
26840    getContent = SS_FileView.getContent
26841  }
26842
26843  var data = getContent();
26844  var inUse = false;
26845  if (data && data.indexOf(path) > 0) {
26846    inUse = true;
26847  }
26848  var messge;
26849  if (inUse && options && options.inUseConfirmation) {
26850    messge = options.inUseConfirmation;
26851  } else if (options && options.confirmationOnDelete) {
26852    messge = options.confirmationOnDelete;
26853  }
26854  if (messge) {
26855    if (!confirm(messge)) {
26856      ev.preventDefault();
26857      return false;
26858    }
26859  }
26860
26861  $fileView.remove();
26862
26863  ev.preventDefault();
26864  return false;
26865};
26866
26867SS_FileView.toHex = function(n) {
26868  if (isNaN(n)) {
26869    return "00";
26870  }
26871
26872  n = Math.max(0, Math.min(n, 255));
26873  return SS_FileView.HEX_DECIMAL.charAt((n - n % 16) / 16) + SS_FileView.HEX_DECIMAL.charAt(n % 16);
26874};
26875
26876SS_FileView.calcPositionAndScale = function(image, canvas) {
26877  var position = 0;
26878  var scale = 1;
26879
26880  if (image > canvas) {
26881    position = 0;
26882    scale = canvas / image;
26883    if (scale < SS_FileView.MIN_SCALE) {
26884      scale = SS_FileView.MIN_SCALE;
26885    }
26886  } else {
26887    position = (canvas - image) / 2;
26888    scale = 1;
26889  }
26890
26891  return { position: position, scale: scale };
26892};
26893
26894SS_FileView.findScaleStepIndex = function(scale) {
26895  var found = -1;
26896  if (scale < SS_FileView.SCALE_STEPS[0]) {
26897    found = 0;
26898  } else if (scale > SS_FileView.SCALE_STEPS[SS_FileView.SCALE_STEPS.length - 1]) {
26899    found = SS_FileView.SCALE_STEPS.length - 1;
26900  } else {
26901    for (var i = 0; i < SS_FileView.SCALE_STEPS.length - 1; i += 1) {
26902      if (SS_FileView.SCALE_STEPS[i] <= scale && scale < SS_FileView.SCALE_STEPS[i + 1]) {
26903        found = i;
26904        break;
26905      }
26906      if (found === -1) {
26907        found = SS_FileView.SCALE_STEPS.length - 1;
26908      }
26909    }
26910  }
26911
26912  return found;
26913};
26914
26915SS_FileView.prototype.initializationComplete = function() {
26916  var self = this;
26917  var canvasWidth = self.$el.width();
26918
26919  var $ajaxBox = $("#ajax-box");
26920  var canvasHeight = $("#cboxLoadedContent").height();
26921  // minus padding
26922  canvasHeight -= $ajaxBox.outerHeight(true) - $ajaxBox.height();
26923  // minus toolbar height
26924  canvasHeight -= Math.ceil(self.$canvasContainer.offset().top) - Math.floor(self.$el.offset().top);
26925  canvasHeight -= SS_FileView.CANVAS_SAFE_MARGIN;
26926
26927  self.canvas.width = canvasWidth;
26928  self.canvas.height = canvasHeight;
26929
26930  var x = SS_FileView.calcPositionAndScale(self.image.width, canvasWidth);
26931  var y = SS_FileView.calcPositionAndScale(self.image.height, canvasHeight);
26932
26933  if (y.scale > x.scale) {
26934    self.scale = x.scale;
26935    self.dragInfo.diff.x = x.position;
26936    self.dragInfo.diff.y = ((canvasHeight - self.image.height * self.scale) / 2) / self.scale;
26937    if (self.dragInfo.diff.y < 0) {
26938      self.dragInfo.diff.y = 0;
26939    }
26940  } else {
26941    self.scale = y.scale;
26942    self.dragInfo.diff.x = ((canvasWidth - self.image.width * self.scale) / 2) / self.scale;
26943    if (self.dragInfo.diff.x < 0) {
26944      self.dragInfo.diff.x = 0;
26945    }
26946    self.dragInfo.diff.y = y.position;
26947  }
26948  self.dragInfo.canvas.x = self.dragInfo.diff.x;
26949  self.dragInfo.canvas.y = self.dragInfo.diff.y;
26950  self.redrawImage();
26951
26952  self.$slider.prop({ value: self.scale * 100 });
26953
26954  self.$el.find(".btn-zoom-out").on("click", self.prevScale.bind(self));
26955  self.$el.find(".btn-zoom-in").on("click", self.nextScale.bind(self));
26956
26957  var $foregroundColorEl = self.$el.find("[name='foreground-color']");
26958  if ($foregroundColorEl.attr("aria-busy")) {
26959    $foregroundColorEl.one("ss:colorPickerReady", function() {
26960      $foregroundColorEl.minicolors("value", self.rgbAt(canvasWidth / 2, canvasHeight / 2));
26961    });
26962  } else {
26963    $foregroundColorEl.minicolors("value", self.rgbAt(canvasWidth / 2, canvasHeight / 2));
26964  }
26965
26966  var $backgroundColorEl = self.$el.find("[name='background-color']");
26967  if ($backgroundColorEl.attr("aria-busy")) {
26968    $backgroundColorEl.one("ss:colorPickerReady", function() {
26969      $backgroundColorEl.minicolors("value", "#ffffff");
26970    });
26971  } else {
26972    $backgroundColorEl.minicolors("value", "#ffffff");
26973  }
26974  self.calculateContrastRatio();
26975
26976  self.$el.find(".btn-contrast-ratio").on("click", self.calculateContrastRatio.bind(self));
26977
26978  self.canvas.addEventListener("click", self.pickUpColor.bind(self));
26979  self.canvas.addEventListener("mousedown", self.dragStart.bind(self));
26980  self.canvas.addEventListener("mousemove", self.dragging.bind(self));
26981  self.canvas.addEventListener("mouseup", self.dragEnd.bind(self));
26982
26983  self.$el.find(".btn-color-picker").on("click", self.pickUpColorStart.bind(self));
26984
26985  self.$el.find(".canvas-container").html(self.canvas);
26986};
26987
26988SS_FileView.prototype.calculateContrastRatio = function() {
26989  var foregroundColor = this.$el.find("#foreground-color").minicolors("value");
26990  var backgroundColor = this.$el.find("#background-color").minicolors("value");
26991  if (!foregroundColor || !backgroundColor) {
26992    return;
26993  }
26994
26995  this.$el.find(".contrast-ratio").html(SS.loading);
26996  $.ajax({
26997    url: this.options.contrastRatioPath,
26998    type: 'GET',
26999    data: { f: foregroundColor, b: backgroundColor, _: Date.now() }
27000  }).done(function(data) {
27001    $(".contrast-ratio").html(data.contrast_ratio_human);
27002  }).fail(function(xhr, status, error) {
27003    $(".contrast-ratio").html(error);
27004  });
27005};
27006
27007SS_FileView.prototype.redrawImage = function() {
27008  this.ctx.clearRect(0, 0, this.canvas.width, this.canvas.height);
27009  this.ctx.scale(this.scale, this.scale);
27010  this.ctx.drawImage(this.image, this.dragInfo.diff.x, this.dragInfo.diff.y);
27011  // reset scale
27012  this.ctx.setTransform(1, 0, 0, 1, 0, 0);
27013};
27014
27015SS_FileView.prototype.zooming = function(ev) {
27016  this.scale = ev.target.value / 100.0;
27017
27018  if (this.$sliderTimeoutId) {
27019    clearTimeout(this.$sliderTimeoutId);
27020  }
27021
27022  this.$sliderTimeoutId = setTimeout(this.zoomCommitted.bind(this), 10);
27023};
27024
27025SS_FileView.prototype.zoomChanged = function(ev) {
27026  this.scale = ev.target.value / 100.0;
27027  if (this.$sliderTimeoutId) {
27028    clearTimeout(this.$sliderTimeoutId);
27029  }
27030  this.zoomCommitted();
27031};
27032
27033SS_FileView.prototype.zoomCommitted = function() {
27034  this.$sliderTimeoutId = null;
27035  this.redrawImage();
27036};
27037
27038SS_FileView.prototype.nextScale = function(_ev) {
27039  var current = SS_FileView.findScaleStepIndex(this.scale);
27040  var next = current + 1;
27041  if (next >= SS_FileView.SCALE_STEPS.length) {
27042    next = SS_FileView.SCALE_STEPS.length - 1;
27043  }
27044
27045  this.scale = SS_FileView.SCALE_STEPS[next];
27046  this.$slider.prop({ value: this.scale * 100 });
27047
27048  this.redrawImage();
27049};
27050
27051SS_FileView.prototype.prevScale = function(_ev) {
27052  var prev = SS_FileView.findScaleStepIndex(this.scale);
27053  if (SS_FileView.SCALE_STEPS[prev] === this.scale) {
27054    prev -= 1;
27055  }
27056  if (prev < 0) {
27057    prev = 0;
27058  }
27059
27060  this.scale = SS_FileView.SCALE_STEPS[prev];
27061  this.$slider.prop({ value: this.scale * 100 });
27062
27063  this.redrawImage();
27064};
27065
27066SS_FileView.prototype.dragStart = function(ev) {
27067  if (this.isPickingUpColor) {
27068    return;
27069  }
27070
27071  this.dragInfo.isDragging = true;
27072  this.dragInfo.start.x = ev.clientX;
27073  this.dragInfo.start.y = ev.clientY;
27074
27075  this.canvas.style.cursor = "move";
27076};
27077
27078SS_FileView.prototype.dragging = function(ev) {
27079  if (!this.dragInfo.isDragging) {
27080    return;
27081  }
27082
27083  this.dragInfo.diff.x = this.dragInfo.canvas.x + (ev.clientX - this.dragInfo.start.x) / this.scale;
27084  this.dragInfo.diff.y = this.dragInfo.canvas.y + (ev.clientY - this.dragInfo.start.y) / this.scale;
27085  this.redrawImage();
27086};
27087
27088SS_FileView.prototype.dragEnd = function(_ev) {
27089  if (!this.dragInfo.isDragging) {
27090    return;
27091  }
27092
27093  this.canvas.style.cursor = "auto";
27094
27095  this.dragInfo.isDragging = false;
27096  this.dragInfo.canvas.x = this.dragInfo.diff.x;
27097  this.dragInfo.canvas.y = this.dragInfo.diff.y;
27098};
27099
27100SS_FileView.prototype.pickUpColorStart = function(ev) {
27101  var $target = $(ev.currentTarget);
27102  if ($target.hasClass("btn-active")) {
27103    // cancel picking
27104    $target.removeClass("btn-active");
27105    this.isPickingUpColor = false;
27106    this.canvas.style.cursor = "auto";
27107  } else {
27108    this.$el.find(".btn-color-picker.btn-active").removeClass("btn-active");
27109
27110    this.isPickingUpColor = true;
27111    $target.addClass("btn-active");
27112    this.canvas.style.cursor = "crosshair";
27113  }
27114};
27115
27116SS_FileView.prototype.pickUpColor = function(ev) {
27117  if (!this.isPickingUpColor) {
27118    return;
27119  }
27120
27121  var x = ev.offsetX;
27122  var y = ev.offsetY;
27123  if (x < 0) {
27124    x = 0;
27125  }
27126  if (x >= this.canvas.width) {
27127    x = this.canvas.width - 1;
27128  }
27129  if (y < 0) {
27130    y = 0;
27131  }
27132  if (y >= this.canvas.height) {
27133    y = this.canvas.height - 1;
27134  }
27135
27136  var rgb = this.rgbAt(x, y);
27137  this.$el.find(".btn-color-picker.btn-active").closest(".btn-group").find(".js-color").minicolors("value", rgb);
27138
27139  this.canvas.style.cursor = "auto";
27140  this.$el.find(".btn-color-picker").removeClass("btn-active");
27141  this.isPickingUpColor = false;
27142
27143  this.calculateContrastRatio();
27144};
27145
27146SS_FileView.prototype.rgbAt = function(x, y) {
27147  this.ctx.scale(this.scale, this.scale);
27148  var pixels = this.ctx.getImageData(x, y, 1, 1).data;
27149  // reset scale
27150  this.ctx.setTransform(1, 0, 0, 1, 0, 0);
27151
27152  var red = pixels[0];
27153  var green = pixels[1];
27154  var blue = pixels[2];
27155  var alpha = pixels[3];
27156
27157  if (alpha === 0) {
27158    return "#ffffff";
27159  }
27160
27161  red = SS_FileView.toHex(red);
27162  green = SS_FileView.toHex(green);
27163  blue = SS_FileView.toHex(blue);
27164  return "#" + red + green + blue;
27165};
27166this.SS_DateTimePicker = (function () {
27167  // 注意:
27168  // datetimepicker にはバグがある。
27169  // このコントールの次の要素が disabled の場合、コントロール内で Enter キーを押しても、入力した日時が確定しない。
27170  //
27171  // datetimepicker では、コントロール内で Enter キーを押すと次の要素にフォーカスを移動させる。
27172  // フォーカスを移動させることでイベント "blur" が発生し、入力が確定 → onChangeDateTime イベント発生という順で処理が進む。
27173  //
27174  // しかし、次の要素が disabled の場合、フォーカスを移動させれず、イベント "blur" が発生しない。
27175  // このため、入力が確定せず、onChangeDateTime イベントも発生しない。
27176  //
27177  // 問題となるソースコードは https://github.com/xdan/datetimepicker/blob/master/jquery.datetimepicker.js#L2591
27178  // 要素セレクターに ":enabled" の条件がない。
27179  //
27180  // そこで、Enter キーが押されたら、イベント "blur" を発生させ、入力が確定 → onChangeDateTime イベント発生という順で処理が進むようにする。
27181  // また、念の為 Enter キーでフォーカスを移動させないようにするため enterLikeTab を false にする。
27182  function SS_DateTimePicker(el, type) {
27183    this.$el = $(el);
27184
27185    if (!type) {
27186      if (this.$el.hasClass("js-date")) {
27187        type = "date"
27188      } else {
27189        type = "datetime"
27190      }
27191    }
27192    this.type = type;
27193    this.initialized = false;
27194    // this.ee = new EventEmitter3();
27195
27196    this.render();
27197    this.$el.data("ss_datetimepicker", this);
27198  }
27199
27200  var standardFormats = {
27201    RFC_2822: 'D, d M Y H:i:s O',
27202    ATOM: 'Y-m-dTH:i:sP',
27203    ISO_8601: 'Y-m-dTH:i:sO',
27204    RFC_822: 'D, d M y H:i:s O',
27205    RFC_850: 'l, d-M-y H:i:s T',
27206    RFC_1036: 'D, d M y H:i:s O',
27207    RFC_1123: 'D, d M Y H:i:s O',
27208    RSS: 'D, d M Y H:i:s O',
27209    W3C: 'Y-m-dTH:i:sP'
27210  }
27211
27212  var isFormatStandard = function(format){
27213    return Object.values(standardFormats).indexOf(format) === -1 ? false : true;
27214  }
27215
27216  var dateFormatter = {
27217    parseDate: function (date, format) {
27218      // 全角半角変換
27219      if (typeof date === "string") {
27220        date = date.replace(/[0-9]/g, function(s) {
27221          return String.fromCharCode(s.charCodeAt(0) - 0xFEE0);
27222        });
27223      }
27224
27225      if(isFormatStandard(format)){
27226        return defaultDateHelper.parseDate(date, format);
27227      }
27228      var d = moment(date, format);
27229      return d.isValid() ? d.toDate() : false;
27230    },
27231
27232    formatDate: function (date, format) {
27233      if(isFormatStandard(format)){
27234        return defaultDateHelper.formatDate(date, format);
27235      }
27236      return moment(date).format(format);
27237    },
27238
27239    formatMask: function(format){
27240      return format
27241        .replace(/Y{4}/g, '9999')
27242        .replace(/Y{2}/g, '99')
27243        .replace(/M{2}/g, '19')
27244        .replace(/D{2}/g, '39')
27245        .replace(/H{2}/g, '29')
27246        .replace(/m{2}/g, '59')
27247        .replace(/s{2}/g, '59');
27248    }
27249  };
27250
27251  var dateFormat = function() {
27252    if ("i18next" in window) {
27253      return i18next.t("date.formats.picker")
27254    } else {
27255      return SS.DEFAULT_DATE_FORMAT;
27256    }
27257  }
27258
27259  var timeFormat = function() {
27260    if ("i18next" in window) {
27261      return i18next.t("time.formats.picker")
27262    } else {
27263      return SS.DEFAULT_TIME_FORMAT;
27264    }
27265  }
27266
27267  var initialized = false;
27268
27269  SS_DateTimePicker.renderOnce = function () {
27270    if (initialized) {
27271      return;
27272    }
27273
27274    $.datetimepicker.setLocale(document.documentElement.lang || 'ja');
27275    // setLocale() を呼び出すと dateFormatter がリセットされるので、setLocale() の後に setDateFormatter() を呼び出さなければならない。
27276    $.datetimepicker.setDateFormatter(dateFormatter);
27277
27278    initialized = true;
27279  };
27280
27281  SS_DateTimePicker.render = function (root, type) {
27282    SS_DateTimePicker.renderOnce();
27283
27284    $(root || document).find(".js-date,.js-datetime").each(function () {
27285      var $this = $(this);
27286      var data = $this.data();
27287      if ("ss_datetimepicker" in data) {
27288        // already instantiated
27289        return;
27290      }
27291
27292      new SS_DateTimePicker(this, type);
27293    });
27294  };
27295
27296  SS_DateTimePicker.instance = function (selector) {
27297    return $(selector).data("ss_datetimepicker");
27298  };
27299
27300  // [ "on", "once", "off", "momentValue", "valueForExchange" ].forEach(function(method) {
27301  [ "momentValue", "valueForExchange" ].forEach(function(method) {
27302    SS_DateTimePicker[method] = function() {
27303      var selector = Array.prototype.shift.call(arguments)
27304      return SS_DateTimePicker.prototype[method].apply(SS_DateTimePicker.instance(selector), arguments);
27305    };
27306  });
27307
27308  SS_DateTimePicker.prototype.render = function () {
27309    var self = this;
27310
27311    var options = self.type === "date" ? self.buildDatePickerOptions() : self.buildDateTimePickerOptions();
27312    self.$el
27313      .attr('autocomplete', 'off')
27314      .datetimepicker(options)
27315      .on("keydown", function(ev) {
27316        var key = ev.which;
27317        if (key === SS.KEY_ENTER) {
27318          $this.trigger("blur.xdsoft")
27319        }
27320        return true;
27321      });
27322
27323    self.$el.one("ss:generate", function() { self.onInitialized(); });
27324
27325    var $form = this.$el.closest("form");
27326    if (!$form.data("ss-datetime-picker-installed")) {
27327      $form.data("ss-datetime-picker-installed", true);
27328    }
27329  };
27330
27331  SS_DateTimePicker.prototype.onInitialized = function () {
27332    this.initialized = true;
27333  };
27334
27335  SS_DateTimePicker.prototype.momentValue = function(value) {
27336    var self = this;
27337
27338    if (arguments.length === 1) {
27339      // setter
27340      if (value) {
27341        value = self.type === "datetime" ? SS.formatTime(value, "picker") : SS.formatDate(value, "picker")
27342      }
27343      self.$el.val(value || '');
27344      self.$el.datetimepicker({ value: value || '' });
27345    } else {
27346      // getter
27347      // datetimepicker のバグだと思うが、初期化時に value が nil や空文字の場合、getValue がカレント時刻になってしまう。
27348      // 表示されている値(input の value)と、内部の値(datetimepicker の getValue)とが異なる場合を考慮する。
27349      if (!self.$el.val()) {
27350        return null;
27351      }
27352
27353      var ret = self.$el.datetimepicker("getValue");
27354      if (!ret) {
27355        return ret;
27356      }
27357
27358      return moment(ret);
27359    }
27360  };
27361
27362  SS_DateTimePicker.prototype.valueForExchange = function () {
27363    var self = this;
27364
27365    var value = self.momentValue();
27366    if (value) {
27367      value = value.format(this.type === "datetime" ? "YYYY/MM/DD HH:mm:ss" : "YYYY/MM/DD");
27368    }
27369
27370    return value || '';
27371  };
27372
27373  SS_DateTimePicker.prototype.buildDatePickerOptions = function () {
27374    var self = this;
27375    var opts = {
27376      format: SS.convertDateTimeFormat(dateFormat()),
27377      formatDate: SS.convertDateTimeFormat(dateFormat()),
27378      formatTime: "HH:mm",
27379      value: self.$el.val(),
27380      enterLikeTab: false,
27381      timepicker: false,
27382      closeOnDateSelect: true,
27383      scrollInput: false,
27384      onGenerate: function() { self.$el.trigger("ss:generate"); },
27385      onChangeDateTime: function(currentTime, $input, ev) {
27386        self.$el.trigger("ss:changeDateTime", [ currentTime, $input, ev ]);
27387      }
27388    };
27389
27390    var data = self.$el.data();
27391    if (data.format) {
27392      opts.format = SS.convertDateTimeFormat(data.format);
27393    }
27394    if ("closeOnDateSelect" in data) {
27395      opts.closeOnDateSelect = data.closeOnDateSelect;
27396    }
27397    if ("scrollInput" in data) {
27398      opts.scrollInput = data.scrollInput;
27399    }
27400    if (data.minDate) {
27401      opts.minDate = data.minDate;
27402    }
27403    if (data.maxDate) {
27404      opts.maxDate = data.maxDate;
27405    }
27406
27407    return opts;
27408  };
27409
27410  SS_DateTimePicker.prototype.buildDateTimePickerOptions = function () {
27411    var self = this;
27412    var opts = {
27413      format: SS.convertDateTimeFormat(timeFormat()),
27414      formatDate: SS.convertDateTimeFormat(dateFormat()),
27415      formatTime: "HH:mm",
27416      value: self.$el.val(),
27417      closeOnDateSelect: false,
27418      enterLikeTab: false,
27419      scrollInput: false,
27420      roundTime: 'ceil',
27421      step: 30,
27422      onGenerate: function() { self.$el.trigger("ss:generate"); },
27423      onChangeDateTime: function(currentTime, $input, ev) {
27424        self.$el.trigger("ss:changeDateTime", [ currentTime, $input, ev ]);
27425      }
27426    };
27427
27428    var data = self.$el.data();
27429    if (data.format) {
27430      opts.format = SS.convertDateTimeFormat(data.format);
27431    }
27432    if (data.minDate) {
27433      opts.minDate = data.minDate;
27434    }
27435    if (data.maxDate) {
27436      opts.maxDate = data.maxDate;
27437    }
27438    if ("closeOnDateSelect" in data) {
27439      opts.closeOnDateSelect = data.closeOnDateSelect;
27440    }
27441    if ("scrollInput" in data) {
27442      opts.scrollInput = data.scrollInput;
27443    }
27444    // time specific options
27445    if (data.step) {
27446      opts.step = data.step;
27447    }
27448    if (data.roundTime) {
27449      opts.roundTime = data.roundTime;
27450    }
27451
27452    return opts;
27453  };
27454
27455  return SS_DateTimePicker;
27456})();
27457this.Cms_Site_Search = (function () {
27458  function Cms_Site_Search() {
27459  }
27460
27461  Cms_Site_Search.render = function () {
27462    $(".ajax-box.article-nodes, .ajax-box.categories").colorbox({
27463      fixed: true,
27464      width: "90%",
27465      height: "90%"
27466    });
27467    $(".selected-article-nodes, .selected-categories").find(".deselect").on("click", function () {
27468      $(this).closest(".selected-item").remove();
27469      return false;
27470    });
27471  }
27472
27473  Cms_Site_Search.selectItem = function (ele) {
27474    var item = $(ele).find(".selected-item").clone(false);
27475
27476    // remove renderInBox class
27477    $(item).find("a").removeClass("cboxElement");
27478
27479    // deselect button
27480    $(item).find(".deselect").on("click", function () {
27481      $(this).closest(".selected-item").remove();
27482      return false;
27483    });
27484
27485    // append
27486    item.show();
27487    SS_SearchUI.anchorAjaxBox.closest("dl").find(".selected-article-nodes, .selected-categories").append(item);
27488
27489    return item;
27490  }
27491
27492  Cms_Site_Search.toggleSelectButton = function () {
27493    if ($(".search-ui .items input:checked").size() > 0) {
27494      $(".select-items").parent("div").show();
27495    } else {
27496      $(".select-items").parent("div").hide();
27497    }
27498  };
27499
27500  Cms_Site_Search.modal = function () {
27501    // form search event
27502    $(".search-ui-form form.search").on("submit", function (_e) {
27503      $(this).ajaxSubmit({
27504        url: $(this).attr("action"),
27505        success: function (data) {
27506          return $("#cboxLoadedContent").html(data);
27507        },
27508        error: function (_data, _status) {
27509          return alert("== Error(SiteSearch) ==");
27510        }
27511      });
27512      return false;
27513    });
27514
27515    // select item event
27516    $(".search-ui a.select-item").on("click", function (_e) {
27517      SS_SearchUI.anchorAjaxBox.closest("dl").find(".selected-article-nodes, .selected-categories").html('');
27518      var tr = $(this).closest("tr");
27519      var article = Cms_Site_Search.selectItem(tr);
27520
27521      $.colorbox.close();
27522      $(article).find(".set-graph:first").trigger("click");
27523
27524      return false;
27525    });
27526
27527    // select items event
27528    $(".search-ui-select .select-items").on("click", function (_e) {
27529      SS_SearchUI.anchorAjaxBox.closest("dl").find(".selected-article-nodes, .selected-categories").html('');
27530      $(".search-ui .items .set-article-node:checked, .search-ui .items .set-category:checked").each(function () {
27531        var tr = $(this).closest("tr");
27532        Cms_Site_Search.selectItem(tr);
27533      });
27534      $.colorbox.close();
27535      return false;
27536    });
27537
27538    // list-head checkbox event
27539    $(".search-ui .list-head input:checkbox").on("change", function (_e) {
27540      var chk = $(this).prop('checked');
27541      $('.search-ui .list-item').each(function () {
27542        $(this).toggleClass('checked', chk);
27543        $(this).find('.set-article-node, .set-category').prop('checked', chk);
27544      });
27545    });
27546
27547    // check selected items in modal
27548    $(".selected-categories .selected-item").each(function () {
27549      var name = $(this).attr("data-name");
27550      $(`#colorbox .items [data-name="${name}"] input[type=checkbox]`).prop('checked', true);
27551    });
27552    $(".selected-article-nodes .selected-item").each(function () {
27553      var id = $(this).attr("data-id");
27554      $(`#colorbox .items [data-id="${id}"] input[type=checkbox]`).prop('checked', true);
27555    });
27556  }
27557
27558  return Cms_Site_Search;
27559})();
27560this.Cms_Site_Search_History = (function () {
27561  function Cms_Site_Search_History(selector, url) {
27562    this.form = $(selector);
27563    this.url = url;
27564
27565    this.keyword = this.form.find('[name="s[keyword]"]');
27566    this.history = this.form.find('.site-search-history');
27567    this.histories = [];
27568
27569    this.maxHistoryLength = 6;
27570    this.maxKeywordLength = 30;
27571
27572    if (this.keyword.length > 0 && this.history.length > 0) {
27573      this.render();
27574    }
27575  }
27576
27577  var DATA_KEY = "cms-site-search-history";
27578
27579  Cms_Site_Search_History.render = function(selector, url) {
27580    $(selector).each(function() {
27581      var $this = $(this);
27582      var instance = $this.data(DATA_KEY);
27583      if (instance) {
27584        return;
27585      }
27586
27587      instance = new Cms_Site_Search_History(this, url);
27588      $this.data(DATA_KEY, instance);
27589    });
27590  };
27591
27592  Cms_Site_Search_History.prototype.storageKey = function (key) {
27593    if (!this.formKey) {
27594      this.formKey = CryptoJS.MD5(this.url).toString();
27595    }
27596    return "ss_site_search_" + this.formKey + "_" + key;
27597  };
27598
27599  Cms_Site_Search_History.prototype.getHistories = function () {
27600    var _this = this;
27601    var histories = [];
27602    var length = 0;
27603
27604    try {
27605      length = localStorage.getItem(_this.storageKey("history_length"));
27606      if (length && (length = parseInt(length))) {
27607        var history;
27608        for (var i = 0; i < length; i++) {
27609          history = localStorage.getItem(_this.storageKey("history_" + i));
27610          if (history) {
27611            histories.push(history);
27612          }
27613        }
27614      }
27615    } catch (error) {
27616      console.warn(error);
27617    }
27618    return histories;
27619  };
27620
27621  Cms_Site_Search_History.prototype.setHistories = function (histories) {
27622    var _this = this;
27623
27624    try {
27625      localStorage.setItem(_this.storageKey("history_length"), histories.length);
27626      $.each(histories, function (idx, history) {
27627        localStorage.setItem(_this.storageKey("history_" + idx), history);
27628      });
27629    } catch (error) {
27630      console.warn(error);
27631    }
27632  };
27633
27634  Cms_Site_Search_History.prototype.renderHistories = function () {
27635    var _this = this;
27636
27637    _this.histories = _this.getHistories();
27638    if (_this.histories.length > 0) {
27639      $(_this.histories).each(function () {
27640        var li = $('<li><a href="#">
27640' + this + '</a></li>');
27641        li .find("a").on("click", function () {
27642          _this.keyword.val($(this).text());
27643          _this.form.trigger("submit");
27644          return false;
27645        });
27646        _this.history.append(li);
27647      });
27648    }
27649
27650    this.index = 0;
27651    this.indexLength = this.histories.length;
27652  };
27653
27654  Cms_Site_Search_History.prototype.renderEvents = function () {
27655    var _this = this;
27656
27657    this.form.on("submit", function(){
27658      var histories = _this.histories;
27659      var keyword = _this.keyword.val();
27660
27661      keyword = _this.formatKeyword(keyword);
27662      if (keyword) {
27663        _this.keyword.val(keyword);
27664        histories = histories.filter(function (v) { return v != keyword; });
27665        histories.unshift(keyword);
27666        histories = histories.slice(0, _this.maxHistoryLength);
27667        _this.setHistories(histories);
27668      }
27669    });
27670
27671    if (this.histories.length > 0) {
27672      this.keyword.on("focus", function(){
27673        _this.history.show();
27674      });
27675      this.keyword.on("blur", function(){
27676        _this.index = 0;
27677        _this.history.find("li").removeClass("selected");
27678        _this.history.hide();
27679      });
27680      this.history.find("a").on("mousedown", function(){
27681        _this.keyword.off("blur");
27682      });
27683      this.keyword.on("keydown", function(e) {
27684        if (e.which != SS.KEY_ENTER && e.which != 38 && e.which != 40) {
27685          return;
27686        }
27687
27688        if (e.which == SS.KEY_ENTER) {
27689          if ((_this.index - 1) >= 0) {
27690            _this.keyword.val(_this.histories[_this.index - 1]);
27691          }
27692          return true;
27693        }
27694        if (e.which == 38) {
27695          _this.index -= 1;
27696        }
27697        if (e.which == 40) {
27698          _this.index += 1;
27699        }
27700        if (_this.index > _this.indexLength) {
27701          _this.index = 1;
27702        } else if (_this.index <= 0) {
27703          _this.index = _this.indexLength;
27704        }
27705        _this.history.find("li").removeClass("selected");
27706        _this.history.find("li:nth-child(" + _this.index + ")").addClass("selected");
27707        _this.keyword.val(_this.history.find("li.selected a").data("value"));
27708      });
27709    }
27710  };
27711
27712  Cms_Site_Search_History.prototype.render = function () {
27713    this.renderHistories();
27714    this.renderEvents();
27715  };
27716
27717  Cms_Site_Search_History.prototype.formatKeyword = function (keyword) {
27718    if (!keyword) {
27719      return keyword;
27720    }
27721
27722    keyword = keyword.replace(/[\s\u3000]+/g, ' ');
27723    keyword = keyword.trim();
27724
27725    if (keyword.length > this.maxKeywordLength) {
27726      keyword = keyword.substr(0, this.maxKeywordLength);
27727      keyword = keyword.trim();
27728    }
27729    return keyword;
27730  };
27731
27732  return Cms_Site_Search_History;
27733
27734})();
27735this.Cms_Line_Message_Repeat_Plan = (function () {
27736  function Cms_Line_Message_Repeat_Plan() {
27737  }
27738
27739  Cms_Line_Message_Repeat_Plan.renderForm = function () {
27740    this.changeRepeatForm();
27741    $('#item_repeat_type').on("change", function () {
27742      Cms_Line_Message_Repeat_Plan.changeRepeatForm();
27743    });
27744  };
27745
27746  Cms_Line_Message_Repeat_Plan.changeRepeatForm = function () {
27747    var repeat_type;
27748    repeat_type = $('#item_repeat_type').val();
27749    if (repeat_type === '') {
27750      $('.cms-line-message-repeat').addClass("hide");
27751    } else {
27752      $('.cms-line-message-repeat').removeClass("hide");
27753      $(".repeat-daily, .repeat-weekly, .repeat-monthly").hide();
27754      $(".repeat-" + repeat_type).show();
27755    }
27756  };
27757
27758  return Cms_Line_Message_Repeat_Plan;
27759
27760})();
27761
27762this.Cms_Line_Area_Cropper = (function () {
27763  function Cms_Line_Area_Cropper(el, opts) {
27764    if (!opts) {
27765      opts = {};
27766    }
27767    this.$el = $(el);
27768    this.$currentArea = this.$el.find(".areas .area1");
27769    this.$image = this.$el.find(".image-warp img");
27770    this.readonly = opts["readonly"];
27771    this.render();
27772  }
27773
27774  Cms_Line_Area_Cropper.prototype.render = function () {
27775    var self = this;
27776    self.cropper = new Cropper(
27777      self.$image[0],
27778      {
27779        viewMode: 1,
27780        zoomOnWheel: false,
27781        background: true,
27782        autoCrop: false,
27783        ready: function(_e) {
27784          $(".area-names .area-name:first").trigger("click");
27785          if (self.readonly) {
27786            self.cropper.disable();
27787          }
27788          window.cropper = self.cropper;
27789        },
27790        cropmove: function(_e) {
27791          self.setCroppedArea();
27792        }
27793      }
27794    );
27795
27796    self.$el.find(".area-name").on("click" , function(){
27797      self.$el.find(".area-name").removeClass("current")
27798      self.$el.find(".area-name").removeClass("btn-active");
27799      $(this).addClass("current");
27800      $(this).addClass("btn-active");
27801
27802      var idx = $(this).data("area");
27803      self.$currentArea = $('[data-area="' + idx + '"]');
27804
27805      self.$el.find(".areas .area").hide();
27806      self.$currentArea.show();
27807      self.cropCurrentArea();
27808      return false;
27809    });
27810
27811    self.$el.find(".reset-area").on("click", function() {
27812      self.$currentArea.find('[name="item[in_areas][][x]"]').val("");
27813      self.$currentArea.find('[name="item[in_areas][][y]"]').val("");
27814      self.$currentArea.find('[name="item[in_areas][][width]"]').val("");
27815      self.$currentArea.find('[name="item[in_areas][][height]"]').val("");
27816      self.$currentArea.find('[name="item[in_areas][][text]"]').val("");
27817      self.$currentArea.find('[name="item[in_areas][][uri]"]').val("");
27818      self.$currentArea.find('[name="item[in_areas][][data]"]').val("");
27819      self.$currentArea.find('[name="item[in_areas][][menu_id]"]').val("");
27820      self.$currentArea.find('[name="item[in_areas][][type]"]').val("message");
27821      self.cropper.clear();
27822      return false;
27823    });
27824
27825    self.$el.find(".action").each(function() {
27826      var $action = $(this)
27827      var $select = $action.find('[name="item[in_areas][][type]"]');
27828      var toggleAction = function(){
27829        $action.find('[data-type]').hide();
27830        $action.find('[data-type="' + $select.val() + '"]').show();
27831      };
27832      $select.on("change", toggleAction);
27833      toggleAction();
27834    });
27835  };
27836
27837  Cms_Line_Area_Cropper.prototype.cropCurrentArea = function () {
27838    var self = this;
27839    var x = self.$currentArea.find('input[name="item[in_areas][][x]"]').val();
27840    var y = self.$currentArea.find('input[name="item[in_areas][][y]"]').val();
27841    var width = self.$currentArea.find('input[name="item[in_areas][][width]"]').val();
27842    var height = self.$currentArea.find('input[name="item[in_areas][][height]"]').val();
27843
27844    if (x && y && width && height) {
27845      var data = self.cropper.getData(true);
27846      Object.assign(data, { x: parseInt(x), y: parseInt(y), width: parseInt(width), height: parseInt(height) });
27847      self.cropper.enable();
27848      self.cropper.crop();
27849      self.cropper.setData(data);
27850    } else {
27851      self.cropper.enable();
27852      self.cropper.clear();
27853    }
27854
27855    if (self.readonly) {
27856      self.cropper.disable();
27857    }
27858  };
27859
27860  Cms_Line_Area_Cropper.prototype.setCroppedArea = function () {
27861    var self = this;
27862    var data = self.cropper.getData(true);
27863    self.$currentArea.find('input[name="item[in_areas][][x]"]').val(data.x);
27864    self.$currentArea.find('input[name="item[in_areas][][y]"]').val(data.y);
27865    self.$currentArea.find('input[name="item[in_areas][][width]"]').val(data.width);
27866    self.$currentArea.find('input[name="item[in_areas][][height]"]').val(data.height);
27867  };
27868
27869  return Cms_Line_Area_Cropper;
27870})();
27871
27872
27873this.Cms_Line_Deliver_Condition =  (function () {
27874  function Cms_Line_Deliver_Condition() {
27875    this.render();
27876  }
27877
27878  Cms_Line_Deliver_Condition.prototype.render = function () {
27879    $(".select-deliver-category").on("change", this.toggleDeliverCategory);
27880    $(".select-deliver-category").on("change", this.toggleDeliverCategoryRemark);
27881    $(".remarks-button").on("click", this.toggleRemarkText);
27882    this.toggleDeliverCategory();
27883    this.toggleDeliverCategoryRemark();
27884  };
27885
27886  Cms_Line_Deliver_Condition.prototype.toggleDeliverCategory = function(){
27887    var selected = {};
27888    $(".deliver-category").each(function(){
27889      var category = this;
27890
27891      // select
27892      var id = $(this).find("select").val();
27893      if (id) {
27894        selected[id] = $(category);
27895      }
27896      // checkbox
27897      $(this).find("input:checked").each(function(){
27898        var id = $(this).val();
27899        selected[id] = $(category);
27900      });
27901    });
27902
27903    $(".deliver-category[data-required]").each(function() {
27904      var ids = $(this).attr("data-required").split(",");
27905      var required = false;
27906      $.each(ids, function() {
27907        var id = this;
27908        if (selected[id] && selected[id].is(':visible')) {
27909          required = true;
27910        }
27911      });
27912      if (required) {
27913        $(this).show();
27914        $(this).find("[name]").attr("name", "item[deliver_category_ids][]");
27915      } else {
27916        $(this).hide();
27917        $(this).find("[name]").attr("name", "");
27918      }
27919    });
27920  };
27921
27922  Cms_Line_Deliver_Condition.prototype.toggleDeliverCategoryRemark = function () {
27923    $(".deliver-remarks").hide();
27924    $(".deliver-category").each(function () {
27925      // select
27926      var id = $(this).find("select").val();
27927      $(".remark-" + id).show();
27928      $(".remark-" + id).text("+ 詳細を開く");
27929    });
27930
27931    // checkbox
27932    $(this).find("input:checked").each(function(){
27933      var id = $(this).val();
27934      $(".remark-" + id).show();
27935      $(".remark-" + id).text("+ 詳細を開く");
27936    });
27937
27938  };
27939
27940  Cms_Line_Deliver_Condition.prototype.toggleRemarkText = function () {
27941    className = $(this).attr("class").split(" ")[0];
27942    $( "." + className + "-text").toggle();
27943    if ($(this).text() == "+ 詳細を開く") {
27944      $(this).text("− 詳細を閉じる");
27945    } else {
27946      $(this).text("+ 詳細を開く");
27947    }
27948  };
27949
27950  return Cms_Line_Deliver_Condition;
27951})();
27952this.Cms_History = (function () {
27953  function Cms_History(selector, listIdentity, opts) {
27954    if (!opts) {
27955      opts = {};
27956    }
27957
27958    this.selector = selector;
27959    this.listIdentity = listIdentity;
27960    this.limit = opts["limit"] ? opts["limit"] : 5;
27961    this.render();
27962  }
27963
27964  Cms_History.prototype.storageKey = function (key) {
27965    return "ss_cms_history_" + this.listIdentity + "_" + key;
27966  };
27967
27968  Cms_History.prototype.render = function () {
27969    var _this = this;
27970    var histories = _this.getHistories();
27971    var current = $(_this.selector).find(".current");
27972
27973    if (!current.length) {
27974      return;
27975    }
27976
27977    var warp = $(current).parent();
27978    var html = $(warp).html();
27979    $(current).remove();
27980
27981    if (histories.length > 0) {
27982      $(histories).each(function () {
27983        $(warp).append(this);
27984      });
27985    }
27986
27987    histories = histories.filter(function (v) { return v != html; });
27988    histories.unshift(html);
27989    histories = histories.slice(0, _this.limit);
27990    _this.setHistories(histories);
27991  };
27992
27993  Cms_History.prototype.setHistories = function (histories) {
27994    var _this = this;
27995
27996    try {
27997      localStorage.setItem(_this.storageKey("length"), histories.length);
27998      $.each(histories, function (i, history) {
27999        localStorage.setItem(_this.storageKey(i), history);
28000      });
28001    } catch (error) {
28002      console.warn(error);
28003    }
28004  };
28005
28006  Cms_History.prototype.getHistories = function () {
28007    var _this = this;
28008    var histories = [];
28009    var length = 0;
28010
28011    try {
28012      length = localStorage.getItem(_this.storageKey("length"));
28013      if (length && (length = parseInt(length))) {
28014        var history;
28015        for (var i = 0; i < length; i++) {
28016          history = localStorage.getItem(_this.storageKey(i));
28017          if (history) {
28018            histories.push(history);
28019          }
28020        }
28021      }
28022    } catch (error) {
28023      console.warn(error);
28024    }
28025    return histories;
28026  };
28027
28028  return Cms_History;
28029
28030})();
28031this.SS_SearchUI = (function () {
28032  function SS_SearchUI() {
28033  }
28034
28035  var selectTable = null;
28036  let toSelected = [], ccSelected = [], bcSelected = [];
28037
28038  SS_SearchUI.dialogType = 'colorbox';
28039
28040  SS_SearchUI.anchorAjaxBox;
28041
28042  SS_SearchUI.defaultTemplate = " \
28043    <tr data-id=\"<%= data.id %>\"> \
28044      <td> \
28045        <input type=\"<%= attr.type %>\" name=\"<%= attr.name %>\" value=\"<%= data.id %>\" class=\"<%= attr.class %>\"> \
28046        <%= data.name %> \
28047      </td> \
28048      <td><a class=\"deselect btn\" href=\"#\"><%= label.delete %></a></td> \
28049    </tr>";
28050
28051  SS_SearchUI.defaultSelector = function ($item, $prevSelected) {
28052    if (!SS_SearchUI.anchorAjaxBox) {
28053      return
28054    }
28055
28056    var templateId = SS_SearchUI.anchorAjaxBox.data("template");
28057    var templateEl = templateId ? document.getElementById(templateId) : null;
28058    var template, attr;
28059    if (templateEl) {
28060      template = templateEl.innerHTML;
28061      attr = {};
28062    } else {
28063      template = SS_SearchUI.defaultTemplate;
28064
28065      var $input = SS_SearchUI.anchorAjaxBox.closest("dl").find(".hidden-ids");
28066      if (selectTable === "to") {
28067        attr = {
28068          name: "item[in_to_members][]",
28069          type: $input.attr("type"),
28070          class: $input.attr("class").replace("hidden-ids", "")
28071        }
28072      } else if (selectTable === "cc") {
28073        attr = {
28074          name: "item[in_cc_members][]",
28075          type: $input.attr("type"),
28076          class: $input.attr("class").replace("hidden-ids", "")
28077        }
28078      } else if (selectTable === "bcc") {
28079        attr = {
28080          name: "item[in_bcc_members][]",
28081          type: $input.attr("type"),
28082          class: $input.attr("class").replace("hidden-ids", "")
28083        }
28084      } else {
28085        attr = {
28086          name: $input.attr("name"),
28087          type: $input.attr("type"),
28088          class: $input.attr("class").replace("hidden-ids", "")
28089        }
28090      }
28091    }
28092
28093    var $data = $item.closest("[data-id]");
28094    var data = $data[0].dataset;
28095    if (!data.name) {
28096      data.name = $data.find(".select-item").text() || $item.text() || $data.text();
28097    }
28098
28099    var deleteLabel;
28100    if ("i18next" in window) {
28101      deleteLabel = i18next.t("ss.buttons.delete");
28102    } else {
28103      deleteLabel = "削除";
28104    }
28105    var tr = ejs.render(template, {data: data, attr: attr, label: { delete: deleteLabel }});
28106    var $tr = $(tr);
28107    var $ajaxSelected;
28108    if (selectTable === "to") {
28109      $ajaxSelected = SS_SearchUI.anchorAjaxBox.closest("body").find(".see.to .ajax-selected");
28110    } else if (selectTable === "cc") {
28111      $ajaxSelected = SS_SearchUI.anchorAjaxBox.closest("body").find(".see.cc-bcc.cc .ajax-selected");
28112    } else if (selectTable === "bcc") {
28113      $ajaxSelected = SS_SearchUI.anchorAjaxBox.closest("body").find(".see.cc-bcc.bcc .ajax-selected");
28114    } else {
28115      $ajaxSelected = SS_SearchUI.anchorAjaxBox.closest("dl").find(".ajax-selected");
28116    }
28117
28118    if ($prevSelected) {
28119      $prevSelected.after($tr);
28120    } else {
28121      $ajaxSelected.find("tbody").prepend($tr);
28122    }
28123    $ajaxSelected.trigger("change");
28124    return $tr;
28125  };
28126
28127  SS_SearchUI.defaultDeselector = function (item) {
28128    var table = $(item).closest(".ajax-selected");
28129    var tr = $(item).closest("tr");
28130
28131    tr.remove();
28132    if (table.find("tbody tr").size() === 0) {
28133      table.hide();
28134    }
28135    table.trigger("change");
28136  };
28137
28138  SS_SearchUI.dispatchEvent = function (eventName, detail) {
28139    var ajaxBox = document.getElementById("ajax-box");
28140    if (ajaxBox) {
28141      var event = new CustomEvent(eventName, { bubbles: true, cancelable: false, composed: true, detail: detail });
28142      ajaxBox.dispatchEvent(event);
28143    }
28144  }
28145
28146  SS_SearchUI.select = function (item, prevSelected) {
28147    if (SS_SearchUI.anchorAjaxBox) {
28148      var selector = SS_SearchUI.anchorAjaxBox.data('on-select');
28149      if (selector) {
28150        return selector(item);
28151      } else {
28152        if (!selectTable) {
28153          if (item.closest("[data-id]").find(".to-checkbox")[0]) {
28154            selectTable = "to";
28155          }
28156        }
28157        var result = this.defaultSelector(item, prevSelected);
28158        if (selectTable === "to") {
28159          SS_SearchUI.anchorAjaxBox.closest("body").find(".see.to .ajax-selected").show();
28160        }
28161        return result;
28162      }
28163    } else {
28164      SS_SearchUI.dispatchEvent("ss:modal-select", { item: item })
28165    }
28166  };
28167
28168  SS_SearchUI.selectItems = function ($el) {
28169    if (!$el) {
28170      $el = $("#ajax-box");
28171    }
28172    var self = this;
28173    var $prevSelected = undefined;
28174    $el.find(".items .to-checkbox input:checkbox").filter(":checked").each(function () {
28175      selectTable = "to";
28176      // 複数項目が選択された場合、最初の項目を先頭に挿入し、2個目以降の選択をその次に挿入する。
28177      $prevSelected = self.select($(this), $prevSelected);
28178    });
28179    if (selectTable === "to" && self.anchorAjaxBox) {
28180      self.anchorAjaxBox.closest("body").find(".see.to .ajax-selected").show();
28181    }
28182
28183    $prevSelected = undefined;
28184    $el.find(".items .cc-checkbox input:checkbox").filter(":checked").each(function () {
28185      selectTable = "cc";
28186      // 複数項目が選択された場合、最初の項目を先頭に挿入し、2個目以降の選択をその次に挿入する。
28187      $prevSelected = self.select($(this), $prevSelected);
28188    });
28189    if (selectTable === "cc" && self.anchorAjaxBox) {
28190      self.anchorAjaxBox.closest("body").find(".see.cc-bcc.cc .ajax-selected").show();
28191    }
28192
28193    $prevSelected = undefined;
28194    $el.find(".items .bcc-checkbox input:checkbox").filter(":checked").each(function () {
28195      selectTable = "bcc";
28196      // 複数項目が選択された場合、最初の項目を先頭に挿入し、2個目以降の選択をその次に挿入する。
28197      $prevSelected = self.select($(this), $prevSelected);
28198    });
28199    if (selectTable === "bcc" && self.anchorAjaxBox) {
28200      self.anchorAjaxBox.closest("body").find(".see.cc-bcc.bcc .ajax-selected").show();
28201    }
28202    if (selectTable === null) {
28203      $prevSelected = undefined;
28204      $el.find(".items input:checkbox").filter(":checked").each(function () {
28205        // 複数項目が選択された場合、最初の項目を先頭に挿入し、2個目以降の選択をその次に挿入する。
28206        $prevSelected = self.select($(this), $prevSelected);
28207      });
28208      if (self.anchorAjaxBox) {
28209        self.anchorAjaxBox.closest("dl").find(".ajax-selected").show();
28210      }
28211    }
28212  };
28213
28214  SS_SearchUI.deselect = function (e) {
28215    var $item = $(this);
28216    var selector = $item.closest(".ajax-selected").data('on-deselect');
28217    if (selector) {
28218      selector($item);
28219    } else {
28220      SS_SearchUI.defaultDeselector($item);
28221    }
28222    e.preventDefault();
28223  };
28224
28225  SS_SearchUI.toggleSelectButton = function ($el) {
28226    if (!$el) {
28227      $el = $("#ajax-box");
28228    }
28229
28230    if ($el.find(".items input:checkbox").filter(":checked").size() > 0) {
28231      return $el.find(".select-items").parent("div").show();
28232    } else {
28233      return $el.find(".select-items").parent("div").hide();
28234    }
28235  };
28236
28237  SS_SearchUI.onceRendered = false;
28238
28239  SS_SearchUI.renderOnce = function() {
28240    if (SS_SearchUI.onceRendered) {
28241      return;
28242    }
28243
28244    $(document)
28245      .on("cbox_load", SS_SearchUI.onColorBoxLoaded)
28246      .on("cbox_cleanup", SS_SearchUI.onColorBoxCleanedUp);
28247    SS_SearchUI.onceRendered = true;
28248  };
28249
28250  SS_SearchUI.render = function (box) {
28251    SS_SearchUI.renderOnce();
28252
28253    $(box || document).find(".ajax-selected").each(function () {
28254      var $this = $(this);
28255      SS.justOnce(this, "searchUI", function() {
28256        $this.on("click", "a.deselect", SS_SearchUI.deselect);
28257        if ($this.find("a.deselect").size() === 0) {
28258          $this.hide();
28259        }
28260      });
28261    });
28262  };
28263
28264  SS_SearchUI.onColorBoxLoaded = function (_ev) {
28265    if (!SS_SearchUI.anchorAjaxBox) {
28266      // ファイル選択ダイアログの「編集」ボタンのクリックなどで別のモーダルが表示される場合がある。
28267      // 別のモーダルからキャンセルなどで戻ってきた際に、元々の anchor を利用したい。
28268      // そこで、初回表示時の anchor を記憶しておく。
28269      SS_SearchUI.anchorAjaxBox = $.colorbox.element();
28270    }
28271  };
28272
28273  SS_SearchUI.onColorBoxCleanedUp = function (_ev) {
28274    SS_SearchUI.anchorAjaxBox = null;
28275    selectTable = null;
28276  };
28277
28278  SS_SearchUI.modal = function (options) {
28279    if (!options) {
28280      options = {};
28281    }
28282
28283    var self = this;
28284    var colorbox = options.colorbox || $.colorbox;
28285    var $el = options.$el || $("#ajax-box");
28286
28287    if (SS_SearchUI.dialogType === 'ss') {
28288      $el.find("form.search").attr("data-turbo", true)
28289    }
28290
28291    var isSameWindow = (window == $el[0].ownerDocument.defaultView)
28292    if (isSameWindow) {
28293      $el.find("form.search").on("submit", function (ev) {
28294        var $div = $("<span />", {class: "loading"}).html(SS.loading);
28295        $el.find("[type=submit]").after($div);
28296
28297        if (SS_SearchUI.dialogType !== 'ss') {
28298          $(this).ajaxSubmit({
28299            url: $(this).attr("action"),
28300            success: function (data) {
28301              var $data = $("<div />").html(data);
28302              $.colorbox.prep($data.contents());
28303            },
28304            error: function (_data, _status) {
28305              $div.html("== Error ==");
28306            }
28307          });
28308          ev.preventDefault();
28309          return false;
28310        }
28311      });
28312    }
28313    $el.find(".pagination a").on("click", function (ev) {
28314      self.selectItems($el);
28315
28316      if (isSameWindow) {
28317        $el.find(".pagination").html(SS.loading);
28318
28319        $.ajax({
28320          url: $(this).attr("href"),
28321          type: "GET",
28322          success: function (data) {
28323            $el.closest("#cboxLoadedContent").html(data);
28324          },
28325          error: function (_data, _status) {
28326            $el.find(".pagination").html("== Error ==");
28327          },
28328          complete: function (_xhr, _status) {
28329            $("#cboxContent").trigger("ss:ajaxPagination");
28330          }
28331        });
28332
28333        ev.preventDefault();
28334        return false;
28335      } else {
28336        return true;
28337      }
28338    });
28339    $el.find("#s_group").on("change", function (_ev) {
28340      self.selectItems($el);
28341      return $el.find("form.search")[0].requestSubmit();
28342    });
28343    $el.find(".submit-on-change").on("change", function (_ev) {
28344      self.selectItems($el);
28345      return $el.find("form.search")[0].requestSubmit();
28346    });
28347
28348    if (self.anchorAjaxBox) {
28349      var $ajaxSelected = self.anchorAjaxBox.closest("dl").find(".ajax-selected");
28350      var $toAjaxSelected = self.anchorAjaxBox.closest("body").find(".see.to .ajax-selected");
28351      var $ccAjaxSelected = self.anchorAjaxBox.closest("body").find(".see.cc-bcc.cc .ajax-selected");
28352      var $bcAjaxSelected = self.anchorAjaxBox.closest("body").find(".see.cc-bcc.bcc .ajax-selected");
28353      if (!$ajaxSelected.length) {
28354        $ajaxSelected = self.anchorAjaxBox.parent().find(".ajax-selected");
28355      }
28356      if (!$toAjaxSelected.length) {
28357        $toAjaxSelected = self.anchorAjaxBox.parent().find(".ajax-selected");
28358      }
28359      if (!$ccAjaxSelected.length) {
28360        $ccAjaxSelected = self.anchorAjaxBox.parent().find(".ajax-selected");
28361      }
28362      if (!$bcAjaxSelected.length) {
28363        $bcAjaxSelected = self.anchorAjaxBox.parent().find("see.cc-bcc.bcc .ajax-selected");
28364      }
28365      $toAjaxSelected.find("tr[data-id]").each(function () {
28366        var id = $(this).data("id");
28367        toSelected.push($("#colorbox .items [data-id='" + id + "']"));
28368      });
28369      $ccAjaxSelected.find("tr[data-id]").each(function () {
28370        var id = $(this).data("id");
28371        ccSelected.push($("#colorbox .items [data-id='" + id + "']"));
28372      });
28373      $bcAjaxSelected.find("tr[data-id]").each(function () {
28374        var id = $(this).data("id");
28375        bcSelected.push($("#colorbox .items [data-id='" + id + "']"));
28376      });
28377      $ajaxSelected.find("tr[data-id]").each(function () {
28378        var id = $(this).data("id");
28379        var tr = $("#colorbox .items [data-id='" + id + "']");
28380        var i;
28381        for (i = 0; i < toSelected.length; i++) {
28382          toSelected[i].find(".to-checkbox input[type=checkbox]").remove();
28383        }
28384        for (i = 0; i < ccSelected.length; i++) {
28385          ccSelected[i].find(".cc-checkbox input[type=checkbox]").remove();
28386        }
28387        for (i = 0; i < bcSelected.length; i++) {
28388          bcSelected[i].find(".bcc-checkbox input[type=checkbox]").remove();
28389        }
28390        tr.find(".checkbox input[type=checkbox]").remove();
28391        tr.find(".select-item,.select-single-item").each(function () {
28392          var $this = $(this);
28393          var html = $this.html();
28394
28395          var disabledHtml = $("<span />", {class: $this.prop("class"), style: 'color: #888'}).html(html);
28396          $this.replaceWith(disabledHtml);
28397        });
28398      });
28399      self.anchorAjaxBox.closest("body").find("tr[data-id]").each(function () {
28400        var i;
28401        for (i = 0; i < toSelected.length; i++) {
28402          toSelected[i].find(".to-checkbox input[type=checkbox]").remove();
28403        }
28404        for (i = 0; i < ccSelected.length; i++) {
28405          ccSelected[i].find(".cc-checkbox input[type=checkbox]").remove();
28406        }
28407        for (i = 0; i < bcSelected.length; i++) {
28408          bcSelected[i].find(".bcc-checkbox input[type=checkbox]").remove();
28409        }
28410      });
28411    }
28412    $el.find("table.index").each(function () {
28413      SS_ListUI.render(this);
28414    });
28415    $el.find("a.select-item").on("click", function (ev) {
28416      if (!SS.disableClick($(this))) {
28417        return false;
28418      }
28419      // self.select() を呼び出した際にダイアログが閉じられ self.anchorAjaxBox が null となる可能性があるので、事前に退避しておく。
28420      var ajaxBox = SS_SearchUI.anchorAjaxBox;
28421      //append newly selected item
28422      self.select($(this));
28423      if (ajaxBox) {
28424        ajaxBox.closest("dl").find(".ajax-selected").show();
28425      }
28426      ev.preventDefault();
28427      if (SS_SearchUI.dialogType === "ss") {
28428        SS_SearchUI.dispatchEvent("ss:modal-close")
28429      } else {
28430        colorbox.close();
28431      }
28432      return false;
28433    });
28434    //remove old items
28435    $el.find(".select-single-item").on("click", function (ev) {
28436      if (!SS.disableClick($(this))) {
28437        return false;
28438      }
28439      // self.select() を呼び出した際にダイアログが閉じられ self.anchorAjaxBox が null となる可能性があるので、事前に退避しておく。
28440      var ajaxBox = SS_SearchUI.anchorAjaxBox;
28441      if (ajaxBox) {
28442        ajaxBox.closest("dl").find(".ajax-selected tr[data-id]").each(function () {
28443          if ($(this).find("input[value]").length) {
28444            return $(this).remove();
28445          }
28446        });
28447      }
28448      //append newly selected item
28449      self.select($(this));
28450      if (ajaxBox) {
28451        ajaxBox.closest("dl").find(".ajax-selected").show();
28452      }
28453      ev.preventDefault();
28454      if (SS_SearchUI.dialogType === "ss") {
28455        SS_SearchUI.dispatchEvent("ss:modal-close")
28456      } else {
28457        colorbox.close();
28458      }
28459      return false;
28460    });
28461    $el.find(".select-items").on("click", function (ev) {
28462      if (!SS.disableClick($(this))) {
28463        return false;
28464      }
28465      self.selectItems($el);
28466      ev.preventDefault();
28467      if (SS_SearchUI.dialogType === "ss") {
28468        SS_SearchUI.dispatchEvent("ss:modal-close")
28469      } else {
28470        colorbox.close();
28471      }
28472      return false;
28473    });
28474    $el.find(".index").on("change", function (_ev) {
28475      return self.toggleSelectButton($el);
28476    });
28477    return self.toggleSelectButton($el);
28478  };
28479
28480  return SS_SearchUI;
28481
28482})();
28483this.SS_AjaxFile = (function () {
28484  function SS_AjaxFile(el, options) {
28485    this.$el = $(el || "#ajax-file-box");
28486    this.options = options || {};
28487
28488    this.render();
28489  }
28490
28491  SS_AjaxFile.additionalFileResizings = [];
28492  SS_AjaxFile.firesEvents = false;
28493
28494  SS_AjaxFile.errors = {
28495    entityTooLarge: "request entity is too large"
28496  }
28497
28498  SS_AjaxFile.addFileResizing = function() {
28499    for (var i = 0; i < arguments.length; i++) {
28500      var argument = arguments[i];
28501      if (argument.default) {
28502        for (var j = 0; j < SS_AjaxFile.additionalFileResizings.length; j++) {
28503          if (SS_AjaxFile.additionalFileResizings[j].default) {
28504            SS_AjaxFile.additionalFileResizings[j].default = false;
28505          }
28506        }
28507      }
28508
28509      SS_AjaxFile.additionalFileResizings.push(argument);
28510    }
28511  }
28512
28513  SS_AjaxFile.defaultFileResizing = function () {
28514    for (var i = 0; i < SS_AjaxFile.additionalFileResizings.length; i++) {
28515      if (SS_AjaxFile.additionalFileResizings[i].default) {
28516        return SS_AjaxFile.additionalFileResizings[i].value;
28517      }
28518    }
28519
28520    return null;
28521  };
28522
28523  SS_AjaxFile.defaultFileSelectHandler = function() {
28524    var promisses = [];
28525    var fileViews = [];
28526
28527    for (var i = 0; i < arguments.length; i++) {
28528      var $argument = $(arguments[i]);
28529      var url = $argument.attr('href');
28530      if (!url) {
28531        continue;
28532      }
28533
28534      var filename = $argument.data("humanized-name");
28535
28536      promisses.push($.ajax({
28537        url: url,
28538        success: function(html) {
28539          fileViews.push({ name: filename, html: html });
28540        },
28541        error: function(xhr, _status, _data) {
28542          if (xhr.responseJSON && Array.isArray(xhr.responseJSON)) {
28543            alert(["== Error(AjaxFile) =="].concat(xhr.responseJSON).join("\n"));
28544          } else {
28545            alert(["== Error(AjaxFile) =="].concat(xhr.statusText).join("\n"));
28546          }
28547        }
28548      }));
28549    }
28550
28551    $.when.apply($, promisses).done(function () {
28552      fileViews.sort(function(a,b) {
28553        if (a.name < b.name) return 1;
28554        if (a.name > b.name) return -1;
28555        return 0;
28556      });
28557
28558      for (var i = 0; i < fileViews.length; i++) {
28559        $("#selected-files").prepend(fileViews[i].html).trigger("change");
28560      }
28561
28562      $.colorbox.close();
28563    });
28564  };
28565
28566  SS_AjaxFile.prototype.render = function() {
28567    var self = this;
28568
28569    self.$el.on("submit", "form.user-file", function (ev) {
28570      var submitted = "attach";
28571      if (ev.originalEvent && ev.originalEvent.submitter) {
28572        submitted = ev.originalEvent.submitter.dataset.submitted;
28573      }
28574      var $form = $(this);
28575
28576      var params = {
28577        url: $form.attr("action") + ".json",
28578        dataType: "json",
28579        success: function(data, _textStatus, _xhr) {
28580          self.submitSuccess(submitted, data);
28581        },
28582        error: function (xhr, _status, _error) {
28583          self.submitError(xhr);
28584        },
28585        complete: function (_xhr, _status) {
28586          SS.enableFormElementsOnTimeoutSubmit();
28587        }
28588      };
28589
28590      $form.ajaxSubmit(params);
28591      ev.preventDefault();
28592    });
28593
28594    self.$el.on("click", ".user-files .select", function(ev) {
28595      self.selectFiles(this);
28596
28597      ev.preventDefault();
28598      return false;
28599    });
28600
28601    self.$el.on("click", ".user-files .delete", function(ev) {
28602      ev.preventDefault();
28603      self.deleteFile(ev.target);
28604      return false;
28605    });
28606
28607    for (var i = 0; i < SS_AjaxFile.additionalFileResizings.length; i++) {
28608      var fileResizing = SS_AjaxFile.additionalFileResizings[i];
28609      var option = $('<option />').val(fileResizing.value).text(fileResizing.label);
28610      if (fileResizing.default) {
28611        option.prop('selected', true)
28612      }
28613
28614      self.$el.find('form.user-file .image-size').append(option);
28615    }
28616  };
28617
28618  SS_AjaxFile.prototype.submitSuccess = function(submitted, data) {
28619    var self = this;
28620    var loadUrl = (submitted === "attach") ? self.options.selectedFilesPath : self.options.indexPath;
28621    var indexOptions = self.options.pathOptions || {};
28622
28623    if (submitted === "attach" && Array.isArray(data)) {
28624      var select_ids = $.map(data, function(v) { return v._id });
28625      indexOptions = Object.assign(indexOptions, { select_ids: select_ids });
28626    }
28627
28628    if (Object.keys(indexOptions).length) {
28629      loadUrl += "?" + $.param(indexOptions);
28630    }
28631
28632    $("<div />").load(loadUrl, function () {
28633      var $userFiles = $(this).find(".user-files");
28634      if ($userFiles[0]) {
28635        // TODO: 差分だけをアニメーションつきで insert するとかっこよくなる
28636        self.$el.find(".user-files").html($userFiles.html());
28637        SS.renderInBox(self.$el);
28638      }
28639
28640      self.$el.find("form.user-file [type='file']").val(null).trigger("change");
28641
28642      var defaultImageSize = null;
28643      for (var i = 0; i < SS_AjaxFile.additionalFileResizings.length; i++) {
28644        var fileResizing = SS_AjaxFile.additionalFileResizings[i];
28645        if (fileResizing.default) {
28646          defaultImageSize = fileResizing.value;
28647          break;
28648        }
28649      }
28650      self.$el.find("form.user-file .image-size").val(defaultImageSize).trigger("change");
28651
28652      if (submitted === "attach") {
28653        self.attachFiles(data);
28654      } else {
28655        $.rails.enableFormElements(self.$el.find('form.user-file'));
28656      }
28657    });
28658  };
28659
28660  SS_AjaxFile.prototype.attachFiles = function(data) {
28661    var self = this;
28662
28663    if (!Array.isArray(data) || data.length == 0) {
28664      return;
28665    }
28666
28667    var elements = [];
28668    $.each(data, function(index, file) {
28669      var item = self.$el.find(".user-files [data-id='" + file._id + "'] .select");
28670      elements.push(item);
28671    });
28672
28673    self.selectFiles.apply(self, elements);
28674  };
28675
28676  SS_AjaxFile.prototype.submitError = function(xhr) {
28677    var self = this;
28678    if (xhr.status === 413) {
28679      alert(["== Error(AjaxFile) =="].concat(SS_AjaxFile.errors.entityTooLarge).join("\n"));
28680    } else {
28681      try {
28682        alert(["== Error(AjaxFile) =="].concat(xhr.responseJSON).join("\n"));
28683      } catch(_error) {
28684        alert(["== Error(AjaxFile) =="].concat(xhr.statusText).join("\n"));
28685      }
28686    }
28687
28688    $.rails.enableFormElements(self.$el.find('form.user-file'));
28689  };
28690
28691  SS_AjaxFile.prototype.selectFiles = function() {
28692    if (SS_SearchUI.anchorAjaxBox) {
28693      if (SS_AjaxFile.firesEvents) {
28694        var event = $.Event("ss:ajaxFileSelected");
28695        SS_SearchUI.anchorAjaxBox.trigger(event, [ arguments ]);
28696        if (event.isDefaultPrevented()) {
28697          return;
28698        }
28699      }
28700
28701      var handler = SS_SearchUI.anchorAjaxBox.data('on-select');
28702      if (handler) {
28703        $.each(arguments, function() {
28704          handler($(this));
28705        });
28706
28707        return true;
28708      }
28709    }
28710
28711    SS_AjaxFile.defaultFileSelectHandler.apply(SS_AjaxFile, arguments);
28712  };
28713
28714  SS_AjaxFile.prototype.deleteFile = function(el) {
28715    var confirmMessage = "削除してよろしいですか?";
28716    if ("i18next" in window) {
28717      confirmMessage = i18next.t('ss.confirm.delete')
28718    } else {
28719      confirmMessage = "削除してよろしいですか?";
28720    }
28721    if (!confirm(confirmMessage)) {
28722      return false;
28723    }
28724
28725    var $el = $(el);
28726    $.ajax({
28727      type: "POST",
28728      data: "_method=delete",
28729      url: $el.attr("href") + ".json",
28730      dataType: "json",
28731      beforeSend: function () {
28732        $el.html(SS.loading);
28733      },
28734      success: function () {
28735        var $target;
28736        if ($el.data("remove")) {
28737          $target = $($el.data("remove"));
28738        } else {
28739          $target = $el.closest(".file-view")
28740        }
28741
28742        $target.slideUp("fast", function() {
28743          $target.remove();
28744          if (SS_AjaxFile.firesEvents && SS_SearchUI.anchorAjaxBox) {
28745            SS_SearchUI.anchorAjaxBox.trigger("ss:ajaxRemoved");
28746          }
28747        });
28748      },
28749      error: function (data, _status) {
28750        alert(["== Error(AjaxFile) =="].concat(data.responseJSON).join("\n"));
28751      }
28752    });
28753  };
28754
28755  return SS_AjaxFile;
28756
28757})();
28758this.Chat_Bot = (function () {
28759  function Chat_Bot(el, url) {
28760    this.$el = $(el);
28761    this.url = url;
28762    this.inProgress = false;
28763    this.render();
28764  }
28765
28766  Chat_Bot.prototype.render = function () {
28767    var _this = this;
28768    _this.$el.on("keypress", '.chat-text', function (ev) {
28769      if ((ev.which && ev.which === SS.KEY_ENTER) || (ev.keyCode && ev.keyCode === SS.KEY_ENTER)) {
28770        _this.sendChatRequest($(this));
28771      }
28772    });
28773    _this.$el.on("click", '.chat-button', function () {
28774      _this.sendChatRequest($(this));
28775    });
28776    _this.$el.on("click", '.chat-items', function (ev) {
28777      var $target = $(ev.target);
28778      if ($target.hasClass('chat-suggest')) {
28779        _this.sendChatRequest($(this), { text: $target.text(), value: $target.data("value"), clickSuggest: true });
28780        return false;
28781      } else if ($target.hasClass('chat-success')) {
28782        _this.sendFeedback($target, 'success');
28783        return false;
28784      } else if ($target.hasClass('chat-retry')) {
28785        _this.sendFeedback($target, 'retry');
28786        return false;
28787      }
28788    });
28789    _this.$el.on("click", '.chat-dismiss', function () {
28790      _this.$el.trigger("ss:chatClose");
28791    });
28792  };
28793
28794  Chat_Bot.prototype.fetchFirstMessagenAndSuggestions = function () {
28795    var _this = this;
28796
28797    if (_this.inProgress) {
28798      return;
28799    }
28800
28801    _this.inProgress = true;
28802
28803    $.ajax({
28804      type: "GET",
28805      url: _this.url,
28806      cache: false,
28807      success: function (res, _status) {
28808        _this.renderChatResponse(res);
28809      },
28810      error: function (_xhr, _status, _error) {
28811      },
28812      complete: function(_xhr, _status) {
28813        _this.inProgress = false;
28814      }
28815    });
28816  };
28817
28818  Chat_Bot.prototype.sendChatRequest = function ($el, options) {
28819    var _this = this;
28820    if (_this.inProgress) {
28821      return;
28822    }
28823
28824    _this.inProgress = true;
28825
28826    var $chatText = _this.$el.find('.chat-text');
28827
28828    var text, value;
28829    if (options) {
28830      text = options.text;
28831      value = options.value ? options.value : text;
28832    }
28833    if (!text) {
28834      text = $chatText.val();
28835      value = text;
28836      $chatText.val('');
28837    }
28838    if (!text) {
28839      return false;
28840    }
28841
28842    var $chatItems = _this.$el.find('.chat-items');
28843    $chatItems.append($('<div class="chat-item user"></div>').append(text));
28844    $chatItems.append($('<div class="chat-item in-progress">' + SS.loading + '</div>'));
28845    $chatItems.animate({ scrollTop: $chatItems[0].scrollHeight });
28846    $.ajax({
28847      type: "GET",
28848      url: _this.url,
28849      cache: false,
28850      data: {
28851        text: text,
28852        value: value,
28853        click_suggest: options && options.clickSuggest
28854      },
28855      success: function (res, _status) {
28856        $chatItems.find(".in-progress").remove();
28857        _this.renderChatResponse(res);
28858      },
28859      error: function (_xhr, _status, _error) {
28860        $chatItems.find(".in-progress").remove();
28861      },
28862      complete: function(_xhr, _status) {
28863        $chatItems.find(".in-progress").remove();
28864        _this.inProgress = false;
28865      }
28866    });
28867  };
28868
28869  Chat_Bot.prototype.renderChatResponse = function (res) {
28870    var _this = this;
28871    var $chatItems = _this.$el.find('.chat-items');
28872
28873    var result = res;
28874    if (typeof res === 'string' || res instanceof String) {
28875      result = $.parseJSON(res);
28876    }
28877
28878    $.each(result.results, function (i, r) {
28879      if (!r.response) {
28880        return;
28881      }
28882
28883      var siteSearchParagraph;
28884      if (r.siteSearchUrl) {
28885        var siteSearchLink = $('<a />', { href: r.siteSearchUrl, target: "_blank", rel: "noopener" }).append(result.siteSearchText);
28886        siteSearchParagraph = $('<p />', { class: "search-result-btn" }).append(siteSearchLink);
28887      } else {
28888        siteSearchParagraph = '';
28889      }
28890
28891      if (r.suggests) {
28892        $chatItems.append($('<div class="chat-item sys"></div>').append(r.response).append(siteSearchParagraph));
28893        r.suggests.forEach(function (suggest) {
28894          var chatSuggest = $('<a class="chat-suggest"></a>').attr('href', _this.url).attr('data-value', suggest.value).append(suggest.text);
28895          $chatItems.append($('<div class="chat-item suggest"></div>').append(chatSuggest));
28896        });
28897      } else if (r.question) {
28898        var chatSuccess = $('<button name="button" type="button" class="chat-success" data-id="' + r.id + '"></button>').append(result.chatSuccess);
28899        var chatRetry = $('<button name="button" type="button" class="chat-retry" data-id="' + r.id + '"></button>').append(result.chatRetry);
28900        var chatFinish = $('<div class="chat-finish"></div>').append(r.question).append(chatSuccess).append(chatRetry);
28901        $chatItems.append($('<div class="chat-item sys"></div>').append(r.response).append(siteSearchParagraph).append(chatFinish));
28902      } else {
28903        $chatItems.append($('<div class="chat-item sys"></div>').append(r.response).append(siteSearchParagraph));
28904      }
28905    });
28906
28907    $chatItems.animate({ scrollTop: $chatItems[0].scrollHeight });
28908  };
28909
28910  Chat_Bot.prototype.sendFeedback = function ($el, question) {
28911    var _this = this;
28912    if (_this.inProgress) {
28913      return;
28914    }
28915
28916    _this.inProgress = true;
28917
28918    $.ajax({
28919      type: "GET",
28920      url: _this.url,
28921      cache: false,
28922      data: {
28923        intent_id: $el.data('id'),
28924        question: question || 'success'
28925      },
28926      success: function (res, _status) {
28927        _this.renderFeedback(res);
28928      },
28929      error: function (_xhr, _status, _error) {
28930      },
28931      complete: function(_xhr, _status) {
28932        _this.inProgress = false;
28933      }
28934    });
28935  };
28936
28937  Chat_Bot.prototype.renderFeedback = function (res) {
28938    var _this = this;
28939
28940    var result = res;
28941    if (typeof res === 'string' || res instanceof String) {
28942      result = $.parseJSON(res);
28943    }
28944
28945    var $chatItems = _this.$el.find('.chat-items');
28946
28947    $.each(result.results, function (i, r) {
28948      if (!r.response) {
28949        return;
28950      }
28951
28952      $chatItems.append($('<div class="chat-item sys"></div>').append(r.response));
28953    });
28954
28955    $chatItems.animate({ scrollTop: $chatItems[0].scrollHeight });
28956    setTimeout(_this.fetchFirstMessagenAndSuggestions.bind(_this), 1000)
28957  };
28958
28959  return Chat_Bot;
28960
28961})();
28962this.Cms_Editor_Module = (function () {
28963  function Cms_Editor_Module() {
28964  }
28965
28966  Cms_Editor_Module.editorId = "item_html";
28967
28968  Cms_Editor_Module.getEditorHtml = function (id) {
28969    var html;
28970    if (id == null) {
28971      id = null;
28972    }
28973    id || (id = Cms_Form.editorId);
28974    if (typeof tinymce !== 'undefined') {
28975      html = tinymce.get(id).getContent();
28976    } else if (typeof CKEDITOR !== 'undefined') {
28977      html = CKEDITOR.instances[id].getData();
28978    } else {
28979      html = "";
28980    }
28981    return html;
28982  };
28983
28984  Cms_Editor_Module.setEditorHtml = function (html, opts) {
28985    var id = null;
28986
28987    opts = opts || {};
28988    if (opts["id"]) {
28989      id = opts["id"];
28990    }
28991
28992    id || (id = Cms_Form.editorId);
28993    if (typeof tinymce !== 'undefined') {
28994      return tinymce.get(id).setContent(html);
28995    } else if (typeof CKEDITOR !== 'undefined') {
28996      return CKEDITOR.instances[id].setData(html);
28997    }
28998  };
28999
29000  return Cms_Editor_Module;
29001
29002})();
29003
29004this.Cms_Editor_CodeMirror = (function () {
29005  function Cms_Editor_CodeMirror() {
29006    //Render codeMirror
29007  }
29008
29009  Cms_Editor_CodeMirror.render = function (selector, opts) {
29010    if (opts == null) {
29011      opts = {};
29012    }
29013    return $(selector).each(function () {
29014      var cm, form;
29015      form = $(this);
29016      cm = CodeMirror.fromTextArea(form.get(0), opts);
29017      cm.setSize(null, form.height());
29018      if (opts["readonly"]) {
29019        cm.refresh();
29020      }
29021      return form.data("editor", cm);
29022    });
29023  };
29024
29025  Cms_Editor_CodeMirror.lock = function (selector, target) {
29026    Cms_Editor_CodeMirror.setOption(selector, target);
29027    return $(document).on('change', selector, function (_ev) {
29028      return Cms_Editor_CodeMirror.setOption(selector, target);
29029    });
29030  };
29031
29032  Cms_Editor_CodeMirror.setOption = function (selector, target) {
29033    var cm;
29034    cm = $(target).next('.CodeMirror')[0].CodeMirror;
29035    if ($(selector).val() === '') {
29036      cm.setOption('mode', 'text/html');
29037      return cm.setOption('readOnly', false);
29038    } else {
29039      cm.setOption('mode', 'text/plain');
29040      return cm.setOption('readOnly', true);
29041    }
29042  };
29043
29044  return Cms_Editor_CodeMirror;
29045
29046})();
29047
29048this.Cms_Editor_CKEditor = (function () {
29049  function Cms_Editor_CKEditor() {
29050  }
29051
29052  var onceInitialized = false;
29053
29054  Cms_Editor_CKEditor.initializeOnce = function () {
29055    if (onceInitialized) {
29056      return;
29057    }
29058
29059    onceInitialized = true;
29060
29061    CKEDITOR.on('dialogDefinition', function (ev) {
29062      var def, info, name, text;
29063      name = ev.data.name;
29064      def = ev.data.definition;
29065      if (name === 'table' || name === 'tableProperties') {
29066        info = def.getContents('info');
29067        text = info.get('txtWidth');
29068        text['default'] = "";
29069        text = info.get('txtCellSpace');
29070        text['controlStyle'] = "display: none";
29071        text['label'] = "";
29072        text['default'] = "";
29073        text = info.get('txtCellPad');
29074        text['controlStyle'] = "display: none";
29075        text['label'] = "";
29076        text['default'] = "";
29077        text = info.get('txtBorder');
29078        text['controlStyle'] = "display: none";
29079        text['label'] = "";
29080        text['default'] = "";
29081        text = info.get('txtSummary');
29082        text['controlStyle'] = "display: none";
29083        text['label'] = "";
29084        return text['default'] = "";
29085      }
29086    });
29087
29088    // fix. CKEditor Paste Dialog: github.com/ckeditor/ckeditor4/issues/469
29089    CKEDITOR.on('instanceReady', function (outerEv) {
29090      var elemet = outerEv.editor.element.$;
29091      outerEv.editor.on("change", function () {
29092        var event = new CustomEvent("ss:change", { bubbles: true, cancelable: true, composed: true });
29093        elemet.dispatchEvent(event);
29094      });
29095      outerEv.editor.on("beforeCommandExec", function(innerEv) {
29096        // Show the paste dialog for the paste buttons and right-click paste
29097        if (innerEv.data.name === "paste") {
29098          innerEv.editor._.forcePasteDialog = true;
29099        }
29100        // Don't show the paste dialog for Ctrl+Shift+V
29101        if (innerEv.data.name === "pastetext" && innerEv.data.commandData.from === "keystrokeHandler") {
29102          innerEv.cancel();
29103        }
29104      });
29105    });
29106  }
29107
29108  Cms_Editor_CKEditor.render = function (selector, opts, _jsOpts) {
29109    //Render CKEditor
29110    if (opts == null) {
29111      opts = {};
29112    }
29113
29114    // $(selector).ckeditor(opts);
29115    $(selector).each(function() {
29116      var $this = $(this);
29117      SS.justOnce(this, "ss-editor", function() {
29118        $this.ckeditor(opts);
29119      });
29120    });
29121
29122    Cms_Editor_CKEditor.initializeOnce();
29123  };
29124
29125  Cms_Editor_CKEditor.destroy = function (selector) {
29126    $(selector).each(function() {
29127      var $this = $(this);
29128      var editor = $this.data("ckeditorInstance");
29129      if (editor) {
29130        editor.destroy();
29131      }
29132
29133      SS.deleteJustOnce(this, "ss-editor");
29134    });
29135  };
29136
29137  return Cms_Editor_CKEditor;
29138
29139})();
29140
29141this.Cms_Editor_TinyMCE = (function () {
29142  function Cms_Editor_TinyMCE() {
29143  }
29144
29145  Cms_Editor_TinyMCE.render = function (selector, opts) {
29146    //Render TinyMCE
29147    if (opts == null) {
29148      opts = {};
29149    }
29150    opts["selector"] = selector;
29151    return tinymce.init(opts);
29152  };
29153
29154  return Cms_Editor_TinyMCE;
29155
29156})();
29157this.Ads_Banner = (function () {
29158  function Ads_Banner() {
29159    //landomize banners
29160  }
29161
29162  Ads_Banner.randomize = function (selector) {
29163    var list, wrap;
29164    wrap = $(selector);
29165    list = wrap.find("a").parent("span");
29166    list = list.sort(function () {
29167      return Math.random() - .5;
29168    });
29169    return list.each(function () {
29170      return wrap.append($(this));
29171    });
29172  };
29173
29174  return Ads_Banner;
29175
29176})();
29177this.Event_Monthly = (function () {
29178  function Event_Monthly() {
29179  }
29180
29181  Event_Monthly.render = function () {
29182    $(".event-pages-filter a[data-id!=all]").on('click', function () {
29183      $(".event-pages-filter a[data-id=all]").removeClass("clicked");
29184
29185      if ($(this).hasClass("clicked")) {
29186        $(this).removeClass("clicked");
29187      } else {
29188        $(this).addClass("clicked");
29189      }
29190
29191      var dataIds = [];
29192      $(".event-pages-filter a.clicked").each(function () {
29193        var dataId = parseInt($(this).attr("data-id"));
29194        if (!isNaN(dataId)) {
29195          return dataIds.push(dataId);
29196        }
29197      });
29198
29199      $("#event-list .page").each(function () {
29200        var pageDataIds = [];
29201        $.each($(this).attr("data-id").split(" "), function () {
29202          return pageDataIds.push(parseInt(this));
29203        });
29204
29205        var visible = false;
29206        $.each(dataIds, function () {
29207          if ($.inArray(parseInt(this), pageDataIds) >= 0) {
29208            visible = true;
29209            return false;
29210          }
29211        });
29212
29213        if (visible) {
29214          return $(this).show();
29215        } else {
29216          return $(this).hide();
29217        }
29218      });
29219      return false;
29220    });
29221
29222    $(".event-pages-filter a[data-id=all]").on('click', function () {
29223      if (!$(this).hasClass("clicked")) {
29224        $(this).addClass("clicked");
29225        $(".event-pages-filter a[data-id!=all]").removeClass("clicked");
29226        $("#event-list .page").show();
29227      }
29228      return false;
29229    });
29230  };
29231
29232  return Event_Monthly;
29233
29234})();
29235this.Event_Calendar = (function () {
29236  function Event_Calendar() {
29237  }
29238
29239  Event_Calendar.render = function (url) {
29240    var paginate;
29241    paginate = function (a) {
29242      var month, year;
29243      year = $(a).attr("data-year");
29244      month = $(a).attr("data-month");
29245      return $.ajax({
29246        type: "GET",
29247        url: url + "?year=" + year + "&month=" + month,
29248        cache: false,
29249        success: function (res, _status) {
29250          var html;
29251          html = "<div>" + res + "</div>";
29252          $(".event-calendar").replaceWith($(html).find(".event-calendar"));
29253          $(".calendar-nav a.paginate").on('click', function () {
29254            paginate(this);
29255            return false;
29256          });
29257        },
29258        error: function (_xhr, _status, _error) {
29259        },
29260        complete: function (_xhr, _status) {
29261          $(".event-calendar .calendar").hide().fadeIn('fast');
29262        }
29263      });
29264    };
29265    return $(".calendar-nav a.paginate").on('click', function () {
29266      paginate(this);
29267      return false;
29268    });
29269  };
29270
29271  return Event_Calendar;
29272
29273})();
29274this.Event_Search = (function () {
29275  function Event_Search() {
29276  }
29277
29278  Event_Search.render = function () {
29279    SS.justOnce(this, "event-search", function() {
29280      $("form.event-search .search_clear").on("click", function () {
29281        $(this).parents("form.event-search").each(function() {
29282          $(this).find("input.keyword").val("");
29283          $(this).find("input.prop").prop("checked", false);
29284          $(this).find("input.start").val("");
29285          $(this).find("input.close").val("");
29286          $(this).find("select.facility").val("");
29287          $(this).find("select.sort").val("");
29288        });
29289        return false;
29290      });
29291    });
29292  };
29293
29294  return Event_Search;
29295
29296})();
29297Inquiry_Form = function (options) {
29298  this.options = options;
29299  this.render();
29300};
29301
29302Inquiry_Form.instance = null;
29303
29304Inquiry_Form.render = function(options) {
29305  if (Inquiry_Form.instance) {
29306    return;
29307  }
29308
29309  Inquiry_Form.instance = new Inquiry_Form(options);
29310};
29311
29312Inquiry_Form.prototype.render = function() {
29313  $('.inquiry-form input:not([type="submit"], [type="button"], [type="reset"])').on('keypress', function (ev) {
29314    if ((ev.which && ev.which === SS.KEY_ENTER) || (ev.keyCode && ev.keyCode === SS.KEY_ENTER)) {
29315      return false;
29316    } else {
29317      return true;
29318    }
29319  });
29320
29321  var _this = this;
29322  $(document).on('change', '.form-select input[type="radio"]', function() {
29323    return _this.changeForm();
29324  });
29325
29326  if ($('.form-select').length > 0) {
29327    this.changeForm();
29328  }
29329};
29330
29331Inquiry_Form.prototype.collectSelectFormValues = function() {
29332  var selector;
29333  if (this.options.confirm) {
29334    selector = 'input[type="hidden"]';
29335  } else {
29336    selector = 'input[type="radio"]:checked';
29337  }
29338
29339  var values = [];
29340  $('.form-select ' + selector).each(function() {
29341    var val = $(this).val();
29342    if (values.indexOf(val) < 0) {
29343      values.push(val);
29344    }
29345  });
29346  return values;
29347};
29348
29349Inquiry_Form.prototype.intersect = function(arr1, arr2) {
29350  return arr1.filter(function(el) {
29351    return arr2.indexOf(el) !== -1
29352  });
29353};
29354
29355Inquiry_Form.prototype.changeForm = function() {
29356  var _this = this;
29357  var checkedValues = this.collectSelectFormValues();
29358
29359  $('.select-form-target').each(function() {
29360    if (_this.intersect(checkedValues, $(this).data('select-form')).length > 0) {
29361      // append required label if absent
29362      if ($(this).find('span.required').length === 0) {
29363        var span = $("<span/>").attr('class', 'required').text(_this.options.requiredLabel);
29364        if (_this.options.confirm) {
29365          span.appendTo($(this).children('dt'));
29366        } else {
29367          span.appendTo($(this).children('legend'));
29368        }
29369      }
29370    } else {
29371      // remove required label
29372      $(this).find('span.required').remove();
29373    }
29374  });
29375};
29376/**
29377 * bxSlider v4.2.5
29378 * Copyright 2013-2015 Steven Wanderski
29379 * Written while drinking Belgian ales and listening to jazz
29380
29381 * Licensed under MIT (http://opensource.org/licenses/MIT)
29382 */
29383
29384;(function($) {
29385
29386  var defaults = {
29387
29388    // GENERAL
29389    mode: 'horizontal',
29390    slideSelector: '',
29391    infiniteLoop: true,
29392    hideControlOnEnd: false,
29393    speed: 500,
29394    easing: null,
29395    slideMargin: 0,
29396    startSlide: 0,
29397    randomStart: false,
29398    captions: false,
29399    ticker: false,
29400    tickerHover: false,
29401    adaptiveHeight: false,
29402    adaptiveHeightSpeed: 500,
29403    video: false,
29404    useCSS: true,
29405    preloadImages: 'visible',
29406    responsive: true,
29407    slideZIndex: 50,
29408    wrapperClass: 'bx-wrapper',
29409
29410    // TOUCH
29411    touchEnabled: true,
29412    swipeThreshold: 50,
29413    oneToOneTouch: true,
29414    preventDefaultSwipeX: true,
29415    preventDefaultSwipeY: false,
29416
29417    // ACCESSIBILITY
29418    ariaLive: true,
29419    ariaHidden: true,
29420
29421    // KEYBOARD
29422    keyboardEnabled: false,
29423
29424    // PAGER
29425    pager: true,
29426    pagerType: 'full',
29427    pagerShortSeparator: ' / ',
29428    pagerSelector: null,
29429    buildPager: null,
29430    pagerCustom: null,
29431
29432    // CONTROLS
29433    controls: true,
29434    nextText: 'Next',
29435    prevText: 'Prev',
29436    nextSelector: null,
29437    prevSelector: null,
29438    autoControls: false,
29439    startText: 'Start',
29440    stopText: 'Stop',
29441    autoControlsCombine: false,
29442    autoControlsSelector: null,
29443
29444    // AUTO
29445    auto: false,
29446    pause: 4000,
29447    autoStart: true,
29448    autoDirection: 'next',
29449    stopAutoOnClick: false,
29450    autoHover: false,
29451    autoDelay: 0,
29452    autoSlideForOnePage: false,
29453
29454    // CAROUSEL
29455    minSlides: 1,
29456    maxSlides: 1,
29457    moveSlides: 0,
29458    slideWidth: 0,
29459    shrinkItems: false,
29460
29461    // CALLBACKS
29462    onSliderLoad: function() { return true; },
29463    onSlideBefore: function() { return true; },
29464    onSlideAfter: function() { return true; },
29465    onSlideNext: function() { return true; },
29466    onSlidePrev: function() { return true; },
29467    onSliderResize: function() { return true; }
29468  };
29469
29470  $.fn.bxSlider = function(options) {
29471
29472    if (this.length === 0) {
29473      return this;
29474    }
29475
29476    // support multiple elements
29477    if (this.length > 1) {
29478      this.each(function() {
29479        $(this).bxSlider(options);
29480      });
29481      return this;
29482    }
29483
29484    // create a namespace to be used throughout the plugin
29485    var slider = {},
29486    // set a reference to our slider element
29487    el = this,
29488    // get the original window dimens (thanks a lot IE)
29489    windowWidth = $(window).width(),
29490    windowHeight = $(window).height();
29491
29492    // Return if slider is already initialized
29493    if ($(el).data('bxSlider')) { return; }
29494
29495    /**
29496     * ===================================================================================
29497     * = PRIVATE FUNCTIONS
29498     * ===================================================================================
29499     */
29500
29501    /**
29502     * Initializes namespace settings to be used throughout plugin
29503     */
29504    var init = function() {
29505      // Return if slider is already initialized
29506      if ($(el).data('bxSlider')) { return; }
29507      // merge user-supplied options with the defaults
29508      slider.settings = $.extend({}, defaults, options);
29509      // parse slideWidth setting
29510      slider.settings.slideWidth = parseInt(slider.settings.slideWidth);
29511      // store the original children
29512      slider.children = el.children(slider.settings.slideSelector);
29513      // check if actual number of slides is less than minSlides / maxSlides
29514      if (slider.children.length < slider.settings.minSlides) { slider.settings.minSlides = slider.children.length; }
29515      if (slider.children.length < slider.settings.maxSlides) { slider.settings.maxSlides = slider.children.length; }
29516      // if random start, set the startSlide setting to random number
29517      if (slider.settings.randomStart) { slider.settings.startSlide = Math.floor(Math.random() * slider.children.length); }
29518      // store active slide information
29519      slider.active = { index: slider.settings.startSlide };
vendor: 26,035 bytes, lines 29520-30080
29520      // store if the slider is in carousel mode (displaying / moving multiple slides)
29521      slider.carousel = slider.settings.minSlides > 1 || slider.settings.maxSlides > 1 ? true : false;
29522      // if carousel, force preloadImages = 'all'
29523      if (slider.carousel) { slider.settings.preloadImages = 'all'; }
29524      // calculate the min / max width thresholds based on min / max number of slides
29525      // used to setup and update carousel slides dimensions
29526      slider.minThreshold = (slider.settings.minSlides * slider.settings.slideWidth) + ((slider.settings.minSlides - 1) * slider.settings.slideMargin);
29527      slider.maxThreshold = (slider.settings.maxSlides * slider.settings.slideWidth) + ((slider.settings.maxSlides - 1) * slider.settings.slideMargin);
29528      // store the current state of the slider (if currently animating, working is true)
29529      slider.working = false;
29530      // initialize the controls object
29531      slider.controls = {};
29532      // initialize an auto interval
29533      slider.interval = null;
29534      // determine which property to use for transitions
29535      slider.animProp = slider.settings.mode === 'vertical' ? 'top' : 'left';
29536      // determine if hardware acceleration can be used
29537      slider.usingCSS = slider.settings.useCSS && slider.settings.mode !== 'fade' && (function() {
29538        // create our test div element
29539        var div = document.createElement('div'),
29540        // css transition properties
29541        props = ['WebkitPerspective', 'MozPerspective', 'OPerspective', 'msPerspective'];
29542        // test for each property
29543        for (var i = 0; i < props.length; i++) {
29544          if (div.style[props[i]] !== undefined) {
29545            slider.cssPrefix = props[i].replace('Perspective', '').toLowerCase();
29546            slider.animProp = '-' + slider.cssPrefix + '-transform';
29547            return true;
29548          }
29549        }
29550        return false;
29551      }());
29552      // if vertical mode always make maxSlides and minSlides equal
29553      if (slider.settings.mode === 'vertical') { slider.settings.maxSlides = slider.settings.minSlides; }
29554      // save original style data
29555      el.data('origStyle', el.attr('style'));
29556      el.children(slider.settings.slideSelector).each(function() {
29557        $(this).data('origStyle', $(this).attr('style'));
29558      });
29559
29560      // perform all DOM / CSS modifications
29561      setup();
29562    };
29563
29564    /**
29565     * Performs all DOM and CSS modifications
29566     */
29567    var setup = function() {
29568      var preloadSelector = slider.children.eq(slider.settings.startSlide); // set the default preload selector (visible)
29569
29570      // wrap el in a wrapper
29571      el.wrap('<div class="' + slider.settings.wrapperClass + '"><div class="bx-viewport"></div></div>');
29572      // store a namespace reference to .bx-viewport
29573      slider.viewport = el.parent();
29574
29575      // add aria-live if the setting is enabled and ticker mode is disabled
29576      if (slider.settings.ariaLive && !slider.settings.ticker) {
29577        slider.viewport.attr('aria-live', 'polite');
29578      }
29579      // add a loading div to display while images are loading
29580      slider.loader = $('<div class="bx-loading" />');
29581      slider.viewport.prepend(slider.loader);
29582      // set el to a massive width, to hold any needed slides
29583      // also strip any margin and padding from el
29584      el.css({
29585        width: slider.settings.mode === 'horizontal' ? (slider.children.length * 1000 + 215) + '%' : 'auto',
29586        position: 'relative'
29587      });
29588      // if using CSS, add the easing property
29589      if (slider.usingCSS && slider.settings.easing) {
29590        el.css('-' + slider.cssPrefix + '-transition-timing-function', slider.settings.easing);
29591      // if not using CSS and no easing value was supplied, use the default JS animation easing (swing)
29592      } else if (!slider.settings.easing) {
29593        slider.settings.easing = 'swing';
29594      }
29595      // make modifications to the viewport (.bx-viewport)
29596      slider.viewport.css({
29597        width: '100%',
29598        overflow: 'hidden',
29599        position: 'relative'
29600      });
29601      slider.viewport.parent().css({
29602        maxWidth: getViewportMaxWidth()
29603      });
29604      // make modification to the wrapper (.bx-wrapper)
29605      if (!slider.settings.pager && !slider.settings.controls) {
29606        slider.viewport.parent().css({
29607          margin: '0 auto 0px'
29608        });
29609      }
29610      // apply css to all slider children
29611      slider.children.css({
29612        'float': slider.settings.mode === 'horizontal' ? 'left' : 'none',
29613        listStyle: 'none',
29614        position: 'relative'
29615      });
29616      // apply the calculated width after the float is applied to prevent scrollbar interference
29617      slider.children.css('width', getSlideWidth());
29618      // if slideMargin is supplied, add the css
29619      if (slider.settings.mode === 'horizontal' && slider.settings.slideMargin > 0) { slider.children.css('marginRight', slider.settings.slideMargin); }
29620      if (slider.settings.mode === 'vertical' && slider.settings.slideMargin > 0) { slider.children.css('marginBottom', slider.settings.slideMargin); }
29621      // if "fade" mode, add positioning and z-index CSS
29622      if (slider.settings.mode === 'fade') {
29623        slider.children.css({
29624          position: 'absolute',
29625          zIndex: 0,
29626          display: 'none'
29627        });
29628        // prepare the z-index on the showing element
29629        slider.children.eq(slider.settings.startSlide).css({zIndex: slider.settings.slideZIndex, display: 'block'});
29630      }
29631      // create an element to contain all slider controls (pager, start / stop, etc)
29632      slider.controls.el = $('<div class="bx-controls" />');
29633      // if captions are requested, add them
29634      if (slider.settings.captions) { appendCaptions(); }
29635      // check if startSlide is last slide
29636      slider.active.last = slider.settings.startSlide === getPagerQty() - 1;
29637      // if video is true, set up the fitVids plugin
29638      if (slider.settings.video) { el.fitVids(); }
29639      if (slider.settings.preloadImages === 'all' || slider.settings.ticker) { preloadSelector = slider.children; }
29640      // only check for control addition if not in "ticker" mode
29641      if (!slider.settings.ticker) {
29642        // if controls are requested, add them
29643        if (slider.settings.controls) { appendControls(); }
29644        // if auto is true, and auto controls are requested, add them
29645        if (slider.settings.auto && slider.settings.autoControls) { appendControlsAuto(); }
29646        // if pager is requested, add it
29647        if (slider.settings.pager) { appendPager(); }
29648        // if any control option is requested, add the controls wrapper
29649        if (slider.settings.controls || slider.settings.autoControls || slider.settings.pager) { slider.viewport.after(slider.controls.el); }
29650      // if ticker mode, do not allow a pager
29651      } else {
29652        slider.settings.pager = false;
29653      }
29654      loadElements(preloadSelector, start);
29655    };
29656
29657    var loadElements = function(selector, callback) {
29658      var total = selector.find('img:not([src=""]), iframe').length,
29659      count = 0;
29660      if (total === 0) {
29661        callback();
29662        return;
29663      }
29664      selector.find('img:not([src=""]), iframe').each(function() {
29665        $(this).one('load error', function() {
29666          if (++count === total) { callback(); }
29667        }).each(function() {
29668          if (this.complete) { $(this).load(); }
29669        });
29670      });
29671    };
29672
29673    /**
29674     * Start the slider
29675     */
29676    var start = function() {
29677      // if infinite loop, prepare additional slides
29678      if (slider.settings.infiniteLoop && slider.settings.mode !== 'fade' && !slider.settings.ticker) {
29679        var slice    = slider.settings.mode === 'vertical' ? slider.settings.minSlides : slider.settings.maxSlides,
29680        sliceAppend  = slider.children.slice(0, slice).clone(true).addClass('bx-clone'),
29681        slicePrepend = slider.children.slice(-slice).clone(true).addClass('bx-clone');
29682        if (slider.settings.ariaHidden) {
29683          sliceAppend.attr('aria-hidden', true);
29684          slicePrepend.attr('aria-hidden', true);
29685        }
29686        el.append(sliceAppend).prepend(slicePrepend);
29687      }
29688      // remove the loading DOM element
29689      slider.loader.remove();
29690      // set the left / top position of "el"
29691      setSlidePosition();
29692      // if "vertical" mode, always use adaptiveHeight to prevent odd behavior
29693      if (slider.settings.mode === 'vertical') { slider.settings.adaptiveHeight = true; }
29694      // set the viewport height
29695      slider.viewport.height(getViewportHeight());
29696      // make sure everything is positioned just right (same as a window resize)
29697      el.redrawSlider();
29698      // onSliderLoad callback
29699      slider.settings.onSliderLoad.call(el, slider.active.index);
29700      // slider has been fully initialized
29701      slider.initialized = true;
29702      // bind the resize call to the window
29703      if (slider.settings.responsive) { $(window).bind('resize', resizeWindow); }
29704      // if auto is true and has more than 1 page, start the show
29705      if (slider.settings.auto && slider.settings.autoStart && (getPagerQty() > 1 || slider.settings.autoSlideForOnePage)) { initAuto(); }
29706      // if ticker is true, start the ticker
29707      if (slider.settings.ticker) { initTicker(); }
29708      // if pager is requested, make the appropriate pager link active
29709      if (slider.settings.pager) { updatePagerActive(slider.settings.startSlide); }
29710      // check for any updates to the controls (like hideControlOnEnd updates)
29711      if (slider.settings.controls) { updateDirectionControls(); }
29712      // if touchEnabled is true, setup the touch events
29713      if (slider.settings.touchEnabled && !slider.settings.ticker) { initTouch(); }
29714      // if keyboardEnabled is true, setup the keyboard events
29715      if (slider.settings.keyboardEnabled && !slider.settings.ticker) {
29716        $(document).keydown(keyPress);
29717      }
29718    };
29719
29720    /**
29721     * Returns the calculated height of the viewport, used to determine either adaptiveHeight or the maxHeight value
29722     */
29723    var getViewportHeight = function() {
29724      var height = 0;
29725      // first determine which children (slides) should be used in our height calculation
29726      var children = $();
29727      // if mode is not "vertical" and adaptiveHeight is false, include all children
29728      if (slider.settings.mode !== 'vertical' && !slider.settings.adaptiveHeight) {
29729        children = slider.children;
29730      } else {
29731        // if not carousel, return the single active child
29732        if (!slider.carousel) {
29733          children = slider.children.eq(slider.active.index);
29734        // if carousel, return a slice of children
29735        } else {
29736          // get the individual slide index
29737          var currentIndex = slider.settings.moveSlides === 1 ? slider.active.index : slider.active.index * getMoveBy();
29738          // add the current slide to the children
29739          children = slider.children.eq(currentIndex);
29740          // cycle through the remaining "showing" slides
29741          for (i = 1; i <= slider.settings.maxSlides - 1; i++) {
29742            // if looped back to the start
29743            if (currentIndex + i >= slider.children.length) {
29744              children = children.add(slider.children.eq(i - 1));
29745            } else {
29746              children = children.add(slider.children.eq(currentIndex + i));
29747            }
29748          }
29749        }
29750      }
29751      // if "vertical" mode, calculate the sum of the heights of the children
29752      if (slider.settings.mode === 'vertical') {
29753        children.each(function(index) {
29754          height += $(this).outerHeight();
29755        });
29756        // add user-supplied margins
29757        if (slider.settings.slideMargin > 0) {
29758          height += slider.settings.slideMargin * (slider.settings.minSlides - 1);
29759        }
29760      // if not "vertical" mode, calculate the max height of the children
29761      } else {
29762        height = Math.max.apply(Math, children.map(function() {
29763          return $(this).outerHeight(false);
29764        }).get());
29765      }
29766
29767      if (slider.viewport.css('box-sizing') === 'border-box') {
29768        height += parseFloat(slider.viewport.css('padding-top')) + parseFloat(slider.viewport.css('padding-bottom')) +
29769              parseFloat(slider.viewport.css('border-top-width')) + parseFloat(slider.viewport.css('border-bottom-width'));
29770      } else if (slider.viewport.css('box-sizing') === 'padding-box') {
29771        height += parseFloat(slider.viewport.css('padding-top')) + parseFloat(slider.viewport.css('padding-bottom'));
29772      }
29773
29774      return height;
29775    };
29776
29777    /**
29778     * Returns the calculated width to be used for the outer wrapper / viewport
29779     */
29780    var getViewportMaxWidth = function() {
29781      var width = '100%';
29782      if (slider.settings.slideWidth > 0) {
29783        if (slider.settings.mode === 'horizontal') {
29784          width = (slider.settings.maxSlides * slider.settings.slideWidth) + ((slider.settings.maxSlides - 1) * slider.settings.slideMargin);
29785        } else {
29786          width = slider.settings.slideWidth;
29787        }
29788      }
29789      return width;
29790    };
29791
29792    /**
29793     * Returns the calculated width to be applied to each slide
29794     */
29795    var getSlideWidth = function() {
29796      var newElWidth = slider.settings.slideWidth, // start with any user-supplied slide width
29797      wrapWidth      = slider.viewport.width();    // get the current viewport width
29798      // if slide width was not supplied, or is larger than the viewport use the viewport width
29799      if (slider.settings.slideWidth === 0 ||
29800        (slider.settings.slideWidth > wrapWidth && !slider.carousel) ||
29801        slider.settings.mode === 'vertical') {
29802        newElWidth = wrapWidth;
29803      // if carousel, use the thresholds to determine the width
29804      } else if (slider.settings.maxSlides > 1 && slider.settings.mode === 'horizontal') {
29805        if (wrapWidth > slider.maxThreshold) {
29806          return newElWidth;
29807        } else if (wrapWidth < slider.minThreshold) {
29808          newElWidth = (wrapWidth - (slider.settings.slideMargin * (slider.settings.minSlides - 1))) / slider.settings.minSlides;
29809        } else if (slider.settings.shrinkItems) {
29810          newElWidth = Math.floor((wrapWidth + slider.settings.slideMargin) / (Math.ceil((wrapWidth + slider.settings.slideMargin) / (newElWidth + slider.settings.slideMargin))) - slider.settings.slideMargin);
29811        }
29812      }
29813      return newElWidth;
29814    };
29815
29816    /**
29817     * Returns the number of slides currently visible in the viewport (includes partially visible slides)
29818     */
29819    var getNumberSlidesShowing = function() {
29820      var slidesShowing = 1,
29821      childWidth = null;
29822      if (slider.settings.mode === 'horizontal' && slider.settings.slideWidth > 0) {
29823        // if viewport is smaller than minThreshold, return minSlides
29824        if (slider.viewport.width() < slider.minThreshold) {
29825          slidesShowing = slider.settings.minSlides;
29826        // if viewport is larger than maxThreshold, return maxSlides
29827        } else if (slider.viewport.width() > slider.maxThreshold) {
29828          slidesShowing = slider.settings.maxSlides;
29829        // if viewport is between min / max thresholds, divide viewport width by first child width
29830        } else {
29831          childWidth = slider.children.first().width() + slider.settings.slideMargin;
29832          slidesShowing = Math.floor((slider.viewport.width() +
29833            slider.settings.slideMargin) / childWidth);
29834        }
29835      // if "vertical" mode, slides showing will always be minSlides
29836      } else if (slider.settings.mode === 'vertical') {
29837        slidesShowing = slider.settings.minSlides;
29838      }
29839      return slidesShowing;
29840    };
29841
29842    /**
29843     * Returns the number of pages (one full viewport of slides is one "page")
29844     */
29845    var getPagerQty = function() {
29846      var pagerQty = 0,
29847      breakPoint = 0,
29848      counter = 0;
29849      // if moveSlides is specified by the user
29850      if (slider.settings.moveSlides > 0) {
29851        if (slider.settings.infiniteLoop) {
29852          pagerQty = Math.ceil(slider.children.length / getMoveBy());
29853        } else {
29854          // when breakpoint goes above children length, counter is the number of pages
29855          while (breakPoint < slider.children.length) {
29856            ++pagerQty;
29857            breakPoint = counter + getNumberSlidesShowing();
29858            counter += slider.settings.moveSlides <= getNumberSlidesShowing() ? slider.settings.moveSlides : getNumberSlidesShowing();
29859          }
29860        }
29861      // if moveSlides is 0 (auto) divide children length by sides showing, then round up
29862      } else {
29863        pagerQty = Math.ceil(slider.children.length / getNumberSlidesShowing());
29864      }
29865      return pagerQty;
29866    };
29867
29868    /**
29869     * Returns the number of individual slides by which to shift the slider
29870     */
29871    var getMoveBy = function() {
29872      // if moveSlides was set by the user and moveSlides is less than number of slides showing
29873      if (slider.settings.moveSlides > 0 && slider.settings.moveSlides <= getNumberSlidesShowing()) {
29874        return slider.settings.moveSlides;
29875      }
29876      // if moveSlides is 0 (auto)
29877      return getNumberSlidesShowing();
29878    };
29879
29880    /**
29881     * Sets the slider's (el) left or top position
29882     */
29883    var setSlidePosition = function() {
29884      var position, lastChild, lastShowingIndex;
29885      // if last slide, not infinite loop, and number of children is larger than specified maxSlides
29886      if (slider.children.length > slider.settings.maxSlides && slider.active.last && !slider.settings.infiniteLoop) {
29887        if (slider.settings.mode === 'horizontal') {
29888          // get the last child's position
29889          lastChild = slider.children.last();
29890          position = lastChild.position();
29891          // set the left position
29892          setPositionProperty(-(position.left - (slider.viewport.width() - lastChild.outerWidth())), 'reset', 0);
29893        } else if (slider.settings.mode === 'vertical') {
29894          // get the last showing index's position
29895          lastShowingIndex = slider.children.length - slider.settings.minSlides;
29896          position = slider.children.eq(lastShowingIndex).position();
29897          // set the top position
29898          setPositionProperty(-position.top, 'reset', 0);
29899        }
29900      // if not last slide
29901      } else {
29902        // get the position of the first showing slide
29903        position = slider.children.eq(slider.active.index * getMoveBy()).position();
29904        // check for last slide
29905        if (slider.active.index === getPagerQty() - 1) { slider.active.last = true; }
29906        // set the respective position
29907        if (position !== undefined) {
29908          if (slider.settings.mode === 'horizontal') { setPositionProperty(-position.left, 'reset', 0); }
29909          else if (slider.settings.mode === 'vertical') { setPositionProperty(-position.top, 'reset', 0); }
29910        }
29911      }
29912    };
29913
29914    /**
29915     * Sets the el's animating property position (which in turn will sometimes animate el).
29916     * If using CSS, sets the transform property. If not using CSS, sets the top / left property.
29917     *
29918     * @param value (int)
29919     *  - the animating property's value
29920     *
29921     * @param type (string) 'slide', 'reset', 'ticker'
29922     *  - the type of instance for which the function is being
29923     *
29924     * @param duration (int)
29925     *  - the amount of time (in ms) the transition should occupy
29926     *
29927     * @param params (array) optional
29928     *  - an optional parameter containing any variables that need to be passed in
29929     */
29930    var setPositionProperty = function(value, type, duration, params) {
29931      var animateObj, propValue;
29932      // use CSS transform
29933      if (slider.usingCSS) {
29934        // determine the translate3d value
29935        propValue = slider.settings.mode === 'vertical' ? 'translate3d(0, ' + value + 'px, 0)' : 'translate3d(' + value + 'px, 0, 0)';
29936        // add the CSS transition-duration
29937        el.css('-' + slider.cssPrefix + '-transition-duration', duration / 1000 + 's');
29938        if (type === 'slide') {
29939          // set the property value
29940          el.css(slider.animProp, propValue);
29941          if (duration !== 0) {
29942            // bind a callback method - executes when CSS transition completes
29943            el.bind('transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd', function(e) {
29944              //make sure it's the correct one
29945              if (!$(e.target).is(el)) { return; }
29946              // unbind the callback
29947              el.unbind('transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd');
29948              updateAfterSlideTransition();
29949            });
29950          } else { //duration = 0
29951            updateAfterSlideTransition();
29952          }
29953        } else if (type === 'reset') {
29954          el.css(slider.animProp, propValue);
29955        } else if (type === 'ticker') {
29956          // make the transition use 'linear'
29957          el.css('-' + slider.cssPrefix + '-transition-timing-function', 'linear');
29958          el.css(slider.animProp, propValue);
29959          if (duration !== 0) {
29960            el.bind('transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd', function(e) {
29961              //make sure it's the correct one
29962              if (!$(e.target).is(el)) { return; }
29963              // unbind the callback
29964              el.unbind('transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd');
29965              // reset the position
29966              setPositionProperty(params.resetValue, 'reset', 0);
29967              // start the loop again
29968              tickerLoop();
29969            });
29970          } else { //duration = 0
29971            setPositionProperty(params.resetValue, 'reset', 0);
29972            tickerLoop();
29973          }
29974        }
29975      // use JS animate
29976      } else {
29977        animateObj = {};
29978        animateObj[slider.animProp] = value;
29979        if (type === 'slide') {
29980          el.animate(animateObj, duration, slider.settings.easing, function() {
29981            updateAfterSlideTransition();
29982          });
29983        } else if (type === 'reset') {
29984          el.css(slider.animProp, value);
29985        } else if (type === 'ticker') {
29986          el.animate(animateObj, duration, 'linear', function() {
29987            setPositionProperty(params.resetValue, 'reset', 0);
29988            // run the recursive loop after animation
29989            tickerLoop();
29990          });
29991        }
29992      }
29993    };
29994
29995    /**
29996     * Populates the pager with proper amount of pages
29997     */
29998    var populatePager = function() {
29999      var pagerHtml = '',
30000      linkContent = '',
30001      pagerQty = getPagerQty();
30002      // loop through each pager item
30003      for (var i = 0; i < pagerQty; i++) {
30004        linkContent = '';
30005        // if a buildPager function is supplied, use it to get pager link value, else use index + 1
30006        if (slider.settings.buildPager && $.isFunction(slider.settings.buildPager) || slider.settings.pagerCustom) {
30007          linkContent = slider.settings.buildPager(i);
30008          slider.pagerEl.addClass('bx-custom-pager');
30009        } else {
30010          linkContent = i + 1;
30011          slider.pagerEl.addClass('bx-default-pager');
30012        }
30013        // var linkContent = slider.settings.buildPager && $.isFunction(slider.settings.buildPager) ? slider.settings.buildPager(i) : i + 1;
30014        // add the markup to the string
30015        pagerHtml += '<div class="bx-pager-item"><a href="" data-slide-index="' + i + '" class="bx-pager-link">' + linkContent + '</a></div>';
30016      }
30017      // populate the pager element with pager links
30018      slider.pagerEl.html(pagerHtml);
30019    };
30020
30021    /**
30022     * Appends the pager to the controls element
30023     */
30024    var appendPager = function() {
30025      if (!slider.settings.pagerCustom) {
30026        // create the pager DOM element
30027        slider.pagerEl = $('<div class="bx-pager" />');
30028        // if a pager selector was supplied, populate it with the pager
30029        if (slider.settings.pagerSelector) {
30030          $(slider.settings.pagerSelector).html(slider.pagerEl);
30031        // if no pager selector was supplied, add it after the wrapper
30032        } else {
30033          slider.controls.el.addClass('bx-has-pager').append(slider.pagerEl);
30034        }
30035        // populate the pager
30036        populatePager();
30037      } else {
30038        slider.pagerEl = $(slider.settings.pagerCustom);
30039      }
30040      // assign the pager click binding
30041      slider.pagerEl.on('click touchend', 'a', clickPagerBind);
30042    };
30043
30044    /**
30045     * Appends prev / next controls to the controls element
30046     */
30047    var appendControls = function() {
30048      slider.controls.next = $('<a class="bx-next" href="">' + slider.settings.nextText + '</a>');
30049      slider.controls.prev = $('<a class="bx-prev" href="">' + slider.settings.prevText + '</a>');
30050      // bind click actions to the controls
30051      slider.controls.next.bind('click touchend', clickNextBind);
30052      slider.controls.prev.bind('click touchend', clickPrevBind);
30053      // if nextSelector was supplied, populate it
30054      if (slider.settings.nextSelector) {
30055        $(slider.settings.nextSelector).append(slider.controls.next);
30056      }
30057      // if prevSelector was supplied, populate it
30058      if (slider.settings.prevSelector) {
30059        $(slider.settings.prevSelector).append(slider.controls.prev);
30060      }
30061      // if no custom selectors were supplied
30062      if (!slider.settings.nextSelector && !slider.settings.prevSelector) {
30063        // add the controls to the DOM
30064        slider.controls.directionEl = $('<div class="bx-controls-direction" />');
30065        // add the control elements to the directionEl
30066        slider.controls.directionEl.append(slider.controls.prev).append(slider.controls.next);
30067        // slider.viewport.append(slider.controls.directionEl);
30068        slider.controls.el.addClass('bx-has-controls-direction').append(slider.controls.directionEl);
30069      }
30070    };
30071
30072    /**
30073     * Appends start / stop auto controls to the controls element
30074     */
30075    var appendControlsAuto = function() {
30076      slider.controls.start = $('<div class="bx-controls-auto-item"><a class="bx-start" href="">' + slider.settings.startText + '</a></div>');
30077      slider.controls.stop = $('<div class="bx-controls-auto-item"><a class="bx-stop" href="">' + slider.settings.stopText + '</a></div>');
30078      // add the controls to the DOM
30079      slider.controls.autoEl = $('<div class="bx-controls-auto" />');
30080      // bind
vendor: 7,154 bytes, lines 30080-30278
30080 click actions to the controls
30081      slider.controls.autoEl.on('click', '.bx-start', clickStartBind);
30082      slider.controls.autoEl.on('click', '.bx-stop', clickStopBind);
30083      // if autoControlsCombine, insert only the "start" control
30084      if (slider.settings.autoControlsCombine) {
30085        slider.controls.autoEl.append(slider.controls.start);
30086      // if autoControlsCombine is false, insert both controls
30087      } else {
30088        slider.controls.autoEl.append(slider.controls.start).append(slider.controls.stop);
30089      }
30090      // if auto controls selector was supplied, populate it with the controls
30091      if (slider.settings.autoControlsSelector) {
30092        $(slider.settings.autoControlsSelector).html(slider.controls.autoEl);
30093      // if auto controls selector was not supplied, add it after the wrapper
30094      } else {
30095        slider.controls.el.addClass('bx-has-controls-auto').append(slider.controls.autoEl);
30096      }
30097      // update the auto controls
30098      updateAutoControls(slider.settings.autoStart ? 'stop' : 'start');
30099    };
30100
30101    /**
30102     * Appends image captions to the DOM
30103     */
30104    var appendCaptions = function() {
30105      // cycle through each child
30106      slider.children.each(function(index) {
30107        // get the image title attribute
30108        var title = $(this).find('img:first').attr('title');
30109        // append the caption
30110        if (title !== undefined && ('' + title).length) {
30111          $(this).append('<div class="bx-caption"><span>' + title + '</span></div>');
30112        }
30113      });
30114    };
30115
30116    /**
30117     * Click next binding
30118     *
30119     * @param e (event)
30120     *  - DOM event object
30121     */
30122    var clickNextBind = function(e) {
30123      e.preventDefault();
30124      if (slider.controls.el.hasClass('disabled')) { return; }
30125      // if auto show is running, stop it
30126      if (slider.settings.auto && slider.settings.stopAutoOnClick) { el.stopAuto(); }
30127      el.goToNextSlide();
30128    };
30129
30130    /**
30131     * Click prev binding
30132     *
30133     * @param e (event)
30134     *  - DOM event object
30135     */
30136    var clickPrevBind = function(e) {
30137      e.preventDefault();
30138      if (slider.controls.el.hasClass('disabled')) { return; }
30139      // if auto show is running, stop it
30140      if (slider.settings.auto && slider.settings.stopAutoOnClick) { el.stopAuto(); }
30141      el.goToPrevSlide();
30142    };
30143
30144    /**
30145     * Click start binding
30146     *
30147     * @param e (event)
30148     *  - DOM event object
30149     */
30150    var clickStartBind = function(e) {
30151      el.startAuto();
30152      e.preventDefault();
30153    };
30154
30155    /**
30156     * Click stop binding
30157     *
30158     * @param e (event)
30159     *  - DOM event object
30160     */
30161    var clickStopBind = function(e) {
30162      el.stopAuto();
30163      e.preventDefault();
30164    };
30165
30166    /**
30167     * Click pager binding
30168     *
30169     * @param e (event)
30170     *  - DOM event object
30171     */
30172    var clickPagerBind = function(e) {
30173      var pagerLink, pagerIndex;
30174      e.preventDefault();
30175      if (slider.controls.el.hasClass('disabled')) {
30176        return;
30177      }
30178      // if auto show is running, stop it
30179      if (slider.settings.auto  && slider.settings.stopAutoOnClick) { el.stopAuto(); }
30180      pagerLink = $(e.currentTarget);
30181      if (pagerLink.attr('data-slide-index') !== undefined) {
30182        pagerIndex = parseInt(pagerLink.attr('data-slide-index'));
30183        // if clicked pager link is not active, continue with the goToSlide call
30184        if (pagerIndex !== slider.active.index) { el.goToSlide(pagerIndex); }
30185      }
30186    };
30187
30188    /**
30189     * Updates the pager links with an active class
30190     *
30191     * @param slideIndex (int)
30192     *  - index of slide to make active
30193     */
30194    var updatePagerActive = function(slideIndex) {
30195      // if "short" pager type
30196      var len = slider.children.length; // nb of children
30197      if (slider.settings.pagerType === 'short') {
30198        if (slider.settings.maxSlides > 1) {
30199          len = Math.ceil(slider.children.length / slider.settings.maxSlides);
30200        }
30201        slider.pagerEl.html((slideIndex + 1) + slider.settings.pagerShortSeparator + len);
30202        return;
30203      }
30204      // remove all pager active classes
30205      slider.pagerEl.find('a').removeClass('active');
30206      // apply the active class for all pagers
30207      slider.pagerEl.each(function(i, el) { $(el).find('a').eq(slideIndex).addClass('active'); });
30208    };
30209
30210    /**
30211     * Performs needed actions after a slide transition
30212     */
30213    var updateAfterSlideTransition = function() {
30214      // if infinite loop is true
30215      if (slider.settings.infiniteLoop) {
30216        var position = '';
30217        // first slide
30218        if (slider.active.index === 0) {
30219          // set the new position
30220          position = slider.children.eq(0).position();
30221        // carousel, last slide
30222        } else if (slider.active.index === getPagerQty() - 1 && slider.carousel) {
30223          position = slider.children.eq((getPagerQty() - 1) * getMoveBy()).position();
30224        // last slide
30225        } else if (slider.active.index === slider.children.length - 1) {
30226          position = slider.children.eq(slider.children.length - 1).position();
30227        }
30228        if (position) {
30229          if (slider.settings.mode === 'horizontal') { setPositionProperty(-position.left, 'reset', 0); }
30230          else if (slider.settings.mode === 'vertical') { setPositionProperty(-position.top, 'reset', 0); }
30231        }
30232      }
30233      // declare that the transition is complete
30234      slider.working = false;
30235      // onSlideAfter callback
30236      slider.settings.onSlideAfter.call(el, slider.children.eq(slider.active.index), slider.oldIndex, slider.active.index);
30237    };
30238
30239    /**
30240     * Updates the auto controls state (either active, or combined switch)
30241     *
30242     * @param state (string) "start", "stop"
30243     *  - the new state of the auto show
30244     */
30245    var updateAutoControls = function(state) {
30246      // if autoControlsCombine is true, replace the current control with the new state
30247      if (slider.settings.autoControlsCombine) {
30248        slider.controls.autoEl.html(slider.controls[state]);
30249      // if autoControlsCombine is false, apply the "active" class to the appropriate control
30250      } else {
30251        slider.controls.autoEl.find('a').removeClass('active');
30252        slider.controls.autoEl.find('a:not(.bx-' + state + ')').addClass('active');
30253      }
30254    };
30255
30256    /**
30257     * Updates the direction controls (checks if either should be hidden)
30258     */
30259    var updateDirectionControls = function() {
30260      if (getPagerQty() === 1) {
30261        slider.controls.prev.addClass('disabled');
30262        slider.controls.next.addClass('disabled');
30263      } else if (!slider.settings.infiniteLoop && slider.settings.hideControlOnEnd) {
30264        // if first slide
30265        if (slider.active.index === 0) {
30266          slider.controls.prev.addClass('disabled');
30267          slider.controls.next.removeClass('disabled');
30268        // if last slide
30269        } else if (slider.active.index === getPagerQty() - 1) {
30270          slider.controls.next.addClass('disabled');
30271          slider.controls.prev.removeClass('disabled');
30272        // if any slide in the middle
30273        } else {
30274          slider.controls.prev.removeClass('disabled');
30275          slider.controls.next.removeClass('disabled');
30276        }
30277      }
30278    };
30279
30280    /**
30281     * Initializes the auto process
30282     */
30283    var initAuto = function() {
30284      // if autoDelay was supplied, launch the auto show using a setTimeout() call
30285      if (slider.settings.autoDelay > 0) {
30286        var timeout = setTimeout(el.startAuto, slider.settings.autoDelay);
30287      // if autoDelay was not supplied, start the auto show normally
30288      } else {
30289        el.startAuto();
30290
30291        //add focus and blur events to ensure its running if timeout gets paused
30292        $(window).focus(function() {
30293          el.startAuto();
30294        }).blur(function() {
30295          el.stopAuto();
30296        }
vendor: 6,234 bytes, lines 30296-30456
30296);
30297      }
30298      // if autoHover is requested
30299      if (slider.settings.autoHover) {
30300        // on el hover
30301        el.hover(function() {
30302          // if the auto show is currently playing (has an active interval)
30303          if (slider.interval) {
30304            // stop the auto show and pass true argument which will prevent control update
30305            el.stopAuto(true);
30306            // create a new autoPaused value which will be used by the relative "mouseout" event
30307            slider.autoPaused = true;
30308          }
30309        }, function() {
30310          // if the autoPaused value was created be the prior "mouseover" event
30311          if (slider.autoPaused) {
30312            // start the auto show and pass true argument which will prevent control update
30313            el.startAuto(true);
30314            // reset the autoPaused value
30315            slider.autoPaused = null;
30316          }
30317        });
30318      }
30319    };
30320
30321    /**
30322     * Initializes the ticker process
30323     */
30324    var initTicker = function() {
30325      var startPosition = 0,
30326      position, transform, value, idx, ratio, property, newSpeed, totalDimens;
30327      // if autoDirection is "next", append a clone of the entire slider
30328      if (slider.settings.autoDirection === 'next') {
30329        el.append(slider.children.clone().addClass('bx-clone'));
30330      // if autoDirection is "prev", prepend a clone of the entire slider, and set the left position
30331      } else {
30332        el.prepend(slider.children.clone().addClass('bx-clone'));
30333        position = slider.children.first().position();
30334        startPosition = slider.settings.mode === 'horizontal' ? -position.left : -position.top;
30335      }
30336      setPositionProperty(startPosition, 'reset', 0);
30337      // do not allow controls in ticker mode
30338      slider.settings.pager = false;
30339      slider.settings.controls = false;
30340      slider.settings.autoControls = false;
30341      // if autoHover is requested
30342      if (slider.settings.tickerHover) {
30343        if (slider.usingCSS) {
30344          idx = slider.settings.mode === 'horizontal' ? 4 : 5;
30345          slider.viewport.hover(function() {
30346            transform = el.css('-' + slider.cssPrefix + '-transform');
30347            value = parseFloat(transform.split(',')[idx]);
30348            setPositionProperty(value, 'reset', 0);
30349          }, function() {
30350            totalDimens = 0;
30351            slider.children.each(function(index) {
30352              totalDimens += slider.settings.mode === 'horizontal' ? $(this).outerWidth(true) : $(this).outerHeight(true);
30353            });
30354            // calculate the speed ratio (used to determine the new speed to finish the paused animation)
30355            ratio = slider.settings.speed / totalDimens;
30356            // determine which property to use
30357            property = slider.settings.mode === 'horizontal' ? 'left' : 'top';
30358            // calculate the new speed
30359            newSpeed = ratio * (totalDimens - (Math.abs(parseInt(value))));
30360            tickerLoop(newSpeed);
30361          });
30362        } else {
30363          // on el hover
30364          slider.viewport.hover(function() {
30365            el.stop();
30366          }, function() {
30367            // calculate the total width of children (used to calculate the speed ratio)
30368            totalDimens = 0;
30369            slider.children.each(function(index) {
30370              totalDimens += slider.settings.mode === 'horizontal' ? $(this).outerWidth(true) : $(this).outerHeight(true);
30371            });
30372            // calculate the speed ratio (used to determine the new speed to finish the paused animation)
30373            ratio = slider.settings.speed / totalDimens;
30374            // determine which property to use
30375            property = slider.settings.mode === 'horizontal' ? 'left' : 'top';
30376            // calculate the new speed
30377            newSpeed = ratio * (totalDimens - (Math.abs(parseInt(el.css(property)))));
30378            tickerLoop(newSpeed);
30379          });
30380        }
30381      }
30382      // start the ticker loop
30383      tickerLoop();
30384    };
30385
30386    /**
30387     * Runs a continuous loop, news ticker-style
30388     */
30389    var tickerLoop = function(resumeSpeed) {
30390      var speed = resumeSpeed ? resumeSpeed : slider.settings.speed,
30391      position = {left: 0, top: 0},
30392      reset = {left: 0, top: 0},
30393      animateProperty, resetValue, params;
30394
30395      // if "next" animate left position to last child, then reset left to 0
30396      if (slider.settings.autoDirection === 'next') {
30397        position = el.find('.bx-clone').first().position();
30398      // if "prev" animate left position to 0, then reset left to first non-clone child
30399      } else {
30400        reset = slider.children.first().position();
30401      }
30402      animateProperty = slider.settings.mode === 'horizontal' ? -position.left : -position.top;
30403      resetValue = slider.settings.mode === 'horizontal' ? -reset.left : -reset.top;
30404      params = {resetValue: resetValue};
30405      setPositionProperty(animateProperty, 'ticker', speed, params);
30406    };
30407
30408    /**
30409     * Check if el is on screen
30410     */
30411    var isOnScreen = function(el) {
30412      var win = $(window),
30413      viewport = {
30414        top: win.scrollTop(),
30415        left: win.scrollLeft()
30416      },
30417      bounds = el.offset();
30418
30419      viewport.right = viewport.left + win.width();
30420      viewport.bottom = viewport.top + win.height();
30421      bounds.right = bounds.left + el.outerWidth();
30422      bounds.bottom = bounds.top + el.outerHeight();
30423
30424      return (!(viewport.right < bounds.left || viewport.left > bounds.right || viewport.bottom < bounds.top || viewport.top > bounds.bottom));
30425    };
30426
30427    /**
30428     * Initializes keyboard events
30429     */
30430    var keyPress = function(e) {
30431      var activeElementTag = document.activeElement.tagName.toLowerCase(),
30432      tagFilters = 'input|textarea',
30433      p = new RegExp(activeElementTag,['i']),
30434      result = p.exec(tagFilters);
30435
30436      if (result == null && isOnScreen(el)) {
30437        if (e.keyCode === 39) {
30438          clickNextBind(e);
30439          return false;
30440        } else if (e.keyCode === 37) {
30441          clickPrevBind(e);
30442          return false;
30443        }
30444      }
30445    };
30446
30447    /**
30448     * Initializes touch events
30449     */
30450    var initTouch = function() {
30451      // initialize object to contain all touch values
30452      slider.touch = {
30453        start: {x: 0, y: 0},
30454        end: {x: 0, y: 0}
30455      };
30456      slider.viewport.
vendor: 6,558 bytes, lines 30456-30617
30456bind('touchstart MSPointerDown pointerdown', onTouchStart);
30457
30458      //for browsers that have implemented pointer events and fire a click after
30459      //every pointerup regardless of whether pointerup is on same screen location as pointerdown or not
30460      slider.viewport.on('click', '.bxslider a', function(e) {
30461        if (slider.viewport.hasClass('click-disabled')) {
30462          e.preventDefault();
30463          slider.viewport.removeClass('click-disabled');
30464        }
30465      });
30466    };
30467
30468    /**
30469     * Event handler for "touchstart"
30470     *
30471     * @param e (event)
30472     *  - DOM event object
30473     */
30474    var onTouchStart = function(e) {
30475      //disable slider controls while user is interacting with slides to avoid slider freeze that happens on touch devices when a slide swipe happens immediately after interacting with slider controls
30476      slider.controls.el.addClass('disabled');
30477
30478      if (slider.working) {
30479        e.preventDefault();
30480        slider.controls.el.removeClass('disabled');
30481      } else {
30482        // record the original position when touch starts
30483        slider.touch.originalPos = el.position();
30484        var orig = e.originalEvent,
30485        touchPoints = (typeof orig.changedTouches !== 'undefined') ? orig.changedTouches : [orig];
30486        // record the starting touch x, y coordinates
30487        slider.touch.start.x = touchPoints[0].pageX;
30488        slider.touch.start.y = touchPoints[0].pageY;
30489
30490        if (slider.viewport.get(0).setPointerCapture) {
30491          slider.pointerId = orig.pointerId;
30492          slider.viewport.get(0).setPointerCapture(slider.pointerId);
30493        }
30494        // bind a "touchmove" event to the viewport
30495        slider.viewport.bind('touchmove MSPointerMove pointermove', onTouchMove);
30496        // bind a "touchend" event to the viewport
30497        slider.viewport.bind('touchend MSPointerUp pointerup', onTouchEnd);
30498        slider.viewport.bind('MSPointerCancel pointercancel', onPointerCancel);
30499      }
30500    };
30501
30502    /**
30503     * Cancel Pointer for Windows Phone
30504     *
30505     * @param e (event)
30506     *  - DOM event object
30507     */
30508    var onPointerCancel = function(e) {
30509      /* onPointerCancel handler is needed to deal with situations when a touchend
30510      doesn't fire after a touchstart (this happens on windows phones only) */
30511      setPositionProperty(slider.touch.originalPos.left, 'reset', 0);
30512
30513      //remove handlers
30514      slider.controls.el.removeClass('disabled');
30515      slider.viewport.unbind('MSPointerCancel pointercancel', onPointerCancel);
30516      slider.viewport.unbind('touchmove MSPointerMove pointermove', onTouchMove);
30517      slider.viewport.unbind('touchend MSPointerUp pointerup', onTouchEnd);
30518      if (slider.viewport.get(0).releasePointerCapture) {
30519        slider.viewport.get(0).releasePointerCapture(slider.pointerId);
30520      }
30521    };
30522
30523    /**
30524     * Event handler for "touchmove"
30525     *
30526     * @param e (event)
30527     *  - DOM event object
30528     */
30529    var onTouchMove = function(e) {
30530      var orig = e.originalEvent,
30531      touchPoints = (typeof orig.changedTouches !== 'undefined') ? orig.changedTouches : [orig],
30532      // if scrolling on y axis, do not prevent default
30533      xMovement = Math.abs(touchPoints[0].pageX - slider.touch.start.x),
30534      yMovement = Math.abs(touchPoints[0].pageY - slider.touch.start.y),
30535      value = 0,
30536      change = 0;
30537
30538      // x axis swipe
30539      if ((xMovement * 3) > yMovement && slider.settings.preventDefaultSwipeX) {
30540        e.preventDefault();
30541      // y axis swipe
30542      } else if ((yMovement * 3) > xMovement && slider.settings.preventDefaultSwipeY) {
30543        e.preventDefault();
30544      }
30545      if (slider.settings.mode !== 'fade' && slider.settings.oneToOneTouch) {
30546        // if horizontal, drag along x axis
30547        if (slider.settings.mode === 'horizontal') {
30548          change = touchPoints[0].pageX - slider.touch.start.x;
30549          value = slider.touch.originalPos.left + change;
30550        // if vertical, drag along y axis
30551        } else {
30552          change = touchPoints[0].pageY - slider.touch.start.y;
30553          value = slider.touch.originalPos.top + change;
30554        }
30555        setPositionProperty(value, 'reset', 0);
30556      }
30557    };
30558
30559    /**
30560     * Event handler for "touchend"
30561     *
30562     * @param e (event)
30563     *  - DOM event object
30564     */
30565    var onTouchEnd = function(e) {
30566      slider.viewport.unbind('touchmove MSPointerMove pointermove', onTouchMove);
30567      //enable slider controls as soon as user stops interacing with slides
30568      slider.controls.el.removeClass('disabled');
30569      var orig    = e.originalEvent,
30570      touchPoints = (typeof orig.changedTouches !== 'undefined') ? orig.changedTouches : [orig],
30571      value       = 0,
30572      distance    = 0;
30573      // record end x, y positions
30574      slider.touch.end.x = touchPoints[0].pageX;
30575      slider.touch.end.y = touchPoints[0].pageY;
30576      // if fade mode, check if absolute x distance clears the threshold
30577      if (slider.settings.mode === 'fade') {
30578        distance = Math.abs(slider.touch.start.x - slider.touch.end.x);
30579        if (distance >= slider.settings.swipeThreshold) {
30580          if (slider.touch.start.x > slider.touch.end.x) {
30581            el.goToNextSlide();
30582          } else {
30583            el.goToPrevSlide();
30584          }
30585          el.stopAuto();
30586        }
30587      // not fade mode
30588      } else {
30589        // calculate distance and el's animate property
30590        if (slider.settings.mode === 'horizontal') {
30591          distance = slider.touch.end.x - slider.touch.start.x;
30592          value = slider.touch.originalPos.left;
30593        } else {
30594          distance = slider.touch.end.y - slider.touch.start.y;
30595          value = slider.touch.originalPos.top;
30596        }
30597        // if not infinite loop and first / last slide, do not attempt a slide transition
30598        if (!slider.settings.infiniteLoop && ((slider.active.index === 0 && distance > 0) || (slider.active.last && distance < 0))) {
30599          setPositionProperty(value, 'reset', 200);
30600        } else {
30601          // check if distance clears threshold
30602          if (Math.abs(distance) >= slider.settings.swipeThreshold) {
30603            if (distance < 0) {
30604              el.goToNextSlide();
30605            } else {
30606              el.goToPrevSlide();
30607            }
30608            el.stopAuto();
30609          } else {
30610            // el.animate(property, 200);
30611            setPositionProperty(value, 'reset', 200);
30612          }
30613        }
30614      }
30615      slider.viewport.unbind('touchend MSPointerUp pointerup', onTouchEnd);
30616      if (slider.viewport.get(0).releasePointerCapture) {
30617        slider.viewport.get(0).releasePointerCapture(slider.pointerId
vendor: 8,775 bytes, lines 30617-30812
30617);
30618      }
30619    };
30620
30621    /**
30622     * Window resize event callback
30623     */
30624    var resizeWindow = function(e) {
30625      // don't do anything if slider isn't initialized.
30626      if (!slider.initialized) { return; }
30627      // Delay if slider working.
30628      if (slider.working) {
30629        window.setTimeout(resizeWindow, 10);
30630      } else {
30631        // get the new window dimens (again, thank you IE)
30632        var windowWidthNew = $(window).width(),
30633        windowHeightNew = $(window).height();
30634        // make sure that it is a true window resize
30635        // *we must check this because our dinosaur friend IE fires a window resize event when certain DOM elements
30636        // are resized. Can you just die already?*
30637        if (windowWidth !== windowWidthNew || windowHeight !== windowHeightNew) {
30638          // set the new window dimens
30639          windowWidth = windowWidthNew;
30640          windowHeight = windowHeightNew;
30641          // update all dynamic elements
30642          el.redrawSlider();
30643          // Call user resize handler
30644          slider.settings.onSliderResize.call(el, slider.active.index);
30645        }
30646      }
30647    };
30648
30649    /**
30650     * Adds an aria-hidden=true attribute to each element
30651     *
30652     * @param startVisibleIndex (int)
30653     *  - the first visible element's index
30654     */
30655    var applyAriaHiddenAttributes = function(startVisibleIndex) {
30656      var numberOfSlidesShowing = getNumberSlidesShowing();
30657      // only apply attributes if the setting is enabled and not in ticker mode
30658      if (slider.settings.ariaHidden && !slider.settings.ticker) {
30659        // add aria-hidden=true to all elements
30660        slider.children.attr('aria-hidden', 'true');
30661        // get the visible elements and change to aria-hidden=false
30662        slider.children.slice(startVisibleIndex, startVisibleIndex + numberOfSlidesShowing).attr('aria-hidden', 'false');
30663      }
30664    };
30665
30666    /**
30667     * Returns index according to present page range
30668     *
30669     * @param slideOndex (int)
30670     *  - the desired slide index
30671     */
30672    var setSlideIndex = function(slideIndex) {
30673      if (slideIndex < 0) {
30674        if (slider.settings.infiniteLoop) {
30675          return getPagerQty() - 1;
30676        }else {
30677          //we don't go to undefined slides
30678          return slider.active.index;
30679        }
30680      // if slideIndex is greater than children length, set active index to 0 (this happens during infinite loop)
30681      } else if (slideIndex >= getPagerQty()) {
30682        if (slider.settings.infiniteLoop) {
30683          return 0;
30684        } else {
30685          //we don't move to undefined pages
30686          return slider.active.index;
30687        }
30688      // set active index to requested slide
30689      } else {
30690        return slideIndex;
30691      }
30692    };
30693
30694    /**
30695     * ===================================================================================
30696     * = PUBLIC FUNCTIONS
30697     * ===================================================================================
30698     */
30699
30700    /**
30701     * Performs slide transition to the specified slide
30702     *
30703     * @param slideIndex (int)
30704     *  - the destination slide's index (zero-based)
30705     *
30706     * @param direction (string)
30707     *  - INTERNAL USE ONLY - the direction of travel ("prev" / "next")
30708     */
30709    el.goToSlide = function(slideIndex, direction) {
30710      // onSlideBefore, onSlideNext, onSlidePrev callbacks
30711      // Allow transition canceling based on returned value
30712      var performTransition = true,
30713      moveBy = 0,
30714      position = {left: 0, top: 0},
30715      lastChild = null,
30716      lastShowingIndex, eq, value, requestEl;
30717      // store the old index
30718      slider.oldIndex = slider.active.index;
30719      //set new index
30720      slider.active.index = setSlideIndex(slideIndex);
30721
30722      // if plugin is currently in motion, ignore request
30723      if (slider.working || slider.active.index === slider.oldIndex) { return; }
30724      // declare that plugin is in motion
30725      slider.working = true;
30726
30727      performTransition = slider.settings.onSlideBefore.call(el, slider.children.eq(slider.active.index), slider.oldIndex, slider.active.index);
30728
30729      // If transitions canceled, reset and return
30730      if (typeof (performTransition) !== 'undefined' && !performTransition) {
30731        slider.active.index = slider.oldIndex; // restore old index
30732        slider.working = false; // is not in motion
30733        return;
30734      }
30735
30736      if (direction === 'next') {
30737        // Prevent canceling in future functions or lack there-of from negating previous commands to cancel
30738        if (!slider.settings.onSlideNext.call(el, slider.children.eq(slider.active.index), slider.oldIndex, slider.active.index)) {
30739          performTransition = false;
30740        }
30741      } else if (direction === 'prev') {
30742        // Prevent canceling in future functions or lack there-of from negating previous commands to cancel
30743        if (!slider.settings.onSlidePrev.call(el, slider.children.eq(slider.active.index), slider.oldIndex, slider.active.index)) {
30744          performTransition = false;
30745        }
30746      }
30747
30748      // check if last slide
30749      slider.active.last = slider.active.index >= getPagerQty() - 1;
30750      // update the pager with active class
30751      if (slider.settings.pager || slider.settings.pagerCustom) { updatePagerActive(slider.active.index); }
30752      // // check for direction control update
30753      if (slider.settings.controls) { updateDirectionControls(); }
30754      // if slider is set to mode: "fade"
30755      if (slider.settings.mode === 'fade') {
30756        // if adaptiveHeight is true and next height is different from current height, animate to the new height
30757        if (slider.settings.adaptiveHeight && slider.viewport.height() !== getViewportHeight()) {
30758          slider.viewport.animate({height: getViewportHeight()}, slider.settings.adaptiveHeightSpeed);
30759        }
30760        // fade out the visible child and reset its z-index value
30761        slider.children.filter(':visible').fadeOut(slider.settings.speed).css({zIndex: 0});
30762        // fade in the newly requested slide
30763        slider.children.eq(slider.active.index).css('zIndex', slider.settings.slideZIndex + 1).fadeIn(slider.settings.speed, function() {
30764          $(this).css('zIndex', slider.settings.slideZIndex);
30765          updateAfterSlideTransition();
30766        });
30767      // slider mode is not "fade"
30768      } else {
30769        // if adaptiveHeight is true and next height is different from current height, animate to the new height
30770        if (slider.settings.adaptiveHeight && slider.viewport.height() !== getViewportHeight()) {
30771          slider.viewport.animate({height: getViewportHeight()}, slider.settings.adaptiveHeightSpeed);
30772        }
30773        // if carousel and not infinite loop
30774        if (!slider.settings.infiniteLoop && slider.carousel && slider.active.last) {
30775          if (slider.settings.mode === 'horizontal') {
30776            // get the last child position
30777            lastChild = slider.children.eq(slider.children.length - 1);
30778            position = lastChild.position();
30779            // calculate the position of the last slide
30780            moveBy = slider.viewport.width() - lastChild.outerWidth();
30781          } else {
30782            // get last showing index position
30783            lastShowingIndex = slider.children.length - slider.settings.minSlides;
30784            position = slider.children.eq(lastShowingIndex).position();
30785          }
30786          // horizontal carousel, going previous while on first slide (infiniteLoop mode)
30787        } else if (slider.carousel && slider.active.last && direction === 'prev') {
30788          // get the last child position
30789          eq = slider.settings.moveSlides === 1 ? slider.settings.maxSlides - getMoveBy() : ((getPagerQty() - 1) * getMoveBy()) - (slider.children.length - slider.settings.maxSlides);
30790          lastChild = el.children('.bx-clone').eq(eq);
30791          position = lastChild.position();
30792        // if infinite loop and "Next" is clicked on the last slide
30793        } else if (direction === 'next' && slider.active.index === 0) {
30794          // get the last clone position
30795          position = el.find('> .bx-clone').eq(slider.settings.maxSlides).position();
30796          slider.active.last = false;
30797        // normal non-zero requests
30798        } else if (slideIndex >= 0) {
30799          //parseInt is applied to allow floats for slides/page
30800          requestEl = slideIndex * parseInt(getMoveBy());
30801          position = slider.children.eq(requestEl).position();
30802        }
30803
30804        /* If the position doesn't exist
30805         * (e.g. if you destroy the slider on a next click),
30806         * it doesn't throw an error.
30807         */
30808        if (typeof (position) !== 'undefined') {
30809          value = slider.settings.mode === 'horizontal' ? -(position.left - moveBy) : -position.top;
30810          // plugin values to be animated
30811          setPositionProperty(value, 'slide', slider.settings.speed);
30812        }
30812 else {
30813          slider.working = false;
30814        }
30815      }
30816      if (slider.settings.ariaHidden) { applyAriaHiddenAttributes(slider.active.index * getMoveBy()); }
30817    };
30818
30819    /**
30820     * Transitions to the next slide in the show
30821     */
30822    el.goToNextSlide = function() {
30823      // if infiniteLoop is false and last page is showing, disregard call
30824      if (!slider.settings.infiniteLoop && slider.active.last) { return; }
30825      var pagerIndex = parseInt(slider.active.index) + 1;
30826      el.goToSlide(pagerIndex, 'next');
30827    };
30828
30829    /**
30830     * Transitions to the prev slide in the show
30831     */
30832    el.goToPrevSlide = function() {
30833      // if infiniteLoop is false and last page is showing, disregard call
30834      if (!slider.settings.infiniteLoop && slider.active.index === 0) { return; }
30835      var pagerIndex = parseInt(slider.active.index) - 1;
30836      el.goToSlide(pagerIndex, 'prev');
30837    };
30838
30839    /**
30840     * Starts the auto show
30841     *
30842     * @param preventControlUpdate (boolean)
30843     *  - if true, auto controls state will not be updated
30844     */
30845    el.startAuto = function(preventControlUpdate) {
30846      // if an interval already exists, disregard call
30847      if (slider.interval) { return; }
30848      // create an interval
30849      slider.interval = setInterval(function() {
30850        if (slider.settings.autoDirection === 'next') {
30851          el.goToNextSlide();
30852        } else {
30853          el.goToPrevSlide();
30854        }
30855      }, slider.settings.pause);
30856      // if auto controls are displayed and preventControlUpdate is not true
30857      if (slider.settings.autoControls && preventControlUpdate !== true) { updateAutoControls('stop'); }
30858    };
30859
30860    /**
30861     * Stops the auto show
30862     *
30863     * @param preventControlUpdate (boolean)
30864     *  - if true, auto controls state will not be updated
30865     */
30866    el.stopAuto = function(preventControlUpdate) {
30867      // if no interval exists, disregard call
30868      if (!slider.interval) { return; }
30869      // clear the interval
30870      clearInterval(slider.interval);
30871      slider.interval = null;
30872      // if auto controls are displayed and preventControlUpdate is not true
30873      if (slider.settings.autoControls && preventControlUpdate !== true) { updateAutoControls('start'); }
30874    };
30875
30876    /**
30877     * Returns current slide index (zero-based)
30878     */
30879    el.getCurrentSlide = function() {
30880      return slider.active.index;
30881    };
30882
30883    /**
30884     * Returns current slide element
30885     */
30886    el.getCurrentSlideElement = function() {
30887      return slider.children.eq(slider.active.index);
30888    };
30889
30890    /**
30891     * Returns a slide element
30892     * @param index (int)
30893     *  - The index (zero-based) of the element you want returned.
30894     */
30895    el.getSlideElement = function(index) {
30896      return slider.children.eq(index);
30897    };
30898
30899    /**
30900     * Returns number of slides in show
30901     */
30902    el.getSlideCount = function() {
30903      return slider.children.length;
30904    };
30905
30906    /**
30907     * Return slider.working variable
30908     */
30909    el.isWorking = function() {
30910      return slider.working;
30911    };
30912
30913    /**
30914     * Update all dynamic slider elements
30915     */
30916    el.redrawSlider = function() {
30917      // resize all children in ratio to new screen size
30918      slider.children.add(el.find('.bx-clone')).outerWidth(getSlideWidth());
30919      // adjust the height
vendor: 4,198 bytes, lines 30920-31018
30920      slider.viewport.css('height', getViewportHeight());
30921      // update the slide position
30922      if (!slider.settings.ticker) { setSlidePosition(); }
30923      // if active.last was true before the screen resize, we want
30924      // to keep it last no matter what screen size we end on
30925      if (slider.active.last) { slider.active.index = getPagerQty() - 1; }
30926      // if the active index (page) no longer exists due to the resize, simply set the index as last
30927      if (slider.active.index >= getPagerQty()) { slider.active.last = true; }
30928      // if a pager is being displayed and a custom pager is not being used, update it
30929      if (slider.settings.pager && !slider.settings.pagerCustom) {
30930        populatePager();
30931        updatePagerActive(slider.active.index);
30932      }
30933      if (slider.settings.ariaHidden) { applyAriaHiddenAttributes(slider.active.index * getMoveBy()); }
30934    };
30935
30936    /**
30937     * Destroy the current instance of the slider (revert everything back to original state)
30938     */
30939    el.destroySlider = function() {
30940      // don't do anything if slider has already been destroyed
30941      if (!slider.initialized) { return; }
30942      slider.initialized = false;
30943      $('.bx-clone', this).remove();
30944      slider.children.each(function() {
30945        if ($(this).data('origStyle') !== undefined) {
30946          $(this).attr('style', $(this).data('origStyle'));
30947        } else {
30948          $(this).removeAttr('style');
30949        }
30950      });
30951      if ($(this).data('origStyle') !== undefined) {
30952        this.attr('style', $(this).data('origStyle'));
30953      } else {
30954        $(this).removeAttr('style');
30955      }
30956      $(this).unwrap().unwrap();
30957      if (slider.controls.el) { slider.controls.el.remove(); }
30958      if (slider.controls.next) { slider.controls.next.remove(); }
30959      if (slider.controls.prev) { slider.controls.prev.remove(); }
30960      if (slider.pagerEl && slider.settings.controls && !slider.settings.pagerCustom) { slider.pagerEl.remove(); }
30961      $('.bx-caption', this).remove();
30962      if (slider.controls.autoEl) { slider.controls.autoEl.remove(); }
30963      clearInterval(slider.interval);
30964      if (slider.settings.responsive) { $(window).unbind('resize', resizeWindow); }
30965      if (slider.settings.keyboardEnabled) { $(document).unbind('keydown', keyPress); }
30966      //remove self reference in data
30967      $(this).removeData('bxSlider');
30968    };
30969
30970    /**
30971     * Reload the slider (revert all DOM changes, and re-initialize)
30972     */
30973    el.reloadSlider = function(settings) {
30974      if (settings !== undefined) { options = settings; }
30975      el.destroySlider();
30976      init();
30977      //store reference to self in order to access public functions later
30978      $(el).data('bxSlider', this);
30979    };
30980
30981    init();
30982
30983    $(el).data('bxSlider', this);
30984
30985    // returns the current jQuery object
30986    return this;
30987  };
30988
30989})(jQuery);
30990/*
30991 * jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/
30992 *
30993 * Uses the built in easing capabilities added In jQuery 1.1
30994 * to offer multiple easing options
30995 *
30996 * TERMS OF USE - jQuery Easing
30997 * 
30998 * Open source under the BSD License. 
30999 * 
31000 * Copyright © 2008 George McGinley Smith
31001 * All rights reserved.
31002 * 
31003 * Redistribution and use in source and binary forms, with or without modification, 
31004 * are permitted provided that the following conditions are met:
31005 * 
31006 * Redistributions of source code must retain the above copyright notice, this list of 
31007 * conditions and the following disclaimer.
31008 * Redistributions in binary form must reproduce the above copyright notice, this list 
31009 * of conditions and the following disclaimer in the documentation and/or other materials 
31010 * provided with the distribution.
31011 * 
31012 * Neither the name of the author nor the names of contributors may be used to endorse 
31013 * or promote products derived from this software without specific prior written permission.
31014 * 
31015 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 
31016 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
31017 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
31018 *  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
vendor: 5,091 bytes, lines 31019-31164
31019 *  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
31020 *  GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 
31021 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
31022 *  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 
31023 * OF THE POSSIBILITY OF SUCH DAMAGE. 
31024 *
31025*/
31026
31027// t: current time, b: begInnIng value, c: change In value, d: duration
31028jQuery.easing['jswing'] = jQuery.easing['swing'];
31029
31030jQuery.extend( jQuery.easing,
31031{
31032	def: 'easeOutQuad',
31033	swing: function (x, t, b, c, d) {
31034		//alert(jQuery.easing.default);
31035		return jQuery.easing[jQuery.easing.def](x, t, b, c, d);
31036	},
31037	easeInQuad: function (x, t, b, c, d) {
31038		return c*(t/=d)*t + b;
31039	},
31040	easeOutQuad: function (x, t, b, c, d) {
31041		return -c *(t/=d)*(t-2) + b;
31042	},
31043	easeInOutQuad: function (x, t, b, c, d) {
31044		if ((t/=d/2) < 1) return c/2*t*t + b;
31045		return -c/2 * ((--t)*(t-2) - 1) + b;
31046	},
31047	easeInCubic: function (x, t, b, c, d) {
31048		return c*(t/=d)*t*t + b;
31049	},
31050	easeOutCubic: function (x, t, b, c, d) {
31051		return c*((t=t/d-1)*t*t + 1) + b;
31052	},
31053	easeInOutCubic: function (x, t, b, c, d) {
31054		if ((t/=d/2) < 1) return c/2*t*t*t + b;
31055		return c/2*((t-=2)*t*t + 2) + b;
31056	},
31057	easeInQuart: function (x, t, b, c, d) {
31058		return c*(t/=d)*t*t*t + b;
31059	},
31060	easeOutQuart: function (x, t, b, c, d) {
31061		return -c * ((t=t/d-1)*t*t*t - 1) + b;
31062	},
31063	easeInOutQuart: function (x, t, b, c, d) {
31064		if ((t/=d/2) < 1) return c/2*t*t*t*t + b;
31065		return -c/2 * ((t-=2)*t*t*t - 2) + b;
31066	},
31067	easeInQuint: function (x, t, b, c, d) {
31068		return c*(t/=d)*t*t*t*t + b;
31069	},
31070	easeOutQuint: function (x, t, b, c, d) {
31071		return c*((t=t/d-1)*t*t*t*t + 1) + b;
31072	},
31073	easeInOutQuint: function (x, t, b, c, d) {
31074		if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b;
31075		return c/2*((t-=2)*t*t*t*t + 2) + b;
31076	},
31077	easeInSine: function (x, t, b, c, d) {
31078		return -c * Math.cos(t/d * (Math.PI/2)) + c + b;
31079	},
31080	easeOutSine: function (x, t, b, c, d) {
31081		return c * Math.sin(t/d * (Math.PI/2)) + b;
31082	},
31083	easeInOutSine: function (x, t, b, c, d) {
31084		return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b;
31085	},
31086	easeInExpo: function (x, t, b, c, d) {
31087		return (t==0) ? b : c * Math.pow(2, 10 * (t/d - 1)) + b;
31088	},
31089	easeOutExpo: function (x, t, b, c, d) {
31090		return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b;
31091	},
31092	easeInOutExpo: function (x, t, b, c, d) {
31093		if (t==0) return b;
31094		if (t==d) return b+c;
31095		if ((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b;
31096		return c/2 * (-Math.pow(2, -10 * --t) + 2) + b;
31097	},
31098	easeInCirc: function (x, t, b, c, d) {
31099		return -c * (Math.sqrt(1 - (t/=d)*t) - 1) + b;
31100	},
31101	easeOutCirc: function (x, t, b, c, d) {
31102		return c * Math.sqrt(1 - (t=t/d-1)*t) + b;
31103	},
31104	easeInOutCirc: function (x, t, b, c, d) {
31105		if ((t/=d/2) < 1) return -c/2 * (Math.sqrt(1 - t*t) - 1) + b;
31106		return c/2 * (Math.sqrt(1 - (t-=2)*t) + 1) + b;
31107	},
31108	easeInElastic: function (x, t, b, c, d) {
31109		var s=1.70158;var p=0;var a=c;
31110		if (t==0) return b;  if ((t/=d)==1) return b+c;  if (!p) p=d*.3;
31111		if (a < Math.abs(c)) { a=c; var s=p/4; }
31112		else var s = p/(2*Math.PI) * Math.asin (c/a);
31113		return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
31114	},
31115	easeOutElastic: function (x, t, b, c, d) {
31116		var s=1.70158;var p=0;var a=c;
31117		if (t==0) return b;  if ((t/=d)==1) return b+c;  if (!p) p=d*.3;
31118		if (a < Math.abs(c)) { a=c; var s=p/4; }
31119		else var s = p/(2*Math.PI) * Math.asin (c/a);
31120		return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b;
31121	},
31122	easeInOutElastic: function (x, t, b, c, d) {
31123		var s=1.70158;var p=0;var a=c;
31124		if (t==0) return b;  if ((t/=d/2)==2) return b+c;  if (!p) p=d*(.3*1.5);
31125		if (a < Math.abs(c)) { a=c; var s=p/4; }
31126		else var s = p/(2*Math.PI) * Math.asin (c/a);
31127		if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
31128		return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b;
31129	},
31130	easeInBack: function (x, t, b, c, d, s) {
31131		if (s == undefined) s = 1.70158;
31132		return c*(t/=d)*t*((s+1)*t - s) + b;
31133	},
31134	easeOutBack: function (x, t, b, c, d, s) {
31135		if (s == undefined) s = 1.70158;
31136		return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b;
31137	},
31138	easeInOutBack: function (x, t, b, c, d, s) {
31139		if (s == undefined) s = 1.70158; 
31140		if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b;
31141		return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b;
31142	},
31143	easeInBounce: function (x, t, b, c, d) {
31144		return c - jQuery.easing.easeOutBounce (x, d-t, 0, c, d) + b;
31145	},
31146	easeOutBounce: function (x, t, b, c, d) {
31147		if ((t/=d) < (1/2.75)) {
31148			return c*(7.5625*t*t) + b;
31149		} else if (t < (2/2.75)) {
31150			return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b;
31151		} else if (t < (2.5/2.75)) {
31152			return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b;
31153		} else {
31154			return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b;
31155		}
31156	},
31157	easeInOutBounce: function (x, t, b, c, d) {
31158		if (t < d/2) return jQuery.easing.easeInBounce (x, t*2, 0, c, d) * .5 + b;
31159		return jQuery.easing.easeOutBounce (x, t*2-d, 0, c, d) * .5 + c*.5 + b;
31160	}
31161});
31162
31163/*
31164 *
31165 * TERMS OF USE - EASING EQUATIONS
31166 * 
31167 * Open source under the BSD License. 
31168 * 
31169 * Copyright © 2001 Robert Penner
31170 * All rights reserved.
31171 * 
31172 * Redistribution and use in source and binary forms, with or without modification, 
31173 * are permitted provided that the following conditions are met:
31174 * 
31175 * Redistributions of source code must retain the above copyright notice, this list of 
31176 * conditions and the following disclaimer.
31177 * Redistributions in binary form must reproduce the above copyright notice, this list 
31178 * of conditions and the following disclaimer in the documentation and/or other materials 
31179 * provided with the distribution.
31180 * 
31181 * Neither the name of the author nor the names of contributors may be used to endorse 
31182 * or promote products derived from this software without specific prior written permission.
31183 * 
31184 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 
31185 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
31186 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
31187 *  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
31188 *  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
31189 *  GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 
31190 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
31191 *  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 
31192 * OF THE POSSIBILITY OF SUCH DAMAGE. 
31193 *
31194 */;
31195/*global jQuery */
31196/*jshint multistr:true browser:true */
31197/*!
31198* FitVids 1.0
31199*
31200* Copyright 2011, Chris Coyier - http://css-tricks.com + Dave Rupert - http://daverupert.com
31201* Credit to Thierry Koblentz - http://www.alistapart.com/articles/creating-intrinsic-ratios-for-video/
31202* Released under the WTFPL license - http://sam.zoy.org/wtfpl/
31203*
31204* Date: Thu Sept 01 18:00:00 2011 -0500
31205*/
31206
31207(function( $ ){
31208
31209  "use strict";
31210
31211  $.fn.fitVids = function( options ) {
31212    var settings = {
31213      customSelector: null
31214    };
31215
31216    var div = document.createElement('div'),
31217        ref = document.getElementsByTagName('base')[0] || document.getElementsByTagName('script')[0];
31218
31219    div.className = 'fit-vids-style';
31220    div.innerHTML = '&shy;<style>         \
31221      .fluid-width-video-wrapper {        \
31222         width: 100%;                     \
31223         position: relative;              \
31224         padding: 0;                      \
31225      }                                   \
31226                                          \
31227      .fluid-width-video-wrapper iframe,  \
31228      .fluid-width-video-wrapper object,  \
31229      .fluid-width-video-wrapper embed {  \
31230         position: absolute;              \
31231         top: 0;                          \
31232         left: 0;                         \
31233         width: 100%;                     \
31234         height: 100%;                    \
31235      }                                   \
31236    </style>';
31237
31238    ref.parentNode.insertBefore(div,ref);
31239
31240    if ( options ) {
31241      $.extend( settings, options );
31242    }
31243
31244    return this.each(function(){
31245      var selectors = [
31246        "iframe[src*='player.vimeo.com']",
31247        "iframe[src*='www.youtube.com']",
31248        "iframe[src*='www.kickstarter.com']",
31249        "object",
31250        "embed"
31251      ];
31252
31253      if (settings.customSelector) {
31254        selectors.push(settings.customSelector);
31255      }
31256
31257      var $allVideos = $(this).find(selectors.join(','));
31258
31259      $allVideos.each(function(){
31260        var $this = $(this);
31261        if (this.tagName.toLowerCase() === 'embed' && $this.parent('object').length || $this.parent('.fluid-width-video-wrapper').length) { return; }
31262        var height = ( this.tagName.toLowerCase() === 'object' || ($this.attr('height') && !isNaN(parseInt($this.attr('height'), 10))) ) ? parseInt($this.attr('height'), 10) : $this.height(),
31263            width = !isNaN(parseInt($this.attr('width'), 10)) ? parseInt($this.attr('width'), 10) : $this.width(),
31264            aspectRatio = height / width;
31265        if(!$this.attr('id')){
31266          var videoID = 'fitvid' + Math.floor(Math.random()*999999);
31267          $this.attr('id', videoID);
31268        }
31269        $this.wrap('<div class="fluid-width-video-wrapper"></div>').parent('.fluid-width-video-wrapper').css('padding-top', (aspectRatio * 100)+"%");
31270        $this.removeAttr('height').removeAttr('width');
31271      });
31272    });
31273  };
31274})( jQuery );
31275
31276
31277
31278
31279
31280
31281this.KeyVisual_Image = (function () {
31282  function KeyVisual_Image() {
31283  }
31284
31285  KeyVisual_Image.slide = function (selector, opts) {
31286    var defaultOpts;
31287    if (opts == null) {
31288      opts = {};
31289    }
31290    defaultOpts = {
31291      auto: true,
31292      autoControls: true,
31293      startText: $(selector).find(".controls-start").text(),
31294      stopText: $(selector).find(".controls-stop").text(),
31295      controls: false,
31296      pagerCustom: selector + " .bx-thumbs",
31297      touchEnabled : false
31298    };
31299    return $(selector + " .images").bxSlider($.extend(defaultOpts, opts));
31300  };
31301
31302  KeyVisual_Image.randomize = function (selector) {
31303    var list, wrap;
31304    wrap = $(selector);
31305    list = wrap.find("li");
31306    list = list.sort(function () {
31307      return Math.random() - .5;
31308    });
31309    return list.each(function () {
31310      return wrap.append($(this));
31311    });
31312  };
31313
31314  return KeyVisual_Image;
31315
31316})();
31317this.Googlemaps_Map = (function () {
31318  function Googlemaps_Map() {
31319  }
31320
31321  Googlemaps_Map.map = null;
31322
31323  Googlemaps_Map.form = null;
31324
31325  Googlemaps_Map.center = null; // null means auto
31326
31327  Googlemaps_Map.zoom = null; // null means auto
31328
31329  Googlemaps_Map.defaultCenter = [36.204824, 138.252924];
31330
31331  Googlemaps_Map.defaultZoom = 13;
31332
31333  Googlemaps_Map.markers = null;
31334
31335  Googlemaps_Map.markerClusterer = null;
31336
31337  Googlemaps_Map.markerIcon = "/assets/img/googlemaps/marker1.png";
31338
31339  Googlemaps_Map.clickIcon = "/assets/img/googlemaps/marker17.png";
31340
31341  Googlemaps_Map.openedInfo = null;
31342
31343  Googlemaps_Map.resized = null;
31344
31345  Googlemaps_Map.kmlLayer = null;
31346
31347  Googlemaps_Map.showGoogleMapsSearch = false;
31348
31349  Googlemaps_Map.mapsSearchUrl = "https://www.google.co.jp/maps/search/";
31350
31351  Googlemaps_Map.attachMessage = function (id) {
31352    google.maps.event.addListener(Googlemaps_Map.markers[id]["marker"], 'click', function (_event) {
31353      if (Googlemaps_Map.openedInfo) {
31354        Googlemaps_Map.openedInfo.close();
31355      }
31356      if (Googlemaps_Map.markers[id]["window"]) {
31357        Googlemaps_Map.markers[id]["window"].open(Googlemaps_Map.markers[id]["marker"].getMap(), Googlemaps_Map.markers[id]["marker"]);
31358      }
31359      Googlemaps_Map.openedInfo = Googlemaps_Map.markers[id]["window"];
31360    });
31361    return google.maps.event.addListener(Googlemaps_Map.markers[id]["window"], 'closeclick', function (_event) {
31362      Googlemaps_Map.openedInfo = null;
31363    });
31364  };
31365
31366  Googlemaps_Map.setForm = function (form) {
31367    return this.form = form;
31368  };
31369
31370  Googlemaps_Map.load = function (selector, options) {
31371    if (!options) {
31372      options = {}
31373    }
31374
31375    if (options["zoom"]) {
31376      if (Googlemaps_Map.validateZoom(options["zoom"])) {
31377        Googlemaps_Map.zoom = options["zoom"];
31378      }
31379    }
31380    if (options["center"]) {
31381      if (Googlemaps_Map.validateLatLon(options["center"][1], options["center"][0])) {
31382        Googlemaps_Map.center = options["center"].reverse();
31383      }
31384    }
31385    if (options["showGoogleMapsSearch"]) {
31386      Googlemaps_Map.showGoogleMapsSearch = true;
31387    }
31388
31389    var center = Googlemaps_Map.getCenter();
31390    var mapOptions = {
31391      center: new google.maps.LatLng(center[0], center[1]),
31392      zoom: Googlemaps_Map.getZoom(),
31393      mapTypeId: google.maps.MapTypeId.ROADMAP,
31394      panControl: false,
31395      zoomControl: true,
31396      zoomControlOptions: {
31397        style: google.maps.ZoomControlStyle.LARGE
31398      },
31399      mapTypeControl: true,
31400      scaleControl: true,
31401      scrollwheel: true,
31402      streetViewControl: true,
31403      overviewMapControl: true,
31404      overviewMapControlOptions: {
31405        opened: true
31406      }
31407    };
31408    Googlemaps_Map.map = new google.maps.Map($(selector).get(0), mapOptions);
31409  };
31410
31411  Googlemaps_Map.getCenter = function () {
31412    return (Googlemaps_Map.center ? Googlemaps_Map.center : Googlemaps_Map.defaultCenter);
31413  }
31414
31415  Googlemaps_Map.getZoom = function () {
31416    return (Googlemaps_Map.zoom ? Googlemaps_Map.zoom : Googlemaps_Map.defaultZoom);
31417  }
31418
31419  Googlemaps_Map.resize = function () {
31420    google.maps.event.trigger(this.map, "resize");
31421    if (!this.resized) {
31422      var center = Googlemaps_Map.getCenter();
31423      this.map.setCenter(new google.maps.LatLng(center[0], center[1]));
31424      if (this.form) {
31425        this.form.renderMarkers();
31426      }
31427    }
31428    return this.resized = true;
31429  };
31430
31431  Googlemaps_Map.renderMarkers = function () {
31432    if (this.form) {
31433      return this.form.renderMarkers();
31434    }
31435  };
31436
31437  Googlemaps_Map.renderEvents = function () {
31438    if (this.form) {
31439      return this.form.renderEvents();
31440    }
31441  };
31442
31443  Googlemaps_Map.setMarkers = function (markers, opts = {}) {
31444    let markerBounds;
31445    Googlemaps_Map.markers = markers;
31446    markerBounds = new google.maps.LatLngBounds();
31447
31448    Object.entries(Googlemaps_Map.markers).forEach(([id, value]) => {
31449      const position = new google.maps.LatLng(value["loc"][1], value["loc"][0]);
31450      const markerOpts = {
31451        position: position,
31452        map: Googlemaps_Map.map,
31453        icon: value["image"] || Googlemaps_Map.markerIcon
31454      };
31455
31456      Googlemaps_Map.markers[id]["marker"] = new google.maps.Marker(markerOpts);
31457      markerBounds.extend(position);
31458
31459      let markerHtml = "";
31460      if (value['html']) {
31461        markerHtml = value['html'];
31462      } else if (value['name'] || value['text']) {
31463        const $markerContent = $("<div/>", { class: "marker marker-info" });
31464        if (value['name']) {
31465          $markerContent.append($("<p/>", { class: "marker-name" }).text(value['name']));
31466        }
31467        if (value['text']) {
31468          const $explanation = $("<div/>", { class: "marker-explanation" });
31469          value['text'].split(/[\r\n]+/).forEach(line => {
31470            if (/^https?:\/\//.test(line)) {
31471              $explanation.append($("<p/>", { class: "marker-link" }).html($("<a />", { href: line }).text(line)));
31472            } else {
31473              $explanation.append($("<p/>").text(line));
31474            }
31475          });
31476          $markerContent.append($explanation);
31477        }
31478        markerHtml = $markerContent.html();
31479      }
31480
31481      if (Googlemaps_Map.showGoogleMapsSearch) {
31482        markerHtml += Googlemaps_Map.getMapsSearchHtml(value['loc'][1], value['loc'][0]);
31483      }
31484
31485      if (markerHtml) {
31486        Googlemaps_Map.markers[id]["window"] = new google.maps.InfoWindow({
31487          content: markerHtml,
31488          pixelOffset: new google.maps.Size(0, 0),
31489        });
31490        Googlemaps_Map.attachMessage(id);
31491      }
31492    });
31493
31494    if (opts['markerCluster']) {
31495      Googlemaps_Map.renderMarkerCluster();
31496    }
31497    Googlemaps_Map.adjustMarkerBounds(Object.keys(Googlemaps_Map.markers).length, markerBounds);
31498  };
31499
31500  Googlemaps_Map.renderMarkerCluster = function () {
31501    const clusterMarkers = Object.values(Googlemaps_Map.markers).map(data => data.marker);
31502    Googlemaps_Map.markerClusterer = new MarkerClusterer(Googlemaps_Map.map, clusterMarkers, {
31503      // averageCenter: true,
31504      ignoreHiddenMarkers: true,
31505      imagePath: '/assets/img/marker-clusterer/m',
31506      // zoomOnClick: false,
31507    });
31508
31509    google.maps.event.addListener(Googlemaps_Map.map, 'zoom_changed', () => {
31510      Googlemaps_Map.closeMarkerClusterInfo();
31511    });
31512
31513    ClusterIcon.prototype.triggerClusterClick = function(event) {
31514      const cluster = this.cluster_;
31515      const markers = cluster.getMarkers();
31516      const positions = markers.map(marker => marker.position.toUrlValue());
31517
31518      const clusterMarkers = Object.values(Googlemaps_Map.markers).filter(marker =>
31519        positions.includes([marker.loc[1], marker.loc[0]].toString())
31520      );
31521      const contents = clusterMarkers.map(marker => marker.html || "");
31522      const infoWindow = new google.maps.InfoWindow({
31523        content: `<div class="marker-cluster-info">${contents.join('')}</div>`,
31524        position: markers[0].position,
31525        pixelOffset: new google.maps.Size(0, -15),
31526        markerType: 'cluster', // custom parameter
31527      });
31528
31529      Googlemaps_Map.openMarkerClusterInfo(infoWindow);
31530      event.stopPropagation();
31531    };
31532  };
31533
31534  Googlemaps_Map.openMarkerClusterInfo = function (infoWindow) {
31535    if (Googlemaps_Map.openedInfo) {
31536      Googlemaps_Map.openedInfo.close();
31537    }
31538    Googlemaps_Map.openedInfo = infoWindow;
31539
31540    infoWindow.open({
31541      map: Googlemaps_Map.map,
31542    });
31543  };
31544
31545  Googlemaps_Map.closeMarkerClusterInfo = function () {
31546    if (Googlemaps_Map.openedInfo && Googlemaps_Map.openedInfo.markerType === 'cluster') {
31547      Googlemaps_Map.openedInfo.close();
31548    }
31549  };
31550
31551  Googlemaps_Map.setKmlLayer = function (url) {
31552    Googlemaps_Map.kmlLayer = new google.maps.KmlLayer({
31553      url: url,
31554      suppressInfoWindows: true,
31555      preserveViewport: false
31556    });
31557    Googlemaps_Map.kmlLayer.setMap(Googlemaps_Map.map);
31558  };
31559
31560  Googlemaps_Map.setGeoJson = function (url) {
31561    Googlemaps_Map.map.data.setStyle({
31562      fillColor: "#b2c9e8",
31563      strokeColor: "#5A88C6",
31564      strokeWeight: 1
31565    });
31566    Googlemaps_Map.map.data.loadGeoJson(url, {}, function(data) {
31567      var bounds = new google.maps.LatLngBounds();
31568      var locs = [];
31569
31570      data.forEach(function (feature) {
31571        feature.getGeometry().forEachLatLng(function (LatLng) {
31572          bounds.extend(LatLng);
31573          locs.push(LatLng);
31574        });
31575      });
31576
31577      Googlemaps_Map.adjustMarkerBounds(locs.length, bounds);
31578    });
31579  };
31580
31581  Googlemaps_Map.adjustMarkerBounds = function(pointCount, bounds) {
31582    if (pointCount > 0) {
31583      // marker exists
31584      // set manually options or do fit
31585      var manuallyAdjust = false;
31586      var idleAdjuster = function() {};
31587
31588      if (Googlemaps_Map.center) {
31589        var center = Googlemaps_Map.getCenter();
31590        Googlemaps_Map.map.setCenter(new google.maps.LatLng(center[0], center[1]));
31591        manuallyAdjust = true;
31592      }
31593
31594      if (Googlemaps_Map.zoom) {
31595        Googlemaps_Map.map.setZoom(Googlemaps_Map.getZoom());
31596        manuallyAdjust = true;
31597      }
31598
31599      if (!manuallyAdjust) {
31600        idleAdjuster = function() {
31601          if (Googlemaps_Map.map.getZoom() > Googlemaps_Map.getZoom()) {
31602            Googlemaps_Map.map.setZoom(Googlemaps_Map.getZoom());
31603          }
31604        };
31605        Googlemaps_Map.map.fitBounds(bounds);
31606      }
31607      google.maps.event.addListenerOnce(Googlemaps_Map.map, "idle", idleAdjuster);
31608    } else {
31609      // marker not exists
31610      // set manually or default options
31611      var center = Googlemaps_Map.getCenter();
31612      Googlemaps_Map.map.setCenter(new google.maps.LatLng(center[0], center[1]));
31613      Googlemaps_Map.map.setZoom(Googlemaps_Map.getZoom());
31614    }
31615  };
31616
31617  Googlemaps_Map.validateZoom = function (zoom) {
31618    if (zoom >= 1 && zoom <= 21) {
31619      return true;
31620    } else {
31621      return false;
31622    }
31623  };
31624
31625  Googlemaps_Map.validateLatLon = function (lat, lon) {
31626    if (lat >= -90 && lat <= 90 && lon >= -180 && lon <= 180) {
31627      return true;
31628    } else {
31629      return false;
31630    }
31631  };
31632
31633  Googlemaps_Map.getMapsSearchHtml = function(lat, lng) {
31634    const url = `${Googlemaps_Map.mapsSearchUrl}${lat},${lng}`;
31635    return `<p class="marker-link"><a href="${url}">Googleマップで確認する</a></p>`;
31636  };
31637
31638  return Googlemaps_Map;
31639})();
31640this.Facility_Search = (function () {
31641  function Facility_Search() {
31642  }
31643
31644  Facility_Search.render = function (selector, opts) {
31645    var markers, overrided, slideSidebar;
31646    if (opts == null) {
31647      //define functions
31648      opts = {};
31649    }
31650    markers = opts["markers"];
31651    slideSidebar = function (column) {
31652      var columnTop, indexTop, scrolled;
31653      columnTop = column.offset().top;
31654      indexTop = column.closest("#map-sidebar").offset().top;
31655      scrolled = column.closest("#map-sidebar").scrollTop();
31656      column.closest("#map-sidebar").animate({
31657        scrollTop: columnTop - indexTop + scrolled
31658      }, 'fast');
31659    };
31660
31661    //setup map
31662    Googlemaps_Map.load(selector, opts);
31663
31664    //setup markers
31665    overrided = Googlemaps_Map.attachMessage;
31666    Googlemaps_Map.attachMessage = function (id) {
31667      overrided(id);
31668      google.maps.event.addListener(Googlemaps_Map.markers[id]["marker"], 'click', function (_event) {
31669        var column, dataID;
31670        $("#map-sidebar .column").removeClass("current");
31671        dataID = Googlemaps_Map.markers[id]["id"];
31672        column = $('#map-sidebar .column[data-id="' + dataID + '"]');
31673        if (column.length) {
31674          column.addClass("current");
31675          slideSidebar(column);
31676        }
31677      });
31678      google.maps.event.addListener(Googlemaps_Map.markers[id]["window"], 'closeclick', function (_event) {
31679        $("#map-sidebar .column").removeClass("current");
31680      });
31681    };
31682    Googlemaps_Map.setMarkers(markers, { markerCluster: opts['markerCluster'] });
31683
31684    //setup sidebar
31685    $("#map-sidebar .column .click-marker").on("click", function () {
31686      var dataID;
31687      dataID = parseInt($(this).closest(".column").attr("data-id"));
31688      $("#map-sidebar .column").removeClass("current");
31689      $.each(Googlemaps_Map.markers, function (i, m) {
31690        var column;
31691        if (dataID === m["id"]) {
31692          if (Googlemaps_Map.markerClusterer) {
31693            var cluster = Googlemaps_Map.markerClusterer.clusters_.find(function(cluster) {
31694              if (cluster.getMarkers().length === 1) return false;
31695              return cluster.getMarkers().find(function(marker) {
31696                return marker.position === m.marker.position;
31697              });
31698            });
31699            if (cluster) {
31700              m["window"].setPosition(cluster.getMarkers()[0].position);
31701              m["window"].pixelOffset = new google.maps.Size(0, -15);
31702            }
31703          }
31704
31705          if (Googlemaps_Map.openedInfo) {
31706            Googlemaps_Map.openedInfo.close();
31707          }
31708          m["window"].open(m["marker"].getMap() || Googlemaps_Map.map, m["marker"]);
31709          Googlemaps_Map.openedInfo = m["window"];
31710          column = $('#map-sidebar .column[data-id="' + dataID + '"]');
31711          column.addClass("current");
31712          slideSidebar(column);
31713          return false;
31714        }
31715      });
31716
31717      return false;
31718    });
31719
31720    //setup category filter
31721    $(".filters a").on("click", function () {
31722      var dataIDs;
31723      $(this).toggleClass("clicked").blur();
31724      dataIDs = [];
31725      $(".filters a.clicked").each(function () {
31726        return dataIDs.push(parseInt($(this).attr("data-id")));
31727      });
31728      $.each(Googlemaps_Map.markers, function (id, _value) {
31729        var column, dataID, visible;
31730        visible = false;
31731        $.each(dataIDs, function () {
31732          if ($.inArray(parseInt(this), Googlemaps_Map.markers[id]["category"]) >= 0) {
31733            visible = true;
31734            return false;
31735          }
31736        });
31737        dataID = Googlemaps_Map.markers[id]["id"];
31738        column = $('#map-sidebar .column[data-id="' + dataID + '"]');
31739        if (visible) {
31740          Googlemaps_Map.markers[id]["marker"].setVisible(true);
31741          column.show();
31742        } else {
31743          Googlemaps_Map.markers[id]["marker"].setVisible(false);
31744          if (Googlemaps_Map.markers[id]["window"]) {
31745            Googlemaps_Map.markers[id]["window"].close();
31746          }
31747          column.hide();
31748        }
31749      });
31750
31751      $('#map-sidebar .column[data-cate-id]').each(function() {
31752        var column = $(this);
31753        var cateID = parseInt(column.attr('data-cate-id'));
31754        var exists = $.inArray(cateID, dataIDs) >= 0;
31755        column.toggle(exists);
31756      });
31757
31758      var resultSize = $('#map-sidebar .column:visible').length;
31759      $('.map-search-result .number').text(resultSize);
31760
31761      if (Googlemaps_Map.openedInfo) {
31762        Googlemaps_Map.openedInfo.close();
31763        Googlemaps_Map.openedInfo = null;
31764      }
31765      if (Googlemaps_Map.markerClusterer) {
31766        Googlemaps_Map.markerClusterer.repaint();
31767        Googlemaps_Map.closeMarkerClusterInfo();
31768      }
31769      return false;
31770    });
31771
31772    //setup location filter
31773    $(".filters .focus").on("change", function () {
31774      var select;
31775      select = $(this);
31776      select.find("option:selected").each(function () {
31777        var latlng, loc, zoomLevel;
31778        if ($(this).val() === "") {
31779          return false;
31780        }
31781        loc = $(this).val().split(",");
31782        zoomLevel = $(this).attr("data-zoom-level");
31783        latlng = new google.maps.LatLng(loc[0], loc[1]);
31784        Googlemaps_Map.map.setCenter(latlng);
31785        if (zoomLevel) {
31786          Googlemaps_Map.map.setZoom(parseInt(zoomLevel));
31787        }
31788        select.val("");
31789      });
31790    });
31791
31792    //click selected category
31793    $('.map-search-condition .category-settings').each(function() {
31794      var settings = $(this).attr('data-category-settings');
31795      if (!settings) return false;
31796      $('.map-search-index .filters a').each(function() {
31797        var $btn = $(this);
31798        if (!settings.includes($btn.text())) {
31799          $btn.click();
31800        }
31801      });
31802    });
31803  };
31804
31805  return Facility_Search;
31806})();
vendor: 40,454 bytes, lines 31807-32865
31807(function() {
31808
31809    var debug = false;
31810
31811    var root = this;
31812
31813    var EXIF = function(obj) {
31814        if (obj instanceof EXIF) return obj;
31815        if (!(this instanceof EXIF)) return new EXIF(obj);
31816        this.EXIFwrapped = obj;
31817    };
31818
31819    if (typeof exports !== 'undefined') {
31820        if (typeof module !== 'undefined' && module.exports) {
31821            exports = module.exports = EXIF;
31822        }
31823        exports.EXIF = EXIF;
31824    } else {
31825        root.EXIF = EXIF;
31826    }
31827
31828    var ExifTags = EXIF.Tags = {
31829
31830        // version tags
31831        0x9000 : "ExifVersion",             // EXIF version
31832        0xA000 : "FlashpixVersion",         // Flashpix format version
31833
31834        // colorspace tags
31835        0xA001 : "ColorSpace",              // Color space information tag
31836
31837        // image configuration
31838        0xA002 : "PixelXDimension",         // Valid width of meaningful image
31839        0xA003 : "PixelYDimension",         // Valid height of meaningful image
31840        0x9101 : "ComponentsConfiguration", // Information about channels
31841        0x9102 : "CompressedBitsPerPixel",  // Compressed bits per pixel
31842
31843        // user information
31844        0x927C : "MakerNote",               // Any desired information written by the manufacturer
31845        0x9286 : "UserComment",             // Comments by user
31846
31847        // related file
31848        0xA004 : "RelatedSoundFile",        // Name of related sound file
31849
31850        // date and time
31851        0x9003 : "DateTimeOriginal",        // Date and time when the original image was generated
31852        0x9004 : "DateTimeDigitized",       // Date and time when the image was stored digitally
31853        0x9290 : "SubsecTime",              // Fractions of seconds for DateTime
31854        0x9291 : "SubsecTimeOriginal",      // Fractions of seconds for DateTimeOriginal
31855        0x9292 : "SubsecTimeDigitized",     // Fractions of seconds for DateTimeDigitized
31856
31857        // picture-taking conditions
31858        0x829A : "ExposureTime",            // Exposure time (in seconds)
31859        0x829D : "FNumber",                 // F number
31860        0x8822 : "ExposureProgram",         // Exposure program
31861        0x8824 : "SpectralSensitivity",     // Spectral sensitivity
31862        0x8827 : "ISOSpeedRatings",         // ISO speed rating
31863        0x8828 : "OECF",                    // Optoelectric conversion factor
31864        0x9201 : "ShutterSpeedValue",       // Shutter speed
31865        0x9202 : "ApertureValue",           // Lens aperture
31866        0x9203 : "BrightnessValue",         // Value of brightness
31867        0x9204 : "ExposureBias",            // Exposure bias
31868        0x9205 : "MaxApertureValue",        // Smallest F number of lens
31869        0x9206 : "SubjectDistance",         // Distance to subject in meters
31870        0x9207 : "MeteringMode",            // Metering mode
31871        0x9208 : "LightSource",             // Kind of light source
31872        0x9209 : "Flash",                   // Flash status
31873        0x9214 : "SubjectArea",             // Location and area of main subject
31874        0x920A : "FocalLength",             // Focal length of the lens in mm
31875        0xA20B : "FlashEnergy",             // Strobe energy in BCPS
31876        0xA20C : "SpatialFrequencyResponse",    //
31877        0xA20E : "FocalPlaneXResolution",   // Number of pixels in width direction per FocalPlaneResolutionUnit
31878        0xA20F : "FocalPlaneYResolution",   // Number of pixels in height direction per FocalPlaneResolutionUnit
31879        0xA210 : "FocalPlaneResolutionUnit",    // Unit for measuring FocalPlaneXResolution and FocalPlaneYResolution
31880        0xA214 : "SubjectLocation",         // Location of subject in image
31881        0xA215 : "ExposureIndex",           // Exposure index selected on camera
31882        0xA217 : "SensingMethod",           // Image sensor type
31883        0xA300 : "FileSource",              // Image source (3 == DSC)
31884        0xA301 : "SceneType",               // Scene type (1 == directly photographed)
31885        0xA302 : "CFAPattern",              // Color filter array geometric pattern
31886        0xA401 : "CustomRendered",          // Special processing
31887        0xA402 : "ExposureMode",            // Exposure mode
31888        0xA403 : "WhiteBalance",            // 1 = auto white balance, 2 = manual
31889        0xA404 : "DigitalZoomRation",       // Digital zoom ratio
31890        0xA405 : "FocalLengthIn35mmFilm",   // Equivalent foacl length assuming 35mm film camera (in mm)
31891        0xA406 : "SceneCaptureType",        // Type of scene
31892        0xA407 : "GainControl",             // Degree of overall image gain adjustment
31893        0xA408 : "Contrast",                // Direction of contrast processing applied by camera
31894        0xA409 : "Saturation",              // Direction of saturation processing applied by camera
31895        0xA40A : "Sharpness",               // Direction of sharpness processing applied by camera
31896        0xA40B : "DeviceSettingDescription",    //
31897        0xA40C : "SubjectDistanceRange",    // Distance to subject
31898
31899        // other tags
31900        0xA005 : "InteroperabilityIFDPointer",
31901        0xA420 : "ImageUniqueID"            // Identifier assigned uniquely to each image
31902    };
31903
31904    var TiffTags = EXIF.TiffTags = {
31905        0x0100 : "ImageWidth",
31906        0x0101 : "ImageHeight",
31907        0x8769 : "ExifIFDPointer",
31908        0x8825 : "GPSInfoIFDPointer",
31909        0xA005 : "InteroperabilityIFDPointer",
31910        0x0102 : "BitsPerSample",
31911        0x0103 : "Compression",
31912        0x0106 : "PhotometricInterpretation",
31913        0x0112 : "Orientation",
31914        0x0115 : "SamplesPerPixel",
31915        0x011C : "PlanarConfiguration",
31916        0x0212 : "YCbCrSubSampling",
31917        0x0213 : "YCbCrPositioning",
31918        0x011A : "XResolution",
31919        0x011B : "YResolution",
31920        0x0128 : "ResolutionUnit",
31921        0x0111 : "StripOffsets",
31922        0x0116 : "RowsPerStrip",
31923        0x0117 : "StripByteCounts",
31924        0x0201 : "JPEGInterchangeFormat",
31925        0x0202 : "JPEGInterchangeFormatLength",
31926        0x012D : "TransferFunction",
31927        0x013E : "WhitePoint",
31928        0x013F : "PrimaryChromaticities",
31929        0x0211 : "YCbCrCoefficients",
31930        0x0214 : "ReferenceBlackWhite",
31931        0x0132 : "DateTime",
31932        0x010E : "ImageDescription",
31933        0x010F : "Make",
31934        0x0110 : "Model",
31935        0x0131 : "Software",
31936        0x013B : "Artist",
31937        0x8298 : "Copyright"
31938    };
31939
31940    var GPSTags = EXIF.GPSTags = {
31941        0x0000 : "GPSVersionID",
31942        0x0001 : "GPSLatitudeRef",
31943        0x0002 : "GPSLatitude",
31944        0x0003 : "GPSLongitudeRef",
31945        0x0004 : "GPSLongitude",
31946        0x0005 : "GPSAltitudeRef",
31947        0x0006 : "GPSAltitude",
31948        0x0007 : "GPSTimeStamp",
31949        0x0008 : "GPSSatellites",
31950        0x0009 : "GPSStatus",
31951        0x000A : "GPSMeasureMode",
31952        0x000B : "GPSDOP",
31953        0x000C : "GPSSpeedRef",
31954        0x000D : "GPSSpeed",
31955        0x000E : "GPSTrackRef",
31956        0x000F : "GPSTrack",
31957        0x0010 : "GPSImgDirectionRef",
31958        0x0011 : "GPSImgDirection",
31959        0x0012 : "GPSMapDatum",
31960        0x0013 : "GPSDestLatitudeRef",
31961        0x0014 : "GPSDestLatitude",
31962        0x0015 : "GPSDestLongitudeRef",
31963        0x0016 : "GPSDestLongitude",
31964        0x0017 : "GPSDestBearingRef",
31965        0x0018 : "GPSDestBearing",
31966        0x0019 : "GPSDestDistanceRef",
31967        0x001A : "GPSDestDistance",
31968        0x001B : "GPSProcessingMethod",
31969        0x001C : "GPSAreaInformation",
31970        0x001D : "GPSDateStamp",
31971        0x001E : "GPSDifferential"
31972    };
31973
31974     // EXIF 2.3 Spec
31975    var IFD1Tags = EXIF.IFD1Tags = {
31976        0x0100: "ImageWidth",
31977        0x0101: "ImageHeight",
31978        0x0102: "BitsPerSample",
31979        0x0103: "Compression",
31980        0x0106: "PhotometricInterpretation",
31981        0x0111: "StripOffsets",
31982        0x0112: "Orientation",
31983        0x0115: "SamplesPerPixel",
31984        0x0116: "RowsPerStrip",
31985        0x0117: "StripByteCounts",
31986        0x011A: "XResolution",
31987        0x011B: "YResolution",
31988        0x011C: "PlanarConfiguration",
31989        0x0128: "ResolutionUnit",
31990        0x0201: "JpegIFOffset",    // When image format is JPEG, this value show offset to JPEG data stored.(aka "ThumbnailOffset" or "JPEGInterchangeFormat")
31991        0x0202: "JpegIFByteCount", // When image format is JPEG, this value shows data size of JPEG image (aka "ThumbnailLength" or "JPEGInterchangeFormatLength")
31992        0x0211: "YCbCrCoefficients",
31993        0x0212: "YCbCrSubSampling",
31994        0x0213: "YCbCrPositioning",
31995        0x0214: "ReferenceBlackWhite"
31996    };
31997
31998    var StringValues = EXIF.StringValues = {
31999        ExposureProgram : {
32000            0 : "Not defined",
32001            1 : "Manual",
32002            2 : "Normal program",
32003            3 : "Aperture priority",
32004            4 : "Shutter priority",
32005            5 : "Creative program",
32006            6 : "Action program",
32007            7 : "Portrait mode",
32008            8 : "Landscape mode"
32009        },
32010        MeteringMode : {
32011            0 : "Unknown",
32012            1 : "Average",
32013            2 : "CenterWeightedAverage",
32014            3 : "Spot",
32015            4 : "MultiSpot",
32016            5 : "Pattern",
32017            6 : "Partial",
32018            255 : "Other"
32019        },
32020        LightSource : {
32021            0 : "Unknown",
32022            1 : "Daylight",
32023            2 : "Fluorescent",
32024            3 : "Tungsten (incandescent light)",
32025            4 : "Flash",
32026            9 : "Fine weather",
32027            10 : "Cloudy weather",
32028            11 : "Shade",
32029            12 : "Daylight fluorescent (D 5700 - 7100K)",
32030            13 : "Day white fluorescent (N 4600 - 5400K)",
32031            14 : "Cool white fluorescent (W 3900 - 4500K)",
32032            15 : "White fluorescent (WW 3200 - 3700K)",
32033            17 : "Standard light A",
32034            18 : "Standard light B",
32035            19 : "Standard light C",
32036            20 : "D55",
32037            21 : "D65",
32038            22 : "D75",
32039            23 : "D50",
32040            24 : "ISO studio tungsten",
32041            255 : "Other"
32042        },
32043        Flash : {
32044            0x0000 : "Flash did not fire",
32045            0x0001 : "Flash fired",
32046            0x0005 : "Strobe return light not detected",
32047            0x0007 : "Strobe return light detected",
32048            0x0009 : "Flash fired, compulsory flash mode",
32049            0x000D : "Flash fired, compulsory flash mode, return light not detected",
32050            0x000F : "Flash fired, compulsory flash mode, return light detected",
32051            0x0010 : "Flash did not fire, compulsory flash mode",
32052            0x0018 : "Flash did not fire, auto mode",
32053            0x0019 : "Flash fired, auto mode",
32054            0x001D : "Flash fired, auto mode, return light not detected",
32055            0x001F : "Flash fired, auto mode, return light detected",
32056            0x0020 : "No flash function",
32057            0x0041 : "Flash fired, red-eye reduction mode",
32058            0x0045 : "Flash fired, red-eye reduction mode, return light not detected",
32059            0x0047 : "Flash fired, red-eye reduction mode, return light detected",
32060            0x0049 : "Flash fired, compulsory flash mode, red-eye reduction mode",
32061            0x004D : "Flash fired, compulsory flash mode, red-eye reduction mode, return light not detected",
32062            0x004F : "Flash fired, compulsory flash mode, red-eye reduction mode, return light detected",
32063            0x0059 : "Flash fired, auto mode, red-eye reduction mode",
32064            0x005D : "Flash fired, auto mode, return light not detected, red-eye reduction mode",
32065            0x005F : "Flash fired, auto mode, return light detected, red-eye reduction mode"
32066        },
32067        SensingMethod : {
32068            1 : "Not defined",
32069            2 : "One-chip color area sensor",
32070            3 : "Two-chip color area sensor",
32071            4 : "Three-chip color area sensor",
32072            5 : "Color sequential area sensor",
32073            7 : "Trilinear sensor",
32074            8 : "Color sequential linear sensor"
32075        },
32076        SceneCaptureType : {
32077            0 : "Standard",
32078            1 : "Landscape",
32079            2 : "Portrait",
32080            3 : "Night scene"
32081        },
32082        SceneType : {
32083            1 : "Directly photographed"
32084        },
32085        CustomRendered : {
32086            0 : "Normal process",
32087            1 : "Custom process"
32088        },
32089        WhiteBalance : {
32090            0 : "Auto white balance",
32091            1 : "Manual white balance"
32092        },
32093        GainControl : {
32094            0 : "None",
32095            1 : "Low gain up",
32096            2 : "High gain up",
32097            3 : "Low gain down",
32098            4 : "High gain down"
32099        },
32100        Contrast : {
32101            0 : "Normal",
32102            1 : "Soft",
32103            2 : "Hard"
32104        },
32105        Saturation : {
32106            0 : "Normal",
32107            1 : "Low saturation",
32108            2 : "High saturation"
32109        },
32110        Sharpness : {
32111            0 : "Normal",
32112            1 : "Soft",
32113            2 : "Hard"
32114        },
32115        SubjectDistanceRange : {
32116            0 : "Unknown",
32117            1 : "Macro",
32118            2 : "Close view",
32119            3 : "Distant view"
32120        },
32121        FileSource : {
32122            3 : "DSC"
32123        },
32124
32125        Components : {
32126            0 : "",
32127            1 : "Y",
32128            2 : "Cb",
32129            3 : "Cr",
32130            4 : "R",
32131            5 : "G",
32132            6 : "B"
32133        }
32134    };
32135
32136    function addEvent(element, event, handler) {
32137        if (element.addEventListener) {
32138            element.addEventListener(event, handler, false);
32139        } else if (element.attachEvent) {
32140            element.attachEvent("on" + event, handler);
32141        }
32142    }
32143
32144    function imageHasData(img) {
32145        return !!(img.exifdata);
32146    }
32147
32148
32149    function base64ToArrayBuffer(base64, contentType) {
32150        contentType = contentType || base64.match(/^data\:([^\;]+)\;base64,/mi)[1] || ''; // e.g. 'data:image/jpeg;base64,...' => 'image/jpeg'
32151        base64 = base64.replace(/^data\:([^\;]+)\;base64,/gmi, '');
32152        var binary = atob(base64);
32153        var len = binary.length;
32154        var buffer = new ArrayBuffer(len);
32155        var view = new Uint8Array(buffer);
32156        for (var i = 0; i < len; i++) {
32157            view[i] = binary.charCodeAt(i);
32158        }
32159        return buffer;
32160    }
32161
32162    function objectURLToBlob(url, callback) {
32163        var http = new XMLHttpRequest();
32164        http.open("GET", url, true);
32165        http.responseType = "blob";
32166        http.onload = function(e) {
32167            if (this.status == 200 || this.status === 0) {
32168                callback(this.response);
32169            }
32170        };
32171        http.send();
32172    }
32173
32174    function getImageData(img, callback) {
32175        function handleBinaryFile(binFile) {
32176            var data = findEXIFinJPEG(binFile);
32177            img.exifdata = data || {};
32178            var iptcdata = findIPTCinJPEG(binFile);
32179            img.iptcdata = iptcdata || {};
32180            if (EXIF.isXmpEnabled) {
32181               var xmpdata= findXMPinJPEG(binFile);
32182               img.xmpdata = xmpdata || {};               
32183            }
32184            if (callback) {
32185                callback.call(img);
32186            }
32187        }
32188
32189        if (img.src) {
32190            if (/^data\:/i.test(img.src)) { // Data URI
32191                var arrayBuffer = base64ToArrayBuffer(img.src);
32192                handleBinaryFile(arrayBuffer);
32193
32194            } else if (/^blob\:/i.test(img.src)) { // Object URL
32195                var fileReader = new FileReader();
32196                fileReader.onload = function(e) {
32197                    handleBinaryFile(e.target.result);
32198                };
32199                objectURLToBlob(img.src, function (blob) {
32200                    fileReader.readAsArrayBuffer(blob);
32201                });
32202            } else {
32203                var http = new XMLHttpRequest();
32204                http.onload = function() {
32205                    if (this.status == 200 || this.status === 0) {
32206                        handleBinaryFile(http.response);
32207                    } else {
32208                        throw "Could not load image";
32209                    }
32210                    http = null;
32211                };
32212                http.open("GET", img.src, true);
32213                http.responseType = "arraybuffer";
32214                http.send(null);
32215            }
32216        } else if (self.FileReader && (img instanceof self.Blob || img instanceof self.File)) {
32217            var fileReader = new FileReader();
32218            fileReader.onload = function(e) {
32219                if (debug) console.log("Got file of length " + e.target.result.byteLength);
32220                handleBinaryFile(e.target.result);
32221            };
32222
32223            fileReader.readAsArrayBuffer(img);
32224        }
32225    }
32226
32227    function findEXIFinJPEG(file) {
32228        var dataView = new DataView(file);
32229
32230        if (debug) console.log("Got file of length " + file.byteLength);
32231        if ((dataView.getUint8(0) != 0xFF) || (dataView.getUint8(1) != 0xD8)) {
32232            if (debug) console.log("Not a valid JPEG");
32233            return false; // not a valid jpeg
32234        }
32235
32236        var offset = 2,
32237            length = file.byteLength,
32238            marker;
32239
32240        while (offset < length) {
32241            if (dataView.getUint8(offset) != 0xFF) {
32242                if (debug) console.log("Not a valid marker at offset " + offset + ", found: " + dataView.getUint8(offset));
32243                return false; // not a valid marker, something is wrong
32244            }
32245
32246            marker = dataView.getUint8(offset + 1);
32247            if (debug) console.log(marker);
32248
32249            // we could implement handling for other markers here,
32250            // but we're only looking for 0xFFE1 for EXIF data
32251
32252            if (marker == 225) {
32253                if (debug) console.log("Found 0xFFE1 marker");
32254
32255                return readEXIFData(dataView, offset + 4, dataView.getUint16(offset + 2) - 2);
32256
32257                // offset += 2 + file.getShortAt(offset+2, true);
32258
32259            } else {
32260                offset += 2 + dataView.getUint16(offset+2);
32261            }
32262
32263        }
32264
32265    }
32266
32267    function findIPTCinJPEG(file) {
32268        var dataView = new DataView(file);
32269
32270        if (debug) console.log("Got file of length " + file.byteLength);
32271        if ((dataView.getUint8(0) != 0xFF) || (dataView.getUint8(1) != 0xD8)) {
32272            if (debug) console.log("Not a valid JPEG");
32273            return false; // not a valid jpeg
32274        }
32275
32276        var offset = 2,
32277            length = file.byteLength;
32278
32279
32280        var isFieldSegmentStart = function(dataView, offset){
32281            return (
32282                dataView.getUint8(offset) === 0x38 &&
32283                dataView.getUint8(offset+1) === 0x42 &&
32284                dataView.getUint8(offset+2) === 0x49 &&
32285                dataView.getUint8(offset+3) === 0x4D &&
32286                dataView.getUint8(offset+4) === 0x04 &&
32287                dataView.getUint8(offset+5) === 0x04
32288            );
32289        };
32290
32291        while (offset < length) {
32292
32293            if ( isFieldSegmentStart(dataView, offset )){
32294
32295                // Get the length of the name header (which is padded to an even number of bytes)
32296                var nameHeaderLength = dataView.getUint8(offset+7);
32297                if(nameHeaderLength % 2 !== 0) nameHeaderLength += 1;
32298                // Check for pre photoshop 6 format
32299                if(nameHeaderLength === 0) {
32300                    // Always 4
32301                    nameHeaderLength = 4;
32302                }
32303
32304                var startOffset = offset + 8 + nameHeaderLength;
32305                var sectionLength = dataView.getUint16(offset + 6 + nameHeaderLength);
32306
32307                return readIPTCData(file, startOffset, sectionLength);
32308
32309                break;
32310
32311            }
32312
32313
32314            // Not the marker, continue searching
32315            offset++;
32316
32317        }
32318
32319    }
32320    var IptcFieldMap = {
32321        0x78 : 'caption',
32322        0x6E : 'credit',
32323        0x19 : 'keywords',
32324        0x37 : 'dateCreated',
32325        0x50 : 'byline',
32326        0x55 : 'bylineTitle',
32327        0x7A : 'captionWriter',
32328        0x69 : 'headline',
32329        0x74 : 'copyright',
32330        0x0F : 'category'
32331    };
32332    function readIPTCData(file, startOffset, sectionLength){
32333        var dataView = new DataView(file);
32334        var data = {};
32335        var fieldValue, fieldName, dataSize, segmentType, segmentSize;
32336        var segmentStartPos = startOffset;
32337        while(segmentStartPos < startOffset+sectionLength) {
32338            if(dataView.getUint8(segmentStartPos) === 0x1C && dataView.getUint8(segmentStartPos+1) === 0x02){
32339                segmentType = dataView.getUint8(segmentStartPos+2);
32340                if(segmentType in IptcFieldMap) {
32341                    dataSize = dataView.getInt16(segmentStartPos+3);
32342                    segmentSize = dataSize + 5;
32343                    fieldName = IptcFieldMap[segmentType];
32344                    fieldValue = getStringFromDB(dataView, segmentStartPos+5, dataSize);
32345                    // Check if we already stored a value with this name
32346                    if(data.hasOwnProperty(fieldName)) {
32347                        // Value already stored with this name, create multivalue field
32348                        if(data[fieldName] instanceof Array) {
32349                            data[fieldName].push(fieldValue);
32350                        }
32351                        else {
32352                            data[fieldName] = [data[fieldName], fieldValue];
32353                        }
32354                    }
32355                    else {
32356                        data[fieldName] = fieldValue;
32357                    }
32358                }
32359
32360            }
32361            segmentStartPos++;
32362        }
32363        return data;
32364    }
32365
32366
32367
32368    function readTags(file, tiffStart, dirStart, strings, bigEnd) {
32369        var entries = file.getUint16(dirStart, !bigEnd),
32370            tags = {},
32371            entryOffset, tag,
32372            i;
32373
32374        for (i=0;i<entries;i++) {
32375            entryOffset = dirStart + i*12 + 2;
32376            tag = strings[file.getUint16(entryOffset, !bigEnd)];
32377            if (!tag && debug) console.log("Unknown tag: " + file.getUint16(entryOffset, !bigEnd));
32378            tags[tag] = readTagValue(file, entryOffset, tiffStart, dirStart, bigEnd);
32379        }
32380        return tags;
32381    }
32382
32383
32384    function readTagValue(file, entryOffset, tiffStart, dirStart, bigEnd) {
32385        var type = file.getUint16(entryOffset+2, !bigEnd),
32386            numValues = file.getUint32(entryOffset+4, !bigEnd),
32387            valueOffset = file.getUint32(entryOffset+8, !bigEnd) + tiffStart,
32388            offset,
32389            vals, val, n,
32390            numerator, denominator;
32391
32392        switch (type) {
32393            case 1: // byte, 8-bit unsigned int
32394            case 7: // undefined, 8-bit byte, value depending on field
32395                if (numValues == 1) {
32396                    return file.getUint8(entryOffset + 8, !bigEnd);
32397                } else {
32398                    offset = numValues > 4 ? valueOffset : (entryOffset + 8);
32399                    vals = [];
32400                    for (n=0;n<numValues;n++) {
32401                        vals[n] = file.getUint8(offset + n);
32402                    }
32403                    return vals;
32404                }
32405
32406            case 2: // ascii, 8-bit byte
32407                offset = numValues > 4 ? valueOffset : (entryOffset + 8);
32408                return getStringFromDB(file, offset, numValues-1);
32409
32410            case 3: // short, 16 bit int
32411                if (numValues == 1) {
32412                    return file.getUint16(entryOffset + 8, !bigEnd);
32413                } else {
32414                    offset = numValues > 2 ? valueOffset : (entryOffset + 8);
32415                    vals = [];
32416                    for (n=0;n<numValues;n++) {
32417                        vals[n] = file.getUint16(offset + 2*n, !bigEnd);
32418                    }
32419                    return vals;
32420                }
32421
32422            case 4: // long, 32 bit int
32423                if (numValues == 1) {
32424                    return file.getUint32(entryOffset + 8, !bigEnd);
32425                } else {
32426                    vals = [];
32427                    for (n=0;n<numValues;n++) {
32428                        vals[n] = file.getUint32(valueOffset + 4*n, !bigEnd);
32429                    }
32430                    return vals;
32431                }
32432
32433            case 5:    // rational = two long values, first is numerator, second is denominator
32434                if (numValues == 1) {
32435                    numerator = file.getUint32(valueOffset, !bigEnd);
32436                    denominator = file.getUint32(valueOffset+4, !bigEnd);
32437                    val = new Number(numerator / denominator);
32438                    val.numerator = numerator;
32439                    val.denominator = denominator;
32440                    return val;
32441                } else {
32442                    vals = [];
32443                    for (n=0;n<numValues;n++) {
32444                        numerator = file.getUint32(valueOffset + 8*n, !bigEnd);
32445                        denominator = file.getUint32(valueOffset+4 + 8*n, !bigEnd);
32446                        vals[n] = new Number(numerator / denominator);
32447                        vals[n].numerator = numerator;
32448                        vals[n].denominator = denominator;
32449                    }
32450                    return vals;
32451                }
32452
32453            case 9: // slong, 32 bit signed int
32454                if (numValues == 1) {
32455                    return file.getInt32(entryOffset + 8, !bigEnd);
32456                } else {
32457                    vals = [];
32458                    for (n=0;n<numValues;n++) {
32459                        vals[n] = file.getInt32(valueOffset + 4*n, !bigEnd);
32460                    }
32461                    return vals;
32462                }
32463
32464            case 10: // signed rational, two slongs, first is numerator, second is denominator
32465                if (numValues == 1) {
32466                    return file.getInt32(valueOffset, !bigEnd) / file.getInt32(valueOffset+4, !bigEnd);
32467                } else {
32468                    vals = [];
32469                    for (n=0;n<numValues;n++) {
32470                        vals[n] = file.getInt32(valueOffset + 8*n, !bigEnd) / file.getInt32(valueOffset+4 + 8*n, !bigEnd);
32471                    }
32472                    return vals;
32473                }
32474        }
32475    }
32476
32477    /**
32478    * Given an IFD (Image File Directory) start offset
32479    * returns an offset to next IFD or 0 if it's the last IFD.
32480    */
32481    function getNextIFDOffset(dataView, dirStart, bigEnd){
32482        //the first 2bytes means the number of directory entries contains in this IFD
32483        var entries = dataView.getUint16(dirStart, !bigEnd);
32484
32485        // After last directory entry, there is a 4bytes of data,
32486        // it means an offset to next IFD.
32487        // If its value is '0x00000000', it means this is the last IFD and there is no linked IFD.
32488
32489        return dataView.getUint32(dirStart + 2 + entries * 12, !bigEnd); // each entry is 12 bytes long
32490    }
32491
32492    function readThumbnailImage(dataView, tiffStart, firstIFDOffset, bigEnd){
32493        // get the IFD1 offset
32494        var IFD1OffsetPointer = getNextIFDOffset(dataView, tiffStart+firstIFDOffset, bigEnd);
32495
32496        if (!IFD1OffsetPointer) {
32497            // console.log('******** IFD1Offset is empty, image thumb not found ********');
32498            return {};
32499        }
32500        else if (IFD1OffsetPointer > dataView.byteLength) { // this should not happen
32501            // console.log('******** IFD1Offset is outside the bounds of the DataView ********');
32502            return {};
32503        }
32504        // console.log('*******  thumbnail IFD offset (IFD1) is: %s', IFD1OffsetPointer);
32505
32506        var thumbTags = readTags(dataView, tiffStart, tiffStart + IFD1OffsetPointer, IFD1Tags, bigEnd)
32507
32508        // EXIF 2.3 specification for JPEG format thumbnail
32509
32510        // If the value of Compression(0x0103) Tag in IFD1 is '6', thumbnail image format is JPEG.
32511        // Most of Exif image uses JPEG format for thumbnail. In that case, you can get offset of thumbnail
32512        // by JpegIFOffset(0x0201) Tag in IFD1, size of thumbnail by JpegIFByteCount(0x0202) Tag.
32513        // Data format is ordinary JPEG format, starts from 0xFFD8 and ends by 0xFFD9. It seems that
32514        // JPEG format and 160x120pixels of size are recommended thumbnail format for Exif2.1 or later.
32515
32516        if (thumbTags['Compression']) {
32517            // console.log('Thumbnail image found!');
32518
32519            switch (thumbTags['Compression']) {
32520                case 6:
32521                    // console.log('Thumbnail image format is JPEG');
32522                    if (thumbTags.JpegIFOffset && thumbTags.JpegIFByteCount) {
32523                    // extract the thumbnail
32524                        var tOffset = tiffStart + thumbTags.JpegIFOffset;
32525                        var tLength = thumbTags.JpegIFByteCount;
32526                        thumbTags['blob'] = new Blob([new Uint8Array(dataView.buffer, tOffset, tLength)], {
32527                            type: 'image/jpeg'
32528                        });
32529                    }
32530                break;
32531
32532            case 1:
32533                console.log("Thumbnail image format is TIFF, which is not implemented.");
32534                break;
32535            default:
32536                console.log("Unknown thumbnail image format '%s'", thumbTags['Compression']);
32537            }
32538        }
32539        else if (thumbTags['PhotometricInterpretation'] == 2) {
32540            console.log("Thumbnail image format is RGB, which is not implemented.");
32541        }
32542        return thumbTags;
32543    }
32544
32545    function getStringFromDB(buffer, start, length) {
32546        var outstr = "";
32547        for (n = start; n < start+length; n++) {
32548            outstr += String.fromCharCode(buffer.getUint8(n));
32549        }
32550        return outstr;
32551    }
32552
32553    function readEXIFData(file, start) {
32554        if (getStringFromDB(file, start, 4) != "Exif") {
32555            if (debug) console.log("Not valid EXIF data! " + getStringFromDB(file, start, 4));
32556            return false;
32557        }
32558
32559        var bigEnd,
32560            tags, tag,
32561            exifData, gpsData,
32562            tiffOffset = start + 6;
32563
32564        // test for TIFF validity and endianness
32565        if (file.getUint16(tiffOffset) == 0x4949) {
32566            bigEnd = false;
32567        } else if (file.getUint16(tiffOffset) == 0x4D4D) {
32568            bigEnd = true;
32569        } else {
32570            if (debug) console.log("Not valid TIFF data! (no 0x4949 or 0x4D4D)");
32571            return false;
32572        }
32573
32574        if (file.getUint16(tiffOffset+2, !bigEnd) != 0x002A) {
32575            if (debug) console.log("Not valid TIFF data! (no 0x002A)");
32576            return false;
32577        }
32578
32579        var firstIFDOffset = file.getUint32(tiffOffset+4, !bigEnd);
32580
32581        if (firstIFDOffset < 0x00000008) {
32582            if (debug) console.log("Not valid TIFF data! (First offset less than 8)", file.getUint32(tiffOffset+4, !bigEnd));
32583            return false;
32584        }
32585
32586        tags = readTags(file, tiffOffset, tiffOffset + firstIFDOffset, TiffTags, bigEnd);
32587
32588        if (tags.ExifIFDPointer) {
32589            exifData = readTags(file, tiffOffset, tiffOffset + tags.ExifIFDPointer, ExifTags, bigEnd);
32590            for (tag in exifData) {
32591                switch (tag) {
32592                    case "LightSource" :
32593                    case "Flash" :
32594                    case "MeteringMode" :
32595                    case "ExposureProgram" :
32596                    case "SensingMethod" :
32597                    case "SceneCaptureType" :
32598                    case "SceneType" :
32599                    case "CustomRendered" :
32600                    case "WhiteBalance" :
32601                    case "GainControl" :
32602                    case "Contrast" :
32603                    case "Saturation" :
32604                    case "Sharpness" :
32605                    case "SubjectDistanceRange" :
32606                    case "FileSource" :
32607                        exifData[tag] = StringValues[tag][exifData[tag]];
32608                        break;
32609
32610                    case "ExifVersion" :
32611                    case "FlashpixVersion" :
32612                        exifData[tag] = String.fromCharCode(exifData[tag][0], exifData[tag][1], exifData[tag][2], exifData[tag][3]);
32613                        break;
32614
32615                    case "ComponentsConfiguration" :
32616                        exifData[tag] =
32617                            StringValues.Components[exifData[tag][0]] +
32618                            StringValues.Components[exifData[tag][1]] +
32619                            StringValues.Components[exifData[tag][2]] +
32620                            StringValues.Components[exifData[tag][3]];
32621                        break;
32622                }
32623                tags[tag] = exifData[tag];
32624            }
32625        }
32626
32627        if (tags.GPSInfoIFDPointer) {
32628            gpsData = readTags(file, tiffOffset, tiffOffset + tags.GPSInfoIFDPointer, GPSTags, bigEnd);
32629            for (tag in gpsData) {
32630                switch (tag) {
32631                    case "GPSVersionID" :
32632                        gpsData[tag] = gpsData[tag][0] +
32633                            "." + gpsData[tag][1] +
32634                            "." + gpsData[tag][2] +
32635                            "." + gpsData[tag][3];
32636                        break;
32637                }
32638                tags[tag] = gpsData[tag];
32639            }
32640        }
32641
32642        // extract thumbnail
32643        tags['thumbnail'] = readThumbnailImage(file, tiffOffset, firstIFDOffset, bigEnd);
32644
32645        return tags;
32646    }
32647
32648   function findXMPinJPEG(file) {
32649
32650        if (!('DOMParser' in self)) {
32651            // console.warn('XML parsing not supported without DOMParser');
32652            return;
32653        }
32654        var dataView = new DataView(file);
32655
32656        if (debug) console.log("Got file of length " + file.byteLength);
32657        if ((dataView.getUint8(0) != 0xFF) || (dataView.getUint8(1) != 0xD8)) {
32658           if (debug) console.log("Not a valid JPEG");
32659           return false; // not a valid jpeg
32660        }
32661
32662        var offset = 2,
32663            length = file.byteLength,
32664            dom = new DOMParser();
32665
32666        while (offset < (length-4)) {
32667            if (getStringFromDB(dataView, offset, 4) == "http") {
32668                var startOffset = offset - 1;
32669                var sectionLength = dataView.getUint16(offset - 2) - 1;
32670                var xmpString = getStringFromDB(dataView, startOffset, sectionLength)
32671                var xmpEndIndex = xmpString.indexOf('xmpmeta>') + 8;
32672                xmpString = xmpString.substring( xmpString.indexOf( '<x:xmpmeta' ), xmpEndIndex );
32673
32674                var indexOfXmp = xmpString.indexOf('x:xmpmeta') + 10
32675                //Many custom written programs embed xmp/xml without any namespace. Following are some of them.
32676                //Without these namespaces, XML is thought to be invalid by parsers
32677                xmpString = xmpString.slice(0, indexOfXmp)
32678                            + 'xmlns:Iptc4xmpCore="http://iptc.org/std/Iptc4xmpCore/1.0/xmlns/" '
32679                            + 'xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" '
32680                            + 'xmlns:tiff="http://ns.adobe.com/tiff/1.0/" '
32681                            + 'xmlns:plus="http://schemas.android.com/apk/lib/com.google.android.gms.plus" '
32682                            + 'xmlns:ext="http://www.gettyimages.com/xsltExtension/1.0" '
32683                            + 'xmlns:exif="http://ns.adobe.com/exif/1.0/" '
32684                            + 'xmlns:stEvt="http://ns.adobe.com/xap/1.0/sType/ResourceEvent#" '
32685                            + 'xmlns:stRef="http://ns.adobe.com/xap/1.0/sType/ResourceRef#" '
32686                            + 'xmlns:crs="http://ns.adobe.com/camera-raw-settings/1.0/" '
32687                            + 'xmlns:xapGImg="http://ns.adobe.com/xap/1.0/g/img/" '
32688                            + 'xmlns:Iptc4xmpExt="http://iptc.org/std/Iptc4xmpExt/2008-02-29/" '
32689                            + xmpString.slice(indexOfXmp)
32690
32691                var domDocument = dom.parseFromString( xmpString, 'text/xml' );
32692                return xml2Object(domDocument);
32693            } else{
32694             offset++;
32695            }
32696        }
32697    }
32698
32699    function xml2json(xml) {
32700        var json = {};
32701      
32702        if (xml.nodeType == 1) { // element node
32703          if (xml.attributes.length > 0) {
32704            json['@attributes'] = {};
32705            for (var j = 0; j < xml.attributes.length; j++) {
32706              var attribute = xml.attributes.item(j);
32707              json['@attributes'][attribute.nodeName] = attribute.nodeValue;
32708            }
32709          }
32710        } else if (xml.nodeType == 3) { // text node
32711          return xml.nodeValue;
32712        }
32713      
32714        // deal with children
32715        if (xml.hasChildNodes()) {
32716          for(var i = 0; i < xml.childNodes.length; i++) {
32717            var child = xml.childNodes.item(i);
32718            var nodeName = child.nodeName;
32719            if (json[nodeName] == null) {
32720              json[nodeName] = xml2json(child);
32721            } else {
32722              if (json[nodeName].push == null) {
32723                var old = json[nodeName];
32724                json[nodeName] = [];
32725                json[nodeName].push(old);
32726              }
32727              json[nodeName].push(xml2json(child));
32728            }
32729          }
32730        }
32731        
32732        return json;
32733    }
32734
32735    function xml2Object(xml) {
32736        try {
32737            var obj = {};
32738            if (xml.children.length > 0) {
32739              for (var i = 0; i < xml.children.length; i++) {
32740                var item = xml.children.item(i);
32741                var attributes = item.attributes;
32742                for(var idx in attributes) {
32743                    var itemAtt = attributes[idx];
32744                    var dataKey = itemAtt.nodeName;
32745                    var dataValue = itemAtt.nodeValue;
32746
32747                    if(dataKey !== undefined) {
32748                        obj[dataKey] = dataValue;
32749                    }
32750                }
32751                var nodeName = item.nodeName;
32752
32753                if (typeof (obj[nodeName]) == "undefined") {
32754                  obj[nodeName] = xml2json(item);
32755                } else {
32756                  if (typeof (obj[nodeName].push) == "undefined") {
32757                    var old = obj[nodeName];
32758
32759                    obj[nodeName] = [];
32760                    obj[nodeName].push(old);
32761                  }
32762                  obj[nodeName].push(xml2json(item));
32763                }
32764              }
32765            } else {
32766              obj = xml.textContent;
32767            }
32768            return obj;
32769          } catch (e) {
32770              console.log(e.message);
32771          }
32772    }
32773
32774    EXIF.enableXmp = function() {
32775        EXIF.isXmpEnabled = true;
32776    }
32777
32778    EXIF.disableXmp = function() {
32779        EXIF.isXmpEnabled = false;
32780    }
32781
32782    EXIF.getData = function(img, callback) {
32783        if (((self.Image && img instanceof self.Image)
32784            || (self.HTMLImageElement && img instanceof self.HTMLImageElement))
32785            && !img.complete)
32786            return false;
32787
32788        if (!imageHasData(img)) {
32789            getImageData(img, callback);
32790        } else {
32791            if (callback) {
32792                callback.call(img);
32793            }
32794        }
32795        return true;
32796    }
32797
32798    EXIF.getTag = function(img, tag) {
32799        if (!imageHasData(img)) return;
32800        return img.exifdata[tag];
32801    }
32802    
32803    EXIF.getIptcTag = function(img, tag) {
32804        if (!imageHasData(img)) return;
32805        return img.iptcdata[tag];
32806    }
32807
32808    EXIF.getAllTags = function(img) {
32809        if (!imageHasData(img)) return {};
32810        var a,
32811            data = img.exifdata,
32812            tags = {};
32813        for (a in data) {
32814            if (data.hasOwnProperty(a)) {
32815                tags[a] = data[a];
32816            }
32817        }
32818        return tags;
32819    }
32820    
32821    EXIF.getAllIptcTags = function(img) {
32822        if (!imageHasData(img)) return {};
32823        var a,
32824            data = img.iptcdata,
32825            tags = {};
32826        for (a in data) {
32827            if (data.hasOwnProperty(a)) {
32828                tags[a] = data[a];
32829            }
32830        }
32831        return tags;
32832    }
32833
32834    EXIF.pretty = function(img) {
32835        if (!imageHasData(img)) return "";
32836        var a,
32837            data = img.exifdata,
32838            strPretty = "";
32839        for (a in data) {
32840            if (data.hasOwnProperty(a)) {
32841                if (typeof data[a] == "object") {
32842                    if (data[a] instanceof Number) {
32843                        strPretty += a + " : " + data[a] + " [" + data[a].numerator + "/" + data[a].denominator + "]\r\n";
32844                    } else {
32845                        strPretty += a + " : [" + data[a].length + " values]\r\n";
32846                    }
32847                } else {
32848                    strPretty += a + " : " + data[a] + "\r\n";
32849                }
32850            }
32851        }
32852        return strPretty;
32853    }
32854
32855    EXIF.readFromBinaryFile = function(file) {
32856        return findEXIFinJPEG(file);
32857    }
32858
32859    if (typeof define === 'function' && define.amd) {
32860        define('exif-js', [], function() {
32861            return EXIF;
32862        });
32863    }
32864}.call(this));
32865
32866
32867this.Member_Photo_Form = (function () {
32868  function Member_Photo_Form() {
32869  }
32870
32871  Member_Photo_Form.maxPointForm = 10;
32872
32873  Member_Photo_Form.deleteMessage = "マーカーを削除してよろしいですか?";
32874
32875  Member_Photo_Form.setExifMessage = "画像に位置情報が含まれています。位置情報を地図に設定しますか?";
32876
32877  Member_Photo_Form.dataID = 0;
32878
32879  Member_Photo_Form.clickMarker = null;
32880
32881  Member_Photo_Form.setMapLoc = function (ele, lat, lon) {
32882    lat = Math.ceil(lat * Math.pow(10, 6)) / Math.pow(10, 6);
32883    lon = Math.ceil(lon * Math.pow(10, 6)) / Math.pow(10, 6);
32884    ele.val(lat.toFixed(6) + "," + lon.toFixed(6));
32885  };
32886
32887  Member_Photo_Form.getMapLoc = function (ele) {
32888    var latlon;
32889    latlon = ele.val().split(',');
32890    return new google.maps.LatLng(parseFloat(latlon[1]), parseFloat(latlon[0]));
32891  };
32892
32893  Member_Photo_Form.attachMessage = function (id) {
32894    google.maps.event.addListener(Googlemaps_Map.markers[id], 'click', function (_event) {
32895      if (Googlemaps_Map.openedInfo) {
32896        Googlemaps_Map.openedInfo.close();
32897      }
32898      $('dd[data-id = "' + id + '"]').each(function () {
32899        var markerHtml, name, text;
32900        name = $(this).find(".marker-name").val();
32901        text = $(this).find(".marker-text").val();
32902        if (name !== "" || text !== "") {
32903          markerHtml = '<div class="marker-info">';
32904          if (name !== "") {
32905            markerHtml += '<p>' + name + '</p>';
32906          }
32907          if (text !== "") {
32908            $.each(text.split(/[\r\n]+/), function () {
32909              if (this.match(/^https?:\/\//)) {
32910                return markerHtml += '<p><a href="' + this + '">' + this + '</a></p>';
32911              } else {
32912                return markerHtml += '<p>' + this + '</p>';
32913              }
32914            });
32915          }
32916          Googlemaps_Map.openedInfo = new google.maps.InfoWindow({
32917            content: markerHtml,
32918            maxWidth: 260
32919          });
32920          Googlemaps_Map.openedInfo.open(Googlemaps_Map.markers[id].getMap(), Googlemaps_Map.markers[id]);
32921        }
32922        return false;
32923      });
32924    });
32925  };
32926
32927  Member_Photo_Form.clearMarker = function (ele) {
32928    var dataId;
32929    dataId = 0;
32930    if (ele.val() !== "") {
32931      if (confirm(Member_Photo_Form.deleteMessage)) {
32932        if (Googlemaps_Map.markers[dataId]) {
32933          Googlemaps_Map.markers[dataId].setMap(null);
32934          ele.val("");
32935        }
32936      }
32937    } else {
32938      if (Googlemaps_Map.markers[dataId]) {
32939        Googlemaps_Map.markers[dataId].setMap(null);
32940      }
32941    }
32942  };
32943
32944  Member_Photo_Form.createMarker = function (ele) {
32945    var dataId;
32946    if ($(".mod-map .clicked").val() !== "") {
32947      ele.val($(".mod-map .clicked").val());
32948      dataId = 0;
32949      if (Googlemaps_Map.markers[dataId]) {
32950        Googlemaps_Map.markers[dataId].setMap(null);
32951      }
32952      Googlemaps_Map.markers[dataId] = new google.maps.Marker({
32953        position: Member_Photo_Form.getMapLoc($(".mod-map .marker-loc")),
32954        map: Googlemaps_Map.map,
32955        icon: Googlemaps_Map.markerIcon
32956      });
32957      Member_Photo_Form.attachMessage(dataId);
32958    }
32959  };
32960
32961  Member_Photo_Form.renderMarkers = function () {
32962    var i, len, m, markerBounds, ref;
32963    markerBounds = new google.maps.LatLngBounds();
32964    if (Googlemaps_Map.markers) {
32965      ref = Googlemaps_Map.markers;
32966      for (i = 0, len = ref.length; i < len; i++) {
32967        m = ref[i];
32968        m.setMap(null);
32969      }
32970    }
32971
32972    Googlemaps_Map.markers = [];
32973    Member_Photo_Form.dataID = 0;
32974    $(".mod-map .marker").each(function () {
32975      var loc;
32976      $(this).attr("data-id", Member_Photo_Form.dataID);
32977      if ($(this).find(".marker-loc").val() !== "") {
32978        loc = Member_Photo_Form.getMapLoc($(this).find(".marker-loc"));
32979        Googlemaps_Map.markers[Member_Photo_Form.dataID] = new google.maps.Marker({
32980          position: loc,
32981          map: Googlemaps_Map.map,
32982          icon: Googlemaps_Map.markerIcon
32983        });
32984        Member_Photo_Form.attachMessage(Member_Photo_Form.dataID);
32985        markerBounds.extend(loc);
32986      }
32987      return Member_Photo_Form.dataID += 1;
32988    });
32989    Googlemaps_Map.adjustMarkerBounds(Googlemaps_Map.markers.length, markerBounds);
32990  };
32991
32992  Member_Photo_Form.setExifLatLng = function (selector) {
32993    return $(selector).on("change", function (e) {
32994      if (!e.target.files[0]) {
32995        return;
32996      }
32997      return EXIF.getData(e.target.files[0], function () {
32998        var lat, latRef, lon, lonRef;
32999        lat = EXIF.getTag(this, 'GPSLatitude');
33000        lon = EXIF.getTag(this, 'GPSLongitude');
33001        latRef = EXIF.getTag(this, 'GPSLatitudeRef') || "N";
33002        lonRef = EXIF.getTag(this, 'GPSLongitudeRef') || "W";
33003        if (!(lat && lon)) {
33004          return false;
33005        }
33006        if (!confirm(Member_Photo_Form.setExifMessage)) {
33007          return false;
33008        }
33009        latRef = latRef === "N" ? 1 : -1;
33010        lonRef = lonRef === "W" ? -1 : 1;
33011        lat = (lat[0] + (lat[1] / 60) + (lat[2] / 3600)) * latRef;
33012        lon = (lon[0] + (lon[1] / 60) + (lon[2] / 3600)) * lonRef;
33013        $(".mod-map .clicked").val([lat, lon].join());
33014        Member_Photo_Form.createMarker($(".mod-map .marker-loc"));
33015        return Googlemaps_Map.map.setCenter(new google.maps.LatLng(lon, lat));
33016      });
33017    });
33018  };
33019
33020  Member_Photo_Form.renderEvents = function () {
33021    google.maps.event.addListener(Googlemaps_Map.map, 'click', function (event) {
33022      Member_Photo_Form.setMapLoc($(".mod-map .clicked"), event.latLng.lng(), event.latLng.lat());
33023      return Member_Photo_Form.createMarker($(".mod-map .marker-loc"));
33024    });
33025    $(".mod-map .clear-marker").on('click', function (_e) {
33026      Member_Photo_Form.clearMarker($(".mod-map .marker-loc"));
33027      return false;
33028    });
33029    $(".mod-map .set-center-position").on('click', function () {
33030      var latlng = Googlemaps_Map.map.getCenter();
33031      var lat = Math.floor((latlng.lat() * 1000000)) / 1000000;
33032      var lng = Math.floor((latlng.lng() * 1000000)) / 1000000;
33033      $(".center-input").val(lng + "," + lat);
33034      return false;
33035    });
33036    $(".mod-map .set-zoom-level").on('click', function () {
33037      $(".zoom-input").val(Googlemaps_Map.map.getZoom());
33038      return false;
33039    });
33040    google.maps.event.addListener(Googlemaps_Map.map, 'bounds_changed', function (_event) {
33041      var zoom = Googlemaps_Map.map.getZoom();
33042      $('input[name="item[map_zoom_level]"]').val(zoom);
33043    });
33044  };
33045
33046  return Member_Photo_Form;
33047})();
33048this.Openlayers_Map = (function () {
33049  function Openlayers_Map(canvas, opts) {
33050    if (opts == null) {
33051      opts = {};
33052    }
33053    this.canvas = canvas;
33054    this.opts = opts;
33055
33056    if (opts["zoom"] && this.validateZoom(opts["zoom"])) {
33057      this.zoom = opts["zoom"];
33058    }
33059    this.defaultZoom = Openlayers_Map.defaultZoom;
33060
33061    if (opts["center"] && this.validateLatLon(opts["center"][1], opts["center"][0])) {
33062      this.center = opts["center"];
33063    }
33064    this.defaultCenter = Openlayers_Map.defaultCenter.reverse();
33065
33066    this.showGoogleMapsSearch = false;
33067    if (opts["showGoogleMapsSearch"]) {
33068      this.showGoogleMapsSearch = opts["showGoogleMapsSearch"];
33069    }
33070
33071    this.markerFeature = null;
33072    this.markerLayer = null;
33073    this.popup = null;
33074    this.markerIcon = Openlayers_Map.markerIcon;
33075    this.loadedLayers = [];
33076    this.render();
33077  }
33078
33079  Openlayers_Map.defaultCenter = [36.204824, 138.252924];
33080
33081  Openlayers_Map.defaultZoom = 10;
33082
33083  Openlayers_Map.markerIcon = "/assets/img/googlemaps/marker1.png";
33084
33085  Openlayers_Map.clickIcon = "/assets/img/googlemaps/marker17.png";
33086
33087  Openlayers_Map.prototype.getCenter = function () {
33088    return (this.center ? this.center : this.defaultCenter);
33089  };
33090
33091  Openlayers_Map.prototype.getZoom = function () {
33092    return (this.zoom ? this.zoom : this.defaultZoom);
33093  };
33094
33095  Openlayers_Map.prototype.render = function () {
33096    this.initMap();
33097    this.initPopup();
33098    if (this.opts["markers"]) {
33099      this.renderMarkers(this.opts["markers"]);
33100    }
33101    this.resize();
33102    this.renderEvents();
33103  };
33104
33105  Openlayers_Map.prototype.createLayers = function (layerOpts) {
33106    var i, layer, layers, len, opts, projection, source, url;
33107    layers = [];
33108    for (i = 0, len = layerOpts.length; i < len; i++) {
33109      opts = layerOpts[i];
33110      source = opts["source"];
33111      url = opts["url"];
33112      projection = opts["projection"];
33113      layer = new ol.layer.Tile({
33114        source: new ol.source[source]({
33115          url: url,
33116          projection: projection
33117        })
33118      });
33119      layers.push(layer);
33120    }
33121    return layers;
33122  };
33123
33124  Openlayers_Map.prototype.initMap = function () {
33125    var layerOpts;
33126
33127    layerOpts = this.opts['layers'];
33128    layerOpts || (layerOpts = [
33129      {
33130        source: "XYZ",
33131        url: "https://cyberjapandata.gsi.go.jp/xyz/std/{z}/{x}/{y}.png",
33132        projection: "EPSG:3857"
33133      }
33134    ]);
33135    this.map = new ol.Map({
33136      target: this.canvas,
33137      renderer: ['canvas', 'dom'],
33138      layers: this.createLayers(layerOpts),
33139      controls: ol.control.defaults({
33140        attributionOptions: {
33141          collapsible: false
33142        }
33143      }),
33144      view: new ol.View({
33145        projection: "EPSG:3857",
33146        center: ol.proj.transform(this.getCenter(), "EPSG:4326", "EPSG:3857"),
33147        maxZoom: 18,
33148        zoom: this.getZoom()
33149      }),
33150      logo: true
33151    });
33152  };
33153
33154  Openlayers_Map.prototype.initPopup = function () {
33155    $("body").append('<div id="marker-popup"><button type="button" class="closer" aria-label="閉じる"></button><div class="content marker"></div></div>');
33156    this.popup = $('#marker-popup');
33157    this.popup.hide();
33158    this.popupOverlay = new ol.Overlay({
33159      element: this.popup.get(0),
33160      autoPan: true,
33161      autoPanAnimation: {
33162        duration: 250
33163      }
33164    });
33165    this.map.addOverlay(this.popupOverlay);
33166    this.map.on('pointermove', (function (_this) {
33167      return function (e) {
33168        var cursor, hit, pixel;
33169        if (e.dragging) {
33170          _this.popup.hide();
33171          return;
33172        }
33173        pixel = _this.map.getEventPixel(e.originalEvent);
33174        hit = _this.map.hasFeatureAtPixel(pixel);
33175        cursor = hit ? 'pointer' : '';
33176        return _this.map.getTarget().style.cursor = cursor;
33177      };
33178    })(this));
33179    this.popup.find('.closer').on('click', (function (_this) {
33180      return function (_e) {
33181        _this.popupOverlay.setPosition(void 0);
33182        $(_this).blur();
33183        return false;
33184      };
33185    })(this));
33186  };
33187
33188  Openlayers_Map.prototype.showPopup = function (feature, coordinate) {
33189    var markerHtml;
33190    markerHtml = feature.get("markerHtml");
33191    if (!markerHtml) {
33192      this.popup.hide();
33193      return;
33194    }
33195    this.popup.find('.content').html(markerHtml);
33196    this.popup.show();
33197    this.popupOverlay.setPosition(coordinate);
33198  };
33199
33200  Openlayers_Map.prototype.renderEvents = function () {
33201    this.map.on('click', (function (_this) {
33202      return function (e) {
33203        var feature;
33204        feature = _this.map.forEachFeatureAtPixel(e.pixel, function (feature, _layer) {
33205          return feature;
33206        });
33207        if (feature) {
33208          _this.showPopup(feature, e.coordinate);
33209        }
33210      };
33211    })(this));
33212  };
33213
33214  Openlayers_Map.prototype.createMarkerStyle = function (iconSrc) {
33215    return new ol.style.Style({
33216      image: new ol.style.Icon({
33217        anchor: [0.5, 1],
33218        anchorXUnits: 'fraction',
33219        anchorYUnits: 'fraction',
33220        src: iconSrc
33221      })
33222    });
33223  };
33224
33225  Openlayers_Map.prototype.setMarker = function (loc, opts) {
33226    var feature, iconSrc, pos, style;
33227    if (opts == null) {
33228      opts = {};
33229    }
33230    iconSrc = this.markerIcon;
33231    if (opts['image']) {
33232      iconSrc = opts['image'];
33233    }
33234    style = this.createMarkerStyle(iconSrc);
33235    pos = [loc[1], loc[0]];
33236
33237    feature = new ol.Feature({
33238      geometry: new ol.geom.Point(ol.proj.transform(pos, "EPSG:4326", "EPSG:3857")),
33239      markerId: opts['id'],
33240      markerHtml: opts['html'],
33241      category: opts['category']
33242    });
33243    feature.setStyle(style);
33244    if (!this.markerLayer) {
33245      this.markerLayer = new ol.layer.Vector({
33246        source: new ol.source.Vector({
33247          features: [feature]
33248        })
33249      });
33250      this.map.addLayer(this.markerLayer);
33251    } else {
33252      this.markerLayer.getSource().addFeature(feature);
33253    }
33254    return feature;
33255  };
33256
33257  Openlayers_Map.prototype.getMarker = function (markerId) {
33258    var ret, source;
33259    ret = null;
33260    if (!this.markerLayer) {
33261      return ret;
33262    }
33263    source = this.markerLayer.getSource();
33264    source.forEachFeature(function (feature) {
33265      if (feature.get("markerId") === markerId) {
33266        return ret = feature;
33267      }
33268    });
33269    return ret;
33270  };
33271
33272  Openlayers_Map.prototype.getMarkers = function () {
33273    var features, source;
33274    source = this.markerLayer.getSource();
33275    features = source.getFeatures();
33276    return features;
33277  };
33278
33279  Openlayers_Map.prototype.removeMarkers = function () {
33280    var source;
33281    if (this.popup) {
33282      this.popup.hide();
33283    }
33284    if (this.markerLayer) {
33285      source = this.markerLayer.getSource();
33286      source.forEachFeature(function (feature) {
33287        source.removeFeature(feature);
33288      });
33289    }
33290  };
33291
33292  Openlayers_Map.prototype.setCenter = function (pos) {
33293    return this.map.getView().setCenter(ol.proj.transform(pos, 'EPSG:4326', 'EPSG:3857'));
33294  };
33295
33296  Openlayers_Map.prototype.setZoom = function (level) {
33297    return this.map.getView().setZoom(level);
33298  };
33299
33300  Openlayers_Map.prototype.renderMarkers = function (markers) {
33301    markers.forEach(marker => {
33302      const iconSrc = marker['image'] || this.markerIcon || '/assets/img/openlayers/marker1.png';
33303      const style = this.createMarkerStyle(iconSrc);
33304
33305      const name = marker['name'];
33306      const text = marker['text'];
33307      const html = marker['html'];
33308      const pos = [marker['loc'][0], marker['loc'][1]];
33309
33310      let markerHtml = "";
33311      if (html) {
33312        markerHtml = html;
33313      } else if (name || text) {
33314        const $markerContent = $("<div/>");
33315        if (name) {
33316          $markerContent.append($("<p/>", { class: "marker-name" }).text(name));
33317        }
33318        if (text) {
33319          $markerContent.append(renderMarkerExplanation(text));
33320        }
33321        markerHtml = $markerContent.html();
33322      }
33323      if (this.showGoogleMapsSearch) {
33324        markerHtml += Googlemaps_Map.getMapsSearchHtml(pos[1], pos[0]);
33325      }
33326
33327      const feature = new ol.Feature({
33328        geometry: new ol.geom.Point(ol.proj.transform(pos, "EPSG:4326", "EPSG:3857")),
33329        markerId: marker['id'],
33330        markerHtml: markerHtml,
33331        iconSrc: iconSrc,
33332        category: marker['category']
33333      });
33334
33335      feature.setStyle(style);
33336
33337      if (!this.markerLayer) {
33338        this.markerLayer = new ol.layer.Vector({
33339          source: new ol.source.Vector()
33340        });
33341        this.map.addLayer(this.markerLayer);
33342      }
33343      this.markerLayer.getSource().addFeature(feature);
33344    });
33345  };
33346
33347  function renderMarkerExplanation(text) {
33348    const $markerExplanation = $("<div/>", { class: "marker-explanation" });
33349    text.split(/[\r\n]+/).forEach((line) => {
33350      let $element;
33351      if (/^https?:\/\//.test(line)) {
33352        $element = $("<p/>", { class: "marker-link" }).html($("<a />", { href: line }).text(line));
33353      } else {
33354        $element = $("<p/>").text(line);
33355      }
33356      $markerExplanation.append($element);
33357    });
33358    return $markerExplanation.html();
33359  }
33360
33361  Openlayers_Map.prototype.resize = function () {
33362    if (!this.markerLayer) {
33363      return;
33364    }
33365
33366    var markerLength = this.markerLayer.getSource().getFeatures().length;
33367    if (markerLength >= 0) {
33368      // marker exists
33369      // set manually options and do fit
33370      var extent = this.markerLayer.getSource().getExtent();
33371      this.map.getView().fit(extent, this.map.getSize());
33372
33373      if (markerLength == 1) {
33374        this.map.getView().setZoom(this.getZoom());
33375      }
33376      if (this.center) {
33377        this.setCenter(this.getCenter());
33378      }
33379      if (this.zoom) {
33380        this.setZoom(this.getZoom());
33381      }
33382    } else {
33383      // marker not exists
33384      // set manually or default options
33385      this.setCenter(this.getCenter());
33386      this.setZoom(this.getZoom());
33387    }
33388  };
33389
33390  Openlayers_Map.prototype.loadLayer = function (url, olFormat) {
33391    var _self = this;
33392    var _url = url;
33393    var _olFormat = olFormat;
33394
33395    // https://openlayers.org/en/latest/apidoc/module-ol_source_Vector.html
33396    var vectorSource = new ol.source.Vector({
33397      format: new _olFormat(),
33398      loader: function(extent, resolution, projection) {
33399        // var proj = projection.getCode();
33400        var xhr = new XMLHttpRequest();
33401        var onError = function() {
33402          console.warn("loadLayer error:" + url);
33403        }
33404        xhr.open('GET', _url);
33405        xhr.onerror = onError;
33406        xhr.onloadstart = function() {
33407          $(_self.canvas).hide();
33408        }
33409        xhr.onload = function() {
33410          if (xhr.status == 200) {
33411            var feature = new _olFormat().
33412              readFeatures(xhr.responseText, { featureProjection: projection });
33413            vectorSource.addFeatures(feature);
33414
33415            extent = layer.getSource().getExtent();
33416            $(_self.canvas).show();
33417            _self.map.getView().fit(extent, _self.map.getSize());
33418            if (_self.map.getView().getZoom() > _self.opts.zoom) {
33419              _self.map.getView().setZoom(_self.opts.zoom);
33420            }
33421          } else {
33422            onError();
33423          }
33424        }
33425        xhr.send();
33426      },
33427      //strategy: ol.loadingstrategy.bbox
33428    });
33429    var layer = new ol.layer.Vector({
33430      source: vectorSource
33431    });
33432    this.map.addLayer(layer);
33433    this.loadedLayers.push(layer);
33434  };
33435
33436  Openlayers_Map.prototype.validateZoom = function (zoom) {
33437    if (zoom >= 3 && zoom <= 18) {
33438      return true;
33439    } else {
33440      return false;
33441    }
33442  };
33443
33444  Openlayers_Map.prototype.validateLatLon = function (lat, lon) {
33445    if (lat >= -90 && lat <= 90 && lon >= -180 && lon <= 180) {
33446      return true;
33447    } else {
33448      return false;
33449    }
33450  };
33451
33452  Openlayers_Map.prototype.removeloadedLayers = function () {
33453    var _self = this;
33454    $.each(this.loadedLayers, function () {
33455      _self.map.removeLayer(this);
33456    });
33457  };
33458
33459  return Openlayers_Map;
33460})();
33461this.Openlayers_Facility_Search = (function () {
33462  function Openlayers_Facility_Search() {
33463  }
33464
33465  Openlayers_Facility_Search.render = function (selector, opts) {
33466    var canvas, map, overrided, slideSidebar;
33467
33468    //define function
33469    if (opts == null) {
33470      opts = {};
33471    }
33472    slideSidebar = function (column) {
33473      var columnTop, indexTop, scrolled;
33474      columnTop = column.offset().top;
33475      indexTop = column.closest("#map-sidebar").offset().top;
33476      scrolled = column.closest("#map-sidebar").scrollTop();
33477      column.closest("#map-sidebar").animate({
33478        scrollTop: columnTop - indexTop + scrolled
33479      }, 'fast');
33480    };
33481
33482    //setup map
33483    canvas = $(selector)[0];
33484    map = new Openlayers_Map(canvas, opts);
33485
33486    //setup markers
33487    overrided = map.showPopup;
33488    map.showPopup = function (feature, coordinate) {
33489      var column, dataId;
33490      overrided.call(map, feature, coordinate);
33491      $("#map-sidebar .column").removeClass("current");
33492      dataId = feature.get("markerId");
33493      column = $('#map-sidebar .column[data-id="' + dataId + '"]');
33494      if (column.length) {
33495        column.addClass("current");
33496        slideSidebar(column);
33497      }
33498    };
33499
33500    //setup sidebar
33501    $("#map-sidebar .column .click-marker").on("click", function () {
33502      var coordinate, dataId, marker;
33503      dataId = parseInt($(this).closest(".column").attr("data-id"));
33504      $("#map-sidebar .column").removeClass("current");
33505      marker = map.getMarker(dataId);
33506      if (!marker) {
33507        return false;
33508      }
33509      coordinate = marker.getGeometry().getCoordinates();
33510      map.showPopup(marker, coordinate);
33511      return false;
33512    });
33513    $(".filters a").on("click", function () {
33514      var dataIds, markers;
33515      if ($(this).hasClass("clicked")) {
33516        $(this).removeClass("clicked");
33517      } else {
33518        $(this).addClass("clicked");
33519      }
33520      dataIds = [];
33521      $(".filters a.clicked").each(function () {
33522        dataIds.push(parseInt($(this).attr("data-id")));
33523      });
33524      markers = map.getMarkers();
33525      $.each(markers, function () {
33526        var category, column, dataId, iconSrc, style, visible;
33527        visible = false;
33528        category = this.get("category");
33529        $.each(dataIds, function () {
33530          if ($.inArray(parseInt(this), category) >= 0) {
33531            visible = true;
33532            return false;
33533          }
33534        });
33535        dataId = this.get("markerId");
33536        column = $('#map-sidebar .column[data-id="' + dataId + '"]');
33537        map.popup.hide();
33538        if (visible) {
33539          iconSrc = this.get("iconSrc");
33540          style = map.createMarkerStyle(iconSrc);
33541          this.setStyle(style);
33542          column.show();
33543        } else {
33544          style = new ol.style.Style({});
33545          this.setStyle(style);
33546          column.hide();
33547        }
33548      });
33549
33550      var resultSize = $('#map-sidebar .column:visible').length;
33551      $('.map-search-result .number').text(resultSize);
33552      return false;
33553    });
33554
33555    //setup location filter
33556    $(".filters .focus").on("change", function () {
33557      var select;
33558      select = $(this);
33559      select.find("option:selected").each(function () {
33560        var loc, pos, zoomLevel;
33561        if ($(this).val() === "") {
33562          return false;
33563        }
33564        loc = $(this).val().split(",");
33565        zoomLevel = $(this).attr("data-zoom-level");
33566        pos = [parseFloat(loc[1]), parseFloat(loc[0])];
33567        map.setCenter(pos);
33568        if (zoomLevel) {
33569          map.setZoom(parseInt(zoomLevel));
33570        }
33571        select.val("");
33572      });
33573    });
33574
33575    //click selected category
33576    $('.map-search-condition .category-settings').each(function() {
33577      var settings = $(this).attr('data-category-settings');
33578      if (!settings) return false;
33579      $('.map-search-index .filters a').each(function() {
33580        var $btn = $(this);
33581        if (!settings.includes($btn.text())) {
33582          $btn.click();
33583        }
33584      });
33585    });
33586  };
33587
33588  return Openlayers_Facility_Search;
33589})();
33590
33591this.Openlayers_Member_Photo_Form = (function () {
33592  function Openlayers_Member_Photo_Form(canvas, opts) {
33593    if (opts == null) {
33594      opts = {};
33595    }
33596
33597    this.canvas = canvas;
33598    this.opts = opts;
33599
33600    if (opts["zoom"] && this.validateZoom(opts["zoom"])) {
33601      this.zoom = opts["zoom"];
33602    }
33603    this.defaultZoom = Openlayers_Map.defaultZoom;
33604
33605    if (opts["center"] && this.validateLatLon(opts["center"][1], opts["center"][0])) {
33606      this.center = opts["center"];
33607    }
33608    this.defaultCenter = Openlayers_Map.defaultCenter.reverse();
33609
33610    this.markerFeature = null;
33611    this.markerLayer = null;
33612
33613    this.popup = null;
33614    this.maxPointForm = 10;
33615    this.deleteMessage = "マーカーを削除してよろしいですか?";
33616    this.setExifMessage = "画像に位置情報が含まれています。位置情報を地図に設定しますか?";
33617    this.dataID = 0;
33618    this.markerIcon = Openlayers_Map.markerIcon;
33619    this.clickIcon = Openlayers_Map.clickIcon;
33620    this.clickMarkerId = null;
33621    this.render();
33622  }
33623
33624  Openlayers_Member_Photo_Form.prototype.getMapLoc = function (ele) {
33625    var latlon;
33626    latlon = ele.val().split(',');
33627    return [parseFloat(latlon[0]), parseFloat(latlon[1])];
33628  };
33629
33630  Openlayers_Member_Photo_Form.prototype.setMapLoc = function (ele, lat, lon) {
33631    lat = Math.ceil(lat * Math.pow(10, 6)) / Math.pow(10, 6);
33632    lon = Math.ceil(lon * Math.pow(10, 6)) / Math.pow(10, 6);
33633    ele.val(lat.toFixed(6) + "," + lon.toFixed(6));
33634  };
33635
33636  Openlayers_Member_Photo_Form.prototype.render = function () {
33637    this.initMap();
33638    this.renderMarkers();
33639    this.resize();
33640    return this.renderEvents();
33641  };
33642
33643  Openlayers_Member_Photo_Form.prototype.createLayers = function (layerOpts) {
33644    var j, layer, layers, len, opts, projection, source, url;
33645    layers = [];
33646    for (j = 0, len = layerOpts.length; j < len; j++) {
33647      opts = layerOpts[j];
33648      source = opts["source"];
33649      url = opts["url"];
33650      projection = opts["projection"];
33651      layer = new ol.layer.Tile({
33652        source: new ol.source[source]({
33653          url: url,
33654          projection: projection
33655        })
33656      });
33657      layers.push(layer);
33658    }
33659    return layers;
33660  };
33661
33662  Openlayers_Member_Photo_Form.prototype.initMap = function () {
33663    var layerOpts;
33664
33665    layerOpts = this.opts['layers'];
33666    layerOpts || (layerOpts = [
33667      {
33668        source: "XYZ",
33669        url: "https://cyberjapandata.gsi.go.jp/xyz/std/{z}/{x}/{y}.png",
33670        projection: "EPSG:3857"
33671      }
33672    ]);
33673
33674    this.map = new ol.Map({
33675      target: this.canvas,
33676      renderer: ['canvas', 'dom'],
33677      layers: this.createLayers(layerOpts),
33678      controls: ol.control.defaults({
33679        attributionOptions: {
33680          collapsible: false
33681        }
33682      }),
33683      view: new ol.View({
33684        projection: "EPSG:3857",
33685        center: ol.proj.transform(this.getCenter(), "EPSG:4326", "EPSG:3857"),
33686        minZoom: 3,
33687        maxZoom: 18,
33688        zoom: this.getZoom()
33689      }),
33690      logo: false
33691    });
33692  };
33693
33694  Openlayers_Member_Photo_Form.prototype.getCenter = function () {
33695    return (this.center ? this.center : this.defaultCenter);
33696  };
33697
33698  Openlayers_Member_Photo_Form.prototype.getZoom = function () {
33699    return (this.zoom ? this.zoom : this.defaultZoom);
33700  };
33701
33702  Openlayers_Member_Photo_Form.prototype.setCenter = function (pos) {
33703    return this.map.getView().setCenter(ol.proj.transform(pos, 'EPSG:4326', 'EPSG:3857'));
33704  };
33705
33706  Openlayers_Member_Photo_Form.prototype.setZoom = function (level) {
33707    return this.map.getView().setZoom(level);
33708  };
33709
33710  Openlayers_Member_Photo_Form.prototype.renderMarkers = function () {
33711    $(".mod-map .marker").each((function (_this) {
33712      return function (i, e) {
33713        var loc;
33714        $(e).attr("data-id", _this.dataID);
33715        if ($(e).find(".marker-loc").val()) {
33716          loc = _this.getMapLoc($(e).find(".marker-loc"));
33717          _this.setMarker(loc, {
33718            id: parseInt(_this.dataID)
33719          });
33720        }
33721        _this.dataID += 1;
33722      };
33723    })(this));
33724  };
33725
33726  Openlayers_Member_Photo_Form.prototype.setMarker = function (loc, opts) {
33727    var feature, pos, ref, ref1, ref2, src, style;
33728    if (opts == null) {
33729      opts = {};
33730    }
33731    src = this.markerIcon;
33732    if (opts['image']) {
33733      src = opts['image'];
33734    }
33735    style = new ol.style.Style({
33736      image: new ol.style.Icon({
33737        anchor: [0.5, 1],
33738        anchorXUnits: 'fraction',
33739        anchorYUnits: 'fraction',
33740        src: src
33741      })
33742    });
33743    pos = [loc[0], loc[1]];
33744    feature = new ol.Feature({
33745      geometry: new ol.geom.Point(ol.proj.transform(pos, "EPSG:4326", "EPSG:3857")),
33746      markerId: (ref = opts['id']) != null ? ref : null,
33747      markerHtml: (ref1 = opts['html']) != null ? ref1 : null,
33748      category: (ref2 = opts['category']) != null ? ref2 : null
33749    });
33750    feature.setStyle(style);
33751    if (!this.markerLayer) {
33752      this.markerLayer = new ol.layer.Vector({
33753        source: new ol.source.Vector({
33754          features: [feature]
33755        })
33756      });
33757      this.map.addLayer(this.markerLayer);
33758    } else {
33759      this.markerLayer.getSource().addFeature(feature);
33760    }
33761    return feature;
33762  };
33763
33764  Openlayers_Member_Photo_Form.prototype.getMarker = function (markerId) {
33765    var ret, source;
33766    ret = null;
33767    if (!this.markerLayer) {
33768      return ret;
33769    }
33770    source = this.markerLayer.getSource();
33771    source.forEachFeature(function (feature) {
33772      if (feature.get("markerId") === markerId) {
33773        return ret = feature;
33774      }
33775    });
33776    return ret;
33777  };
33778
33779  Openlayers_Member_Photo_Form.prototype.removeMarker = function (markerId) {
33780    var feature, source;
33781    feature = this.getMarker(markerId);
33782    if (feature) {
33783      source = this.markerLayer.getSource();
33784      source.removeFeature(feature);
33785      return true;
33786    }
33787    return false;
33788  };
33789
33790  Openlayers_Member_Photo_Form.prototype.renderEvents = function () {
33791    this.map.on('click', (function (_this) {
33792      return function (e) {
33793        var pos = ol.proj.transform(e.coordinate, "EPSG:3857", "EPSG:4326");
33794        while (pos[0] < 180) {
33795          pos[0] += 360;
33796        }
33797        while (pos[0] > 180) {
33798          pos[0] -= 360;
33799        }
33800        _this.setMapLoc($(".mod-map .clicked"), pos[0], pos[1]);
33801        _this.setMapLoc($(".mod-map .marker-loc"), pos[0], pos[1]);
33802        return _this.createMarker($(".mod-map .marker-loc"));
33803      };
33804    })(this));
33805    this.map.getView().on("propertychange", function(e) {
33806      if (e.key === 'resolution') {
33807        var zoom = this.getZoom();
33808        $('input[name="item[map_zoom_level]"]').val(zoom);
33809      }
33810    });
33811    $(".mod-map .set-center-position").on('click', (function (_this) {
33812      return function () {
33813        var latlng = ol.proj.transform(_this.map.getView().getCenter(), 'EPSG:3857', 'EPSG:4326');
33814        var lat = Math.floor((latlng[1] * 1000000)) / 1000000;
33815        var lng = Math.floor((latlng[0] * 1000000)) / 1000000;
33816        $(".center-input").val(lng + "," + lat);
33817        return false;
33818      };
33819    })(this));
33820    $(".mod-map .set-zoom-level").on('click', (function (_this) {
33821      return function () {
33822        $(".zoom-input").val(_this.map.getView().getZoom());
33823        return false;
33824      };
33825    })(this));
33826    return $(".mod-map .clear-marker").on('click', (function (_this) {
33827      return function (_e) {
33828        _this.clearMarker($(".mod-map .marker-loc"));
33829        return false;
33830      };
33831    })(this));
33832  };
33833
33834  Openlayers_Member_Photo_Form.prototype.createMarker = function (ele) {
33835    var dataId;
33836    dataId = 0;
33837    this.removeMarker(dataId);
33838    return this.setMarker(this.getMapLoc(ele), {
33839      id: dataId
33840    });
33841  };
33842
33843  Openlayers_Member_Photo_Form.prototype.clearMarker = function (ele) {
33844    var dataId;
33845    dataId = 0;
33846    if (ele.val() !== "") {
33847      if (confirm(this.deleteMessage)) {
33848        this.removeMarker(dataId);
33849        ele.val("");
33850      }
33851    } else {
33852      this.removeMarker(dataId);
33853    }
33854  };
33855
33856  Openlayers_Member_Photo_Form.prototype.setExifLatLng = function (selector) {
33857    return $(selector).on("change", (function (_this) {
33858      return function (e) {
33859        var self;
33860        if (!e.target.files[0]) {
33861          return;
33862        }
33863        self = _this;
33864        return EXIF.getData(e.target.files[0], function () {
33865          var lat, latRef, lon, lonRef;
33866          lat = EXIF.getTag(this, 'GPSLatitude');
33867          lon = EXIF.getTag(this, 'GPSLongitude');
33868          latRef = EXIF.getTag(this, 'GPSLatitudeRef') || "N";
33869          lonRef = EXIF.getTag(this, 'GPSLongitudeRef') || "W";
33870          if (!(lat && lon)) {
33871            return false;
33872          }
33873          if (!confirm(self.setExifMessage)) {
33874            return false;
33875          }
33876          latRef = latRef === "N" ? 1 : -1;
33877          lonRef = lonRef === "W" ? -1 : 1;
33878          lat = (lat[0] + (lat[1] / 60) + (lat[2] / 3600)) * latRef;
33879          lon = (lon[0] + (lon[1] / 60) + (lon[2] / 3600)) * lonRef;
33880          $(".mod-map .clicked").val([lat, lon].join());
33881          $(".mod-map .marker-loc").val([lat, lon].join());
33882          self.createMarker($(".mod-map .marker-loc"));
33883          return self.setCenter([lat, lon]);
33884        });
33885      };
33886    })(this));
33887  };
33888
33889  Openlayers_Member_Photo_Form.prototype.resize = function () {
33890    if (!this.markerLayer) {
33891      return;
33892    }
33893
33894    var markerLength = this.markerLayer.getSource().getFeatures().length;
33895    if (markerLength >= 0) {
33896      // marker exists
33897      // set manually options and do fit
33898      var extent = this.markerLayer.getSource().getExtent();
33899      this.map.getView().fit(extent, this.map.getSize());
33900      this.map.getView().setZoom(this.getZoom());
33901
33902      if (this.center) {
33903        this.setCenter(this.getCenter());
33904      }
33905      if (this.zoom) {
33906        this.setZoom(this.getZoom());
33907      }
33908    } else {
33909      // marker not exists
33910      // set manually or default options
33911      this.setCenter(this.getCenter());
33912      this.setZoom(this.getZoom());
33913    }
33914  };
33915
33916  Openlayers_Member_Photo_Form.prototype.validateZoom = function (zoom) {
33917    if (zoom >= 3 && zoom <= 18) {
33918      return true;
33919    } else {
33920      return false;
33921    }
33922  };
33923
33924  Openlayers_Member_Photo_Form.prototype.validateLatLon = function (lat, lon) {
33925    if (lat >= -90 && lat <= 90 && lon >= -180 && lon <= 180) {
33926      return true;
33927    } else {
33928      return false;
33929    }
33930  };
33931
33932  return Openlayers_Member_Photo_Form;
33933})();
33934this.Openlayers_Dataset_Map = (function () {
33935  function Openlayers_Dataset_Map() {
33936  }
33937
33938  Openlayers_Dataset_Map.map = null;
33939  Openlayers_Dataset_Map.map_points = null;
33940
33941  Openlayers_Dataset_Map.render = function (selector, opts) {
33942    $(".dataset-search a#ajax-search").colorbox({
33943      fixed: true,
33944      width: "90%",
33945      height: "90%"
33946    });
33947    var canvas = $(selector)[0];
33948    Openlayers_Dataset_Map.map = new Openlayers_Map(canvas, opts);
33949  }
33950
33951  Openlayers_Dataset_Map.selectItem = function (ele) {
33952    var dataset_id = $(ele).attr("data-id");
33953    var item = $(ele).find(".selected-item").clone(false);
33954
33955    // remove renderInBox class
33956    $(item).find("a").removeClass("cboxElement");
33957
33958    $(item).find('[name="resource_id"]').each(function (_idx) {
33959      var resource_id = $(this).val();
33960
33961      $(this).data("map_points", Openlayers_Dataset_Map.map_points[dataset_id][resource_id]);
33962
33963      // checkbox
33964      $(this).on("click", function () {
33965        Openlayers_Dataset_Map.setMarkers();
33966        Openlayers_Dataset_Map.map.resize();
33967      });
33968
33969      // select marker image
33970      $(this).closest("li").find(".marker-image-form .select-marker-image").on("click", function () {
33971        var form = $(this).closest(".marker-image-form");
33972        var images = $(form).find(".images");
33973
33974        $(".marker-image-form .images").hide();
33975
33976        images.show();
33977        $("body").not(this).one("click", function (_e) {
33978          images.hide();
33979        });
33980
33981        return false;
33982      });
33983
33984      // marker images
33985      $(this).closest("li").find(".marker-image-form .images .image").on("click", function () {
33986        var form = $(this).closest(".marker-image-form");
33987        var images = $(form).find(".images");
33988        var thumb = $(form).find(".marker-thumb img");
33989        var src = $(this).find('img').andSelf("img").attr("src");
33990
33991        form.data("src", src);
33992        thumb.attr("src", src);
33993        images.hide();
33994
33995        Openlayers_Dataset_Map.setMarkers();
33996        return false;
33997      });
33998      $(this).closest("li").find(".marker-image-form .marker-thumb").html($('<img />', { src: Openlayers_Dataset_Map.map.markerIcon }));
33999    });
34000
34001    // deselect button
34002    $(item).find(".deselect").on("click", function (_e) {
34003      $(this).closest(".selected-item").remove();
34004      Openlayers_Dataset_Map.setMarkers();
34005      Openlayers_Dataset_Map.map.resize();
34006      return false;
34007    });
34008
34009    // append and remove
34010    item.show();
34011    $(".dataset-search .selected-dataset").append(item);
34012      var length = $(".dataset-search .selected-dataset .selected-item").length - 10;
34013      for (var i = 0; i < length; i++) {
34014        $(".dataset-search .selected-dataset .selected-item:first").remove();
34015      }
34016
34017    return item;
34018  }
34019
34020  Openlayers_Dataset_Map.setMarkers = function () {
34021    Openlayers_Dataset_Map.map.removeMarkers();
34022    Openlayers_Dataset_Map.map.removeloadedLayers();
34023    $(".dataset-search .selected-item .set-markers:checked").each(function () {
34024      var map_points = $(this).data("map_points");
34025      var form = $(this).closest("li").find(".marker-image-form");
34026
34027      if (form && form.data("src")) {
34028        $.each(map_points["points"], function(){
34029          this["image"] = form.data("src");
34030        });
34031      }
34032
34033      if (map_points["points"]) {
34034        Openlayers_Dataset_Map.map.renderMarkers(map_points["points"]);
34035      } else if (map_points["format"] == "KML") {
34036        Openlayers_Dataset_Map.map.loadLayer(map_points["url"], ol.format.KML);
34037      } else if (map_points["format"] == "GEOJSON") {
34038        Openlayers_Dataset_Map.map.loadLayer(map_points["url"], ol.format.GeoJSON);
34039      }
34040    });
34041  };
34042
34043  Openlayers_Dataset_Map.toggleSelectButton = function () {
34044    if ($(".search-ui .items input:checked").size() > 0) {
34045      $(".select-items").parent("div").show();
34046    } else {
34047      $(".select-items").parent("div").hide();
34048    }
34049  };
34050
34051  Openlayers_Dataset_Map.modal = function (map_points) {
34052    Openlayers_Dataset_Map.map_points = map_points;
34053
34054    // form search event
34055    $(".search-ui-form form.search").on("submit", function (_e) {
34056      $(this).ajaxSubmit({
34057        url: $(this).attr("action"),
34058        success: function (data) {
34059          return $("#cboxLoadedContent").html(data);
34060        },
34061        error: function (_data, _status) {
34062          return alert("== Error ==");
34063        }
34064      });
34065      return false;
34066    });
34067
34068    // select item event
34069    $(".search-ui a.select-item").on("click", function (_e) {
34070      var tr = $(this).closest("tr");
34071      var article = Openlayers_Dataset_Map.selectItem(tr);
34072
34073      $.colorbox.close();
34074      $(article).find(".set-markers").trigger("click");
34075
34076      return false;
34077    });
34078
34079    // select items event
34080    $(".search-ui-select .select-items").on("click", function (_e) {
34081      $(".search-ui .items .set-dataset:checked").each(function () {
34082        var tr = $(this).closest("tr");
34083        Openlayers_Dataset_Map.selectItem(tr);
34084      });
34085      $.colorbox.close();
34086      return false;
34087    });
34088
34089    // list-head checkbox event
34090    $(".search-ui .list-head input:checkbox").on("change", function (_e) {
34091      var chk = $(this).prop('checked');
34092      $('.search-ui .list-item').each(function () {
34093        $(this).toggleClass('checked', chk);
34094        $(this).find('.set-dataset').prop('checked', chk);
34095      });
34096    });
34097
34098    // toggle select items button event
34099    $(".search-ui").on("change", function (_e) {
34100        Openlayers_Dataset_Map.toggleSelectButton();
34101    });
34102
34103    // disable selected items in modal
34104    $(".dataset-search .selected-dataset .selected-item").each(function () {
34105      var id = $(this).attr("data-id");
34106      var tr = $(".items [data-id='" + id + "']");
34107      tr.find("input[type=checkbox]").remove();
34108
34109      var item = tr.find(".select-item").html();
34110      tr.find(".select-item").replaceWith("<span class='select-item' style='color: #888'>" + item + "</span>");
34111    });
34112  }
34113
34114  return Openlayers_Dataset_Map;
34115})();
34116/*!
34117 * Chart.js v4.5.0
vendor: 23,253 bytes, lines 34117-34128
34117
34118 * https://www.chartjs.org
34119 * (c) 2025 Chart.js Contributors
34120 * Released under the MIT License
34121 */
34122!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).Chart=e()}(this,(function(){"use strict";var t=Object.freeze({__proto__:null,get Colors(){return Jo},get Decimation(){return ta},get Filler(){return ba},get Legend(){return Ma},get SubTitle(){return Pa},get Title(){return ka},get Tooltip(){return Na}});function e(){}const i=(()=>{let t=0;return()=>t++})();function s(t){return null==t}function n(t){if(Array.isArray&&Array.isArray(t))return!0;const e=Object.prototype.toString.call(t);return"[object"===e.slice(0,7)&&"Array]"===e.slice(-6)}function o(t){return null!==t&&"[object Object]"===Object.prototype.toString.call(t)}function a(t){return("number"==typeof t||t instanceof Number)&&isFinite(+t)}function r(t,e){return a(t)?t:e}function l(t,e){return void 0===t?e:t}const h=(t,e)=>"string"==typeof t&&t.endsWith("%")?parseFloat(t)/100:+t/e,c=(t,e)=>"string"==typeof t&&t.endsWith("%")?parseFloat(t)/100*e:+t;function d(t,e,i){if(t&&"function"==typeof t.call)return t.apply(i,e)}function u(t,e,i,s){let a,r,l;if(n(t))if(r=t.length,s)for(a=r-1;a>=0;a--)e.call(i,t[a],a);else for(a=0;a<r;a++)e.call(i,t[a],a);else if(o(t))for(l=Object.keys(t),r=l.length,a=0;a<r;a++)e.call(i,t[l[a]],l[a])}function f(t,e){let i,s,n,o;if(!t||!e||t.length!==e.length)return!1;for(i=0,s=t.length;i<s;++i)if(n=t[i],o=e[i],n.datasetIndex!==o.datasetIndex||n.index!==o.index)return!1;return!0}function g(t){if(n(t))return t.map(g);if(o(t)){const e=Object.create(null),i=Object.keys(t),s=i.length;let n=0;for(;n<s;++n)e[i[n]]=g(t[i[n]]);return e}return t}function p(t){return-1===["__proto__","prototype","constructor"].indexOf(t)}function m(t,e,i,s){if(!p(t))return;const n=e[t],a=i[t];o(n)&&o(a)?x(n,a,s):e[t]=g(a)}function x(t,e,i){const s=n(e)?e:[e],a=s.length;if(!o(t))return t;const r=(i=i||{}).merger||m;let l;for(let e=0;e<a;++e){if(l=s[e],!o(l))continue;const n=Object.keys(l);for(let e=0,s=n.length;e<s;++e)r(n[e],t,l,i)}return t}function b(t,e){return x(t,e,{merger:_})}function _(t,e,i){if(!p(t))return;const s=e[t],n=i[t];o(s)&&o(n)?b(s,n):Object.prototype.hasOwnProperty.call(e,t)||(e[t]=g(n))}const y={"":t=>t,x:t=>t.x,y:t=>t.y};function v(t){const e=t.split("."),i=[];let s="";for(const t of e)s+=t,s.endsWith("\\")?s=s.slice(0,-1)+".":(i.push(s),s="");return i}function M(t,e){const i=y[e]||(y[e]=function(t){const e=v(t);return t=>{for(const i of e){if(""===i)break;t=t&&t[i]}return t}}(e));return i(t)}function w(t){return t.charAt(0).toUpperCase()+t.slice(1)}const k=t=>void 0!==t,S=t=>"function"==typeof t,P=(t,e)=>{if(t.size!==e.size)return!1;for(const i of t)if(!e.has(i))return!1;return!0};function D(t){return"mouseup"===t.type||"click"===t.type||"contextmenu"===t.type}const C=Math.PI,O=2*C,A=O+C,T=Number.POSITIVE_INFINITY,L=C/180,E=C/2,R=C/4,I=2*C/3,z=Math.log10,F=Math.sign;function V(t,e,i){return Math.abs(t-e)<i}function B(t){const e=Math.round(t);t=V(t,e,t/1e3)?e:t;const i=Math.pow(10,Math.floor(z(t))),s=t/i;return(s<=1?1:s<=2?2:s<=5?5:10)*i}function W(t){const e=[],i=Math.sqrt(t);let s;for(s=1;s<i;s++)t%s==0&&(e.push(s),e.push(t/s));return i===(0|i)&&e.push(i),e.sort(((t,e)=>t-e)).pop(),e}function N(t){return!function(t){return"symbol"==typeof t||"object"==typeof t&&null!==t&&!(Symbol.toPrimitive in t||"toString"in t||"valueOf"in t)}(t)&&!isNaN(parseFloat(t))&&isFinite(t)}function H(t,e){const i=Math.round(t);return i-e<=t&&i+e>=t}function j(t,e,i){let s,n,o;for(s=0,n=t.length;s<n;s++)o=t[s][i],isNaN(o)||(e.min=Math.min(e.min,o),e.max=Math.max(e.max,o))}function $(t){return t*(C/180)}function Y(t){return t*(180/C)}function U(t){if(!a(t))return;let e=1,i=0;for(;Math.round(t*e)/e!==t;)e*=10,i++;return i}function X(t,e){const i=e.x-t.x,s=e.y-t.y,n=Math.sqrt(i*i+s*s);let o=Math.atan2(s,i);return o<-.5*C&&(o+=O),{angle:o,distance:n}}function q(t,e){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function K(t,e){return(t-e+A)%O-C}function G(t){return(t%O+O)%O}function J(t,e,i,s){const n=G(t),o=G(e),a=G(i),r=G(o-n),l=G(a-n),h=G(n-o),c=G(n-a);return n===o||n===a||s&&o===a||r>l&&h<c}function Z(t,e,i){return Math.max(e,Math.min(i,t))}function Q(t){return Z(t,-32768,32767)}function tt(t,e,i,s=1e-6){return t>=Math.min(e,i)-s&&t<=Math.max(e,i)+s}function et(t,e,i){i=i||(i=>t[i]<e);let s,n=t.length-1,o=0;for(;n-o>1;)s=o+n>>1,i(s)?o=s:n=s;return{lo:o,hi:n}}const it=(t,e,i,s)=>et(t,i,s?s=>{const n=t[s][e];return n<i||n===i&&t[s+1][e]===i}:s=>t[s][e]<i),st=(t,e,i)=>et(t,i,(s=>t[s][e]>=i));function nt(t,e,i){let s=0,n=t.length;for(;s<n&&t[s]<e;)s++;for(;n>s&&t[n-1]>i;)n--;return s>0||n<t.length?t.slice(s,n):t}const ot=["push","pop","shift","splice","unshift"];function at(t,e){t._chartjs?t._chartjs.listeners.push(e):(Object.defineProperty(t,"_chartjs",{configurable:!0,enumerable:!1,value:{listeners:[e]}}),ot.forEach((e=>{const i="_onData"+w(e),s=t[e];Object.defineProperty(t,e,{configurable:!0,enumerable:!1,value(...e){const n=s.apply(this,e);return t._chartjs.listeners.forEach((t=>{"function"==typeof t[i]&&t[i](...e)})),n}})})))}function rt(t,e){const i=t._chartjs;if(!i)return;const s=i.listeners,n=s.indexOf(e);-1!==n&&s.splice(n,1),s.length>0||(ot.forEach((e=>{delete t[e]})),delete t._chartjs)}function lt(t){const e=new Set(t);return e.size===t.length?t:Array.from(e)}const ht="undefined"==typeof window?function(t){return t()}:window.requestAnimationFrame;function ct(t,e){let i=[],s=!1;return function(...n){i=n,s||(s=!0,ht.call(window,(()=>{s=!1,t.apply(e,i)})))}}function dt(t,e){let i;return function(...s){return e?(clearTimeout(i),i=setTimeout(t,e,s)):t.apply(this,s),e}}const ut=t=>"start"===t?"left":"end"===t?"right":"center",ft=(t,e,i)=>"start"===t?e:"end"===t?i:(e+i)/2,gt=(t,e,i,s)=>t===(s?"left":"right")?i:"center"===t?(e+i)/2:e;function pt(t,e,i){const n=e.length;let o=0,a=n;if(t._sorted){const{iScale:r,vScale:l,_parsed:h}=t,c=t.dataset&&t.dataset.options?t.dataset.options.spanGaps:null,d=r.axis,{min:u,max:f,minDefined:g,maxDefined:p}=r.getUserBounds();if(g){if(o=Math.min(it(h,d,u).lo,i?n:it(e,d,r.getPixelForValue(u)).lo),c){const t=h.slice(0,o+1).reverse().findIndex((t=>!s(t[l.axis])));o-=Math.max(0,t)}o=Z(o,0,n-1)}if(p){let t=Math.max(it(h,r.axis,f,!0).hi+1,i?0:it(e,d,r.getPixelForValue(f),!0).hi+1);if(c){const e=h.slice(t-1).findIndex((t=>!s(t[l.axis])));t+=Math.max(0,e)}a=Z(t,o,n)-o}else a=n-o}return{start:o,count:a}}function mt(t){const{xScale:e,yScale:i,_scaleRanges:s}=t,n={xmin:e.min,xmax:e.max,ymin:i.min,ymax:i.max};if(!s)return t._scaleRanges=n,!0;const o=s.xmin!==e.min||s.xmax!==e.max||s.ymin!==i.min||s.ymax!==i.max;return Object.assign(s,n),o}class xt{constructor(){this._request=null,this._charts=new Map,this._running=!1,this._lastDate=void 0}_notify(t,e,i,s){const n=e.listeners[s],o=e.duration;n.forEach((s=>s({chart:t,initial:e.initial,numSteps:o,currentStep:Math.min(i-e.start,o)})))}_refresh(){this._request||(this._running=!0,this._request=ht.call(window,(()=>{this._update(),this._request=null,this._running&&this._refresh()})))}_update(t=Date.now()){let e=0;this._charts.forEach(((i,s)=>{if(!i.running||!i.items.length)return;const n=i.items;let o,a=n.length-1,r=!1;for(;a>=0;--a)o=n[a],o._active?(o._total>i.duration&&(i.duration=o._total),o.tick(t),r=!0):(n[a]=n[n.length-1],n.pop());r&&(s.draw(),this._notify(s,i,t,"progress")),n.length||(i.running=!1,this._notify(s,i,t,"complete"),i.initial=!1),e+=n.length})),this._lastDate=t,0===e&&(this._running=!1)}_getAnims(t){const e=this._charts;let i=e.get(t);return i||(i={running:!1,initial:!0,items:[],listeners:{complete:[],progress:[]}},e.set(t,i)),i}listen(t,e,i){this._getAnims(t).listeners[e].push(i)}add(t,e){e&&e.length&&this._getAnims(t).items.push(...e)}has(t){return this._getAnims(t).items.length>0}start(t){const e=this._charts.get(t);e&&(e.running=!0,e.start=Date.now(),e.duration=e.items.reduce(((t,e)=>Math.max(t,e._duration)),0),this._refresh())}running(t){if(!this._running)return!1;const e=this._charts.get(t);return!!(e&&e.running&&e.items.length)}stop(t){const e=this._charts.get(t);if(!e||!e.items.length)return;const i=e.items;let s=i.length-1;for(;s>=0;--s)i[s].cancel();e.items=[],this._notify(t,e,Date.now(),"complete")}remove(t){return this._charts.delete(t)}}var bt=new xt;
34123/*!
34124 * @kurkle/color v0.3.2
34125 * https://github.com/kurkle/color#readme
34126 * (c) 2023 Jukka Kurkela
34127 * Released under the MIT License
34128 */function _t(t){return t+.5|0}const yt=(t,e,i)=>Math.max(Math.min(t,i),e);function vt(t){return yt(_t(2.55*t),0,255)}function Mt(t){return yt(_t(255*t),0,255)}function wt(t){return yt(_t(t/2.55)/100,0,1)}function kt(t){return yt(_t(100*t),0,100)}const St={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,A:10,B:11,C:12,D:13,E:14,F:15,a:10,b:11,c:12,d:13,e:14,f:15},Pt=[..."0123456789ABCDEF"],Dt=t=>Pt[15&t],Ct=t=>Pt[(240&t)>>4]+Pt[15&t],Ot=t=>(240&t)>>4==(15&t);function At(t){var e=(t=>Ot(t.r)&&Ot(t.g)&&Ot(t.b)&&Ot(t.a))(t)?Dt:Ct;return t?"#"+e(t.r)+e(t.g)+e(t.b)+((t,e)=>t<255?e(t):"")(t.a,e):void 0}const Tt=/^(hsla?|hwb|hsv)\(\s*([-+.e\d]+)(?:deg)?[\s,]+([-+.e\d]+)%[\s,]+([-+.e\d]+)%(?:[\s,]+([-+.e\d]+)(%)?)?\s*\)$/;function Lt(t,e,i){const s=e*Math.min(i,1-i),n=(e,n=(e+t/30)%12)=>i-s*Math.max(Math.min(n-3,9-n,1),-1);return[n(0),n(8),n(4)]}function Et(t,e,i){const s=(s,n=(s+t/60)%6)=>i-i*e*Math.max(Math.min(n,4-n,1),0);return[s(5),s(3),s(1)]}function Rt(t,e,i){const s=Lt(t,1,.5);let n;for(e+i>1&&(n=1/(e+i),e*=n,i*=n),n=0;n<3;n++)s[n]*=1-e-i,s[n]+=e;return s}function It(t){const e=t.r/255,i=t.g/255,s=t.b/255,n=Math.max(e,i,s),o=Math.min(e,i,s),a=(n+o)/2;let r,l,h;return n!==o&&(h=n-o,l=a>.5?h/(2-n-o):h/(n+o),r=function(t,e,i,s,n){return t===n?(e-i)/s+(e<i?6:0):e===n?(i-t)/s+2:(t-e)/s+4}(e,i,s,h,n),r=60*r+.5),[0|r,l||0,a]}function zt(t,e,i,s){return(Array.isArray(e)?t(e[0],e[1],e[2]):t(e,i,s)).map(Mt)}function Ft(t,e,i){return zt(Lt,t,e,i)}function Vt(t){return(t%360+360)%360}function Bt(t){const e=Tt.exec(t);let i,s=255;if(!e)return;e[5]!==i&&(s=e[6]?vt(+e[5]):Mt(+e[5]));const n=Vt(+e[2]),o=+e[3]/100,a=+e[4]/100;return i="hwb"===e[1]?function(t,e,i){return zt(Rt,t,e,i)}(n,o,a):"hsv"===e[1]?function(t,e,i){return zt(Et,t,e,i)}(n,o,a):Ft(n,o,a),{r:i[0],g:i[1],b:i[2],a:s}}const Wt={x:"dark",Z:"light",Y:"re",X:"blu",W:"gr",V:"medium",U:"slate",A:"ee",T:"ol",S:"or",B:"ra",C:"lateg",D:"ights",R:"in",Q:"turquois",E:"hi",P:"ro",O:"al",N:"le",M:"de",L:"yello",F:"en",K:"ch",G:"arks",H:"ea",I:"ightg",J:"wh"},Nt={OiceXe:"f0f8ff",antiquewEte:"faebd7",aqua:"ffff",aquamarRe:"7fffd4",azuY:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"0",blanKedOmond:"ffebcd",Xe:"ff",XeviTet:"8a2be2",bPwn:"a52a2a",burlywood:"deb887",caMtXe:"5f9ea0",KartYuse:"7fff00",KocTate:"d2691e",cSO:"ff7f50",cSnflowerXe:"6495ed",cSnsilk:"fff8dc",crimson:"dc143c",cyan:"ffff",xXe:"8b",xcyan:"8b8b",xgTMnPd:"b8860b",xWay:"a9a9a9",xgYF:"6400",xgYy:"a9a9a9",xkhaki:"bdb76b",xmagFta:"8b008b",xTivegYF:"556b2f",xSange:"ff8c00",xScEd:"9932cc",xYd:"8b0000",xsOmon:"e9967a",xsHgYF:"8fbc8f",xUXe:"483d8b",xUWay:"2f4f4f",xUgYy:"2f4f4f",xQe:"ced1",xviTet:"9400d3",dAppRk:"ff1493",dApskyXe:"bfff",dimWay:"696969",dimgYy:"696969",dodgerXe:"1e90ff",fiYbrick:"b22222",flSOwEte:"fffaf0",foYstWAn:"228b22",fuKsia:"ff00ff",gaRsbSo:"dcdcdc",ghostwEte:"f8f8ff",gTd:"ffd700",gTMnPd:"daa520",Way:"808080",gYF:"8000",gYFLw:"adff2f",gYy:"808080",honeyMw:"f0fff0",hotpRk:"ff69b4",RdianYd:"cd5c5c",Rdigo:"4b0082",ivSy:"fffff0",khaki:"f0e68c",lavFMr:"e6e6fa",lavFMrXsh:"fff0f5",lawngYF:"7cfc00",NmoncEffon:"fffacd",ZXe:"add8e6",ZcSO:"f08080",Zcyan:"e0ffff",ZgTMnPdLw:"fafad2",ZWay:"d3d3d3",ZgYF:"90ee90",ZgYy:"d3d3d3",ZpRk:"ffb6c1",ZsOmon:"ffa07a",ZsHgYF:"20b2aa",ZskyXe:"87cefa",ZUWay:"778899",ZUgYy:"778899",ZstAlXe:"b0c4de",ZLw:"ffffe0",lime:"ff00",limegYF:"32cd32",lRF:"faf0e6",magFta:"ff00ff",maPon:"800000",VaquamarRe:"66cdaa",VXe:"cd",VScEd:"ba55d3",VpurpN:"9370db",VsHgYF:"3cb371",VUXe:"7b68ee",VsprRggYF:"fa9a",VQe:"48d1cc",VviTetYd:"c71585",midnightXe:"191970",mRtcYam:"f5fffa",mistyPse:"ffe4e1",moccasR:"ffe4b5",navajowEte:"ffdead",navy:"80",Tdlace:"fdf5e6",Tive:"808000",TivedBb:"6b8e23",Sange:"ffa500",SangeYd:"ff4500",ScEd:"da70d6",pOegTMnPd:"eee8aa",pOegYF:"98fb98",pOeQe:"afeeee",pOeviTetYd:"db7093",papayawEp:"ffefd5",pHKpuff:"ffdab9",peru:"cd853f",pRk:"ffc0cb",plum:"dda0dd",powMrXe:"b0e0e6",purpN:"800080",YbeccapurpN:"663399",Yd:"ff0000",Psybrown:"bc8f8f",PyOXe:"4169e1",saddNbPwn:"8b4513",sOmon:"fa8072",sandybPwn:"f4a460",sHgYF:"2e8b57",sHshell:"fff5ee",siFna:"a0522d",silver:"c0c0c0",skyXe:"87ceeb",UXe:"6a5acd",UWay:"708090",UgYy:"708090",snow:"fffafa",sprRggYF:"ff7f",stAlXe:"4682b4",tan:"d2b48c",teO:"8080",tEstN:"d8bfd8",tomato:"ff6347",Qe:"40e0d0",viTet:"ee82ee",JHt:"f5deb3",wEte:"ffffff",wEtesmoke:"f5f5f5",Lw:"ffff00",LwgYF:"9acd32"};let Ht;function jt(t){Ht||(Ht=function(){const t={},e=Object.keys(Nt),i=Object.keys(Wt);let s,n,o,a,r;for(s=0;s<e.length;s++){for(a=r=e[s],n=0;n<i.length;n++)o=i[n],r=r.replace(o,Wt[o]);o=parseInt(Nt[a],16),t[r]=[o>>16&255,o>>8&255,255&o]}return t}(),Ht.transparent=[0,0,0,0]);const e=Ht[t.toLowerCase()];return e&&{r:e[0],g:e[1],b:e[2],a:4===e.length?e[3]:255}}const $t=/^rgba?\(\s*([-+.\d]+)(%)?[\s,]+([-+.e\d]+)(%)?[\s,]+([-+.e\d]+)(%)?(?:[\s,/]+([-+.e\d]+)(%)?)?\s*\)$/;const Yt=t=>t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055,Ut=t=>t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4);function Xt(t,e,i){if(t){let s=It(t);s[e]=Math.max(0,Math.min(s[e]+s[e]*i,0===e?360:1)),s=Ft(s),t.r=s[0],t.g=s[1],t.b=s[2]}}function qt(t,e){return t?Object.assign(e||{},t):t}function Kt(t){var e={r:0,g:0,b:0,a:255};return Array.isArray(t)?t.length>=3&&(e={r:t[0],g:t[1],b:t[2],a:255},t.length>3&&(e.a=Mt(t[3]))):(e=qt(t,{r:0,g:0,b:0,a:1})).a=Mt(e.a),e}function Gt(t){return"r"===t.charAt(0)?function(t){const e=$t.exec(t);let i,s,n,o=255;if(e){if(e[7]!==i){const t=+e[7];o=e[8]?vt(t):yt(255*t,0,255)}return i=+e[1],s=+e[3],n=+e[5],i=255&(e[2]?vt(i):yt(i,0,255)),s=255&(e[4]?vt(s):yt(s,0,255)),n=255&(e[6]?vt(n):yt(n,0,255)),{r:i,g:s,b:n,a:o}}}(t):Bt(t)}class Jt{constructor(t){if(t instanceof Jt)return t;const e=typeof t;let i;var s,n,o;"object"===e?i=Kt(t):"string"===e&&(o=(s=t).length,"#"===s[0]&&(4===o||5===o?n={r:255&17*St[s[1]],g:255&17*St[s[2]],b:255&17*St[s[3]],a:5===o?17*St[s[4]]:255}:7!==o&&9!==o||(n={r:St[s[1]]<<4|St[s[2]],g:St[s[3]]<<4|St[s[4]],b:St[s[5]]<<4|St[s[6]],a:9===o?St[s[7]]<<4|St[s[8]]:255})),i=n||jt(t)||Gt(t)),this._rgb=i,this._valid=!!i}get valid(){return this._valid}get rgb(){var t=qt(this._rgb);return t&&(t.a=wt(t.a)),t}set rgb(t){this._rgb=Kt(t)}rgbString(){return this._valid?(t=this._rgb)&&(t.a<255?`rgba(${t.r}, ${t.g}, ${t.b}, ${wt(t.a)})`:`rgb(${t.r}, ${t.g}, ${t.b})`):void 0;var t}hexString(){return this._valid?At(this._rgb):void 0}hslString(){return this._valid?function(t){if(!t)return;const e=It(t),i=e[0],s=kt(e[1]),n=kt(e[2]);return t.a<255?`hsla(${i}, ${s}%, ${n}%, ${wt(t.a)})`:`hsl(${i}, ${s}%, ${n}%)`}(this._rgb):void 0}mix(t,e){if(t){const i=this.rgb,s=t.rgb;let n;const o=e===n?.5:e,a=2*o-1,r=i.a-s.a,l=((a*r==-1?a:(a+r)/(1+a*r))+1)/2;n=1-l,i.r=255&l*i.r+n*s.r+.5,i.g=255&l*i.g+n*s.g+.5,i.b=255&l*i.b+n*s.b+.5,i.a=o*i.a+(1-o)*s.a,this.rgb=i}return this}interpolate(t,e){return t&&(this._rgb=function(t,e,i){const s=Ut(wt(t.r)),n=Ut(wt(t.g)),o=Ut(wt(t.b));return{r:Mt(Yt(s+i*(Ut(wt(e.r))-s))),g:Mt(Yt(n+i*(Ut(wt(e.g))-n))),b:Mt(Yt(o+i*(Ut(wt(e.b))-o))),a:t.a+i*(e.a-t.a)}}(this._rgb,t._rgb,e)),this}clone(){return new Jt(this.rgb)}alpha(t){return this._rgb.a=Mt(t),this}clearer(t){return this._rgb.a*=1-t,this}greyscale(){const t=this._rgb,e=_t(.3*t.r+.59*t.g+.11*t.b);return t.r=t.g=t.b=e,this}opaquer(t){return this._rgb.a*=1+t,this}negate(){const t=this._rgb;return t.r=255-t.r,t.g=255-t.g,t.b=255-t.b,this}lighten(t){return Xt(this._rgb,2,t),this}darken(t){return Xt(this._rgb,2,-t),this}saturate(t){return Xt(this._rgb,1,t),this}desaturate(t){return Xt(this._rgb,1,-t),this}rotate(t){return function(t,e){var i=It(t);i[0]=Vt(i[0]+e),i=Ft(i),t.r=i[0],t.g=i[1],t.b=i[2]}(this._rgb,t),this}}function Zt(t){if(t&&"object"==typeof t){const e=t.toString();return"[object CanvasPattern]"===e||"[object CanvasGradient]"===e}return!1}function Qt(t){return Zt(t)?t:new Jt(t)}function te(t){return Zt(t)?t:new Jt(t).saturate(.5).darken(.1).hexString()}const ee=["x","y","borderWidth","radius","tension"],ie=["color","borderColor","backgroundColor"];const se=new Map;function ne(t,e,i){return function(t,e){e=e||{};const i=t+JSON.stringify(e);let s=se.get(i);return s||(s=new Intl.NumberFormat(t,e),se.set(i,s)),s}(e,i).format(t)}const oe={values:t=>n(t)?t:""+t,numeric(t,e,i){if(0===t)return"0";const s=this.chart.options.locale;let n,o=t;if(i.length>1){const e=Math.max(Math.abs(i[0].value),Math.abs(i[i.length-1].value));(e<1e-4||e>1e15)&&(n="scientific"),o=function(t,e){let i=e.length>3?e[2].value-e[1].value:e[1].value-e[0].value;Math.abs(i)>=1&&t!==Math.floor(t)&&(i=t-Math.floor(t));return i}(t,i)}const a=z(Math.abs(o)),r=isNaN(a)?1:Math.max(Math.min(-1*Math.floor(a),20),0),l={notation:n,minimumFractionDigits:r,maximumFractionDigits:r};return Object.assign(l,this.options.ticks.format),ne(t,s,l)},logarithmic(t,e,i){if(0===t)return"0";const s=i[e].significand||t/Math.pow(10,Math.floor(z(t)));return[1,2,3,5,10,15].includes(s)||e>.8*i.length?oe.numeric.call(this,t,e,i):""}};var ae={formatters:oe};const re=Object.create(null),le=Object.create(null);function he(t,e){if(!e)return t;const i=e.split(".");for(let e=0,s=i.length;e<s;++e){const s=i[e];t=t[s]||(t[s]=Object.create(null))}return t}function ce(t,e,i){return"string"==typeof e?x(he(t,e),i):x(he(t,""),e)}class de{constructor(t,e){this.animation=void 0,this.backgroundColor="rgba(0,0,0,0.1)",this.borderColor="rgba(0,0,0,0.1)",this.color="#666",this.datasets={},this.devicePixelRatio=t=>t.chart.platform.getDevicePixelRatio(),this.elements={},this.events=["mousemove","mouseout","click","touchstart","touchmove"],this.font={family:"'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",size:12,style:"normal",lineHeight:1.2,weight:null},this.hover={},this.hoverBackgroundColor=(t,e)=>te(e.backgroundColor),this.hoverBorderColor=(t,e)=>te(e.borderColor),this.hoverColor=(t,e)=>te(e.color),this.indexAxis="x",this.interaction={mode:"nearest",intersect:!0,includeInvisible:!1},this.maintainAspectRatio=!0,this.onHover=null,this.onClick=null,this.parsing=!0,this.plugins={},this.responsive=!0,this.scale=void 0,this.scales={},this.showLine=!0,this.drawActiveElementsOnTop=!0,this.describe(t),this.apply(e)}set(t,e){return ce(this,t,e)}get(t){return he(this,t)}describe(t,e){return ce(le,t,e)}override(t,e){return ce(re,t,e)}route(t,e,i,s){const n=he(this,t),a=he(this,i),r="_"+e;Object.defineProperties(n,{[r]:{value:n[e],writable:!0},[e]:{enumerable:!0,get(){const t=this[r],e=a[s];return o(t)?Object.assign({},e,t):l(t,e)},set(t){this[r]=t}}})}apply(t){t.forEach((t=>t(this)))}}var ue=new de({_scriptable:t=>!t.startsWith("on"),_indexable:t=>"events"!==t,hover:{_fallback:"interaction"},interaction:{_scriptable:!1,_indexable:!1}},[function(t){t.set("animation",{delay:void 0,duration:1e3,easing:"easeOutQuart",fn:void 0,from:void 0,loop:void 0,to:void 0,type:void 0}),t.describe("animation",{_fallback:!1,_indexable:!1,_scriptable:t=>"onProgress"!==t&&"onComplete"!==t&&"fn"!==t}),t.set("animations",{colors:{type:"color",properties:ie},numbers:{type:"number",properties:ee}}),t.describe("animations",{_fallback:"animation"}),t.set("transitions",{active:{animation:{duration:400}},resize:{animation:{duration:0}},show:{animations:{colors:{from:"transparent"},visible:{type:"boolean",duration:0}}},hide:{animations:{colors:{to:"transparent"},visible:{type:"boolean",easing:"linear",fn:t=>0|t}}}})},function(t){t.set("layout",{autoPadding:!0,padding:{top:0,right:0,bottom:0,left:0}})},function(t){t.set("scale",{display:!0,offset:!1,reverse:!1,beginAtZero:!1,bounds:"ticks",clip:!0,grace:0,grid:{display:!0,lineWidth:1,drawOnChartArea:!0,drawTicks:!0,tickLength:8,tickWidth:(t,e)=>e.lineWidth,tickColor:(t,e)=>e.color,offset:!1},border:{display:!0,dash:[],dashOffset:0,width:1},title:{display:!1,text:"",padding:{top:4,bottom:4}},ticks:{minRotation:0,maxRotation:50,mirror:!1,textStrokeWidth:0,textStrokeColor:"",padding:3,display:!0,autoSkip:!0,autoSkipPadding:3,labelOffset:0,callback:ae.formatters.values,minor:{},major:{},align:"center",crossAlign:"near",showLabelBackdrop:!1,backdropColor:"rgba(255, 255, 255, 0.75)",backdropPadding:2}}),t.route("scale.ticks","color","","color"),t.route("scale.grid","color","","borderColor"),t.route("scale.border","color","","borderColor"),t.route("scale.title","color","","color"),t.describe("scale",{_fallback:!1,_scriptable:t=>!t.startsWith("before")&&!t.startsWith("after")&&"callback"!==t&&"parser"!==t,_indexable:t=>"borderDash"!==t&&"tickBorderDash"!==t&&"dash"!==t}),t.describe("scales",{_fallback:"scale"}),t.describe("scale.ticks",{_scriptable:t=>"backdropPadding"!==t&&"callback"!==t,_indexable:t=>"backdropPadding"!==t})}]);function fe(){return"undefined"!=typeof window&&"undefined"!=typeof document}function ge(t){let e=t.parentNode;return e&&"[object ShadowRoot]"===e.toString()&&(e=e.host),e}function pe(t,e,i){let s;return"string"==typeof t?(s=parseInt(t,10),-1!==t.indexOf("%")&&(s=s/100*e.parentNode[i])):s=t,s}const me=t=>t.ownerDocument.defaultView.getComputedStyle(t,null);function xe(t,e){return me(t).getPropertyValue(e)}const be=["top","right","bottom","left"];function _e(t,e,i){const s={};i=i?"-"+i:"";for(let n=0;n<4;n++){const o=be[n];s[o]=parseFloat(t[e+"-"+o+i])||0}return s.width=s.left+s.right,s.height=s.top+s.bottom,s}const ye=(t,e,i)=>(t>0||e>0)&&(!i||!i.shadowRoot);function ve(t,e){if("native"in t)return t;const{canvas:i,currentDevicePixelRatio:s}=e,n=me(i),o="border-box"===n.boxSizing,a=_e(n,"padding"),r=_e(n,"border","width"),{x:l,y:h,box:c}=function(t,e){const i=t.touches,s=i&&i.length?i[0]:t,{offsetX:n,offsetY:o}=s;let a,r,l=!1;if(ye(n,o,t.target))a=n,r=o;else{const t=e.getBoundingClientRect();a=s.clientX-t.left,r=s.clientY-t.top,l=!0}return{x:a,y:r,box:l}}(t,i),d=a.left+(c&&r.left),u=a.top+(c&&r.top);let{width:f,height:g}=e;return o&&(f-=a.width+r.width,g-=a.height+r.height),{x:Math.round((l-d)/f*i.width/s),y:Math.round((h-u)/g*i.height/s)}}const Me=t=>Math.round(10*t)/10;function we(t,e,i,s){const n=me(t),o=_e(n,"margin"),a=pe(n.maxWidth,t,"clientWidth")||T,r=pe(n.maxHeight,t,"clientHeight")||T,l=function(t,e,i){let s,n;if(void 0===e||void 0===i){const o=t&&ge(t);if(o){const t=o.getBoundingClientRect(),a=me(o),r=_e(a,"border","width"),l=_e(a,"padding");e=t.width-l.width-r.width,i=t.height-l.height-r.height,s=pe(a.maxWidth,o,"clientWidth"),n=pe(a.maxHeight,o,"clientHeight")}else e=t.clientWidth,i=t.clientHeight}return{width:e,height:i,maxWidth:s||T,maxHeight:n||T}}(t,e,i);let{width:h,height:c}=l;if("content-box"===n.boxSizing){const t=_e(n,"border","width"),e=_e(n,"padding");h-=e.width+t.width,c-=e.height+t.height}h=Math.max(0,h-o.width),c=Math.max(0,s?h/s:c-o.height),h=Me(Math.min(h,a,l.maxWidth)),c=Me(Math.min(c,r,l.maxHeight)),h&&!c&&(c=Me(h/2));return(void 0!==e||void 0!==i)&&s&&l.height&&c>l.height&&(c=l.height,h=Me(Math.floor(c*s))),{width:h,height:c}}function ke(t,e,i){const s=e||1,n=M
34128ath.floor(t.height*s),o=Math.floor(t.width*s);t.height=Math.floor(t.height),t.width=Math.floor
vendor: 68,851 bytes, line 34128
34128(t.width);const a=t.canvas;return a.style&&(i||!a.style.height&&!a.style.width)&&(a.style.height=`${t.height}px`,a.style.width=`${t.width}px`),(t.currentDevicePixelRatio!==s||a.height!==n||a.width!==o)&&(t.currentDevicePixelRatio=s,a.height=n,a.width=o,t.ctx.setTransform(s,0,0,s,0,0),!0)}const Se=function(){let t=!1;try{const e={get passive(){return t=!0,!1}};fe()&&(window.addEventListener("test",null,e),window.removeEventListener("test",null,e))}catch(t){}return t}();function Pe(t,e){const i=xe(t,e),s=i&&i.match(/^(\d+)(\.\d+)?px$/);return s?+s[1]:void 0}function De(t){return!t||s(t.size)||s(t.family)?null:(t.style?t.style+" ":"")+(t.weight?t.weight+" ":"")+t.size+"px "+t.family}function Ce(t,e,i,s,n){let o=e[n];return o||(o=e[n]=t.measureText(n).width,i.push(n)),o>s&&(s=o),s}function Oe(t,e,i,s){let o=(s=s||{}).data=s.data||{},a=s.garbageCollect=s.garbageCollect||[];s.font!==e&&(o=s.data={},a=s.garbageCollect=[],s.font=e),t.save(),t.font=e;let r=0;const l=i.length;let h,c,d,u,f;for(h=0;h<l;h++)if(u=i[h],null==u||n(u)){if(n(u))for(c=0,d=u.length;c<d;c++)f=u[c],null==f||n(f)||(r=Ce(t,o,a,r,f))}else r=Ce(t,o,a,r,u);t.restore();const g=a.length/2;if(g>i.length){for(h=0;h<g;h++)delete o[a[h]];a.splice(0,g)}return r}function Ae(t,e,i){const s=t.currentDevicePixelRatio,n=0!==i?Math.max(i/2,.5):0;return Math.round((e-n)*s)/s+n}function Te(t,e){(e||t)&&((e=e||t.getContext("2d")).save(),e.resetTransform(),e.clearRect(0,0,t.width,t.height),e.restore())}function Le(t,e,i,s){Ee(t,e,i,s,null)}function Ee(t,e,i,s,n){let o,a,r,l,h,c,d,u;const f=e.pointStyle,g=e.rotation,p=e.radius;let m=(g||0)*L;if(f&&"object"==typeof f&&(o=f.toString(),"[object HTMLImageElement]"===o||"[object HTMLCanvasElement]"===o))return t.save(),t.translate(i,s),t.rotate(m),t.drawImage(f,-f.width/2,-f.height/2,f.width,f.height),void t.restore();if(!(isNaN(p)||p<=0)){switch(t.beginPath(),f){default:n?t.ellipse(i,s,n/2,p,0,0,O):t.arc(i,s,p,0,O),t.closePath();break;case"triangle":c=n?n/2:p,t.moveTo(i+Math.sin(m)*c,s-Math.cos(m)*p),m+=I,t.lineTo(i+Math.sin(m)*c,s-Math.cos(m)*p),m+=I,t.lineTo(i+Math.sin(m)*c,s-Math.cos(m)*p),t.closePath();break;case"rectRounded":h=.516*p,l=p-h,a=Math.cos(m+R)*l,d=Math.cos(m+R)*(n?n/2-h:l),r=Math.sin(m+R)*l,u=Math.sin(m+R)*(n?n/2-h:l),t.arc(i-d,s-r,h,m-C,m-E),t.arc(i+u,s-a,h,m-E,m),t.arc(i+d,s+r,h,m,m+E),t.arc(i-u,s+a,h,m+E,m+C),t.closePath();break;case"rect":if(!g){l=Math.SQRT1_2*p,c=n?n/2:l,t.rect(i-c,s-l,2*c,2*l);break}m+=R;case"rectRot":d=Math.cos(m)*(n?n/2:p),a=Math.cos(m)*p,r=Math.sin(m)*p,u=Math.sin(m)*(n?n/2:p),t.moveTo(i-d,s-r),t.lineTo(i+u,s-a),t.lineTo(i+d,s+r),t.lineTo(i-u,s+a),t.closePath();break;case"crossRot":m+=R;case"cross":d=Math.cos(m)*(n?n/2:p),a=Math.cos(m)*p,r=Math.sin(m)*p,u=Math.sin(m)*(n?n/2:p),t.moveTo(i-d,s-r),t.lineTo(i+d,s+r),t.moveTo(i+u,s-a),t.lineTo(i-u,s+a);break;case"star":d=Math.cos(m)*(n?n/2:p),a=Math.cos(m)*p,r=Math.sin(m)*p,u=Math.sin(m)*(n?n/2:p),t.moveTo(i-d,s-r),t.lineTo(i+d,s+r),t.moveTo(i+u,s-a),t.lineTo(i-u,s+a),m+=R,d=Math.cos(m)*(n?n/2:p),a=Math.cos(m)*p,r=Math.sin(m)*p,u=Math.sin(m)*(n?n/2:p),t.moveTo(i-d,s-r),t.lineTo(i+d,s+r),t.moveTo(i+u,s-a),t.lineTo(i-u,s+a);break;case"line":a=n?n/2:Math.cos(m)*p,r=Math.sin(m)*p,t.moveTo(i-a,s-r),t.lineTo(i+a,s+r);break;case"dash":t.moveTo(i,s),t.lineTo(i+Math.cos(m)*(n?n/2:p),s+Math.sin(m)*p);break;case!1:t.closePath()}t.fill(),e.borderWidth>0&&t.stroke()}}function Re(t,e,i){return i=i||.5,!e||t&&t.x>e.left-i&&t.x<e.right+i&&t.y>e.top-i&&t.y<e.bottom+i}function Ie(t,e){t.save(),t.beginPath(),t.rect(e.left,e.top,e.right-e.left,e.bottom-e.top),t.clip()}function ze(t){t.restore()}function Fe(t,e,i,s,n){if(!e)return t.lineTo(i.x,i.y);if("middle"===n){const s=(e.x+i.x)/2;t.lineTo(s,e.y),t.lineTo(s,i.y)}else"after"===n!=!!s?t.lineTo(e.x,i.y):t.lineTo(i.x,e.y);t.lineTo(i.x,i.y)}function Ve(t,e,i,s){if(!e)return t.lineTo(i.x,i.y);t.bezierCurveTo(s?e.cp1x:e.cp2x,s?e.cp1y:e.cp2y,s?i.cp2x:i.cp1x,s?i.cp2y:i.cp1y,i.x,i.y)}function Be(t,e,i,s,n){if(n.strikethrough||n.underline){const o=t.measureText(s),a=e-o.actualBoundingBoxLeft,r=e+o.actualBoundingBoxRight,l=i-o.actualBoundingBoxAscent,h=i+o.actualBoundingBoxDescent,c=n.strikethrough?(l+h)/2:h;t.strokeStyle=t.fillStyle,t.beginPath(),t.lineWidth=n.decorationWidth||2,t.moveTo(a,c),t.lineTo(r,c),t.stroke()}}function We(t,e){const i=t.fillStyle;t.fillStyle=e.color,t.fillRect(e.left,e.top,e.width,e.height),t.fillStyle=i}function Ne(t,e,i,o,a,r={}){const l=n(e)?e:[e],h=r.strokeWidth>0&&""!==r.strokeColor;let c,d;for(t.save(),t.font=a.string,function(t,e){e.translation&&t.translate(e.translation[0],e.translation[1]),s(e.rotation)||t.rotate(e.rotation),e.color&&(t.fillStyle=e.color),e.textAlign&&(t.textAlign=e.textAlign),e.textBaseline&&(t.textBaseline=e.textBaseline)}(t,r),c=0;c<l.length;++c)d=l[c],r.backdrop&&We(t,r.backdrop),h&&(r.strokeColor&&(t.strokeStyle=r.strokeColor),s(r.strokeWidth)||(t.lineWidth=r.strokeWidth),t.strokeText(d,i,o,r.maxWidth)),t.fillText(d,i,o,r.maxWidth),Be(t,i,o,d,r),o+=Number(a.lineHeight);t.restore()}function He(t,e){const{x:i,y:s,w:n,h:o,radius:a}=e;t.arc(i+a.topLeft,s+a.topLeft,a.topLeft,1.5*C,C,!0),t.lineTo(i,s+o-a.bottomLeft),t.arc(i+a.bottomLeft,s+o-a.bottomLeft,a.bottomLeft,C,E,!0),t.lineTo(i+n-a.bottomRight,s+o),t.arc(i+n-a.bottomRight,s+o-a.bottomRight,a.bottomRight,E,0,!0),t.lineTo(i+n,s+a.topRight),t.arc(i+n-a.topRight,s+a.topRight,a.topRight,0,-E,!0),t.lineTo(i+a.topLeft,s)}function je(t,e=[""],i,s,n=(()=>t[0])){const o=i||t;void 0===s&&(s=ti("_fallback",t));const a={[Symbol.toStringTag]:"Object",_cacheable:!0,_scopes:t,_rootScopes:o,_fallback:s,_getTarget:n,override:i=>je([i,...t],e,o,s)};return new Proxy(a,{deleteProperty:(e,i)=>(delete e[i],delete e._keys,delete t[0][i],!0),get:(i,s)=>qe(i,s,(()=>function(t,e,i,s){let n;for(const o of e)if(n=ti(Ue(o,t),i),void 0!==n)return Xe(t,n)?Ze(i,s,t,n):n}(s,e,t,i))),getOwnPropertyDescriptor:(t,e)=>Reflect.getOwnPropertyDescriptor(t._scopes[0],e),getPrototypeOf:()=>Reflect.getPrototypeOf(t[0]),has:(t,e)=>ei(t).includes(e),ownKeys:t=>ei(t),set(t,e,i){const s=t._storage||(t._storage=n());return t[e]=s[e]=i,delete t._keys,!0}})}function $e(t,e,i,s){const a={_cacheable:!1,_proxy:t,_context:e,_subProxy:i,_stack:new Set,_descriptors:Ye(t,s),setContext:e=>$e(t,e,i,s),override:n=>$e(t.override(n),e,i,s)};return new Proxy(a,{deleteProperty:(e,i)=>(delete e[i],delete t[i],!0),get:(t,e,i)=>qe(t,e,(()=>function(t,e,i){const{_proxy:s,_context:a,_subProxy:r,_descriptors:l}=t;let h=s[e];S(h)&&l.isScriptable(e)&&(h=function(t,e,i,s){const{_proxy:n,_context:o,_subProxy:a,_stack:r}=i;if(r.has(t))throw new Error("Recursion detected: "+Array.from(r).join("->")+"->"+t);r.add(t);let l=e(o,a||s);r.delete(t),Xe(t,l)&&(l=Ze(n._scopes,n,t,l));return l}(e,h,t,i));n(h)&&h.length&&(h=function(t,e,i,s){const{_proxy:n,_context:a,_subProxy:r,_descriptors:l}=i;if(void 0!==a.index&&s(t))return e[a.index%e.length];if(o(e[0])){const i=e,s=n._scopes.filter((t=>t!==i));e=[];for(const o of i){const i=Ze(s,n,t,o);e.push($e(i,a,r&&r[t],l))}}return e}(e,h,t,l.isIndexable));Xe(e,h)&&(h=$e(h,a,r&&r[e],l));return h}(t,e,i))),getOwnPropertyDescriptor:(e,i)=>e._descriptors.allKeys?Reflect.has(t,i)?{enumerable:!0,configurable:!0}:void 0:Reflect.getOwnPropertyDescriptor(t,i),getPrototypeOf:()=>Reflect.getPrototypeOf(t),has:(e,i)=>Reflect.has(t,i),ownKeys:()=>Reflect.ownKeys(t),set:(e,i,s)=>(t[i]=s,delete e[i],!0)})}function Ye(t,e={scriptable:!0,indexable:!0}){const{_scriptable:i=e.scriptable,_indexable:s=e.indexable,_allKeys:n=e.allKeys}=t;return{allKeys:n,scriptable:i,indexable:s,isScriptable:S(i)?i:()=>i,isIndexable:S(s)?s:()=>s}}const Ue=(t,e)=>t?t+w(e):e,Xe=(t,e)=>o(e)&&"adapters"!==t&&(null===Object.getPrototypeOf(e)||e.constructor===Object);function qe(t,e,i){if(Object.prototype.hasOwnProperty.call(t,e)||"constructor"===e)return t[e];const s=i();return t[e]=s,s}function Ke(t,e,i){return S(t)?t(e,i):t}const Ge=(t,e)=>!0===t?e:"string"==typeof t?M(e,t):void 0;function Je(t,e,i,s,n){for(const o of e){const e=Ge(i,o);if(e){t.add(e);const o=Ke(e._fallback,i,n);if(void 0!==o&&o!==i&&o!==s)return o}else if(!1===e&&void 0!==s&&i!==s)return null}return!1}function Ze(t,e,i,s){const a=e._rootScopes,r=Ke(e._fallback,i,s),l=[...t,...a],h=new Set;h.add(s);let c=Qe(h,l,i,r||i,s);return null!==c&&((void 0===r||r===i||(c=Qe(h,l,r,c,s),null!==c))&&je(Array.from(h),[""],a,r,(()=>function(t,e,i){const s=t._getTarget();e in s||(s[e]={});const a=s[e];if(n(a)&&o(i))return i;return a||{}}(e,i,s))))}function Qe(t,e,i,s,n){for(;i;)i=Je(t,e,i,s,n);return i}function ti(t,e){for(const i of e){if(!i)continue;const e=i[t];if(void 0!==e)return e}}function ei(t){let e=t._keys;return e||(e=t._keys=function(t){const e=new Set;for(const i of t)for(const t of Object.keys(i).filter((t=>!t.startsWith("_"))))e.add(t);return Array.from(e)}(t._scopes)),e}function ii(t,e,i,s){const{iScale:n}=t,{key:o="r"}=this._parsing,a=new Array(s);let r,l,h,c;for(r=0,l=s;r<l;++r)h=r+i,c=e[h],a[r]={r:n.parse(M(c,o),h)};return a}const si=Number.EPSILON||1e-14,ni=(t,e)=>e<t.length&&!t[e].skip&&t[e],oi=t=>"x"===t?"y":"x";function ai(t,e,i,s){const n=t.skip?e:t,o=e,a=i.skip?e:i,r=q(o,n),l=q(a,o);let h=r/(r+l),c=l/(r+l);h=isNaN(h)?0:h,c=isNaN(c)?0:c;const d=s*h,u=s*c;return{previous:{x:o.x-d*(a.x-n.x),y:o.y-d*(a.y-n.y)},next:{x:o.x+u*(a.x-n.x),y:o.y+u*(a.y-n.y)}}}function ri(t,e="x"){const i=oi(e),s=t.length,n=Array(s).fill(0),o=Array(s);let a,r,l,h=ni(t,0);for(a=0;a<s;++a)if(r=l,l=h,h=ni(t,a+1),l){if(h){const t=h[e]-l[e];n[a]=0!==t?(h[i]-l[i])/t:0}o[a]=r?h?F(n[a-1])!==F(n[a])?0:(n[a-1]+n[a])/2:n[a-1]:n[a]}!function(t,e,i){const s=t.length;let n,o,a,r,l,h=ni(t,0);for(let c=0;c<s-1;++c)l=h,h=ni(t,c+1),l&&h&&(V(e[c],0,si)?i[c]=i[c+1]=0:(n=i[c]/e[c],o=i[c+1]/e[c],r=Math.pow(n,2)+Math.pow(o,2),r<=9||(a=3/Math.sqrt(r),i[c]=n*a*e[c],i[c+1]=o*a*e[c])))}(t,n,o),function(t,e,i="x"){const s=oi(i),n=t.length;let o,a,r,l=ni(t,0);for(let h=0;h<n;++h){if(a=r,r=l,l=ni(t,h+1),!r)continue;const n=r[i],c=r[s];a&&(o=(n-a[i])/3,r[`cp1${i}`]=n-o,r[`cp1${s}`]=c-o*e[h]),l&&(o=(l[i]-n)/3,r[`cp2${i}`]=n+o,r[`cp2${s}`]=c+o*e[h])}}(t,o,e)}function li(t,e,i){return Math.max(Math.min(t,i),e)}function hi(t,e,i,s,n){let o,a,r,l;if(e.spanGaps&&(t=t.filter((t=>!t.skip))),"monotone"===e.cubicInterpolationMode)ri(t,n);else{let i=s?t[t.length-1]:t[0];for(o=0,a=t.length;o<a;++o)r=t[o],l=ai(i,r,t[Math.min(o+1,a-(s?0:1))%a],e.tension),r.cp1x=l.previous.x,r.cp1y=l.previous.y,r.cp2x=l.next.x,r.cp2y=l.next.y,i=r}e.capBezierPoints&&function(t,e){let i,s,n,o,a,r=Re(t[0],e);for(i=0,s=t.length;i<s;++i)a=o,o=r,r=i<s-1&&Re(t[i+1],e),o&&(n=t[i],a&&(n.cp1x=li(n.cp1x,e.left,e.right),n.cp1y=li(n.cp1y,e.top,e.bottom)),r&&(n.cp2x=li(n.cp2x,e.left,e.right),n.cp2y=li(n.cp2y,e.top,e.bottom)))}(t,i)}const ci=t=>0===t||1===t,di=(t,e,i)=>-Math.pow(2,10*(t-=1))*Math.sin((t-e)*O/i),ui=(t,e,i)=>Math.pow(2,-10*t)*Math.sin((t-e)*O/i)+1,fi={linear:t=>t,easeInQuad:t=>t*t,easeOutQuad:t=>-t*(t-2),easeInOutQuad:t=>(t/=.5)<1?.5*t*t:-.5*(--t*(t-2)-1),easeInCubic:t=>t*t*t,easeOutCubic:t=>(t-=1)*t*t+1,easeInOutCubic:t=>(t/=.5)<1?.5*t*t*t:.5*((t-=2)*t*t+2),easeInQuart:t=>t*t*t*t,easeOutQuart:t=>-((t-=1)*t*t*t-1),easeInOutQuart:t=>(t/=.5)<1?.5*t*t*t*t:-.5*((t-=2)*t*t*t-2),easeInQuint:t=>t*t*t*t*t,easeOutQuint:t=>(t-=1)*t*t*t*t+1,easeInOutQuint:t=>(t/=.5)<1?.5*t*t*t*t*t:.5*((t-=2)*t*t*t*t+2),easeInSine:t=>1-Math.cos(t*E),easeOutSine:t=>Math.sin(t*E),easeInOutSine:t=>-.5*(Math.cos(C*t)-1),easeInExpo:t=>0===t?0:Math.pow(2,10*(t-1)),easeOutExpo:t=>1===t?1:1-Math.pow(2,-10*t),easeInOutExpo:t=>ci(t)?t:t<.5?.5*Math.pow(2,10*(2*t-1)):.5*(2-Math.pow(2,-10*(2*t-1))),easeInCirc:t=>t>=1?t:-(Math.sqrt(1-t*t)-1),easeOutCirc:t=>Math.sqrt(1-(t-=1)*t),easeInOutCirc:t=>(t/=.5)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1),easeInElastic:t=>ci(t)?t:di(t,.075,.3),easeOutElastic:t=>ci(t)?t:ui(t,.075,.3),easeInOutElastic(t){const e=.1125;return ci(t)?t:t<.5?.5*di(2*t,e,.45):.5+.5*ui(2*t-1,e,.45)},easeInBack(t){const e=1.70158;return t*t*((e+1)*t-e)},easeOutBack(t){const e=1.70158;return(t-=1)*t*((e+1)*t+e)+1},easeInOutBack(t){let e=1.70158;return(t/=.5)<1?t*t*((1+(e*=1.525))*t-e)*.5:.5*((t-=2)*t*((1+(e*=1.525))*t+e)+2)},easeInBounce:t=>1-fi.easeOutBounce(1-t),easeOutBounce(t){const e=7.5625,i=2.75;return t<1/i?e*t*t:t<2/i?e*(t-=1.5/i)*t+.75:t<2.5/i?e*(t-=2.25/i)*t+.9375:e*(t-=2.625/i)*t+.984375},easeInOutBounce:t=>t<.5?.5*fi.easeInBounce(2*t):.5*fi.easeOutBounce(2*t-1)+.5};function gi(t,e,i,s){return{x:t.x+i*(e.x-t.x),y:t.y+i*(e.y-t.y)}}function pi(t,e,i,s){return{x:t.x+i*(e.x-t.x),y:"middle"===s?i<.5?t.y:e.y:"after"===s?i<1?t.y:e.y:i>0?e.y:t.y}}function mi(t,e,i,s){const n={x:t.cp2x,y:t.cp2y},o={x:e.cp1x,y:e.cp1y},a=gi(t,n,i),r=gi(n,o,i),l=gi(o,e,i),h=gi(a,r,i),c=gi(r,l,i);return gi(h,c,i)}const xi=/^(normal|(\d+(?:\.\d+)?)(px|em|%)?)$/,bi=/^(normal|italic|initial|inherit|unset|(oblique( -?[0-9]?[0-9]deg)?))$/;function _i(t,e){const i=(""+t).match(xi);if(!i||"normal"===i[1])return 1.2*e;switch(t=+i[2],i[3]){case"px":return t;case"%":t/=100}return e*t}const yi=t=>+t||0;function vi(t,e){const i={},s=o(e),n=s?Object.keys(e):e,a=o(t)?s?i=>l(t[i],t[e[i]]):e=>t[e]:()=>t;for(const t of n)i[t]=yi(a(t));return i}function Mi(t){return vi(t,{top:"y",right:"x",bottom:"y",left:"x"})}function wi(t){return vi(t,["topLeft","topRight","bottomLeft","bottomRight"])}function ki(t){const e=Mi(t);return e.width=e.left+e.right,e.height=e.top+e.bottom,e}function Si(t,e){t=t||{},e=e||ue.font;let i=l(t.size,e.size);"string"==typeof i&&(i=parseInt(i,10));let s=l(t.style,e.style);s&&!(""+s).match(bi)&&(console.warn('Invalid font style specified: "'+s+'"'),s=void 0);const n={family:l(t.family,e.family),lineHeight:_i(l(t.lineHeight,e.lineHeight),i),size:i,style:s,weight:l(t.weight,e.weight),string:""};return n.string=De(n),n}function Pi(t,e,i,s){let o,a,r,l=!0;for(o=0,a=t.length;o<a;++o)if(r=t[o],void 0!==r&&(void 0!==e&&"function"==typeof r&&(r=r(e),l=!1),void 0!==i&&n(r)&&(r=r[i%r.length],l=!1),void 0!==r))return s&&!l&&(s.cacheable=!1),r}function Di(t,e,i){const{min:s,max:n}=t,o=c(e,(n-s)/2),a=(t,e)=>i&&0===t?0:t+e;return{min:a(s,-Math.abs(o)),max:a(n,o)}}function Ci(t,e){return Object.assign(Object.create(t),e)}function Oi(t,e,i){return t?function(t,e){return{x:i=>t+t+e-i,setWidth(t){e=t},textAlign:t=>"center"===t?t:"right"===t?"left":"right",xPlus:(t,e)=>t-e,leftForLtr:(t,e)=>t-e}}(e,i):{x:t=>t,setWidth(t){},textAlign:t=>t,xPlus:(t,e)=>t+e,leftForLtr:(t,e)=>t}}function Ai(t,e){let i,s;"ltr"!==e&&"rtl"!==e||(i=t.canvas.style,s=[i.getPropertyValue("direction"),i.getPropertyPriority("direction")],i.setProperty("direction",e,"important"),t.prevTextDirection=s)}function Ti(t,e){void 0!==e&&(delete t.prevTextDirection,t.canvas.style.setProperty("direction",e[0],e[1]))}function Li(t){return"angle"===t?{between:J,compare:K,normalize:G}:{between:tt,compare:(t,e)=>t-e,normalize:t=>t}}function Ei({start:t,end:e,count:i,loop:s,style:n}){return{start:t%i,end:e%i,loop:s&&(e-t+1)%i==0,style:n}}function Ri(t,e,i){if(!i)return[t];const{property:s,start:n,end:o}=i,a=e.length,{compare:r,between:l,normalize:h}=Li(s),{start:c,end:d,loop:u,style:f}=function(t,e,i){const{property:s,start:n,end:o}=i,{between:a,normalize:r}=Li(s),l=e.length;let h,c,{start:d,end:u,loop:f}=t;if(f){for(d+=l,u+=l,h=0,c=l;h<c&&a(r(e[d%l][s]),n,o);++h)d--,u--;d%=l,u%=l}return u<d&&(u+=l),{start:d,end:u,loop:f,style:t.style}}(t,e,i),g=[];let p,m,x,b=!1,_=null;const y=()=>b||l(n,x,p)&&0!==r(n,x),v=()=>!b||0===r(o,p)||l(o,x,p);for(let t=c,i=c;t<=d;++t)m=e[t%a],m.skip||(p=h(m[s]),p!==x&&(b=l(p,n,o),null===_&&y()&&(_=0===r(p,n)?t:i),null!==_&&v()&&(g.push(Ei({start:_,end:t,loop:u,count:a,style:f})),_=null),i=t,x=p));return null!==_&&g.push(Ei({start:_,end:d,loop:u,count:a,style:f})),g}function Ii(t,e){const i=[],s=t.segments;for(let n=0;n<s.length;n++){const o=Ri(s[n],t.points,e);o.length&&i.push(...o)}return i}function zi(t,e){const i=t.points,s=t.options.spanGaps,n=i.length;if(!n)return[];const o=!!t._loop,{start:a,end:r}=function(t,e,i,s){let n=0,o=e-1;if(i&&!s)for(;n<e&&!t[n].skip;)n++;for(;n<e&&t[n].skip;)n++;for(n%=e,i&&(o+=n);o>n&&t[o%e].skip;)o--;return o%=e,{start:n,end:o}}(i,n,o,s);if(!0===s)return Fi(t,[{start:a,end:r,loop:o}],i,e);return Fi(t,function(t,e,i,s){const n=t.length,o=[];let a,r=e,l=t[e];for(a=e+1;a<=i;++a){const i=t[a%n];i.skip||i.stop?l.skip||(s=!1,o.push({start:e%n,end:(a-1)%n,loop:s}),e=r=i.stop?a:null):(r=a,l.skip&&(e=a)),l=i}return null!==r&&o.push({start:e%n,end:r%n,loop:s}),o}(i,a,r<a?r+n:r,!!t._fullLoop&&0===a&&r===n-1),i,e)}function Fi(t,e,i,s){return s&&s.setContext&&i?function(t,e,i,s){const n=t._chart.getContext(),o=Vi(t.options),{_datasetIndex:a,options:{spanGaps:r}}=t,l=i.length,h=[];let c=o,d=e[0].start,u=d;function f(t,e,s,n){const o=r?-1:1;if(t!==e){for(t+=l;i[t%l].skip;)t-=o;for(;i[e%l].skip;)e+=o;t%l!=e%l&&(h.push({start:t%l,end:e%l,loop:s,style:n}),c=n,d=e%l)}}for(const t of e){d=r?d:t.start;let e,o=i[d%l];for(u=d+1;u<=t.end;u++){const r=i[u%l];e=Vi(s.setContext(Ci(n,{type:"segment",p0:o,p1:r,p0DataIndex:(u-1)%l,p1DataIndex:u%l,datasetIndex:a}))),Bi(e,c)&&f(d,u-1,t.loop,c),o=r,c=e}d<u-1&&f(d,u-1,t.loop,c)}return h}(t,e,i,s):e}function Vi(t){return{backgroundColor:t.backgroundColor,borderCapStyle:t.borderCapStyle,borderDash:t.borderDash,borderDashOffset:t.borderDashOffset,borderJoinStyle:t.borderJoinStyle,borderWidth:t.borderWidth,borderColor:t.borderColor}}function Bi(t,e){if(!e)return!1;const i=[],s=function(t,e){return Zt(e)?(i.includes(e)||i.push(e),i.indexOf(e)):e};return JSON.stringify(t,s)!==JSON.stringify(e,s)}function Wi(t,e,i){return t.options.clip?t[i]:e[i]}function Ni(t,e){const i=e._clip;if(i.disabled)return!1;const s=function(t,e){const{xScale:i,yScale:s}=t;return i&&s?{left:Wi(i,e,"left"),right:Wi(i,e,"right"),top:Wi(s,e,"top"),bottom:Wi(s,e,"bottom")}:e}(e,t.chartArea);return{left:!1===i.left?0:s.left-(!0===i.left?0:i.left),right:!1===i.right?t.width:s.right+(!0===i.right?0:i.right),top:!1===i.top?0:s.top-(!0===i.top?0:i.top),bottom:!1===i.bottom?t.height:s.bottom+(!0===i.bottom?0:i.bottom)}}var Hi=Object.freeze({__proto__:null,HALF_PI:E,INFINITY:T,PI:C,PITAU:A,QUARTER_PI:R,RAD_PER_DEG:L,TAU:O,TWO_THIRDS_PI:I,_addGrace:Di,_alignPixel:Ae,_alignStartEnd:ft,_angleBetween:J,_angleDiff:K,_arrayUnique:lt,_attachContext:$e,_bezierCurveTo:Ve,_bezierInterpolation:mi,_boundSegment:Ri,_boundSegments:Ii,_capitalize:w,_computeSegments:zi,_createResolver:je,_decimalPlaces:U,_deprecated:function(t,e,i,s){void 0!==e&&console.warn(t+': "'+i+'" is deprecated. Please use "'+s+'" instead')},_descriptors:Ye,_elementsEqual:f,_factorize:W,_filterBetween:nt,_getParentNode:ge,_getStartAndCountOfVisiblePoints:pt,_int16Range:Q,_isBetween:tt,_isClickEvent:D,_isDomSupported:fe,_isPointInArea:Re,_limitValue:Z,_longestText:Oe,_lookup:et,_lookupByKey:it,_measureText:Ce,_merger:m,_mergerIf:_,_normalizeAngle:G,_parseObjectDataRadialScale:ii,_pointInLine:gi,_readValueToProps:vi,_rlookupByKey:st,_scaleRangesChanged:mt,_setMinAndMaxByKey:j,_splitKey:v,_steppedInterpolation:pi,_steppedLineTo:Fe,_textX:gt,_toLeftRightCenter:ut,_updateBezierControlPoints:hi,addRoundedRectPath:He,almostEquals:V,almostWhole:H,callback:d,clearCanvas:Te,clipArea:Ie,clone:g,color:Qt,createContext:Ci,debounce:dt,defined:k,distanceBetweenPoints:q,drawPoint:Le,drawPointLegend:Ee,each:u,easingEffects:fi,finiteOrDefault:r,fontString:function(t,e,i){return e+" "+t+"px "+i},formatNumber:ne,getAngleFromPoint:X,getDatasetClipArea:Ni,getHoverColor:te,getMaximumSize:we,getRelativePosition:ve,getRtlAdapter:Oi,getStyle:xe,isArray:n,isFinite:a,isFunction:S,isNullOrUndef:s,isNumber:N,isObject:o,isPatternOrGradient:Zt,listenArrayEvents:at,log10:z,merge:x,mergeIf:b,niceNum:B,noop:e,overrideTextDirection:Ai,readUsedSize:Pe,renderText:Ne,requestAnimFrame:ht,resolve:Pi,resolveObjectKey:M,restoreTextDirection:Ti,retinaScale:ke,setsEqual:P,sign:F,splineCurve:ai,splineCurveMonotone:ri,supportsEventListenerOptions:Se,throttled:ct,toDegrees:Y,toDimension:c,toFont:Si,toFontString:De,toLineHeight:_i,toPadding:ki,toPercentage:h,toRadians:$,toTRBL:Mi,toTRBLCorners:wi,uid:i,unclipArea:ze,unlistenArrayEvents:rt,valueOrDefault:l});function ji(t,e,i,n){const{controller:o,data:a,_sorted:r}=t,l=o._cachedMeta.iScale,h=t.dataset&&t.dataset.options?t.dataset.options.spanGaps:null;if(l&&e===l.axis&&"r"!==e&&r&&a.length){const r=l._reversePixels?st:it;if(!n){const n=r(a,e,i);if(h){const{vScale:e}=o._cachedMeta,{_parsed:i}=t,a=i.slice(0,n.lo+1).reverse().findIndex((t=>!s(t[e.axis])));n.lo-=Math.max(0,a);const r=i.slice(n.hi).findIndex((t=>!s(t[e.axis])));n.hi+=Math.max(0,r)}return n}if(o._sharedOptions){const t=a[0],s="function"==typeof t.getRange&&t.getRange(e);if(s){const t=r(a,e,i-s),n=r(a,e,i+s);return{lo:t.lo,hi:n.hi}}}}return{lo:0,hi:a.length-1}}function $i(t,e,i,s,n){const o=t.getSortedVisibleDatasetMetas(),a=i[e];for(let t=0,i=o.length;t<i;++t){const{index:i,data:r}=o[t],{lo:l,hi:h}=ji(o[t],e,a,n);for(let t=l;t<=h;++t){const e=r[t];e.skip||s(e,i,t)}}}function Yi(t,e,i,s,n){const o=[];if(!n&&!t.isPointInArea(e))return o;return $i(t,i,e,(function(i,a,r){(n||Re(i,t.chartArea,0))&&i.inRange(e.x,e.y,s)&&o.push({element:i,datasetIndex:a,index:r})}),!0),o}function Ui(t,e,i,s,n,o){let a=[];const r=function(t){const e=-1!==t.indexOf("x"),i=-1!==t.indexOf("y");return function(t,s){const n=e?Math.abs(t.x-s.x):0,o=i?Math.abs(t.y-s.y):0;return Math.sqrt(Math.pow(n,2)+Math.pow(o,2))}}(i);let l=Number.POSITIVE_INFINITY;return $i(t,i,e,(function(i,h,c){const d=i.inRange(e.x,e.y,n);if(s&&!d)return;const u=i.getCenterPoint(n);if(!(!!o||t.isPointInArea(u))&&!d)return;const f=r(e,u);f<l?(a=[{element:i,datasetIndex:h,index:c}],l=f):f===l&&a.push({element:i,datasetIndex:h,index:c})})),a}function Xi(t,e,i,s,n,o){return o||t.isPointInArea(e)?"r"!==i||s?Ui(t,e,i,s,n,o):function(t,e,i,s){let n=[];return $i(t,i,e,(function(t,i,o){const{startAngle:a,endAngle:r}=t.getProps(["startAngle","endAngle"],s),{angle:l}=X(t,{x:e.x,y:e.y});J(l,a,r)&&n.push({element:t,datasetIndex:i,index:o})})),n}(t,e,i,n):[]}function qi(t,e,i,s,n){const o=[],a="x"===i?"inXRange":"inYRange";let r=!1;return $i(t,i,e,((t,s,l)=>{t[a]&&t[a](e[i],n)&&(o.push({element:t,datasetIndex:s,index:l}),r=r||t.inRange(e.x,e.y,n))})),s&&!r?[]:o}var Ki={evaluateInteractionItems:$i,modes:{index(t,e,i,s){const n=ve(e,t),o=i.axis||"x",a=i.includeInvisible||!1,r=i.intersect?Yi(t,n,o,s,a):Xi(t,n,o,!1,s,a),l=[];return r.length?(t.getSortedVisibleDatasetMetas().forEach((t=>{const e=r[0].index,i=t.data[e];i&&!i.skip&&l.push({element:i,datasetIndex:t.index,index:e})})),l):[]},dataset(t,e,i,s){const n=ve(e,t),o=i.axis||"xy",a=i.includeInvisible||!1;let r=i.intersect?Yi(t,n,o,s,a):Xi(t,n,o,!1,s,a);if(r.length>0){const e=r[0].datasetIndex,i=t.getDatasetMeta(e).data;r=[];for(let t=0;t<i.length;++t)r.push({element:i[t],datasetIndex:e,index:t})}return r},point:(t,e,i,s)=>Yi(t,ve(e,t),i.axis||"xy",s,i.includeInvisible||!1),nearest(t,e,i,s){const n=ve(e,t),o=i.axis||"xy",a=i.includeInvisible||!1;return Xi(t,n,o,i.intersect,s,a)},x:(t,e,i,s)=>qi(t,ve(e,t),"x",i.intersect,s),y:(t,e,i,s)=>qi(t,ve(e,t),"y",i.intersect,s)}};const Gi=["left","top","right","bottom"];function Ji(t,e){return t.filter((t=>t.pos===e))}function Zi(t,e){return t.filter((t=>-1===Gi.indexOf(t.pos)&&t.box.axis===e))}function Qi(t,e){return t.sort(((t,i)=>{const s=e?i:t,n=e?t:i;return s.weight===n.weight?s.index-n.index:s.weight-n.weight}))}function ts(t,e){const i=function(t){const e={};for(const i of t){const{stack:t,pos:s,stackWeight:n}=i;if(!t||!Gi.includes(s))continue;const o=e[t]||(e[t]={count:0,placed:0,weight:0,size:0});o.count++,o.weight+=n}return e}(t),{vBoxMaxWidth:s,hBoxMaxHeight:n}=e;let o,a,r;for(o=0,a=t.length;o<a;++o){r=t[o];const{fullSize:a}=r.box,l=i[r.stack],h=l&&r.stackWeight/l.weight;r.horizontal?(r.width=h?h*s:a&&e.availableWidth,r.height=n):(r.width=s,r.height=h?h*n:a&&e.availableHeight)}return i}function es(t,e,i,s){return Math.max(t[i],e[i])+Math.max(t[s],e[s])}function is(t,e){t.top=Math.max(t.top,e.top),t.left=Math.max(t.left,e.left),t.bottom=Math.max(t.bottom,e.bottom),t.right=Math.max(t.right,e.right)}function ss(t,e,i,s){const{pos:n,box:a}=i,r=t.maxPadding;if(!o(n)){i.size&&(t[n]-=i.size);const e=s[i.stack]||{size:0,count:1};e.size=Math.max(e.size,i.horizontal?a.height:a.width),i.size=e.size/e.count,t[n]+=i.size}a.getPadding&&is(r,a.getPadding());const l=Math.max(0,e.outerWidth-es(r,t,"left","right")),h=Math.max(0,e.outerHeight-es(r,t,"top","bottom")),c=l!==t.w,d=h!==t.h;return t.w=l,t.h=h,i.horizontal?{same:c,other:d}:{same:d,other:c}}function ns(t,e){const i=e.maxPadding;function s(t){const s={left:0,top:0,right:0,bottom:0};return t.forEach((t=>{s[t]=Math.max(e[t],i[t])})),s}return s(t?["left","right"]:["top","bottom"])}function os(t,e,i,s){const n=[];let o,a,r,l,h,c;for(o=0,a=t.length,h=0;o<a;++o){r=t[o],l=r.box,l.update(r.width||e.w,r.height||e.h,ns(r.horizontal,e));const{same:a,other:d}=ss(e,i,r,s);h|=a&&n.length,c=c||d,l.fullSize||n.push(r)}return h&&os(n,e,i,s)||c}function as(t,e,i,s,n){t.top=i,t.left=e,t.right=e+s,t.bottom=i+n,t.width=s,t.height=n}function rs(t,e,i,s){const n=i.padding;let{x:o,y:a}=e;for(const r of t){const t=r.box,l=s[r.stack]||{count:1,placed:0,weight:1},h=r.stackWeight/l.weight||1;if(r.horizontal){const s=e.w*h,o=l.size||t.height;k(l.start)&&(a=l.start),t.fullSize?as(t,n.left,a,i.outerWidth-n.right-n.left,o):as(t,e.left+l.placed,a,s,o),l.start=a,l.placed+=s,a=t.bottom}else{const s=e.h*h,a=l.size||t.width;k(l.start)&&(o=l.start),t.fullSize?as(t,o,n.top,a,i.outerHeight-n.bottom-n.top):as(t,o,e.top+l.placed,a,s),l.start=o,l.placed+=s,o=t.right}}e.x=o,e.y=a}var ls={addBox(t,e){t.boxes||(t.boxes=[]),e.fullSize=e.fullSize||!1,e.position=e.position||"top",e.weight=e.weight||0,e._layers=e._layers||function(){return[{z:0,draw(t){e.draw(t)}}]},t.boxes.push(e)},removeBox(t,e){const i=t.boxes?t.boxes.indexOf(e):-1;-1!==i&&t.boxes.splice(i,1)},configure(t,e,i){e.fullSize=i.fullSize,e.position=i.position,e.weight=i.weight},update(t,e,i,s){if(!t)return;const n=ki(t.options.layout.padding),o=Math.max(e-n.width,0),a=Math.max(i-n.height,0),r=function(t){const e=function(t){const e=[];let i,s,n,o,a,r;for(i=0,s=(t||[]).length;i<s;++i)n=t[i],({position:o,options:{stack:a,stackWeight:r=1}}=n),e.push({index:i,box:n,pos:o,horizontal:n.isHorizontal(),weight:n.weight,stack:a&&o+a,stackWeight:r});return e}(t),i=Qi(e.filter((t=>t.box.fullSize)),!0),s=Qi(Ji(e,"left"),!0),n=Qi(Ji(e,"right")),o=Qi(Ji(e,"top"),!0),a=Qi(Ji(e,"bottom")),r=Zi(e,"x"),l=Zi(e,"y");return{fullSize:i,leftAndTop:s.concat(o),rightAndBottom:n.concat(l).concat(a).concat(r),chartArea:Ji(e,"chartArea"),vertical:s.concat(n).concat(l),horizontal:o.concat(a).concat(r)}}(t.boxes),l=r.vertical,h=r.horizontal;u(t.boxes,(t=>{"function"==typeof t.beforeLayout&&t.beforeLayout()}));const c=l.reduce(((t,e)=>e.box.options&&!1===e.box.options.display?t:t+1),0)||1,d=Object.freeze({outerWidth:e,outerHeight:i,padding:n,availableWidth:o,availableHeight:a,vBoxMaxWidth:o/2/c,hBoxMaxHeight:a/2}),f=Object.assign({},n);is(f,ki(s));const g=Object.assign({maxPadding:f,w:o,h:a,x:n.left,y:n.top},n),p=ts(l.concat(h),d);os(r.fullSize,g,d,p),os(l,g,d,p),os(h,g,d,p)&&os(l,g,d,p),function(t){const e=t.maxPadding;function i(i){const s=Math.max(e[i]-t[i],0);return t[i]+=s,s}t.y+=i("top"),t.x+=i("left"),i("right"),i("bottom")}(g),rs(r.leftAndTop,g,d,p),g.x+=g.w,g.y+=g.h,rs(r.rightAndBottom,g,d,p),t.chartArea={left:g.left,top:g.top,right:g.left+g.w,bottom:g.top+g.h,height:g.h,width:g.w},u(r.chartArea,(e=>{const i=e.box;Object.assign(i,t.chartArea),i.update(g.w,g.h,{left:0,top:0,right:0,bottom:0})}))}};class hs{acquireContext(t,e){}releaseContext(t){return!1}addEventListener(t,e,i){}removeEventListener(t,e,i){}getDevicePixelRatio(){return 1}getMaximumSize(t,e,i,s){return e=Math.max(0,e||t.width),i=i||t.height,{width:e,height:Math.max(0,s?Math.floor(e/s):i)}}isAttached(t){return!0}updateConfig(t){}}class cs extends hs{acquireContext(t){return t&&t.getContext&&t.getContext("2d")||null}updateConfig(t){t.options.animation=!1}}const ds="$chartjs",us={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},fs=t=>null===t||""===t;const gs=!!Se&&{passive:!0};function ps(t,e,i){t&&t.canvas&&t.canvas.removeEventListener(e,i,gs)}function ms(t,e){for(const i of t)if(i===e||i.contains(e))return!0}function xs(t,e,i){const s=t.canvas,n=new MutationObserver((t=>{let e=!1;for(const i of t)e=e||ms(i.addedNodes,s),e=e&&!ms(i.removedNodes,s);e&&i()}));return n.observe(document,{childList:!0,subtree:!0}),n}function bs(t,e,i){const s=t.canvas,n=new MutationObserver((t=>{let e=!1;for(const i of t)e=e||ms(i.removedNodes,s),e=e&&!ms(i.addedNodes,s);e&&i()}));return n.observe(document,{childList:!0,subtree:!0}),n}const _s=new Map;let ys=0;function vs(){const t=window.devicePixelRatio;t!==ys&&(ys=t,_s.forEach(((e,i)=>{i.currentDevicePixelRatio!==t&&e()})))}function Ms(t,e,i){const s=t.canvas,n=s&&ge(s);if(!n)return;const o=ct(((t,e)=>{const s=n.clientWidth;i(t,e),s<n.clientWidth&&i()}),window),a=new ResizeObserver((t=>{const e=t[0],i=e.contentRect.width,s=e.contentRect.height;0===i&&0===s||o(i,s)}));return a.observe(n),function(t,e){_s.size||window.addEventListener("resize",vs),_s.set(t,e)}(t,o),a}function ws(t,e,i){i&&i.disconnect(),"resize"===e&&function(t){_s.delete(t),_s.size||window.removeEventListener("resize",vs)}(t)}function ks(t,e,i){const s=t.canvas,n=ct((e=>{null!==t.ctx&&i(function(t,e){const i=us[t.type]||t.type,{x:s,y:n}=ve(t,e);return{type:i,chart:e,native:t,x:void 0!==s?s:null,y:void 0!==n?n:null}}(e,t))}),t);return function(t,e,i){t&&t.addEventListener(e,i,gs)}(s,e,n),n}class Ss extends hs{acquireContext(t,e){const i=t&&t.getContext&&t.getContext("2d");return i&&i.canvas===t?(function(t,e){const i=t.style,s=t.getAttribute("height"),n=t.getAttribute("width");if(t[ds]={initial:{height:s,width:n,style:{display:i.display,height:i.height,width:i.width}}},i.display=i.display||"block",i.boxSizing=i.boxSizing||"border-box",fs(n)){const e=Pe(t,"width");void 0!==e&&(t.width=e)}if(fs(s))if(""===t.style.height)t.height=t.width/(e||2);else{const e=Pe(t,"height");void 0!==e&&(t.height=e)}}(t,e),i):null}releaseContext(t){const e=t.canvas;if(!e[ds])return!1;const i=e[ds].initial;["height","width"].forEach((t=>{const n=i[t];s(n)?e.removeAttribute(t):e.setAttribute(t,n)}));const n=i.style||{};return Object.keys(n).forEach((t=>{e.style[t]=n[t]})),e.width=e.width,delete e[ds],!0}addEventListener(t,e,i){this.removeEventListener(t,e);const s=t.$proxies||(t.$proxies={}),n={attach:xs,detach:bs,resize:Ms}[e]||ks;s[e]=n(t,e,i)}removeEventListener(t,e){const i=t.$proxies||(t.$proxies={}),s=i[e];if(!s)return;({attach:ws,detach:ws,resize:ws}[e]||ps)(t,e,s),i[e]=void 0}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(t,e,i,s){return we(t,e,i,s)}isAttached(t){const e=t&&ge(t);return!(!e||!e.isConnected)}}function Ps(t){return!fe()||"undefined"!=typeof OffscreenCanvas&&t instanceof OffscreenCanvas?cs:Ss}var Ds=Object.freeze({__proto__:null,BasePlatform:hs,BasicPlatform:cs,DomPlatform:Ss,_detectPlatform:Ps});const Cs="transparent",Os={boolean:(t,e,i)=>i>.5?e:t,color(t,e,i){const s=Qt(t||Cs),n=s.valid&&Qt(e||Cs);return n&&n.valid?n.mix(s,i).hexString():e},number:(t,e,i)=>t+(e-t)*i};class As{constructor(t,e,i,s){const n=e[i];s=Pi([t.to,s,n,t.from]);const o=Pi([t.from,n,s]);this._active=!0,this._fn=t.fn||Os[t.type||typeof o],this._easing=fi[t.easing]||fi.linear,this._start=Math.floor(Date.now()+(t.delay||0)),this._duration=this._total=Math.floor(t.duration),this._loop=!!t.loop,this._target=e,this._prop=i,this._from=o,this._to=s,this._promises=void 0}active(){return this._active}update(t,e,i){if(this._active){this._notify(!1);const s=this._target[this._prop],n=i-this._start,o=this._duration-n;this._start=i,this._duration=Math.floor(Math.max(o,t.duration)),this._total+=n,this._loop=!!t.loop,this._to=Pi([t.to,e,s,t.from]),this._from=Pi([t.from,s,e])}}cancel(){this._active&&(this.tick(Date.now()),this._active=!1,this._notify(!1))}tick(t){const e=t-this._start,i=this._duration,s=this._prop,n=this._from,o=this._loop,a=this._to;let r;if(this._active=n!==a&&(o||e<i),!this._active)return this._target[s]=a,void this._notify(!0);e<0?this._target[s]=n:(r=e/i%2,r=o&&r>1?2-r:r,r=this._easing(Math.min(1,Math.max(0,r))),this._target[s]=this._fn(n,a,r))}wait(){const t=this._promises||(this._promises=[]);return new Promise(((e,i)=>{t.push({res:e,rej:i})}))}_notify(t){const e=t?"res":"rej",i=this._promises||[];for(let t=0;t<i.length;t++)i[t][e]()}}class Ts{constructor(t,e){this._chart=t,this._properties=new Map,this.configure(e)}configure(t){if(!o(t))return;const e=Object.keys(ue.animation),i=this._properties;Object.getOwnPropertyNames(t).forEach((s=>{const a=t[s];if(!o(a))return;const r={};for(const t of e)r[t]=a[t];(n(a.properties)&&a.properties||[s]).forEach((t=>{t!==s&&i.has(t)||i.set(t,r)}))}))}_animateOptions(t,e){const i=e.options,s=function(t,e){if(!e)return;let i=t.options;if(!i)return void(t.options=e);i.$shared&&(t.options=i=Object.assign({},i,{$shared:!1,$animations:{}}));return i}(t,i);if(!s)return[];const n=this._createAnimations(s,i);return i.$shared&&function(t,e){const i=[],s=Object.keys(e);for(let e=0;e<s.length;e++){const n=t[s[e]];n&&n.active()&&i.push(n.wait())}return Promise.all(i)}(t.options.$animations,i).then((()=>{t.options=i}),(()=>{})),n}_createAnimations(t,e){const i=this._properties,s=[],n=t.$animations||(t.$animations={}),o=Object.keys(e),a=Date.now();let r;for(r=o.length-1;r>=0;--r){const l=o[r];if("$"===l.charAt(0))continue;if("options"===l){s.push(...this._animateOptions(t,e));continue}const h=e[l];let c=n[l];const d=i.get(l);if(c){if(d&&c.active()){c.update(d,h,a);continue}c.cancel()}d&&d.duration?(n[l]=c=new As(d,t,l,h),s.push(c)):t[l]=h}return s}update(t,e){if(0===this._properties.size)return void Object.assign(t,e);const i=this._createAnimations(t,e);return i.length?(bt.add(this._chart,i),!0):void 0}}function Ls(t,e){const i=t&&t.options||{},s=i.reverse,n=void 0===i.min?e:0,o=void 0===i.max?e:0;return{start:s?o:n,end:s?n:o}}function Es(t,e){const i=[],s=t._getSortedDatasetMetas(e);let n,o;for(n=0,o=s.length;n<o;++n)i.push(s[n].index);return i}function Rs(t,e,i,s={}){const n=t.keys,o="single"===s.mode;let r,l,h,c;if(null===e)return;let d=!1;for(r=0,l=n.length;r<l;++r){if(h=+n[r],h===i){if(d=!0,s.all)continue;break}c=t.values[h],a(c)&&(o||0===e||F(e)===F(c))&&(e+=c)}return d||s.all?e:0}function Is(t,e){const i=t&&t.options.stacked;return i||void 0===i&&void 0!==e.stack}function zs(t,e,i){const s=t[e]||(t[e]={});return s[i]||(s[i]={})}function Fs(t,e,i,s){for(const n of e.getMatchingVisibleMetas(s).reverse()){const e=t[n.index];if(i&&e>0||!i&&e<0)return n.index}return null}function Vs(t,e){const{chart:i,_cachedMeta:s}=t,n=i._stacks||(i._stacks={}),{iScale:o,vScale:a,index:r}=s,l=o.axis,h=a.axis,c=function(t,e,i){return`${t.id}.${e.id}.${i.stack||i.type}`}(o,a,s),d=e.length;let u;for(let t=0;t<d;++t){const i=e[t],{[l]:o,[h]:d}=i;u=(i._stacks||(i._stacks={}))[h]=zs(n,c,o),u[r]=d,u._top=Fs(u,a,!0,s.type),u._bottom=Fs(u,a,!1,s.type);(u._visualValues||(u._visualValues={}))[r]=d}}function Bs(t,e){const i=t.scales;return Object.keys(i).filter((t=>i[t].axis===e)).shift()}function Ws(t,e){const i=t.controller.index,s=t.vScale&&t.vScale.axis;if(s){e=e||t._parsed;for(const t of e){const e=t._stacks;if(!e||void 0===e[s]||void 0===e[s][i])return;delete e[s][i],void 0!==e[s]._visualValues&&void 0!==e[s]._visualValues[i]&&delete e[s]._visualValues[i]}}}const Ns=t=>"reset"===t||"none"===t,Hs=(t,e)=>e?t:Object.assign({},t);class js{static defaults={};static datasetElementType=null;static dataElementType=null;constructor(t,e){this.chart=t,this._ctx=t.ctx,this.index=e,this._cachedDataOpts={},this._cachedMeta=this.getMeta(),this._type=this._cachedMeta.type,this.options=void 0,this._parsing=!1,this._data=void 0,this._objectData=void 0,this._sharedOptions=void 0,this._drawStart=void 0,this._drawCount=void 0,this.enableOptionSharing=!1,this.supportsDecimation=!1,this.$context=void 0,this._syncList=[],this.datasetElementType=new.target.datasetElementType,this.dataElementType=new.target.dataElementType,this.initialize()}initialize(){const t=this._cachedMeta;this.configure(),this.linkScales(),t._stacked=Is(t.vScale,t),this.addElements(),this.options.fill&&!this.chart.isPluginEnabled("filler")&&console.warn("Tried to use the 'fill' option without the 'Filler' plugin enabled. Please import and register the 'Filler' plugin and make sure it is not disabled in the options")}updateIndex(t){this.index!==t&&Ws(this._cachedMeta),this.index=t}linkScales(){const t=this.chart,e=this._cachedMeta,i=this.getDataset(),s=(t,e,i,s)=>"x"===t?e:"r"===t?s:i,n=e.xAxisID=l(i.xAxisID,Bs(t,"x")),o=e.yAxisID=l(i.yAxisID,Bs(t,"y")),a=e.rAxisID=l(i.rAxisID,Bs(t,"r")),r=e.indexAxis,h=e.iAxisID=s(r,n,o,a),c=e.vAxisID=s(r,o,n,a);e.xScale=this.getScaleForId(n),e.yScale=this.getScaleForId(o),e.rScale=this.getScaleForId(a),e.iScale=this.getScaleForId(h),e.vScale=this.getScaleForId(c)}getDataset(){return this.chart.data.datasets[this.index]}getMeta(){return this.chart.getDatasetMeta(this.index)}getScaleForId(t){return this.chart.scales[t]}_getOtherScale(t){const e=this._cachedMeta;return t===e.iScale?e.vScale:e.iScale}reset(){this._update("reset")}_destroy(){const t=this._cachedMeta;this._data&&rt(this._data,this),t._stacked&&Ws(t)}_dataCheck(){const t=this.getDataset(),e=t.data||(t.data=[]),i=this._data;if(o(e)){const t=this._cachedMeta;this._data=function(t,e){const{iScale:i,vScale:s}=e,n="x"===i.axis?"x":"y",o="x"===s.axis?"x":"y",a=Object.keys(t),r=new Array(a.length);let l,h,c;for(l=0,h=a.length;l<h;++l)c=a[l],r[l]={[n]:c,[o]:t[c]};return r}(e,t)}else if(i!==e){if(i){rt(i,this);const t=this._cachedMeta;Ws(t),t._parsed=[]}e&&Object.isExtensible(e)&&at(e,this),this._syncList=[],this._data=e}}addElements(){const t=this._cachedMeta;this._dataCheck(),this.datasetElementType&&(t.dataset=new this.datasetElementType)}buildOrUpdateElements(t){const e=this._cachedMeta,i=this.getDataset();let s=!1;this._dataCheck();const n=e._stacked;e._stacked=Is(e.vScale,e),e.stack!==i.stack&&(s=!0,Ws(e),e.stack=i.stack),this._resyncElements(t),(s||n!==e._stacked)&&(Vs(this,e._parsed),e._stacked=Is(e.vScale,e))}configure(){const t=this.chart.config,e=t.datasetScopeKeys(this._type),i=t.getOptionScopes(this.getDataset(),e,!0);this.options=t.createResolver(i,this.getContext()),this._parsing=this.options.parsing,this._cachedDataOpts={}}parse(t,e){const{_cachedMeta:i,_data:s}=this,{iScale:a,_stacked:r}=i,l=a.axis;let h,c,d,u=0===t&&e===s.length||i._sorted,f=t>0&&i._parsed[t-1];if(!1===this._parsing)i._parsed=s,i._sorted=!0,d=s;else{d=n(s[t])?this.parseArrayData(i,s,t,e):o(s[t])?this.parseObjectData(i,s,t,e):this.parsePrimitiveData(i,s,t,e);const a=()=>null===c[l]||f&&c[l]<f[l];for(h=0;h<e;++h)i._parsed[h+t]=c=d[h],u&&(a()&&(u=!1),f=c);i._sorted=u}r&&Vs(this,d)}parsePrimitiveData(t,e,i,s){const{iScale:n,vScale:o}=t,a=n.axis,r=o.axis,l=n.getLabels(),h=n===o,c=new Array(s);let d,u,f;for(d=0,u=s;d<u;++d)f=d+i,c[d]={[a]:h||n.parse(l[f],f),[r]:o.parse(e[f],f)};return c}parseArrayData(t,e,i,s){const{xScale:n,yScale:o}=t,a=new Array(s);let r,l,h,c;for(r=0,l=s;r<l;++r)h=r+i,c=e[h],a[r]={x:n.parse(c[0],h),y:o.parse(c[1],h)};return a}parseObjectData(t,e,i,s){const{xScale:n,yScale:o}=t,{xAxisKey:a="x",yAxisKey:r="y"}=this._parsing,l=new Array(s);let h,c,d,u;for(h=0,c=s;h<c;++h)d=h+i,u=e[d],l[h]={x:n.parse(M(u,a),d),y:o.parse(M(u,r),d)};return l}getParsed(t){return this._cachedMeta._parsed[t]}getDataElement(t){return this._cachedMeta.data[t]}applyStack(t,e,i){const s=this.chart,n=this._cachedMeta,o=e[t.axis];return Rs({keys:Es(s,!0),values:e._stacks[t.axis]._visualValues},o,n.index,{mode:i})}updateRangeFromParsed(t,e,i,s){const n=i[e.axis];let o=null===n?NaN:n;const a=s&&i._stacks[e.axis];s&&a&&(s.values=a,o=Rs(s,n,this._cachedMeta.index)),t.min=Math.min(t.min,o),t.max=Math.max(t.max,o)}getMinMax(t,e){const i=this._cachedMeta,s=i._parsed,n=i._sorted&&t===i.iScale,o=s.length,r=this._getOtherScale(t),l=((t,e,i)=>t&&!e.hidden&&e._stacked&&{keys:Es(i,!0),values:null})(e,i,this.chart),h={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY},{min:c,max:d}=function(t){const{min:e,max:i,minDefined:s,maxDefined:n}=t.getUserBounds();return{min:s?e:Number.NEGATIVE_INFINITY,max:n?i:Number.POSITIVE_INFINITY}}(r);let u,f;function g(){f=s[u];const e=f[r.axis];return!a(f[t.axis])||c>e||d<e}for(u=0;u<o&&(g()||(this.updateRangeFromParsed(h,t,f,l),!n));++u);if(n)for(u=o-1;u>=0;--u)if(!g()){this.updateRangeFromParsed(h,t,f,l);break}return h}getAllParsedValues(t){const e=this._cachedMeta._parsed,i=[];let s,n,o;for(s=0,n=e.length;s<n;++s)o=e[s][t.axis],a(o)&&i.push(o);return i}getMaxOverflow(){return!1}getLabelAndValue(t){const e=this._cachedMeta,i=e.iScale,s=e.vScale,n=this.getParsed(t);return{label:i?""+i.getLabelForValue(n[i.axis]):"",value:s?""+s.getLabelForValue(n[s.axis]):""}}_update(t){const e=this._cachedMeta;this.update(t||"default"),e._clip=function(t){let e,i,s,n;return o(t)?(e=t.top,i=t.right,s=t.bottom,n=t.left):e=i=s=n=t,{top:e,right:i,bottom:s,left:n,disabled:!1===t}}(l(this.options.clip,function(t,e,i){if(!1===i)return!1;const s=Ls(t,i),n=Ls(e,i);return{top:n.end,right:s.end,bottom:n.start,left:s.start}}(e.xScale,e.yScale,this.getMaxOverflow())))}update(t){}draw(){const t=this._ctx,e=this.chart,i=this._cachedMeta,s=i.data||[],n=e.chartArea,o=[],a=this._drawStart||0,r=this._drawCount||s.length-a,l=this.options.drawActiveElementsOnTop;let h;for(i.dataset&&i.dataset.draw(t,n,a,r),h=a;h<a+r;++h){const e=s[h];e.hidden||(e.active&&l?o.push(e):e.draw(t,n))}for(h=0;h<o.length;++h)o[h].draw(t,n)}getStyle(t,e){const i=e?"active":"default";return void 0===t&&this._cachedMeta.dataset?this.resolveDatasetElementOptions(i):this.resolveDataElementOptions(t||0,i)}getContext(t,e,i){const s=this.getDataset();let n;if(t>=0&&t<this._cachedMeta.data.length){const e=this._cachedMeta.data[t];n=e.$context||(e.$context=function(t,e,i){return Ci(t,{active:!1,dataIndex:e,parsed:void 0,raw:void 0,element:i,index:e,mode:"default",type:"data"})}(this.getContext(),t,e)),n.parsed=this.getParsed(t),n.raw=s.data[t],n.index=n.dataIndex=t}else n=this.$context||(this.$context=function(t,e){return Ci(t,{active:!1,dataset:void 0,datasetIndex:e,index:e,mode:"default",type:"dataset"})}(this.chart.getContext(),this.index)),n.dataset=s,n.index=n.datasetIndex=this.index;return n.active=!!e,n.mode=i,n}resolveDatasetElementOptions(t){return this._resolveElementOptions(this.datasetElementType.id,t)}resolveDataElementOptions(t,e){return this._resolveElementOptions(this.dataElementType.id,e,t)}_resolveElementOptions(t,e="default",i){const s="active"===e,n=this._cachedDataOpts,o=t+"-"+e,a=n[o],r=this.enableOptionSharing&&k(i);if(a)return Hs(a,r);const l=this.chart.config,h=l.datasetElementScopeKeys(this._type,t),c=s?[`${t}Hover`,"hover",t,""]:[t,""],d=l.getOptionScopes(this.getDataset(),h),u=Object.keys(ue.elements[t]),f=l.resolveNamedOptions(d,u,(()=>this.getContext(i,s,e)),c);return f.$shared&&(f.$shared=r,n[o]=Object.freeze(Hs(f,r))),f}_resolveAnimations(t,e,i){const s=this.chart,n=this._cachedDataOpts,o=`animation-${e}`,a=n[o];if(a)return a;let r;if(!1!==s.options.animation){const s=this.chart.config,n=s.datasetAnimationScopeKeys(this._type,e),o=s.getOptionScopes(this.getDataset(),n);r=s.createResolver(o,this.getContext(t,i,e))}const l=new Ts(s,r&&r.animations);return r&&r._cacheable&&(n[o]=Object.freeze(l)),l}getSharedOptions(t){if(t.$shared)return this._sharedOptions||(this._sharedOptions=Object.assign({},t))}includeOptions(t,e){return!e||Ns(t)||this.chart._animationsDisabled}_getSharedOptions(t,e){const i=this.resolveDataElementOptions(t,e),s=this._sharedOptions,n=this.getSharedOptions(i),o=this.includeOptions(e,n)||n!==s;return this.updateSharedOptions(n,e,i),{sharedOptions:n,includeOptions:o}}updateElement(t,e,i,s){Ns(s)?Object.assign(t,i):this._resolveAnimations(e,s).update(t,i)}updateSharedOptions(t,e,i){t&&!Ns(e)&&this._resolveAnimations(void 0,e).update(t,i)}_setStyle(t,e,i,s){t.active=s;const n=this.getStyle(e,s);this._resolveAnimations(e,i,s).update(t,{options:!s&&this.getSharedOptions(n)||n})}removeHoverStyle(t,e,i){this._setStyle(t,i,"active",!1)}setHoverStyle(t,e,i){this._setStyle(t,i,"active",!0)}_removeDatasetHoverStyle(){const t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!1)}_setDatasetHoverStyle(){const t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!0)}_resyncElements(t){const e=this._data,i=this._cachedMeta.data;for(const[t,e,i]of this._syncList)this[t](e,i);this._syncList=[];const s=i.length,n=e.length,o=Math.min(n,s);o&&this.parse(0,o),n>s?this._insertElements(s,n-s,t):n<s&&this._removeElements(n,s-n)}_insertElements(t,e,i=!0){const s=this._cachedMeta,n=s.data,o=t+e;let a;const r=t=>{for(t.length+=e,a=t.length-1;a>=o;a--)t[a]=t[a-e]};for(r(n),a=t;a<o;++a)n[a]=new this.dataElementType;this._parsing&&r(s._parsed),this.parse(t,e),i&&this.updateElements(n,t,e,"reset")}updateElements(t,e,i,s){}_removeElements(t,e){const i=this._cachedMeta;if(this._parsing){const s=i._parsed.splice(t,e);i._stacked&&Ws(i,s)}i.data.splice(t,e)}_sync(t){if(this._parsing)this._syncList.push(t);else{const[e,i,s]=t;this[e](i,s)}this.chart._dataChanges.push([this.index,...t])}_onDataPush(){const t=arguments.length;this._sync(["_insertElements",this.getDataset().data.length-t,t])}_onDataPop(){this._sync(["_removeElements",this._cachedMeta.data.length-1,1])}_onDataShift(){this._sync(["_removeElements",0,1])}_onDataSplice(t,e){e&&this._sync(["_removeElements",t,e]);const i=arguments.length-2;i&&this._sync(["_insertElements",t,i])}_onDataUnshift(){this._sync(["_insertElements",0,arguments.length])}}class $s{static defaults={};static defaultRoutes=void 0;x;y;active=!1;options;$animations;tooltipPosition(t){const{x:e,y:i}=this.getProps(["x","y"],t);return{x:e,y:i}}hasValue(){return N(this.x)&&N(this.y)}getProps(t,e){const i=this.$animations;if(!e||!i)return this;const s={};return t.forEach((t=>{s[t]=i[t]&&i[t].active()?i[t]._to:this[t]})),s}}function Ys(t,e){const i=t.options.ticks,n=function(t){const e=t.options.offset,i=t._tickSize(),s=t._length/i+(e?0:1),n=t._maxLength/i;return Math.floor(Math.min(s,n))}(t),o=Math.min(i.maxTicksLimit||n,n),a=i.major.enabled?function(t){const e=[];let i,s;for(i=0,s=t.length;i<s;i++)t[i].major&&e.push(i);return e}(e):[],r=a.length,l=a[0],h=a[r-1],c=[];if(r>o)return function(t,e,i,s){let n,o=0,a=i[0];for(s=Math.ceil(s),n=0;n<t.length;n++)n===a&&(e.push(t[n]),o++,a=i[o*s])}(e,c,a,r/o),c;const d=function(t,e,i){const s=function(t){const e=t.length;let i,s;if(e<2)return!1;for(s=t[0],i=1;i<e;++i)if(t[i]-t[i-1]!==s)return!1;return s}(t),n=e.length/i;if(!s)return Math.max(n,1);const o=W(s);for(let t=0,e=o.length-1;t<e;t++){const e=o[t];if(e>n)return e}return Math.max(n,1)}(a,e,o);if(r>0){let t,i;const n=r>1?Math.round((h-l)/(r-1)):null;for(Us(e,c,d,s(n)?0:l-n,l),t=0,i=r-1;t<i;t++)Us(e,c,d,a[t],a[t+1]);return Us(e,c,d,h,s(n)?e.length:h+n),c}return Us(e,c,d),c}function Us(t,e,i,s,n){const o=l(s,0),a=Math.min(l(n,t.length),t.length);let r,h,c,d=0;for(i=Math.ceil(i),n&&(r=n-s,i=r/Math.floor(r/i)),c=o;c<0;)d++,c=Math.round(o+d*i);for(h=Math.max(o,0);h<a;h++)h===c&&(e.push(t[h]),d++,c=Math.round(o+d*i))}const Xs=(t,e,i)=>"top"===e||"left"===e?t[e]+i:t[e]-i,qs=(t,e)=>Math.min(e||t,t);function Ks(t,e){const i=[],s=t.length/e,n=t.length;let o=0;for(;o<n;o+=s)i.push(t[Math.floor(o)]);return i}function Gs(t,e,i){const s=t.ticks.length,n=Math.min(e,s-1),o=t._startPixel,a=t._endPixel,r=1e-6;let l,h=t.getPixelForTick(n);if(!(i&&(l=1===s?Math.max(h-o,a-h):0===e?(t.getPixelForTick(1)-h)/2:(h-t.getPixelForTick(n-1))/2,h+=n<e?l:-l,h<o-r||h>a+r)))return h}function Js(t){return t.drawTicks?t.tickLength:0}function Zs(t,e){if(!t.display)return 0;const i=Si(t.font,e),s=ki(t.padding);return(n(t.text)?t.text.length:1)*i.lineHeight+s.height}function Qs(t,e,i){let s=ut(t);return(i&&"right"!==e||!i&&"right"===e)&&(s=(t=>"left"===t?"right":"right"===t?"left":t)(s)),s}class tn extends $s{constructor(t){super(),this.id=t.id,this.type=t.type,this.options=void 0,this.ctx=t.ctx,this.chart=t.chart,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this._margins={left:0,right:0,top:0,bottom:0},this.maxWidth=void 0,this.maxHeight=void 0,this.paddingTop=void 0,this.paddingBottom=void 0,this.paddingLeft=void 0,this.paddingRight=void 0,this.axis=void 0,this.labelRotation=void 0,this.min=void 0,this.max=void 0,this._range=void 0,this.ticks=[],this._gridLineItems=null,this._labelItems=null,this._labelSizes=null,this._length=0,this._maxLength=0,this._longestTextCache={},this._startPixel=void 0,this._endPixel=void 0,this._reversePixels=!1,this._userMax=void 0,this._userMin=void 0,this._suggestedMax=void 0,this._suggestedMin=void 0,this._ticksLength=0,this._borderValue=0,this._cache={},this._dataLimitsCached=!1,this.$context=void 0}init(t){this.options=t.setContext(this.getContext()),this.axis=t.axis,this._userMin=this.parse(t.min),this._userMax=this.parse(t.max),this._suggestedMin=this.parse(t.suggestedMin),this._suggestedMax=this.parse(t.suggestedMax)}parse(t,e){return t}getUserBounds(){let{_userMin:t,_userMax:e,_suggestedMin:i,_suggestedMax:s}=this;return t=r(t,Number.POSITIVE_INFINITY),e=r(e,Number.NEGATIVE_INFINITY),i=r(i,Number.POSITIVE_INFINITY),s=r(s,Number.NEGATIVE_INFINITY),{min:r(t,i),max:r(e,s),minDefined:a(t),maxDefined:a(e)}}getMinMax(t){let e,{min:i,max:s,minDefined:n,maxDefined:o}=this.getUserBounds();if(n&&o)return{min:i,max:s};const a=this.getMatchingVisibleMetas();for(let r=0,l=a.length;r<l;++r)e=a[r].controller.getMinMax(this,t),n||(i=Math.min(i,e.min)),o||(s=Math.max(s,e.max));return i=o&&i>s?s:i,s=n&&i>s?i:s,{min:r(i,r(s,i)),max:r(s,r(i,s))}}getPadding(){return{left:this.paddingLeft||0,top:this.paddingTop||0,right:this.paddingRight||0,bottom:this.paddingBottom||0}}getTicks(){return this.ticks}getLabels(){const t=this.chart.data;return this.options.labels||(this.isHorizontal()?t.xLabels:t.yLabels)||t.labels||[]}getLabelItems(t=this.chart.chartArea){return this._labelItems||(this._labelItems=this._computeLabelItems(t))}beforeLayout(){this._cache={},this._dataLimitsCached=!1}beforeUpdate(){d(this.options.beforeUpdate,[this])}update(t,e,i){const{beginAtZero:s,grace:n,ticks:o}=this.options,a=o.sampleSize;this.beforeUpdate(),this.maxWidth=t,this.maxHeight=e,this._margins=i=Object.assign({left:0,right:0,top:0,bottom:0},i),this.ticks=null,this._labelSizes=null,this._gridLineItems=null,this._labelItems=null,this.beforeSetDimensions(),this.setDimensions(),this.afterSetDimensions(),this._maxLength=this.isHorizontal()?this.width+i.left+i.right:this.height+i.top+i.bottom,this._dataLimitsCached||(this.beforeDataLimits(),this.determineDataLimits(),this.afterDataLimits(),this._range=Di(this,n,s),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();const r=a<this.ticks.length;this._convertTicksToLabels(r?Ks(this.ticks,a):this.ticks),this.configure(),this.beforeCalculateLabelRotation(),this.calculateLabelRotation(),this.afterCalculateLabelRotation(),o.display&&(o.autoSkip||"auto"===o.source)&&(this.ticks=Ys(this,this.ticks),this._labelSizes=null,this.afterAutoSkip()),r&&this._convertTicksToLabels(this.ticks),this.beforeFit(),this.fit(),this.afterFit(),this.afterUpdate()}configure(){let t,e,i=this.options.reverse;this.isHorizontal()?(t=this.left,e=this.right):(t=this.top,e=this.bottom,i=!i),this._startPixel=t,this._endPixel=e,this._reversePixels=i,this._length=e-t,this._alignToPixels=this.options.alignToPixels}afterUpdate(){d(this.options.afterUpdate,[this])}beforeSetDimensions(){d(this.options.beforeSetDimensions,[this])}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=0,this.right=this.width):(this.height=this.maxHeight,this.top=0,this.bottom=this.height),this.paddingLeft=0,this.paddingTop=0,this.paddingRight=0,this.paddingBottom=0}afterSetDimensions(){d(this.options.afterSetDimensions,[this])}_callHooks(t){this.chart.notifyPlugins(t,this.getContext()),d(this.options[t],[this])}beforeDataLimits(){this._callHooks("beforeDataLimits")}determineDataLimits(){}afterDataLimits(){this._callHooks("afterDataLimits")}beforeBuildTicks(){this._callHooks("beforeBuildTicks")}buildTicks(){return[]}afterBuildTicks(){this._callHooks("afterBuildTicks")}beforeTickToLabelConversion(){d(this.options.beforeTickToLabelConversion,[this])}generateTickLabels(t){const e=this.options.ticks;let i,s,n;for(i=0,s=t.length;i<s;i++)n=t[i],n.label=d(e.callback,[n.value,i,t],this)}afterTickToLabelConversion(){d(this.options.afterTickToLabelConversion,[this])}beforeCalculateLabelRotation(){d(this.options.beforeCalculateLabelRotation,[this])}calculateLabelRotation(){const t=this.options,e=t.ticks,i=qs(this.ticks.length,t.ticks.maxTicksLimit),s=e.minRotation||0,n=e.maxRotation;let o,a,r,l=s;if(!this._isVisible()||!e.display||s>=n||i<=1||!this.isHorizontal())return void(this.labelRotation=s);const h=this._getLabelSizes(),c=h.widest.width,d=h.highest.height,u=Z(this.chart.width-c,0,this.maxWidth);o=t.offset?this.maxWidth/i:u/(i-1),c+6>o&&(o=u/(i-(t.offset?.5:1)),a=this.maxHeight-Js(t.grid)-e.padding-Zs(t.title,this.chart.options.font),r=Math.sqrt(c*c+d*d),l=Y(Math.min(Math.asin(Z((h.highest.height+6)/o,-1,1)),Math.asin(Z(a/r,-1,1))-Math.asin(Z(d/r,-1,1)))),l=Math.max(s,Math.min(n,l))),this.labelRotation=l}afterCalculateLabelRotation(){d(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){d(this.options.beforeFit,[this])}fit(){const t={width:0,height:0},{chart:e,options:{ticks:i,title:s,grid:n}}=this,o=this._isVisible(),a=this.isHorizontal();if(o){const o=Zs(s,e.options.font);if(a?(t.width=this.maxWidth,t.height=Js(n)+o):(t.height=this.maxHeight,t.width=Js(n)+o),i.display&&this.ticks.length){const{first:e,last:s,widest:n,highest:o}=this._getLabelSizes(),r=2*i.padding,l=$(this.labelRotation),h=Math.cos(l),c=Math.sin(l);if(a){const e=i.mirror?0:c*n.width+h*o.height;t.height=Math.min(this.maxHeight,t.height+e+r)}else{const e=i.mirror?0:h*n.width+c*o.height;t.width=Math.min(this.maxWidth,t.width+e+r)}this._calculatePadding(e,s,c,h)}}this._handleMargins(),a?(this.width=this._length=e.width-this._margins.left-this._margins.right,this.height=t.height):(this.width=t.width,this.height=this._length=e.height-this._margins.top-this._margins.bottom)}_calculatePadding(t,e,i,s){const{ticks:{align:n,padding:o},position:a}=this.options,r=0!==this.labelRotation,l="top"!==a&&"x"===this.axis;if(this.isHorizontal()){const a=this.getPixelForTick(0)-this.left,h=this.right-this.getPixelForTick(this.ticks.length-1);let c=0,d=0;r?l?(c=s*t.width,d=i*e.height):(c=i*t.height,d=s*e.width):"start"===n?d=e.width:"end"===n?c=t.width:"inner"!==n&&(c=t.width/2,d=e.width/2),this.paddingLeft=Math.max((c-a+o)*this.width/(this.width-a),0),this.paddingRight=Math.max((d-h+o)*this.width/(this.width-h),0)}else{let i=e.height/2,s=t.height/2;"start"===n?(i=0,s=t.height):"end"===n&&(i=e.height,s=0),this.paddingTop=i+o,this.paddingBottom=s+o}}_handleMargins(){this._margins&&(this._margins.left=Math.max(this.paddingLeft,this._margins.left),this._margins.top=Math.max(this.paddingTop,this._margins.top),this._margins.right=Math.max(this.paddingRight,this._margins.right),this._margins.bottom=Math.max(this.paddingBottom,this._margins.bottom))}afterFit(){d(this.options.afterFit,[this])}isHorizontal(){const{axis:t,position:e}=this.options;return"top"===e||"bottom"===e||"x"===t}isFullSize(){return this.options.fullSize}_convertTicksToLabels(t){let e,i;for(this.beforeTickToLabelConversion(),this.generateTickLabels(t),e=0,i=t.length;e<i;e++)s(t[e].label)&&(t.splice(e,1),i--,e--);this.afterTickToLabelConversion()}_getLabelSizes(){let t=this._labelSizes;if(!t){const e=this.options.ticks.sampleSize;let i=this.ticks;e<i.length&&(i=Ks(i,e)),this._labelSizes=t=this._computeLabelSizes(i,i.length,this.options.ticks.maxTicksLimit)}return t}_computeLabelSizes(t,e,i){const{ctx:o,_longestTextCache:a}=this,r=[],l=[],h=Math.floor(e/qs(e,i));let c,d,f,g,p,m,x,b,_,y,v,M=0,w=0;for(c=0;c<e;c+=h){if(g=t[c].label,p=this._resolveTickFontOptions(c),o.font=m=p.string,x=a[m]=a[m]||{data:{},gc:[]},b=p.lineHeight,_=y=0,s(g)||n(g)){if(n(g))for(d=0,f=g.length;d<f;++d)v=g[d],s(v)||n(v)||(_=Ce(o,x.data,x.gc,_,v),y+=b)}else _=Ce(o,x.data,x.gc,_,g),y=b;r.push(_),l.push(y),M=Math.max(_,M),w=Math.max(y,w)}!function(t,e){u(t,(t=>{const i=t.gc,s=i.length/2;let n;if(s>e){for(n=0;n<s;++n)delete t.data[i[n]];i.splice(0,s)}}))}(a,e);const k=r.indexOf(M),S=l.indexOf(w),P=t=>({width:r[t]||0,height:l[t]||0});return{first:P(0),last:P(e-1),widest:P(k),highest:P(S),widths:r,heights:l}}getLabelForValue(t){return t}getPixelForValue(t,e){return NaN}getValueForPixel(t){}getPixelForTick(t){const e=this.ticks;return t<0||t>e.length-1?null:this.getPixelForValue(e[t].value)}getPixelForDecimal(t){this._reversePixels&&(t=1-t);const e=this._startPixel+t*this._length;return Q(this._alignToPixels?Ae(this.chart,e,0):e)}getDecimalForPixel(t){const e=(t-this._startPixel)/this._length;return this._reversePixels?1-e:e}getBasePixel(){return this.getPixelForValue(this.getBaseValue())}getBaseValue(){const{min:t,max:e}=this;return t<0&&e<0?e:t>0&&e>0?t:0}getContext(t){const e=this.ticks||[];if(t>=0&&t<e.length){const i=e[t];return i.$context||(i.$context=function(t,e,i){return Ci(t,{tick:i,index:e,type:"tick"})}(this.getContext(),t,i))}return this.$context||(this.$context=Ci(this.chart.getContext(),{scale:this,type:"scale"}))}_tickSize(){const t=this.options.ticks,e=$(this.labelRotation),i=Math.abs(Math.cos(e)),s=Math.abs(Math.sin(e)),n=this._getLabelSizes(),o=t.autoSkipPadding||0,a=n?n.widest.width+o:0,r=n?n.highest.height+o:0;return this.isHorizontal()?r*i>a*s?a/i:r/s:r*s<a*i?r/i:a/s}_isVisible(){const t=this.options.display;return"auto"!==t?!!t:this.getMatchingVisibleMetas().length>0}_computeGridLineItems(t){const e=this.axis,i=this.chart,s=this.options,{grid:n,position:a,border:r}=s,h=n.offset,c=this.isHorizontal(),d=this.ticks.length+(h?1:0),u=Js(n),f=[],g=r.setContext(this.getContext()),p=g.display?g.width:0,m=p/2,x=function(t){return Ae(i,t,p)};let b,_,y,v,M,w,k,S,P,D,C,O;if("top"===a)b=x(this.bottom),w=this.bottom-u,S=b-m,D=x(t.top)+m,O=t.bottom;else if("bottom"===a)b=x(this.top),D=t.top,O=x(t.bottom)-m,w=b+m,S=this.top+u;else if("left"===a)b=x(this.right),M=this.right-u,k=b-m,P=x(t.left)+m,C=t.right;else if("right"===a)b=x(this.left),P=t.left,C=x(t.right)-m,M=b+m,k=this.left+u;else if("x"===e){if("center"===a)b=x((t.top+t.bottom)/2+.5);else if(o(a)){const t=Object.keys(a)[0],e=a[t];b=x(this.chart.scales[t].getPixelForValue(e))}D=t.top,O=t.bottom,w=b+m,S=w+u}else if("y"===e){if("center"===a)b=x((t.left+t.right)/2);else if(o(a)){const t=Object.keys(a)[0],e=a[t];b=x(this.chart.scales[t].getPixelForValue(e))}M=b-m,k=M-u,P=t.left,C=t.right}const A=l(s.ticks.maxTicksLimit,d),T=Math.max(1,Math.ceil(d/A));for(_=0;_<d;_+=T){const t=this.getContext(_),e=n.setContext(t),s=r.setContext(t),o=e.lineWidth,a=e.color,l=s.dash||[],d=s.dashOffset,u=e.tickWidth,g=e.tickColor,p=e.tickBorderDash||[],m=e.tickBorderDashOffset;y=Gs(this,_,h),void 0!==y&&(v=Ae(i,y,o),c?M=k=P=C=v:w=S=D=O=v,f.push({tx1:M,ty1:w,tx2:k,ty2:S,x1:P,y1:D,x2:C,y2:O,width:o,color:a,borderDash:l,borderDashOffset:d,tickWidth:u,tickColor:g,tickBorderDash:p,tickBorderDashOffset:m}))}return this._ticksLength=d,this._borderValue=b,f}_computeLabelItems(t){const e=this.axis,i=this.options,{position:s,ticks:a}=i,r=this.isHorizontal(),l=this.ticks,{align:h,crossAlign:c,padding:d,mirror:u}=a,f=Js(i.grid),g=f+d,p=u?-d:g,m=-$(this.labelRotation),x=[];let b,_,y,v,M,w,k,S,P,D,C,O,A="middle";if("top"===s)w=this.bottom-p,k=this._getXAxisLabelAlignment();else if("bottom"===s)w=this.top+p,k=this._getXAxisLabelAlignment();else if("left"===s){const t=this._getYAxisLabelAlignment(f);k=t.textAlign,M=t.x}else if("right"===s){const t=this._getYAxisLabelAlignment(f);k=t.textAlign,M=t.x}else if("x"===e){if("center"===s)w=(t.top+t.bottom)/2+g;else if(o(s)){const t=Object.keys(s)[0],e=s[t];w=this.chart.scales[t].getPixelForValue(e)+g}k=this._getXAxisLabelAlignment()}else if("y"===e){if("center"===s)M=(t.left+t.right)/2-g;else if(o(s)){const t=Object.keys(s)[0],e=s[t];M=this.chart.scales[t].getPixelForValue(e)}k=this._getYAxisLabelAlignment(f).textAlign}"y"===e&&("start"===h?A="top":"end"===h&&(A="bottom"));const T=this._getLabelSizes();for(b=0,_=l.length;b<_;++b){y=l[b],v=y.label;const t=a.setContext(this.getContext(b));S=this.getPixelForTick(b)+a.labelOffset,P=this._resolveTickFontOptions(b),D=P.lineHeight,C=n(v)?v.length:1;const e=C/2,i=t.color,o=t.textStrokeColor,h=t.textStrokeWidth;let d,f=k;if(r?(M=S,"inner"===k&&(f=b===_-1?this.options.reverse?"left":"right":0===b?this.options.reverse?"right":"left":"center"),O="top"===s?"near"===c||0!==m?-C*D+D/2:"center"===c?-T.highest.height/2-e*D+D:-T.highest.height+D/2:"near"===c||0!==m?D/2:"center"===c?T.highest.height/2-e*D:T.highest.height-C*D,u&&(O*=-1),0===m||t.showLabelBackdrop||(M+=D/2*Math.sin(m))):(w=S,O=(1-C)*D/2),t.showLabelBackdrop){const e=ki(t.backdropPadding),i=T.heights[b],s=T.widths[b];let n=O-e.top,o=0-e.left;switch(A){case"middle":n-=i/2;break;case"bottom":n-=i}switch(k){case"center":o-=s/2;break;case"right":o-=s;break;case"inner":b===_-1?o-=s:b>0&&(o-=s/2)}d={left:o,top:n,width:s+e.width,height:i+e.height,color:t.backdropColor}}x.push({label:v,font:P,textOffset:O,options:{rotation:m,color:i,strokeColor:o,strokeWidth:h,textAlign:f,textBaseline:A,translation:[M,w],backdrop:d}})}return x}_getXAxisLabelAlignment(){const{position:t,ticks:e}=this.options;if(-$(this.labelRotation))return"top"===t?"left":"right";let i="center";return"start"===e.align?i="left":"end"===e.align?i="right":"inner"===e.align&&(i="inner"),i}_getYAxisLabelAlignment(t){const{position:e,ticks:{crossAlign:i,mirror:s,padding:n}}=this.options,o=t+n,a=this._getLabelSizes().widest.width;let r,l;return"left"===e?s?(l=this.right+n,"near"===i?r="left":"center"===i?(r="center",l+=a/2):(r="right",l+=a)):(l=this.right-o,"near"===i?r="right":"center"===i?(r="center",l-=a/2):(r="left",l=this.left)):"right"===e?s?(l=this.left+n,"near"===i?r="right":"center"===i?(r="center",l-=a/2):(r="left",l-=a)):(l=this.left+o,"near"===i?r="left":"center"===i?(r="center",l+=a/2):(r="right",l=this.right)):r="right",{textAlign:r,x:l}}_computeLabelArea(){if(this.options.ticks.mirror)return;const t=this.chart,e=this.options.position;return"left"===e||"right"===e?{top:0,left:this.left,bottom:t.height,right:this.right}:"top"===e||"bottom"===e?{top:this.top,left:0,bottom:this.bottom,right:t.width}:void 0}drawBackground(){const{ctx:t,options:{backgroundColor:e},left:i,top:s,width:n,height:o}=this;e&&(t.save(),t.fillStyle=e,t.fillRect(i,s,n,o),t.restore())}getLineWidthForValue(t){const e=this.options.grid;if(!this._isVisible()||!e.display)return 0;const i=this.ticks.findIndex((e=>e.value===t));if(i>=0){return e.setContext(this.getContext(i)).lineWidth}return 0}drawGrid(t){const e=this.options.grid,i=this.ctx,s=this._gridLineItems||(this._gridLineItems=this._computeGridLineItems(t));let n,o;const a=(t,e,s)=>{s.width&&s.color&&(i.save(),i.lineWidth=s.width,i.strokeStyle=s.color,i.setLineDash(s.borderDash||[]),i.lineDashOffset=s.borderDashOffset,i.beginPath(),i.moveTo(t.x,t.y),i.lineTo(e.x,e.y),i.stroke(),i.restore())};if(e.display)for(n=0,o=s.length;n<o;++n){const t=s[n];e.drawOnChartArea&&a({x:t.x1,y:t.y1},{x:t.x2,y:t.y2},t),e.drawTicks&&a({x:t.tx1,y:t.ty1},{x:t.tx2,y:t.ty2},{color:t.tickColor,width:t.tickWidth,borderDash:t.tickBorderDash,borderDashOffset:t.tickBorderDashOffset})}}drawBorder(){const{chart:t,ctx:e,options:{border:i,grid:s}}=this,n=i.setContext(this.getContext()),o=i.display?n.width:0;if(!o)return;const a=s.setContext(this.getContext(0)).lineWidth,r=this._borderValue;let l,h,c,d;this.isHorizontal()?(l=Ae(t,this.left,o)-o/2,h=Ae(t,this.right,a)+a/2,c=d=r):(c=Ae(t,this.top,o)-o/2,d=Ae(t,this.bottom,a)+a/2,l=h=r),e.save(),e.lineWidth=n.width,e.strokeStyle=n.color,e.beginPath(),e.moveTo(l,c),e.lineTo(h,d),e.stroke(),e.restore()}drawLabels(t){if(!this.options.ticks.display)return;const e=this.ctx,i=this._computeLabelArea();i&&Ie(e,i);const s=this.getLabelItems(t);for(const t of s){const i=t.options,s=t.font;Ne(e,t.label,0,t.textOffset,s,i)}i&&ze(e)}drawTitle(){const{ctx:t,options:{position:e,title:i,reverse:s}}=this;if(!i.display)return;const a=Si(i.font),r=ki(i.padding),l=i.align;let h=a.lineHeight/2;"bottom"===e||"center"===e||o(e)?(h+=r.bottom,n(i.text)&&(h+=a.lineHeight*(i.text.length-1))):h+=r.top;const{titleX:c,titleY:d,maxWidth:u,rotation:f}=function(t,e,i,s){const{top:n,left:a,bottom:r,right:l,chart:h}=t,{chartArea:c,scales:d}=h;let u,f,g,p=0;const m=r-n,x=l-a;if(t.isHorizontal()){if(f=ft(s,a,l),o(i)){const t=Object.keys(i)[0],s=i[t];g=d[t].getPixelForValue(s)+m-e}else g="center"===i?(c.bottom+c.top)/2+m-e:Xs(t,i,e);u=l-a}else{if(o(i)){const t=Object.keys(i)[0],s=i[t];f=d[t].getPixelForValue(s)-x+e}else f="center"===i?(c.left+c.right)/2-x+e:Xs(t,i,e);g=ft(s,r,n),p="left"===i?-E:E}return{titleX:f,titleY:g,maxWidth:u,rotation:p}}(this,h,e,l);Ne(t,i.text,0,0,a,{color:i.color,maxWidth:u,rotation:f,textAlign:Qs(l,e,s),textBaseline:"middle",translation:[c,d]})}draw(t){this._isVisible()&&(this.drawBackground(),this.drawGrid(t),this.drawBorder(),this.drawTitle(),this.drawLabels(t))}_layers(){const t=this.options,e=t.ticks&&t.ticks.z||0,i=l(t.grid&&t.grid.z,-1),s=l(t.border&&t.border.z,0);return this._isVisible()&&this.draw===tn.prototype.draw?[{z:i,draw:t=>{this.drawBackground(),this.drawGrid(t),this.drawTitle()}},{z:s,draw:()=>{this.drawBorder()}},{z:e,draw:t=>{this.drawLabels(t)}}]:[{z:e,draw:t=>{this.draw(t)}}]}getMatchingVisibleMetas(t){const e=this.chart.getSortedVisibleDatasetMetas(),i=this.axis+"AxisID",s=[];let n,o;for(n=0,o=e.length;n<o;++n){const o=e[n];o[i]!==this.id||t&&o.type!==t||s.push(o)}return s}_resolveTickFontOptions(t){return Si(this.options.ticks.setContext(this.getContext(t)).font)}_maxDigits(){const t=this._resolveTickFontOptions(0).lineHeight;return(this.isHorizontal()?this.width:this.height)/t}}class en{constructor(t,e,i){this.type=t,this.scope=e,this.override=i,this.items=Object.create(null)}isForType(t){return Object.prototype.isPrototypeOf.call(this.type.prototype,t.prototype)}register(t){const e=Object.getPrototypeOf(t);let i;(function(t){return"id"in t&&"defaults"in t})(e)&&(i=this.register(e));const s=this.items,n=t.id,o=this.scope+"."+n;if(!n)throw new Error("class does not have id: "+t);return n in s||(s[n]=t,function(t,e,i){const s=x(Object.create(null),[i?ue.get(i):{},ue.get(e),t.defaults]);ue.set(e,s),t.defaultRoutes&&function(t,e){Object.keys(e).forEach((i=>{const s=i.split("."),n=s.pop(),o=[t].concat(s).join("."),a=e[i].split("."),r=a.pop(),l=a.join(".");ue.route(o,n,l,r)}))}(e,t.defaultRoutes);t.descriptors&&ue.describe(e,t.descriptors)}(t,o,i),this.override&&ue.override(t.id,t.overrides)),o}get(t){return this.items[t]}unregister(t){const e=this.items,i=t.id,s=this.scope;i in e&&delete e[i],s&&i in ue[s]&&(delete ue[s][i],this.override&&delete re[i])}}class sn{constructor(){this.controllers=new en(js,"datasets",!0),this.elements=new en($s,"elements"),this.plugins=new en(Object,"plugins"),this.scales=new en(tn,"scales"),this._typedRegistries=[this.controllers,this.scales,this.elements]}add(...t){this._each("register",t)}remove(...t){this._each("unregister",t)}addControllers(...t){this._each("register",t,this.controllers)}addElements(...t){this._each("register",t,this.elements)}addPlugins(...t){this._each("register",t,this.plugins)}addScales(...t){this._each("register",t,this.scales)}getController(t){return this._get(t,this.controllers,"controller")}getElement(t){return this._get(t,this.elements,"element")}getPlugin(t){return this._get(t,this.plugins,"plugin")}getScale(t){return this._get(t,this.scales,"scale")}removeControllers(...t){this._each("unregister",t,this.controllers)}removeElements(...t){this._each("unregister",t,this.elements)}removePlugins(...t){this._each("unregister",t,this.plugins)}removeScales(...t){this._each("unregister",t,this.scales)}_each(t,e,i){[...e].forEach((e=>{const s=i||this._getRegistryForType(e);i||s.isForType(e)||s===this.plugins&&e.id?this._exec(t,s,e):u(e,(e=>{const s=i||this._getRegistryForType(e);this._exec(t,s,e)}))}))}_exec(t,e,i){const s=w(t);d(i["before"+s],[],i),e[t](i),d(i["after"+s],[],i)}_getRegistryForType(t){for(let e=0;e<this._typedRegistries.length;e++){const i=this._typedRegistries[e];if(i.isForType(t))return i}return this.plugins}_get(t,e,i){const s=e.get(t);if(void 0===s)throw new Error('"'+t+'" is not a registered '+i+".");return s}}var nn=new sn;class on{constructor(){this._init=
vendor: 3,433 bytes, line 34128
34128[]}notify(t,e,i,s){"beforeInit"===e&&(this._init=this._createDescriptors(t,!0),this._notify(this._init,t,"install"));const n=s?this._descriptors(t).filter(s):this._descriptors(t),o=this._notify(n,t,e,i);return"afterDestroy"===e&&(this._notify(n,t,"stop"),this._notify(this._init,t,"uninstall")),o}_notify(t,e,i,s){s=s||{};for(const n of t){const t=n.plugin;if(!1===d(t[i],[e,s,n.options],t)&&s.cancelable)return!1}return!0}invalidate(){s(this._cache)||(this._oldCache=this._cache,this._cache=void 0)}_descriptors(t){if(this._cache)return this._cache;const e=this._cache=this._createDescriptors(t);return this._notifyStateChanges(t),e}_createDescriptors(t,e){const i=t&&t.config,s=l(i.options&&i.options.plugins,{}),n=function(t){const e={},i=[],s=Object.keys(nn.plugins.items);for(let t=0;t<s.length;t++)i.push(nn.getPlugin(s[t]));const n=t.plugins||[];for(let t=0;t<n.length;t++){const s=n[t];-1===i.indexOf(s)&&(i.push(s),e[s.id]=!0)}return{plugins:i,localIds:e}}(i);return!1!==s||e?function(t,{plugins:e,localIds:i},s,n){const o=[],a=t.getContext();for(const r of e){const e=r.id,l=an(s[e],n);null!==l&&o.push({plugin:r,options:rn(t.config,{plugin:r,local:i[e]},l,a)})}return o}(t,n,s,e):[]}_notifyStateChanges(t){const e=this._oldCache||[],i=this._cache,s=(t,e)=>t.filter((t=>!e.some((e=>t.plugin.id===e.plugin.id))));this._notify(s(e,i),t,"stop"),this._notify(s(i,e),t,"start")}}function an(t,e){return e||!1!==t?!0===t?{}:t:null}function rn(t,{plugin:e,local:i},s,n){const o=t.pluginScopeKeys(e),a=t.getOptionScopes(s,o);return i&&e.defaults&&a.push(e.defaults),t.createResolver(a,n,[""],{scriptable:!1,indexable:!1,allKeys:!0})}function ln(t,e){const i=ue.datasets[t]||{};return((e.datasets||{})[t]||{}).indexAxis||e.indexAxis||i.indexAxis||"x"}function hn(t){if("x"===t||"y"===t||"r"===t)return t}function cn(t,...e){if(hn(t))return t;for(const s of e){const e=s.axis||("top"===(i=s.position)||"bottom"===i?"x":"left"===i||"right"===i?"y":void 0)||t.length>1&&hn(t[0].toLowerCase());if(e)return e}var i;throw new Error(`Cannot determine type of '${t}' axis. Please provide 'axis' or 'position' option.`)}function dn(t,e,i){if(i[e+"AxisID"]===t)return{axis:e}}function un(t,e){const i=re[t.type]||{scales:{}},s=e.scales||{},n=ln(t.type,e),a=Object.create(null);return Object.keys(s).forEach((e=>{const r=s[e];if(!o(r))return console.error(`Invalid scale configuration for scale: ${e}`);if(r._proxy)return console.warn(`Ignoring resolver passed as options for scale: ${e}`);const l=cn(e,r,function(t,e){if(e.data&&e.data.datasets){const i=e.data.datasets.filter((e=>e.xAxisID===t||e.yAxisID===t));if(i.length)return dn(t,"x",i[0])||dn(t,"y",i[0])}return{}}(e,t),ue.scales[r.type]),h=function(t,e){return t===e?"_index_":"_value_"}(l,n),c=i.scales||{};a[e]=b(Object.create(null),[{axis:l},r,c[l],c[h]])})),t.data.datasets.forEach((i=>{const n=i.type||t.type,o=i.indexAxis||ln(n,e),r=(re[n]||{}).scales||{};Object.keys(r).forEach((t=>{const e=function(t,e){let i=t;return"_index_"===t?i=e:"_value_"===t&&(i="x"===e?"y":"x"),i}(t,o),n=i[e+"AxisID"]||e;a[n]=a[n]||Object.create(null),b(a[n],[{axis:e},s[n],r[t]])}))})),Object.keys(a).forEach((t=>{const e=a[t];b(e,[ue.scales[e.type],ue.scale])})),a}function fn(t){const e=t.options||(t.options={});e.plugins=l(e.plugins,{}),e.scales=un(t,e)}function gn(t){return(t=t||{}).datasets=t.datasets||[],t.labels=t.labels||[],t}const pn=new Map,mn=new Set;function xn(t,e){let i=pn.get(t);
vendor: 3,327 bytes, line 34128
34128return i||(i=e(),pn.set(t,i),mn.add(i)),i}const bn=(t,e,i)=>{const s=M(e,i);void 0!==s&&t.add(s)};class _n{constructor(t){this._config=function(t){return(t=t||{}).data=gn(t.data),fn(t),t}(t),this._scopeCache=new Map,this._resolverCache=new Map}get platform(){return this._config.platform}get type(){return this._config.type}set type(t){this._config.type=t}get data(){return this._config.data}set data(t){this._config.data=gn(t)}get options(){return this._config.options}set options(t){this._config.options=t}get plugins(){return this._config.plugins}update(){const t=this._config;this.clearCache(),fn(t)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(t){return xn(t,(()=>[[`datasets.${t}`,""]]))}datasetAnimationScopeKeys(t,e){return xn(`${t}.transition.${e}`,(()=>[[`datasets.${t}.transitions.${e}`,`transitions.${e}`],[`datasets.${t}`,""]]))}datasetElementScopeKeys(t,e){return xn(`${t}-${e}`,(()=>[[`datasets.${t}.elements.${e}`,`datasets.${t}`,`elements.${e}`,""]]))}pluginScopeKeys(t){const e=t.id;return xn(`${this.type}-plugin-${e}`,(()=>[[`plugins.${e}`,...t.additionalOptionScopes||[]]]))}_cachedScopes(t,e){const i=this._scopeCache;let s=i.get(t);return s&&!e||(s=new Map,i.set(t,s)),s}getOptionScopes(t,e,i){const{options:s,type:n}=this,o=this._cachedScopes(t,i),a=o.get(e);if(a)return a;const r=new Set;e.forEach((e=>{t&&(r.add(t),e.forEach((e=>bn(r,t,e)))),e.forEach((t=>bn(r,s,t))),e.forEach((t=>bn(r,re[n]||{},t))),e.forEach((t=>bn(r,ue,t))),e.forEach((t=>bn(r,le,t)))}));const l=Array.from(r);return 0===l.length&&l.push(Object.create(null)),mn.has(e)&&o.set(e,l),l}chartOptionScopes(){const{options:t,type:e}=this;return[t,re[e]||{},ue.datasets[e]||{},{type:e},ue,le]}resolveNamedOptions(t,e,i,s=[""]){const o={$shared:!0},{resolver:a,subPrefixes:r}=yn(this._resolverCache,t,s);let l=a;if(function(t,e){const{isScriptable:i,isIndexable:s}=Ye(t);for(const o of e){const e=i(o),a=s(o),r=(a||e)&&t[o];if(e&&(S(r)||vn(r))||a&&n(r))return!0}return!1}(a,e)){o.$shared=!1;l=$e(a,i=S(i)?i():i,this.createResolver(t,i,r))}for(const t of e)o[t]=l[t];return o}createResolver(t,e,i=[""],s){const{resolver:n}=yn(this._resolverCache,t,i);return o(e)?$e(n,e,void 0,s):n}}function yn(t,e,i){let s=t.get(e);s||(s=new Map,t.set(e,s));const n=i.join();let o=s.get(n);if(!o){o={resolver:je(e,i),subPrefixes:i.filter((t=>!t.toLowerCase().includes("hover")))},s.set(n,o)}return o}const vn=t=>o(t)&&Object.getOwnPropertyNames(t).some((e=>S(t[e])));const Mn=["top","bottom","left","right","chartArea"];function wn(t,e){return"top"===t||"bottom"===t||-1===Mn.indexOf(t)&&"x"===e}function kn(t,e){return function(i,s){return i[t]===s[t]?i[e]-s[e]:i[t]-s[t]}}function Sn(t){const e=t.chart,i=e.options.animation;e.notifyPlugins("afterRender"),d(i&&i.onComplete,[t],e)}function Pn(t){const e=t.chart,i=e.options.animation;d(i&&i.onProgress,[t],e)}function Dn(t){return fe()&&"string"==typeof t?t=document.getElementById(t):t&&t.length&&(t=t[0]),t&&t.canvas&&(t=t.canvas),t}const Cn={},On=t=>{const e=Dn(t);return Object.values(Cn).filter((t=>t.canvas===e)).pop()};function An(t,e,i){const s=Object.keys(t);for(const n of s){const s=+n;if(s>=e){const o=t[n];delete t[n],(i>0||s>e)&&(t[s+i]=o)}}}class Tn{static defaults=ue;static instances=Cn;static overrides=re;static registry=nn;static version="4.5.0
vendor: 16,156 bytes, line 34128
34128";static getChart=On;static register(...t){nn.add(...t),Ln()}static unregister(...t){nn.remove(...t),Ln()}constructor(t,e){const s=this.config=new _n(e),n=Dn(t),o=On(n);if(o)throw new Error("Canvas is already in use. Chart with ID '"+o.id+"' must be destroyed before the canvas with ID '"+o.canvas.id+"' can be reused.");const a=s.createResolver(s.chartOptionScopes(),this.getContext());this.platform=new(s.platform||Ps(n)),this.platform.updateConfig(s);const r=this.platform.acquireContext(n,a.aspectRatio),l=r&&r.canvas,h=l&&l.height,c=l&&l.width;this.id=i(),this.ctx=r,this.canvas=l,this.width=c,this.height=h,this._options=a,this._aspectRatio=this.aspectRatio,this._layers=[],this._metasets=[],this._stacks=void 0,this.boxes=[],this.currentDevicePixelRatio=void 0,this.chartArea=void 0,this._active=[],this._lastEvent=void 0,this._listeners={},this._responsiveListeners=void 0,this._sortedMetasets=[],this.scales={},this._plugins=new on,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=dt((t=>this.update(t)),a.resizeDelay||0),this._dataChanges=[],Cn[this.id]=this,r&&l?(bt.listen(this,"complete",Sn),bt.listen(this,"progress",Pn),this._initialize(),this.attached&&this.update()):console.error("Failed to create chart: can't acquire context from the given item")}get aspectRatio(){const{options:{aspectRatio:t,maintainAspectRatio:e},width:i,height:n,_aspectRatio:o}=this;return s(t)?e&&o?o:n?i/n:null:t}get data(){return this.config.data}set data(t){this.config.data=t}get options(){return this._options}set options(t){this.config.options=t}get registry(){return nn}_initialize(){return this.notifyPlugins("beforeInit"),this.options.responsive?this.resize():ke(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return Te(this.canvas,this.ctx),this}stop(){return bt.stop(this),this}resize(t,e){bt.running(this)?this._resizeBeforeDraw={width:t,height:e}:this._resize(t,e)}_resize(t,e){const i=this.options,s=this.canvas,n=i.maintainAspectRatio&&this.aspectRatio,o=this.platform.getMaximumSize(s,t,e,n),a=i.devicePixelRatio||this.platform.getDevicePixelRatio(),r=this.width?"resize":"attach";this.width=o.width,this.height=o.height,this._aspectRatio=this.aspectRatio,ke(this,a,!0)&&(this.notifyPlugins("resize",{size:o}),d(i.onResize,[this,o],this),this.attached&&this._doResize(r)&&this.render())}ensureScalesHaveIDs(){u(this.options.scales||{},((t,e)=>{t.id=e}))}buildOrUpdateScales(){const t=this.options,e=t.scales,i=this.scales,s=Object.keys(i).reduce(((t,e)=>(t[e]=!1,t)),{});let n=[];e&&(n=n.concat(Object.keys(e).map((t=>{const i=e[t],s=cn(t,i),n="r"===s,o="x"===s;return{options:i,dposition:n?"chartArea":o?"bottom":"left",dtype:n?"radialLinear":o?"category":"linear"}})))),u(n,(e=>{const n=e.options,o=n.id,a=cn(o,n),r=l(n.type,e.dtype);void 0!==n.position&&wn(n.position,a)===wn(e.dposition)||(n.position=e.dposition),s[o]=!0;let h=null;if(o in i&&i[o].type===r)h=i[o];else{h=new(nn.getScale(r))({id:o,type:r,ctx:this.ctx,chart:this}),i[h.id]=h}h.init(n,t)})),u(s,((t,e)=>{t||delete i[e]})),u(i,(t=>{ls.configure(this,t,t.options),ls.addBox(this,t)}))}_updateMetasets(){const t=this._metasets,e=this.data.datasets.length,i=t.length;if(t.sort(((t,e)=>t.index-e.index)),i>e){for(let t=e;t<i;++t)this._destroyDatasetMeta(t);t.splice(e,i-e)}this._sortedMetasets=t.slice(0).sort(kn("order","index"))}_removeUnreferencedMetasets(){const{_metasets:t,data:{datasets:e}}=this;t.length>e.length&&delete this._stacks,t.forEach(((t,i)=>{0===e.filter((e=>e===t._dataset)).length&&this._destroyDatasetMeta(i)}))}buildOrUpdateControllers(){const t=[],e=this.data.datasets;let i,s;for(this._removeUnreferencedMetasets(),i=0,s=e.length;i<s;i++){const s=e[i];let n=this.getDatasetMeta(i);const o=s.type||this.config.type;if(n.type&&n.type!==o&&(this._destroyDatasetMeta(i),n=this.getDatasetMeta(i)),n.type=o,n.indexAxis=s.indexAxis||ln(o,this.options),n.order=s.order||0,n.index=i,n.label=""+s.label,n.visible=this.isDatasetVisible(i),n.controller)n.controller.updateIndex(i),n.controller.linkScales();else{const e=nn.getController(o),{datasetElementType:s,dataElementType:a}=ue.datasets[o];Object.assign(e,{dataElementType:nn.getElement(a),datasetElementType:s&&nn.getElement(s)}),n.controller=new e(this,i),t.push(n.controller)}}return this._updateMetasets(),t}_resetElements(){u(this.data.datasets,((t,e)=>{this.getDatasetMeta(e).controller.reset()}),this)}reset(){this._resetElements(),this.notifyPlugins("reset")}update(t){const e=this.config;e.update();const i=this._options=e.createResolver(e.chartOptionScopes(),this.getContext()),s=this._animationsDisabled=!i.animation;if(this._updateScales(),this._checkEventBindings(),this._updateHiddenIndices(),this._plugins.invalidate(),!1===this.notifyPlugins("beforeUpdate",{mode:t,cancelable:!0}))return;const n=this.buildOrUpdateControllers();this.notifyPlugins("beforeElementsUpdate");let o=0;for(let t=0,e=this.data.datasets.length;t<e;t++){const{controller:e}=this.getDatasetMeta(t),i=!s&&-1===n.indexOf(e);e.buildOrUpdateElements(i),o=Math.max(+e.getMaxOverflow(),o)}o=this._minPadding=i.layout.autoPadding?o:0,this._updateLayout(o),s||u(n,(t=>{t.reset()})),this._updateDatasets(t),this.notifyPlugins("afterUpdate",{mode:t}),this._layers.sort(kn("z","_idx"));const{_active:a,_lastEvent:r}=this;r?this._eventHandler(r,!0):a.length&&this._updateHoverStyles(a,a,!0),this.render()}_updateScales(){u(this.scales,(t=>{ls.removeBox(this,t)})),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){const t=this.options,e=new Set(Object.keys(this._listeners)),i=new Set(t.events);P(e,i)&&!!this._responsiveListeners===t.responsive||(this.unbindEvents(),this.bindEvents())}_updateHiddenIndices(){const{_hiddenIndices:t}=this,e=this._getUniformDataChanges()||[];for(const{method:i,start:s,count:n}of e){An(t,s,"_removeElements"===i?-n:n)}}_getUniformDataChanges(){const t=this._dataChanges;if(!t||!t.length)return;this._dataChanges=[];const e=this.data.datasets.length,i=e=>new Set(t.filter((t=>t[0]===e)).map(((t,e)=>e+","+t.splice(1).join(",")))),s=i(0);for(let t=1;t<e;t++)if(!P(s,i(t)))return;return Array.from(s).map((t=>t.split(","))).map((t=>({method:t[1],start:+t[2],count:+t[3]})))}_updateLayout(t){if(!1===this.notifyPlugins("beforeLayout",{cancelable:!0}))return;ls.update(this,this.width,this.height,t);const e=this.chartArea,i=e.width<=0||e.height<=0;this._layers=[],u(this.boxes,(t=>{i&&"chartArea"===t.position||(t.configure&&t.configure(),this._layers.push(...t._layers()))}),this),this._layers.forEach(((t,e)=>{t._idx=e})),this.notifyPlugins("afterLayout")}_updateDatasets(t){if(!1!==this.notifyPlugins("beforeDatasetsUpdate",{mode:t,cancelable:!0})){for(let t=0,e=this.data.datasets.length;t<e;++t)this.getDatasetMeta(t).controller.configure();for(let e=0,i=this.data.datasets.length;e<i;++e)this._updateDataset(e,S(t)?t({datasetIndex:e}):t);this.notifyPlugins("afterDatasetsUpdate",{mode:t})}}_updateDataset(t,e){const i=this.getDatasetMeta(t),s={meta:i,index:t,mode:e,cancelable:!0};!1!==this.notifyPlugins("beforeDatasetUpdate",s)&&(i.controller._update(e),s.cancelable=!1,this.notifyPlugins("afterDatasetUpdate",s))}render(){!1!==this.notifyPlugins("beforeRender",{cancelable:!0})&&(bt.has(this)?this.attached&&!bt.running(this)&&bt.start(this):(this.draw(),Sn({chart:this})))}draw(){let t;if(this._resizeBeforeDraw){const{width:t,height:e}=this._resizeBeforeDraw;this._resizeBeforeDraw=null,this._resize(t,e)}if(this.clear(),this.width<=0||this.height<=0)return;if(!1===this.notifyPlugins("beforeDraw",{cancelable:!0}))return;const e=this._layers;for(t=0;t<e.length&&e[t].z<=0;++t)e[t].draw(this.chartArea);for(this._drawDatasets();t<e.length;++t)e[t].draw(this.chartArea);this.notifyPlugins("afterDraw")}_getSortedDatasetMetas(t){const e=this._sortedMetasets,i=[];let s,n;for(s=0,n=e.length;s<n;++s){const n=e[s];t&&!n.visible||i.push(n)}return i}getSortedVisibleDatasetMetas(){return this._getSortedDatasetMetas(!0)}_drawDatasets(){if(!1===this.notifyPlugins("beforeDatasetsDraw",{cancelable:!0}))return;const t=this.getSortedVisibleDatasetMetas();for(let e=t.length-1;e>=0;--e)this._drawDataset(t[e]);this.notifyPlugins("afterDatasetsDraw")}_drawDataset(t){const e=this.ctx,i={meta:t,index:t.index,cancelable:!0},s=Ni(this,t);!1!==this.notifyPlugins("beforeDatasetDraw",i)&&(s&&Ie(e,s),t.controller.draw(),s&&ze(e),i.cancelable=!1,this.notifyPlugins("afterDatasetDraw",i))}isPointInArea(t){return Re(t,this.chartArea,this._minPadding)}getElementsAtEventForMode(t,e,i,s){const n=Ki.modes[e];return"function"==typeof n?n(this,t,i,s):[]}getDatasetMeta(t){const e=this.data.datasets[t],i=this._metasets;let s=i.filter((t=>t&&t._dataset===e)).pop();return s||(s={type:null,data:[],dataset:null,controller:null,hidden:null,xAxisID:null,yAxisID:null,order:e&&e.order||0,index:t,_dataset:e,_parsed:[],_sorted:!1},i.push(s)),s}getContext(){return this.$context||(this.$context=Ci(null,{chart:this,type:"chart"}))}getVisibleDatasetCount(){return this.getSortedVisibleDatasetMetas().length}isDatasetVisible(t){const e=this.data.datasets[t];if(!e)return!1;const i=this.getDatasetMeta(t);return"boolean"==typeof i.hidden?!i.hidden:!e.hidden}setDatasetVisibility(t,e){this.getDatasetMeta(t).hidden=!e}toggleDataVisibility(t){this._hiddenIndices[t]=!this._hiddenIndices[t]}getDataVisibility(t){return!this._hiddenIndices[t]}_updateVisibility(t,e,i){const s=i?"show":"hide",n=this.getDatasetMeta(t),o=n.controller._resolveAnimations(void 0,s);k(e)?(n.data[e].hidden=!i,this.update()):(this.setDatasetVisibility(t,i),o.update(n,{visible:i}),this.update((e=>e.datasetIndex===t?s:void 0)))}hide(t,e){this._updateVisibility(t,e,!1)}show(t,e){this._updateVisibility(t,e,!0)}_destroyDatasetMeta(t){const e=this._metasets[t];e&&e.controller&&e.controller._destroy(),delete this._metasets[t]}_stop(){let t,e;for(this.stop(),bt.remove(this),t=0,e=this.data.datasets.length;t<e;++t)this._destroyDatasetMeta(t)}destroy(){this.notifyPlugins("beforeDestroy");const{canvas:t,ctx:e}=this;this._stop(),this.config.clearCache(),t&&(this.unbindEvents(),Te(t,e),this.platform.releaseContext(e),this.canvas=null,this.ctx=null),delete Cn[this.id],this.notifyPlugins("afterDestroy")}toBase64Image(...t){return this.canvas.toDataURL(...t)}bindEvents(){this.bindUserEvents(),this.options.responsive?this.bindResponsiveEvents():this.attached=!0}bindUserEvents(){const t=this._listeners,e=this.platform,i=(i,s)=>{e.addEventListener(this,i,s),t[i]=s},s=(t,e,i)=>{t.offsetX=e,t.offsetY=i,this._eventHandler(t)};u(this.options.events,(t=>i(t,s)))}bindResponsiveEvents(){this._responsiveListeners||(this._responsiveListeners={});const t=this._responsiveListeners,e=this.platform,i=(i,s)=>{e.addEventListener(this,i,s),t[i]=s},s=(i,s)=>{t[i]&&(e.removeEventListener(this,i,s),delete t[i])},n=(t,e)=>{this.canvas&&this.resize(t,e)};let o;const a=()=>{s("attach",a),this.attached=!0,this.resize(),i("resize",n),i("detach",o)};o=()=>{this.attached=!1,s("resize",n),this._stop(),this._resize(0,0),i("attach",a)},e.isAttached(this.canvas)?a():o()}unbindEvents(){u(this._listeners,((t,e)=>{this.platform.removeEventListener(this,e,t)})),this._listeners={},u(this._responsiveListeners,((t,e)=>{this.platform.removeEventListener(this,e,t)})),this._responsiveListeners=void 0}updateHoverStyle(t,e,i){const s=i?"set":"remove";let n,o,a,r;for("dataset"===e&&(n=this.getDatasetMeta(t[0].datasetIndex),n.controller["_"+s+"DatasetHoverStyle"]()),a=0,r=t.length;a<r;++a){o=t[a];const e=o&&this.getDatasetMeta(o.datasetIndex).controller;e&&e[s+"HoverStyle"](o.element,o.datasetIndex,o.index)}}getActiveElements(){return this._active||[]}setActiveElements(t){const e=this._active||[],i=t.map((({datasetIndex:t,index:e})=>{const i=this.getDatasetMeta(t);if(!i)throw new Error("No dataset found at index "+t);return{datasetIndex:t,element:i.data[e],index:e}}));!f(i,e)&&(this._active=i,this._lastEvent=null,this._updateHoverStyles(i,e))}notifyPlugins(t,e,i){return this._plugins.notify(this,t,e,i)}isPluginEnabled(t){return 1===this._plugins._cache.filter((e=>e.plugin.id===t)).length}_updateHoverStyles(t,e,i){const s=this.options.hover,n=(t,e)=>t.filter((t=>!e.some((e=>t.datasetIndex===e.datasetIndex&&t.index===e.index)))),o=n(e,t),a=i?t:n(t,e);o.length&&this.updateHoverStyle(o,s.mode,!1),a.length&&s.mode&&this.updateHoverStyle(a,s.mode,!0)}_eventHandler(t,e){const i={event:t,replay:e,cancelable:!0,inChartArea:this.isPointInArea(t)},s=e=>(e.options.events||this.options.events).includes(t.native.type);if(!1===this.notifyPlugins("beforeEvent",i,s))return;const n=this._handleEvent(t,e,i.inChartArea);return i.cancelable=!1,this.notifyPlugins("afterEvent",i,s),(n||i.changed)&&this.render(),this}_handleEvent(t,e,i){const{_active:s=[],options:n}=this,o=e,a=this._getActiveElements(t,s,i,o),r=D(t),l=function(t,e,i,s){return i&&"mouseout"!==t.type?s?e:t:null}(t,this._lastEvent,i,r);i&&(this._lastEvent=null,d(n.onHover,[t,a,this],this),r&&d(n.onClick,[t,a,this],this));const h=!f(a,s);return(h||e)&&(this._active=a,this._updateHoverStyles(a,s,e)),this._lastEvent=l,h}_getActiveElements(t,e,i,s){if("mouseout"===t.type)return[];if(!i)return e;const n=this.options.hover;return this.getElementsAtEventForMode(t,n.mode,n,s)}}function Ln(){return u(Tn.instances,(t=>t._plugins.invalidate()))}function En(){throw new Error("This method is not implemented: Check that a complete date adapter is provided.")}class Rn{static override(t){Object.assign(Rn.prototype,t)}options;constructor(t){this.options=t||{}}init(){}formats(){return En()}parse(){return En()}format(){return En()}add(){return En()}diff(){return En()}startOf(){return En()}endOf(){return En()}}var In={_date:Rn};function zn(t){const e=t.iScale,i=function(t,e){if(!t._cache.$bar){const i=t.getMatchingVisibleMetas(e);let s=[];for(let e=0,n=i.length;e<n;e++)s=s.concat(i[e].controller.getAllParsedValues(t));t._cache.$bar=lt(s.sort(((t,e)=>t-e)))}return t._cache.$bar}(e,t.type);let s,n,o,a,r=e._length;const l=()=>{32767!==o&&-32768!==o&&(k(a)&&(r=Math.min(r,Math.abs(o-a)||r)),a=o)};for(s=0,n=i.length;s<n;++s)o=e.getPixelForValue(i[s]),l();for(a=void 0,s=0,n=e.ticks.length;s<n;++s)o=e.getPixelForTick(s),l();return r}function Fn(t,e,i,s){return n(t)?function(t,e,i,s){const n=i.parse(t[0],s),o=i.parse(t[1],s),a=Math.min(n,o),r=Math.max(n,o);let l=a,h=r;Math.abs(a)>Math.abs(r)&&(l=r,h=a),e[i.axis]=h,e._custom={barStart:l,barEnd:h,start:n,end:o,min:a,max:r}}(t,e,i,s):e[i.axis]=i.parse(t,s),e}function Vn(t,e,i,s){const n=t.iScale,o=t.vScale,a=n.getLabels(),r=n===o,l=[];let h,c,d,u;for(h=i,c=i+s;h<c;++h)u=e[h],d={},d[n.axis]=r||n.parse(a[h],h),l.push(Fn(u,d,o,h));return l}function Bn(t){return t&&void 0!==t.barStart&&void 0!==t.barEnd}function Wn(t,e,i,s){let n=e.borderSkipped;const o={};if(!n)return void(t.borderSkipped=o);if(!0===n)return void(t.borderSkipped={top:!0,right:!0,bottom:!0,left:!0});const{start:a,end:r,reverse:l,top:h,bottom:c}=function(t){let e,i,s,n,o;return t.horizontal?(e=t.base>t.x,i="left",s="right"):(e=t.base<t.y,i="bottom",s="top"),e?(n="end",o="start"):(n="start",o="end"),{start:i,end:s,reverse:e,top:n,bottom:o}}(t);"middle"===n&&i&&(t.enableBorderRadius=!0,(i._top||0)===s?n=h:(i._bottom||0)===s?n=c:(o[Nn(c,a,r,l)]=!0,n=h)),o[Nn(n,a,r,l)]=!0,t.borderSkipped=o}function Nn(t,e,i,s){var n,o,a;return s?(a=i,t=Hn(t=(n=t)===(o=e)?a:n===a?o:n,i,e)):t=Hn(t,e,i),t}function Hn(t,e,i){return"start"===t?e:"end"===t?i:t}function jn(t,{inflateAmount:e},i){t.inflateAmount="auto"===e?1===i?.33:0:e}class $n extends js{static id="doughnut";static defaults={datasetElementType:!1,dataElementType:"arc",animation:{animateRotate:!0,animateScale:!1},animations:{numbers:{type:"number",properties:["circumference","endAngle","innerRadius","outerRadius","startAngle","x","y","offset","borderWidth","spacing"]}},cutout:"50%",rotation:0,circumference:360,radius:"100%",spacing:0,indexAxis:"r"};static descriptors={_scriptable:t=>"spacing"!==t,_indexable:t=>"spacing"!==t&&!t.startsWith("borderDash")&&!t.startsWith("hoverBorderDash")};static overrides={aspectRatio:1,plugins:{legend:{labels:{generateLabels(t){const e=t.data
34128;if(e.labels.length&&e.datasets.length){const{labels:{pointStyle:i,color:s}}=t.legend.options;return e.labels.map(((e,n)=>{const o=t.getDatasetMeta(0).controller.getStyle(n);return{text:e,fillStyle:o.backgroundColor,strokeStyle:o.borderColor,fontColor:s,lineWidth:o.borderWidth,pointStyle:i,hidden:!t.getDataVisibility(n),index:n}}))}return
vendor: 92,844 bytes, lines 34128-34129
34128[]}},onClick(t,e,i){i.chart.toggleDataVisibility(e.index),i.chart.update()}}}};constructor(t,e){super(t,e),this.enableOptionSharing=!0,this.innerRadius=void 0,this.outerRadius=void 0,this.offsetX=void 0,this.offsetY=void 0}linkScales(){}parse(t,e){const i=this.getDataset().data,s=this._cachedMeta;if(!1===this._parsing)s._parsed=i;else{let n,a,r=t=>+i[t];if(o(i[t])){const{key:t="value"}=this._parsing;r=e=>+M(i[e],t)}for(n=t,a=t+e;n<a;++n)s._parsed[n]=r(n)}}_getRotation(){return $(this.options.rotation-90)}_getCircumference(){return $(this.options.circumference)}_getRotationExtents(){let t=O,e=-O;for(let i=0;i<this.chart.data.datasets.length;++i)if(this.chart.isDatasetVisible(i)&&this.chart.getDatasetMeta(i).type===this._type){const s=this.chart.getDatasetMeta(i).controller,n=s._getRotation(),o=s._getCircumference();t=Math.min(t,n),e=Math.max(e,n+o)}return{rotation:t,circumference:e-t}}update(t){const e=this.chart,{chartArea:i}=e,s=this._cachedMeta,n=s.data,o=this.getMaxBorderWidth()+this.getMaxOffset(n)+this.options.spacing,a=Math.max((Math.min(i.width,i.height)-o)/2,0),r=Math.min(h(this.options.cutout,a),1),l=this._getRingWeight(this.index),{circumference:d,rotation:u}=this._getRotationExtents(),{ratioX:f,ratioY:g,offsetX:p,offsetY:m}=function(t,e,i){let s=1,n=1,o=0,a=0;if(e<O){const r=t,l=r+e,h=Math.cos(r),c=Math.sin(r),d=Math.cos(l),u=Math.sin(l),f=(t,e,s)=>J(t,r,l,!0)?1:Math.max(e,e*i,s,s*i),g=(t,e,s)=>J(t,r,l,!0)?-1:Math.min(e,e*i,s,s*i),p=f(0,h,d),m=f(E,c,u),x=g(C,h,d),b=g(C+E,c,u);s=(p-x)/2,n=(m-b)/2,o=-(p+x)/2,a=-(m+b)/2}return{ratioX:s,ratioY:n,offsetX:o,offsetY:a}}(u,d,r),x=(i.width-o)/f,b=(i.height-o)/g,_=Math.max(Math.min(x,b)/2,0),y=c(this.options.radius,_),v=(y-Math.max(y*r,0))/this._getVisibleDatasetWeightTotal();this.offsetX=p*y,this.offsetY=m*y,s.total=this.calculateTotal(),this.outerRadius=y-v*this._getRingWeightOffset(this.index),this.innerRadius=Math.max(this.outerRadius-v*l,0),this.updateElements(n,0,n.length,t)}_circumference(t,e){const i=this.options,s=this._cachedMeta,n=this._getCircumference();return e&&i.animation.animateRotate||!this.chart.getDataVisibility(t)||null===s._parsed[t]||s.data[t].hidden?0:this.calculateCircumference(s._parsed[t]*n/O)}updateElements(t,e,i,s){const n="reset"===s,o=this.chart,a=o.chartArea,r=o.options.animation,l=(a.left+a.right)/2,h=(a.top+a.bottom)/2,c=n&&r.animateScale,d=c?0:this.innerRadius,u=c?0:this.outerRadius,{sharedOptions:f,includeOptions:g}=this._getSharedOptions(e,s);let p,m=this._getRotation();for(p=0;p<e;++p)m+=this._circumference(p,n);for(p=e;p<e+i;++p){const e=this._circumference(p,n),i=t[p],o={x:l+this.offsetX,y:h+this.offsetY,startAngle:m,endAngle:m+e,circumference:e,outerRadius:u,innerRadius:d};g&&(o.options=f||this.resolveDataElementOptions(p,i.active?"active":s)),m+=e,this.updateElement(i,p,o,s)}}calculateTotal(){const t=this._cachedMeta,e=t.data;let i,s=0;for(i=0;i<e.length;i++){const n=t._parsed[i];null===n||isNaN(n)||!this.chart.getDataVisibility(i)||e[i].hidden||(s+=Math.abs(n))}return s}calculateCircumference(t){const e=this._cachedMeta.total;return e>0&&!isNaN(t)?O*(Math.abs(t)/e):0}getLabelAndValue(t){const e=this._cachedMeta,i=this.chart,s=i.data.labels||[],n=ne(e._parsed[t],i.options.locale);return{label:s[t]||"",value:n}}getMaxBorderWidth(t){let e=0;const i=this.chart;let s,n,o,a,r;if(!t)for(s=0,n=i.data.datasets.length;s<n;++s)if(i.isDatasetVisible(s)){o=i.getDatasetMeta(s),t=o.data,a=o.controller;break}if(!t)return 0;for(s=0,n=t.length;s<n;++s)r=a.resolveDataElementOptions(s),"inner"!==r.borderAlign&&(e=Math.max(e,r.borderWidth||0,r.hoverBorderWidth||0));return e}getMaxOffset(t){let e=0;for(let i=0,s=t.length;i<s;++i){const t=this.resolveDataElementOptions(i);e=Math.max(e,t.offset||0,t.hoverOffset||0)}return e}_getRingWeightOffset(t){let e=0;for(let i=0;i<t;++i)this.chart.isDatasetVisible(i)&&(e+=this._getRingWeight(i));return e}_getRingWeight(t){return Math.max(l(this.chart.data.datasets[t].weight,1),0)}_getVisibleDatasetWeightTotal(){return this._getRingWeightOffset(this.chart.data.datasets.length)||1}}class Yn extends js{static id="polarArea";static defaults={dataElementType:"arc",animation:{animateRotate:!0,animateScale:!0},animations:{numbers:{type:"number",properties:["x","y","startAngle","endAngle","innerRadius","outerRadius"]}},indexAxis:"r",startAngle:0};static overrides={aspectRatio:1,plugins:{legend:{labels:{generateLabels(t){const e=t.data;if(e.labels.length&&e.datasets.length){const{labels:{pointStyle:i,color:s}}=t.legend.options;return e.labels.map(((e,n)=>{const o=t.getDatasetMeta(0).controller.getStyle(n);return{text:e,fillStyle:o.backgroundColor,strokeStyle:o.borderColor,fontColor:s,lineWidth:o.borderWidth,pointStyle:i,hidden:!t.getDataVisibility(n),index:n}}))}return[]}},onClick(t,e,i){i.chart.toggleDataVisibility(e.index),i.chart.update()}}},scales:{r:{type:"radialLinear",angleLines:{display:!1},beginAtZero:!0,grid:{circular:!0},pointLabels:{display:!1},startAngle:0}}};constructor(t,e){super(t,e),this.innerRadius=void 0,this.outerRadius=void 0}getLabelAndValue(t){const e=this._cachedMeta,i=this.chart,s=i.data.labels||[],n=ne(e._parsed[t].r,i.options.locale);return{label:s[t]||"",value:n}}parseObjectData(t,e,i,s){return ii.bind(this)(t,e,i,s)}update(t){const e=this._cachedMeta.data;this._updateRadius(),this.updateElements(e,0,e.length,t)}getMinMax(){const t=this._cachedMeta,e={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY};return t.data.forEach(((t,i)=>{const s=this.getParsed(i).r;!isNaN(s)&&this.chart.getDataVisibility(i)&&(s<e.min&&(e.min=s),s>e.max&&(e.max=s))})),e}_updateRadius(){const t=this.chart,e=t.chartArea,i=t.options,s=Math.min(e.right-e.left,e.bottom-e.top),n=Math.max(s/2,0),o=(n-Math.max(i.cutoutPercentage?n/100*i.cutoutPercentage:1,0))/t.getVisibleDatasetCount();this.outerRadius=n-o*this.index,this.innerRadius=this.outerRadius-o}updateElements(t,e,i,s){const n="reset"===s,o=this.chart,a=o.options.animation,r=this._cachedMeta.rScale,l=r.xCenter,h=r.yCenter,c=r.getIndexAngle(0)-.5*C;let d,u=c;const f=360/this.countVisibleElements();for(d=0;d<e;++d)u+=this._computeAngle(d,s,f);for(d=e;d<e+i;d++){const e=t[d];let i=u,g=u+this._computeAngle(d,s,f),p=o.getDataVisibility(d)?r.getDistanceFromCenterForValue(this.getParsed(d).r):0;u=g,n&&(a.animateScale&&(p=0),a.animateRotate&&(i=g=c));const m={x:l,y:h,innerRadius:0,outerRadius:p,startAngle:i,endAngle:g,options:this.resolveDataElementOptions(d,e.active?"active":s)};this.updateElement(e,d,m,s)}}countVisibleElements(){const t=this._cachedMeta;let e=0;return t.data.forEach(((t,i)=>{!isNaN(this.getParsed(i).r)&&this.chart.getDataVisibility(i)&&e++})),e}_computeAngle(t,e,i){return this.chart.getDataVisibility(t)?$(this.resolveDataElementOptions(t,e).angle||i):0}}var Un=Object.freeze({__proto__:null,BarController:class extends js{static id="bar";static defaults={datasetElementType:!1,dataElementType:"bar",categoryPercentage:.8,barPercentage:.9,grouped:!0,animations:{numbers:{type:"number",properties:["x","y","base","width","height"]}}};static overrides={scales:{_index_:{type:"category",offset:!0,grid:{offset:!0}},_value_:{type:"linear",beginAtZero:!0}}};parsePrimitiveData(t,e,i,s){return Vn(t,e,i,s)}parseArrayData(t,e,i,s){return Vn(t,e,i,s)}parseObjectData(t,e,i,s){const{iScale:n,vScale:o}=t,{xAxisKey:a="x",yAxisKey:r="y"}=this._parsing,l="x"===n.axis?a:r,h="x"===o.axis?a:r,c=[];let d,u,f,g;for(d=i,u=i+s;d<u;++d)g=e[d],f={},f[n.axis]=n.parse(M(g,l),d),c.push(Fn(M(g,h),f,o,d));return c}updateRangeFromParsed(t,e,i,s){super.updateRangeFromParsed(t,e,i,s);const n=i._custom;n&&e===this._cachedMeta.vScale&&(t.min=Math.min(t.min,n.min),t.max=Math.max(t.max,n.max))}getMaxOverflow(){return 0}getLabelAndValue(t){const e=this._cachedMeta,{iScale:i,vScale:s}=e,n=this.getParsed(t),o=n._custom,a=Bn(o)?"["+o.start+", "+o.end+"]":""+s.getLabelForValue(n[s.axis]);return{label:""+i.getLabelForValue(n[i.axis]),value:a}}initialize(){this.enableOptionSharing=!0,super.initialize();this._cachedMeta.stack=this.getDataset().stack}update(t){const e=this._cachedMeta;this.updateElements(e.data,0,e.data.length,t)}updateElements(t,e,i,n){const o="reset"===n,{index:a,_cachedMeta:{vScale:r}}=this,l=r.getBasePixel(),h=r.isHorizontal(),c=this._getRuler(),{sharedOptions:d,includeOptions:u}=this._getSharedOptions(e,n);for(let f=e;f<e+i;f++){const e=this.getParsed(f),i=o||s(e[r.axis])?{base:l,head:l}:this._calculateBarValuePixels(f),g=this._calculateBarIndexPixels(f,c),p=(e._stacks||{})[r.axis],m={horizontal:h,base:i.base,enableBorderRadius:!p||Bn(e._custom)||a===p._top||a===p._bottom,x:h?i.head:g.center,y:h?g.center:i.head,height:h?g.size:Math.abs(i.size),width:h?Math.abs(i.size):g.size};u&&(m.options=d||this.resolveDataElementOptions(f,t[f].active?"active":n));const x=m.options||t[f].options;Wn(m,x,p,a),jn(m,x,c.ratio),this.updateElement(t[f],f,m,n)}}_getStacks(t,e){const{iScale:i}=this._cachedMeta,n=i.getMatchingVisibleMetas(this._type).filter((t=>t.controller.options.grouped)),o=i.options.stacked,a=[],r=this._cachedMeta.controller.getParsed(e),l=r&&r[i.axis],h=t=>{const e=t._parsed.find((t=>t[i.axis]===l)),n=e&&e[t.vScale.axis];if(s(n)||isNaN(n))return!0};for(const i of n)if((void 0===e||!h(i))&&((!1===o||-1===a.indexOf(i.stack)||void 0===o&&void 0===i.stack)&&a.push(i.stack),i.index===t))break;return a.length||a.push(void 0),a}_getStackCount(t){return this._getStacks(void 0,t).length}_getAxisCount(){return this._getAxis().length}getFirstScaleIdForIndexAxis(){const t=this.chart.scales,e=this.chart.options.indexAxis;return Object.keys(t).filter((i=>t[i].axis===e)).shift()}_getAxis(){const t={},e=this.getFirstScaleIdForIndexAxis();for(const i of this.chart.data.datasets)t[l("x"===this.chart.options.indexAxis?i.xAxisID:i.yAxisID,e)]=!0;return Object.keys(t)}_getStackIndex(t,e,i){const s=this._getStacks(t,i),n=void 0!==e?s.indexOf(e):-1;return-1===n?s.length-1:n}_getRuler(){const t=this.options,e=this._cachedMeta,i=e.iScale,s=[];let n,o;for(n=0,o=e.data.length;n<o;++n)s.push(i.getPixelForValue(this.getParsed(n)[i.axis],n));const a=t.barThickness;return{min:a||zn(e),pixels:s,start:i._startPixel,end:i._endPixel,stackCount:this._getStackCount(),scale:i,grouped:t.grouped,ratio:a?1:t.categoryPercentage*t.barPercentage}}_calculateBarValuePixels(t){const{_cachedMeta:{vScale:e,_stacked:i,index:n},options:{base:o,minBarLength:a}}=this,r=o||0,l=this.getParsed(t),h=l._custom,c=Bn(h);let d,u,f=l[e.axis],g=0,p=i?this.applyStack(e,l,i):f;p!==f&&(g=p-f,p=f),c&&(f=h.barStart,p=h.barEnd-h.barStart,0!==f&&F(f)!==F(h.barEnd)&&(g=0),g+=f);const m=s(o)||c?g:o;let x=e.getPixelForValue(m);if(d=this.chart.getDataVisibility(t)?e.getPixelForValue(g+p):x,u=d-x,Math.abs(u)<a){u=function(t,e,i){return 0!==t?F(t):(e.isHorizontal()?1:-1)*(e.min>=i?1:-1)}(u,e,r)*a,f===r&&(x-=u/2);const t=e.getPixelForDecimal(0),s=e.getPixelForDecimal(1),o=Math.min(t,s),h=Math.max(t,s);x=Math.max(Math.min(x,h),o),d=x+u,i&&!c&&(l._stacks[e.axis]._visualValues[n]=e.getValueForPixel(d)-e.getValueForPixel(x))}if(x===e.getPixelForValue(r)){const t=F(u)*e.getLineWidthForValue(r)/2;x+=t,u-=t}return{size:u,base:x,head:d,center:d+u/2}}_calculateBarIndexPixels(t,e){const i=e.scale,n=this.options,o=n.skipNull,a=l(n.maxBarThickness,1/0);let r,h;const c=this._getAxisCount();if(e.grouped){const i=o?this._getStackCount(t):e.stackCount,d="flex"===n.barThickness?function(t,e,i,s){const n=e.pixels,o=n[t];let a=t>0?n[t-1]:null,r=t<n.length-1?n[t+1]:null;const l=i.categoryPercentage;null===a&&(a=o-(null===r?e.end-e.start:r-o)),null===r&&(r=o+o-a);const h=o-(o-Math.min(a,r))/2*l;return{chunk:Math.abs(r-a)/2*l/s,ratio:i.barPercentage,start:h}}(t,e,n,i*c):function(t,e,i,n){const o=i.barThickness;let a,r;return s(o)?(a=e.min*i.categoryPercentage,r=i.barPercentage):(a=o*n,r=1),{chunk:a/n,ratio:r,start:e.pixels[t]-a/2}}(t,e,n,i*c),u="x"===this.chart.options.indexAxis?this.getDataset().xAxisID:this.getDataset().yAxisID,f=this._getAxis().indexOf(l(u,this.getFirstScaleIdForIndexAxis())),g=this._getStackIndex(this.index,this._cachedMeta.stack,o?t:void 0)+f;r=d.start+d.chunk*g+d.chunk/2,h=Math.min(a,d.chunk*d.ratio)}else r=i.getPixelForValue(this.getParsed(t)[i.axis],t),h=Math.min(a,e.min*e.ratio);return{base:r-h/2,head:r+h/2,center:r,size:h}}draw(){const t=this._cachedMeta,e=t.vScale,i=t.data,s=i.length;let n=0;for(;n<s;++n)null===this.getParsed(n)[e.axis]||i[n].hidden||i[n].draw(this._ctx)}},BubbleController:class extends js{static id="bubble";static defaults={datasetElementType:!1,dataElementType:"point",animations:{numbers:{type:"number",properties:["x","y","borderWidth","radius"]}}};static overrides={scales:{x:{type:"linear"},y:{type:"linear"}}};initialize(){this.enableOptionSharing=!0,super.initialize()}parsePrimitiveData(t,e,i,s){const n=super.parsePrimitiveData(t,e,i,s);for(let t=0;t<n.length;t++)n[t]._custom=this.resolveDataElementOptions(t+i).radius;return n}parseArrayData(t,e,i,s){const n=super.parseArrayData(t,e,i,s);for(let t=0;t<n.length;t++){const s=e[i+t];n[t]._custom=l(s[2],this.resolveDataElementOptions(t+i).radius)}return n}parseObjectData(t,e,i,s){const n=super.parseObjectData(t,e,i,s);for(let t=0;t<n.length;t++){const s=e[i+t];n[t]._custom=l(s&&s.r&&+s.r,this.resolveDataElementOptions(t+i).radius)}return n}getMaxOverflow(){const t=this._cachedMeta.data;let e=0;for(let i=t.length-1;i>=0;--i)e=Math.max(e,t[i].size(this.resolveDataElementOptions(i))/2);return e>0&&e}getLabelAndValue(t){const e=this._cachedMeta,i=this.chart.data.labels||[],{xScale:s,yScale:n}=e,o=this.getParsed(t),a=s.getLabelForValue(o.x),r=n.getLabelForValue(o.y),l=o._custom;return{label:i[t]||"",value:"("+a+", "+r+(l?", "+l:"")+")"}}update(t){const e=this._cachedMeta.data;this.updateElements(e,0,e.length,t)}updateElements(t,e,i,s){const n="reset"===s,{iScale:o,vScale:a}=this._cachedMeta,{sharedOptions:r,includeOptions:l}=this._getSharedOptions(e,s),h=o.axis,c=a.axis;for(let d=e;d<e+i;d++){const e=t[d],i=!n&&this.getParsed(d),u={},f=u[h]=n?o.getPixelForDecimal(.5):o.getPixelForValue(i[h]),g=u[c]=n?a.getBasePixel():a.getPixelForValue(i[c]);u.skip=isNaN(f)||isNaN(g),l&&(u.options=r||this.resolveDataElementOptions(d,e.active?"active":s),n&&(u.options.radius=0)),this.updateElement(e,d,u,s)}}resolveDataElementOptions(t,e){const i=this.getParsed(t);let s=super.resolveDataElementOptions(t,e);s.$shared&&(s=Object.assign({},s,{$shared:!1}));const n=s.radius;return"active"!==e&&(s.radius=0),s.radius+=l(i&&i._custom,n),s}},DoughnutController:$n,LineController:class extends js{static id="line";static defaults={datasetElementType:"line",dataElementType:"point",showLine:!0,spanGaps:!1};static overrides={scales:{_index_:{type:"category"},_value_:{type:"linear"}}};initialize(){this.enableOptionSharing=!0,this.supportsDecimation=!0,super.initialize()}update(t){const e=this._cachedMeta,{dataset:i,data:s=[],_dataset:n}=e,o=this.chart._animationsDisabled;let{start:a,count:r}=pt(e,s,o);this._drawStart=a,this._drawCount=r,mt(e)&&(a=0,r=s.length),i._chart=this.chart,i._datasetIndex=this.index,i._decimated=!!n._decimated,i.points=s;const l=this.resolveDatasetElementOptions(t);this.options.showLine||(l.borderWidth=0),l.segment=this.options.segment,this.updateElement(i,void 0,{animated:!o,options:l},t),this.updateElements(s,a,r,t)}updateElements(t,e,i,n){const o="reset"===n,{iScale:a,vScale:r,_stacked:l,_dataset:h}=this._cachedMeta,{sharedOptions:c,includeOptions:d}=this._getSharedOptions(e,n),u=a.axis,f=r.axis,{spanGaps:g,segment:p}=this.options,m=N(g)?g:Number.POSITIVE_INFINITY,x=this.chart._animationsDisabled||o||"none"===n,b=e+i,_=t.length;let y=e>0&&this.getParsed(e-1);for(let i=0;i<_;++i){const g=t[i],_=x?g:{};if(i<e||i>=b){_.skip=!0;continue}const v=this.getParsed(i),M=s(v[f]),w=_[u]=a.getPixelForValue(v[u],i),k=_[f]=o||M?r.getBasePixel():r.getPixelForValue(l?this.applyStack(r,v,l):v[f],i);_.skip=isNaN(w)||isNaN(k)||M,_.stop=i>0&&Math.abs(v[u]-y[u])>m,p&&(_.parsed=v,_.raw=h.data[i]),d&&(_.options=c||this.resolveDataElementOptions(i,g.active?"active":n)),x||this.updateElement(g,i,_,n),y=v}}getMaxOverflow(){const t=this._cachedMeta,e=t.dataset,i=e.options&&e.options.borderWidth||0,s=t.data||[];if(!s.length)return i;const n=s[0].size(this.resolveDataElementOptions(0)),o=s[s.length-1].size(this.resolveDataElementOptions(s.length-1));return Math.max(i,n,o)/2}draw(){const t=this._cachedMeta;t.dataset.updateControlPoints(this.chart.chartArea,t.iScale.axis),super.draw()}},PieController:class extends $n{static id="pie";static defaults={cutout:0,rotation:0,circumference:360,radius:"100%"}},PolarAreaController:Yn,RadarController:class extends js{static id="radar";static defaults={datasetElementType:"line",dataElementType:"point",indexAxis:"r",showLine:!0,elements:{line:{fill:"start"}}};static overrides={aspectRatio:1,scales:{r:{type:"radialLinear"}}};getLabelAndValue(t){const e=this._cachedMeta.vScale,i=this.getParsed(t);return{label:e.getLabels()[t],value:""+e.getLabelForValue(i[e.axis])}}parseObjectData(t,e,i,s){return ii.bind(this)(t,e,i,s)}update(t){const e=this._cachedMeta,i=e.dataset,s=e.data||[],n=e.iScale.getLabels();if(i.points=s,"resize"!==t){const e=this.resolveDatasetElementOptions(t);this.options.showLine||(e.borderWidth=0);const o={_loop:!0,_fullLoop:n.length===s.length,options:e};this.updateElement(i,void 0,o,t)}this.updateElements(s,0,s.length,t)}updateElements(t,e,i,s){const n=this._cachedMeta.rScale,o="reset"===s;for(let a=e;a<e+i;a++){const e=t[a],i=this.resolveDataElementOptions(a,e.active?"active":s),r=n.getPointPositionForValue(a,this.getParsed(a).r),l=o?n.xCenter:r.x,h=o?n.yCenter:r.y,c={x:l,y:h,angle:r.angle,skip:isNaN(l)||isNaN(h),options:i};this.updateElement(e,a,c,s)}}},ScatterController:class extends js{static id="scatter";static defaults={datasetElementType:!1,dataElementType:"point",showLine:!1,fill:!1};static overrides={interaction:{mode:"point"},scales:{x:{type:"linear"},y:{type:"linear"}}};getLabelAndValue(t){const e=this._cachedMeta,i=this.chart.data.labels||[],{xScale:s,yScale:n}=e,o=this.getParsed(t),a=s.getLabelForValue(o.x),r=n.getLabelForValue(o.y);return{label:i[t]||"",value:"("+a+", "+r+")"}}update(t){const e=this._cachedMeta,{data:i=[]}=e,s=this.chart._animationsDisabled;let{start:n,count:o}=pt(e,i,s);if(this._drawStart=n,this._drawCount=o,mt(e)&&(n=0,o=i.length),this.options.showLine){this.datasetElementType||this.addElements();const{dataset:n,_dataset:o}=e;n._chart=this.chart,n._datasetIndex=this.index,n._decimated=!!o._decimated,n.points=i;const a=this.resolveDatasetElementOptions(t);a.segment=this.options.segment,this.updateElement(n,void 0,{animated:!s,options:a},t)}else this.datasetElementType&&(delete e.dataset,this.datasetElementType=!1);this.updateElements(i,n,o,t)}addElements(){const{showLine:t}=this.options;!this.datasetElementType&&t&&(this.datasetElementType=this.chart.registry.getElement("line")),super.addElements()}updateElements(t,e,i,n){const o="reset"===n,{iScale:a,vScale:r,_stacked:l,_dataset:h}=this._cachedMeta,c=this.resolveDataElementOptions(e,n),d=this.getSharedOptions(c),u=this.includeOptions(n,d),f=a.axis,g=r.axis,{spanGaps:p,segment:m}=this.options,x=N(p)?p:Number.POSITIVE_INFINITY,b=this.chart._animationsDisabled||o||"none"===n;let _=e>0&&this.getParsed(e-1);for(let c=e;c<e+i;++c){const e=t[c],i=this.getParsed(c),p=b?e:{},y=s(i[g]),v=p[f]=a.getPixelForValue(i[f],c),M=p[g]=o||y?r.getBasePixel():r.getPixelForValue(l?this.applyStack(r,i,l):i[g],c);p.skip=isNaN(v)||isNaN(M)||y,p.stop=c>0&&Math.abs(i[f]-_[f])>x,m&&(p.parsed=i,p.raw=h.data[c]),u&&(p.options=d||this.resolveDataElementOptions(c,e.active?"active":n)),b||this.updateElement(e,c,p,n),_=i}this.updateSharedOptions(d,n,c)}getMaxOverflow(){const t=this._cachedMeta,e=t.data||[];if(!this.options.showLine){let t=0;for(let i=e.length-1;i>=0;--i)t=Math.max(t,e[i].size(this.resolveDataElementOptions(i))/2);return t>0&&t}const i=t.dataset,s=i.options&&i.options.borderWidth||0;if(!e.length)return s;const n=e[0].size(this.resolveDataElementOptions(0)),o=e[e.length-1].size(this.resolveDataElementOptions(e.length-1));return Math.max(s,n,o)/2}}});function Xn(t,e,i,s){const n=vi(t.options.borderRadius,["outerStart","outerEnd","innerStart","innerEnd"]);const o=(i-e)/2,a=Math.min(o,s*e/2),r=t=>{const e=(i-Math.min(o,t))*s/2;return Z(t,0,Math.min(o,e))};return{outerStart:r(n.outerStart),outerEnd:r(n.outerEnd),innerStart:Z(n.innerStart,0,a),innerEnd:Z(n.innerEnd,0,a)}}function qn(t,e,i,s){return{x:i+t*Math.cos(e),y:s+t*Math.sin(e)}}function Kn(t,e,i,s,n,o){const{x:a,y:r,startAngle:l,pixelMargin:h,innerRadius:c}=e,d=Math.max(e.outerRadius+s+i-h,0),u=c>0?c+s+i+h:0;let f=0;const g=n-l;if(s){const t=((c>0?c-s:0)+(d>0?d-s:0))/2;f=(g-(0!==t?g*t/(t+s):g))/2}const p=(g-Math.max(.001,g*d-i/C)/d)/2,m=l+p+f,x=n-p-f,{outerStart:b,outerEnd:_,innerStart:y,innerEnd:v}=Xn(e,u,d,x-m),M=d-b,w=d-_,k=m+b/M,S=x-_/w,P=u+y,D=u+v,O=m+y/P,A=x-v/D;if(t.beginPath(),o){const e=(k+S)/2;if(t.arc(a,r,d,k,e),t.arc(a,r,d,e,S),_>0){const e=qn(w,S,a,r);t.arc(e.x,e.y,_,S,x+E)}const i=qn(D,x,a,r);if(t.lineTo(i.x,i.y),v>0){const e=qn(D,A,a,r);t.arc(e.x,e.y,v,x+E,A+Math.PI)}const s=(x-v/u+(m+y/u))/2;if(t.arc(a,r,u,x-v/u,s,!0),t.arc(a,r,u,s,m+y/u,!0),y>0){const e=qn(P,O,a,r);t.arc(e.x,e.y,y,O+Math.PI,m-E)}const n=qn(M,m,a,r);if(t.lineTo(n.x,n.y),b>0){const e=qn(M,k,a,r);t.arc(e.x,e.y,b,m-E,k)}}else{t.moveTo(a,r);const e=Math.cos(k)*d+a,i=Math.sin(k)*d+r;t.lineTo(e,i);const s=Math.cos(S)*d+a,n=Math.sin(S)*d+r;t.lineTo(s,n)}t.closePath()}function Gn(t,e,i,s,n){const{fullCircles:o,startAngle:a,circumference:r,options:l}=e,{borderWidth:h,borderJoinStyle:c,borderDash:d,borderDashOffset:u,borderRadius:f}=l,g="inner"===l.borderAlign;if(!h)return;t.setLineDash(d||[]),t.lineDashOffset=u,g?(t.lineWidth=2*h,t.lineJoin=c||"round"):(t.lineWidth=h,t.lineJoin=c||"bevel");let p=e.endAngle;if(o){Kn(t,e,i,s,p,n);for(let e=0;e<o;++e)t.stroke();isNaN(r)||(p=a+(r%O||O))}g&&function(t,e,i){const{startAngle:s,pixelMargin:n,x:o,y:a,outerRadius:r,innerRadius:l}=e;let h=n/r;t.beginPath(),t.arc(o,a,r,s-h,i+h),l>n?(h=n/l,t.arc(o,a,l,i+h,s-h,!0)):t.arc(o,a,n,i+E,s-E),t.closePath(),t.clip()}(t,e,p),l.selfJoin&&p-a>=C&&0===f&&"miter"!==c&&function(t,e,i){const{startAngle:s,x:n,y:o,outerRadius:a,innerRadius:r,options:l}=e,{borderWidth:h,borderJoinStyle:c}=l,d=Math.min(h/a,G(s-i));if(t.beginPath(),t.arc(n,o,a-h/2,s+d/2,i-d/2),r>0){const e=Math.min(h/r,G(s-i));t.arc(n,o,r+h/2,i-e/2,s+e/2,!0)}else{const e=Math.min(h/2,a*G(s-i));if("round"===c)t.arc(n,o,e,i-C/2,s+C/2,!0);else if("bevel"===c){const a=2*e*e,r=-a*Math.cos(i+C/2)+n,l=-a*Math.sin(i+C/2)+o,h=a*Math.cos(s+C/2)+n,c=a*Math.sin(s+C/2)+o;t.lineTo(r,l),t.lineTo(h,c)}}t.closePath(),t.moveTo(0,0),t.rect(0,0,t.canvas.width,t.canvas.height),t.clip("evenodd")}(t,e,p),o||(Kn(t,e,i,s,p,n),t.stroke())}function Jn(t,e,i=e){t.lineCap=l(i.borderCapStyle,e.borderCapStyle),t.setLineDash(l(i.borderDash,e.borderDash)),t.lineDashOffset=l(i.borderDashOffset,e.borderDashOffset),t.lineJoin=l(i.borderJoinStyle,e.borderJoinStyle),t.lineWidth=l(i.borderWidth,e.borderWidth),t.strokeStyle=l(i.borderColor,e.borderColor)}function Zn(t,e,i){t.lineTo(i.x,i.y)}function Qn(t,e,i={}){const s=t.length,{start:n=0,end:o=s-1}=i,{start:a,end:r}=e,l=Math.max(n,a),h=Math.min(o,r),c=n<a&&o<a||n>r&&o>r;return{count:s,start:l,loop:e.loop,ilen:h<l&&!c?s+h-l:h-l}}function to(t,e,i,s){const{points:n,options:o}=e,{count:a,start:r,loop:l,ilen:h}=Qn(n,i,s),c=function(t){return t.stepped?Fe:t.tension||"monotone"===t.cubicInterpolationMode?Ve:Zn}(o);let d,u,f,{move:g=!0,reverse:p}=s||{};for(d=0;d<=h;++d)u=n[(r+(p?h-d:d))%a],u.skip||(g?(t.moveTo(u.x,u.y),g=!1):c(t,f,u,p,o.stepped),f=u);return l&&(u=n[(r+(p?h:0))%a],c(t,f,u,p,o.stepped)),!!l}function eo(t,e,i,s){const n=e.points,{count:o,start:a,ilen:r}=Qn(n,i,s),{move:l=!0,reverse:h}=s||{};let c,d,u,f,g,p,m=0,x=0;const b=t=>(a+(h?r-t:t))%o,_=()=>{f!==g&&(t.lineTo(m,g),t.lineTo(m,f),t.lineTo(m,p))};for(l&&(d=n[b(0)],t.moveTo(d.x,d.y)),c=0;c<=r;++c){if(d=n[b(c)],d.skip)continue;const e=d.x,i=d.y,s=0|e;s===u?(i<f?f=i:i>g&&(g=i),m=(x*m+e)/++x):(_(),t.lineTo(e,i),u=s,x=0,f=g=i),p=i}_()}function io(t){const e=t.options,i=e.borderDash&&e.borderDash.length;return!(t._decimated||t._loop||e.tension||"monotone"===e.cubicInterpolationMode||e.stepped||i)?eo:to}const so="function"==typeof Path2D;function no(t,e,i,s){so&&!e.options.segment?function(t,e,i,s){let n=e._path;n||(n=e._path=new Path2D,e.path(n,i,s)&&n.closePath()),Jn(t,e.options),t.stroke(n)}(t,e,i,s):function(t,e,i,s){const{segments:n,options:o}=e,a=io(e);for(const r of n)Jn(t,o,r.style),t.beginPath(),a(t,e,r,{start:i,end:i+s-1})&&t.closePath(),t.stroke()}(t,e,i,s)}class oo extends $s{static id="line";static defaults={borderCapStyle:"butt",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderWidth:3,capBezierPoints:!0,cubicInterpolationMode:"default",fill:!1,spanGaps:!1,stepped:!1,tension:0};static defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};static descriptors={_scriptable:!0,_indexable:t=>"borderDash"!==t&&"fill"!==t};constructor(t){super(),this.animated=!0,this.options=void 0,this._chart=void 0,this._loop=void 0,this._fullLoop=void 0,this._path=void 0,this._points=void 0,this._segments=void 0,this._decimated=!1,this._pointsUpdated=!1,this._datasetIndex=void 0,t&&Object.assign(this,t)}updateControlPoints(t,e){const i=this.options;if((i.tension||"monotone"===i.cubicInterpolationMode)&&!i.stepped&&!this._pointsUpdated){const s=i.spanGaps?this._loop:this._fullLoop;hi(this._points,i,t,s,e),this._pointsUpdated=!0}}set points(t){this._points=t,delete this._segments,delete this._path,this._pointsUpdated=!1}get points(){return this._points}get segments(){return this._segments||(this._segments=zi(this,this.options.segment))}first(){const t=this.segments,e=this.points;return t.length&&e[t[0].start]}last(){const t=this.segments,e=this.points,i=t.length;return i&&e[t[i-1].end]}interpolate(t,e){const i=this.options,s=t[e],n=this.points,o=Ii(this,{property:e,start:s,end:s});if(!o.length)return;const a=[],r=function(t){return t.stepped?pi:t.tension||"monotone"===t.cubicInterpolationMode?mi:gi}(i);let l,h;for(l=0,h=o.length;l<h;++l){const{start:h,end:c}=o[l],d=n[h],u=n[c];if(d===u){a.push(d);continue}const f=r(d,u,Math.abs((s-d[e])/(u[e]-d[e])),i.stepped);f[e]=t[e],a.push(f)}return 1===a.length?a[0]:a}pathSegment(t,e,i){return io(this)(t,this,e,i)}path(t,e,i){const s=this.segments,n=io(this);let o=this._loop;e=e||0,i=i||this.points.length-e;for(const a of s)o&=n(t,this,a,{start:e,end:e+i-1});return!!o}draw(t,e,i,s){const n=this.options||{};(this.points||[]).length&&n.borderWidth&&(t.save(),no(t,this,i,s),t.restore()),this.animated&&(this._pointsUpdated=!1,this._path=void 0)}}function ao(t,e,i,s){const n=t.options,{[i]:o}=t.getProps([i],s);return Math.abs(e-o)<n.radius+n.hitRadius}function ro(t,e){const{x:i,y:s,base:n,width:o,height:a}=t.getProps(["x","y","base","width","height"],e);let r,l,h,c,d;return t.horizontal?(d=a/2,r=Math.min(i,n),l=Math.max(i,n),h=s-d,c=s+d):(d=o/2,r=i-d,l=i+d,h=Math.min(s,n),c=Math.max(s,n)),{left:r,top:h,right:l,bottom:c}}function lo(t,e,i,s){return t?0:Z(e,i,s)}function ho(t){const e=ro(t),i=e.right-e.left,s=e.bottom-e.top,n=function(t,e,i){const s=t.options.borderWidth,n=t.borderSkipped,o=Mi(s);return{t:lo(n.top,o.top,0,i),r:lo(n.right,o.right,0,e),b:lo(n.bottom,o.bottom,0,i),l:lo(n.left,o.left,0,e)}}(t,i/2,s/2),a=function(t,e,i){const{enableBorderRadius:s}=t.getProps(["enableBorderRadius"]),n=t.options.borderRadius,a=wi(n),r=Math.min(e,i),l=t.borderSkipped,h=s||o(n);return{topLeft:lo(!h||l.top||l.left,a.topLeft,0,r),topRight:lo(!h||l.top||l.right,a.topRight,0,r),bottomLeft:lo(!h||l.bottom||l.left,a.bottomLeft,0,r),bottomRight:lo(!h||l.bottom||l.right,a.bottomRight,0,r)}}(t,i/2,s/2);return{outer:{x:e.left,y:e.top,w:i,h:s,radius:a},inner:{x:e.left+n.l,y:e.top+n.t,w:i-n.l-n.r,h:s-n.t-n.b,radius:{topLeft:Math.max(0,a.topLeft-Math.max(n.t,n.l)),topRight:Math.max(0,a.topRight-Math.max(n.t,n.r)),bottomLeft:Math.max(0,a.bottomLeft-Math.max(n.b,n.l)),bottomRight:Math.max(0,a.bottomRight-Math.max(n.b,n.r))}}}}function co(t,e,i,s){const n=null===e,o=null===i,a=t&&!(n&&o)&&ro(t,s);return a&&(n||tt(e,a.left,a.right))&&(o||tt(i,a.top,a.bottom))}function uo(t,e){t.rect(e.x,e.y,e.w,e.h)}function fo(t,e,i={}){const s=t.x!==i.x?-e:0,n=t.y!==i.y?-e:0,o=(t.x+t.w!==i.x+i.w?e:0)-s,a=(t.y+t.h!==i.y+i.h?e:0)-n;return{x:t.x+s,y:t.y+n,w:t.w+o,h:t.h+a,radius:t.radius}}var go=Object.freeze({__proto__:null,ArcElement:class extends $s{static id="arc";static defaults={borderAlign:"center",borderColor:"#fff",borderDash:[],borderDashOffset:0,borderJoinStyle:void 0,borderRadius:0,borderWidth:2,offset:0,spacing:0,angle:void 0,circular:!0,selfJoin:!1};static defaultRoutes={backgroundColor:"backgroundColor"};static descriptors={_scriptable:!0,_indexable:t=>"borderDash"!==t};circumference;endAngle;fullCircles;innerRadius;outerRadius;pixelMargin;startAngle;constructor(t){super(),this.options=void 0,this.circumference=void 0,this.startAngle=void 0,this.endAngle=void 0,this.innerRadius=void 0,this.outerRadius=void 0,this.pixelMargin=0,this.fullCircles=0,t&&Object.assign(this,t)}inRange(t,e,i){const s=this.getProps(["x","y"],i),{angle:n,distance:o}=X(s,{x:t,y:e}),{startAngle:a,endAngle:r,innerRadius:h,outerRadius:c,circumference:d}=this.getProps(["startAngle","endAngle","innerRadius","outerRadius","circumference"],i),u=(this.options.spacing+this.options.borderWidth)/2,f=l(d,r-a),g=J(n,a,r)&&a!==r,p=f>=O||g,m=tt(o,h+u,c+u);return p&&m}getCenterPoint(t){const{x:e,y:i,startAngle:s,endAngle:n,innerRadius:o,outerRadius:a}=this.getProps(["x","y","startAngle","endAngle","innerRadius","outerRadius"],t),{offset:r,spacing:l}=this.options,h=(s+n)/2,c=(o+a+l+r)/2;return{x:e+Math.cos(h)*c,y:i+Math.sin(h)*c}}tooltipPosition(t){return this.getCenterPoint(t)}draw(t){const{options:e,circumference:i}=this,s=(e.offset||0)/4,n=(e.spacing||0)/2,o=e.circular;if(this.pixelMargin="inner"===e.borderAlign?.33:0,this.fullCircles=i>O?Math.floor(i/O):0,0===i||this.innerRadius<0||this.outerRadius<0)return;t.save();const a=(this.startAngle+this.endAngle)/2;t.translate(Math.cos(a)*s,Math.sin(a)*s);const r=s*(1-Math.sin(Math.min(C,i||0)));t.fillStyle=e.backgroundColor,t.strokeStyle=e.borderColor,function(t,e,i,s,n){const{fullCircles:o,startAngle:a,circumference:r}=e;let l=e.endAngle;if(o){Kn(t,e,i,s,l,n);for(let e=0;e<o;++e)t.fill();isNaN(r)||(l=a+(r%O||O))}Kn(t,e,i,s,l,n),t.fill()}(t,this,r,n,o),Gn(t,this,r,n,o),t.restore()}},BarElement:class extends $s{static id="bar";static defaults={borderSkipped:"start",borderWidth:0,borderRadius:0,inflateAmount:"auto",pointStyle:void 0};static defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};constructor(t){super(),this.options=void 0,this.horizontal=void 0,this.base=void 0,this.width=void 0,this.height=void 0,this.inflateAmount=void 0,t&&Object.assign(this,t)}draw(t){const{inflateAmount:e,options:{borderColor:i,backgroundColor:s}}=this,{inner:n,outer:o}=ho(this),a=(r=o.radius).topLeft||r.topRight||r.bottomLeft||r.bottomRight?He:uo;var r;t.save(),o.w===n.w&&o.h===n.h||(t.beginPath(),a(t,fo(o,e,n)),t.clip(),a(t,fo(n,-e,o)),t.fillStyle=i,t.fill("evenodd")),t.beginPath(),a(t,fo(n,e)),t.fillStyle=s,t.fill(),t.restore()}inRange(t,e,i){return co(this,t,e,i)}inXRange(t,e){return co(this,t,null,e)}inYRange(t,e){return co(this,null,t,e)}getCenterPoint(t){const{x:e,y:i,base:s,horizontal:n}=this.getProps(["x","y","base","horizontal"],t);return{x:n?(e+s)/2:e,y:n?i:(i+s)/2}}getRange(t){return"x"===t?this.width/2:this.height/2}},LineElement:oo,PointElement:class extends $s{static id="point";parsed;skip;stop;static defaults={borderWidth:1,hitRadius:1,hoverBorderWidth:1,hoverRadius:4,pointStyle:"circle",radius:3,rotation:0};static defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};constructor(t){super(),this.options=void 0,this.parsed=void 0,this.skip=void 0,this.stop=void 0,t&&Object.assign(this,t)}inRange(t,e,i){const s=this.options,{x:n,y:o}=this.getProps(["x","y"],i);return Math.pow(t-n,2)+Math.pow(e-o,2)<Math.pow(s.hitRadius+s.radius,2)}inXRange(t,e){return ao(this,t,"x",e)}inYRange(t,e){return ao(this,t,"y",e)}getCenterPoint(t){const{x:e,y:i}=this.getProps(["x","y"],t);return{x:e,y:i}}size(t){let e=(t=t||this.options||{}).radius||0;e=Math.max(e,e&&t.hoverRadius||0);return 2*(e+(e&&t.borderWidth||0))}draw(t,e){const i=this.options;this.skip||i.radius<.1||!Re(this,e,this.size(i)/2)||(t.strokeStyle=i.borderColor,t.lineWidth=i.borderWidth,t.fillStyle=i.backgroundColor,Le(t,i,this.x,this.y))}getRange(){const t=this.options||{};return t.radius+t.hitRadius}}});function po(t,e,i,s){const n=t.indexOf(e);if(-1===n)return((t,e,i,s)=>("string"==typeof e?(i=t.push(e)-1,s.unshift({index:i,label:e})):isNaN(e)&&(i=null),i))(t,e,i,s);return n!==t.lastIndexOf(e)?i:n}function mo(t){const e=this.getLabels();return t>=0&&t<e.length?e[t]:t}function xo(t,e,{horizontal:i,minRotation:s}){const n=$(s),o=(i?Math.sin(n):Math.cos(n))||.001,a=.75*e*(""+t).length;return Math.min(e/o,a)}class bo extends tn{constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._endValue=void 0,this._valueRange=0}parse(t,e){return s(t)||("number"==typeof t||t instanceof Number)&&!isFinite(+t)?null:+t}handleTickRangeOptions(){const{beginAtZero:t}=this.options,{minDefined:e,maxDefined:i}=this.getUserBounds();let{min:s,max:n}=this;const o=t=>s=e?s:t,a=t=>n=i?n:t;if(t){const t=F(s),e=F(n);t<0&&e<0?a(0):t>0&&e>0&&o(0)}if(s===n){let e=0===n?1:Math.abs(.05*n);a(n+e),t||o(s-e)}this.min=s,this.max=n}getTickLimit(){const t=this.options.ticks;let e,{maxTicksLimit:i,stepSize:s}=t;return s?(e=Math.ceil(this.max/s)-Math.floor(this.min/s)+1,e>1e3&&(console.warn(`scales.${this.id}.ticks.stepSize: ${s} would result generating up to ${e} ticks. Limiting to 1000.`),e=1e3)):(e=this.computeTickLimit(),i=i||11),i&&(e=Math.min(i,e)),e}computeTickLimit(){return Number.POSITIVE_INFINITY}buildTicks(){const t=this.options,e=t.ticks;let i=this.getTickLimit();i=Math.max(2,i);const n=function(t,e){const i=[],{bounds:n,step:o,min:a,max:r,precision:l,count:h,maxTicks:c,maxDigits:d,includeBounds:u}=t,f=o||1,g=c-1,{min:p,max:m}=e,x=!s(a),b=!s(r),_=!s(h),y=(m-p)/(d+1);let v,M,w,k,S=B((m-p)/g/f)*f;if(S<1e-14&&!x&&!b)return[{value:p},{value:m}];k=Math.ceil(m/S)-Math.floor(p/S),k>g&&(S=B(k*S/g/f)*f),s(l)||(v=Math.pow(10,l),S=Math.ceil(S*v)/v),"ticks"===n?(M=Math.floor(p/S)*S,w=Math.ceil(m/S)*S):(M=p,w=m),x&&b&&o&&H((r-a)/o,S/1e3)?(k=Math.round(Math.min((r-a)/S,c)),S=(r-a)/k,M=a,w=r):_?(M=x?a:M,w=b?r:w,k=h-1,S=(w-M)/k):(k=(w-M)/S,k=V(k,Math.round(k),S/1e3)?Math.round(k):Math.ceil(k));const P=Math.max(U(S),U(M));v=Math.pow(10,s(l)?P:l),M=Math.round(M*v)/v,w=Math.round(w*v)/v;let D=0;for(x&&(u&&M!==a?(i.push({value:a}),M<a&&D++,V(Math.round((M+D*S)*v)/v,a,xo(a,y,t))&&D++):M<a&&D++);D<k;++D){const t=Math.round((M+D*S)*v)/v;if(b&&t>r)break;i.push({value:t})}return b&&u&&w!==r?i.length&&V(i[i.length-1].value,r,xo(r,y,t))?i[i.length-1].value=r:i.push({value:r}):b&&w!==r||i.push({value:w}),i}({maxTicks:i,bounds:t.bounds,min:t.min,max:t.max,precision:e.precision,step:e.stepSize,count:e.count,maxDigits:this._maxDigits(),horizontal:this.isHorizontal(),minRotation:e.minRotation||0,includeBounds:!1!==e.includeBounds},this._range||this);return"ticks"===t.bounds&&j(n,this,"value"),t.reverse?(n.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),n}configure(){const t=this.ticks;let e=this.min,i=this.max;if(super.configure(),this.options.offset&&t.length){const s=(i-e)/Math.max(t.length-1,1)/2;e-=s,i+=s}this._startValue=e,this._endValue=i,this._valueRange=i-e}getLabelForValue(t){return ne(t,this.chart.options.locale,this.options.ticks.format)}}class _o extends bo{static id="linear";static defaults={ticks:{callback:ae.formatters.numeric}};determineDataLimits(){const{min:t,max:e}=this.getMinMax(!0);this.min=a(t)?t:0,this.max=a(e)?e:1,this.handleTickRangeOptions()}computeTickLimit(){const t=this.isHorizontal(),e=t?this.width:this.height,i=$(this.options.ticks.minRotation),s=(t?Math.sin(i):Math.cos(i))||.001,n=this._resolveTickFontOptions(0);return Math.ceil(e/Math.min(40,n.lineHeight/s))}getPixelForValue(t){return null===t?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getValueForPixel(t){return this._startValue+this.getDecimalForPixel(t)*this._valueRange}}const yo=t=>Math.floor(z(t)),vo=(t,e)=>Math.pow(10,yo(t)+e);function Mo(t){return 1===t/Math.pow(10,yo(t))}function wo(t,e,i){const s=Math.pow(10,i),n=Math.floor(t/s);return Math.ceil(e/s)-n}function ko(t,{min:e,max:i}){e=r(t.min,e);const s=[],n=yo(e);let o=function(t,e){let i=yo(e-t);for(;wo(t,e,i)>10;)i++;for(;wo(t,e,i)<10;)i--;return Math.min(i,yo(t))}(e,i),a=o<0?Math.pow(10,Math.abs(o)):1;const l=Math.pow(10,o),h=n>o?Math.pow(10,n):0,c=Math.round((e-h)*a)/a,d=Math.floor((e-h)/l/10)*l*10;let u=Math.floor((c-d)/Math.pow(10,o)),f=r(t.min,Math.round((h+d+u*Math.pow(10,o))*a)/a);for(;f<i;)s.push({value:f,major:Mo(f),significand:u}),u>=10?u=u<15?15:20:u++,u>=20&&(o++,u=2,a=o>=0?1:a),f=Math.round((h+d+u*Math.pow(10,o))*a)/a;const g=r(t.max,f);return s.push({value:g,major:Mo(g),significand:u}),s}class So extends tn{static id="logarithmic";static defaults={ticks:{callback:ae.formatters.logarithmic,major:{enabled:!0}}};constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._valueRange=0}parse(t,e){const i=bo.prototype.parse.apply(this,[t,e]);if(0!==i)return a(i)&&i>0?i:null;this._zero=!0}determineDataLimits(){const{min:t,max:e}=this.getMinMax(!0);this.min=a(t)?Math.max(0,t):null,this.max=a(e)?Math.max(0,e):null,this.options.beginAtZero&&(this._zero=!0),this._zero&&this.min!==this._suggestedMin&&!a(this._userMin)&&(this.min=t===vo(this.min,0)?vo(this.min,-1):vo(this.min,0)),this.handleTickRangeOptions()}handleTickRangeOptions(){const{minDefined:t,maxDefined:e}=this.getUserBounds();let i=this.min,s=this.max;const n=e=>i=t?i:e,o=t=>s=e?s:t;i===s&&(i<=0?(n(1),o(10)):(n(vo(i,-1)),o(vo(s,1)))),i<=0&&n(vo(s,-1)),s<=0&&o(vo(i,1)),this.min=i,this.max=s}buildTicks(){const t=this.options,e=ko({min:this._userMin,max:this._userMax},this);return"ticks"===t.bounds&&j(e,this,"value"),t.reverse?(e.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),e}getLabelForValue(t){return void 0===t?"0":ne(t,this.chart.options.locale,this.options.ticks.format)}configure(){const t=this.min;super.configure(),this._startValue=z(t),this._valueRange=z(this.max)-z(t)}getPixelForValue(t){return void 0!==t&&0!==t||(t=this.min),null===t||isNaN(t)?NaN:this.getPixelForDecimal(t===this.min?0:(z(t)-this._startValue)/this._valueRange)}getValueForPixel(t){const e=this.getDecimalForPixel(t);return Math.pow(10,this._startValue+e*this._valueRange)}}function Po(t){const e=t.ticks;if(e.display&&t.display){const t=ki(e.backdropPadding);return l(e.font&&e.font.size,ue.font.size)+t.height}return 0}function Do(t,e,i,s,n){return t===s||t===n?{start:e-i/2,end:e+i/2}:t<s||t>n?{start:e-i,end:e}:{start:e,end:e+i}}function Co(t){const e={l:t.left+t._padding.left,r:t.right-t._padding.right,t:t.top+t._padding.top,b:t.bottom-t._padding.bottom},i=Object.assign({},e),s=[],o=[],a=t._pointLabels.length,r=t.options.pointLabels,l=r.centerPointLabels?C/a:0;for(let u=0;u<a;u++){const a=r.setContext(t.getPointLabelContext(u));o[u]=a.padding;const f=t.getPointPosition(u,t.drawingArea+o[u],l),g=Si(a.font),p=(h=t.ctx,c=g,d=n(d=t._pointLabels[u])?d:[d],{w:Oe(h,c.string,d),h:d.length*c.lineHeight});s[u]=p;const m=G(t.getIndexAngle(u)+l),x=Math.round(Y(m));Oo(i,e,m,Do(x,f.x,p.w,0,180),Do(x,f.y,p.h,90,270))}var h,c,d;t.setCenterPoint(e.l-i.l,i.r-e.r,e.t-i.t,i.b-e.b),t._pointLabelItems=function(t,e,i){const s=[],n=t._pointLabels.length,o=t.options,{centerPointLabels:a,display:r}=o.pointLabels,l={extra:Po(o)/2,additionalAngle:a?C/n:0};let h;for(let o=0;o<n;o++){l.padding=i[o],l.size=e[o];const n=Ao(t,o,l);s.push(n),"auto"===r&&(n.visible=To(n,h),n.visible&&(h=n))}return s}(t,s,o)}function Oo(t,e,i,s,n){const o=Math.abs(Math.sin(i)),a=Math.abs(Math.cos(i));let r=0,l=0;s.start<e.l?(r=(e.l-s.start)/o,t.l=Math.min(t.l,e.l-r)):s.end>e.r&&(r=(s.end-e.r)/o,t.r=Math.max(t.r,e.r+r)),n.start<e.t?(l=(e.t-n.start)/a,t.t=Math.min(t.t,e.t-l)):n.end>e.b&&(l=(n.end-e.b)/a,t.b=Math.max(t.b,e.b+l))}function Ao(t,e,i){const s=t.drawingArea,{extra:n,additionalAngle:o,padding:a,size:r}=i,l=t.getPointPosition(e,s+n+a,o),h=Math.round(Y(G(l.angle+E))),c=function(t,e,i){90===i||270===i?t-=e/2:(i>270||i<90)&&(t-=e);return t}(l.y,r.h,h),d=function(t){if(0===t||180===t)return"center";if(t<180)return"left";return"right"}(h),u=function(t,e,i){"right"===i?t-=e:"center"===i&&(t-=e/2);return t}(l.x,r.w,d);return{visible:!0,x:l.x,y:c,textAlign:d,left:u,top:c,right:u+r.w,bottom:c+r.h}}function To(t,e){if(!e)return!0;const{left:i,top:s,right:n,bottom:o}=t;return!(Re({x:i,y:s},e)||Re({x:i,y:o},e)||Re({x:n,y:s},e)||Re({x:n,y:o},e))}function Lo(t,e,i){const{left:n,top:o,right:a,bottom:r}=i,{backdropColor:l}=e;if(!s(l)){const i=wi(e.borderRadius),s=ki(e.backdropPadding);t.fillStyle=l;const h=n-s.left,c=o-s.top,d=a-n+s.width,u=r-o+s.height;Object.values(i).some((t=>0!==t))?(t.beginPath(),He(t,{x:h,y:c,w:d,h:u,radius:i}),t.fill()):t.fillRect(h,c,d,u)}}function Eo(t,e,i,s){const{ctx:n}=t;if(i)n.arc(t.xCenter,t.yCenter,e,0,O);else{let i=t.getPointPosition(0,e);n.moveTo(i.x,i.y);for(let o=1;o<s;o++)i=t.getPointPosition(o,e),n.lineTo(i.x,i.y)}}class Ro extends bo{static id="radialLinear";static defaults={display:!0,animate:!0,position:"chartArea",angleLines:{display:!0,lineWidth:1,borderDash:[],borderDashOffset:0},grid:{circular:!1},startAngle:0,ticks:{showLabelBackdrop:!0,callback:ae.formatters.numeric},pointLabels:{backdropColor:void 0,backdropPadding:2,display:!0,font:{size:10},callback:t=>t,padding:5,centerPointLabels:!1}};static defaultRoutes={"angleLines.color":"borderColor","pointLabels.color":"color","ticks.color":"color"};static descriptors={angleLines:{_fallback:"grid"}};constructor(t){super(t),this.xCenter=void 0,this.yCenter=void 0,this.drawingArea=void 0,this._pointLabels=[],this._pointLabelItems=[]}setDimensions(){const t=this._padding=ki(Po(this.options)/2),e=this.width=this.maxWidth-t.width,i=this.height=this.maxHeight-t.height;this.xCenter=Math.floor(this.left+e/2+t.left),this.yCenter=Math.floor(this.top+i/2+t.top),this.drawingArea=Math.floor(Math.min(e,i)/2)}determineDataLimits(){const{min:t,max:e}=this.getMinMax(!1);this.min=a(t)&&!isNaN(t)?t:0,this.max=a(e)&&!isNaN(e)?e:0,this.handleTickRangeOptions()}computeTickLimit(){return Math.ceil(this.drawingArea/Po(this.options))}generateTickLabels(t){bo.prototype.generateTickLabels.call(this,t),this._pointLabels=this.getLabels().map(((t,e)=>{const i=d(this.options.pointLabels.callback,[t,e],this);return i||0===i?i:""})).filter(((t,e)=>this.chart.getDataVisibility(e)))}fit(){const t=this.options;t.display&&t.pointLabels.display?Co(this):this.setCenterPoint(0,0,0,0)}setCenterPoint(t,e,i,s){this.xCenter+=Math.floor((t-e)/2),this.yCenter+=Math.floor((i-s)/2),this.drawingArea-=Math.min(this.drawingArea/2,Math.max(t,e,i,s))}getIndexAngle(t){return G(t*(O/(this._pointLabels.length||1))+$(this.options.startAngle||0))}getDistanceFromCenterForValue(t){if(s(t))return NaN;const e=this.drawingArea/(this.max-this.min);return this.options.reverse?(this.max-t)*e:(t-this.min)*e}getValueForDistanceFromCenter(t){if(s(t))return NaN;const e=t/(this.drawingArea/(this.max-this.min));return this.options.reverse?this.max-e:this.min+e}getPointLabelContext(t){const e=this._pointLabels||[];if(t>=0&&t<e.length){const i=e[t];return function(t,e,i){return Ci(t,{label:i,index:e,type:"pointLabel"})}(this.getContext(),t,i)}}getPointPosition(t,e,i=0){const s=this.getIndexAngle(t)-E+i;return{x:Math.cos(s)*e+this.xCenter,y:Math.sin(s)*e+this.yCenter,angle:s}}getPointPositionForValue(t,e){return this.getPointPosition(t,this.getDistanceFromCenterForValue(e))}getBasePosition(t){return this.getPointPositionForValue(t||0,this.getBaseValue())}getPointLabelPosition(t){const{left:e,top:i,right:s,bottom:n}=this._pointLabelItems[t];return{left:e,top:i,right:s,bottom:n}}drawBackground(){const{backgroundColor:t,grid:{circular:e}}=this.options;if(t){const i=this.ctx;i.save(),i.beginPath(),Eo(this,this.getDistanceFromCenterForValue(this._endValue),e,this._pointLabels.length),i.closePath(),i.fillStyle=t,i.fill(),i.restore()}}drawGrid(){const t=this.ctx,e=this.options,{angleLines:i,grid:s,border:n}=e,o=this._pointLabels.length;let a,r,l;if(e.pointLabels.display&&function(t,e){const{ctx:i,options:{pointLabels:s}}=t;for(let n=e-1;n>=0;n--){const e=t._pointLabelItems[n];if(!e.visible)continue;const o=s.setContext(t.getPointLabelContext(n));Lo(i,o,e);const a=Si(o.font),{x:r,y:l,textAlign:h}=e;Ne(i,t._pointLabels[n],r,l+a.lineHeight/2,a,{color:o.color,textAlign:h,textBaseline:"middle"})}}(this,o),s.display&&this.ticks.forEach(((t,e)=>{if(0!==e||0===e&&this.min<0){r=this.getDistanceFromCenterForValue(t.value);const i=this.getContext(e),a=s.setContext(i),l=n.setContext(i);!function(t,e,i,s,n){const o=t.ctx,a=e.circular,{color:r,lineWidth:l}=e;!a&&!s||!r||!l||i<0||(o.save(),o.strokeStyle=r,o.lineWidth=l,o.setLineDash(n.dash||[]),o.lineDashOffset=n.dashOffset,o.beginPath(),Eo(t,i,a,s),o.closePath(),o.stroke(),o.restore())}(this,a,r,o,l)}})),i.display){for(t.save(),a=o-1;a>=0;a--){const s=i.setContext(this.getPointLabelContext(a)),{color:n,lineWidth:o}=s;o&&n&&(t.lineWidth=o,t.strokeStyle=n,t.setLineDash(s.borderDash),t.lineDashOffset=s.borderDashOffset,r=this.getDistanceFromCenterForValue(e.reverse?this.min:this.max),l=this.getPointPosition(a,r),t.beginPath(),t.moveTo(this.xCenter,this.yCenter),t.lineTo(l.x,l.y),t.stroke())}t.restore()}}drawBorder(){}drawLabels(){const t=this.ctx,e=this.options,i=e.ticks;if(!i.display)return;const s=this.getIndexAngle(0);let n,o;t.save(),t.translate(this.xCenter,this.yCenter),t.rotate(s),t.textAlign="center",t.textBaseline="middle",this.ticks.forEach(((s,a)=>{if(0===a&&this.min>=0&&!e.reverse)return;const r=i.setContext(this.getContext(a)),l=Si(r.font);if(n=this.getDistanceFromCenterForValue(this.ticks[a].value),r.showLabelBackdrop){t.font=l.string,o=t.measureText(s.label).width,t.fillStyle=r.backdropColor;const e=ki(r.backdropPadding);t.fillRect(-o/2-e.left,-n-l.size/2-e.top,o+e.width,l.size+e.height)}Ne(t,s.label,0,-n,l,{color:r.color,strokeColor:r.textStrokeColor,strokeWidth:r.textStrokeWidth})})),t.restore()}drawTitle(){}}const Io={millisecond:{common:!0,size:1,steps:1e3},second:{common:!0,size:1e3,steps:60},minute:{common:!0,size:6e4,steps:60},hour:{common:!0,size:36e5,steps:24},day:{common:!0,size:864e5,steps:30},week:{common:!1,size:6048e5,steps:4},month:{common:!0,size:2628e6,steps:12},quarter:{common:!1,size:7884e6,steps:4},year:{common:!0,size:3154e7}},zo=Object.keys(Io);function Fo(t,e){return t-e}function Vo(t,e){if(s(e))return null;const i=t._adapter,{parser:n,round:o,isoWeekday:r}=t._parseOpts;let l=e;return"function"==typeof n&&(l=n(l)),a(l)||(l="string"==typeof n?i.parse(l,n):i.parse(l)),null===l?null:(o&&(l="week"!==o||!N(r)&&!0!==r?i.startOf(l,o):i.startOf(l,"isoWeek",r)),+l)}function Bo(t,e,i,s){const n=zo.length;for(let o=zo.indexOf(t);o<n-1;++o){const t=Io[zo[o]],n=t.steps?t.steps:Number.MAX_SAFE_INTEGER;if(t.common&&Math.ceil((i-e)/(n*t.size))<=s)return zo[o]}return zo[n-1]}function Wo(t,e,i){if(i){if(i.length){const{lo:s,hi:n}=et(i,e);t[i[s]>=e?i[s]:i[n]]=!0}}else t[e]=!0}function No(t,e,i){const s=[],n={},o=e.length;let a,r;for(a=0;a<o;++a)r=e[a],n[r]=a,s.push({value:r,major:!1});return 0!==o&&i?function(t,e,i,s){const n=t._adapter,o=+n.startOf(e[0].value,s),a=e[e.length-1].value;let r,l;for(r=o;r<=a;r=+n.add(r,1,s))l=i[r],l>=0&&(e[l].major=!0);return e}(t,s,n,i):s}class Ho extends tn{static id="time";static defaults={bounds:"data",adapters:{},time:{parser:!1,unit:!1,round:!1,isoWeekday:!1,minUnit:"millisecond",displayFormats:{}},ticks:{source:"auto",callback:!1,major:{enabled:!1}}};constructor(t){super(t),this._cache={data:[],labels:[],all:[]},this._unit="day",this._majorUnit=void 0,this._offsets={},this._normalized=!1,this._parseOpts=void 0}init(t,e={}){const i=t.time||(t.time={}),s=this._adapter=new In._date(t.adapters.date);s.init(e),b(i.displayFormats,s.formats()),this._parseOpts={parser:i.parser,round:i.round,isoWeekday:i.isoWeekday},super.init(t),this._normalized=e.normalized}parse(t,e){return void 0===t?null:Vo(this,t)}beforeLayout(){super.beforeLayout(),this._cache={data:[],labels:[],all:[]}}determineDataLimits(){const t=this.options,e=this._adapter,i=t.time.unit||"day";let{min:s,max:n,minDefined:o,maxDefined:r}=this.getUserBounds();function l(t){o||isNaN(t.min)||(s=Math.min(s,t.min)),r||isNaN(t.max)||(n=Math.max(n,t.max))}o&&r||(l(this._getLabelBounds()),"ticks"===t.bounds&&"labels"===t.ticks.source||l(this.getMinMax(!1))),s=a(s)&&!isNaN(s)?s:+e.startOf(Date.now(),i),n=a(n)&&!isNaN(n)?n:+e.endOf(Date.now(),i)+1,this.min=Math.min(s,n-1),this.max=Math.max(s+1,n)}_getLabelBounds(){const t=this.getLabelTimestamps();let e=Number.POSITIVE_INFINITY,i=Number.NEGATIVE_INFINITY;return t.length&&(e=t[0],i=t[t.length-1]),{min:e,max:i}}buildTicks(){const t=this.options,e=t.time,i=t.ticks,s="labels"===i.source?this.getLabelTimestamps():this._generate();"ticks"===t.bounds&&s.length&&(this.min=this._userMin||s[0],this.max=this._userMax||s[s.length-1]);const n=this.min,o=nt(s,n,this.max);return this._unit=e.unit||(i.autoSkip?Bo(e.minUnit,this.min,this.max,this._getLabelCapacity(n)):function(t,e,i,s,n){for(let o=zo.length-1;o>=zo.indexOf(i);o--){const i=zo[o];if(Io[i].common&&t._adapter.diff(n,s,i)>=e-1)return i}return zo[i?zo.indexOf(i):0]}(this,o.length,e.minUnit,this.min,this.max)),this._majorUnit=i.major.enabled&&"year"!==this._unit?function(t){for(let e=zo.indexOf(t)+1,i=zo.length;e<i;++e)if(Io[zo[e]].common)return zo[e]}(this._unit):void 0,this.initOffsets(s),t.reverse&&o.reverse(),No(this,o,this._majorUnit)}afterAutoSkip(){this.options.offsetAfterAutoskip&&this.initOffsets(this.ticks.map((t=>+t.value)))}initOffsets(t=[]){let e,i,s=0,n=0;this.options.offset&&t.length&&(e=this.getDecimalForValue(t[0]),s=1===t.length?1-e:(this.getDecimalForValue(t[1])-e)/2,i=this.getDecimalForValue(t[t.length-1]),n=1===t.length?i:(i-this.getDecimalForValue(t[t.length-2]))/2);const o=t.length<3?.5:.25;s=Z(s,0,o),n=Z(n,0,o),this._offsets={start:s,end:n,factor:1/(s+1+n)}}_generate(){const t=this._adapter,e=this.min,i=this.max,s=this.options,n=s.time,o=n.unit||Bo(n.minUnit,e,i,this._getLabelCapacity(e)),a=l(s.ticks.stepSize,1),r="week"===o&&n.isoWeekday,h=N(r)||!0===r,c={};let d,u,f=e;if(h&&(f=+t.startOf(f,"isoWeek",r)),f=+t.startOf(f,h?"day":o),t.diff(i,e,o)>1e5*a)throw new Error(e+" and "+i+" are too far apart with stepSize of "+a+" "+o);const g="data"===s.ticks.source&&this.getDataTimestamps();for(d=f,u=0;d<i;d=+t.add(d,a,o),u++)Wo(c,d,g);return d!==i&&"ticks"!==s.bounds&&1!==u||Wo(c,d,g),Object.keys(c).sort(Fo).map((t=>+t))}getLabelForValue(t){const e=this._adapter,i=this.options.time;return i.tooltipFormat?e.format(t,i.tooltipFormat):e.format(t,i.displayFormats.datetime)}format(t,e){const i=this.options.time.displayFormats,s=this._unit,n=e||i[s];return this._adapter.format(t,n)}_tickFormatFunction(t,e,i,s){const n=this.options,o=n.ticks.callback;if(o)return d(o,[t,e,i],this);const a=n.time.displayFormats,r=this._unit,l=this._majorUnit,h=r&&a[r],c=l&&a[l],u=i[e],f=l&&c&&u&&u.major;return this._adapter.format(t,s||(f?c:h))}generateTickLabels(t){let e,i,s;for(e=0,i=t.length;e<i;++e)s=t[e],s.label=this._tickFormatFunction(s.value,e,t)}getDecimalForValue(t){return null===t?NaN:(t-this.min)/(this.max-this.min)}getPixelForValue(t){const e=this._offsets,i=this.getDecimalForValue(t);return this.getPixelForDecimal((e.start+i)*e.factor)}getValueForPixel(t){const e=this._offsets,i=this.getDecimalForPixel(t)/e.factor-e.end;return this.min+i*(this.max-this.min)}_getLabelSize(t){const e=this.options.ticks,i=this.ctx.measureText(t).width,s=$(this.isHorizontal()?e.maxRotation:e.minRotation),n=Math.cos(s),o=Math.sin(s),a=this._resolveTickFontOptions(0).size;return{w:i*n+a*o,h:i*o+a*n}}_getLabelCapacity(t){const e=this.options.time,i=e.displayFormats,s=i[e.unit]||i.millisecond,n=this._tickFormatFunction(t,0,No(this,[t],this._majorUnit),s),o=this._getLabelSize(n),a=Math.floor(this.isHorizontal()?this.width/o.w:this.height/o.h)-1;return a>0?a:1}getDataTimestamps(){let t,e,i=this._cache.data||[];if(i.length)return i;const s=this.getMatchingVisibleMetas();if(this._normalized&&s.length)return this._cache.data=s[0].controller.getAllParsedValues(this);for(t=0,e=s.length;t<e;++t)i=i.concat(s[t].controller.getAllParsedValues(this));return this._cache.data=this.normalize(i)}getLabelTimestamps(){const t=this._cache.labels||[];let e,i;if(t.length)return t;const s=this.getLabels();for(e=0,i=s.length;e<i;++e)t.push(Vo(this,s[e]));return this._cache.labels=this._normalized?t:this.normalize(t)}normalize(t){return lt(t.sort(Fo))}}function jo(t,e,i){let s,n,o,a,r=0,l=t.length-1;i?(e>=t[r].pos&&e<=t[l].pos&&({lo:r,hi:l}=it(t,"pos",e)),({pos:s,time:o}=t[r]),({pos:n,time:a}=t[l])):(e>=t[r].time&&e<=t[l].time&&({lo:r,hi:l}=it(t,"time",e)),({time:s,pos:o}=t[r]),({time:n,pos:a}=t[l]));const h=n-s;return h?o+(a-o)*(e-s)/h:o}var $o=Object.freeze({__proto__:null,CategoryScale:class extends tn{static id="category";static defaults={ticks:{callback:mo}};constructor(t){super(t),this._startValue=void 0,this._valueRange=0,this._addedLabels=[]}init(t){const e=this._addedLabels;if(e.length){const t=this.getLabels();for(const{index:i,label:s}of e)t[i]===s&&t.splice(i,1);this._addedLabels=[]}super.init(t)}parse(t,e){if(s(t))return null;const i=this.getLabels();return((t,e)=>null===t?null:Z(Math.round(t),0,e))(e=isFinite(e)&&i[e]===t?e:po(i,t,l(e,t),this._addedLabels),i.length-1)}determineDataLimits(){const{minDefined:t,maxDefined:e}=this.getUserBounds();let{min:i,max:s}=this.getMinMax(!0);"ticks"===this.options.bounds&&(t||(i=0),e||(s=this.getLabels().length-1)),this.min=i,this.max=s}buildTicks(){const t=this.min,e=this.max,i=this.options.offset,s=[];let n=this.getLabels();n=0===t&&e===n.length-1?n:n.slice(t,e+1),this._valueRange=Math.max(n.length-(i?0:1),1),this._startValue=this.min-(i?.5:0);for(let i=t;i<=e;i++)s.push({value:i});return s}getLabelForValue(t){return mo.call(this,t)}configure(){super.configure(),this.isHorizontal()||(this._reversePixels=!this._reversePixels)}getPixelForValue(t){return"number"!=typeof t&&(t=this.parse(t)),null===t?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getPixelForTick(t){const e=this.ticks;return t<0||t>e.length-1?null:this.getPixelForValue(e[t].value)}getValueForPixel(t){return Math.round(this._startValue+this.getDecimalForPixel(t)*this._valueRange)}getBasePixel(){return this.bottom}},LinearScale:_o,LogarithmicScale:So,RadialLinearScale:Ro,TimeScale:Ho,TimeSeriesScale:class extends Ho{static id="timeseries";static defaults=Ho.defaults;constructor(t){super(t),this._table=[],this._minPos=void 0,this._tableRange=void 0}initOffsets(){const t=this._getTimestampsForTable(),e=this._table=this.buildLookupTable(t);this._minPos=jo(e,this.min),this._tableRange=jo(e,this.max)-this._minPos,super.initOffsets(t)}buildLookupTable(t){const{min:e,max:i}=this,s=[],n=[];let o,a,r,l,h;for(o=0,a=t.length;o<a;++o)l=t[o],l>=e&&l<=i&&s.push(l);if(s.length<2)return[{time:e,pos:0},{time:i,pos:1}];for(o=0,a=s.length;o<a;++o)h=s[o+1],r=s[o-1],l=s[o],Math.round((h+r)/2)!==l&&n.push({time:l,pos:o/(a-1)});return n}_generate(){const t=this.min,e=this.max;let i=super.getDataTimestamps();return i.includes(t)&&i.length||i.splice(0,0,t),i.includes(e)&&1!==i.length||i.push(e),i.sort(((t,e)=>t-e))}_getTimestampsForTable(){let t=this._cache.all||[];if(t.length)return t;const e=this.getDataTimestamps(),i=this.getLabelTimestamps();return t=e.length&&i.length?this.normalize(e.concat(i)):e.length?e:i,t=this._cache.all=t,t}getDecimalForValue(t){return(jo(this._table,t)-this._minPos)/this._tableRange}getValueForPixel(t){const e=this._offsets,i=this.getDecimalForPixel(t)/e.factor-e.end;return jo(this._table,i*this._tableRange+this._minPos,!0)}}});const Yo=["rgb(54, 162, 235)","rgb(255, 99, 132)","rgb(255, 159, 64)","rgb(255, 205, 86)","rgb(75, 192, 192)","rgb(153, 102, 255)","rgb(201, 203, 207)"],Uo=Yo.map((t=>t.replace("rgb(","rgba(").replace(")",", 0.5)")));function Xo(t){return Yo[t%Yo.length]}function qo(t){return Uo[t%Uo.length]}function Ko(t){let e=0;return(i,s)=>{const n=t.getDatasetMeta(s).controller;n instanceof $n?e=function(t,e){return t.backgroundColor=t.data.map((()=>Xo(e++))),e}(i,e):n instanceof Yn?e=function(t,e){return t.backgroundColor=t.data.map((()=>qo(e++))),e}(i,e):n&&(e=function(t,e){return t.borderColor=Xo(e),t.backgroundColor=qo(e),++e}(i,e))}}function Go(t){let e;for(e in t)if(t[e].borderColor||t[e].backgroundColor)return!0;return!1}var Jo={id:"colors",defaults:{enabled:!0,forceOverride:!1},beforeLayout(t,e,i){if(!i.enabled)return;const{data:{datasets:s},options:n}=t.config,{elements:o}=n,a=Go(s)||(r=n)&&(r.borderColor||r.backgroundColor)||o&&Go(o)||"rgba(0,0,0,0.1)"!==ue.borderColor||"rgba(0,0,0,0.1)"!==ue.backgroundColor;var r;if(!i.forceOverride&&a)return;const l=Ko(t);s.forEach(l)}};function Zo(t){if(t._decimated){const e=t._data;delete t._decimated,delete t._data,Object.defineProperty(t,"data",{configurable:!0,enumerable:!0,writable:!0,value:e})}}function Qo(t){t.data.datasets.forEach((t=>{Zo(t)}))}var ta={id:"decimation",defaults:{algorithm:"min-max",enabled:!1},beforeElementsUpdate:(t,e,i)=>{if(!i.enabled)return void Qo(t);const n=t.width;t.data.datasets.forEach(((e,o)=>{const{_data:a,indexAxis:r}=e,l=t.getDatasetMeta(o),h=a||e.data;if("y"===Pi([r,t.options.indexAxis]))return;if(!l.controller.supportsDecimation)return;const c=t.scales[l.xAxisID];if("linear"!==c.type&&"time"!==c.type)return;if(t.options.parsing)return;let{start:d,count:u}=function(t,e){const i=e.length;let s,n=0;const{iScale:o}=t,{min:a,max:r,minDefined:l,maxDefined:h}=o.getUserBounds();return l&&(n=Z(it(e,o.axis,a).lo,0,i-1)),s=h?Z(it(e,o.axis,r).hi+1,n,i)-n:i-n,{start:n,count:s}}(l,h);if(u<=(i.threshold||4*n))return void Zo(e);let f;switch(s(a)&&(e._data=h,delete e.data,Object.defineProperty(e,"data",{configurable:!0,enumerable:!0,get:function(){return this._decimated},set:function(t){this._data=t}})),i.algorithm){case"lttb":f=function(t,e,i,s,n){const o=n.samples||s;if(o>=i)return t.slice(e,e+i);const a=[],r=(i-2)/(o-2);let l=0;const h=e+i-1;let c,d,u,f,g,p=e;for(a[l++]=t[p],c=0;c<o-2;c++){let s,n=0,o=0;const h=Math.floor((c+1)*r)+1+e,m=Math.min(Math.floor((c+2)*r)+1,i)+e,x=m-h;for(s=h;s<m;s++)n+=t[s].x,o+=t[s].y;n/=x,o/=x;const b=Math.floor(c*r)+1+e,_=Math.min(Math.floor((c+1)*r)+1,i)+e,{x:y,y:v}=t[p];for(u=f=-1,s=b;s<_;s++)f=.5*Math.abs((y-n)*(t[s].y-v)-(y-t[s].x)*(o-v)),f>u&&(u=f,d=t[s],g=s);a[l++]=d,p=g}return a[l++]=t[h],a}(h,d,u,n,i);break;case"min-max":f=function(t,e,i,n){let o,a,r,l,h,c,d,u,f,g,p=0,m=0;const x=[],b=e+i-1,_=t[e].x,y=t[b].x-_;for(o=e;o<e+i;++o){a=t[o],r=(a.x-_)/y*n,l=a.y;const e=0|r;if(e===h)l<f?(f=l,c=o):l>g&&(g=l,d=o),p=(m*p+a.x)/++m;else{const i=o-1;if(!s(c)&&!s(d)){const e=Math.min(c,d),s=Math.max(c,d);e!==u&&e!==i&&x.push({...t[e],x:p}),s!==u&&s!==i&&x.push({...t[s],x:p})}o>0&&i!==u&&x.push(t[i]),x.push(a),h=e,m=0,f=g=l,c=d=u=o}}return x}(h,d,u,n);break;default:throw new Error(`Unsupported decimation algorithm '${i.algorithm}'`)}e._decimated=f}))},destroy(t){Qo(t)}};function ea(t,e,i,s){if(s)return;let n=e[t],o=i[t];return"angle"===t&&(n=G(n),o=G(o)),{property:t,start:n,end:o}}function ia(t,e,i){for(;e>t;e--){const t=i[e];if(!isNaN(t.x)&&!isNaN(t.y))break}return e}function sa(t,e,i,s){return t&&e?s(t[i],e[i]):t?t[i]:e?e[i]:0}function na(t,e){let i=[],s=!1;return n(t)?(s=!0,i=t):i=function(t,e){const{x:i=null,y:s=null}=t||{},n=e.points,o=[];return e.segments.forEach((({start:t,end:e})=>{e=ia(t,e,n);const a=n[t],r=n[e];null!==s?(o.push({x:a.x,y:s}),o.push({x:r.x,y:s})):null!==i&&(o.push({x:i,y:a.y}),o.push({x:i,y:r.y}))})),o}(t,e),i.length?new oo({points:i,options:{tension:0},_loop:s,_fullLoop:s}):null}function oa(t){return t&&!1!==t.fill}function aa(t,e,i){let s=t[e].fill;const n=[e];let o;if(!i)return s;for(;!1!==s&&-1===n.indexOf(s);){if(!a(s))return s;if(o=t[s],!o)return!1;if(o.visible)return s;n.push(s),s=o.fill}return!1}function ra(t,e,i){const s=function(t){const e=t.options,i=e.fill;let s=l(i&&i.target,i);void 0===s&&(s=!!e.backgroundColor);if(!1===s||null===s)return!1;if(!0===s)return"origin";return s}(t);if(o(s))return!isNaN(s.value)&&s;let n=parseFloat(s);return a(n)&&Math.floor(n)===n?function(t,e,i,s){"-"!==t&&"+"!==t||(i=e+i);if(i===e||i<0||i>=s)return!1;return i}(s[0],e,n,i):["origin","start","end","stack","shape"].indexOf(s)>=0&&s}function la(t,e,i){const s=[];for(let n=0;n<i.length;n++){const o=i[n],{first:a,last:r,point:l}=ha(o,e,"x");if(!(!l||a&&r))if(a)s.unshift(l);else if(t.push(l),!r)break}t.push(...s)}function ha(t,e,i){const s=t.interpolate(e,i);if(!s)return{};const n=s[i],o=t.segments,a=t.points;let r=!1,l=!1;for(let t=0;t<o.length;t++){const e=o[t],s=a[e.start][i],h=a[e.end][i];if(tt(n,s,h)){r=n===s,l=n===h;break}}return{first:r,last:l,point:s}}class ca{constructor(t){this.x=t.x,this.y=t.y,this.radius=t.radius}pathSegment(t,e,i){const{x:s,y:n,radius:o}=this;return e=e||{start:0,end:O},t.arc(s,n,o,e.end,e.start,!0),!i.bounds}interpolate(t){const{x:e,y:i,radius:s}=this,n=t.angle;return{x:e+Math.cos(n)*s,y:i+Math.sin(n)*s,angle:n}}}function da(t){const{chart:e,fill:i,line:s}=t;if(a(i))return function(t,e){const i=t.getDatasetMeta(e),s=i&&t.isDatasetVisible(e);return s?i.dataset:null}(e,i);if("stack"===i)return function(t){const{scale:e,index:i,line:s}=t,n=[],o=s.segments,a=s.points,r=function(t,e){const i=[],s=t.getMatchingVisibleMetas("line");for(let t=0;t<s.length;t++){const n=s[t];if(n.index===e)break;n.hidden||i.unshift(n.dataset)}return i}(e,i);r.push(na({x:null,y:e.bottom},s));for(let t=0;t<o.length;t++){const e=o[t];for(let t=e.start;t<=e.end;t++)la(n,a[t],r)}return new oo({points:n,options:{}})}(t);if("shape"===i)return!0;const n=function(t){const e=t.scale||{};if(e.getPointPositionForValue)return function(t){const{scale:e,fill:i}=t,s=e.options,n=e.getLabels().length,a=s.reverse?e.max:e.min,r=function(t,e,i){let s;return s="start"===t?i:"end"===t?e.options.reverse?e.min:e.max:o(t)?t.value:e.getBaseValue(),s}(i,e,a),l=[];if(s.grid.circular){const t=e.getPointPositionForValue(0,a);return new ca({x:t.x,y:t.y,radius:e.getDistanceFromCenterForValue(r)})}for(let t=0;t<n;++t)l.push(e.getPointPositionForValue(t,r));return l}(t);return function(t){const{scale:e={},fill:i}=t,s=function(t,e){let i=null;return"start"===t?i=e.bottom:"end"===t?i=e.top:o(t)?i=e.getPixelForValue(t.value):e.getBasePixel&&(i=e.getBasePixel()),i}(i,e);if(a(s)){const t=e.isHorizontal();return{x:t?s:null,y:t?null:s}}return null}(t)}(t);return n instanceof ca?n:na(n,s)}function ua(t,e,i){const s=da(e),{chart:n,index:o,line:a,scale:r,axis:l}=e,h=a.options,c=h.fill,d=h.backgroundColor,{above:u=d,below:f=d}=c||{},g=n.getDatasetMeta(o),p=Ni(n,g);s&&a.points.length&&(Ie(t,i),function(t,e){const{line:i,target:s,above:n,below:o,area:a,scale:r,clip:l}=e,h=i._loop?"angle":e.axis;t.save();let c=o;o!==n&&("x"===h?(fa(t,s,a.top),pa(t,{line:i,target:s,color:n,scale:r,property:h,clip:l}),t.restore(),t.save(),fa(t,s,a.bottom)):"y"===h&&(ga(t,s,a.left),pa(t,{line:i,target:s,color:o,scale:r,property:h,clip:l}),t.restore(),t.save(),ga(t,s,a.right),c=n));pa(t,{line:i,target:s,color:c,scale:r,property:h,clip:l}),t.restore()}(t,{line:a,target:s,above:u,below:f,area:i,scale:r,axis:l,clip:p}),ze(t))}function fa(t,e,i){const{segments:s,points:n}=e;let o=!0,a=!1;t.beginPath();for(const r of s){const{start:s,end:l}=r,h=n[s],c=n[ia(s,l,n)];o?(t.moveTo(h.x,h.y),o=!1):(t.lineTo(h.x,i),t.lineTo(h.x,h.y)),a=!!e.pathSegment(t,r,{move:a}),a?t.closePath():t.lineTo(c.x,i)}t.lineTo(e.first().x,i),t.closePath(),t.clip()}function ga(t,e,i){const{segments:s,points:n}=e;let o=!0,a=!1;t.beginPath();for(const r of s){const{start:s,end:l}=r,h=n[s],c=n[ia(s,l,n)];o?(t.moveTo(h.x,h.y),o=!1):(t.lineTo(i,h.y),t.lineTo(h.x,h.y)),a=!!e.pathSegment(t,r,{move:a}),a?t.closePath():t.lineTo(i,c.y)}t.lineTo(i,e.first().y),t.closePath(),t.clip()}function pa(t,e){const{line:i,target:s,property:n,color:o,scale:a,clip:r}=e,l=function(t,e,i){const s=t.segments,n=t.points,o=e.points,a=[];for(const t of s){let{start:s,end:r}=t;r=ia(s,r,n);const l=ea(i,n[s],n[r],t.loop);if(!e.segments){a.push({source:t,target:l,start:n[s],end:n[r]});continue}const h=Ii(e,l);for(const e of h){const s=ea(i,o[e.start],o[e.end],e.loop),r=Ri(t,n,s);for(const t of r)a.push({source:t,target:e,start:{[i]:sa(l,s,"start",Math.max)},end:{[i]:sa(l,s,"end",Math.min)}})}}return a}(i,s,n);for(const{source:e,target:h,start:c,end:d}of l){const{style:{backgroundColor:l=o}={}}=e,u=!0!==s;t.save(),t.fillStyle=l,ma(t,a,r,u&&ea(n,c,d)),t.beginPath();const f=!!i.pathSegment(t,e);let g;if(u){f?t.closePath():xa(t,s,d,n);const e=!!s.pathSegment(t,h,{move:f,reverse:!0});g=f&&e,g||xa(t,s,c,n)}t.closePath(),t.fill(g?"evenodd":"nonzero"),t.restore()}}function ma(t,e,i,s){const n=e.chart.chartArea,{property:o,start:a,end:r}=s||{};if("x"===o||"y"===o){let e,s,l,h;"x"===o?(e=a,s=n.top,l=r,h=n.bottom):(e=n.left,s=a,l=n.right,h=r),t.beginPath(),i&&(e=Math.max(e,i.left),l=Math.min(l,i.right),s=Math.max(s,i.top),h=Math.min(h,i.bottom)),t.rect(e,s,l-e,h-s),t.clip()}}function xa(t,e,i,s){const n=e.interpolate(i,s);n&&t.lineTo(n.x,n.y)}var ba={id:"filler",afterDatasetsUpdate(t,e,i){const s=(t.data.datasets||[]).length,n=[];let o,a,r,l;for(a=0;a<s;++a)o=t.getDatasetMeta(a),r=o.dataset,l=null,r&&r.options&&r instanceof oo&&(l={visible:t.isDatasetVisible(a),index:a,fill:ra(r,a,s),chart:t,axis:o.controller.options.indexAxis,scale:o.vScale,line:r}),o.$filler=l,n.push(l);for(a=0;a<s;++a)l=n[a],l&&!1!==l.fill&&(l.fill=aa(n,a,i.propagate))},beforeDraw(t,e,i){const s="beforeDraw"===i.drawTime,n=t.getSortedVisibleDatasetMetas(),o=t.chartArea;for(let e=n.length-1;e>=0;--e){const i=n[e].$filler;i&&(i.line.updateControlPoints(o,i.axis),s&&i.fill&&ua(t.ctx,i,o))}},beforeDatasetsDraw(t,e,i){if("beforeDatasetsDraw"!==i.drawTime)return;const s=t.getSortedVisibleDatasetMetas();for(let e=s.length-1;e>=0;--e){const i=s[e].$filler;oa(i)&&ua(t.ctx,i,t.chartArea)}},beforeDatasetDraw(t,e,i){const s=e.meta.$filler;oa(s)&&"beforeDatasetDraw"===i.drawTime&&ua(t.ctx,s,t.chartArea)},defaults:{propagate:!0,drawTime:"beforeDatasetDraw"}};const _a=(t,e)=>{let{boxHeight:i=e,boxWidth:s=e}=t;return t.usePointStyle&&(i=Math.min(i,e),s=t.pointStyleWidth||Math.min(s,e)),{boxWidth:s,boxHeight:i,itemHeight:Math.max(e,i)}};class ya extends $s{constructor(t){super(),this._added=!1,this.legendHitBoxes=[],this._hoveredItem=null,this.doughnutMode=!1,this.chart=t.chart,this.options=t.options,this.ctx=t.ctx,this.legendItems=void 0,this.columnSizes=void 0,this.lineWidths=void 0,this.maxHeight=void 0,this.maxWidth=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.height=void 0,this.width=void 0,this._margins=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(t,e,i){this.maxWidth=t,this.maxHeight=e,this._margins=i,this.setDimensions(),this.buildLabels(),this.fit()}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=this._margins.left,this.right=this.width):(this.height=this.maxHeight,this.top=this._margins.top,this.bottom=this.height)}buildLabels(){const t=this.options.labels||{};let e=d(t.generateLabels,[this.chart],this)||[];t.filter&&(e=e.filter((e=>t.filter(e,this.chart.data)))),t.sort&&(e=e.sort(((e,i)=>t.sort(e,i,this.chart.data)))),this.options.reverse&&e.reverse(),this.legendItems=e}fit(){const{options:t,ctx:e}=this;if(!t.display)return void(this.width=this.height=0);const i=t.labels,s=Si(i.font),n=s.size,o=this._computeTitleHeight(),{boxWidth:a,itemHeight:r}=_a(i,n);let l,h;e.font=s.string,this.isHorizontal()?(l=this.maxWidth,h=this._fitRows(o,n,a,r)+10):(h=this.maxHeight,l=this._fitCols(o,s,a,r)+10),this.width=Math.min(l,t.maxWidth||this.maxWidth),this.height=Math.min(h,t.maxHeight||this.maxHeight)}_fitRows(t,e,i,s){const{ctx:n,maxWidth:o,options:{labels:{padding:a}}}=this,r=this.legendHitBoxes=[],l=this.lineWidths=[0],h=s+a;let c=t;n.textAlign="left",n.textBaseline="middle";let d=-1,u=-h;return this.legendItems.forEach(((t,f)=>{const g=i+e/2+n.measureText(t.text).width;(0===f||l[l.length-1]+g+2*a>o)&&(c+=h,l[l.length-(f>0?0:1)]=0,u+=h,d++),r[f]={left:0,top:u,row:d,width:g,height:s},l[l.length-1]+=g+a})),c}_fitCols(t,e,i,s){const{ctx:n,maxHeight:o,options:{labels:{padding:a}}}=this,r=this.legendHitBoxes=[],l=this.columnSizes=[],h=o-t;let c=a,d=0,u=0,f=0,g=0;return this.legendItems.forEach(((t,o)=>{const{itemWidth:p,itemHeight:m}=function(t,e,i,s,n){const o=function(t,e,i,s){let n=t.text;n&&"string"!=typeof n&&(n=n.reduce(((t,e)=>t.length>e.length?t:e)));return e+i.size/2+s.measureText(n).width}(s,t,e,i),a=function(t,e,i){let s=t;"string"!=typeof e.text&&(s=va(e,i));return s}(n,s,e.lineHeight);return{itemWidth:o,itemHeight:a}}(i,e,n,t,s);o>0&&u+m+2*a>h&&(c+=d+a,l.push({width:d,height:u}),f+=d+a,g++,d=u=0),r[o]={left:f,top:u,col:g,width:p,height:m},d=Math.max(d,p),u+=m+a})),c+=d,l.push({width:d,height:u}),c}adjustHitBoxes(){if(!this.options.display)return;const t=this._computeTitleHeight(),{legendHitBoxes:e,options:{align:i,labels:{padding:s},rtl:n}}=this,o=Oi(n,this.left,this.width);if(this.isHorizontal()){let n=0,a=ft(i,this.left+s,this.right-this.lineWidths[n]);for(const r of e)n!==r.row&&(n=r.row,a=ft(i,this.left+s,this.right-this.lineWidths[n])),r.top+=this.top+t+s,r.left=o.leftForLtr(o.x(a),r.width),a+=r.width+s}else{let n=0,a=ft(i,this.top+t+s,this.bottom-this.columnSizes[n].height);for(const r of e)r.col!==n&&(n=r.col,a=ft(i,this.top+t+s,this.bottom-this.columnSizes[n].height)),r.top=a,r.left+=this.left+s,r.left=o.leftForLtr(o.x(r.left),r.width),a+=r.height+s}}isHorizontal(){return"top"===this.options.position||"bottom"===this.options.position}draw(){if(this.options.display){const t=this.ctx;Ie(t,this),this._draw(),ze(t)}}_draw(){const{options:t,columnSizes:e,lineWidths:i,ctx:s}=this,{align:n,labels:o}=t,a=ue.color,r=Oi(t.rtl,this.left,this.width),h=Si(o.font),{padding:c}=o,d=h.size,u=d/2;let f;this.drawTitle(),s.textAlign=r.textAlign("left"),s.textBaseline="middle",s.lineWidth=.5,s.font=h.string;const{boxWidth:g,boxHeight:p,itemHeight:m}=_a(o,d),x=this.isHorizontal(),b=this._computeTitleHeight();f=x?{x:ft(n,this.left+c,this.right-i[0]),y:this.top+c+b,line:0}:{x:this.left+c,y:ft(n,this.top+b+c,this.bottom-e[0].height),line:0},Ai(this.ctx,t.textDirection);const _=m+c;this.legendItems.forEach(((y,v)=>{s.strokeStyle=y.fontColor,s.fillStyle=y.fontColor;const M=s.measureText(y.text).width,w=r.textAlign(y.textAlign||(y.textAlign=o.textAlign)),k=g+u+M;let S=f.x,P=f.y;r.setWidth(this.width),x?v>0&&S+k+c>this.right&&(P=f.y+=_,f.line++,S=f.x=ft(n,this.left+c,this.right-i[f.line])):v>0&&P+_>this.bottom&&(S=f.x=S+e[f.line].width+c,f.line++,P=f.y=ft(n,this.top+b+c,this.bottom-e[f.line].height));if(function(t,e,i){if(isNaN(g)||g<=0||isNaN(p)||p<0)return;s.save();const n=l(i.lineWidth,1);if(s.fillStyle=l(i.fillStyle,a),s.lineCap=l(i.lineCap,"butt"),s.lineDashOffset=l(i.lineDashOffset,0),s.lineJoin=l(i.lineJoin,"miter"),s.lineWidth=n,s.strokeStyle=l(i.strokeStyle,a),s.setLineDash(l(i.lineDash,[])),o.usePointStyle){const a={radius:p*Math.SQRT2/2,pointStyle:i.pointStyle,rotation:i.rotation,borderWidth:n},l=r.xPlus(t,g/2);Ee(s,a,l,e+u,o.pointStyleWidth&&g)}else{const o=e+Math.max((d-p)/2,0),a=r.leftForLtr(t,g),l=wi(i.borderRadius);s.beginPath(),Object.values(l).some((t=>0!==t))?He(s,{x:a,y:o,w:g,h:p,radius:l}):s.rect(a,o,g,p),s.fill(),0!==n&&s.stroke()}s.restore()}(r.x(S),P,y),S=gt(w,S+g+u,x?S+k:this.right,t.rtl),function(t,e,i){Ne(s,i.text,t,e+m/2,h,{strikethrough:i.hidden,textAlign:r.textAlign(i.textAlign)})}(r.x(S),P,y),x)f.x+=k+c;else if("string"!=typeof y.text){const t=h.lineHeight;f.y+=va(y,t)+c}else f.y+=_})),Ti(this.ctx,t.textDirection)}drawTitle(){const t=this.options,e=t.title,i=Si(e.font),s=ki(e.padding);if(!e.display)return;const n=Oi(t.rtl,this.left,this.width),o=this.ctx,a=e.position,r=i.size/2,l=s.top+r;let h,c=this.left,d=this.width;if(this.isHorizontal())d=Math.max(...this.lineWidths),h=this.top+l,c=ft(t.align,c,this.right-d);else{const e=this.columnSizes.reduce(((t,e)=>Math.max(t,e.height)),0);h=l+ft(t.align,this.top,this.bottom-e-t.labels.padding-this._computeTitleHeight())}const u=ft(a,c,c+d);o.textAlign=n.textAlign(ut(a)),o.textBaseline="middle",o.strokeStyle=e.color,o.fillStyle=e.color,o.font=i.string,Ne(o,e.text,u,h,i)}_computeTitleHeight(){const t=this.options.title,e=Si(t.font),i=ki(t.padding);return t.display?e.lineHeight+i.height:0}_getLegendItemAt(t,e){let i,s,n;if(tt(t,this.left,this.right)&&tt(e,this.top,this.bottom))for(n=this.legendHitBoxes,i=0;i<n.length;++i)if(s=n[i],tt(t,s.left,s.left+s.width)&&tt(e,s.top,s.top+s.height))return this.legendItems[i];return null}handleEvent(t){const e=this.options;if(!function(t,e){if(("mousemove"===t||"mouseout"===t)&&(e.onHover||e.onLeave))return!0;if(e.onClick&&("click"===t||"mouseup"===t))return!0;return!1}(t.type,e))return;const i=this._getLegendItemAt(t.x,t.y);if("mousemove"===t.type||"mouseout"===t.type){const o=this._hoveredItem,a=(n=i,null!==(s=o)&&null!==n&&s.datasetIndex===n.datasetIndex&&s.index===n.index);o&&!a&&d(e.onLeave,[t,o,this],this),this._hoveredItem=i,i&&!a&&d(e.onHover,[t,i,this],this)}else i&&d(e.onClick,[t,i,this],this);var s,n}}function va(t,e){return e*(t.text?t.text.length:0)}var Ma={id:"legend",_element:ya,start(t,e,i){const s=t.legend=new ya({ctx:t.ctx,options:i,chart:t});ls.configure(t,s,i),ls.addBox(t,s)},stop(t){ls.removeBox(t,t.legend),delete t.legend},beforeUpdate(t,e,i){const s=t.legend;ls.configure(t,s,i),s.options=i},afterUpdate(t){const e=t.legend;e.buildLabels(),e.adjustHitBoxes()},afterEvent(t,e){e.replay||t.legend.handleEvent(e.event)},defaults:{display:!0,position:"top",align:"center",fullSize:!0,reverse:!1,weight:1e3,onClick(t,e,i){const s=e.datasetIndex,n=i.chart;n.isDatasetVisible(s)?(n.hide(s),e.hidden=!0):(n.show(s),e.hidden=!1)},onHover:null,onLeave:null,labels:{color:t=>t.chart.options.color,boxWidth:40,padding:10,generateLabels(t){const e=t.data.datasets,{labels:{usePointStyle:i,pointStyle:s,textAlign:n,color:o,useBorderRadius:a,borderRadius:r}}=t.legend.options;return t._getSortedDatasetMetas().map((t=>{const l=t.controller.getStyle(i?0:void 0),h=ki(l.borderWidth);return{text:e[t.index].label,fillStyle:l.backgroundColor,fontColor:o,hidden:!t.visible,lineCap:l.borderCapStyle,lineDash:l.borderDash,lineDashOffset:l.borderDashOffset,lineJoin:l.borderJoinStyle,lineWidth:(h.width+h.height)/4,strokeStyle:l.borderColor,pointStyle:s||l.pointStyle,rotation:l.rotation,textAlign:n||l.textAlign,borderRadius:a&&(r||l.borderRadius),datasetIndex:t.index}}),this)}},title:{color:t=>t.chart.options.color,display:!1,position:"center",text:""}},descriptors:{_scriptable:t=>!t.startsWith("on"),labels:{_scriptable:t=>!["generateLabels","filter","sort"].includes(t)}}};class wa extends $s{constructor(t){super(),this.chart=t.chart,this.options=t.options,this.ctx=t.ctx,this._padding=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(t,e){const i=this.options;if(this.left=0,this.top=0,!i.display)return void(this.width=this.height=this.right=this.bottom=0);this.width=this.right=t,this.height=this.bottom=e;const s=n(i.text)?i.text.length:1;this._padding=ki(i.padding);const o=s*Si(i.font).lineHeight+this._padding.height;this.isHorizontal()?this.height=o:this.width=o}isHorizontal(){const t=this.options.position;return"top"===t||"bottom"===t}_drawArgs(t){const{top:e,left:i,bottom:s,right:n,options:o}=this,a=o.align;let r,l,h,c=0;return this.isHorizontal()?(l=ft(a,i,n),h=e+t,r=n-i):("left"===o.position?(l=i+t,h=ft(a,s,e),c=-.5*C):(l=n-t,h=ft(a,e,s),c=.5*C),r=s-e),{titleX:l,titleY:h,maxWidth:r,rotation:c}}draw(){const t=this.ctx,e=this.options;if(!e.display)return;const i=Si(e.font),s=i.lineHeight/2+this._padding.top,{titleX:n,titleY:o,maxWidth:a,rotation:r}=this._drawArgs(s);Ne(t,e.text,0,0,i,{color:e.color,maxWidth:a,rotation:r,textAlign:ut(e.align),textBaseline:"middle",translation:[n,o]})}}var ka={id:"title",_element:wa,start(t,e,i){!function(t,e){const i=new wa({ctx:t.ctx,options:e,chart:t});ls.configure(t,i,e),ls.addBox(t,i),t.titleBlock=i}(t,i)},stop(t){const e=t.titleBlock;ls.removeBox(t,e),delete t.titleBlock},beforeUpdate(t,e,i){const s=t.titleBlock;ls.configure(t,s,i),s.options=i},defaults:{align:"center",display:!1,font:{weight:"bold"},fullSize:!0,padding:10,position:"top",text:"",weight:2e3},defaultRoutes:{color:"color"},descriptors:{_scriptable:!0,_indexable:!1}};const Sa=new WeakMap;var Pa={id:"subtitle",start(t,e,i){const s=new wa({ctx:t.ctx,options:i,chart:t});ls.configure(t,s,i),ls.addBox(t,s),Sa.set(t,s)},stop(t){ls.removeBox(t,Sa.get(t)),Sa.delete(t)},beforeUpdate(t,e,i){const s=Sa.get(t);ls.configure(t,s,i),s.options=i},defaults:{align:"center",display:!1,font:{weight:"normal"},fullSize:!0,padding:0,position:"top",text:"",weight:1500},defaultRoutes:{color:"color"},descriptors:{_scriptable:!0,_indexable:!1}};const Da={average(t){if(!t.length)return!1;let e,i,s=new Set,n=0,o=0;for(e=0,i=t.length;e<i;++e){const i=t[e].element;if(i&&i.hasValue()){const t=i.tooltipPosition();s.add(t.x),n+=t.y,++o}}if(0===o||0===s.size)return!1;return{x:[...s].reduce(((t,e)=>t+e))/s.size,y:n/o}},nearest(t,e){if(!t.length)return!1;let i,s,n,o=e.x,a=e.y,r=Number.POSITIVE_INFINITY;for(i=0,s=t.length;i<s;++i){const s=t[i].element;if(s&&s.hasValue()){const t=q(e,s.getCenterPoint());t<r&&(r=t,n=s)}}if(n){const t=n.tooltipPosition();o=t.x,a=t.y}return{x:o,y:a}}};function Ca(t,e){return e&&(n(e)?Array.prototype.push.apply(t,e):t.push(e)),t}function Oa(t){return("string"==typeof t||t instanceof String)&&t.indexOf("\n")>-1?t.split("\n"):t}function Aa(t,e){const{element:i,datasetIndex:s,index:n}=e,o=t.getDatasetMeta(s).controller,{label:a,value:r}=o.getLabelAndValue(n);return{chart:t,label:a,parsed:o.getParsed(n),raw:t.data.datasets[s].data[n],formattedValue:r,dataset:o.getDataset(),dataIndex:n,datasetIndex:s,element:i}}function Ta(t,e){const i=t.chart.ctx,{body:s,footer:n,title:o}=t,{boxWidth:a,boxHeight:r}=e,l=Si(e.bodyFont),h=Si(e.titleFont),c=Si(e.footerFont),d=o.length,f=n.length,g=s.length,p=ki(e.padding);let m=p.height,x=0,b=s.reduce(((t,e)=>t+e.before.length+e.lines.length+e.after.length),0);if(b+=t.beforeBody.length+t.afterBody.length,d&&(m+=d*h.lineHeight+(d-1)*e.titleSpacing+e.titleMarginBottom),b){m+=g*(e.displayColors?Math.max(r,l.lineHeight):l.lineHeight)+(b-g)*l.lineHeight+(b-1)*e.bodySpacing}f&&(m+=e.footerMarginTop+f*c.lineHeight+(f-1)*e.footerSpacing);let _=0;const y=function(t){x=Math.max(x,i.measureText(t).width+_)};return i.save(),i.font=h.string,u(t.title,y),i.font=l.string,u(t.beforeBody.concat(t.afterBody),y),_=e.displayColors?a+2+e.boxPadding:0,u(s,(t=>{u(t.before,y),u(t.lines,y),u(t.after,y)})),_=0,i.font=c.string,u(t.footer,y),i.restore(),x+=p.width,{width:x,height:m}}function La(t,e,i,s){const{x:n,width:o}=i,{width:a,chartArea:{left:r,right:l}}=t;let h="center";return"center"===s?h=n<=(r+l)/2?"left":"right":n<=o/2?h="left":n>=a-o/2&&(h="right"),function(t,e,i,s){const{x:n,width:o}=s,a=i.caretSize+i.caretPadding;return"left"===t&&n+o+a>e.width||"right"===t&&n-o-a<0||void 0}(h,t,e,i)&&(h="center"),h}function Ea(t,e,i){const s=i.yAlign||e.yAlign||function(t,e){const{y:i,height:s}=e;return i<s/2?"top":i>t.height-s/2?"bottom":"center"}(t,i);return{xAlign:i.xAlign||e.xAlign||La(t,e,i,s),yAlign:s}}function Ra(t,e,i,s){const{caretSize:n,caretPadding:o,cornerRadius:a}=t,{xAlign:r,yAlign:l}=i,h=n+o,{topLeft:c,topRight:d,bottomLeft:u,bottomRight:f}=wi(a);let g=function(t,e){let{x:i,width:s}=t;return"right"===e?i-=s:"center"===e&&(i-=s/2),i}(e,r);const p=function(t,e,i){let{y:s,height:n}=t;return"top"===e?s+=i:s-="bottom"===e?n+i:n/2,s}(e,l,h);return"center"===l?"left"===r?g+=h:"right"===r&&(g-=h):"left"===r?g-=Math.max(c,u)+n:"right"===r&&(g+=Math.max(d,f)+n),{x:Z(g,0,s.width-e.width),y:Z(p,0,s.height-e.height)}}function Ia(t,e,i){const s=ki(i.padding);return"center"===e?t.x+t.width/2:"right"===e?t.x+t.width-s.right:t.x+s.left}function za(t){return Ca([],Oa(t))}function Fa(t,e){const i=e&&e.dataset&&e.dataset.tooltip&&e.dataset.tooltip.callbacks;return i?t.override(i):t}const Va={beforeTitle:e,title(t){if(t.length>0){const e=t[0],i=e.chart.data.labels,s=i?i.length:0;if(this&&this.options&&"dataset"===this.options.mode)return e.dataset.label||"";if(e.label)return e.label;if(s>0&&e.dataIndex<s)return i[e.dataIndex]}return""},afterTitle:e,beforeBody:e,beforeLabel:e,label(t){if(this&&this.options&&"dataset"===this.options.mode)return t.label+": "+t.formattedValue||t.formattedValue;let e=t.dataset.label||"";e&&(e+=": ");const i=t.formattedValue;return s(i)||(e+=i),e},labelColor(t){const e=t.chart.getDatasetMeta(t.datasetIndex).controller.getStyle(t.dataIndex);return{borderColor:e.borderColor,backgroundColor:e.backgroundColor,borderWidth:e.borderWidth,borderDash:e.borderDash,borderDashOffset:e.borderDashOffset,borderRadius:0}},labelTextColor(){return this.options.bodyColor},labelPointStyle(t){const e=t.chart.getDatasetMeta(t.datasetIndex).controller.getStyle(t.dataIndex);return{pointStyle:e.pointStyle,rotation:e.rotation}},afterLabel:e,afterBody:e,beforeFooter:e,footer:e,afterFooter:e};function Ba(t,e,i,s){const n=t[e].call(i,s);return void 0===n?Va[e].call(i,s):n}class Wa extends $s{static positioners=Da;constructor(t){super(),this.opacity=0,this._active=[],this._eventPosition=void 0,this._size=void 0,this._cachedAnimations=void 0,this._tooltipItems=[],this.$animations=void 0,this.$context=void 0,this.chart=t.chart,this.options=t.options,this.dataPoints=void 0,this.title=void 0,this.beforeBody=void 0,this.body=void 0,this.afterBody=void 0,this.footer=void 0,this.xAlign=void 0,this.yAlign=void 0,this.x=void 0,this.y=void 0,this.height=void 0,this.width=void 0,this.caretX=void 0,this.caretY=void 0,this.labelColors=void 0,this.labelPointStyles=void 0,this.labelTextColors=void 0}initialize(t){this.options=t,this._cachedAnimations=void 0,this.$context=void 0}_resolveAnimations(){const t=this._cachedAnimations;if(t)return t;const e=this.chart,i=this.options.setContext(this.getContext()),s=i.enabled&&e.options.animation&&i.animations,n=new Ts(this.chart,s);return s._cacheable&&(this._cachedAnimations=Object.freeze(n)),n}getContext(){return this.$context||(this.$context=(t=this.chart.getContext(),e=this,i=this._tooltipItems,Ci(t,{tooltip:e,tooltipItems:i,type:"tooltip"})));var t,e,i}getTitle(t,e){const{callbacks:i}=e,s=Ba(i,"beforeTitle",this,t),n=Ba(i,"title",this,t),o=Ba(i,"afterTitle",this,t);let a=[];return a=Ca(a,Oa(s)),a=Ca(a,Oa(n)),a=Ca(a,Oa(o)),a}getBeforeBody(t,e){return za(Ba(e.callbacks,"beforeBody",this,t))}getBody(t,e){const{callbacks:i}=e,s=[];return u(t,(t=>{const e={before:[],lines:[],after:[]},n=Fa(i,t);Ca(e.before,Oa(Ba(n,"beforeLabel",this,t))),Ca(e.lines,Ba(n,"label",this,t)),Ca(e.after,Oa(Ba(n,"afterLabel",this,t))),s.push(e)})),s}getAfterBody(t,e){return za(Ba(e.callbacks,"afterBody",this,t))}getFooter(t,e){const{callbacks:i}=e,s=Ba(i,"beforeFooter",this,t),n=Ba(i,"footer",this,t),o=Ba(i,"afterFooter",this,t);let a=[];return a=Ca(a,Oa(s)),a=Ca(a,Oa(n)),a=Ca(a,Oa(o)),a}_createItems(t){const e=this._active,i=this.chart.data,s=[],n=[],o=[];let a,r,l=[];for(a=0,r=e.length;a<r;++a)l.push(Aa(this.chart,e[a]));return t.filter&&(l=l.filter(((e,s,n)=>t.filter(e,s,n,i)))),t.itemSort&&(l=l.sort(((e,s)=>t.itemSort(e,s,i)))),u(l,(e=>{const i=Fa(t.callbacks,e);s.push(Ba(i,"labelColor",this,e)),n.push(Ba(i,"labelPointStyle",this,e)),o.push(Ba(i,"labelTextColor",this,e))})),this.labelColors=s,this.labelPointStyles=n,this.labelTextColors=o,this.dataPoints=l,l}update(t,e){const i=this.options.setContext(this.getContext()),s=this._active;let n,o=[];if(s.length){const t=Da[i.position].call(this,s,this._eventPosition);o=this._createItems(i),this.title=this.getTitle(o,i),this.beforeBody=this.getBeforeBody(o,i),this.body=this.getBody(o,i),this.afterBody=this.getAfterBody(o,i),this.footer=this.getFooter(o,i);const e=this._size=Ta(this,i),a=Object.assign({},t,e),r=Ea(this.chart,i,a),l=Ra(i,a,r,this.chart);this.xAlign=r.xAlign,this.yAlign=r.yAlign,n={opacity:1,x:l.x,y:l.y,width:e.width,height:e.height,caretX:t.x,caretY:t.y}}else 0!==this.opacity&&(n={opacity:0});this._tooltipItems=o,this.$context=void 0,n&&this._resolveAnimations().update(this,n),t&&i.external&&i.external.call(this,{chart:this.chart,tooltip:this,replay:e})}drawCaret(t,e,i,s){const n=this.getCaretPosition(t,i,s);e.lineTo(n.x1,n.y1),e.lineTo(n.x2,n.y2),e.lineTo(n.x3,n.y3)}getCaretPosition(t,e,i){const{xAlign:s,yAlign:n}=this,{caretSize:o,cornerRadius:a}=i,{topLeft:r,topRight:l,bottomLeft:h,bottomRight:c}=wi(a),{x:d,y:u}=t,{width:f,height:g}=e;let p,m,x,b,_,y;return"center"===n?(_=u+g/2,"left"===s?(p=d,m=p-o,b=_+o,y=_-o):(p=d+f,m=p+o,b=_-o,y=_+o),x=p):(m="left"===s?d+Math.max(r,h)+o:"right"===s?d+f-Math.max(l,c)-o:this.caretX,"top"===n?(b=u,_=b-o,p=m-o,x=m+o):(b=u+g,_=b+o,p=m+o,x=m-o),y=b),{x1:p,x2:m,x3:x,y1:b,y2:_,y3:y}}drawTitle(t,e,i){const s=this.title,n=s.length;let o,a,r;if(n){const l=Oi(i.rtl,this.x,this.width);for(t.x=Ia(this,i.titleAlign,i),e.textAlign=l.textAlign(i.titleAlign),e.textBaseline="middle",o=Si(i.titleFont),a=i.titleSpacing,e.fillStyle=i.titleColor,e.font=o.string,r=0;r<n;++r)e.fillText(s[r],l.x(t.x),t.y+o.lineHeight/2),t.y+=o.lineHeight+a,r+1===n&&(t.y+=i.titleMarginBottom-a)}}_drawColorBox(t,e,i,s,n){const a=this.labelColors[i],r=this.labelPointStyles[i],{boxHeight:l,boxWidth:h}=n,c=Si(n.bodyFont),d=Ia(this,"left",n),u=s.x(d),f=l<c.lineHeight?(c.lineHeight-l)/2:0,g=e.y+f;if(n.usePointStyle){const e={radius:Math.min(h,l)/2,pointStyle:r.pointStyle,rotation:r.rotation,borderWidth:1},i=s.leftForLtr(u,h)+h/2,o=g+l/2;t.strokeStyle=n.multiKeyBackground,t.fillStyle=n.multiKeyBackground,Le(t,e,i,o),t.strokeStyle=a.borderColor,t.fillStyle=a.backgroundColor,Le(t,e,i,o)}else{t.lineWidth=o(a.borderWidth)?Math.max(...Object.values(a.borderWidth)):a.borderWidth||1,t.strokeStyle=a.borderColor,t.setLineDash(a.borderDash||[]),t.lineDashOffset=a.borderDashOffset||0;const e=s.leftForLtr(u,h),i=s.leftForLtr(s.xPlus(u,1),h-2),r=wi(a.borderRadius);Object.values(r).some((t=>0!==t))?(t.beginPath(),t.fillStyle=n.multiKeyBackground,He(t,{x:e,y:g,w:h,h:l,radius:r}),t.fill(),t.stroke(),t.fillStyle=a.backgroundColor,t.beginPath(),He(t,{x:i,y:g+1,w:h-2,h:l-2,radius:r}),t.fill()):(t.fillStyle=n.multiKeyBackground,t.fillRect(e,g,h,l),t.strokeRect(e,g,h,l),t.fillStyle=a.backgroundColor,t.fillRect(i,g+1,h-2,l-2))}t.fillStyle=this.labelTextColors[i]}drawBody(t,e,i){const{body:s}=this,{bodySpacing:n,bodyAlign:o,displayColors:a,boxHeight:r,boxWidth:l,boxPadding:h}=i,c=Si(i.bodyFont);let d=c.lineHeight,f=0;const g=Oi(i.rtl,this.x,this.width),p=function(i){e.fillText(i,g.x(t.x+f),t.y+d/2),t.y+=d+n},m=g.textAlign(o);let x,b,_,y,v,M,w;for(e.textAlign=o,e.textBaseline="middle",e.font=c.string,t.x=Ia(this,m,i),e.fillStyle=i.bodyColor,u(this.beforeBody,p),f=a&&"right"!==m?"center"===o?l/2+h:l+2+h:0,y=0,M=s.length;y<M;++y){for(x=s[y],b=this.labelTextColors[y],e.fillStyle=b,u(x.before,p),_=x.lines,a&&_.length&&(this._drawColorBox(e,t,y,g,i),d=Math.max(c.lineHeight,r)),v=0,w=_.length;v<w;++v)p(_[v]),d=c.lineHeight;u(x.after,p)}f=0,d=c.lineHeight,u(this.afterBody,p),t.y-=n}drawFooter(t,e,i){const s=this.footer,n=s.length;let o,a;if(n){const r=Oi(i.rtl,this.x,this.width);for(t.x=Ia(this,i.footerAlign,i),t.y+=i.footerMarginTop,e.textAlign=r.textAlign(i.footerAlign),e.textBaseline="middle",o=Si(i.footerFont),e.fillStyle=i.footerColor,e.font=o.string,a=0;a<n;++a)e.fillText(s[a],r.x(t.x),t.y+o.lineHeight/2),t.y+=o.lineHeight+i.footerSpacing}}drawBackground(t,e,i,s){const{xAlign:n,yAlign:o}=this,{x:a,y:r}=t,{width:l,height:h}=i,{topLeft:c,topRight:d,bottomLeft:u,bottomRight:f}=wi(s.cornerRadius);e.fillStyle=s.backgroundColor,e.strokeStyle=s.borderColor,e.lineWidth=s.borderWidth,e.beginPath(),e.moveTo(a+c,r),"top"===o&&this.drawCaret(t,e,i,s),e.lineTo(a+l-d,r),e.quadraticCurveTo(a+l,r,a+l,r+d),"center"===o&&"right"===n&&this.drawCaret(t,e,i,s),e.lineTo(a+l,r+h-f),e.quadraticCurveTo(a+l,r+h,a+l-f,r+h),"bottom"===o&&this.drawCaret(t,e,i,s),e.lineTo(a+u,r+h),e.quadraticCurveTo(a,r+h,a,r+h-u),"center"===o&&"left"===n&&this.drawCaret(t,e,i,s),e.lineTo(a,r+c),e.quadraticCurveTo(a,r,a+c,r),e.closePath(),e.fill(),s.borderWidth>0&&e.stroke()}_updateAnimationTarget(t){const e=this.chart,i=this.$animations,s=i&&i.x,n=i&&i.y;if(s||n){const i=Da[t.position].call(this,this._active,this._eventPosition);if(!i)return;const o=this._size=Ta(this,t),a=Object.assign({},i,this._size),r=Ea(e,t,a),l=Ra(t,a,r,e);s._to===l.x&&n._to===l.y||(this.xAlign=r.xAlign,this.yAlign=r.yAlign,this.width=o.width,this.height=o.height,this.caretX=i.x,this.caretY=i.y,this._resolveAnimations().update(this,l))}}_willRender(){return!!this.opacity}draw(t){const e=this.options.setContext(this.getContext());let i=this.opacity;if(!i)return;this._updateAnimationTarget(e);const s={width:this.width,height:this.height},n={x:this.x,y:this.y};i=Math.abs(i)<.001?0:i;const o=ki(e.padding),a=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;e.enabled&&a&&(t.save(),t.globalAlpha=i,this.drawBackground(n,t,s,e),Ai(t,e.textDirection),n.y+=o.top,this.drawTitle(n,t,e),this.drawBody(n,t,e),this.drawFooter(n,t,e),Ti(t,e.textDirection),t.restore())}getActiveElements(){return this._active||[]}setActiveElements(t,e){const i=this._active,s=t.map((({datasetIndex:t,index:e})=>{const i=this.chart.getDatasetMeta(t);if(!i)throw new Error("Cannot find a dataset at index "+t);return{datasetIndex:t,element:i.data[e],index:e}})),n=!f(i,s),o=this._positionChanged(s,e);(n||o)&&(this._active=s,this._eventPosition=e,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(t,e,i=!0){if(e&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;const s=this.options,n=this._active||[],o=this._getActiveElements(t,n,e,i),a=this._positionChanged(o,t),r=e||!f(o,n)||a;return r&&(this._active=o,(s.enabled||s.external)&&(this._eventPosition={x:t.x,y:t.y},this.update(!0,e))),r}_getActiveElements(t,e,i,s){const n=this.options;if("mouseout"===t.type)return[];if(!s)return e.filter((t=>this.chart.data.datasets[t.datasetIndex]&&void 0!==this.chart.getDatasetMeta(t.datasetIndex).controller.getParsed(t.index)));const o=this.chart.getElementsAtEventForMode(t,n.mode,n,i);return n.reverse&&o.reverse(),o}_positionChanged(t,e){const{caretX:i,caretY:s,options:n}=this,o=Da[n.position].call(this,t,e);return!1!==o&&(i!==o.x||s!==o.y)}}var Na={id:"tooltip",_element:Wa,positioners:Da,afterInit(t,e,i){i&&(t.tooltip=new Wa({chart:t,options:i}))},beforeUpdate(t,e,i){t.tooltip&&t.tooltip.initialize(i)},reset(t,e,i){t.tooltip&&t.tooltip.initialize(i)},afterDraw(t){const e=t.tooltip;if(e&&e._willRender()){const i={tooltip:e};if(!1===t.notifyPlugins("beforeTooltipDraw",{...i,cancelable:!0}))return;e.draw(t.ctx),t.notifyPlugins("afterTooltipDraw",i)}},afterEvent(t,e){if(t.tooltip){const i=e.replay;t.tooltip.handleEvent(e.event,i,e.inChartArea)&&(e.changed=!0)}},defaults:{enabled:!0,external:null,position:"average",backgroundColor:"rgba(0,0,0,0.8)",titleColor:"#fff",titleFont:{weight:"bold"},titleSpacing:2,titleMarginBottom:6,titleAlign:"left",bodyColor:"#fff",bodySpacing:2,bodyFont:{},bodyAlign:"left",footerColor:"#fff",footerSpacing:2,footerMarginTop:6,footerFont:{weight:"bold"},footerAlign:"left",padding:6,caretPadding:2,caretSize:5,cornerRadius:6,boxHeight:(t,e)=>e.bodyFont.size,boxWidth:(t,e)=>e.bodyFont.size,multiKeyBackground:"#fff",displayColors:!0,boxPadding:0,borderColor:"rgba(0,0,0,0)",borderWidth:0,animation:{duration:400,easing:"easeOutQuart"},animations:{numbers:{type:"number",properties:["x","y","width","height","caretX","caretY"]},opacity:{easing:"linear",duration:200}},callbacks:Va},defaultRoutes:{bodyFont:"font",footerFont:"font",titleFont:"font"},descriptors:{_scriptable:t=>"filter"!==t&&"itemSort"!==t&&"external"!==t,_indexable:!1,callbacks:{_scriptable:!1,_indexable:!1},animation:{_fallback:!1},animations:{_fallback:"animation"}},additionalOptionScopes:["interaction"]};return Tn.register(Un,$o,go,t),Tn.helpers={...Hi},Tn._adapters=In,Tn.Animation=As,Tn.Animations=Ts,Tn.animator=bt,Tn.controllers=nn.controllers.items,Tn.DatasetController=js,Tn.Element=$s,Tn.elements=go,Tn.Interaction=Ki,Tn.layouts=ls,Tn.platforms=Ds,Tn.Scale=tn,Tn.Ticks=ae,Object.assign(Tn,Un,$o,go,t,Ds),Tn.Chart=Tn,"undefined"!=typeof window&&(window.Chart=Tn),Tn}));
34129//# sourceMappingURL=
34129/assets/chart.js/dist/chart.umd.js.map
34130//!
34131;
vendor: 19,817 bytes, lines 34132-34981
34132/*!
34133 * chartjs-plugin-datalabels v2.2.0
34134 * https://chartjs-plugin-datalabels.netlify.app
34135 * (c) 2017-2022 chartjs-plugin-datalabels contributors
34136 * Released under the MIT license
34137 */
34138(function (global, factory) {
34139typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('chart.js/helpers'), require('chart.js')) :
34140typeof define === 'function' && define.amd ? define(['chart.js/helpers', 'chart.js'], factory) :
34141(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.ChartDataLabels = factory(global.Chart.helpers, global.Chart));
34142})(this, (function (helpers, chart_js) { 'use strict';
34143
34144var devicePixelRatio = (function() {
34145  if (typeof window !== 'undefined') {
34146    if (window.devicePixelRatio) {
34147      return window.devicePixelRatio;
34148    }
34149
34150    // devicePixelRatio is undefined on IE10
34151    // https://stackoverflow.com/a/20204180/8837887
34152    // https://github.com/chartjs/chartjs-plugin-datalabels/issues/85
34153    var screen = window.screen;
34154    if (screen) {
34155      return (screen.deviceXDPI || 1) / (screen.logicalXDPI || 1);
34156    }
34157  }
34158
34159  return 1;
34160}());
34161
34162var utils = {
34163  // @todo move this in Chart.helpers.toTextLines
34164  toTextLines: function(inputs) {
34165    var lines = [];
34166    var input;
34167
34168    inputs = [].concat(inputs);
34169    while (inputs.length) {
34170      input = inputs.pop();
34171      if (typeof input === 'string') {
34172        lines.unshift.apply(lines, input.split('\n'));
34173      } else if (Array.isArray(input)) {
34174        inputs.push.apply(inputs, input);
34175      } else if (!helpers.isNullOrUndef(inputs)) {
34176        lines.unshift('' + input);
34177      }
34178    }
34179
34180    return lines;
34181  },
34182
34183  // @todo move this in Chart.helpers.canvas.textSize
34184  // @todo cache calls of measureText if font doesn't change?!
34185  textSize: function(ctx, lines, font) {
34186    var items = [].concat(lines);
34187    var ilen = items.length;
34188    var prev = ctx.font;
34189    var width = 0;
34190    var i;
34191
34192    ctx.font = font.string;
34193
34194    for (i = 0; i < ilen; ++i) {
34195      width = Math.max(ctx.measureText(items[i]).width, width);
34196    }
34197
34198    ctx.font = prev;
34199
34200    return {
34201      height: ilen * font.lineHeight,
34202      width: width
34203    };
34204  },
34205
34206  /**
34207   * Returns value bounded by min and max. This is equivalent to max(min, min(value, max)).
34208   * @todo move this method in Chart.helpers.bound
34209   * https://doc.qt.io/qt-5/qtglobal.html#qBound
34210   */
34211  bound: function(min, value, max) {
34212    return Math.max(min, Math.min(value, max));
34213  },
34214
34215  /**
34216   * Returns an array of pair [value, state] where state is:
34217   * * -1: value is only in a0 (removed)
34218   * *  1: value is only in a1 (added)
34219   */
34220  arrayDiff: function(a0, a1) {
34221    var prev = a0.slice();
34222    var updates = [];
34223    var i, j, ilen, v;
34224
34225    for (i = 0, ilen = a1.length; i < ilen; ++i) {
34226      v = a1[i];
34227      j = prev.indexOf(v);
34228
34229      if (j === -1) {
34230        updates.push([v, 1]);
34231      } else {
34232        prev.splice(j, 1);
34233      }
34234    }
34235
34236    for (i = 0, ilen = prev.length; i < ilen; ++i) {
34237      updates.push([prev[i], -1]);
34238    }
34239
34240    return updates;
34241  },
34242
34243  /**
34244   * https://github.com/chartjs/chartjs-plugin-datalabels/issues/70
34245   */
34246  rasterize: function(v) {
34247    return Math.round(v * devicePixelRatio) / devicePixelRatio;
34248  }
34249};
34250
34251function orient(point, origin) {
34252  var x0 = origin.x;
34253  var y0 = origin.y;
34254
34255  if (x0 === null) {
34256    return {x: 0, y: -1};
34257  }
34258  if (y0 === null) {
34259    return {x: 1, y: 0};
34260  }
34261
34262  var dx = point.x - x0;
34263  var dy = point.y - y0;
34264  var ln = Math.sqrt(dx * dx + dy * dy);
34265
34266  return {
34267    x: ln ? dx / ln : 0,
34268    y: ln ? dy / ln : -1
34269  };
34270}
34271
34272function aligned(x, y, vx, vy, align) {
34273  switch (align) {
34274  case 'center':
34275    vx = vy = 0;
34276    break;
34277  case 'bottom':
34278    vx = 0;
34279    vy = 1;
34280    break;
34281  case 'right':
34282    vx = 1;
34283    vy = 0;
34284    break;
34285  case 'left':
34286    vx = -1;
34287    vy = 0;
34288    break;
34289  case 'top':
34290    vx = 0;
34291    vy = -1;
34292    break;
34293  case 'start':
34294    vx = -vx;
34295    vy = -vy;
34296    break;
34297  case 'end':
34298    // keep natural orientation
34299    break;
34300  default:
34301    // clockwise rotation (in degree)
34302    align *= (Math.PI / 180);
34303    vx = Math.cos(align);
34304    vy = Math.sin(align);
34305    break;
34306  }
34307
34308  return {
34309    x: x,
34310    y: y,
34311    vx: vx,
34312    vy: vy
34313  };
34314}
34315
34316// Line clipping (Cohen–Sutherland algorithm)
34317// https://en.wikipedia.org/wiki/Cohen–Sutherland_algorithm
34318
34319var R_INSIDE = 0;
34320var R_LEFT = 1;
34321var R_RIGHT = 2;
34322var R_BOTTOM = 4;
34323var R_TOP = 8;
34324
34325function region(x, y, rect) {
34326  var res = R_INSIDE;
34327
34328  if (x < rect.left) {
34329    res |= R_LEFT;
34330  } else if (x > rect.right) {
34331    res |= R_RIGHT;
34332  }
34333  if (y < rect.top) {
34334    res |= R_TOP;
34335  } else if (y > rect.bottom) {
34336    res |= R_BOTTOM;
34337  }
34338
34339  return res;
34340}
34341
34342function clipped(segment, area) {
34343  var x0 = segment.x0;
34344  var y0 = segment.y0;
34345  var x1 = segment.x1;
34346  var y1 = segment.y1;
34347  var r0 = region(x0, y0, area);
34348  var r1 = region(x1, y1, area);
34349  var r, x, y;
34350
34351  // eslint-disable-next-line no-constant-condition
34352  while (true) {
34353    if (!(r0 | r1) || (r0 & r1)) {
34354      // both points inside or on the same side: no clipping
34355      break;
34356    }
34357
34358    // at least one point is outside
34359    r = r0 || r1;
34360
34361    if (r & R_TOP) {
34362      x = x0 + (x1 - x0) * (area.top - y0) / (y1 - y0);
34363      y = area.top;
34364    } else if (r & R_BOTTOM) {
34365      x = x0 + (x1 - x0) * (area.bottom - y0) / (y1 - y0);
34366      y = area.bottom;
34367    } else if (r & R_RIGHT) {
34368      y = y0 + (y1 - y0) * (area.right - x0) / (x1 - x0);
34369      x = area.right;
34370    } else if (r & R_LEFT) {
34371      y = y0 + (y1 - y0) * (area.left - x0) / (x1 - x0);
34372      x = area.left;
34373    }
34374
34375    if (r === r0) {
34376      x0 = x;
34377      y0 = y;
34378      r0 = region(x0, y0, area);
34379    } else {
34380      x1 = x;
34381      y1 = y;
34382      r1 = region(x1, y1, area);
34383    }
34384  }
34385
34386  return {
34387    x0: x0,
34388    x1: x1,
34389    y0: y0,
34390    y1: y1
34391  };
34392}
34393
34394function compute$1(range, config) {
34395  var anchor = config.anchor;
34396  var segment = range;
34397  var x, y;
34398
34399  if (config.clamp) {
34400    segment = clipped(segment, config.area);
34401  }
34402
34403  if (anchor === 'start') {
34404    x = segment.x0;
34405    y = segment.y0;
34406  } else if (anchor === 'end') {
34407    x = segment.x1;
34408    y = segment.y1;
34409  } else {
34410    x = (segment.x0 + segment.x1) / 2;
34411    y = (segment.y0 + segment.y1) / 2;
34412  }
34413
34414  return aligned(x, y, range.vx, range.vy, config.align);
34415}
34416
34417var positioners = {
34418  arc: function(el, config) {
34419    var angle = (el.startAngle + el.endAngle) / 2;
34420    var vx = Math.cos(angle);
34421    var vy = Math.sin(angle);
34422    var r0 = el.innerRadius;
34423    var r1 = el.outerRadius;
34424
34425    return compute$1({
34426      x0: el.x + vx * r0,
34427      y0: el.y + vy * r0,
34428      x1: el.x + vx * r1,
34429      y1: el.y + vy * r1,
34430      vx: vx,
34431      vy: vy
34432    }, config);
34433  },
34434
34435  point: function(el, config) {
34436    var v = orient(el, config.origin);
34437    var rx = v.x * el.options.radius;
34438    var ry = v.y * el.options.radius;
34439
34440    return compute$1({
34441      x0: el.x - rx,
34442      y0: el.y - ry,
34443      x1: el.x + rx,
34444      y1: el.y + ry,
34445      vx: v.x,
34446      vy: v.y
34447    }, config);
34448  },
34449
34450  bar: function(el, config) {
34451    var v = orient(el, config.origin);
34452    var x = el.x;
34453    var y = el.y;
34454    var sx = 0;
34455    var sy = 0;
34456
34457    if (el.horizontal) {
34458      x = Math.min(el.x, el.base);
34459      sx = Math.abs(el.base - el.x);
34460    } else {
34461      y = Math.min(el.y, el.base);
34462      sy = Math.abs(el.base - el.y);
34463    }
34464
34465    return compute$1({
34466      x0: x,
34467      y0: y + sy,
34468      x1: x + sx,
34469      y1: y,
34470      vx: v.x,
34471      vy: v.y
34472    }, config);
34473  },
34474
34475  fallback: function(el, config) {
34476    var v = orient(el, config.origin);
34477
34478    return compute$1({
34479      x0: el.x,
34480      y0: el.y,
34481      x1: el.x + (el.width || 0),
34482      y1: el.y + (el.height || 0),
34483      vx: v.x,
34484      vy: v.y
34485    }, config);
34486  }
34487};
34488
34489var rasterize = utils.rasterize;
34490
34491function boundingRects(model) {
34492  var borderWidth = model.borderWidth || 0;
34493  var padding = model.padding;
34494  var th = model.size.height;
34495  var tw = model.size.width;
34496  var tx = -tw / 2;
34497  var ty = -th / 2;
34498
34499  return {
34500    frame: {
34501      x: tx - padding.left - borderWidth,
34502      y: ty - padding.top - borderWidth,
34503      w: tw + padding.width + borderWidth * 2,
34504      h: th + padding.height + borderWidth * 2
34505    },
34506    text: {
34507      x: tx,
34508      y: ty,
34509      w: tw,
34510      h: th
34511    }
34512  };
34513}
34514
34515function getScaleOrigin(el, context) {
34516  var scale = context.chart.getDatasetMeta(context.datasetIndex).vScale;
34517
34518  if (!scale) {
34519    return null;
34520  }
34521
34522  if (scale.xCenter !== undefined && scale.yCenter !== undefined) {
34523    return {x: scale.xCenter, y: scale.yCenter};
34524  }
34525
34526  var pixel = scale.getBasePixel();
34527  return el.horizontal ?
34528    {x: pixel, y: null} :
34529    {x: null, y: pixel};
34530}
34531
34532function getPositioner(el) {
34533  if (el instanceof chart_js.ArcElement) {
34534    return positioners.arc;
34535  }
34536  if (el instanceof chart_js.PointElement) {
34537    return positioners.point;
34538  }
34539  if (el instanceof chart_js.BarElement) {
34540    return positioners.bar;
34541  }
34542  return positioners.fallback;
34543}
34544
34545function drawRoundedRect(ctx, x, y, w, h, radius) {
34546  var HALF_PI = Math.PI / 2;
34547
34548  if (radius) {
34549    var r = Math.min(radius, h / 2, w / 2);
34550    var left = x + r;
34551    var top = y + r;
34552    var right = x + w - r;
34553    var bottom = y + h - r;
34554
34555    ctx.moveTo(x, top);
34556    if (left < right && top < bottom) {
34557      ctx.arc(left, top, r, -Math.PI, -HALF_PI);
34558      ctx.arc(right, top, r, -HALF_PI, 0);
34559      ctx.arc(right, bottom, r, 0, HALF_PI);
34560      ctx.arc(left, bottom, r, HALF_PI, Math.PI);
34561    } else if (left < right) {
34562      ctx.moveTo(left, y);
34563      ctx.arc(right, top, r, -HALF_PI, HALF_PI);
34564      ctx.arc(left, top, r, HALF_PI, Math.PI + HALF_PI);
34565    } else if (top < bottom) {
34566      ctx.arc(left, top, r, -Math.PI, 0);
34567      ctx.arc(left, bottom, r, 0, Math.PI);
34568    } else {
34569      ctx.arc(left, top, r, -Math.PI, Math.PI);
34570    }
34571    ctx.closePath();
34572    ctx.moveTo(x, y);
34573  } else {
34574    ctx.rect(x, y, w, h);
34575  }
34576}
34577
34578function drawFrame(ctx, rect, model) {
34579  var bgColor = model.backgroundColor;
34580  var borderColor = model.borderColor;
34581  var borderWidth = model.borderWidth;
34582
34583  if (!bgColor && (!borderColor || !borderWidth)) {
34584    return;
34585  }
34586
34587  ctx.beginPath();
34588
34589  drawRoundedRect(
34590    ctx,
34591    rasterize(rect.x) + borderWidth / 2,
34592    rasterize(rect.y) + borderWidth / 2,
34593    rasterize(rect.w) - borderWidth,
34594    rasterize(rect.h) - borderWidth,
34595    model.borderRadius);
34596
34597  ctx.closePath();
34598
34599  if (bgColor) {
34600    ctx.fillStyle = bgColor;
34601    ctx.fill();
34602  }
34603
34604  if (borderColor && borderWidth) {
34605    ctx.strokeStyle = borderColor;
34606    ctx.lineWidth = borderWidth;
34607    ctx.lineJoin = 'miter';
34608    ctx.stroke();
34609  }
34610}
34611
34612function textGeometry(rect, align, font) {
34613  var h = font.lineHeight;
34614  var w = rect.w;
34615  var x = rect.x;
34616  var y = rect.y + h / 2;
34617
34618  if (align === 'center') {
34619    x += w / 2;
34620  } else if (align === 'end' || align === 'right') {
34621    x += w;
34622  }
34623
34624  return {
34625    h: h,
34626    w: w,
34627    x: x,
34628    y: y
34629  };
34630}
34631
34632function drawTextLine(ctx, text, cfg) {
34633  var shadow = ctx.shadowBlur;
34634  var stroked = cfg.stroked;
34635  var x = rasterize(cfg.x);
34636  var y = rasterize(cfg.y);
34637  var w = rasterize(cfg.w);
34638
34639  if (stroked) {
34640    ctx.strokeText(text, x, y, w);
34641  }
34642
34643  if (cfg.filled) {
34644    if (shadow && stroked) {
34645      // Prevent drawing shadow on both the text stroke and fill, so
34646      // if the text is stroked, remove the shadow for the text fill.
34647      ctx.shadowBlur = 0;
34648    }
34649
34650    ctx.fillText(text, x, y, w);
34651
34652    if (shadow && stroked) {
34653      ctx.shadowBlur = shadow;
34654    }
34655  }
34656}
34657
34658function drawText(ctx, lines, rect, model) {
34659  var align = model.textAlign;
34660  var color = model.color;
34661  var filled = !!color;
34662  var font = model.font;
34663  var ilen = lines.length;
34664  var strokeColor = model.textStrokeColor;
34665  var strokeWidth = model.textStrokeWidth;
34666  var stroked = strokeColor && strokeWidth;
34667  var i;
34668
34669  if (!ilen || (!filled && !stroked)) {
34670    return;
34671  }
34672
34673  // Adjust coordinates based on text alignment and line height
34674  rect = textGeometry(rect, align, font);
34675
34676  ctx.font = font.string;
34677  ctx.textAlign = align;
34678  ctx.textBaseline = 'middle';
34679  ctx.shadowBlur = model.textShadowBlur;
34680  ctx.shadowColor = model.textShadowColor;
34681
34682  if (filled) {
34683    ctx.fillStyle = color;
34684  }
34685  if (stroked) {
34686    ctx.lineJoin = 'round';
34687    ctx.lineWidth = strokeWidth;
34688    ctx.strokeStyle = strokeColor;
34689  }
34690
34691  for (i = 0, ilen = lines.length; i < ilen; ++i) {
34692    drawTextLine(ctx, lines[i], {
34693      stroked: stroked,
34694      filled: filled,
34695      w: rect.w,
34696      x: rect.x,
34697      y: rect.y + rect.h * i
34698    });
34699  }
34700}
34701
34702var Label = function(config, ctx, el, index) {
34703  var me = this;
34704
34705  me._config = config;
34706  me._index = index;
34707  me._model = null;
34708  me._rects = null;
34709  me._ctx = ctx;
34710  me._el = el;
34711};
34712
34713helpers.merge(Label.prototype, {
34714  /**
34715   * @private
34716   */
34717  _modelize: function(display, lines, config, context) {
34718    var me = this;
34719    var index = me._index;
34720    var font = helpers.toFont(helpers.resolve([config.font, {}], context, index));
34721    var color = helpers.resolve([config.color, chart_js.defaults.color], context, index);
34722
34723    return {
34724      align: helpers.resolve([config.align, 'center'], context, index),
34725      anchor: helpers.resolve([config.anchor, 'center'], context, index),
34726      area: context.chart.chartArea,
34727      backgroundColor: helpers.resolve([config.backgroundColor, null], context, index),
34728      borderColor: helpers.resolve([config.borderColor, null], context, index),
34729      borderRadius: helpers.resolve([config.borderRadius, 0], context, index),
34730      borderWidth: helpers.resolve([config.borderWidth, 0], context, index),
34731      clamp: helpers.resolve([config.clamp, false], context, index),
34732      clip: helpers.resolve([config.clip, false], context, index),
34733      color: color,
34734      display: display,
34735      font: font,
34736      lines: lines,
34737      offset: helpers.resolve([config.offset, 4], context, index),
34738      opacity: helpers.resolve([config.opacity, 1], context, index),
34739      origin: getScaleOrigin(me._el, context),
34740      padding: helpers.toPadding(helpers.resolve([config.padding, 4], context, index)),
34741      positioner: getPositioner(me._el),
34742      rotation: helpers.resolve([config.rotation, 0], context, index) * (Math.PI / 180),
34743      size: utils.textSize(me._ctx, lines, font),
34744      textAlign: helpers.resolve([config.textAlign, 'start'], context, index),
34745      textShadowBlur: helpers.resolve([config.textShadowBlur, 0], context, index),
34746      textShadowColor: helpers.resolve([config.textShadowColor, color], context, index),
34747      textStrokeColor: helpers.resolve([config.textStrokeColor, color], context, index),
34748      textStrokeWidth: helpers.resolve([config.textStrokeWidth, 0], context, index)
34749    };
34750  },
34751
34752  update: function(context) {
34753    var me = this;
34754    var model = null;
34755    var rects = null;
34756    var index = me._index;
34757    var config = me._config;
34758    var value, label, lines;
34759
34760    // We first resolve the display option (separately) to avoid computing
34761    // other options in case the label is hidden (i.e. display: false).
34762    var display = helpers.resolve([config.display, true], context, index);
34763
34764    if (display) {
34765      value = context.dataset.data[index];
34766      label = helpers.valueOrDefault(helpers.callback(config.formatter, [value, context]), value);
34767      lines = helpers.isNullOrUndef(label) ? [] : utils.toTextLines(label);
34768
34769      if (lines.length) {
34770        model = me._modelize(display, lines, config, context);
34771        rects = boundingRects(model);
34772      }
34773    }
34774
34775    me._model = model;
34776    me._rects = rects;
34777  },
34778
34779  geometry: function() {
34780    return this._rects ? this._rects.frame : {};
34781  },
34782
34783  rotation: function() {
34784    return this._model ? this._model.rotation : 0;
34785  },
34786
34787  visible: function() {
34788    return this._model && this._model.opacity;
34789  },
34790
34791  model: function() {
34792    return this._model;
34793  },
34794
34795  draw: function(chart, center) {
34796    var me = this;
34797    var ctx = chart.ctx;
34798    var model = me._model;
34799    var rects = me._rects;
34800    var area;
34801
34802    if (!this.visible()) {
34803      return;
34804    }
34805
34806    ctx.save();
34807
34808    if (model.clip) {
34809      area = model.area;
34810      ctx.beginPath();
34811      ctx.rect(
34812        area.left,
34813        area.top,
34814        area.right - area.left,
34815        area.bottom - area.top);
34816      ctx.clip();
34817    }
34818
34819    ctx.globalAlpha = utils.bound(0, model.opacity, 1);
34820    ctx.translate(rasterize(center.x), rasterize(center.y));
34821    ctx.rotate(model.rotation);
34822
34823    drawFrame(ctx, rects.frame, model);
34824    drawText(ctx, model.lines, rects.text, model);
34825
34826    ctx.restore();
34827  }
34828});
34829
34830var MIN_INTEGER = Number.MIN_SAFE_INTEGER || -9007199254740991; // eslint-disable-line es/no-number-minsafeinteger
34831var MAX_INTEGER = Number.MAX_SAFE_INTEGER || 9007199254740991;  // eslint-disable-line es/no-number-maxsafeinteger
34832
34833function rotated(point, center, angle) {
34834  var cos = Math.cos(angle);
34835  var sin = Math.sin(angle);
34836  var cx = center.x;
34837  var cy = center.y;
34838
34839  return {
34840    x: cx + cos * (point.x - cx) - sin * (point.y - cy),
34841    y: cy + sin * (point.x - cx) + cos * (point.y - cy)
34842  };
34843}
34844
34845function projected(points, axis) {
34846  var min = MAX_INTEGER;
34847  var max = MIN_INTEGER;
34848  var origin = axis.origin;
34849  var i, pt, vx, vy, dp;
34850
34851  for (i = 0; i < points.length; ++i) {
34852    pt = points[i];
34853    vx = pt.x - origin.x;
34854    vy = pt.y - origin.y;
34855    dp = axis.vx * vx + axis.vy * vy;
34856    min = Math.min(min, dp);
34857    max = Math.max(max, dp);
34858  }
34859
34860  return {
34861    min: min,
34862    max: max
34863  };
34864}
34865
34866function toAxis(p0, p1) {
34867  var vx = p1.x - p0.x;
34868  var vy = p1.y - p0.y;
34869  var ln = Math.sqrt(vx * vx + vy * vy);
34870
34871  return {
34872    vx: (p1.x - p0.x) / ln,
34873    vy: (p1.y - p0.y) / ln,
34874    origin: p0,
34875    ln: ln
34876  };
34877}
34878
34879var HitBox = function() {
34880  this._rotation = 0;
34881  this._rect = {
34882    x: 0,
34883    y: 0,
34884    w: 0,
34885    h: 0
34886  };
34887};
34888
34889helpers.merge(HitBox.prototype, {
34890  center: function() {
34891    var r = this._rect;
34892    return {
34893      x: r.x + r.w / 2,
34894      y: r.y + r.h / 2
34895    };
34896  },
34897
34898  update: function(center, rect, rotation) {
34899    this._rotation = rotation;
34900    this._rect = {
34901      x: rect.x + center.x,
34902      y: rect.y + center.y,
34903      w: rect.w,
34904      h: rect.h
34905    };
34906  },
34907
34908  contains: function(point) {
34909    var me = this;
34910    var margin = 1;
34911    var rect = me._rect;
34912
34913    point = rotated(point, me.center(), -me._rotation);
34914
34915    return !(point.x < rect.x - margin
34916      || point.y < rect.y - margin
34917      || point.x > rect.x + rect.w + margin * 2
34918      || point.y > rect.y + rect.h + margin * 2);
34919  },
34920
34921  // Separating Axis Theorem
34922  // https://gamedevelopment.tutsplus.com/tutorials/collision-detection-using-the-separating-axis-theorem--gamedev-169
34923  intersects: function(other) {
34924    var r0 = this._points();
34925    var r1 = other._points();
34926    var axes = [
34927      toAxis(r0[0], r0[1]),
34928      toAxis(r0[0], r0[3])
34929    ];
34930    var i, pr0, pr1;
34931
34932    if (this._rotation !== other._rotation) {
34933      // Only separate with r1 axis if the rotation is different,
34934      // else it's enough to separate r0 and r1 with r0 axis only!
34935      axes.push(
34936        toAxis(r1[0], r1[1]),
34937        toAxis(r1[0], r1[3])
34938      );
34939    }
34940
34941    for (i = 0; i < axes.length; ++i) {
34942      pr0 = projected(r0, axes[i]);
34943      pr1 = projected(r1, axes[i]);
34944
34945      if (pr0.max < pr1.min || pr1.max < pr0.min) {
34946        return false;
34947      }
34948    }
34949
34950    return true;
34951  },
34952
34953  /**
34954   * @private
34955   */
34956  _points: function() {
34957    var me = this;
34958    var rect = me._rect;
34959    var angle = me._rotation;
34960    var center = me.center();
34961
34962    return [
34963      rotated({x: rect.x, y: rect.y}, center, angle),
34964      rotated({x: rect.x + rect.w, y: rect.y}, center, angle),
34965      rotated({x: rect.x + rect.w, y: rect.y + rect.h}, center, angle),
34966      rotated({x: rect.x, y: rect.y + rect.h}, center, angle)
34967    ];
34968  }
34969});
34970
34971function coordinates(el, model, geometry) {
34972  var point = model.positioner(el, model);
34973  var vx = point.vx;
34974  var vy = point.vy;
34975
34976  if (!vx && !vy) {
34977    // if aligned center, we don't want to offset the center point
34978    return {x: point.x, y: point.y};
34979  }
34980
34981  var w = geometry.w;
vendor: 4,081 bytes, lines 34982-35133
34982  var h = geometry.h;
34983
34984  // take in account the label rotation
34985  var rotation = model.rotation;
34986  var dx = Math.abs(w / 2 * Math.cos(rotation)) + Math.abs(h / 2 * Math.sin(rotation));
34987  var dy = Math.abs(w / 2 * Math.sin(rotation)) + Math.abs(h / 2 * Math.cos(rotation));
34988
34989  // scale the unit vector (vx, vy) to get at least dx or dy equal to
34990  // w or h respectively (else we would calculate the distance to the
34991  // ellipse inscribed in the bounding rect)
34992  var vs = 1 / Math.max(Math.abs(vx), Math.abs(vy));
34993  dx *= vx * vs;
34994  dy *= vy * vs;
34995
34996  // finally, include the explicit offset
34997  dx += model.offset * vx;
34998  dy += model.offset * vy;
34999
35000  return {
35001    x: point.x + dx,
35002    y: point.y + dy
35003  };
35004}
35005
35006function collide(labels, collider) {
35007  var i, j, s0, s1;
35008
35009  // IMPORTANT Iterate in the reverse order since items at the end of the
35010  // list have an higher weight/priority and thus should be less impacted
35011  // by the overlapping strategy.
35012
35013  for (i = labels.length - 1; i >= 0; --i) {
35014    s0 = labels[i].$layout;
35015
35016    for (j = i - 1; j >= 0 && s0._visible; --j) {
35017      s1 = labels[j].$layout;
35018
35019      if (s1._visible && s0._box.intersects(s1._box)) {
35020        collider(s0, s1);
35021      }
35022    }
35023  }
35024
35025  return labels;
35026}
35027
35028function compute(labels) {
35029  var i, ilen, label, state, geometry, center, proxy;
35030
35031  // Initialize labels for overlap detection
35032  for (i = 0, ilen = labels.length; i < ilen; ++i) {
35033    label = labels[i];
35034    state = label.$layout;
35035
35036    if (state._visible) {
35037      // Chart.js 3 removed el._model in favor of getProps(), making harder to
35038      // abstract reading values in positioners. Also, using string arrays to
35039      // read values (i.e. var {a,b,c} = el.getProps(["a","b","c"])) would make
35040      // positioners inefficient in the normal case (i.e. not the final values)
35041      // and the code a bit ugly, so let's use a Proxy instead.
35042      proxy = new Proxy(label._el, {get: (el, p) => el.getProps([p], true)[p]});
35043
35044      geometry = label.geometry();
35045      center = coordinates(proxy, label.model(), geometry);
35046      state._box.update(center, geometry, label.rotation());
35047    }
35048  }
35049
35050  // Auto hide overlapping labels
35051  return collide(labels, function(s0, s1) {
35052    var h0 = s0._hidable;
35053    var h1 = s1._hidable;
35054
35055    if ((h0 && h1) || h1) {
35056      s1._visible = false;
35057    } else if (h0) {
35058      s0._visible = false;
35059    }
35060  });
35061}
35062
35063var layout = {
35064  prepare: function(datasets) {
35065    var labels = [];
35066    var i, j, ilen, jlen, label;
35067
35068    for (i = 0, ilen = datasets.length; i < ilen; ++i) {
35069      for (j = 0, jlen = datasets[i].length; j < jlen; ++j) {
35070        label = datasets[i][j];
35071        labels.push(label);
35072        label.$layout = {
35073          _box: new HitBox(),
35074          _hidable: false,
35075          _visible: true,
35076          _set: i,
35077          _idx: label._index
35078        };
35079      }
35080    }
35081
35082    // TODO New `z` option: labels with a higher z-index are drawn
35083    // of top of the ones with a lower index. Lowest z-index labels
35084    // are also discarded first when hiding overlapping labels.
35085    labels.sort(function(a, b) {
35086      var sa = a.$layout;
35087      var sb = b.$layout;
35088
35089      return sa._idx === sb._idx
35090        ? sb._set - sa._set
35091        : sb._idx - sa._idx;
35092    });
35093
35094    this.update(labels);
35095
35096    return labels;
35097  },
35098
35099  update: function(labels) {
35100    var dirty = false;
35101    var i, ilen, label, model, state;
35102
35103    for (i = 0, ilen = labels.length; i < ilen; ++i) {
35104      label = labels[i];
35105      model = label.model();
35106      state = label.$layout;
35107      state._hidable = model && model.display === 'auto';
35108      state._visible = label.visible();
35109      dirty |= state._hidable;
35110    }
35111
35112    if (dirty) {
35113      compute(labels);
35114    }
35115  },
35116
35117  lookup: function(labels, point) {
35118    var i, state;
35119
35120    // IMPORTANT Iterate in the reverse order since items at the end of
35121    // the list have an higher z-index, thus should be picked first.
35122
35123    for (i = labels.length - 1; i >= 0; --i) {
35124      state = labels[i].$layout;
35125
35126      if (state && state._visible && state._box.contains(point)) {
35127        return labels[i];
35128      }
35129    }
35130
35131    return null;
35132  },
35133
vendor: 8,875 bytes, lines 35134-35487
35134  draw: function(chart, labels) {
35135    var i, ilen, label, state, geometry, center;
35136
35137    for (i = 0, ilen = labels.length; i < ilen; ++i) {
35138      label = labels[i];
35139      state = label.$layout;
35140
35141      if (state._visible) {
35142        geometry = label.geometry();
35143        center = coordinates(label._el, label.model(), geometry);
35144        state._box.update(center, geometry, label.rotation());
35145        label.draw(chart, center);
35146      }
35147    }
35148  }
35149};
35150
35151var formatter = function(value) {
35152  if (helpers.isNullOrUndef(value)) {
35153    return null;
35154  }
35155
35156  var label = value;
35157  var keys, klen, k;
35158  if (helpers.isObject(value)) {
35159    if (!helpers.isNullOrUndef(value.label)) {
35160      label = value.label;
35161    } else if (!helpers.isNullOrUndef(value.r)) {
35162      label = value.r;
35163    } else {
35164      label = '';
35165      keys = Object.keys(value);
35166      for (k = 0, klen = keys.length; k < klen; ++k) {
35167        label += (k !== 0 ? ', ' : '') + keys[k] + ': ' + value[keys[k]];
35168      }
35169    }
35170  }
35171
35172  return '' + label;
35173};
35174
35175/**
35176 * IMPORTANT: make sure to also update tests and TypeScript definition
35177 * files (`/test/specs/defaults.spec.js` and `/types/options.d.ts`)
35178 */
35179
35180var defaults = {
35181  align: 'center',
35182  anchor: 'center',
35183  backgroundColor: null,
35184  borderColor: null,
35185  borderRadius: 0,
35186  borderWidth: 0,
35187  clamp: false,
35188  clip: false,
35189  color: undefined,
35190  display: true,
35191  font: {
35192    family: undefined,
35193    lineHeight: 1.2,
35194    size: undefined,
35195    style: undefined,
35196    weight: null
35197  },
35198  formatter: formatter,
35199  labels: undefined,
35200  listeners: {},
35201  offset: 4,
35202  opacity: 1,
35203  padding: {
35204    top: 4,
35205    right: 4,
35206    bottom: 4,
35207    left: 4
35208  },
35209  rotation: 0,
35210  textAlign: 'start',
35211  textStrokeColor: undefined,
35212  textStrokeWidth: 0,
35213  textShadowBlur: 0,
35214  textShadowColor: undefined
35215};
35216
35217/**
35218 * @see https://github.com/chartjs/Chart.js/issues/4176
35219 */
35220
35221var EXPANDO_KEY = '$datalabels';
35222var DEFAULT_KEY = '$default';
35223
35224function configure(dataset, options) {
35225  var override = dataset.datalabels;
35226  var listeners = {};
35227  var configs = [];
35228  var labels, keys;
35229
35230  if (override === false) {
35231    return null;
35232  }
35233  if (override === true) {
35234    override = {};
35235  }
35236
35237  options = helpers.merge({}, [options, override]);
35238  labels = options.labels || {};
35239  keys = Object.keys(labels);
35240  delete options.labels;
35241
35242  if (keys.length) {
35243    keys.forEach(function(key) {
35244      if (labels[key]) {
35245        configs.push(helpers.merge({}, [
35246          options,
35247          labels[key],
35248          {_key: key}
35249        ]));
35250      }
35251    });
35252  } else {
35253    // Default label if no "named" label defined.
35254    configs.push(options);
35255  }
35256
35257  // listeners: {<event-type>: {<label-key>: <fn>}}
35258  listeners = configs.reduce(function(target, config) {
35259    helpers.each(config.listeners || {}, function(fn, event) {
35260      target[event] = target[event] || {};
35261      target[event][config._key || DEFAULT_KEY] = fn;
35262    });
35263
35264    delete config.listeners;
35265    return target;
35266  }, {});
35267
35268  return {
35269    labels: configs,
35270    listeners: listeners
35271  };
35272}
35273
35274function dispatchEvent(chart, listeners, label, event) {
35275  if (!listeners) {
35276    return;
35277  }
35278
35279  var context = label.$context;
35280  var groups = label.$groups;
35281  var callback;
35282
35283  if (!listeners[groups._set]) {
35284    return;
35285  }
35286
35287  callback = listeners[groups._set][groups._key];
35288  if (!callback) {
35289    return;
35290  }
35291
35292  if (helpers.callback(callback, [context, event]) === true) {
35293    // Users are allowed to tweak the given context by injecting values that can be
35294    // used in scriptable options to display labels differently based on the current
35295    // event (e.g. highlight an hovered label). That's why we update the label with
35296    // the output context and schedule a new chart render by setting it dirty.
35297    chart[EXPANDO_KEY]._dirty = true;
35298    label.update(context);
35299  }
35300}
35301
35302function dispatchMoveEvents(chart, listeners, previous, label, event) {
35303  var enter, leave;
35304
35305  if (!previous && !label) {
35306    return;
35307  }
35308
35309  if (!previous) {
35310    enter = true;
35311  } else if (!label) {
35312    leave = true;
35313  } else if (previous !== label) {
35314    leave = enter = true;
35315  }
35316
35317  if (leave) {
35318    dispatchEvent(chart, listeners.leave, previous, event);
35319  }
35320  if (enter) {
35321    dispatchEvent(chart, listeners.enter, label, event);
35322  }
35323}
35324
35325function handleMoveEvents(chart, event) {
35326  var expando = chart[EXPANDO_KEY];
35327  var listeners = expando._listeners;
35328  var previous, label;
35329
35330  if (!listeners.enter && !listeners.leave) {
35331    return;
35332  }
35333
35334  if (event.type === 'mousemove') {
35335    label = layout.lookup(expando._labels, event);
35336  } else if (event.type !== 'mouseout') {
35337    return;
35338  }
35339
35340  previous = expando._hovered;
35341  expando._hovered = label;
35342  dispatchMoveEvents(chart, listeners, previous, label, event);
35343}
35344
35345function handleClickEvents(chart, event) {
35346  var expando = chart[EXPANDO_KEY];
35347  var handlers = expando._listeners.click;
35348  var label = handlers && layout.lookup(expando._labels, event);
35349  if (label) {
35350    dispatchEvent(chart, handlers, label, event);
35351  }
35352}
35353
35354var plugin = {
35355  id: 'datalabels',
35356
35357  defaults: defaults,
35358
35359  beforeInit: function(chart) {
35360    chart[EXPANDO_KEY] = {
35361      _actives: []
35362    };
35363  },
35364
35365  beforeUpdate: function(chart) {
35366    var expando = chart[EXPANDO_KEY];
35367    expando._listened = false;
35368    expando._listeners = {};     // {<event-type>: {<dataset-index>: {<label-key>: <fn>}}}
35369    expando._datasets = [];      // per dataset labels: [Label[]]
35370    expando._labels = [];        // layouted labels: Label[]
35371  },
35372
35373  afterDatasetUpdate: function(chart, args, options) {
35374    var datasetIndex = args.index;
35375    var expando = chart[EXPANDO_KEY];
35376    var labels = expando._datasets[datasetIndex] = [];
35377    var visible = chart.isDatasetVisible(datasetIndex);
35378    var dataset = chart.data.datasets[datasetIndex];
35379    var config = configure(dataset, options);
35380    var elements = args.meta.data || [];
35381    var ctx = chart.ctx;
35382    var i, j, ilen, jlen, cfg, key, el, label;
35383
35384    ctx.save();
35385
35386    for (i = 0, ilen = elements.length; i < ilen; ++i) {
35387      el = elements[i];
35388      el[EXPANDO_KEY] = [];
35389
35390      if (visible && el && chart.getDataVisibility(i) && !el.skip) {
35391        for (j = 0, jlen = config.labels.length; j < jlen; ++j) {
35392          cfg = config.labels[j];
35393          key = cfg._key;
35394
35395          label = new Label(cfg, ctx, el, i);
35396          label.$groups = {
35397            _set: datasetIndex,
35398            _key: key || DEFAULT_KEY
35399          };
35400          label.$context = {
35401            active: false,
35402            chart: chart,
35403            dataIndex: i,
35404            dataset: dataset,
35405            datasetIndex: datasetIndex
35406          };
35407
35408          label.update(label.$context);
35409          el[EXPANDO_KEY].push(label);
35410          labels.push(label);
35411        }
35412      }
35413    }
35414
35415    ctx.restore();
35416
35417    // Store listeners at the chart level and per event type to optimize
35418    // cases where no listeners are registered for a specific event.
35419    helpers.merge(expando._listeners, config.listeners, {
35420      merger: function(event, target, source) {
35421        target[event] = target[event] || {};
35422        target[event][args.index] = source[event];
35423        expando._listened = true;
35424      }
35425    });
35426  },
35427
35428  afterUpdate: function(chart) {
35429    chart[EXPANDO_KEY]._labels = layout.prepare(chart[EXPANDO_KEY]._datasets);
35430  },
35431
35432  // Draw labels on top of all dataset elements
35433  // https://github.com/chartjs/chartjs-plugin-datalabels/issues/29
35434  // https://github.com/chartjs/chartjs-plugin-datalabels/issues/32
35435  afterDatasetsDraw: function(chart) {
35436    layout.draw(chart, chart[EXPANDO_KEY]._labels);
35437  },
35438
35439  beforeEvent: function(chart, args) {
35440    // If there is no listener registered for this chart, `listened` will be false,
35441    // meaning we can immediately ignore the incoming event and avoid useless extra
35442    // computation for users who don't implement label interactions.
35443    if (chart[EXPANDO_KEY]._listened) {
35444      var event = args.event;
35445      switch (event.type) {
35446      case 'mousemove':
35447      case 'mouseout':
35448        handleMoveEvents(chart, event);
35449        break;
35450      case 'click':
35451        handleClickEvents(chart, event);
35452        break;
35453      }
35454    }
35455  },
35456
35457  afterEvent: function(chart) {
35458    var expando = chart[EXPANDO_KEY];
35459    var previous = expando._actives;
35460    var actives = expando._actives = chart.getActiveElements();
35461    var updates = utils.arrayDiff(previous, actives);
35462    var i, ilen, j, jlen, update, label, labels;
35463
35464    for (i = 0, ilen = updates.length; i < ilen; ++i) {
35465      update = updates[i];
35466      if (update[1]) {
35467        labels = update[0].element[EXPANDO_KEY] || [];
35468        for (j = 0, jlen = labels.length; j < jlen; ++j) {
35469          label = labels[j];
35470          label.$context.active = (update[1] === 1);
35471          label.update(label.$context);
35472        }
35473      }
35474    }
35475
35476    if (expando._dirty || updates.length) {
35477      layout.update(expando._labels);
35478      chart.render();
35479    }
35480
35481    delete expando._dirty;
35482  }
35483};
35484
35485return plugin;
35486
35487}));
35488
35489
35490
35491// chartjs-plugin-colorschemes-v3 に問題があり helpers をグローバル変数として定義しておかないとプラグイン内でエラーが発生する
35492// 現状 colorschemes を利用している箇所はオープンデータのグラフプレビューのみ
35493window.helpers = Chart.helpers;
35494/*!
35495 * chartjs-plugin-colorschemes-v3 v0.5.4
35496 * https://nagix.github.io/chartjs-plugin-colorschemes
35497 * (c) 2022 Akihiko Kusanagi
35498 * Released under the MIT license
35499 */
35500(function (global, factory) {
35501typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('chart.js'), require('chart.js/helpers')) :
35502typeof define === 'function' && define.amd ? define(['chart.js', 'chart.js/helpers'], factory) :
35503(global = global || self, global.ChartColorSchemes = factory(global.Chart, global.helpers));
35504}(this, (function (chart_js, helpers) { 'use strict
vendor: 54,309 bytes, lines 35504-36528
35504';
35505
35506// eslint-disable-next-line one-var
35507var
35508	// Sequential
35509	YlGn3 = ['#f7fcb9', '#addd8e', '#31a354'],
35510	YlGn4 = ['#ffffcc', '#c2e699', '#78c679', '#238443'],
35511	YlGn5 = ['#ffffcc', '#c2e699', '#78c679', '#31a354', '#006837'],
35512	YlGn6 = ['#ffffcc', '#d9f0a3', '#addd8e', '#78c679', '#31a354', '#006837'],
35513	YlGn7 = ['#ffffcc', '#d9f0a3', '#addd8e', '#78c679', '#41ab5d', '#238443', '#005a32'],
35514	YlGn8 = ['#ffffe5', '#f7fcb9', '#d9f0a3', '#addd8e', '#78c679', '#41ab5d', '#238443', '#005a32'],
35515	YlGn9 = ['#ffffe5', '#f7fcb9', '#d9f0a3', '#addd8e', '#78c679', '#41ab5d', '#238443', '#006837', '#004529'],
35516
35517	YlGnBu3 = ['#edf8b1', '#7fcdbb', '#2c7fb8'],
35518	YlGnBu4 = ['#ffffcc', '#a1dab4', '#41b6c4', '#225ea8'],
35519	YlGnBu5 = ['#ffffcc', '#a1dab4', '#41b6c4', '#2c7fb8', '#253494'],
35520	YlGnBu6 = ['#ffffcc', '#c7e9b4', '#7fcdbb', '#41b6c4', '#2c7fb8', '#253494'],
35521	YlGnBu7 = ['#ffffcc', '#c7e9b4', '#7fcdbb', '#41b6c4', '#1d91c0', '#225ea8', '#0c2c84'],
35522	YlGnBu8 = ['#ffffd9', '#edf8b1', '#c7e9b4', '#7fcdbb', '#41b6c4', '#1d91c0', '#225ea8', '#0c2c84'],
35523	YlGnBu9 = ['#ffffd9', '#edf8b1', '#c7e9b4', '#7fcdbb', '#41b6c4', '#1d91c0', '#225ea8', '#253494', '#081d58'],
35524
35525	GnBu3 = ['#e0f3db', '#a8ddb5', '#43a2ca'],
35526	GnBu4 = ['#f0f9e8', '#bae4bc', '#7bccc4', '#2b8cbe'],
35527	GnBu5 = ['#f0f9e8', '#bae4bc', '#7bccc4', '#43a2ca', '#0868ac'],
35528	GnBu6 = ['#f0f9e8', '#ccebc5', '#a8ddb5', '#7bccc4', '#43a2ca', '#0868ac'],
35529	GnBu7 = ['#f0f9e8', '#ccebc5', '#a8ddb5', '#7bccc4', '#4eb3d3', '#2b8cbe', '#08589e'],
35530	GnBu8 = ['#f7fcf0', '#e0f3db', '#ccebc5', '#a8ddb5', '#7bccc4', '#4eb3d3', '#2b8cbe', '#08589e'],
35531	GnBu9 = ['#f7fcf0', '#e0f3db', '#ccebc5', '#a8ddb5', '#7bccc4', '#4eb3d3', '#2b8cbe', '#0868ac', '#084081'],
35532
35533	BuGn3 = ['#e5f5f9', '#99d8c9', '#2ca25f'],
35534	BuGn4 = ['#edf8fb', '#b2e2e2', '#66c2a4', '#238b45'],
35535	BuGn5 = ['#edf8fb', '#b2e2e2', '#66c2a4', '#2ca25f', '#006d2c'],
35536	BuGn6 = ['#edf8fb', '#ccece6', '#99d8c9', '#66c2a4', '#2ca25f', '#006d2c'],
35537	BuGn7 = ['#edf8fb', '#ccece6', '#99d8c9', '#66c2a4', '#41ae76', '#238b45', '#005824'],
35538	BuGn8 = ['#f7fcfd', '#e5f5f9', '#ccece6', '#99d8c9', '#66c2a4', '#41ae76', '#238b45', '#005824'],
35539	BuGn9 = ['#f7fcfd', '#e5f5f9', '#ccece6', '#99d8c9', '#66c2a4', '#41ae76', '#238b45', '#006d2c', '#00441b'],
35540
35541	PuBuGn3 = ['#ece2f0', '#a6bddb', '#1c9099'],
35542	PuBuGn4 = ['#f6eff7', '#bdc9e1', '#67a9cf', '#02818a'],
35543	PuBuGn5 = ['#f6eff7', '#bdc9e1', '#67a9cf', '#1c9099', '#016c59'],
35544	PuBuGn6 = ['#f6eff7', '#d0d1e6', '#a6bddb', '#67a9cf', '#1c9099', '#016c59'],
35545	PuBuGn7 = ['#f6eff7', '#d0d1e6', '#a6bddb', '#67a9cf', '#3690c0', '#02818a', '#016450'],
35546	PuBuGn8 = ['#fff7fb', '#ece2f0', '#d0d1e6', '#a6bddb', '#67a9cf', '#3690c0', '#02818a', '#016450'],
35547	PuBuGn9 = ['#fff7fb', '#ece2f0', '#d0d1e6', '#a6bddb', '#67a9cf', '#3690c0', '#02818a', '#016c59', '#014636'],
35548
35549	PuBu3 = ['#ece7f2', '#a6bddb', '#2b8cbe'],
35550	PuBu4 = ['#f1eef6', '#bdc9e1', '#74a9cf', '#0570b0'],
35551	PuBu5 = ['#f1eef6', '#bdc9e1', '#74a9cf', '#2b8cbe', '#045a8d'],
35552	PuBu6 = ['#f1eef6', '#d0d1e6', '#a6bddb', '#74a9cf', '#2b8cbe', '#045a8d'],
35553	PuBu7 = ['#f1eef6', '#d0d1e6', '#a6bddb', '#74a9cf', '#3690c0', '#0570b0', '#034e7b'],
35554	PuBu8 = ['#fff7fb', '#ece7f2', '#d0d1e6', '#a6bddb', '#74a9cf', '#3690c0', '#0570b0', '#034e7b'],
35555	PuBu9 = ['#fff7fb', '#ece7f2', '#d0d1e6', '#a6bddb', '#74a9cf', '#3690c0', '#0570b0', '#045a8d', '#023858'],
35556
35557	BuPu3 = ['#e0ecf4', '#9ebcda', '#8856a7'],
35558	BuPu4 = ['#edf8fb', '#b3cde3', '#8c96c6', '#88419d'],
35559	BuPu5 = ['#edf8fb', '#b3cde3', '#8c96c6', '#8856a7', '#810f7c'],
35560	BuPu6 = ['#edf8fb', '#bfd3e6', '#9ebcda', '#8c96c6', '#8856a7', '#810f7c'],
35561	BuPu7 = ['#edf8fb', '#bfd3e6', '#9ebcda', '#8c96c6', '#8c6bb1', '#88419d', '#6e016b'],
35562	BuPu8 = ['#f7fcfd', '#e0ecf4', '#bfd3e6', '#9ebcda', '#8c96c6', '#8c6bb1', '#88419d', '#6e016b'],
35563	BuPu9 = ['#f7fcfd', '#e0ecf4', '#bfd3e6', '#9ebcda', '#8c96c6', '#8c6bb1', '#88419d', '#810f7c', '#4d004b'],
35564
35565	RdPu3 = ['#fde0dd', '#fa9fb5', '#c51b8a'],
35566	RdPu4 = ['#feebe2', '#fbb4b9', '#f768a1', '#ae017e'],
35567	RdPu5 = ['#feebe2', '#fbb4b9', '#f768a1', '#c51b8a', '#7a0177'],
35568	RdPu6 = ['#feebe2', '#fcc5c0', '#fa9fb5', '#f768a1', '#c51b8a', '#7a0177'],
35569	RdPu7 = ['#feebe2', '#fcc5c0', '#fa9fb5', '#f768a1', '#dd3497', '#ae017e', '#7a0177'],
35570	RdPu8 = ['#fff7f3', '#fde0dd', '#fcc5c0', '#fa9fb5', '#f768a1', '#dd3497', '#ae017e', '#7a0177'],
35571	RdPu9 = ['#fff7f3', '#fde0dd', '#fcc5c0', '#fa9fb5', '#f768a1', '#dd3497', '#ae017e', '#7a0177', '#49006a'],
35572
35573	PuRd3 = ['#e7e1ef', '#c994c7', '#dd1c77'],
35574	PuRd4 = ['#f1eef6', '#d7b5d8', '#df65b0', '#ce1256'],
35575	PuRd5 = ['#f1eef6', '#d7b5d8', '#df65b0', '#dd1c77', '#980043'],
35576	PuRd6 = ['#f1eef6', '#d4b9da', '#c994c7', '#df65b0', '#dd1c77', '#980043'],
35577	PuRd7 = ['#f1eef6', '#d4b9da', '#c994c7', '#df65b0', '#e7298a', '#ce1256', '#91003f'],
35578	PuRd8 = ['#f7f4f9', '#e7e1ef', '#d4b9da', '#c994c7', '#df65b0', '#e7298a', '#ce1256', '#91003f'],
35579	PuRd9 = ['#f7f4f9', '#e7e1ef', '#d4b9da', '#c994c7', '#df65b0', '#e7298a', '#ce1256', '#980043', '#67001f'],
35580
35581	OrRd3 = ['#fee8c8', '#fdbb84', '#e34a33'],
35582	OrRd4 = ['#fef0d9', '#fdcc8a', '#fc8d59', '#d7301f'],
35583	OrRd5 = ['#fef0d9', '#fdcc8a', '#fc8d59', '#e34a33', '#b30000'],
35584	OrRd6 = ['#fef0d9', '#fdd49e', '#fdbb84', '#fc8d59', '#e34a33', '#b30000'],
35585	OrRd7 = ['#fef0d9', '#fdd49e', '#fdbb84', '#fc8d59', '#ef6548', '#d7301f', '#990000'],
35586	OrRd8 = ['#fff7ec', '#fee8c8', '#fdd49e', '#fdbb84', '#fc8d59', '#ef6548', '#d7301f', '#990000'],
35587	OrRd9 = ['#fff7ec', '#fee8c8', '#fdd49e', '#fdbb84', '#fc8d59', '#ef6548', '#d7301f', '#b30000', '#7f0000'],
35588
35589	YlOrRd3 = ['#ffeda0', '#feb24c', '#f03b20'],
35590	YlOrRd4 = ['#ffffb2', '#fecc5c', '#fd8d3c', '#e31a1c'],
35591	YlOrRd5 = ['#ffffb2', '#fecc5c', '#fd8d3c', '#f03b20', '#bd0026'],
35592	YlOrRd6 = ['#ffffb2', '#fed976', '#feb24c', '#fd8d3c', '#f03b20', '#bd0026'],
35593	YlOrRd7 = ['#ffffb2', '#fed976', '#feb24c', '#fd8d3c', '#fc4e2a', '#e31a1c', '#b10026'],
35594	YlOrRd8 = ['#ffffcc', '#ffeda0', '#fed976', '#feb24c', '#fd8d3c', '#fc4e2a', '#e31a1c', '#b10026'],
35595	YlOrRd9 = ['#ffffcc', '#ffeda0', '#fed976', '#feb24c', '#fd8d3c', '#fc4e2a', '#e31a1c', '#bd0026', '#800026'],
35596
35597	YlOrBr3 = ['#fff7bc', '#fec44f', '#d95f0e'],
35598	YlOrBr4 = ['#ffffd4', '#fed98e', '#fe9929', '#cc4c02'],
35599	YlOrBr5 = ['#ffffd4', '#fed98e', '#fe9929', '#d95f0e', '#993404'],
35600	YlOrBr6 = ['#ffffd4', '#fee391', '#fec44f', '#fe9929', '#d95f0e', '#993404'],
35601	YlOrBr7 = ['#ffffd4', '#fee391', '#fec44f', '#fe9929', '#ec7014', '#cc4c02', '#8c2d04'],
35602	YlOrBr8 = ['#ffffe5', '#fff7bc', '#fee391', '#fec44f', '#fe9929', '#ec7014', '#cc4c02', '#8c2d04'],
35603	YlOrBr9 = ['#ffffe5', '#fff7bc', '#fee391', '#fec44f', '#fe9929', '#ec7014', '#cc4c02', '#993404', '#662506'],
35604
35605	Purples3 = ['#efedf5', '#bcbddc', '#756bb1'],
35606	Purples4 = ['#f2f0f7', '#cbc9e2', '#9e9ac8', '#6a51a3'],
35607	Purples5 = ['#f2f0f7', '#cbc9e2', '#9e9ac8', '#756bb1', '#54278f'],
35608	Purples6 = ['#f2f0f7', '#dadaeb', '#bcbddc', '#9e9ac8', '#756bb1', '#54278f'],
35609	Purples7 = ['#f2f0f7', '#dadaeb', '#bcbddc', '#9e9ac8', '#807dba', '#6a51a3', '#4a1486'],
35610	Purples8 = ['#fcfbfd', '#efedf5', '#dadaeb', '#bcbddc', '#9e9ac8', '#807dba', '#6a51a3', '#4a1486'],
35611	Purples9 = ['#fcfbfd', '#efedf5', '#dadaeb', '#bcbddc', '#9e9ac8', '#807dba', '#6a51a3', '#54278f', '#3f007d'],
35612
35613	Blues3 = ['#deebf7', '#9ecae1', '#3182bd'],
35614	Blues4 = ['#eff3ff', '#bdd7e7', '#6baed6', '#2171b5'],
35615	Blues5 = ['#eff3ff', '#bdd7e7', '#6baed6', '#3182bd', '#08519c'],
35616	Blues6 = ['#eff3ff', '#c6dbef', '#9ecae1', '#6baed6', '#3182bd', '#08519c'],
35617	Blues7 = ['#eff3ff', '#c6dbef', '#9ecae1', '#6baed6', '#4292c6', '#2171b5', '#084594'],
35618	Blues8 = ['#f7fbff', '#deebf7', '#c6dbef', '#9ecae1', '#6baed6', '#4292c6', '#2171b5', '#084594'],
35619	Blues9 = ['#f7fbff', '#deebf7', '#c6dbef', '#9ecae1', '#6baed6', '#4292c6', '#2171b5', '#08519c', '#08306b'],
35620
35621	Greens3 = ['#e5f5e0', '#a1d99b', '#31a354'],
35622	Greens4 = ['#edf8e9', '#bae4b3', '#74c476', '#238b45'],
35623	Greens5 = ['#edf8e9', '#bae4b3', '#74c476', '#31a354', '#006d2c'],
35624	Greens6 = ['#edf8e9', '#c7e9c0', '#a1d99b', '#74c476', '#31a354', '#006d2c'],
35625	Greens7 = ['#edf8e9', '#c7e9c0', '#a1d99b', '#74c476', '#41ab5d', '#238b45', '#005a32'],
35626	Greens8 = ['#f7fcf5', '#e5f5e0', '#c7e9c0', '#a1d99b', '#74c476', '#41ab5d', '#238b45', '#005a32'],
35627	Greens9 = ['#f7fcf5', '#e5f5e0', '#c7e9c0', '#a1d99b', '#74c476', '#41ab5d', '#238b45', '#006d2c', '#00441b'],
35628
35629	Oranges3 = ['#fee6ce', '#fdae6b', '#e6550d'],
35630	Oranges4 = ['#feedde', '#fdbe85', '#fd8d3c', '#d94701'],
35631	Oranges5 = ['#feedde', '#fdbe85', '#fd8d3c', '#e6550d', '#a63603'],
35632	Oranges6 = ['#feedde', '#fdd0a2', '#fdae6b', '#fd8d3c', '#e6550d', '#a63603'],
35633	Oranges7 = ['#feedde', '#fdd0a2', '#fdae6b', '#fd8d3c', '#f16913', '#d94801', '#8c2d04'],
35634	Oranges8 = ['#fff5eb', '#fee6ce', '#fdd0a2', '#fdae6b', '#fd8d3c', '#f16913', '#d94801', '#8c2d04'],
35635	Oranges9 = ['#fff5eb', '#fee6ce', '#fdd0a2', '#fdae6b', '#fd8d3c', '#f16913', '#d94801', '#a63603', '#7f2704'],
35636
35637	Reds3 = ['#fee0d2', '#fc9272', '#de2d26'],
35638	Reds4 = ['#fee5d9', '#fcae91', '#fb6a4a', '#cb181d'],
35639	Reds5 = ['#fee5d9', '#fcae91', '#fb6a4a', '#de2d26', '#a50f15'],
35640	Reds6 = ['#fee5d9', '#fcbba1', '#fc9272', '#fb6a4a', '#de2d26', '#a50f15'],
35641	Reds7 = ['#fee5d9', '#fcbba1', '#fc9272', '#fb6a4a', '#ef3b2c', '#cb181d', '#99000d'],
35642	Reds8 = ['#fff5f0', '#fee0d2', '#fcbba1', '#fc9272', '#fb6a4a', '#ef3b2c', '#cb181d', '#99000d'],
35643	Reds9 = ['#fff5f0', '#fee0d2', '#fcbba1', '#fc9272', '#fb6a4a', '#ef3b2c', '#cb181d', '#a50f15', '#67000d'],
35644
35645	Greys3 = ['#f0f0f0', '#bdbdbd', '#636363'],
35646	Greys4 = ['#f7f7f7', '#cccccc', '#969696', '#525252'],
35647	Greys5 = ['#f7f7f7', '#cccccc', '#969696', '#636363', '#252525'],
35648	Greys6 = ['#f7f7f7', '#d9d9d9', '#bdbdbd', '#969696', '#636363', '#252525'],
35649	Greys7 = ['#f7f7f7', '#d9d9d9', '#bdbdbd', '#969696', '#737373', '#525252', '#252525'],
35650	Greys8 = ['#ffffff', '#f0f0f0', '#d9d9d9', '#bdbdbd', '#969696', '#737373', '#525252', '#252525'],
35651	Greys9 = ['#ffffff', '#f0f0f0', '#d9d9d9', '#bdbdbd', '#969696', '#737373', '#525252', '#252525', '#000000'],
35652
35653	// Diverging
35654	PuOr3 = ['#f1a340', '#f7f7f7', '#998ec3'],
35655	PuOr4 = ['#e66101', '#fdb863', '#b2abd2', '#5e3c99'],
35656	PuOr5 = ['#e66101', '#fdb863', '#f7f7f7', '#b2abd2', '#5e3c99'],
35657	PuOr6 = ['#b35806', '#f1a340', '#fee0b6', '#d8daeb', '#998ec3', '#542788'],
35658	PuOr7 = ['#b35806', '#f1a340', '#fee0b6', '#f7f7f7', '#d8daeb', '#998ec3', '#542788'],
35659	PuOr8 = ['#b35806', '#e08214', '#fdb863', '#fee0b6', '#d8daeb', '#b2abd2', '#8073ac', '#542788'],
35660	PuOr9 = ['#b35806', '#e08214', '#fdb863', '#fee0b6', '#f7f7f7', '#d8daeb', '#b2abd2', '#8073ac', '#542788'],
35661	PuOr10 = ['#7f3b08', '#b35806', '#e08214', '#fdb863', '#fee0b6', '#d8daeb', '#b2abd2', '#8073ac', '#542788', '#2d004b'],
35662	PuOr11 = ['#7f3b08', '#b35806', '#e08214', '#fdb863', '#fee0b6', '#f7f7f7', '#d8daeb', '#b2abd2', '#8073ac', '#542788', '#2d004b'],
35663
35664	BrBG3 = ['#d8b365', '#f5f5f5', '#5ab4ac'],
35665	BrBG4 = ['#a6611a', '#dfc27d', '#80cdc1', '#018571'],
35666	BrBG5 = ['#a6611a', '#dfc27d', '#f5f5f5', '#80cdc1', '#018571'],
35667	BrBG6 = ['#8c510a', '#d8b365', '#f6e8c3', '#c7eae5', '#5ab4ac', '#01665e'],
35668	BrBG7 = ['#8c510a', '#d8b365', '#f6e8c3', '#f5f5f5', '#c7eae5', '#5ab4ac', '#01665e'],
35669	BrBG8 = ['#8c510a', '#bf812d', '#dfc27d', '#f6e8c3', '#c7eae5', '#80cdc1', '#35978f', '#01665e'],
35670	BrBG9 = ['#8c510a', '#bf812d', '#dfc27d', '#f6e8c3', '#f5f5f5', '#c7eae5', '#80cdc1', '#35978f', '#01665e'],
35671	BrBG10 = ['#543005', '#8c510a', '#bf812d', '#dfc27d', '#f6e8c3', '#c7eae5', '#80cdc1', '#35978f', '#01665e', '#003c30'],
35672	BrBG11 = ['#543005', '#8c510a', '#bf812d', '#dfc27d', '#f6e8c3', '#f5f5f5', '#c7eae5', '#80cdc1', '#35978f', '#01665e', '#003c30'],
35673
35674	PRGn3 = ['#af8dc3', '#f7f7f7', '#7fbf7b'],
35675	PRGn4 = ['#7b3294', '#c2a5cf', '#a6dba0', '#008837'],
35676	PRGn5 = ['#7b3294', '#c2a5cf', '#f7f7f7', '#a6dba0', '#008837'],
35677	PRGn6 = ['#762a83', '#af8dc3', '#e7d4e8', '#d9f0d3', '#7fbf7b', '#1b7837'],
35678	PRGn7 = ['#762a83', '#af8dc3', '#e7d4e8', '#f7f7f7', '#d9f0d3', '#7fbf7b', '#1b7837'],
35679	PRGn8 = ['#762a83', '#9970ab', '#c2a5cf', '#e7d4e8', '#d9f0d3', '#a6dba0', '#5aae61', '#1b7837'],
35680	PRGn9 = ['#762a83', '#9970ab', '#c2a5cf', '#e7d4e8', '#f7f7f7', '#d9f0d3', '#a6dba0', '#5aae61', '#1b7837'],
35681	PRGn10 = ['#40004b', '#762a83', '#9970ab', '#c2a5cf', '#e7d4e8', '#d9f0d3', '#a6dba0', '#5aae61', '#1b7837', '#00441b'],
35682	PRGn11 = ['#40004b', '#762a83', '#9970ab', '#c2a5cf', '#e7d4e8', '#f7f7f7', '#d9f0d3', '#a6dba0', '#5aae61', '#1b7837', '#00441b'],
35683
35684	PiYG3 = ['#e9a3c9', '#f7f7f7', '#a1d76a'],
35685	PiYG4 = ['#d01c8b', '#f1b6da', '#b8e186', '#4dac26'],
35686	PiYG5 = ['#d01c8b', '#f1b6da', '#f7f7f7', '#b8e186', '#4dac26'],
35687	PiYG6 = ['#c51b7d', '#e9a3c9', '#fde0ef', '#e6f5d0', '#a1d76a', '#4d9221'],
35688	PiYG7 = ['#c51b7d', '#e9a3c9', '#fde0ef', '#f7f7f7', '#e6f5d0', '#a1d76a', '#4d9221'],
35689	PiYG8 = ['#c51b7d', '#de77ae', '#f1b6da', '#fde0ef', '#e6f5d0', '#b8e186', '#7fbc41', '#4d9221'],
35690	PiYG9 = ['#c51b7d', '#de77ae', '#f1b6da', '#fde0ef', '#f7f7f7', '#e6f5d0', '#b8e186', '#7fbc41', '#4d9221'],
35691	PiYG10 = ['#8e0152', '#c51b7d', '#de77ae', '#f1b6da', '#fde0ef', '#e6f5d0', '#b8e186', '#7fbc41', '#4d9221', '#276419'],
35692	PiYG11 = ['#8e0152', '#c51b7d', '#de77ae', '#f1b6da', '#fde0ef', '#f7f7f7', '#e6f5d0', '#b8e186', '#7fbc41', '#4d9221', '#276419'],
35693
35694	RdBu3 = ['#ef8a62', '#f7f7f7', '#67a9cf'],
35695	RdBu4 = ['#ca0020', '#f4a582', '#92c5de', '#0571b0'],
35696	RdBu5 = ['#ca0020', '#f4a582', '#f7f7f7', '#92c5de', '#0571b0'],
35697	RdBu6 = ['#b2182b', '#ef8a62', '#fddbc7', '#d1e5f0', '#67a9cf', '#2166ac'],
35698	RdBu7 = ['#b2182b', '#ef8a62', '#fddbc7', '#f7f7f7', '#d1e5f0', '#67a9cf', '#2166ac'],
35699	RdBu8 = ['#b2182b', '#d6604d', '#f4a582', '#fddbc7', '#d1e5f0', '#92c5de', '#4393c3', '#2166ac'],
35700	RdBu9 = ['#b2182b', '#d6604d', '#f4a582', '#fddbc7', '#f7f7f7', '#d1e5f0', '#92c5de', '#4393c3', '#2166ac'],
35701	RdBu10 = ['#67001f', '#b2182b', '#d6604d', '#f4a582', '#fddbc7', '#d1e5f0', '#92c5de', '#4393c3', '#2166ac', '#053061'],
35702	RdBu11 = ['#67001f', '#b2182b', '#d6604d', '#f4a582', '#fddbc7', '#f7f7f7', '#d1e5f0', '#92c5de', '#4393c3', '#2166ac', '#053061'],
35703
35704	RdGy3 = ['#ef8a62', '#ffffff', '#999999'],
35705	RdGy4 = ['#ca0020', '#f4a582', '#bababa', '#404040'],
35706	RdGy5 = ['#ca0020', '#f4a582', '#ffffff', '#bababa', '#404040'],
35707	RdGy6 = ['#b2182b', '#ef8a62', '#fddbc7', '#e0e0e0', '#999999', '#4d4d4d'],
35708	RdGy7 = ['#b2182b', '#ef8a62', '#fddbc7', '#ffffff', '#e0e0e0', '#999999', '#4d4d4d'],
35709	RdGy8 = ['#b2182b', '#d6604d', '#f4a582', '#fddbc7', '#e0e0e0', '#bababa', '#878787', '#4d4d4d'],
35710	RdGy9 = ['#b2182b', '#d6604d', '#f4a582', '#fddbc7', '#ffffff', '#e0e0e0', '#bababa', '#878787', '#4d4d4d'],
35711	RdGy10 = ['#67001f', '#b2182b', '#d6604d', '#f4a582', '#fddbc7', '#e0e0e0', '#bababa', '#878787', '#4d4d4d', '#1a1a1a'],
35712	RdGy11 = ['#67001f', '#b2182b', '#d6604d', '#f4a582', '#fddbc7', '#ffffff', '#e0e0e0', '#bababa', '#878787', '#4d4d4d', '#1a1a1a'],
35713
35714	RdYlBu3 = ['#fc8d59', '#ffffbf', '#91bfdb'],
35715	RdYlBu4 = ['#d7191c', '#fdae61', '#abd9e9', '#2c7bb6'],
35716	RdYlBu5 = ['#d7191c', '#fdae61', '#ffffbf', '#abd9e9', '#2c7bb6'],
35717	RdYlBu6 = ['#d73027', '#fc8d59', '#fee090', '#e0f3f8', '#91bfdb', '#4575b4'],
35718	RdYlBu7 = ['#d73027', '#fc8d59', '#fee090', '#ffffbf', '#e0f3f8', '#91bfdb', '#4575b4'],
35719	RdYlBu8 = ['#d73027', '#f46d43', '#fdae61', '#fee090', '#e0f3f8', '#abd9e9', '#74add1', '#4575b4'],
35720	RdYlBu9 = ['#d73027', '#f46d43', '#fdae61', '#fee090', '#ffffbf', '#e0f3f8', '#abd9e9', '#74add1', '#4575b4'],
35721	RdYlBu10 = ['#a50026', '#d73027', '#f46d43', '#fdae61', '#fee090', '#e0f3f8', '#abd9e9', '#74add1', '#4575b4', '#313695'],
35722	RdYlBu11 = ['#a50026', '#d73027', '#f46d43', '#fdae61', '#fee090', '#ffffbf', '#e0f3f8', '#abd9e9', '#74add1', '#4575b4', '#313695'],
35723
35724	Spectral3 = ['#fc8d59', '#ffffbf', '#99d594'],
35725	Spectral4 = ['#d7191c', '#fdae61', '#abdda4', '#2b83ba'],
35726	Spectral5 = ['#d7191c', '#fdae61', '#ffffbf', '#abdda4', '#2b83ba'],
35727	Spectral6 = ['#d53e4f', '#fc8d59', '#fee08b', '#e6f598', '#99d594', '#3288bd'],
35728	Spectral7 = ['#d53e4f', '#fc8d59', '#fee08b', '#ffffbf', '#e6f598', '#99d594', '#3288bd'],
35729	Spectral8 = ['#d53e4f', '#f46d43', '#fdae61', '#fee08b', '#e6f598', '#abdda4', '#66c2a5', '#3288bd'],
35730	Spectral9 = ['#d53e4f', '#f46d43', '#fdae61', '#fee08b', '#ffffbf', '#e6f598', '#abdda4', '#66c2a5', '#3288bd'],
35731	Spectral10 = ['#9e0142', '#d53e4f', '#f46d43', '#fdae61', '#fee08b', '#e6f598', '#abdda4', '#66c2a5', '#3288bd', '#5e4fa2'],
35732	Spectral11 = ['#9e0142', '#d53e4f', '#f46d43', '#fdae61', '#fee08b', '#ffffbf', '#e6f598', '#abdda4', '#66c2a5', '#3288bd', '#5e4fa2'],
35733
35734	RdYlGn3 = ['#fc8d59', '#ffffbf', '#91cf60'],
35735	RdYlGn4 = ['#d7191c', '#fdae61', '#a6d96a', '#1a9641'],
35736	RdYlGn5 = ['#d7191c', '#fdae61', '#ffffbf', '#a6d96a', '#1a9641'],
35737	RdYlGn6 = ['#d73027', '#fc8d59', '#fee08b', '#d9ef8b', '#91cf60', '#1a9850'],
35738	RdYlGn7 = ['#d73027', '#fc8d59', '#fee08b', '#ffffbf', '#d9ef8b', '#91cf60', '#1a9850'],
35739	RdYlGn8 = ['#d73027', '#f46d43', '#fdae61', '#fee08b', '#d9ef8b', '#a6d96a', '#66bd63', '#1a9850'],
35740	RdYlGn9 = ['#d73027', '#f46d43', '#fdae61', '#fee08b', '#ffffbf', '#d9ef8b', '#a6d96a', '#66bd63', '#1a9850'],
35741	RdYlGn10 = ['#a50026', '#d73027', '#f46d43', '#fdae61', '#fee08b', '#d9ef8b', '#a6d96a', '#66bd63', '#1a9850', '#006837'],
35742	RdYlGn11 = ['#a50026', '#d73027', '#f46d43', '#fdae61', '#fee08b', '#ffffbf', '#d9ef8b', '#a6d96a', '#66bd63', '#1a9850', '#006837'],
35743
35744	// Qualitative
35745	Accent3 = ['#7fc97f', '#beaed4', '#fdc086'],
35746	Accent4 = ['#7fc97f', '#beaed4', '#fdc086', '#ffff99'],
35747	Accent5 = ['#7fc97f', '#beaed4', '#fdc086', '#ffff99', '#386cb0'],
35748	Accent6 = ['#7fc97f', '#beaed4', '#fdc086', '#ffff99', '#386cb0', '#f0027f'],
35749	Accent7 = ['#7fc97f', '#beaed4', '#fdc086', '#ffff99', '#386cb0', '#f0027f', '#bf5b17'],
35750	Accent8 = ['#7fc97f', '#beaed4', '#fdc086', '#ffff99', '#386cb0', '#f0027f', '#bf5b17', '#666666'],
35751
35752	DarkTwo3 = ['#1b9e77', '#d95f02', '#7570b3'],
35753	DarkTwo4 = ['#1b9e77', '#d95f02', '#7570b3', '#e7298a'],
35754	DarkTwo5 = ['#1b9e77', '#d95f02', '#7570b3', '#e7298a', '#66a61e'],
35755	DarkTwo6 = ['#1b9e77', '#d95f02', '#7570b3', '#e7298a', '#66a61e', '#e6ab02'],
35756	DarkTwo7 = ['#1b9e77', '#d95f02', '#7570b3', '#e7298a', '#66a61e', '#e6ab02', '#a6761d'],
35757	DarkTwo8 = ['#1b9e77', '#d95f02', '#7570b3', '#e7298a', '#66a61e', '#e6ab02', '#a6761d', '#666666'],
35758
35759	Paired3 = ['#a6cee3', '#1f78b4', '#b2df8a'],
35760	Paired4 = ['#a6cee3', '#1f78b4', '#b2df8a', '#33a02c'],
35761	Paired5 = ['#a6cee3', '#1f78b4', '#b2df8a', '#33a02c', '#fb9a99'],
35762	Paired6 = ['#a6cee3', '#1f78b4', '#b2df8a', '#33a02c', '#fb9a99', '#e31a1c'],
35763	Paired7 = ['#a6cee3', '#1f78b4', '#b2df8a', '#33a02c', '#fb9a99', '#e31a1c', '#fdbf6f'],
35764	Paired8 = ['#a6cee3', '#1f78b4', '#b2df8a', '#33a02c', '#fb9a99', '#e31a1c', '#fdbf6f', '#ff7f00'],
35765	Paired9 = ['#a6cee3', '#1f78b4', '#b2df8a', '#33a02c', '#fb9a99', '#e31a1c', '#fdbf6f', '#ff7f00', '#cab2d6'],
35766	Paired10 = ['#a6cee3', '#1f78b4', '#b2df8a', '#33a02c', '#fb9a99', '#e31a1c', '#fdbf6f', '#ff7f00', '#cab2d6', '#6a3d9a'],
35767	Paired11 = ['#a6cee3', '#1f78b4', '#b2df8a', '#33a02c', '#fb9a99', '#e31a1c', '#fdbf6f', '#ff7f00', '#cab2d6', '#6a3d9a', '#ffff99'],
35768	Paired12 = ['#a6cee3', '#1f78b4', '#b2df8a', '#33a02c', '#fb9a99', '#e31a1c', '#fdbf6f', '#ff7f00', '#cab2d6', '#6a3d9a', '#ffff99', '#b15928'],
35769
35770	PastelOne3 = ['#fbb4ae', '#b3cde3', '#ccebc5'],
35771	PastelOne4 = ['#fbb4ae', '#b3cde3', '#ccebc5', '#decbe4'],
35772	PastelOne5 = ['#fbb4ae', '#b3cde3', '#ccebc5', '#decbe4', '#fed9a6'],
35773	PastelOne6 = ['#fbb4ae', '#b3cde3', '#ccebc5', '#decbe4', '#fed9a6', '#ffffcc'],
35774	PastelOne7 = ['#fbb4ae', '#b3cde3', '#ccebc5', '#decbe4', '#fed9a6', '#ffffcc', '#e5d8bd'],
35775	PastelOne8 = ['#fbb4ae', '#b3cde3', '#ccebc5', '#decbe4', '#fed9a6', '#ffffcc', '#e5d8bd', '#fddaec'],
35776	PastelOne9 = ['#fbb4ae', '#b3cde3', '#ccebc5', '#decbe4', '#fed9a6', '#ffffcc', '#e5d8bd', '#fddaec', '#f2f2f2'],
35777
35778	PastelTwo3 = ['#b3e2cd', '#fdcdac', '#cbd5e8'],
35779	PastelTwo4 = ['#b3e2cd', '#fdcdac', '#cbd5e8', '#f4cae4'],
35780	PastelTwo5 = ['#b3e2cd', '#fdcdac', '#cbd5e8', '#f4cae4', '#e6f5c9'],
35781	PastelTwo6 = ['#b3e2cd', '#fdcdac', '#cbd5e8', '#f4cae4', '#e6f5c9', '#fff2ae'],
35782	PastelTwo7 = ['#b3e2cd', '#fdcdac', '#cbd5e8', '#f4cae4', '#e6f5c9', '#fff2ae', '#f1e2cc'],
35783	PastelTwo8 = ['#b3e2cd', '#fdcdac', '#cbd5e8', '#f4cae4', '#e6f5c9', '#fff2ae', '#f1e2cc', '#cccccc'],
35784
35785	SetOne3 = ['#e41a1c', '#377eb8', '#4daf4a'],
35786	SetOne4 = ['#e41a1c', '#377eb8', '#4daf4a', '#984ea3'],
35787	SetOne5 = ['#e41a1c', '#377eb8', '#4daf4a', '#984ea3', '#ff7f00'],
35788	SetOne6 = ['#e41a1c', '#377eb8', '#4daf4a', '#984ea3', '#ff7f00', '#ffff33'],
35789	SetOne7 = ['#e41a1c', '#377eb8', '#4daf4a', '#984ea3', '#ff7f00', '#ffff33', '#a65628'],
35790	SetOne8 = ['#e41a1c', '#377eb8', '#4daf4a', '#984ea3', '#ff7f00', '#ffff33', '#a65628', '#f781bf'],
35791	SetOne9 = ['#e41a1c', '#377eb8', '#4daf4a', '#984ea3', '#ff7f00', '#ffff33', '#a65628', '#f781bf', '#999999'],
35792
35793	SetTwo3 = ['#66c2a5', '#fc8d62', '#8da0cb'],
35794	SetTwo4 = ['#66c2a5', '#fc8d62', '#8da0cb', '#e78ac3'],
35795	SetTwo5 = ['#66c2a5', '#fc8d62', '#8da0cb', '#e78ac3', '#a6d854'],
35796	SetTwo6 = ['#66c2a5', '#fc8d62', '#8da0cb', '#e78ac3', '#a6d854', '#ffd92f'],
35797	SetTwo7 = ['#66c2a5', '#fc8d62', '#8da0cb', '#e78ac3', '#a6d854', '#ffd92f', '#e5c494'],
35798	SetTwo8 = ['#66c2a5', '#fc8d62', '#8da0cb', '#e78ac3', '#a6d854', '#ffd92f', '#e5c494', '#b3b3b3'],
35799
35800	SetThree3 = ['#8dd3c7', '#ffffb3', '#bebada'],
35801	SetThree4 = ['#8dd3c7', '#ffffb3', '#bebada', '#fb8072'],
35802	SetThree5 = ['#8dd3c7', '#ffffb3', '#bebada', '#fb8072', '#80b1d3'],
35803	SetThree6 = ['#8dd3c7', '#ffffb3', '#bebada', '#fb8072', '#80b1d3', '#fdb462'],
35804	SetThree7 = ['#8dd3c7', '#ffffb3', '#bebada', '#fb8072', '#80b1d3', '#fdb462', '#b3de69'],
35805	SetThree8 = ['#8dd3c7', '#ffffb3', '#bebada', '#fb8072', '#80b1d3', '#fdb462', '#b3de69', '#fccde5'],
35806	SetThree9 = ['#8dd3c7', '#ffffb3', '#bebada', '#fb8072', '#80b1d3', '#fdb462', '#b3de69', '#fccde5', '#d9d9d9'],
35807	SetThree10 = ['#8dd3c7', '#ffffb3', '#bebada', '#fb8072', '#80b1d3', '#fdb462', '#b3de69', '#fccde5', '#d9d9d9', '#bc80bd'],
35808	SetThree11 = ['#8dd3c7', '#ffffb3', '#bebada', '#fb8072', '#80b1d3', '#fdb462', '#b3de69', '#fccde5', '#d9d9d9', '#bc80bd', '#ccebc5'],
35809	SetThree12 = ['#8dd3c7', '#ffffb3', '#bebada', '#fb8072', '#80b1d3', '#fdb462', '#b3de69', '#fccde5', '#d9d9d9', '#bc80bd', '#ccebc5', '#ffed6f'];
35810
35811var brewer = /*#__PURE__*/Object.freeze({
35812__proto__: null,
35813YlGn3: YlGn3,
35814YlGn4: YlGn4,
35815YlGn5: YlGn5,
35816YlGn6: YlGn6,
35817YlGn7: YlGn7,
35818YlGn8: YlGn8,
35819YlGn9: YlGn9,
35820YlGnBu3: YlGnBu3,
35821YlGnBu4: YlGnBu4,
35822YlGnBu5: YlGnBu5,
35823YlGnBu6: YlGnBu6,
35824YlGnBu7: YlGnBu7,
35825YlGnBu8: YlGnBu8,
35826YlGnBu9: YlGnBu9,
35827GnBu3: GnBu3,
35828GnBu4: GnBu4,
35829GnBu5: GnBu5,
35830GnBu6: GnBu6,
35831GnBu7: GnBu7,
35832GnBu8: GnBu8,
35833GnBu9: GnBu9,
35834BuGn3: BuGn3,
35835BuGn4: BuGn4,
35836BuGn5: BuGn5,
35837BuGn6: BuGn6,
35838BuGn7: BuGn7,
35839BuGn8: BuGn8,
35840BuGn9: BuGn9,
35841PuBuGn3: PuBuGn3,
35842PuBuGn4: PuBuGn4,
35843PuBuGn5: PuBuGn5,
35844PuBuGn6: PuBuGn6,
35845PuBuGn7: PuBuGn7,
35846PuBuGn8: PuBuGn8,
35847PuBuGn9: PuBuGn9,
35848PuBu3: PuBu3,
35849PuBu4: PuBu4,
35850PuBu5: PuBu5,
35851PuBu6: PuBu6,
35852PuBu7: PuBu7,
35853PuBu8: PuBu8,
35854PuBu9: PuBu9,
35855BuPu3: BuPu3,
35856BuPu4: BuPu4,
35857BuPu5: BuPu5,
35858BuPu6: BuPu6,
35859BuPu7: BuPu7,
35860BuPu8: BuPu8,
35861BuPu9: BuPu9,
35862RdPu3: RdPu3,
35863RdPu4: RdPu4,
35864RdPu5: RdPu5,
35865RdPu6: RdPu6,
35866RdPu7: RdPu7,
35867RdPu8: RdPu8,
35868RdPu9: RdPu9,
35869PuRd3: PuRd3,
35870PuRd4: PuRd4,
35871PuRd5: PuRd5,
35872PuRd6: PuRd6,
35873PuRd7: PuRd7,
35874PuRd8: PuRd8,
35875PuRd9: PuRd9,
35876OrRd3: OrRd3,
35877OrRd4: OrRd4,
35878OrRd5: OrRd5,
35879OrRd6: OrRd6,
35880OrRd7: OrRd7,
35881OrRd8: OrRd8,
35882OrRd9: OrRd9,
35883YlOrRd3: YlOrRd3,
35884YlOrRd4: YlOrRd4,
35885YlOrRd5: YlOrRd5,
35886YlOrRd6: YlOrRd6,
35887YlOrRd7: YlOrRd7,
35888YlOrRd8: YlOrRd8,
35889YlOrRd9: YlOrRd9,
35890YlOrBr3: YlOrBr3,
35891YlOrBr4: YlOrBr4,
35892YlOrBr5: YlOrBr5,
35893YlOrBr6: YlOrBr6,
35894YlOrBr7: YlOrBr7,
35895YlOrBr8: YlOrBr8,
35896YlOrBr9: YlOrBr9,
35897Purples3: Purples3,
35898Purples4: Purples4,
35899Purples5: Purples5,
35900Purples6: Purples6,
35901Purples7: Purples7,
35902Purples8: Purples8,
35903Purples9: Purples9,
35904Blues3: Blues3,
35905Blues4: Blues4,
35906Blues5: Blues5,
35907Blues6: Blues6,
35908Blues7: Blues7,
35909Blues8: Blues8,
35910Blues9: Blues9,
35911Greens3: Greens3,
35912Greens4: Greens4,
35913Greens5: Greens5,
35914Greens6: Greens6,
35915Greens7: Greens7,
35916Greens8: Greens8,
35917Greens9: Greens9,
35918Oranges3: Oranges3,
35919Oranges4: Oranges4,
35920Oranges5: Oranges5,
35921Oranges6: Oranges6,
35922Oranges7: Oranges7,
35923Oranges8: Oranges8,
35924Oranges9: Oranges9,
35925Reds3: Reds3,
35926Reds4: Reds4,
35927Reds5: Reds5,
35928Reds6: Reds6,
35929Reds7: Reds7,
35930Reds8: Reds8,
35931Reds9: Reds9,
35932Greys3: Greys3,
35933Greys4: Greys4,
35934Greys5: Greys5,
35935Greys6: Greys6,
35936Greys7: Greys7,
35937Greys8: Greys8,
35938Greys9: Greys9,
35939PuOr3: PuOr3,
35940PuOr4: PuOr4,
35941PuOr5: PuOr5,
35942PuOr6: PuOr6,
35943PuOr7: PuOr7,
35944PuOr8: PuOr8,
35945PuOr9: PuOr9,
35946PuOr10: PuOr10,
35947PuOr11: PuOr11,
35948BrBG3: BrBG3,
35949BrBG4: BrBG4,
35950BrBG5: BrBG5,
35951BrBG6: BrBG6,
35952BrBG7: BrBG7,
35953BrBG8: BrBG8,
35954BrBG9: BrBG9,
35955BrBG10: BrBG10,
35956BrBG11: BrBG11,
35957PRGn3: PRGn3,
35958PRGn4: PRGn4,
35959PRGn5: PRGn5,
35960PRGn6: PRGn6,
35961PRGn7: PRGn7,
35962PRGn8: PRGn8,
35963PRGn9: PRGn9,
35964PRGn10: PRGn10,
35965PRGn11: PRGn11,
35966PiYG3: PiYG3,
35967PiYG4: PiYG4,
35968PiYG5: PiYG5,
35969PiYG6: PiYG6,
35970PiYG7: PiYG7,
35971PiYG8: PiYG8,
35972PiYG9: PiYG9,
35973PiYG10: PiYG10,
35974PiYG11: PiYG11,
35975RdBu3: RdBu3,
35976RdBu4: RdBu4,
35977RdBu5: RdBu5,
35978RdBu6: RdBu6,
35979RdBu7: RdBu7,
35980RdBu8: RdBu8,
35981RdBu9: RdBu9,
35982RdBu10: RdBu10,
35983RdBu11: RdBu11,
35984RdGy3: RdGy3,
35985RdGy4: RdGy4,
35986RdGy5: RdGy5,
35987RdGy6: RdGy6,
35988RdGy7: RdGy7,
35989RdGy8: RdGy8,
35990RdGy9: RdGy9,
35991RdGy10: RdGy10,
35992RdGy11: RdGy11,
35993RdYlBu3: RdYlBu3,
35994RdYlBu4: RdYlBu4,
35995RdYlBu5: RdYlBu5,
35996RdYlBu6: RdYlBu6,
35997RdYlBu7: RdYlBu7,
35998RdYlBu8: RdYlBu8,
35999RdYlBu9: RdYlBu9,
36000RdYlBu10: RdYlBu10,
36001RdYlBu11: RdYlBu11,
36002Spectral3: Spectral3,
36003Spectral4: Spectral4,
36004Spectral5: Spectral5,
36005Spectral6: Spectral6,
36006Spectral7: Spectral7,
36007Spectral8: Spectral8,
36008Spectral9: Spectral9,
36009Spectral10: Spectral10,
36010Spectral11: Spectral11,
36011RdYlGn3: RdYlGn3,
36012RdYlGn4: RdYlGn4,
36013RdYlGn5: RdYlGn5,
36014RdYlGn6: RdYlGn6,
36015RdYlGn7: RdYlGn7,
36016RdYlGn8: RdYlGn8,
36017RdYlGn9: RdYlGn9,
36018RdYlGn10: RdYlGn10,
36019RdYlGn11: RdYlGn11,
36020Accent3: Accent3,
36021Accent4: Accent4,
36022Accent5: Accent5,
36023Accent6: Accent6,
36024Accent7: Accent7,
36025Accent8: Accent8,
36026DarkTwo3: DarkTwo3,
36027DarkTwo4: DarkTwo4,
36028DarkTwo5: DarkTwo5,
36029DarkTwo6: DarkTwo6,
36030DarkTwo7: DarkTwo7,
36031DarkTwo8: DarkTwo8,
36032Paired3: Paired3,
36033Paired4: Paired4,
36034Paired5: Paired5,
36035Paired6: Paired6,
36036Paired7: Paired7,
36037Paired8: Paired8,
36038Paired9: Paired9,
36039Paired10: Paired10,
36040Paired11: Paired11,
36041Paired12: Paired12,
36042PastelOne3: PastelOne3,
36043PastelOne4: PastelOne4,
36044PastelOne5: PastelOne5,
36045PastelOne6: PastelOne6,
36046PastelOne7: PastelOne7,
36047PastelOne8: PastelOne8,
36048PastelOne9: PastelOne9,
36049PastelTwo3: PastelTwo3,
36050PastelTwo4: PastelTwo4,
36051PastelTwo5: PastelTwo5,
36052PastelTwo6: PastelTwo6,
36053PastelTwo7: PastelTwo7,
36054PastelTwo8: PastelTwo8,
36055SetOne3: SetOne3,
36056SetOne4: SetOne4,
36057SetOne5: SetOne5,
36058SetOne6: SetOne6,
36059SetOne7: SetOne7,
36060SetOne8: SetOne8,
36061SetOne9: SetOne9,
36062SetTwo3: SetTwo3,
36063SetTwo4: SetTwo4,
36064SetTwo5: SetTwo5,
36065SetTwo6: SetTwo6,
36066SetTwo7: SetTwo7,
36067SetTwo8: SetTwo8,
36068SetThree3: SetThree3,
36069SetThree4: SetThree4,
36070SetThree5: SetThree5,
36071SetThree6: SetThree6,
36072SetThree7: SetThree7,
36073SetThree8: SetThree8,
36074SetThree9: SetThree9,
36075SetThree10: SetThree10,
36076SetThree11: SetThree11,
36077SetThree12: SetThree12
36078});
36079
36080// eslint-disable-next-line one-var
36081var
36082	Adjacency6 = ['#a9a57c', '#9cbebd', '#d2cb6c', '#95a39d', '#c89f5d', '#b1a089'],
36083	Advantage6 = ['#663366', '#330f42', '#666699', '#999966', '#f7901e', '#a3a101'],
36084	Angles6 = ['#797b7e', '#f96a1b', '#08a1d9', '#7c984a', '#c2ad8d', '#506e94'],
36085	Apex6 = ['#ceb966', '#9cb084', '#6bb1c9', '#6585cf', '#7e6bc9', '#a379bb'],
36086	Apothecary6 = ['#93a299', '#cf543f', '#b5ae53', '#848058', '#e8b54d', '#786c71'],
36087	Aspect6 = ['#f07f09', '#9f2936', '#1b587c', '#4e8542', '#604878', '#c19859'],
36088	Atlas6 = ['#f81b02', '#fc7715', '#afbf41', '#50c49f', '#3b95c4', '#b560d4'],
36089	Austin6 = ['#94c600', '#71685a', '#ff6700', '#909465', '#956b43', '#fea022'],
36090	Badge6 = ['#f8b323', '#656a59', '#46b2b5', '#8caa7e', '#d36f68', '#826276'],
36091	Banded6 = ['#ffc000', '#a5d028', '#08cc78', '#f24099', '#828288', '#f56617'],
36092	Basis6 = ['#f09415', '#c1b56b', '#4baf73', '#5aa6c0', '#d17df9', '#fa7e5c'],
36093	Berlin6 = ['#a6b727', '#df5327', '#fe9e00', '#418ab3', '#d7d447', '#818183'],
36094	BlackTie6 = ['#6f6f74', '#a7b789', '#beae98', '#92a9b9', '#9c8265', '#8d6974'],
36095	Blue6 = ['#0f6fc6', '#009dd9', '#0bd0d9', '#10cf9b', '#7cca62', '#a5c249'],
36096	BlueGreen6 = ['#3494ba', '#58b6c0', '#75bda7', '#7a8c8e', '#84acb6', '#2683c6'],
36097	BlueII6 = ['#1cade4', '#2683c6', '#27ced7', '#42ba97', '#3e8853', '#62a39f'],
36098	BlueRed6 = ['#4a66ac', '#629dd1', '#297fd5', '#7f8fa9', '#5aa2ae', '#9d90a0'],
36099	BlueWarm6 = ['#4a66ac', '#629dd1', '#297fd5', '#7f8fa9', '#5aa2ae', '#9d90a0'],
36100	Breeze6 = ['#2c7c9f', '#244a58', '#e2751d', '#ffb400', '#7eb606', '#c00000'],
36101	Capital6 = ['#4b5a60', '#9c5238', '#504539', '#c1ad79', '#667559', '#bad6ad'],
36102	Celestial6 = ['#ac3ec1', '#477bd1', '#46b298', '#90ba4c', '#dd9d31', '#e25247'],
36103	Circuit6 = ['#9acd4c', '#faa93a', '#d35940', '#b258d3', '#63a0cc', '#8ac4a7'],
36104	Civic6 = ['#d16349', '#ccb400', '#8cadae', '#8c7b70', '#8fb08c', '#d19049'],
36105	Clarity6 = ['#93a299', '#ad8f67', '#726056', '#4c5a6a', '#808da0', '#79463d'],
36106	Codex6 = ['#990000', '#efab16', '#78ac35', '#35aca2', '#4083cf', '#0d335e'],
36107	Composite6 = ['#98c723', '#59b0b9', '#deae00', '#b77bb4', '#e0773c', '#a98d63'],
36108	Concourse6 = ['#2da2bf', '#da1f28', '#eb641b', '#39639d', '#474b78', '#7d3c4a'],
36109	Couture6 = ['#9e8e5c', '#a09781', '#85776d', '#aeafa9', '#8d878b', '#6b6149'],
36110	Crop6 = ['#8c8d86', '#e6c069', '#897b61', '#8dab8e', '#77a2bb', '#e28394'],
36111	Damask6 = ['#9ec544', '#50bea3', '#4a9ccc', '#9a66ca', '#c54f71', '#de9c3c'],
36112	Depth6 = ['#41aebd', '#97e9d5', '#a2cf49', '#608f3d', '#f4de3a', '#fcb11c'],
36113	Dividend6 = ['#4d1434', '#903163', '#b2324b', '#969fa7', '#66b1ce', '#40619d'],
36114	Droplet6 = ['#2fa3ee', '#4bcaad', '#86c157', '#d99c3f', '#ce6633', '#a35dd1'],
36115	Elemental6 = ['#629dd1', '#297fd5', '#7f8fa9', '#4a66ac', '#5aa2ae', '#9d90a0'],
36116	Equity6 = ['#d34817', '#9b2d1f', '#a28e6a', '#956251', '#918485', '#855d5d'],
36117	Essential6 = ['#7a7a7a', '#f5c201', '#526db0', '#989aac', '#dc5924', '#b4b392'],
36118	Excel16 = ['#9999ff', '#993366', '#ffffcc', '#ccffff', '#660066', '#ff8080', '#0066cc', '#ccccff', '#000080', '#ff00ff', '#ffff00', '#0000ff', '#800080', '#800000', '#008080', '#0000ff'],
36119	Executive6 = ['#6076b4', '#9c5252', '#e68422', '#846648', '#63891f', '#758085'],
36120	Exhibit6 = ['#3399ff', '#69ffff', '#ccff33', '#3333ff', '#9933ff', '#ff33ff'],
36121	Expo6 = ['#fbc01e', '#efe1a2', '#fa8716', '#be0204', '#640f10', '#7e13e3'],
36122	Facet6 = ['#90c226', '#54a021', '#e6b91e', '#e76618', '#c42f1a', '#918655'],
36123	Feathered6 = ['#606372', '#79a8a4', '#b2ad8f', '#ad8082', '#dec18c', '#92a185'],
36124	Flow6 = ['#0f6fc6', '#009dd9', '#0bd0d9', '#10cf9b', '#7cca62', '#a5c249'],
36125	Focus6 = ['#ffb91d', '#f97817', '#6de304', '#ff0000', '#732bea', '#c913ad'],
36126	Folio6 = ['#294171', '#748cbc', '#8e887c', '#834736', '#5a1705', '#a0a16a'],
36127	Formal6 = ['#907f76', '#a46645', '#cd9c47', '#9a92cd', '#7d639b', '#733678'],
36128	Forte6 = ['#c70f0c', '#dd6b0d', '#faa700', '#93e50d', '#17c7ba', '#0a96e4'],
36129	Foundry6 = ['#72a376', '#b0ccb0', '#a8cdd7', '#c0beaf', '#cec597', '#e8b7b7'],
36130	Frame6 = ['#40bad2', '#fab900', '#90bb23', '#ee7008', '#1ab39f', '#d5393d'],
36131	Gallery6 = ['#b71e42', '#de478e', '#bc72f0', '#795faf', '#586ea6', '#6892a0'],
36132	Genesis6 = ['#80b606', '#e29f1d', '#2397e2', '#35aca2', '#5430bb', '#8d34e0'],
36133	Grayscale6 = ['#dddddd', '#b2b2b2', '#969696', '#808080', '#5f5f5f', '#4d4d4d'],
36134	Green6 = ['#549e39', '#8ab833', '#c0cf3a', '#029676', '#4ab5c4', '#0989b1'],
36135	GreenYellow6 = ['#99cb38', '#63a537', '#37a76f', '#44c1a3', '#4eb3cf', '#51c3f9'],
36136	Grid6 = ['#c66951', '#bf974d', '#928b70', '#87706b', '#94734e', '#6f777d'],
36137	Habitat6 = ['#f8c000', '#f88600', '#f83500', '#8b723d', '#818b3d', '#586215'],
36138	Hardcover6 = ['#873624', '#d6862d', '#d0be40', '#877f6c', '#972109', '#aeb795'],
36139	Headlines6 = ['#439eb7', '#e28b55', '#dcb64d', '#4ca198', '#835b82', '#645135'],
36140	Horizon6 = ['#7e97ad', '#cc8e60', '#7a6a60', '#b4936d', '#67787b', '#9d936f'],
36141	Infusion6 = ['#8c73d0', '#c2e8c4', '#c5a6e8', '#b45ec7', '#9fdafb', '#95c5b0'],
36142	Inkwell6 = ['#860908', '#4a0505', '#7a500a', '#c47810', '#827752', '#b5bb83'],
36143	Inspiration6 = ['#749805', '#bacc82', '#6e9ec2', '#2046a5', '#5039c6', '#7411d0'],
36144	Integral6 = ['#1cade4', '#2683c6', '#27ced7', '#42ba97', '#3e8853', '#62a39f'],
36145	Ion6 = ['#b01513', '#ea6312', '#e6b729', '#6aac90', '#5f9c9d', '#9e5e9b'],
36146	IonBoardroom6 = ['#b31166', '#e33d6f', '#e45f3c', '#e9943a', '#9b6bf2', '#d53dd0'],
36147	Kilter6 = ['#76c5ef', '#fea022', '#ff6700', '#70a525', '#a5d848', '#20768c'],
36148	Madison6 = ['#a1d68b', '#5ec795', '#4dadcf', '#cdb756', '#e29c36', '#8ec0c1'],
36149	MainEvent6 = ['#b80e0f', '#a6987d', '#7f9a71', '#64969f', '#9b75b2', '#80737a'],
36150	Marquee6 = ['#418ab3', '#a6b727', '#f69200', '#838383', '#fec306', '#df5327'],
36151	Median6 = ['#94b6d2', '#dd8047', '#a5ab81', '#d8b25c', '#7ba79d', '#968c8c'],
36152	Mesh6 = ['#6f6f6f', '#bfbfa5', '#dcd084', '#e7bf5f', '#e9a039', '#cf7133'],
36153	Metail6 = ['#6283ad', '#324966', '#5b9ea4', '#1d5b57', '#1b4430', '#2f3c35'],
36154	Metro6 = ['#7fd13b', '#ea157a', '#feb80a', '#00addc', '#738ac8', '#1ab39f'],
36155	Metropolitan6 = ['#50b4c8', '#a8b97f', '#9b9256', '#657689', '#7a855d', '#84ac9d'],
36156	Module6 = ['#f0ad00', '#60b5cc', '#e66c7d', '#6bb76d', '#e88651', '#c64847'],
36157	NewsPrint6 = ['#ad0101', '#726056', '#ac956e', '#808da9', '#424e5b', '#730e00'],
36158	Office6 = ['#5b9bd5', '#ed7d31', '#a5a5a5', '#ffc000', '#4472c4', '#70ad47'],
36159	OfficeClassic6 = ['#4f81bd', '#c0504d', '#9bbb59', '#8064a2', '#4bacc6', '#f79646'],
36160	Opulent6 = ['#b83d68', '#ac66bb', '#de6c36', '#f9b639', '#cf6da4', '#fa8d3d'],
36161	Orange6 = ['#e48312', '#bd582c', '#865640', '#9b8357', '#c2bc80', '#94a088'],
36162	OrangeRed6 = ['#d34817', '#9b2d1f', '#a28e6a', '#956251', '#918485', '#855d5d'],
36163	Orbit6 = ['#f2d908', '#9de61e', '#0d8be6', '#c61b1b', '#e26f08', '#8d35d1'],
36164	Organic6 = ['#83992a', '#3c9770', '#44709d', '#a23c33', '#d97828', '#deb340'],
36165	Oriel6 = ['#fe8637', '#7598d9', '#b32c16', '#f5cd2d', '#aebad5', '#777c84'],
36166	Origin6 = ['#727ca3', '#9fb8cd', '#d2da7a', '#fada7a', '#b88472', '#8e736a'],
36167	Paper6 = ['#a5b592', '#f3a447', '#e7bc29', '#d092a7', '#9c85c0', '#809ec2'],
36168	Parallax6 = ['#30acec', '#80c34f', '#e29d3e', '#d64a3b', '#d64787', '#a666e1'],
36169	Parcel6 = ['#f6a21d', '#9bafb5', '#c96731', '#9ca383', '#87795d', '#a0988c'],
36170	Perception6 = ['#a2c816', '#e07602', '#e4c402', '#7dc1ef', '#21449b', '#a2b170'],
36171	Perspective6 = ['#838d9b', '#d2610c', '#80716a', '#94147c', '#5d5ad2', '#6f6c7d'],
36172	Pixel6 = ['#ff7f01', '#f1b015', '#fbec85', '#d2c2f1', '#da5af4', '#9d09d1'],
36173	Plaza6 = ['#990000', '#580101', '#e94a00', '#eb8f00', '#a4a4a4', '#666666'],
36174	Precedent6 = ['#993232', '#9b6c34', '#736c5d', '#c9972b', '#c95f2b', '#8f7a05'],
36175	Pushpin6 = ['#fda023', '#aa2b1e', '#71685c', '#64a73b', '#eb5605', '#b9ca1a'],
36176	Quotable6 = ['#00c6bb', '#6feba0', '#b6df5e', '#efb251', '#ef755f', '#ed515c'],
36177	Red6 = ['#a5300f', '#d55816', '#e19825', '#b19c7d', '#7f5f52', '#b27d49'],
36178	RedOrange6 = ['#e84c22', '#ffbd47', '#b64926', '#ff8427', '#cc9900', '#b22600'],
36179	RedViolet6 = ['#e32d91', '#c830cc', '#4ea6dc', '#4775e7', '#8971e1', '#d54773'],
36180	Retrospect6 = ['#e48312', '#bd582c', '#865640', '#9b8357', '#c2bc80', '#94a088'],
36181	Revolution6 = ['#0c5986', '#ddf53d', '#508709', '#bf5e00', '#9c0001', '#660075'],
36182	Saddle6 = ['#c6b178', '#9c5b14', '#71b2bc', '#78aa5d', '#867099', '#4c6f75'],
36183	Savon6 = ['#1cade4', '#2683c6', '#27ced7', '#42ba97', '#3e8853', '#62a39f'],
36184	Sketchbook6 = ['#a63212', '#e68230', '#9bb05e', '#6b9bc7', '#4e66b2', '#8976ac'],
36185	Sky6 = ['#073779', '#8fd9fb', '#ffcc00', '#eb6615', '#c76402', '#b523b4'],
36186	Slate6 = ['#bc451b', '#d3ba68', '#bb8640', '#ad9277', '#a55a43', '#ad9d7b'],
36187	Slice6 = ['#052f61', '#a50e82', '#14967c', '#6a9e1f', '#e87d37', '#c62324'],
36188	Slipstream6 = ['#4e67c8', '#5eccf3', '#a7ea52', '#5dceaf', '#ff8021', '#f14124'],
36189	SOHO6 = ['#61625e', '#964d2c', '#66553e', '#848058', '#afa14b', '#ad7d4d'],
36190	Solstice6 = ['#3891a7', '#feb80a', '#c32d2e', '#84aa33', '#964305', '#475a8d'],
36191	Spectrum6 = ['#990000', '#ff6600', '#ffba00', '#99cc00', '#528a02', '#333333'],
36192	Story6 = ['#1d86cd', '#732e9a', '#b50b1b', '#e8950e', '#55992b', '#2c9c89'],
36193	Studio6 = ['#f7901e', '#fec60b', '#9fe62f', '#4ea5d1', '#1c4596', '#542d90'],
36194	Summer6 = ['#51a6c2', '#51c2a9', '#7ec251', '#e1dc53', '#b54721', '#a16bb1'],
36195	Technic6 = ['#6ea0b0', '#ccaf0a', '#8d89a4', '#748560', '#9e9273', '#7e848d'],
36196	Thatch6 = ['#759aa5', '#cfc60d', '#99987f', '#90ac97', '#ffad1c', '#b9ab6f'],
36197	Tradition6 = ['#6b4a0b', '#790a14', '#908342', '#423e5c', '#641345', '#748a2f'],
36198	Travelogue6 = ['#b74d21', '#a32323', '#4576a3', '#615d9a', '#67924b', '#bf7b1b'],
36199	Trek6 = ['#f0a22e', '#a5644e', '#b58b80', '#c3986d', '#a19574', '#c17529'],
36200	Twilight6 = ['#e8bc4a', '#83c1c6', '#e78d35', '#909ce1', '#839c41', '#cc5439'],
36201	Urban6 = ['#53548a', '#438086', '#a04da3', '#c4652d', '#8b5d3d', '#5c92b5'],
36202	UrbanPop6 = ['#86ce24', '#00a2e6', '#fac810', '#7d8f8c', '#d06b20', '#958b8b'],
36203	VaporTrail6 = ['#df2e28', '#fe801a', '#e9bf35', '#81bb42', '#32c7a9', '#4a9bdc'],
36204	Venture6 = ['#9eb060', '#d09a08', '#f2ec86', '#824f1c', '#511818', '#553876'],
36205	Verve6 = ['#ff388c', '#e40059', '#9c007f', '#68007f', '#005bd3', '#00349e'],
36206	View6 = ['#6f6f74', '#92a9b9', '#a7b789', '#b9a489', '#8d6374', '#9b7362'],
36207	Violet6 = ['#ad84c6', '#8784c7', '#5d739a', '#6997af', '#84acb6', '#6f8183'],
36208	VioletII6 = ['#92278f', '#9b57d3', '#755dd9', '#665eb8', '#45a5ed', '#5982db'],
36209	Waveform6 = ['#31b6fd', '#4584d3', '#5bd078', '#a5d028', '#f5c040', '#05e0db'],
36210	Wisp6 = ['#a53010', '#de7e18', '#9f8351', '#728653', '#92aa4c', '#6aac91'],
36211	WoodType6 = ['#d34817', '#9b2d1f', '#a28e6a', '#956251', '#918485', '#855d5d'],
36212	Yellow6 = ['#ffca08', '#f8931d', '#ce8d3e', '#ec7016', '#e64823', '#9c6a6a'],
36213	YellowOrange6 = ['#f0a22e', '#a5644e', '#b58b80', '#c3986d', '#a19574', '#c17529'];
36214
36215var office = /*#__PURE__*/Object.freeze({
36216__proto__: null,
36217Adjacency6: Adjacency6,
36218Advantage6: Advantage6,
36219Angles6: Angles6,
36220Apex6: Apex6,
36221Apothecary6: Apothecary6,
36222Aspect6: Aspect6,
36223Atlas6: Atlas6,
36224Austin6: Austin6,
36225Badge6: Badge6,
36226Banded6: Banded6,
36227Basis6: Basis6,
36228Berlin6: Berlin6,
36229BlackTie6: BlackTie6,
36230Blue6: Blue6,
36231BlueGreen6: BlueGreen6,
36232BlueII6: BlueII6,
36233BlueRed6: BlueRed6,
36234BlueWarm6: BlueWarm6,
36235Breeze6: Breeze6,
36236Capital6: Capital6,
36237Celestial6: Celestial6,
36238Circuit6: Circuit6,
36239Civic6: Civic6,
36240Clarity6: Clarity6,
36241Codex6: Codex6,
36242Composite6: Composite6,
36243Concourse6: Concourse6,
36244Couture6: Couture6,
36245Crop6: Crop6,
36246Damask6: Damask6,
36247Depth6: Depth6,
36248Dividend6: Dividend6,
36249Droplet6: Droplet6,
36250Elemental6: Elemental6,
36251Equity6: Equity6,
36252Essential6: Essential6,
36253Excel16: Excel16,
36254Executive6: Executive6,
36255Exhibit6: Exhibit6,
36256Expo6: Expo6,
36257Facet6: Facet6,
36258Feathered6: Feathered6,
36259Flow6: Flow6,
36260Focus6: Focus6,
36261Folio6: Folio6,
36262Formal6: Formal6,
36263Forte6: Forte6,
36264Foundry6: Foundry6,
36265Frame6: Frame6,
36266Gallery6: Gallery6,
36267Genesis6: Genesis6,
36268Grayscale6: Grayscale6,
36269Green6: Green6,
36270GreenYellow6: GreenYellow6,
36271Grid6: Grid6,
36272Habitat6: Habitat6,
36273Hardcover6: Hardcover6,
36274Headlines6: Headlines6,
36275Horizon6: Horizon6,
36276Infusion6: Infusion6,
36277Inkwell6: Inkwell6,
36278Inspiration6: Inspiration6,
36279Integral6: Integral6,
36280Ion6: Ion6,
36281IonBoardroom6: IonBoardroom6,
36282Kilter6: Kilter6,
36283Madison6: Madison6,
36284MainEvent6: MainEvent6,
36285Marquee6: Marquee6,
36286Median6: Median6,
36287Mesh6: Mesh6,
36288Metail6: Metail6,
36289Metro6: Metro6,
36290Metropolitan6: Metropolitan6,
36291Module6: Module6,
36292NewsPrint6: NewsPrint6,
36293Office6: Office6,
36294OfficeClassic6: OfficeClassic6,
36295Opulent6: Opulent6,
36296Orange6: Orange6,
36297OrangeRed6: OrangeRed6,
36298Orbit6: Orbit6,
36299Organic6: Organic6,
36300Oriel6: Oriel6,
36301Origin6: Origin6,
36302Paper6: Paper6,
36303Parallax6: Parallax6,
36304Parcel6: Parcel6,
36305Perception6: Perception6,
36306Perspective6: Perspective6,
36307Pixel6: Pixel6,
36308Plaza6: Plaza6,
36309Precedent6: Precedent6,
36310Pushpin6: Pushpin6,
36311Quotable6: Quotable6,
36312Red6: Red6,
36313RedOrange6: RedOrange6,
36314RedViolet6: RedViolet6,
36315Retrospect6: Retrospect6,
36316Revolution6: Revolution6,
36317Saddle6: Saddle6,
36318Savon6: Savon6,
36319Sketchbook6: Sketchbook6,
36320Sky6: Sky6,
36321Slate6: Slate6,
36322Slice6: Slice6,
36323Slipstream6: Slipstream6,
36324SOHO6: SOHO6,
36325Solstice6: Solstice6,
36326Spectrum6: Spectrum6,
36327Story6: Story6,
36328Studio6: Studio6,
36329Summer6: Summer6,
36330Technic6: Technic6,
36331Thatch6: Thatch6,
36332Tradition6: Tradition6,
36333Travelogue6: Travelogue6,
36334Trek6: Trek6,
36335Twilight6: Twilight6,
36336Urban6: Urban6,
36337UrbanPop6: UrbanPop6,
36338VaporTrail6: VaporTrail6,
36339Venture6: Venture6,
36340Verve6: Verve6,
36341View6: View6,
36342Violet6: Violet6,
36343VioletII6: VioletII6,
36344Waveform6: Waveform6,
36345Wisp6: Wisp6,
36346WoodType6: WoodType6,
36347Yellow6: Yellow6,
36348YellowOrange6: YellowOrange6
36349});
36350
36351// eslint-disable-next-line one-var
36352var
36353	// New
36354	Tableau10 = ['#4E79A7', '#F28E2B', '#E15759', '#76B7B2', '#59A14F', '#EDC948', '#B07AA1', '#FF9DA7', '#9C755F', '#BAB0AC'],
36355	Tableau20 = ['#4E79A7', '#A0CBE8', '#F28E2B', '#FFBE7D', '#59A14F', '#8CD17D', '#B6992D', '#F1CE63', '#499894', '#86BCB6', '#E15759', '#FF9D9A', '#79706E', '#BAB0AC', '#D37295', '#FABFD2', '#B07AA1', '#D4A6C8', '#9D7660', '#D7B5A6'],
36356	ColorBlind10 = ['#1170aa', '#fc7d0b', '#a3acb9', '#57606c', '#5fa2ce', '#c85200', '#7b848f', '#a3cce9', '#ffbc79', '#c8d0d9'],
36357	SeattleGrays5 = ['#767f8b', '#b3b7b8', '#5c6068', '#d3d3d3', '#989ca3'],
36358	Traffic9 = ['#b60a1c', '#e39802', '#309143', '#e03531', '#f0bd27', '#51b364', '#ff684c', '#ffda66', '#8ace7e'],
36359	MillerStone11 = ['#4f6980', '#849db1', '#a2ceaa', '#638b66', '#bfbb60', '#f47942', '#fbb04e', '#b66353', '#d7ce9f', '#b9aa97', '#7e756d'],
36360	SuperfishelStone10 = ['#6388b4', '#ffae34', '#ef6f6a', '#8cc2ca', '#55ad89', '#c3bc3f', '#bb7693', '#baa094', '#a9b5ae', '#767676'],
36361	NurielStone9 = ['#8175aa', '#6fb899', '#31a1b3', '#ccb22b', '#a39fc9', '#94d0c0', '#959c9e', '#027b8e', '#9f8f12'],
36362	JewelBright9 = ['#eb1e2c', '#fd6f30', '#f9a729', '#f9d23c', '#5fbb68', '#64cdcc', '#91dcea', '#a4a4d5', '#bbc9e5'],
36363	Summer8 = ['#bfb202', '#b9ca5d', '#cf3e53', '#f1788d', '#00a2b3', '#97cfd0', '#f3a546', '#f7c480'],
36364	Winter10 = ['#90728f', '#b9a0b4', '#9d983d', '#cecb76', '#e15759', '#ff9888', '#6b6b6b', '#bab2ae', '#aa8780', '#dab6af'],
36365	GreenOrangeTeal12 = ['#4e9f50', '#87d180', '#ef8a0c', '#fcc66d', '#3ca8bc', '#98d9e4', '#94a323', '#c3ce3d', '#a08400', '#f7d42a', '#26897e', '#8dbfa8'],
36366	RedBlueBrown12 = ['#466f9d', '#91b3d7', '#ed444a', '#feb5a2', '#9d7660', '#d7b5a6', '#3896c4', '#a0d4ee', '#ba7e45', '#39b87f', '#c8133b', '#ea8783'],
36367	PurplePinkGray12 = ['#8074a8', '#c6c1f0', '#c46487', '#ffbed1', '#9c9290', '#c5bfbe', '#9b93c9', '#ddb5d5', '#7c7270', '#f498b6', '#b173a0', '#c799bc'],
36368	HueCircle19 = ['#1ba3c6', '#2cb5c0', '#30bcad', '#21B087', '#33a65c', '#57a337', '#a2b627', '#d5bb21', '#f8b620', '#f89217', '#f06719', '#e03426', '#f64971', '#fc719e', '#eb73b3', '#ce69be', '#a26dc2', '#7873c0', '#4f7cba'],
36369	OrangeBlue7 = ['#9e3d22', '#d45b21', '#f69035', '#d9d5c9', '#77acd3', '#4f81af', '#2b5c8a'],
36370	RedGreen7 = ['#a3123a', '#e33f43', '#f8816b', '#ced7c3', '#73ba67', '#44914e', '#24693d'],
36371	GreenBlue7 = ['#24693d', '#45934d', '#75bc69', '#c9dad2', '#77a9cf', '#4e7fab', '#2a5783'],
36372	RedBlue7 = ['#a90c38', '#e03b42', '#f87f69', '#dfd4d1', '#7eaed3', '#5383af', '#2e5a87'],
36373	RedBlack7 = ['#ae123a', '#e33e43', '#f8816b', '#d9d9d9', '#a0a7a8', '#707c83', '#49525e'],
36374	GoldPurple7 = ['#ad9024', '#c1a33b', '#d4b95e', '#e3d8cf', '#d4a3c3', '#c189b0', '#ac7299'],
36375	RedGreenGold7 = ['#be2a3e', '#e25f48', '#f88f4d', '#f4d166', '#90b960', '#4b9b5f', '#22763f'],
36376	SunsetSunrise7 = ['#33608c', '#9768a5', '#e7718a', '#f6ba57', '#ed7846', '#d54c45', '#b81840'],
36377	OrangeBlueWhite7 = ['#9e3d22', '#e36621', '#fcad52', '#ffffff', '#95c5e1', '#5b8fbc', '#2b5c8a'],
36378	RedGreenWhite7 = ['#ae123a', '#ee574d', '#fdac9e', '#ffffff', '#91d183', '#539e52', '#24693d'],
36379	GreenBlueWhite7 = ['#24693d', '#529c51', '#8fd180', '#ffffff', '#95c1dd', '#598ab5', '#2a5783'],
36380	RedBlueWhite7 = ['#a90c38', '#ec534b', '#feaa9a', '#ffffff', '#9ac4e1', '#5c8db8', '#2e5a87'],
36381	RedBlackWhite7 = ['#ae123a', '#ee574d', '#fdac9d', '#ffffff', '#bdc0bf', '#7d888d', '#49525e'],
36382	OrangeBlueLight7 = ['#ffcc9e', '#f9d4b6', '#f0dccd', '#e5e5e5', '#dae1ea', '#cfdcef', '#c4d8f3'],
36383	Temperature7 = ['#529985', '#6c9e6e', '#99b059', '#dbcf47', '#ebc24b', '#e3a14f', '#c26b51'],
36384	BlueGreen7 = ['#feffd9', '#f2fabf', '#dff3b2', '#c4eab1', '#94d6b7', '#69c5be', '#41b7c4'],
36385	BlueLight7 = ['#e5e5e5', '#e0e3e8', '#dbe1ea', '#d5dfec', '#d0dcef', '#cadaf1', '#c4d8f3'],
36386	OrangeLight7 = ['#e5e5e5', '#ebe1d9', '#f0ddcd', '#f5d9c2', '#f9d4b6', '#fdd0aa', '#ffcc9e'],
36387	Blue20 = ['#b9ddf1', '#afd6ed', '#a5cfe9', '#9bc7e4', '#92c0df', '#89b8da', '#80b0d5', '#79aacf', '#72a3c9', '#6a9bc3', '#6394be', '#5b8cb8', '#5485b2', '#4e7fac', '#4878a6', '#437a9f', '#3d6a98', '#376491', '#305d8a', '#2a5783'],
36388	Orange20 = ['#ffc685', '#fcbe75', '#f9b665', '#f7ae54', '#f5a645', '#f59c3c', '#f49234', '#f2882d', '#f07e27', '#ee7422', '#e96b20', '#e36420', '#db5e20', '#d25921', '#ca5422', '#c14f22', '#b84b23', '#af4623', '#a64122', '#9e3d22'],
36389	Green20 = ['#b3e0a6', '#a5db96', '#98d687', '#8ed07f', '#85ca77', '#7dc370', '#75bc69', '#6eb663', '#67af5c', '#61a956', '#59a253', '#519c51', '#49964f', '#428f4d', '#398949', '#308344', '#2b7c40', '#27763d', '#256f3d', '#24693d'],
36390	Red20 = ['#ffbeb2', '#feb4a6', '#fdab9b', '#fca290', '#fb9984', '#fa8f79', '#f9856e', '#f77b66', '#f5715d', '#f36754', '#f05c4d', '#ec5049', '#e74545', '#e13b42', '#da323f', '#d3293d', '#ca223c', '#c11a3b', '#b8163a', '#ae123a'],
36391	Purple20 = ['#eec9e5', '#eac1df', '#e6b9d9', '#e0b2d2', '#daabcb', '#d5a4c4', '#cf9dbe', '#ca96b8', '#c48fb2', '#be89ac', '#b882a6', '#b27ba1', '#aa759d', '#a27099', '#9a6a96', '#926591', '#8c5f86', '#865986', '#81537f', '#7c4d79'],
36392	Brown20 = ['#eedbbd', '#ecd2ad', '#ebc994', '#eac085', '#e8b777', '#e5ae6c', '#e2a562', '#de9d5a', '#d99455', '#d38c54', '#ce8451', '#c9784d', '#c47247', '#c16941', '#bd6036', '#b85636', '#b34d34', '#ad4433', '#a63d32', '#9f3632'],
36393	Gray20 = ['#d5d5d5', '#cdcecd', '#c5c7c6', '#bcbfbe', '#b4b7b7', '#acb0b1', '#a4a9ab', '#9ca3a4', '#939c9e', '#8b9598', '#848e93', '#7c878d', '#758087', '#6e7a81', '#67737c', '#616c77', '#5b6570', '#555f6a', '#4f5864', '#49525e'],
36394	GrayWarm20 = ['#dcd4d0', '#d4ccc8', '#cdc4c0', '#c5bdb9', '#beb6b2', '#b7afab', '#b0a7a4', '#a9a09d', '#a29996', '#9b938f', '#948c88', '#8d8481', '#867e7b', '#807774', '#79706e', '#736967', '#6c6260', '#665c51', '#5f5654', '#59504e'],
36395	BlueTeal20 = ['#bce4d8', '#aedcd5', '#a1d5d2', '#95cecf', '#89c8cc', '#7ec1ca', '#72bac6', '#66b2c2', '#59acbe', '#4ba5ba', '#419eb6', '#3b96b2', '#358ead', '#3586a7', '#347ea1', '#32779b', '#316f96', '#2f6790', '#2d608a', '#2c5985'],
36396	OrangeGold20 = ['#f4d166', '#f6c760', '#f8bc58', '#f8b252', '#f7a84a', '#f69e41', '#f49538', '#f38b2f', '#f28026', '#f0751e', '#eb6c1c', '#e4641e', '#de5d1f', '#d75521', '#cf4f22', '#c64a22', '#bc4623', '#b24223', '#a83e24', '#9e3a26'],
36397	GreenGold20 = ['#f4d166', '#e3cd62', '#d3c95f', '#c3c55d', '#b2c25b', '#a3bd5a', '#93b958', '#84b457', '#76af56', '#67a956', '#5aa355', '#4f9e53', '#479751', '#40914f', '#3a8a4d', '#34844a', '#2d7d45', '#257740', '#1c713b', '#146c36'],
36398	RedGold21 = ['#f4d166', '#f5c75f', '#f6bc58', '#f7b254', '#f9a750', '#fa9d4f', '#fa9d4f', '#fb934d', '#f7894b', '#f47f4a', '#f0774a', '#eb6349', '#e66549', '#e15c48', '#dc5447', '#d64c45', '#d04344', '#ca3a42', '#c43141', '#bd273f', '#b71d3e'],
36399
36400	// Classic
36401	Classic10 = ['#1f77b4', '#ff7f0e', '#2ca02c', '#d62728', '#9467bd', '#8c564b', '#e377c2', '#7f7f7f', '#bcbd22', '#17becf'],
36402	ClassicMedium10 = ['#729ece', '#ff9e4a', '#67bf5c', '#ed665d', '#ad8bc9', '#a8786e', '#ed97ca', '#a2a2a2', '#cdcc5d', '#6dccda'],
36403	ClassicLight10 = ['#aec7e8', '#ffbb78', '#98df8a', '#ff9896', '#c5b0d5', '#c49c94', '#f7b6d2', '#c7c7c7', '#dbdb8d', '#9edae5'],
36404	Classic20 = ['#1f77b4', '#aec7e8', '#ff7f0e', '#ffbb78', '#2ca02c', '#98df8a', '#d62728', '#ff9896', '#9467bd', '#c5b0d5', '#8c564b', '#c49c94', '#e377c2', '#f7b6d2', '#7f7f7f', '#c7c7c7', '#bcbd22', '#dbdb8d', '#17becf', '#9edae5'],
36405	ClassicGray5 = ['#60636a', '#a5acaf', '#414451', '#8f8782', '#cfcfcf'],
36406	ClassicColorBlind10 = ['#006ba4', '#ff800e', '#ababab', '#595959', '#5f9ed1', '#c85200', '#898989', '#a2c8ec', '#ffbc79', '#cfcfcf'],
36407	ClassicTrafficLight9 = ['#b10318', '#dba13a', '#309343', '#d82526', '#ffc156', '#69b764', '#f26c64', '#ffdd71', '#9fcd99'],
36408	ClassicPurpleGray6 = ['#7b66d2', '#dc5fbd', '#94917b', '#995688', '#d098ee', '#d7d5c5'],
36409	ClassicPurpleGray12 = ['#7b66d2', '#a699e8', '#dc5fbd', '#ffc0da', '#5f5a41', '#b4b19b', '#995688', '#d898ba', '#ab6ad5', '#d098ee', '#8b7c6e', '#dbd4c5'],
36410	ClassicGreenOrange6 = ['#32a251', '#ff7f0f', '#3cb7cc', '#ffd94a', '#39737c', '#b85a0d'],
36411	ClassicGreenOrange12 = ['#32a251', '#acd98d', '#ff7f0f', '#ffb977', '#3cb7cc', '#98d9e4', '#b85a0d', '#ffd94a', '#39737c', '#86b4a9', '#82853b', '#ccc94d'],
36412	ClassicBlueRed6 = ['#2c69b0', '#f02720', '#ac613c', '#6ba3d6', '#ea6b73', '#e9c39b'],
36413	ClassicBlueRed12 = ['#2c69b0', '#b5c8e2', '#f02720', '#ffb6b0', '#ac613c', '#e9c39b', '#6ba3d6', '#b5dffd', '#ac8763', '#ddc9b4', '#bd0a36', '#f4737a'],
36414	ClassicCyclic13 = ['#1f83b4', '#12a2a8', '#2ca030', '#78a641', '#bcbd22', '#ffbf50', '#ffaa0e', '#ff7f0e', '#d63a3a', '#c7519c', '#ba43b4', '#8a60b0', '#6f63bb'],
36415	ClassicGreen7 = ['#bccfb4', '#94bb83', '#69a761', '#339444', '#27823b', '#1a7232', '#09622a'],
36416	ClassicGray13 = ['#c3c3c3', '#b2b2b2', '#a2a2a2', '#929292', '#838383', '#747474', '#666666', '#585858', '#4b4b4b', '#3f3f3f', '#333333', '#282828', '#1e1e1e'],
36417	ClassicBlue7 = ['#b4d4da', '#7bc8e2', '#67add4', '#3a87b7', '#1c73b1', '#1c5998', '#26456e'],
36418	ClassicRed9 = ['#eac0bd', '#f89a90', '#f57667', '#e35745', '#d8392c', '#cf1719', '#c21417', '#b10c1d', '#9c0824'],
36419	ClassicOrange7 = ['#f0c294', '#fdab67', '#fd8938', '#f06511', '#d74401', '#a33202', '#7b3014'],
36420	ClassicAreaRed11 = ['#f5cac7', '#fbb3ab', '#fd9c8f', '#fe8b7a', '#fd7864', '#f46b55', '#ea5e45', '#e04e35', '#d43e25', '#c92b14', '#bd1100'],
36421	ClassicAreaGreen11 = ['#dbe8b4', '#c3e394', '#acdc7a', '#9ad26d', '#8ac765', '#7abc5f', '#6cae59', '#60a24d', '#569735', '#4a8c1c', '#3c8200'],
36422	ClassicAreaBrown11 = ['#f3e0c2', '#f6d29c', '#f7c577', '#f0b763', '#e4aa63', '#d89c63', '#cc8f63', '#c08262', '#bb7359', '#bb6348', '#bb5137'],
36423	ClassicRedGreen11 = ['#9c0824', '#bd1316', '#d11719', '#df513f', '#fc8375', '#cacaca', '#a2c18f', '#69a761', '#2f8e41', '#1e7735', '#09622a'],
36424	ClassicRedBlue11 = ['#9c0824', '#bd1316', '#d11719', '#df513f', '#fc8375', '#cacaca', '#67add4', '#3a87b7', '#1c73b1', '#1c5998', '#26456e'],
36425	ClassicRedBlack11 = ['#9c0824', '#bd1316', '#d11719', '#df513f', '#fc8375', '#cacaca', '#9b9b9b', '#777777', '#565656', '#383838', '#1e1e1e'],
36426	ClassicAreaRedGreen21 = ['#bd1100', '#c82912', '#d23a21', '#dc4930', '#e6583e', '#ef654d', '#f7705b', '#fd7e6b', '#fe8e7e', '#fca294', '#e9dabe', '#c7e298', '#b1de7f', '#a0d571', '#90cb68', '#82c162', '#75b65d', '#69aa56', '#5ea049', '#559633', '#4a8c1c'],
36427	ClassicOrangeBlue13 = ['#7b3014', '#a33202', '#d74401', '#f06511', '#fd8938', '#fdab67', '#cacaca', '#7bc8e2', '#67add4', '#3a87b7', '#1c73b1', '#1c5998', '#26456e'],
36428	ClassicGreenBlue11 = ['#09622a', '#1e7735', '#2f8e41', '#69a761', '#a2c18f', '#cacaca', '#67add4', '#3a87b7', '#1c73b1', '#1c5998', '#26456e'],
36429	ClassicRedWhiteGreen11 = ['#9c0824', '#b41f27', '#cc312b', '#e86753', '#fcb4a5', '#ffffff', '#b9d7b7', '#74af72', '#428f49', '#297839', '#09622a'],
36430	ClassicRedWhiteBlack11 = ['#9c0824', '#b41f27', '#cc312b', '#e86753', '#fcb4a5', '#ffffff', '#bfbfbf', '#838383', '#575757', '#393939', '#1e1e1e'],
36431	ClassicOrangeWhiteBlue11 = ['#7b3014', '#a84415', '#d85a13', '#fb8547', '#ffc2a1', '#ffffff', '#b7cde2', '#6a9ec5', '#3679a8', '#2e5f8a', '#26456e'],
36432	ClassicRedWhiteBlackLight10 = ['#ffc2c5', '#ffd1d3', '#ffe0e1', '#fff0f0', '#ffffff', '#f3f3f3', '#e8e8e8', '#dddddd', '#d1d1d1', '#c6c6c6'],
36433	ClassicOrangeWhiteBlueLight11 = ['#ffcc9e', '#ffd6b1', '#ffe0c5', '#ffead8', '#fff5eb', '#ffffff', '#f3f7fd', '#e8effa', '#dce8f8', '#d0e0f6', '#c4d8f3'],
36434	ClassicRedWhiteGreenLight11 = ['#ffb2b6', '#ffc2c5', '#ffd1d3', '#ffe0e1', '#fff0f0', '#ffffff', '#f1faed', '#e3f5db', '#d5f0ca', '#c6ebb8', '#b7e6a7'],
36435	ClassicRedGreenLight11 = ['#ffb2b6', '#fcbdc0', '#f8c7c9', '#f2d1d2', '#ecdbdc', '#e5e5e5', '#dde6d9', '#d4e6cc', '#cae6c0', '#c1e6b4', '#b7e6a7'];
36436
36437var tableau = /*#__PURE__*/Object.freeze({
36438__proto__: null,
36439Tableau10: Tableau10,
36440Tableau20: Tableau20,
36441ColorBlind10: ColorBlind10,
36442SeattleGrays5: SeattleGrays5,
36443Traffic9: Traffic9,
36444MillerStone11: MillerStone11,
36445SuperfishelStone10: SuperfishelStone10,
36446NurielStone9: NurielStone9,
36447JewelBright9: JewelBright9,
36448Summer8: Summer8,
36449Winter10: Winter10,
36450GreenOrangeTeal12: GreenOrangeTeal12,
36451RedBlueBrown12: RedBlueBrown12,
36452PurplePinkGray12: PurplePinkGray12,
36453HueCircle19: HueCircle19,
36454OrangeBlue7: OrangeBlue7,
36455RedGreen7: RedGreen7,
36456GreenBlue7: GreenBlue7,
36457RedBlue7: RedBlue7,
36458RedBlack7: RedBlack7,
36459GoldPurple7: GoldPurple7,
36460RedGreenGold7: RedGreenGold7,
36461SunsetSunrise7: SunsetSunrise7,
36462OrangeBlueWhite7: OrangeBlueWhite7,
36463RedGreenWhite7: RedGreenWhite7,
36464GreenBlueWhite7: GreenBlueWhite7,
36465RedBlueWhite7: RedBlueWhite7,
36466RedBlackWhite7: RedBlackWhite7,
36467OrangeBlueLight7: OrangeBlueLight7,
36468Temperature7: Temperature7,
36469BlueGreen7: BlueGreen7,
36470BlueLight7: BlueLight7,
36471OrangeLight7: OrangeLight7,
36472Blue20: Blue20,
36473Orange20: Orange20,
36474Green20: Green20,
36475Red20: Red20,
36476Purple20: Purple20,
36477Brown20: Brown20,
36478Gray20: Gray20,
36479GrayWarm20: GrayWarm20,
36480BlueTeal20: BlueTeal20,
36481OrangeGold20: OrangeGold20,
36482GreenGold20: GreenGold20,
36483RedGold21: RedGold21,
36484Classic10: Classic10,
36485ClassicMedium10: ClassicMedium10,
36486ClassicLight10: ClassicLight10,
36487Classic20: Classic20,
36488ClassicGray5: ClassicGray5,
36489ClassicColorBlind10: ClassicColorBlind10,
36490ClassicTrafficLight9: ClassicTrafficLight9,
36491ClassicPurpleGray6: ClassicPurpleGray6,
36492ClassicPurpleGray12: ClassicPurpleGray12,
36493ClassicGreenOrange6: ClassicGreenOrange6,
36494ClassicGreenOrange12: ClassicGreenOrange12,
36495ClassicBlueRed6: ClassicBlueRed6,
36496ClassicBlueRed12: ClassicBlueRed12,
36497ClassicCyclic13: ClassicCyclic13,
36498ClassicGreen7: ClassicGreen7,
36499ClassicGray13: ClassicGray13,
36500ClassicBlue7: ClassicBlue7,
36501ClassicRed9: ClassicRed9,
36502ClassicOrange7: ClassicOrange7,
36503ClassicAreaRed11: ClassicAreaRed11,
36504ClassicAreaGreen11: ClassicAreaGreen11,
36505ClassicAreaBrown11: ClassicAreaBrown11,
36506ClassicRedGreen11: ClassicRedGreen11,
36507ClassicRedBlue11: ClassicRedBlue11,
36508ClassicRedBlack11: ClassicRedBlack11,
36509ClassicAreaRedGreen21: ClassicAreaRedGreen21,
36510ClassicOrangeBlue13: ClassicOrangeBlue13,
36511ClassicGreenBlue11: ClassicGreenBlue11,
36512ClassicRedWhiteGreen11: ClassicRedWhiteGreen11,
36513ClassicRedWhiteBlack11: ClassicRedWhiteBlack11,
36514ClassicOrangeWhiteBlue11: ClassicOrangeWhiteBlue11,
36515ClassicRedWhiteBlackLight10: ClassicRedWhiteBlackLight10,
36516ClassicOrangeWhiteBlueLight11: ClassicOrangeWhiteBlueLight11,
36517ClassicRedWhiteGreenLight11: ClassicRedWhiteGreenLight11,
36518ClassicRedGreenLight11: ClassicRedGreenLight11
36519});
36520
36521var colorschemes = {
36522	brewer: brewer,
36523	office: office,
36524	tableau: tableau
36525};
36526
36527var EXPANDO_KEY = '$colorschemes';
36528
vendor: 3,050 bytes, lines 36529-36622
36529// pluginBase snippet fixes the chartjs 3 incompatibility, and is backwards-compatible
36530// by Github user gebrits (https://github.com/gebrits/chartjs-plugin-colorschemes)
36531//
36532// Chartjs 2 => Chart.defaults.global
36533// Chartjs 3 => Chart.defaults
36534const pluginBase = chart_js.Chart.defaults.global || chart_js.Chart.defaults;
36535pluginBase.plugins.colorschemes = {
36536	scheme: 'brewer.Paired12',
36537	fillAlpha: 0.5,
36538	reverse: false,
36539	overrideExisting: false
36540};
36541
36542function getScheme(scheme) {
36543	var colorschemes, matches, arr, category;
36544
36545	if (Array.isArray(scheme)) {
36546		return scheme;
36547	} else if (typeof scheme === 'string') {
36548		colorschemes = chart_js.Chart.colorschemes || {};
36549
36550		// For backward compatibility
36551		matches = scheme.match(/^(brewer\.\w+)([1-3])-(\d+)$/);
36552		if (matches) {
36553			scheme = matches[1] + ['One', 'Two', 'Three'][matches[2] - 1] + matches[3];
36554		} else if (scheme === 'office.Office2007-2010-6') {
36555			scheme = 'office.OfficeClassic6';
36556		}
36557
36558		arr = scheme.split('.');
36559		category = colorschemes[arr[0]];
36560		if (category) {
36561			return category[arr[1]];
36562		}
36563	}
36564}
36565
36566var ColorSchemesPlugin = {
36567	id: 'colorschemes',
36568
36569	beforeUpdate: function(chart, args, options) {
36570		// Please note that in v3, the args argument was added. It was not used before it was added,
36571		// so we just check if it is not actually our options object
36572		if (options === undefined) {
36573			options = args;
36574		}
36575
36576		var scheme = getScheme(options.scheme);
36577		var fillAlpha = options.fillAlpha;
36578		var reverse = options.reverse;
36579		var override = options.overrideExisting;
36580		var custom = options.custom;
36581		var schemeClone, customResult, length, colorIndex, newColor;
36582
36583		if (scheme) {
36584
36585			if (typeof custom === 'function') {
36586				// clone the original scheme
36587				schemeClone = scheme.slice();
36588
36589				// Execute own custom color function
36590				customResult = custom(schemeClone);
36591
36592				// check if we really received a filled array; otherwise we keep and use the original scheme
36593				if (Array.isArray(customResult) && customResult.length) {
36594					scheme = customResult;
36595				} else if (Array.isArray(schemeClone) && schemeClone.length) {
36596					scheme = schemeClone;
36597				}
36598			}
36599
36600			length = scheme.length;
36601
36602			// Set scheme colors
36603			chart.config.data.datasets.forEach(function(dataset, datasetIndex) {
36604				colorIndex = datasetIndex % length;
36605				newColor = scheme[reverse ? length - colorIndex - 1 : colorIndex];
36606
36607				// Object to store which color option is set
36608				dataset[EXPANDO_KEY] = {};
36609
36610				switch (dataset.type || chart.config.type) {
36611				// For line, radar and scatter chart, borderColor and backgroundColor (50% transparent) are set
36612				case 'line':
36613				case 'radar':
36614				case 'scatter':
36615					if (typeof dataset.backgroundColor === 'undefined' || override) {
36616						dataset[EXPANDO_KEY].backgroundColor = dataset.backgroundColor;
36617						dataset.backgroundColor = helpers.color(newColor).alpha(fillAlpha).rgbString();
36618					}
36619					if (typeof dataset.borderColor === 'undefined' || override) {
36620						dataset[EXPANDO_KEY].borderColor = dataset.borderColor;
36621						dataset.borderColor = newColor;
36622					}
vendor: 2,176 bytes, lines 36623-36676
36623					if (typeof dataset.pointBackgroundColor === 'undefined' || override) {
36624						dataset[EXPANDO_KEY].pointBackgroundColor = dataset.pointBackgroundColor;
36625						dataset.pointBackgroundColor = helpers.color(newColor).alpha(fillAlpha).rgbString();
36626					}
36627					if (typeof dataset.pointBorderColor === 'undefined' || override) {
36628						dataset[EXPANDO_KEY].pointBorderColor = dataset.pointBorderColor;
36629						dataset.pointBorderColor = newColor;
36630					}
36631					break;
36632				// For doughnut and pie chart, backgroundColor is set to an array of colors
36633				case 'doughnut':
36634				case 'pie':
36635				case 'polarArea':
36636					if (typeof dataset.backgroundColor === 'undefined' || override) {
36637						dataset[EXPANDO_KEY].backgroundColor = dataset.backgroundColor;
36638						dataset.backgroundColor = dataset.data.map(function(data, dataIndex) {
36639							colorIndex = dataIndex % length;
36640							return scheme[reverse ? length - colorIndex - 1 : colorIndex];
36641						});
36642					}
36643					break;
36644				// For bar chart backgroundColor (including fillAlpha) and borderColor are set
36645				case 'bar':
36646					if (typeof dataset.backgroundColor === 'undefined' || override) {
36647						dataset[EXPANDO_KEY].backgroundColor = dataset.backgroundColor;
36648						dataset.backgroundColor = helpers.color(newColor).alpha(fillAlpha).rgbString();
36649					}
36650					if (typeof dataset.borderColor === 'undefined' || override) {
36651						dataset[EXPANDO_KEY].borderColor = dataset.borderColor;
36652						dataset.borderColor = newColor;
36653					}
36654					break;
36655				// For the other chart, only backgroundColor is set
36656				default:
36657					if (typeof dataset.backgroundColor === 'undefined' || override) {
36658						dataset[EXPANDO_KEY].backgroundColor = dataset.backgroundColor;
36659						dataset.backgroundColor = newColor;
36660					}
36661					break;
36662				}
36663			});
36664		}
36665	},
36666
36667	afterUpdate: function(chart) {
36668		// Unset colors
36669		chart.config.data.datasets.forEach(function(dataset) {
36670			if (dataset[EXPANDO_KEY]) {
36671				if (dataset[EXPANDO_KEY].hasOwnProperty('backgroundColor')) {
36672					dataset.backgroundColor = dataset[EXPANDO_KEY].backgroundColor;
36673				}
36674				if (dataset[EXPANDO_KEY].hasOwnProperty('borderColor')) {
36675					dataset.borderColor = dataset[EXPANDO_KEY].borderColor;
36676				}
36677				if (dataset[EXPANDO_KEY].hasOwnProperty('pointBackgroundColor')) {
36678					dataset.pointBackgroundColor = dataset[EXPANDO_KEY].pointBackgroundColor;
36679				}
36680				if (dataset[EXPANDO_KEY].hasOwnProperty('pointBorderColor')) {
36681					dataset.pointBorderColor = dataset[EXPANDO_KEY].pointBorderColor;
36682				}
36683				delete dataset[EXPANDO_KEY];
36684			}
36685		});
36686	},
36687
36688	beforeEvent: function(chart, event, options) {
36689	},
36690
36691	afterEvent: function(chart) {
36692	}
36693};
36694
36695if (chart_js.Chart.registry) {
36696  // Chartjs 3
36697  chart_js.Chart.register(ColorSchemesPlugin);
36698} else {
36699  // Chartjs 2
36700  chart_js.Chart.plugins.register(ColorSchemesPlugin);
36701}
36702
36703chart_js.Chart.colorschemes = colorschemes;
36704
36705return ColorSchemesPlugin;
36706
36707})));
36708
36709
36710
36711
36712Opendata_Graph = function (canvas, controller) {
36713  this.$canvas = $(canvas);
36714  this.$container = $(canvas).parent("div");
36715  this.$controller = $(controller);
36716  this.chart = null;
36717};
36718
36719Opendata_Graph.prototype.render = function(type, name, labels, datasets, opts) {
36720  if (opts == null) {
36721    opts = {};
36722  }
36723
36724  this.type = type;
36725  this.name = name;
36726  this.labels = labels;
36727  this.datasets = datasets;
36728  this.headerIndex = opts["headerIndex"];
36729
36730  this.destroy();
36731  if (this.headerIndex || this.headerIndex === 0) {
36732    var dataset = this.datasets[this.headerIndex];
36733    if (dataset) {
36734      this.datasets = [dataset];
36735    }
36736  }
36737  if (this.type === "bar") {
36738    this.drawBar();
36739  } else if(this.type === "line") {
36740    this.drawLine();
36741  } else if (this.type === "pie") {
36742    this.drawPie();
36743  }
36744};
36745
36746Opendata_Graph.prototype.resizeContainer = function(width) {
36747  var baseWidth = this.$container.data("baseWidth");
36748  if (!baseWidth) {
36749    baseWidth = this.$container.width();
36750    this.$container.data("baseWidth", baseWidth);
36751  }
36752  if (width > baseWidth) {
36753    this.$container.css("width", width + "px");
36754  } else {
36755    this.$container.css("width", baseWidth + "px");
36756  }
36757};
36758
36759Opendata_Graph.prototype.datasetsMinWidth = function() {
36760  return (this.datasets.length * 12) * this.labels.length;
36761};
36762
36763Opendata_Graph.prototype.drawBar = function() {
36764  var self = this;
36765
36766  this.resizeContainer(this.datasetsMinWidth());
36767  this.chart = new Chart(this.$canvas, {
36768    type: 'bar',
36769    plugins: [ChartColorSchemes],
36770    responsive: true,
36771    maintainAspectRatio: false,
36772    data: {
36773      labels: this.labels,
36774      datasets: this.datasets,
36775    },
36776    options: {
36777      title: {
36778        display: true,
36779        text: this.name,
36780        fontSize: 18
36781      },
36782      legend: {
36783        display: true,
36784        position: 'bottom',
36785        onClick: function () { return false; }
36786      },
36787      plugins: {
36788        colorschemes: {
36789          scheme: 'brewer.Paired12'
36790        }
36791      },
36792      scales: {
36793        x: {
36794          ticks: {
36795            autoSkip: false
36796          }
36797        },
36798        y: {
36799          ticks: {
36800            beginAtZero: true,
36801            callback: function (label, _index, _labels) {
36802              return label.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ',');
36803            }
36804          }
36805        }
36806      },
36807      animation: {
36808        onComplete: function() {
36809          self.$container.addClass("loaded");
36810        }
36811      }
36812    }
36813  });
36814};
36815
36816Opendata_Graph.prototype.drawLine = function() {
36817  var self = this;
36818
36819  this.resizeContainer(this.datasetsMinWidth());
36820  this.chart = new Chart(this.$canvas, {
36821    type: 'line',
36822    plugins: [ChartColorSchemes],
36823    responsive: true,
36824    maintainAspectRatio: false,
36825    data: {
36826      labels: this.labels,
36827      datasets: this.datasets,
36828    },
36829    options: {
36830      title: {
36831        display: true,
36832        text: this.name,
36833        fontSize: 18
36834      },
36835      legend: {
36836        display: true,
36837        position: 'bottom',
36838        onClick: function () { return false; }
36839      },
36840      plugins: {
36841        colorschemes: {
36842          scheme: 'brewer.Paired12'
36843        }
36844      },
36845      scales: {
36846        x: {
36847          ticks: {
36848            autoSkip: false
36849          }
36850        },
36851        y: {
36852          ticks: {
36853            beginAtZero: true,
36854            callback: function(label, _index, _labels) {
36855              return label.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ',');
36856            }
36857          }
36858        }
36859      },
36860      animation: {
36861        onComplete: function() {
36862          self.$container.addClass("loaded");
36863        }
36864      }
36865    }
36866  });
36867};
36868
36869Opendata_Graph.prototype.drawPie = function() {
36870  var self = this;
36871
36872  this.resizeContainer(0);
36873  this.chart = new Chart(this.$canvas, {
36874    type: 'pie',
36875    plugins: [ChartColorSchemes],
36876    responsive: true,
36877    maintainAspectRatio: false,
36878    data: {
36879      labels: this.labels,
36880      datasets: this.datasets,
36881    },
36882    options: {
36883      title: {
36884        display: true,
36885        text: this.name,
36886        fontSize: 18
36887      },
36888      legend: {
36889        display: true,
36890        position: 'bottom',
36891        onClick: function () { return false; }
36892      },
36893      plugins: {
36894        colorschemes: {
36895          scheme: 'brewer.Paired12'
36896        }
36897      },
36898      tooltips: {
36899        callbacks: {
36900          label: function(tooltipItem, data) {
36901            var label = data["labels"][tooltipItem["index"]];
36902            var dataset = data["datasets"][tooltipItem["datasetIndex"]];
36903
36904            data = dataset["data"][tooltipItem["index"]];
36905            data = data.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ',');
36906
36907            label = label + "(" + dataset["label"] + "): " + data;
36908            return label;
36909          }
36910        }
36911      },
36912      scales: {
36913        x: { display: false },
36914        y: { display: false }
36915      },
36916      animation: {
36917        onComplete: function() {
36918          self.$container.addClass("loaded");
36919        }
36920      }
36921    }
36922  });
36923};
36924
36925Opendata_Graph.graphTypes = {"bar":"棒グラフ","line":"線グラフ","pie":"円グラフ"};
36926
36927Opendata_Graph.prototype.renderController = function(types, headers, callback) {
36928  var self = this;
36929  this.types = types;
36930  this.headers = headers;
36931  this.$controller.html("");
36932
36933  // type bottons
36934  var divTypes = $('<div class="graph-types"></div>');
36935  $.each(this.types, function() {
36936    var type = this;
36937    var button = $('<button />', { type: "button", "data-type": type }).text(Opendata_Graph.graphTypes[type]);
36938
36939    if (self.type === type) {
36940      button.addClass("current");
36941    }
36942    button.on("click", function() {
36943      callback(type);
36944    })
36945    divTypes.append(button);
36946  });
36947  this.$controller.append(divTypes);
36948
36949  // pie controller
36950  if (this.type === "pie" && this.headers && this.headers.length > 0) {
36951    var divHeader = $('<div class="graph-header-controller"></div>');
36952    var select = $('<select class="select-header" name="header-index"></select>');
36953
36954    $.each(this.headers, function(i) {
36955      if (self.headerIndex === i) {
36956        select.append($('<option />', { value: i, selected: "selected" }).text(this));
36957      } else {
36958        select.append($('<option />', { value: i }).text(this));
36959      }
36960    });
36961    select.on("change", function() {
36962      callback("pie", select.val());
36963    });
36964
36965    divHeader.append(select);
36966    this.$controller.append(divHeader);
36967  }
36968
36969  this.$controller.show();
36970};
36971
36972Opendata_Graph.prototype.destroy = function() {
36973  if (this.chart) {
36974    this.chart.destroy();
36975  }
36976  if (this.$controller) {
36977    this.$controller.html("");
36978  }
36979};
36980
36981this.Opendata_Dataset_Graph = (function () {
36982  function Opendata_Dataset_Graph() {
36983  }
36984
36985  Opendata_Dataset_Graph.graph = null;
36986  Opendata_Dataset_Graph.$canvas = null;
36987  Opendata_Dataset_Graph.$controller = null;
36988
36989  Opendata_Dataset_Graph.render = function (canvas, controller) {
36990    $(".dataset-search a#ajax-search").colorbox({
36991      fixed: true,
36992      width: "90%",
36993      height: "90%"
36994    });
36995    Opendata_Dataset_Graph.$canvas = $(canvas);
36996    Opendata_Dataset_Graph.$controller = $(controller);
36997    Opendata_Dataset_Graph.graph = new Opendata_Graph(
36998      Opendata_Dataset_Graph.$canvas,
36999      Opendata_Dataset_Graph.$controller
37000    );
37001  }
37002
37003  Opendata_Dataset_Graph.renderGraph = function (type, header) {
37004    var ele = $('.selected-dataset [name="resource_id"]:checked:first');
37005
37006    if (ele.length > 0) {
37007      var url = $(ele).data("url");
37008      var name = $(ele).closest("li").find(".resource-name").text();
37009
37010      if (type) {
37011        url += "?type=" + type;
37012      }
37013      $.ajax({
37014        url: url,
37015        type: "GET",
37016        dataType: "json",
37017        success: function (data) {
37018          var type = data["type"];
37019          var types = data["types"];
37020          var datasets = data["datasets"];
37021          var labels = data["labels"];
37022          var headers = data["headers"];
37023
37024          if (type == "pie") {
37025            if (!header) {
37026              header = 0;
37027            }
37028            name += "(" + headers[header] + ")";
37029          }
37030          Opendata_Dataset_Graph.graph.render(type, name, labels, datasets, {headerIndex: header});
37031          Opendata_Dataset_Graph.graph.renderController(types, headers, function (type, header) {
37032            Opendata_Dataset_Graph.renderGraph(type, header);
37033          });
37034        }
37035      });
37036    } else {
37037      Opendata_Dataset_Graph.graph.destroy();
37038    }
37039  };
37040
37041  Opendata_Dataset_Graph.selectItem = function (ele) {
37042    // var dataset_id = $(ele).attr("data-id");
37043    var item = $(ele).find(".selected-item").clone(false);
37044
37045    // remove renderInBox class
37046    $(item).find("a").removeClass("cboxElement");
37047
37048    $(item).find('[name="resource_id"]').each(function (_idx) {
37049      // var resource_id = $(this).val();
37050
37051      // checkbox
37052      $(this).on("click", function () {
37053        $(this).closest('.selected-dataset').find('[name="resource_id"]').not(this).prop("checked", false);
37054        Opendata_Dataset_Graph.renderGraph();
37055        Opendata_Dataset_Graph.toggleFirstNotice();
37056      });
37057    });
37058
37059    // deselect button
37060    $(item).find(".deselect").on("click", function (_e) {
37061      $(this).closest(".selected-item").remove();
37062      Opendata_Dataset_Graph.graph.destroy();
37063      Opendata_Dataset_Graph.toggleFirstNotice();
37064      return false;
37065    });
37066
37067    // append and remove
37068    item.show();
37069    $(".dataset-search .selected-dataset").append(item);
37070    var length = $(".dataset-search .selected-dataset .selected-item").length - 10;
37071    for (var i = 0; i < length; i++) {
37072      $(".dataset-search .selected-dataset .selected-item:first").remove();
37073    }
37074    Opendata_Dataset_Graph.toggleFirstNotice();
37075
37076    return item;
37077  }
37078
37079  Opendata_Dataset_Graph.toggleSelectButton = function () {
37080    if ($(".search-ui .items input:checked").size() > 0) {
37081      $(".select-items").parent("div").show();
37082    } else {
37083      $(".select-items").parent("div").hide();
37084    }
37085  };
37086
37087  Opendata_Dataset_Graph.toggleFirstNotice = function () {
37088    if ($('.selected-dataset [name="resource_id"]:checked').length > 0) {
37089      $(".resource-graph .first-notice").hide();
37090    } else {
37091      $(".resource-graph .first-notice").show();
37092    }
37093  };
37094
37095  Opendata_Dataset_Graph.modal = function () {
37096    // form search event
37097    $(".search-ui-form form.search").on("submit", function (_e) {
37098      $(this).ajaxSubmit({
37099        url: $(this).attr("action"),
37100        success: function (data) {
37101          return $("#cboxLoadedContent").html(data);
37102        },
37103        error: function (_data, _status) {
37104          return alert("== Error ==");
37105        }
37106      });
37107      return false;
37108    });
37109
37110    // select item event
37111    $(".search-ui a.select-item").on("click", function (_e) {
37112      var tr = $(this).closest("tr");
37113      var article = Opendata_Dataset_Graph.selectItem(tr);
37114
37115      $.colorbox.close();
37116      $(article).find(".set-graph:first").trigger("click");
37117
37118      return false;
37119    });
37120
37121    // select items event
37122    $(".search-ui-select .select-items").on("click", function (_e) {
37123      $(".search-ui .items .set-dataset:checked").each(function () {
37124        var tr = $(this).closest("tr");
37125        Opendata_Dataset_Graph.selectItem(tr);
37126      });
37127      $.colorbox.close();
37128      return false;
37129    });
37130
37131    // list-head checkbox event
37132    $(".search-ui .list-head input:checkbox").on("change", function (_e) {
37133      var chk = $(this).prop('checked');
37134      $('.search-ui .list-item').each(function () {
37135        $(this).toggleClass('checked', chk);
37136        $(this).find('.set-dataset').prop('checked', chk);
37137      });
37138    });
37139
37140    // toggle select items button event
37141    $(".search-ui").on("change", function (_e) {
37142      Opendata_Dataset_Graph.toggleSelectButton();
37143    });
37144
37145    // disable selected items in modal
37146    $(".dataset-search .selected-dataset .selected-item").each(function () {
37147      var id = $(this).attr("data-id");
37148      var tr = $(".items [data-id='" + id + "']");
37149      tr.find("input[type=checkbox]").remove();
37150
37151      var item = tr.find(".select-item").html();
37152      tr.find(".select-item").replaceWith("<span class='select-item' style='color: #888'>" + item + "</span>");
37153    });
37154  }
37155
37156  return Opendata_Dataset_Graph;
37157})();

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.