Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

19046 lines
516KB

  1. /*! jQuery UI - v1.13.0 - 2021-10-07
  2. * http://jqueryui.com
  3. * Includes: widget.js, position.js, data.js, disable-selection.js, effect.js, effects/effect-blind.js, effects/effect-bounce.js, effects/effect-clip.js, effects/effect-drop.js, effects/effect-explode.js, effects/effect-fade.js, effects/effect-fold.js, effects/effect-highlight.js, effects/effect-puff.js, effects/effect-pulsate.js, effects/effect-scale.js, effects/effect-shake.js, effects/effect-size.js, effects/effect-slide.js, effects/effect-transfer.js, focusable.js, form-reset-mixin.js, jquery-patch.js, keycode.js, labels.js, scroll-parent.js, tabbable.js, unique-id.js, widgets/accordion.js, widgets/autocomplete.js, widgets/button.js, widgets/checkboxradio.js, widgets/controlgroup.js, widgets/datepicker.js, widgets/dialog.js, widgets/draggable.js, widgets/droppable.js, widgets/menu.js, widgets/mouse.js, widgets/progressbar.js, widgets/resizable.js, widgets/selectable.js, widgets/selectmenu.js, widgets/slider.js, widgets/sortable.js, widgets/spinner.js, widgets/tabs.js, widgets/tooltip.js
  4. * Copyright jQuery Foundation and other contributors; Licensed MIT */
  5. ( function( factory ) {
  6. "use strict";
  7. if ( typeof define === "function" && define.amd ) {
  8. // AMD. Register as an anonymous module.
  9. define( [ "jquery" ], factory );
  10. } else {
  11. // Browser globals
  12. factory( jQuery );
  13. }
  14. } )( function( $ ) {
  15. "use strict";
  16. $.ui = $.ui || {};
  17. var version = $.ui.version = "1.13.0";
  18. /*!
  19. * jQuery UI Widget 1.13.0
  20. * http://jqueryui.com
  21. *
  22. * Copyright jQuery Foundation and other contributors
  23. * Released under the MIT license.
  24. * http://jquery.org/license
  25. */
  26. //>>label: Widget
  27. //>>group: Core
  28. //>>description: Provides a factory for creating stateful widgets with a common API.
  29. //>>docs: http://api.jqueryui.com/jQuery.widget/
  30. //>>demos: http://jqueryui.com/widget/
  31. var widgetUuid = 0;
  32. var widgetHasOwnProperty = Array.prototype.hasOwnProperty;
  33. var widgetSlice = Array.prototype.slice;
  34. $.cleanData = ( function( orig ) {
  35. return function( elems ) {
  36. var events, elem, i;
  37. for ( i = 0; ( elem = elems[ i ] ) != null; i++ ) {
  38. // Only trigger remove when necessary to save time
  39. events = $._data( elem, "events" );
  40. if ( events && events.remove ) {
  41. $( elem ).triggerHandler( "remove" );
  42. }
  43. }
  44. orig( elems );
  45. };
  46. } )( $.cleanData );
  47. $.widget = function( name, base, prototype ) {
  48. var existingConstructor, constructor, basePrototype;
  49. // ProxiedPrototype allows the provided prototype to remain unmodified
  50. // so that it can be used as a mixin for multiple widgets (#8876)
  51. var proxiedPrototype = {};
  52. var namespace = name.split( "." )[ 0 ];
  53. name = name.split( "." )[ 1 ];
  54. var fullName = namespace + "-" + name;
  55. if ( !prototype ) {
  56. prototype = base;
  57. base = $.Widget;
  58. }
  59. if ( Array.isArray( prototype ) ) {
  60. prototype = $.extend.apply( null, [ {} ].concat( prototype ) );
  61. }
  62. // Create selector for plugin
  63. $.expr.pseudos[ fullName.toLowerCase() ] = function( elem ) {
  64. return !!$.data( elem, fullName );
  65. };
  66. $[ namespace ] = $[ namespace ] || {};
  67. existingConstructor = $[ namespace ][ name ];
  68. constructor = $[ namespace ][ name ] = function( options, element ) {
  69. // Allow instantiation without "new" keyword
  70. if ( !this._createWidget ) {
  71. return new constructor( options, element );
  72. }
  73. // Allow instantiation without initializing for simple inheritance
  74. // must use "new" keyword (the code above always passes args)
  75. if ( arguments.length ) {
  76. this._createWidget( options, element );
  77. }
  78. };
  79. // Extend with the existing constructor to carry over any static properties
  80. $.extend( constructor, existingConstructor, {
  81. version: prototype.version,
  82. // Copy the object used to create the prototype in case we need to
  83. // redefine the widget later
  84. _proto: $.extend( {}, prototype ),
  85. // Track widgets that inherit from this widget in case this widget is
  86. // redefined after a widget inherits from it
  87. _childConstructors: []
  88. } );
  89. basePrototype = new base();
  90. // We need to make the options hash a property directly on the new instance
  91. // otherwise we'll modify the options hash on the prototype that we're
  92. // inheriting from
  93. basePrototype.options = $.widget.extend( {}, basePrototype.options );
  94. $.each( prototype, function( prop, value ) {
  95. if ( typeof value !== "function" ) {
  96. proxiedPrototype[ prop ] = value;
  97. return;
  98. }
  99. proxiedPrototype[ prop ] = ( function() {
  100. function _super() {
  101. return base.prototype[ prop ].apply( this, arguments );
  102. }
  103. function _superApply( args ) {
  104. return base.prototype[ prop ].apply( this, args );
  105. }
  106. return function() {
  107. var __super = this._super;
  108. var __superApply = this._superApply;
  109. var returnValue;
  110. this._super = _super;
  111. this._superApply = _superApply;
  112. returnValue = value.apply( this, arguments );
  113. this._super = __super;
  114. this._superApply = __superApply;
  115. return returnValue;
  116. };
  117. } )();
  118. } );
  119. constructor.prototype = $.widget.extend( basePrototype, {
  120. // TODO: remove support for widgetEventPrefix
  121. // always use the name + a colon as the prefix, e.g., draggable:start
  122. // don't prefix for widgets that aren't DOM-based
  123. widgetEventPrefix: existingConstructor ? ( basePrototype.widgetEventPrefix || name ) : name
  124. }, proxiedPrototype, {
  125. constructor: constructor,
  126. namespace: namespace,
  127. widgetName: name,
  128. widgetFullName: fullName
  129. } );
  130. // If this widget is being redefined then we need to find all widgets that
  131. // are inheriting from it and redefine all of them so that they inherit from
  132. // the new version of this widget. We're essentially trying to replace one
  133. // level in the prototype chain.
  134. if ( existingConstructor ) {
  135. $.each( existingConstructor._childConstructors, function( i, child ) {
  136. var childPrototype = child.prototype;
  137. // Redefine the child widget using the same prototype that was
  138. // originally used, but inherit from the new version of the base
  139. $.widget( childPrototype.namespace + "." + childPrototype.widgetName, constructor,
  140. child._proto );
  141. } );
  142. // Remove the list of existing child constructors from the old constructor
  143. // so the old child constructors can be garbage collected
  144. delete existingConstructor._childConstructors;
  145. } else {
  146. base._childConstructors.push( constructor );
  147. }
  148. $.widget.bridge( name, constructor );
  149. return constructor;
  150. };
  151. $.widget.extend = function( target ) {
  152. var input = widgetSlice.call( arguments, 1 );
  153. var inputIndex = 0;
  154. var inputLength = input.length;
  155. var key;
  156. var value;
  157. for ( ; inputIndex < inputLength; inputIndex++ ) {
  158. for ( key in input[ inputIndex ] ) {
  159. value = input[ inputIndex ][ key ];
  160. if ( widgetHasOwnProperty.call( input[ inputIndex ], key ) && value !== undefined ) {
  161. // Clone objects
  162. if ( $.isPlainObject( value ) ) {
  163. target[ key ] = $.isPlainObject( target[ key ] ) ?
  164. $.widget.extend( {}, target[ key ], value ) :
  165. // Don't extend strings, arrays, etc. with objects
  166. $.widget.extend( {}, value );
  167. // Copy everything else by reference
  168. } else {
  169. target[ key ] = value;
  170. }
  171. }
  172. }
  173. }
  174. return target;
  175. };
  176. $.widget.bridge = function( name, object ) {
  177. var fullName = object.prototype.widgetFullName || name;
  178. $.fn[ name ] = function( options ) {
  179. var isMethodCall = typeof options === "string";
  180. var args = widgetSlice.call( arguments, 1 );
  181. var returnValue = this;
  182. if ( isMethodCall ) {
  183. // If this is an empty collection, we need to have the instance method
  184. // return undefined instead of the jQuery instance
  185. if ( !this.length && options === "instance" ) {
  186. returnValue = undefined;
  187. } else {
  188. this.each( function() {
  189. var methodValue;
  190. var instance = $.data( this, fullName );
  191. if ( options === "instance" ) {
  192. returnValue = instance;
  193. return false;
  194. }
  195. if ( !instance ) {
  196. return $.error( "cannot call methods on " + name +
  197. " prior to initialization; " +
  198. "attempted to call method '" + options + "'" );
  199. }
  200. if ( typeof instance[ options ] !== "function" ||
  201. options.charAt( 0 ) === "_" ) {
  202. return $.error( "no such method '" + options + "' for " + name +
  203. " widget instance" );
  204. }
  205. methodValue = instance[ options ].apply( instance, args );
  206. if ( methodValue !== instance && methodValue !== undefined ) {
  207. returnValue = methodValue && methodValue.jquery ?
  208. returnValue.pushStack( methodValue.get() ) :
  209. methodValue;
  210. return false;
  211. }
  212. } );
  213. }
  214. } else {
  215. // Allow multiple hashes to be passed on init
  216. if ( args.length ) {
  217. options = $.widget.extend.apply( null, [ options ].concat( args ) );
  218. }
  219. this.each( function() {
  220. var instance = $.data( this, fullName );
  221. if ( instance ) {
  222. instance.option( options || {} );
  223. if ( instance._init ) {
  224. instance._init();
  225. }
  226. } else {
  227. $.data( this, fullName, new object( options, this ) );
  228. }
  229. } );
  230. }
  231. return returnValue;
  232. };
  233. };
  234. $.Widget = function( /* options, element */ ) {};
  235. $.Widget._childConstructors = [];
  236. $.Widget.prototype = {
  237. widgetName: "widget",
  238. widgetEventPrefix: "",
  239. defaultElement: "<div>",
  240. options: {
  241. classes: {},
  242. disabled: false,
  243. // Callbacks
  244. create: null
  245. },
  246. _createWidget: function( options, element ) {
  247. element = $( element || this.defaultElement || this )[ 0 ];
  248. this.element = $( element );
  249. this.uuid = widgetUuid++;
  250. this.eventNamespace = "." + this.widgetName + this.uuid;
  251. this.bindings = $();
  252. this.hoverable = $();
  253. this.focusable = $();
  254. this.classesElementLookup = {};
  255. if ( element !== this ) {
  256. $.data( element, this.widgetFullName, this );
  257. this._on( true, this.element, {
  258. remove: function( event ) {
  259. if ( event.target === element ) {
  260. this.destroy();
  261. }
  262. }
  263. } );
  264. this.document = $( element.style ?
  265. // Element within the document
  266. element.ownerDocument :
  267. // Element is window or document
  268. element.document || element );
  269. this.window = $( this.document[ 0 ].defaultView || this.document[ 0 ].parentWindow );
  270. }
  271. this.options = $.widget.extend( {},
  272. this.options,
  273. this._getCreateOptions(),
  274. options );
  275. this._create();
  276. if ( this.options.disabled ) {
  277. this._setOptionDisabled( this.options.disabled );
  278. }
  279. this._trigger( "create", null, this._getCreateEventData() );
  280. this._init();
  281. },
  282. _getCreateOptions: function() {
  283. return {};
  284. },
  285. _getCreateEventData: $.noop,
  286. _create: $.noop,
  287. _init: $.noop,
  288. destroy: function() {
  289. var that = this;
  290. this._destroy();
  291. $.each( this.classesElementLookup, function( key, value ) {
  292. that._removeClass( value, key );
  293. } );
  294. // We can probably remove the unbind calls in 2.0
  295. // all event bindings should go through this._on()
  296. this.element
  297. .off( this.eventNamespace )
  298. .removeData( this.widgetFullName );
  299. this.widget()
  300. .off( this.eventNamespace )
  301. .removeAttr( "aria-disabled" );
  302. // Clean up events and states
  303. this.bindings.off( this.eventNamespace );
  304. },
  305. _destroy: $.noop,
  306. widget: function() {
  307. return this.element;
  308. },
  309. option: function( key, value ) {
  310. var options = key;
  311. var parts;
  312. var curOption;
  313. var i;
  314. if ( arguments.length === 0 ) {
  315. // Don't return a reference to the internal hash
  316. return $.widget.extend( {}, this.options );
  317. }
  318. if ( typeof key === "string" ) {
  319. // Handle nested keys, e.g., "foo.bar" => { foo: { bar: ___ } }
  320. options = {};
  321. parts = key.split( "." );
  322. key = parts.shift();
  323. if ( parts.length ) {
  324. curOption = options[ key ] = $.widget.extend( {}, this.options[ key ] );
  325. for ( i = 0; i < parts.length - 1; i++ ) {
  326. curOption[ parts[ i ] ] = curOption[ parts[ i ] ] || {};
  327. curOption = curOption[ parts[ i ] ];
  328. }
  329. key = parts.pop();
  330. if ( arguments.length === 1 ) {
  331. return curOption[ key ] === undefined ? null : curOption[ key ];
  332. }
  333. curOption[ key ] = value;
  334. } else {
  335. if ( arguments.length === 1 ) {
  336. return this.options[ key ] === undefined ? null : this.options[ key ];
  337. }
  338. options[ key ] = value;
  339. }
  340. }
  341. this._setOptions( options );
  342. return this;
  343. },
  344. _setOptions: function( options ) {
  345. var key;
  346. for ( key in options ) {
  347. this._setOption( key, options[ key ] );
  348. }
  349. return this;
  350. },
  351. _setOption: function( key, value ) {
  352. if ( key === "classes" ) {
  353. this._setOptionClasses( value );
  354. }
  355. this.options[ key ] = value;
  356. if ( key === "disabled" ) {
  357. this._setOptionDisabled( value );
  358. }
  359. return this;
  360. },
  361. _setOptionClasses: function( value ) {
  362. var classKey, elements, currentElements;
  363. for ( classKey in value ) {
  364. currentElements = this.classesElementLookup[ classKey ];
  365. if ( value[ classKey ] === this.options.classes[ classKey ] ||
  366. !currentElements ||
  367. !currentElements.length ) {
  368. continue;
  369. }
  370. // We are doing this to create a new jQuery object because the _removeClass() call
  371. // on the next line is going to destroy the reference to the current elements being
  372. // tracked. We need to save a copy of this collection so that we can add the new classes
  373. // below.
  374. elements = $( currentElements.get() );
  375. this._removeClass( currentElements, classKey );
  376. // We don't use _addClass() here, because that uses this.options.classes
  377. // for generating the string of classes. We want to use the value passed in from
  378. // _setOption(), this is the new value of the classes option which was passed to
  379. // _setOption(). We pass this value directly to _classes().
  380. elements.addClass( this._classes( {
  381. element: elements,
  382. keys: classKey,
  383. classes: value,
  384. add: true
  385. } ) );
  386. }
  387. },
  388. _setOptionDisabled: function( value ) {
  389. this._toggleClass( this.widget(), this.widgetFullName + "-disabled", null, !!value );
  390. // If the widget is becoming disabled, then nothing is interactive
  391. if ( value ) {
  392. this._removeClass( this.hoverable, null, "ui-state-hover" );
  393. this._removeClass( this.focusable, null, "ui-state-focus" );
  394. }
  395. },
  396. enable: function() {
  397. return this._setOptions( { disabled: false } );
  398. },
  399. disable: function() {
  400. return this._setOptions( { disabled: true } );
  401. },
  402. _classes: function( options ) {
  403. var full = [];
  404. var that = this;
  405. options = $.extend( {
  406. element: this.element,
  407. classes: this.options.classes || {}
  408. }, options );
  409. function bindRemoveEvent() {
  410. options.element.each( function( _, element ) {
  411. var isTracked = $.map( that.classesElementLookup, function( elements ) {
  412. return elements;
  413. } )
  414. .some( function( elements ) {
  415. return elements.is( element );
  416. } );
  417. if ( !isTracked ) {
  418. that._on( $( element ), {
  419. remove: "_untrackClassesElement"
  420. } );
  421. }
  422. } );
  423. }
  424. function processClassString( classes, checkOption ) {
  425. var current, i;
  426. for ( i = 0; i < classes.length; i++ ) {
  427. current = that.classesElementLookup[ classes[ i ] ] || $();
  428. if ( options.add ) {
  429. bindRemoveEvent();
  430. current = $( $.uniqueSort( current.get().concat( options.element.get() ) ) );
  431. } else {
  432. current = $( current.not( options.element ).get() );
  433. }
  434. that.classesElementLookup[ classes[ i ] ] = current;
  435. full.push( classes[ i ] );
  436. if ( checkOption && options.classes[ classes[ i ] ] ) {
  437. full.push( options.classes[ classes[ i ] ] );
  438. }
  439. }
  440. }
  441. if ( options.keys ) {
  442. processClassString( options.keys.match( /\S+/g ) || [], true );
  443. }
  444. if ( options.extra ) {
  445. processClassString( options.extra.match( /\S+/g ) || [] );
  446. }
  447. return full.join( " " );
  448. },
  449. _untrackClassesElement: function( event ) {
  450. var that = this;
  451. $.each( that.classesElementLookup, function( key, value ) {
  452. if ( $.inArray( event.target, value ) !== -1 ) {
  453. that.classesElementLookup[ key ] = $( value.not( event.target ).get() );
  454. }
  455. } );
  456. this._off( $( event.target ) );
  457. },
  458. _removeClass: function( element, keys, extra ) {
  459. return this._toggleClass( element, keys, extra, false );
  460. },
  461. _addClass: function( element, keys, extra ) {
  462. return this._toggleClass( element, keys, extra, true );
  463. },
  464. _toggleClass: function( element, keys, extra, add ) {
  465. add = ( typeof add === "boolean" ) ? add : extra;
  466. var shift = ( typeof element === "string" || element === null ),
  467. options = {
  468. extra: shift ? keys : extra,
  469. keys: shift ? element : keys,
  470. element: shift ? this.element : element,
  471. add: add
  472. };
  473. options.element.toggleClass( this._classes( options ), add );
  474. return this;
  475. },
  476. _on: function( suppressDisabledCheck, element, handlers ) {
  477. var delegateElement;
  478. var instance = this;
  479. // No suppressDisabledCheck flag, shuffle arguments
  480. if ( typeof suppressDisabledCheck !== "boolean" ) {
  481. handlers = element;
  482. element = suppressDisabledCheck;
  483. suppressDisabledCheck = false;
  484. }
  485. // No element argument, shuffle and use this.element
  486. if ( !handlers ) {
  487. handlers = element;
  488. element = this.element;
  489. delegateElement = this.widget();
  490. } else {
  491. element = delegateElement = $( element );
  492. this.bindings = this.bindings.add( element );
  493. }
  494. $.each( handlers, function( event, handler ) {
  495. function handlerProxy() {
  496. // Allow widgets to customize the disabled handling
  497. // - disabled as an array instead of boolean
  498. // - disabled class as method for disabling individual parts
  499. if ( !suppressDisabledCheck &&
  500. ( instance.options.disabled === true ||
  501. $( this ).hasClass( "ui-state-disabled" ) ) ) {
  502. return;
  503. }
  504. return ( typeof handler === "string" ? instance[ handler ] : handler )
  505. .apply( instance, arguments );
  506. }
  507. // Copy the guid so direct unbinding works
  508. if ( typeof handler !== "string" ) {
  509. handlerProxy.guid = handler.guid =
  510. handler.guid || handlerProxy.guid || $.guid++;
  511. }
  512. var match = event.match( /^([\w:-]*)\s*(.*)$/ );
  513. var eventName = match[ 1 ] + instance.eventNamespace;
  514. var selector = match[ 2 ];
  515. if ( selector ) {
  516. delegateElement.on( eventName, selector, handlerProxy );
  517. } else {
  518. element.on( eventName, handlerProxy );
  519. }
  520. } );
  521. },
  522. _off: function( element, eventName ) {
  523. eventName = ( eventName || "" ).split( " " ).join( this.eventNamespace + " " ) +
  524. this.eventNamespace;
  525. element.off( eventName );
  526. // Clear the stack to avoid memory leaks (#10056)
  527. this.bindings = $( this.bindings.not( element ).get() );
  528. this.focusable = $( this.focusable.not( element ).get() );
  529. this.hoverable = $( this.hoverable.not( element ).get() );
  530. },
  531. _delay: function( handler, delay ) {
  532. function handlerProxy() {
  533. return ( typeof handler === "string" ? instance[ handler ] : handler )
  534. .apply( instance, arguments );
  535. }
  536. var instance = this;
  537. return setTimeout( handlerProxy, delay || 0 );
  538. },
  539. _hoverable: function( element ) {
  540. this.hoverable = this.hoverable.add( element );
  541. this._on( element, {
  542. mouseenter: function( event ) {
  543. this._addClass( $( event.currentTarget ), null, "ui-state-hover" );
  544. },
  545. mouseleave: function( event ) {
  546. this._removeClass( $( event.currentTarget ), null, "ui-state-hover" );
  547. }
  548. } );
  549. },
  550. _focusable: function( element ) {
  551. this.focusable = this.focusable.add( element );
  552. this._on( element, {
  553. focusin: function( event ) {
  554. this._addClass( $( event.currentTarget ), null, "ui-state-focus" );
  555. },
  556. focusout: function( event ) {
  557. this._removeClass( $( event.currentTarget ), null, "ui-state-focus" );
  558. }
  559. } );
  560. },
  561. _trigger: function( type, event, data ) {
  562. var prop, orig;
  563. var callback = this.options[ type ];
  564. data = data || {};
  565. event = $.Event( event );
  566. event.type = ( type === this.widgetEventPrefix ?
  567. type :
  568. this.widgetEventPrefix + type ).toLowerCase();
  569. // The original event may come from any element
  570. // so we need to reset the target on the new event
  571. event.target = this.element[ 0 ];
  572. // Copy original event properties over to the new event
  573. orig = event.originalEvent;
  574. if ( orig ) {
  575. for ( prop in orig ) {
  576. if ( !( prop in event ) ) {
  577. event[ prop ] = orig[ prop ];
  578. }
  579. }
  580. }
  581. this.element.trigger( event, data );
  582. return !( typeof callback === "function" &&
  583. callback.apply( this.element[ 0 ], [ event ].concat( data ) ) === false ||
  584. event.isDefaultPrevented() );
  585. }
  586. };
  587. $.each( { show: "fadeIn", hide: "fadeOut" }, function( method, defaultEffect ) {
  588. $.Widget.prototype[ "_" + method ] = function( element, options, callback ) {
  589. if ( typeof options === "string" ) {
  590. options = { effect: options };
  591. }
  592. var hasOptions;
  593. var effectName = !options ?
  594. method :
  595. options === true || typeof options === "number" ?
  596. defaultEffect :
  597. options.effect || defaultEffect;
  598. options = options || {};
  599. if ( typeof options === "number" ) {
  600. options = { duration: options };
  601. } else if ( options === true ) {
  602. options = {};
  603. }
  604. hasOptions = !$.isEmptyObject( options );
  605. options.complete = callback;
  606. if ( options.delay ) {
  607. element.delay( options.delay );
  608. }
  609. if ( hasOptions && $.effects && $.effects.effect[ effectName ] ) {
  610. element[ method ]( options );
  611. } else if ( effectName !== method && element[ effectName ] ) {
  612. element[ effectName ]( options.duration, options.easing, callback );
  613. } else {
  614. element.queue( function( next ) {
  615. $( this )[ method ]();
  616. if ( callback ) {
  617. callback.call( element[ 0 ] );
  618. }
  619. next();
  620. } );
  621. }
  622. };
  623. } );
  624. var widget = $.widget;
  625. /*!
  626. * jQuery UI Position 1.13.0
  627. * http://jqueryui.com
  628. *
  629. * Copyright jQuery Foundation and other contributors
  630. * Released under the MIT license.
  631. * http://jquery.org/license
  632. *
  633. * http://api.jqueryui.com/position/
  634. */
  635. //>>label: Position
  636. //>>group: Core
  637. //>>description: Positions elements relative to other elements.
  638. //>>docs: http://api.jqueryui.com/position/
  639. //>>demos: http://jqueryui.com/position/
  640. ( function() {
  641. var cachedScrollbarWidth,
  642. max = Math.max,
  643. abs = Math.abs,
  644. rhorizontal = /left|center|right/,
  645. rvertical = /top|center|bottom/,
  646. roffset = /[\+\-]\d+(\.[\d]+)?%?/,
  647. rposition = /^\w+/,
  648. rpercent = /%$/,
  649. _position = $.fn.position;
  650. function getOffsets( offsets, width, height ) {
  651. return [
  652. parseFloat( offsets[ 0 ] ) * ( rpercent.test( offsets[ 0 ] ) ? width / 100 : 1 ),
  653. parseFloat( offsets[ 1 ] ) * ( rpercent.test( offsets[ 1 ] ) ? height / 100 : 1 )
  654. ];
  655. }
  656. function parseCss( element, property ) {
  657. return parseInt( $.css( element, property ), 10 ) || 0;
  658. }
  659. function isWindow( obj ) {
  660. return obj != null && obj === obj.window;
  661. }
  662. function getDimensions( elem ) {
  663. var raw = elem[ 0 ];
  664. if ( raw.nodeType === 9 ) {
  665. return {
  666. width: elem.width(),
  667. height: elem.height(),
  668. offset: { top: 0, left: 0 }
  669. };
  670. }
  671. if ( isWindow( raw ) ) {
  672. return {
  673. width: elem.width(),
  674. height: elem.height(),
  675. offset: { top: elem.scrollTop(), left: elem.scrollLeft() }
  676. };
  677. }
  678. if ( raw.preventDefault ) {
  679. return {
  680. width: 0,
  681. height: 0,
  682. offset: { top: raw.pageY, left: raw.pageX }
  683. };
  684. }
  685. return {
  686. width: elem.outerWidth(),
  687. height: elem.outerHeight(),
  688. offset: elem.offset()
  689. };
  690. }
  691. $.position = {
  692. scrollbarWidth: function() {
  693. if ( cachedScrollbarWidth !== undefined ) {
  694. return cachedScrollbarWidth;
  695. }
  696. var w1, w2,
  697. div = $( "<div style=" +
  698. "'display:block;position:absolute;width:200px;height:200px;overflow:hidden;'>" +
  699. "<div style='height:300px;width:auto;'></div></div>" ),
  700. innerDiv = div.children()[ 0 ];
  701. $( "body" ).append( div );
  702. w1 = innerDiv.offsetWidth;
  703. div.css( "overflow", "scroll" );
  704. w2 = innerDiv.offsetWidth;
  705. if ( w1 === w2 ) {
  706. w2 = div[ 0 ].clientWidth;
  707. }
  708. div.remove();
  709. return ( cachedScrollbarWidth = w1 - w2 );
  710. },
  711. getScrollInfo: function( within ) {
  712. var overflowX = within.isWindow || within.isDocument ? "" :
  713. within.element.css( "overflow-x" ),
  714. overflowY = within.isWindow || within.isDocument ? "" :
  715. within.element.css( "overflow-y" ),
  716. hasOverflowX = overflowX === "scroll" ||
  717. ( overflowX === "auto" && within.width < within.element[ 0 ].scrollWidth ),
  718. hasOverflowY = overflowY === "scroll" ||
  719. ( overflowY === "auto" && within.height < within.element[ 0 ].scrollHeight );
  720. return {
  721. width: hasOverflowY ? $.position.scrollbarWidth() : 0,
  722. height: hasOverflowX ? $.position.scrollbarWidth() : 0
  723. };
  724. },
  725. getWithinInfo: function( element ) {
  726. var withinElement = $( element || window ),
  727. isElemWindow = isWindow( withinElement[ 0 ] ),
  728. isDocument = !!withinElement[ 0 ] && withinElement[ 0 ].nodeType === 9,
  729. hasOffset = !isElemWindow && !isDocument;
  730. return {
  731. element: withinElement,
  732. isWindow: isElemWindow,
  733. isDocument: isDocument,
  734. offset: hasOffset ? $( element ).offset() : { left: 0, top: 0 },
  735. scrollLeft: withinElement.scrollLeft(),
  736. scrollTop: withinElement.scrollTop(),
  737. width: withinElement.outerWidth(),
  738. height: withinElement.outerHeight()
  739. };
  740. }
  741. };
  742. $.fn.position = function( options ) {
  743. if ( !options || !options.of ) {
  744. return _position.apply( this, arguments );
  745. }
  746. // Make a copy, we don't want to modify arguments
  747. options = $.extend( {}, options );
  748. var atOffset, targetWidth, targetHeight, targetOffset, basePosition, dimensions,
  749. // Make sure string options are treated as CSS selectors
  750. target = typeof options.of === "string" ?
  751. $( document ).find( options.of ) :
  752. $( options.of ),
  753. within = $.position.getWithinInfo( options.within ),
  754. scrollInfo = $.position.getScrollInfo( within ),
  755. collision = ( options.collision || "flip" ).split( " " ),
  756. offsets = {};
  757. dimensions = getDimensions( target );
  758. if ( target[ 0 ].preventDefault ) {
  759. // Force left top to allow flipping
  760. options.at = "left top";
  761. }
  762. targetWidth = dimensions.width;
  763. targetHeight = dimensions.height;
  764. targetOffset = dimensions.offset;
  765. // Clone to reuse original targetOffset later
  766. basePosition = $.extend( {}, targetOffset );
  767. // Force my and at to have valid horizontal and vertical positions
  768. // if a value is missing or invalid, it will be converted to center
  769. $.each( [ "my", "at" ], function() {
  770. var pos = ( options[ this ] || "" ).split( " " ),
  771. horizontalOffset,
  772. verticalOffset;
  773. if ( pos.length === 1 ) {
  774. pos = rhorizontal.test( pos[ 0 ] ) ?
  775. pos.concat( [ "center" ] ) :
  776. rvertical.test( pos[ 0 ] ) ?
  777. [ "center" ].concat( pos ) :
  778. [ "center", "center" ];
  779. }
  780. pos[ 0 ] = rhorizontal.test( pos[ 0 ] ) ? pos[ 0 ] : "center";
  781. pos[ 1 ] = rvertical.test( pos[ 1 ] ) ? pos[ 1 ] : "center";
  782. // Calculate offsets
  783. horizontalOffset = roffset.exec( pos[ 0 ] );
  784. verticalOffset = roffset.exec( pos[ 1 ] );
  785. offsets[ this ] = [
  786. horizontalOffset ? horizontalOffset[ 0 ] : 0,
  787. verticalOffset ? verticalOffset[ 0 ] : 0
  788. ];
  789. // Reduce to just the positions without the offsets
  790. options[ this ] = [
  791. rposition.exec( pos[ 0 ] )[ 0 ],
  792. rposition.exec( pos[ 1 ] )[ 0 ]
  793. ];
  794. } );
  795. // Normalize collision option
  796. if ( collision.length === 1 ) {
  797. collision[ 1 ] = collision[ 0 ];
  798. }
  799. if ( options.at[ 0 ] === "right" ) {
  800. basePosition.left += targetWidth;
  801. } else if ( options.at[ 0 ] === "center" ) {
  802. basePosition.left += targetWidth / 2;
  803. }
  804. if ( options.at[ 1 ] === "bottom" ) {
  805. basePosition.top += targetHeight;
  806. } else if ( options.at[ 1 ] === "center" ) {
  807. basePosition.top += targetHeight / 2;
  808. }
  809. atOffset = getOffsets( offsets.at, targetWidth, targetHeight );
  810. basePosition.left += atOffset[ 0 ];
  811. basePosition.top += atOffset[ 1 ];
  812. return this.each( function() {
  813. var collisionPosition, using,
  814. elem = $( this ),
  815. elemWidth = elem.outerWidth(),
  816. elemHeight = elem.outerHeight(),
  817. marginLeft = parseCss( this, "marginLeft" ),
  818. marginTop = parseCss( this, "marginTop" ),
  819. collisionWidth = elemWidth + marginLeft + parseCss( this, "marginRight" ) +
  820. scrollInfo.width,
  821. collisionHeight = elemHeight + marginTop + parseCss( this, "marginBottom" ) +
  822. scrollInfo.height,
  823. position = $.extend( {}, basePosition ),
  824. myOffset = getOffsets( offsets.my, elem.outerWidth(), elem.outerHeight() );
  825. if ( options.my[ 0 ] === "right" ) {
  826. position.left -= elemWidth;
  827. } else if ( options.my[ 0 ] === "center" ) {
  828. position.left -= elemWidth / 2;
  829. }
  830. if ( options.my[ 1 ] === "bottom" ) {
  831. position.top -= elemHeight;
  832. } else if ( options.my[ 1 ] === "center" ) {
  833. position.top -= elemHeight / 2;
  834. }
  835. position.left += myOffset[ 0 ];
  836. position.top += myOffset[ 1 ];
  837. collisionPosition = {
  838. marginLeft: marginLeft,
  839. marginTop: marginTop
  840. };
  841. $.each( [ "left", "top" ], function( i, dir ) {
  842. if ( $.ui.position[ collision[ i ] ] ) {
  843. $.ui.position[ collision[ i ] ][ dir ]( position, {
  844. targetWidth: targetWidth,
  845. targetHeight: targetHeight,
  846. elemWidth: elemWidth,
  847. elemHeight: elemHeight,
  848. collisionPosition: collisionPosition,
  849. collisionWidth: collisionWidth,
  850. collisionHeight: collisionHeight,
  851. offset: [ atOffset[ 0 ] + myOffset[ 0 ], atOffset [ 1 ] + myOffset[ 1 ] ],
  852. my: options.my,
  853. at: options.at,
  854. within: within,
  855. elem: elem
  856. } );
  857. }
  858. } );
  859. if ( options.using ) {
  860. // Adds feedback as second argument to using callback, if present
  861. using = function( props ) {
  862. var left = targetOffset.left - position.left,
  863. right = left + targetWidth - elemWidth,
  864. top = targetOffset.top - position.top,
  865. bottom = top + targetHeight - elemHeight,
  866. feedback = {
  867. target: {
  868. element: target,
  869. left: targetOffset.left,
  870. top: targetOffset.top,
  871. width: targetWidth,
  872. height: targetHeight
  873. },
  874. element: {
  875. element: elem,
  876. left: position.left,
  877. top: position.top,
  878. width: elemWidth,
  879. height: elemHeight
  880. },
  881. horizontal: right < 0 ? "left" : left > 0 ? "right" : "center",
  882. vertical: bottom < 0 ? "top" : top > 0 ? "bottom" : "middle"
  883. };
  884. if ( targetWidth < elemWidth && abs( left + right ) < targetWidth ) {
  885. feedback.horizontal = "center";
  886. }
  887. if ( targetHeight < elemHeight && abs( top + bottom ) < targetHeight ) {
  888. feedback.vertical = "middle";
  889. }
  890. if ( max( abs( left ), abs( right ) ) > max( abs( top ), abs( bottom ) ) ) {
  891. feedback.important = "horizontal";
  892. } else {
  893. feedback.important = "vertical";
  894. }
  895. options.using.call( this, props, feedback );
  896. };
  897. }
  898. elem.offset( $.extend( position, { using: using } ) );
  899. } );
  900. };
  901. $.ui.position = {
  902. fit: {
  903. left: function( position, data ) {
  904. var within = data.within,
  905. withinOffset = within.isWindow ? within.scrollLeft : within.offset.left,
  906. outerWidth = within.width,
  907. collisionPosLeft = position.left - data.collisionPosition.marginLeft,
  908. overLeft = withinOffset - collisionPosLeft,
  909. overRight = collisionPosLeft + data.collisionWidth - outerWidth - withinOffset,
  910. newOverRight;
  911. // Element is wider than within
  912. if ( data.collisionWidth > outerWidth ) {
  913. // Element is initially over the left side of within
  914. if ( overLeft > 0 && overRight <= 0 ) {
  915. newOverRight = position.left + overLeft + data.collisionWidth - outerWidth -
  916. withinOffset;
  917. position.left += overLeft - newOverRight;
  918. // Element is initially over right side of within
  919. } else if ( overRight > 0 && overLeft <= 0 ) {
  920. position.left = withinOffset;
  921. // Element is initially over both left and right sides of within
  922. } else {
  923. if ( overLeft > overRight ) {
  924. position.left = withinOffset + outerWidth - data.collisionWidth;
  925. } else {
  926. position.left = withinOffset;
  927. }
  928. }
  929. // Too far left -> align with left edge
  930. } else if ( overLeft > 0 ) {
  931. position.left += overLeft;
  932. // Too far right -> align with right edge
  933. } else if ( overRight > 0 ) {
  934. position.left -= overRight;
  935. // Adjust based on position and margin
  936. } else {
  937. position.left = max( position.left - collisionPosLeft, position.left );
  938. }
  939. },
  940. top: function( position, data ) {
  941. var within = data.within,
  942. withinOffset = within.isWindow ? within.scrollTop : within.offset.top,
  943. outerHeight = data.within.height,
  944. collisionPosTop = position.top - data.collisionPosition.marginTop,
  945. overTop = withinOffset - collisionPosTop,
  946. overBottom = collisionPosTop + data.collisionHeight - outerHeight - withinOffset,
  947. newOverBottom;
  948. // Element is taller than within
  949. if ( data.collisionHeight > outerHeight ) {
  950. // Element is initially over the top of within
  951. if ( overTop > 0 && overBottom <= 0 ) {
  952. newOverBottom = position.top + overTop + data.collisionHeight - outerHeight -
  953. withinOffset;
  954. position.top += overTop - newOverBottom;
  955. // Element is initially over bottom of within
  956. } else if ( overBottom > 0 && overTop <= 0 ) {
  957. position.top = withinOffset;
  958. // Element is initially over both top and bottom of within
  959. } else {
  960. if ( overTop > overBottom ) {
  961. position.top = withinOffset + outerHeight - data.collisionHeight;
  962. } else {
  963. position.top = withinOffset;
  964. }
  965. }
  966. // Too far up -> align with top
  967. } else if ( overTop > 0 ) {
  968. position.top += overTop;
  969. // Too far down -> align with bottom edge
  970. } else if ( overBottom > 0 ) {
  971. position.top -= overBottom;
  972. // Adjust based on position and margin
  973. } else {
  974. position.top = max( position.top - collisionPosTop, position.top );
  975. }
  976. }
  977. },
  978. flip: {
  979. left: function( position, data ) {
  980. var within = data.within,
  981. withinOffset = within.offset.left + within.scrollLeft,
  982. outerWidth = within.width,
  983. offsetLeft = within.isWindow ? within.scrollLeft : within.offset.left,
  984. collisionPosLeft = position.left - data.collisionPosition.marginLeft,
  985. overLeft = collisionPosLeft - offsetLeft,
  986. overRight = collisionPosLeft + data.collisionWidth - outerWidth - offsetLeft,
  987. myOffset = data.my[ 0 ] === "left" ?
  988. -data.elemWidth :
  989. data.my[ 0 ] === "right" ?
  990. data.elemWidth :
  991. 0,
  992. atOffset = data.at[ 0 ] === "left" ?
  993. data.targetWidth :
  994. data.at[ 0 ] === "right" ?
  995. -data.targetWidth :
  996. 0,
  997. offset = -2 * data.offset[ 0 ],
  998. newOverRight,
  999. newOverLeft;
  1000. if ( overLeft < 0 ) {
  1001. newOverRight = position.left + myOffset + atOffset + offset + data.collisionWidth -
  1002. outerWidth - withinOffset;
  1003. if ( newOverRight < 0 || newOverRight < abs( overLeft ) ) {
  1004. position.left += myOffset + atOffset + offset;
  1005. }
  1006. } else if ( overRight > 0 ) {
  1007. newOverLeft = position.left - data.collisionPosition.marginLeft + myOffset +
  1008. atOffset + offset - offsetLeft;
  1009. if ( newOverLeft > 0 || abs( newOverLeft ) < overRight ) {
  1010. position.left += myOffset + atOffset + offset;
  1011. }
  1012. }
  1013. },
  1014. top: function( position, data ) {
  1015. var within = data.within,
  1016. withinOffset = within.offset.top + within.scrollTop,
  1017. outerHeight = within.height,
  1018. offsetTop = within.isWindow ? within.scrollTop : within.offset.top,
  1019. collisionPosTop = position.top - data.collisionPosition.marginTop,
  1020. overTop = collisionPosTop - offsetTop,
  1021. overBottom = collisionPosTop + data.collisionHeight - outerHeight - offsetTop,
  1022. top = data.my[ 1 ] === "top",
  1023. myOffset = top ?
  1024. -data.elemHeight :
  1025. data.my[ 1 ] === "bottom" ?
  1026. data.elemHeight :
  1027. 0,
  1028. atOffset = data.at[ 1 ] === "top" ?
  1029. data.targetHeight :
  1030. data.at[ 1 ] === "bottom" ?
  1031. -data.targetHeight :
  1032. 0,
  1033. offset = -2 * data.offset[ 1 ],
  1034. newOverTop,
  1035. newOverBottom;
  1036. if ( overTop < 0 ) {
  1037. newOverBottom = position.top + myOffset + atOffset + offset + data.collisionHeight -
  1038. outerHeight - withinOffset;
  1039. if ( newOverBottom < 0 || newOverBottom < abs( overTop ) ) {
  1040. position.top += myOffset + atOffset + offset;
  1041. }
  1042. } else if ( overBottom > 0 ) {
  1043. newOverTop = position.top - data.collisionPosition.marginTop + myOffset + atOffset +
  1044. offset - offsetTop;
  1045. if ( newOverTop > 0 || abs( newOverTop ) < overBottom ) {
  1046. position.top += myOffset + atOffset + offset;
  1047. }
  1048. }
  1049. }
  1050. },
  1051. flipfit: {
  1052. left: function() {
  1053. $.ui.position.flip.left.apply( this, arguments );
  1054. $.ui.position.fit.left.apply( this, arguments );
  1055. },
  1056. top: function() {
  1057. $.ui.position.flip.top.apply( this, arguments );
  1058. $.ui.position.fit.top.apply( this, arguments );
  1059. }
  1060. }
  1061. };
  1062. } )();
  1063. var position = $.ui.position;
  1064. /*!
  1065. * jQuery UI :data 1.13.0
  1066. * http://jqueryui.com
  1067. *
  1068. * Copyright jQuery Foundation and other contributors
  1069. * Released under the MIT license.
  1070. * http://jquery.org/license
  1071. */
  1072. //>>label: :data Selector
  1073. //>>group: Core
  1074. //>>description: Selects elements which have data stored under the specified key.
  1075. //>>docs: http://api.jqueryui.com/data-selector/
  1076. var data = $.extend( $.expr.pseudos, {
  1077. data: $.expr.createPseudo ?
  1078. $.expr.createPseudo( function( dataName ) {
  1079. return function( elem ) {
  1080. return !!$.data( elem, dataName );
  1081. };
  1082. } ) :
  1083. // Support: jQuery <1.8
  1084. function( elem, i, match ) {
  1085. return !!$.data( elem, match[ 3 ] );
  1086. }
  1087. } );
  1088. /*!
  1089. * jQuery UI Disable Selection 1.13.0
  1090. * http://jqueryui.com
  1091. *
  1092. * Copyright jQuery Foundation and other contributors
  1093. * Released under the MIT license.
  1094. * http://jquery.org/license
  1095. */
  1096. //>>label: disableSelection
  1097. //>>group: Core
  1098. //>>description: Disable selection of text content within the set of matched elements.
  1099. //>>docs: http://api.jqueryui.com/disableSelection/
  1100. // This file is deprecated
  1101. var disableSelection = $.fn.extend( {
  1102. disableSelection: ( function() {
  1103. var eventType = "onselectstart" in document.createElement( "div" ) ?
  1104. "selectstart" :
  1105. "mousedown";
  1106. return function() {
  1107. return this.on( eventType + ".ui-disableSelection", function( event ) {
  1108. event.preventDefault();
  1109. } );
  1110. };
  1111. } )(),
  1112. enableSelection: function() {
  1113. return this.off( ".ui-disableSelection" );
  1114. }
  1115. } );
  1116. // Create a local jQuery because jQuery Color relies on it and the
  1117. // global may not exist with AMD and a custom build (#10199).
  1118. // This module is a noop if used as a regular AMD module.
  1119. // eslint-disable-next-line no-unused-vars
  1120. var jQuery = $;
  1121. /*!
  1122. * jQuery Color Animations v2.2.0
  1123. * https://github.com/jquery/jquery-color
  1124. *
  1125. * Copyright OpenJS Foundation and other contributors
  1126. * Released under the MIT license.
  1127. * http://jquery.org/license
  1128. *
  1129. * Date: Sun May 10 09:02:36 2020 +0200
  1130. */
  1131. var stepHooks = "backgroundColor borderBottomColor borderLeftColor borderRightColor " +
  1132. "borderTopColor color columnRuleColor outlineColor textDecorationColor textEmphasisColor",
  1133. class2type = {},
  1134. toString = class2type.toString,
  1135. // plusequals test for += 100 -= 100
  1136. rplusequals = /^([\-+])=\s*(\d+\.?\d*)/,
  1137. // a set of RE's that can match strings and generate color tuples.
  1138. stringParsers = [ {
  1139. re: /rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,
  1140. parse: function( execResult ) {
  1141. return [
  1142. execResult[ 1 ],
  1143. execResult[ 2 ],
  1144. execResult[ 3 ],
  1145. execResult[ 4 ]
  1146. ];
  1147. }
  1148. }, {
  1149. re: /rgba?\(\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,
  1150. parse: function( execResult ) {
  1151. return [
  1152. execResult[ 1 ] * 2.55,
  1153. execResult[ 2 ] * 2.55,
  1154. execResult[ 3 ] * 2.55,
  1155. execResult[ 4 ]
  1156. ];
  1157. }
  1158. }, {
  1159. // this regex ignores A-F because it's compared against an already lowercased string
  1160. re: /#([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})?/,
  1161. parse: function( execResult ) {
  1162. return [
  1163. parseInt( execResult[ 1 ], 16 ),
  1164. parseInt( execResult[ 2 ], 16 ),
  1165. parseInt( execResult[ 3 ], 16 ),
  1166. execResult[ 4 ] ?
  1167. ( parseInt( execResult[ 4 ], 16 ) / 255 ).toFixed( 2 ) :
  1168. 1
  1169. ];
  1170. }
  1171. }, {
  1172. // this regex ignores A-F because it's compared against an already lowercased string
  1173. re: /#([a-f0-9])([a-f0-9])([a-f0-9])([a-f0-9])?/,
  1174. parse: function( execResult ) {
  1175. return [
  1176. parseInt( execResult[ 1 ] + execResult[ 1 ], 16 ),
  1177. parseInt( execResult[ 2 ] + execResult[ 2 ], 16 ),
  1178. parseInt( execResult[ 3 ] + execResult[ 3 ], 16 ),
  1179. execResult[ 4 ] ?
  1180. ( parseInt( execResult[ 4 ] + execResult[ 4 ], 16 ) / 255 )
  1181. .toFixed( 2 ) :
  1182. 1
  1183. ];
  1184. }
  1185. }, {
  1186. re: /hsla?\(\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,
  1187. space: "hsla",
  1188. parse: function( execResult ) {
  1189. return [
  1190. execResult[ 1 ],
  1191. execResult[ 2 ] / 100,
  1192. execResult[ 3 ] / 100,
  1193. execResult[ 4 ]
  1194. ];
  1195. }
  1196. } ],
  1197. // jQuery.Color( )
  1198. color = jQuery.Color = function( color, green, blue, alpha ) {
  1199. return new jQuery.Color.fn.parse( color, green, blue, alpha );
  1200. },
  1201. spaces = {
  1202. rgba: {
  1203. props: {
  1204. red: {
  1205. idx: 0,
  1206. type: "byte"
  1207. },
  1208. green: {
  1209. idx: 1,
  1210. type: "byte"
  1211. },
  1212. blue: {
  1213. idx: 2,
  1214. type: "byte"
  1215. }
  1216. }
  1217. },
  1218. hsla: {
  1219. props: {
  1220. hue: {
  1221. idx: 0,
  1222. type: "degrees"
  1223. },
  1224. saturation: {
  1225. idx: 1,
  1226. type: "percent"
  1227. },
  1228. lightness: {
  1229. idx: 2,
  1230. type: "percent"
  1231. }
  1232. }
  1233. }
  1234. },
  1235. propTypes = {
  1236. "byte": {
  1237. floor: true,
  1238. max: 255
  1239. },
  1240. "percent": {
  1241. max: 1
  1242. },
  1243. "degrees": {
  1244. mod: 360,
  1245. floor: true
  1246. }
  1247. },
  1248. support = color.support = {},
  1249. // element for support tests
  1250. supportElem = jQuery( "<p>" )[ 0 ],
  1251. // colors = jQuery.Color.names
  1252. colors,
  1253. // local aliases of functions called often
  1254. each = jQuery.each;
  1255. // determine rgba support immediately
  1256. supportElem.style.cssText = "background-color:rgba(1,1,1,.5)";
  1257. support.rgba = supportElem.style.backgroundColor.indexOf( "rgba" ) > -1;
  1258. // define cache name and alpha properties
  1259. // for rgba and hsla spaces
  1260. each( spaces, function( spaceName, space ) {
  1261. space.cache = "_" + spaceName;
  1262. space.props.alpha = {
  1263. idx: 3,
  1264. type: "percent",
  1265. def: 1
  1266. };
  1267. } );
  1268. // Populate the class2type map
  1269. jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ),
  1270. function( _i, name ) {
  1271. class2type[ "[object " + name + "]" ] = name.toLowerCase();
  1272. } );
  1273. function getType( obj ) {
  1274. if ( obj == null ) {
  1275. return obj + "";
  1276. }
  1277. return typeof obj === "object" ?
  1278. class2type[ toString.call( obj ) ] || "object" :
  1279. typeof obj;
  1280. }
  1281. function clamp( value, prop, allowEmpty ) {
  1282. var type = propTypes[ prop.type ] || {};
  1283. if ( value == null ) {
  1284. return ( allowEmpty || !prop.def ) ? null : prop.def;
  1285. }
  1286. // ~~ is an short way of doing floor for positive numbers
  1287. value = type.floor ? ~~value : parseFloat( value );
  1288. // IE will pass in empty strings as value for alpha,
  1289. // which will hit this case
  1290. if ( isNaN( value ) ) {
  1291. return prop.def;
  1292. }
  1293. if ( type.mod ) {
  1294. // we add mod before modding to make sure that negatives values
  1295. // get converted properly: -10 -> 350
  1296. return ( value + type.mod ) % type.mod;
  1297. }
  1298. // for now all property types without mod have min and max
  1299. return Math.min( type.max, Math.max( 0, value ) );
  1300. }
  1301. function stringParse( string ) {
  1302. var inst = color(),
  1303. rgba = inst._rgba = [];
  1304. string = string.toLowerCase();
  1305. each( stringParsers, function( _i, parser ) {
  1306. var parsed,
  1307. match = parser.re.exec( string ),
  1308. values = match && parser.parse( match ),
  1309. spaceName = parser.space || "rgba";
  1310. if ( values ) {
  1311. parsed = inst[ spaceName ]( values );
  1312. // if this was an rgba parse the assignment might happen twice
  1313. // oh well....
  1314. inst[ spaces[ spaceName ].cache ] = parsed[ spaces[ spaceName ].cache ];
  1315. rgba = inst._rgba = parsed._rgba;
  1316. // exit each( stringParsers ) here because we matched
  1317. return false;
  1318. }
  1319. } );
  1320. // Found a stringParser that handled it
  1321. if ( rgba.length ) {
  1322. // if this came from a parsed string, force "transparent" when alpha is 0
  1323. // chrome, (and maybe others) return "transparent" as rgba(0,0,0,0)
  1324. if ( rgba.join() === "0,0,0,0" ) {
  1325. jQuery.extend( rgba, colors.transparent );
  1326. }
  1327. return inst;
  1328. }
  1329. // named colors
  1330. return colors[ string ];
  1331. }
  1332. color.fn = jQuery.extend( color.prototype, {
  1333. parse: function( red, green, blue, alpha ) {
  1334. if ( red === undefined ) {
  1335. this._rgba = [ null, null, null, null ];
  1336. return this;
  1337. }
  1338. if ( red.jquery || red.nodeType ) {
  1339. red = jQuery( red ).css( green );
  1340. green = undefined;
  1341. }
  1342. var inst = this,
  1343. type = getType( red ),
  1344. rgba = this._rgba = [];
  1345. // more than 1 argument specified - assume ( red, green, blue, alpha )
  1346. if ( green !== undefined ) {
  1347. red = [ red, green, blue, alpha ];
  1348. type = "array";
  1349. }
  1350. if ( type === "string" ) {
  1351. return this.parse( stringParse( red ) || colors._default );
  1352. }
  1353. if ( type === "array" ) {
  1354. each( spaces.rgba.props, function( _key, prop ) {
  1355. rgba[ prop.idx ] = clamp( red[ prop.idx ], prop );
  1356. } );
  1357. return this;
  1358. }
  1359. if ( type === "object" ) {
  1360. if ( red instanceof color ) {
  1361. each( spaces, function( _spaceName, space ) {
  1362. if ( red[ space.cache ] ) {
  1363. inst[ space.cache ] = red[ space.cache ].slice();
  1364. }
  1365. } );
  1366. } else {
  1367. each( spaces, function( _spaceName, space ) {
  1368. var cache = space.cache;
  1369. each( space.props, function( key, prop ) {
  1370. // if the cache doesn't exist, and we know how to convert
  1371. if ( !inst[ cache ] && space.to ) {
  1372. // if the value was null, we don't need to copy it
  1373. // if the key was alpha, we don't need to copy it either
  1374. if ( key === "alpha" || red[ key ] == null ) {
  1375. return;
  1376. }
  1377. inst[ cache ] = space.to( inst._rgba );
  1378. }
  1379. // this is the only case where we allow nulls for ALL properties.
  1380. // call clamp with alwaysAllowEmpty
  1381. inst[ cache ][ prop.idx ] = clamp( red[ key ], prop, true );
  1382. } );
  1383. // everything defined but alpha?
  1384. if ( inst[ cache ] && jQuery.inArray( null, inst[ cache ].slice( 0, 3 ) ) < 0 ) {
  1385. // use the default of 1
  1386. if ( inst[ cache ][ 3 ] == null ) {
  1387. inst[ cache ][ 3 ] = 1;
  1388. }
  1389. if ( space.from ) {
  1390. inst._rgba = space.from( inst[ cache ] );
  1391. }
  1392. }
  1393. } );
  1394. }
  1395. return this;
  1396. }
  1397. },
  1398. is: function( compare ) {
  1399. var is = color( compare ),
  1400. same = true,
  1401. inst = this;
  1402. each( spaces, function( _, space ) {
  1403. var localCache,
  1404. isCache = is[ space.cache ];
  1405. if ( isCache ) {
  1406. localCache = inst[ space.cache ] || space.to && space.to( inst._rgba ) || [];
  1407. each( space.props, function( _, prop ) {
  1408. if ( isCache[ prop.idx ] != null ) {
  1409. same = ( isCache[ prop.idx ] === localCache[ prop.idx ] );
  1410. return same;
  1411. }
  1412. } );
  1413. }
  1414. return same;
  1415. } );
  1416. return same;
  1417. },
  1418. _space: function() {
  1419. var used = [],
  1420. inst = this;
  1421. each( spaces, function( spaceName, space ) {
  1422. if ( inst[ space.cache ] ) {
  1423. used.push( spaceName );
  1424. }
  1425. } );
  1426. return used.pop();
  1427. },
  1428. transition: function( other, distance ) {
  1429. var end = color( other ),
  1430. spaceName = end._space(),
  1431. space = spaces[ spaceName ],
  1432. startColor = this.alpha() === 0 ? color( "transparent" ) : this,
  1433. start = startColor[ space.cache ] || space.to( startColor._rgba ),
  1434. result = start.slice();
  1435. end = end[ space.cache ];
  1436. each( space.props, function( _key, prop ) {
  1437. var index = prop.idx,
  1438. startValue = start[ index ],
  1439. endValue = end[ index ],
  1440. type = propTypes[ prop.type ] || {};
  1441. // if null, don't override start value
  1442. if ( endValue === null ) {
  1443. return;
  1444. }
  1445. // if null - use end
  1446. if ( startValue === null ) {
  1447. result[ index ] = endValue;
  1448. } else {
  1449. if ( type.mod ) {
  1450. if ( endValue - startValue > type.mod / 2 ) {
  1451. startValue += type.mod;
  1452. } else if ( startValue - endValue > type.mod / 2 ) {
  1453. startValue -= type.mod;
  1454. }
  1455. }
  1456. result[ index ] = clamp( ( endValue - startValue ) * distance + startValue, prop );
  1457. }
  1458. } );
  1459. return this[ spaceName ]( result );
  1460. },
  1461. blend: function( opaque ) {
  1462. // if we are already opaque - return ourself
  1463. if ( this._rgba[ 3 ] === 1 ) {
  1464. return this;
  1465. }
  1466. var rgb = this._rgba.slice(),
  1467. a = rgb.pop(),
  1468. blend = color( opaque )._rgba;
  1469. return color( jQuery.map( rgb, function( v, i ) {
  1470. return ( 1 - a ) * blend[ i ] + a * v;
  1471. } ) );
  1472. },
  1473. toRgbaString: function() {
  1474. var prefix = "rgba(",
  1475. rgba = jQuery.map( this._rgba, function( v, i ) {
  1476. if ( v != null ) {
  1477. return v;
  1478. }
  1479. return i > 2 ? 1 : 0;
  1480. } );
  1481. if ( rgba[ 3 ] === 1 ) {
  1482. rgba.pop();
  1483. prefix = "rgb(";
  1484. }
  1485. return prefix + rgba.join() + ")";
  1486. },
  1487. toHslaString: function() {
  1488. var prefix = "hsla(",
  1489. hsla = jQuery.map( this.hsla(), function( v, i ) {
  1490. if ( v == null ) {
  1491. v = i > 2 ? 1 : 0;
  1492. }
  1493. // catch 1 and 2
  1494. if ( i && i < 3 ) {
  1495. v = Math.round( v * 100 ) + "%";
  1496. }
  1497. return v;
  1498. } );
  1499. if ( hsla[ 3 ] === 1 ) {
  1500. hsla.pop();
  1501. prefix = "hsl(";
  1502. }
  1503. return prefix + hsla.join() + ")";
  1504. },
  1505. toHexString: function( includeAlpha ) {
  1506. var rgba = this._rgba.slice(),
  1507. alpha = rgba.pop();
  1508. if ( includeAlpha ) {
  1509. rgba.push( ~~( alpha * 255 ) );
  1510. }
  1511. return "#" + jQuery.map( rgba, function( v ) {
  1512. // default to 0 when nulls exist
  1513. v = ( v || 0 ).toString( 16 );
  1514. return v.length === 1 ? "0" + v : v;
  1515. } ).join( "" );
  1516. },
  1517. toString: function() {
  1518. return this._rgba[ 3 ] === 0 ? "transparent" : this.toRgbaString();
  1519. }
  1520. } );
  1521. color.fn.parse.prototype = color.fn;
  1522. // hsla conversions adapted from:
  1523. // https://code.google.com/p/maashaack/source/browse/packages/graphics/trunk/src/graphics/colors/HUE2RGB.as?r=5021
  1524. function hue2rgb( p, q, h ) {
  1525. h = ( h + 1 ) % 1;
  1526. if ( h * 6 < 1 ) {
  1527. return p + ( q - p ) * h * 6;
  1528. }
  1529. if ( h * 2 < 1 ) {
  1530. return q;
  1531. }
  1532. if ( h * 3 < 2 ) {
  1533. return p + ( q - p ) * ( ( 2 / 3 ) - h ) * 6;
  1534. }
  1535. return p;
  1536. }
  1537. spaces.hsla.to = function( rgba ) {
  1538. if ( rgba[ 0 ] == null || rgba[ 1 ] == null || rgba[ 2 ] == null ) {
  1539. return [ null, null, null, rgba[ 3 ] ];
  1540. }
  1541. var r = rgba[ 0 ] / 255,
  1542. g = rgba[ 1 ] / 255,
  1543. b = rgba[ 2 ] / 255,
  1544. a = rgba[ 3 ],
  1545. max = Math.max( r, g, b ),
  1546. min = Math.min( r, g, b ),
  1547. diff = max - min,
  1548. add = max + min,
  1549. l = add * 0.5,
  1550. h, s;
  1551. if ( min === max ) {
  1552. h = 0;
  1553. } else if ( r === max ) {
  1554. h = ( 60 * ( g - b ) / diff ) + 360;
  1555. } else if ( g === max ) {
  1556. h = ( 60 * ( b - r ) / diff ) + 120;
  1557. } else {
  1558. h = ( 60 * ( r - g ) / diff ) + 240;
  1559. }
  1560. // chroma (diff) == 0 means greyscale which, by definition, saturation = 0%
  1561. // otherwise, saturation is based on the ratio of chroma (diff) to lightness (add)
  1562. if ( diff === 0 ) {
  1563. s = 0;
  1564. } else if ( l <= 0.5 ) {
  1565. s = diff / add;
  1566. } else {
  1567. s = diff / ( 2 - add );
  1568. }
  1569. return [ Math.round( h ) % 360, s, l, a == null ? 1 : a ];
  1570. };
  1571. spaces.hsla.from = function( hsla ) {
  1572. if ( hsla[ 0 ] == null || hsla[ 1 ] == null || hsla[ 2 ] == null ) {
  1573. return [ null, null, null, hsla[ 3 ] ];
  1574. }
  1575. var h = hsla[ 0 ] / 360,
  1576. s = hsla[ 1 ],
  1577. l = hsla[ 2 ],
  1578. a = hsla[ 3 ],
  1579. q = l <= 0.5 ? l * ( 1 + s ) : l + s - l * s,
  1580. p = 2 * l - q;
  1581. return [
  1582. Math.round( hue2rgb( p, q, h + ( 1 / 3 ) ) * 255 ),
  1583. Math.round( hue2rgb( p, q, h ) * 255 ),
  1584. Math.round( hue2rgb( p, q, h - ( 1 / 3 ) ) * 255 ),
  1585. a
  1586. ];
  1587. };
  1588. each( spaces, function( spaceName, space ) {
  1589. var props = space.props,
  1590. cache = space.cache,
  1591. to = space.to,
  1592. from = space.from;
  1593. // makes rgba() and hsla()
  1594. color.fn[ spaceName ] = function( value ) {
  1595. // generate a cache for this space if it doesn't exist
  1596. if ( to && !this[ cache ] ) {
  1597. this[ cache ] = to( this._rgba );
  1598. }
  1599. if ( value === undefined ) {
  1600. return this[ cache ].slice();
  1601. }
  1602. var ret,
  1603. type = getType( value ),
  1604. arr = ( type === "array" || type === "object" ) ? value : arguments,
  1605. local = this[ cache ].slice();
  1606. each( props, function( key, prop ) {
  1607. var val = arr[ type === "object" ? key : prop.idx ];
  1608. if ( val == null ) {
  1609. val = local[ prop.idx ];
  1610. }
  1611. local[ prop.idx ] = clamp( val, prop );
  1612. } );
  1613. if ( from ) {
  1614. ret = color( from( local ) );
  1615. ret[ cache ] = local;
  1616. return ret;
  1617. } else {
  1618. return color( local );
  1619. }
  1620. };
  1621. // makes red() green() blue() alpha() hue() saturation() lightness()
  1622. each( props, function( key, prop ) {
  1623. // alpha is included in more than one space
  1624. if ( color.fn[ key ] ) {
  1625. return;
  1626. }
  1627. color.fn[ key ] = function( value ) {
  1628. var local, cur, match, fn,
  1629. vtype = getType( value );
  1630. if ( key === "alpha" ) {
  1631. fn = this._hsla ? "hsla" : "rgba";
  1632. } else {
  1633. fn = spaceName;
  1634. }
  1635. local = this[ fn ]();
  1636. cur = local[ prop.idx ];
  1637. if ( vtype === "undefined" ) {
  1638. return cur;
  1639. }
  1640. if ( vtype === "function" ) {
  1641. value = value.call( this, cur );
  1642. vtype = getType( value );
  1643. }
  1644. if ( value == null && prop.empty ) {
  1645. return this;
  1646. }
  1647. if ( vtype === "string" ) {
  1648. match = rplusequals.exec( value );
  1649. if ( match ) {
  1650. value = cur + parseFloat( match[ 2 ] ) * ( match[ 1 ] === "+" ? 1 : -1 );
  1651. }
  1652. }
  1653. local[ prop.idx ] = value;
  1654. return this[ fn ]( local );
  1655. };
  1656. } );
  1657. } );
  1658. // add cssHook and .fx.step function for each named hook.
  1659. // accept a space separated string of properties
  1660. color.hook = function( hook ) {
  1661. var hooks = hook.split( " " );
  1662. each( hooks, function( _i, hook ) {
  1663. jQuery.cssHooks[ hook ] = {
  1664. set: function( elem, value ) {
  1665. var parsed, curElem,
  1666. backgroundColor = "";
  1667. if ( value !== "transparent" && ( getType( value ) !== "string" || ( parsed = stringParse( value ) ) ) ) {
  1668. value = color( parsed || value );
  1669. if ( !support.rgba && value._rgba[ 3 ] !== 1 ) {
  1670. curElem = hook === "backgroundColor" ? elem.parentNode : elem;
  1671. while (
  1672. ( backgroundColor === "" || backgroundColor === "transparent" ) &&
  1673. curElem && curElem.style
  1674. ) {
  1675. try {
  1676. backgroundColor = jQuery.css( curElem, "backgroundColor" );
  1677. curElem = curElem.parentNode;
  1678. } catch ( e ) {
  1679. }
  1680. }
  1681. value = value.blend( backgroundColor && backgroundColor !== "transparent" ?
  1682. backgroundColor :
  1683. "_default" );
  1684. }
  1685. value = value.toRgbaString();
  1686. }
  1687. try {
  1688. elem.style[ hook ] = value;
  1689. } catch ( e ) {
  1690. // wrapped to prevent IE from throwing errors on "invalid" values like 'auto' or 'inherit'
  1691. }
  1692. }
  1693. };
  1694. jQuery.fx.step[ hook ] = function( fx ) {
  1695. if ( !fx.colorInit ) {
  1696. fx.start = color( fx.elem, hook );
  1697. fx.end = color( fx.end );
  1698. fx.colorInit = true;
  1699. }
  1700. jQuery.cssHooks[ hook ].set( fx.elem, fx.start.transition( fx.end, fx.pos ) );
  1701. };
  1702. } );
  1703. };
  1704. color.hook( stepHooks );
  1705. jQuery.cssHooks.borderColor = {
  1706. expand: function( value ) {
  1707. var expanded = {};
  1708. each( [ "Top", "Right", "Bottom", "Left" ], function( _i, part ) {
  1709. expanded[ "border" + part + "Color" ] = value;
  1710. } );
  1711. return expanded;
  1712. }
  1713. };
  1714. // Basic color names only.
  1715. // Usage of any of the other color names requires adding yourself or including
  1716. // jquery.color.svg-names.js.
  1717. colors = jQuery.Color.names = {
  1718. // 4.1. Basic color keywords
  1719. aqua: "#00ffff",
  1720. black: "#000000",
  1721. blue: "#0000ff",
  1722. fuchsia: "#ff00ff",
  1723. gray: "#808080",
  1724. green: "#008000",
  1725. lime: "#00ff00",
  1726. maroon: "#800000",
  1727. navy: "#000080",
  1728. olive: "#808000",
  1729. purple: "#800080",
  1730. red: "#ff0000",
  1731. silver: "#c0c0c0",
  1732. teal: "#008080",
  1733. white: "#ffffff",
  1734. yellow: "#ffff00",
  1735. // 4.2.3. "transparent" color keyword
  1736. transparent: [ null, null, null, 0 ],
  1737. _default: "#ffffff"
  1738. };
  1739. /*!
  1740. * jQuery UI Effects 1.13.0
  1741. * http://jqueryui.com
  1742. *
  1743. * Copyright jQuery Foundation and other contributors
  1744. * Released under the MIT license.
  1745. * ht