/*!
* jQuery Migrate - v3.4.1 - 2023-02-23T15:31Z
* Copyright OpenJS Foundation and other contributors
*/
( function( factory ) {
"use strict";
if ( typeof define === "function" && define.amd ) {
// AMD. Register as an anonymous module.
define( [ "jquery" ], function( jQuery ) {
return factory( jQuery, window );
} );
} else if ( typeof module === "object" && module.exports ) {
// Node/CommonJS
// eslint-disable-next-line no-undef
module.exports = factory( require( "jquery" ), window );
} else {
// Browser globals
factory( jQuery, window );
}
} )( function( jQuery, window ) {
"use strict";
jQuery.migrateVersion = "3.4.1";
// Returns 0 if v1 == v2, -1 if v1 < v2, 1 if v1 > v2
function compareVersions( v1, v2 ) {
var i,
rVersionParts = /^(\d+)\.(\d+)\.(\d+)/,
v1p = rVersionParts.exec( v1 ) || [ ],
v2p = rVersionParts.exec( v2 ) || [ ];
for ( i = 1; i <= 3; i++ ) {
if ( +v1p[ i ] > +v2p[ i ] ) {
return 1;
}
if ( +v1p[ i ] < +v2p[ i ] ) {
return -1;
}
}
return 0;
}
function jQueryVersionSince( version ) {
return compareVersions( jQuery.fn.jquery, version ) >= 0;
}
// A map from disabled patch codes to `true`. This should really
// be a `Set` but those are unsupported in IE.
var disabledPatches = Object.create( null );
// Don't apply patches for specified codes. Helpful for code bases
// where some Migrate warnings have been addressed and it's desirable
// to avoid needless patches or false positives.
jQuery.migrateDisablePatches = function() {
var i;
for ( i = 0; i < arguments.length; i++ ) {
disabledPatches[ arguments[ i ] ] = true;
}
};
// Allow enabling patches disabled via `jQuery.migrateDisablePatches`.
// Helpful if you want to disable a patch only for some code that won't
// be updated soon to be able to focus on other warnings - and enable it
// immediately after such a call:
// ```js
// jQuery.migrateDisablePatches( "workaroundA" );
// elem.pluginViolatingWarningA( "pluginMethod" );
// jQuery.migrateEnablePatches( "workaroundA" );
// ```
jQuery.migrateEnablePatches = function() {
var i;
for ( i = 0; i < arguments.length; i++ ) {
delete disabledPatches[ arguments[ i ] ];
}
};
jQuery.migrateIsPatchEnabled = function( patchCode ) {
return !disabledPatches[ patchCode ];
};
( function() {
// Support: IE9 only
// IE9 only creates console object when dev tools are first opened
// IE9 console is a host object, callable but doesn't have .apply()
if ( !window.console || !window.console.log ) {
return;
}
// Need jQuery 3.x-4.x and no older Migrate loaded
if ( !jQuery || !jQueryVersionSince( "3.0.0" ) ||
jQueryVersionSince( "5.0.0" ) ) {
window.console.log( "JQMIGRATE: jQuery 3.x-4.x REQUIRED" );
}
if ( jQuery.migrateWarnings ) {
window.console.log( "JQMIGRATE: Migrate plugin loaded multiple times" );
}
// Show a message on the console so devs know we're active
window.console.log( "JQMIGRATE: Migrate is installed" +
( jQuery.migrateMute ? "" : " with logging active" ) +
", version " + jQuery.migrateVersion );
} )();
var warnedAbout = {};
// By default each warning is only reported once.
jQuery.migrateDeduplicateWarnings = true;
// List of warnings already given; public read only
jQuery.migrateWarnings = [];
// Set to false to disable traces that appear with warnings
if ( jQuery.migrateTrace === undefined ) {
jQuery.migrateTrace = true;
}
// Forget any warnings we've already given; public
jQuery.migrateReset = function() {
warnedAbout = {};
jQuery.migrateWarnings.length = 0;
};
function migrateWarn( code, msg ) {
var console = window.console;
if ( jQuery.migrateIsPatchEnabled( code ) &&
( !jQuery.migrateDeduplicateWarnings || !warnedAbout[ msg ] ) ) {
warnedAbout[ msg ] = true;
jQuery.migrateWarnings.push( msg + " [" + code + "]" );
if ( console && console.warn && !jQuery.migrateMute ) {
console.warn( "JQMIGRATE: " + msg );
if ( jQuery.migrateTrace && console.trace ) {
console.trace();
}
}
}
}
function migrateWarnProp( obj, prop, value, code, msg ) {
Object.defineProperty( obj, prop, {
configurable: true,
enumerable: true,
get: function() {
migrateWarn( code, msg );
return value;
},
set: function( newValue ) {
migrateWarn( code, msg );
value = newValue;
}
} );
}
function migrateWarnFuncInternal( obj, prop, newFunc, code, msg ) {
var finalFunc,
origFunc = obj[ prop ];
obj[ prop ] = function() {
// If `msg` not provided, do not warn; more sophisticated warnings
// logic is most likely embedded in `newFunc`, in that case here
// we just care about the logic choosing the proper implementation
// based on whether the patch is disabled or not.
if ( msg ) {
migrateWarn( code, msg );
}
// Since patches can be disabled & enabled dynamically, we
// need to decide which implementation to run on each invocation.
finalFunc = jQuery.migrateIsPatchEnabled( code ) ?
newFunc :
// The function may not have existed originally so we need a fallback.
( origFunc || jQuery.noop );
return finalFunc.apply( this, arguments );
};
}
function migratePatchAndWarnFunc( obj, prop, newFunc, code, msg ) {
if ( !msg ) {
throw new Error( "No warning message provided" );
}
return migrateWarnFuncInternal( obj, prop, newFunc, code, msg );
}
function migratePatchFunc( obj, prop, newFunc, code ) {
return migrateWarnFuncInternal( obj, prop, newFunc, code );
}
if ( window.document.compatMode === "BackCompat" ) {
// jQuery has never supported or tested Quirks Mode
migrateWarn( "quirks", "jQuery is not compatible with Quirks Mode" );
}
var findProp,
class2type = {},
oldInit = jQuery.fn.init,
oldFind = jQuery.find,
rattrHashTest = /\[(\s*[-\w]+\s*)([~|^$*]?=)\s*([-\w#]*?#[-\w#]*)\s*\]/,
rattrHashGlob = /\[(\s*[-\w]+\s*)([~|^$*]?=)\s*([-\w#]*?#[-\w#]*)\s*\]/g,
// Require that the "whitespace run" starts from a non-whitespace
// to avoid O(N^2) behavior when the engine would try matching "\s+$" at each space position.
rtrim = /^[\s\uFEFF\xA0]+|([^\s\uFEFF\xA0])[\s\uFEFF\xA0]+$/g;
migratePatchFunc( jQuery.fn, "init", function( arg1 ) {
var args = Array.prototype.slice.call( arguments );
if ( jQuery.migrateIsPatchEnabled( "selector-empty-id" ) &&
typeof arg1 === "string" && arg1 === "#" ) {
// JQuery( "#" ) is a bogus ID selector, but it returned an empty set
// before jQuery 3.0
migrateWarn( "selector-empty-id", "jQuery( '#' ) is not a valid selector" );
args[ 0 ] = [];
}
return oldInit.apply( this, args );
}, "selector-empty-id" );
// This is already done in Core but the above patch will lose this assignment
// so we need to redo it. It doesn't matter whether the patch is enabled or not
// as the method is always going to be a Migrate-created wrapper.
jQuery.fn.init.prototype = jQuery.fn;
migratePatchFunc( jQuery, "find", function( selector ) {
var args = Array.prototype.slice.call( arguments );
// Support: PhantomJS 1.x
// String#match fails to match when used with a //g RegExp, only on some strings
if ( typeof selector === "string" && rattrHashTest.test( selector ) ) {
// The nonstandard and undocumented unquoted-hash was removed in jQuery 1.12.0
// First see if qS thinks it's a valid selector, if so avoid a false positive
try {
window.document.querySelector( selector );
} catch ( err1 ) {
// Didn't *look* valid to qSA, warn and try quoting what we think is the value
selector = selector.replace( rattrHashGlob, function( _, attr, op, value ) {
return "[" + attr + op + "\"" + value + "\"]";
} );
// If the regexp *may*