Gitlab Schedule Duplicator

Gitlab schedule duplicator

目前為 2023-10-24 提交的版本,檢視 最新版本

  1. // ==UserScript==
  2. // @name Gitlab Schedule Duplicator
  3. // @namespace https://github.com/tranphuquy19
  4. // @description Gitlab schedule duplicator
  5. // @match https://gitlab.com/*/pipeline_schedules*
  6. // @match https://*.gitlab.com/*/pipeline_schedules*
  7. // @grant GM_addStyle
  8. // @run-at document-end
  9. // @license MIT
  10. // @author tranphuquy19
  11. // @version 1698123165271
  12. // ==/UserScript==
  13. /******/ (() => { // webpackBootstrap
  14. /******/ var __webpack_modules__ = ([
  15. /* 0 */
  16. /***/ ((__unused_webpack_module, exports) => {
  17.  
  18. "use strict";
  19.  
  20. var _a, _b;
  21. Object.defineProperty(exports, "__esModule", ({ value: true }));
  22. exports.saveGitlabToolSettings = exports.saveGitlabToken = exports.replaceEnterWithN = exports.sortVarByName = exports.enableMarkdownVarDescription = exports.autoShowDropDown = exports.getTheOptionsFrom = exports.includeAllVariables = exports.wrappedVarBy = exports.gitlabDefaultPipelineSchedule = exports.gitlabRestPerPage = exports.gitlabSvgIconUrl = exports.gitlabToken = exports.gitlabProjectId = exports.gitlabGraphqlUrl = exports.gitlabApiUrl = exports.gitlabUrl = exports.gitlabTokenLocalStorageKey = void 0;
  23. const gitlabTokenLocalStorageKey = 'gitlab_token';
  24. exports.gitlabTokenLocalStorageKey = gitlabTokenLocalStorageKey;
  25. const gitlabUrl = document.location.origin;
  26. exports.gitlabUrl = gitlabUrl;
  27. const gitlabApiUrl = `${gitlabUrl}/api/v4`;
  28. exports.gitlabApiUrl = gitlabApiUrl;
  29. const gitlabGraphqlUrl = `${gitlabUrl}/api/graphql`;
  30. exports.gitlabGraphqlUrl = gitlabGraphqlUrl;
  31. const gitlabProjectId = ((_a = document.querySelector('#project_id')) === null || _a === void 0 ? void 0 : _a.value) ||
  32. ((_b = document.querySelector('body')) === null || _b === void 0 ? void 0 : _b.getAttribute('data-project-id'));
  33. exports.gitlabProjectId = gitlabProjectId;
  34. const gitlabToken = window.atob(localStorage.getItem(gitlabTokenLocalStorageKey) || '');
  35. exports.gitlabToken = gitlabToken;
  36. let includeAllVariables = false;
  37. exports.includeAllVariables = includeAllVariables;
  38. let gitlabSvgIconUrl = `/assets/icons-29e9caf34d9cc5889ea5f1dce460a0578cd14318aabc385b1fe54ce6069c9874.svg`;
  39. exports.gitlabSvgIconUrl = gitlabSvgIconUrl;
  40. let gitlabRestPerPage = 9999; // Number of items per page for REST API
  41. exports.gitlabRestPerPage = gitlabRestPerPage;
  42. let gitlabDefaultPipelineSchedule = {
  43. active: false,
  44. cron: '0 15 * * *',
  45. description: 'New pipeline schedule',
  46. cron_timezone: 'UTC',
  47. ref: 'main',
  48. };
  49. exports.gitlabDefaultPipelineSchedule = gitlabDefaultPipelineSchedule;
  50. let wrappedVarBy = '"';
  51. exports.wrappedVarBy = wrappedVarBy;
  52. let replaceEnterWithN = true;
  53. exports.replaceEnterWithN = replaceEnterWithN;
  54. let getTheOptionsFrom = 'merge_both'; // var_description, gitlab_variable_options, merge_both
  55. exports.getTheOptionsFrom = getTheOptionsFrom;
  56. let autoShowDropDown = true;
  57. exports.autoShowDropDown = autoShowDropDown;
  58. let enableMarkdownVarDescription = true;
  59. exports.enableMarkdownVarDescription = enableMarkdownVarDescription;
  60. let sortVarByName = true;
  61. exports.sortVarByName = sortVarByName;
  62. const gitlabToolSettingsLSKey = 'gitlab-tool-settings';
  63. const gitlabToolSettings = localStorage.getItem(gitlabToolSettingsLSKey);
  64. if (gitlabToolSettings === null) {
  65. localStorage.setItem(gitlabToolSettingsLSKey, JSON.stringify({
  66. gitlabDefaultPipelineSchedule,
  67. wrappedVarBy,
  68. gitlabSvgIconUrl,
  69. gitlabRestPerPage,
  70. includeAllVariables,
  71. getTheOptionsFrom,
  72. autoShowDropDown,
  73. enableMarkdownVarDescription,
  74. sortVarByName,
  75. replaceEnterWithN,
  76. }));
  77. }
  78. else {
  79. const settings = JSON.parse(gitlabToolSettings);
  80. exports.gitlabDefaultPipelineSchedule = gitlabDefaultPipelineSchedule = settings.gitlabDefaultPipelineSchedule;
  81. exports.wrappedVarBy = wrappedVarBy = settings.wrappedVarBy;
  82. exports.gitlabSvgIconUrl = gitlabSvgIconUrl = settings.gitlabSvgIconUrl;
  83. exports.gitlabRestPerPage = gitlabRestPerPage = settings.gitlabRestPerPage;
  84. exports.includeAllVariables = includeAllVariables = settings.includeAllVariables;
  85. exports.getTheOptionsFrom = getTheOptionsFrom = settings.getTheOptionsFrom;
  86. exports.autoShowDropDown = autoShowDropDown = settings.autoShowDropDown;
  87. exports.enableMarkdownVarDescription = enableMarkdownVarDescription = settings.enableMarkdownVarDescription;
  88. exports.sortVarByName = sortVarByName = settings.sortVarByName;
  89. exports.replaceEnterWithN = replaceEnterWithN = settings.replaceEnterWithN;
  90. }
  91. const saveGitlabToken = (token) => {
  92. localStorage.setItem(gitlabTokenLocalStorageKey, window.btoa(token));
  93. };
  94. exports.saveGitlabToken = saveGitlabToken;
  95. const saveGitlabToolSettings = (settings) => {
  96. const oldSettings = JSON.parse(localStorage.getItem(gitlabToolSettingsLSKey) || '');
  97. const newSettings = Object.assign(Object.assign({}, oldSettings), settings);
  98. localStorage.setItem(gitlabToolSettingsLSKey, JSON.stringify(newSettings));
  99. };
  100. exports.saveGitlabToolSettings = saveGitlabToolSettings;
  101. exports["default"] = {
  102. gitlabTokenLocalStorageKey,
  103. gitlabUrl,
  104. gitlabApiUrl,
  105. gitlabGraphqlUrl,
  106. gitlabProjectId,
  107. gitlabToken,
  108. gitlabSvgIconUrl,
  109. gitlabRestPerPage,
  110. gitlabDefaultPipelineSchedule,
  111. wrappedVarBy,
  112. includeAllVariables,
  113. getTheOptionsFrom,
  114. autoShowDropDown,
  115. enableMarkdownVarDescription,
  116. sortVarByName,
  117. replaceEnterWithN,
  118. saveGitlabToken,
  119. saveGitlabToolSettings,
  120. };
  121.  
  122.  
  123. /***/ }),
  124. /* 1 */
  125. /***/ (function(module, exports) {
  126.  
  127. var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
  128. * jQuery JavaScript Library v3.7.1 -ajax,-ajax/jsonp,-ajax/load,-ajax/script,-ajax/var/location,-ajax/var/nonce,-ajax/var/rquery,-ajax/xhr,-manipulation/_evalUrl,-deprecated/ajax-event-alias,-effects,-effects/animatedSelector,-effects/Tween
  129. * https://jquery.com/
  130. *
  131. * Copyright OpenJS Foundation and other contributors
  132. * Released under the MIT license
  133. * https://jquery.org/license
  134. *
  135. * Date: 2023-08-28T13:37Z
  136. */
  137. ( function( global, factory ) {
  138.  
  139. "use strict";
  140.  
  141. if ( true && typeof module.exports === "object" ) {
  142.  
  143. // For CommonJS and CommonJS-like environments where a proper `window`
  144. // is present, execute the factory and get jQuery.
  145. // For environments that do not have a `window` with a `document`
  146. // (such as Node.js), expose a factory as module.exports.
  147. // This accentuates the need for the creation of a real `window`.
  148. // e.g. var jQuery = require("jquery")(window);
  149. // See ticket trac-14549 for more info.
  150. module.exports = global.document ?
  151. factory( global, true ) :
  152. function( w ) {
  153. if ( !w.document ) {
  154. throw new Error( "jQuery requires a window with a document" );
  155. }
  156. return factory( w );
  157. };
  158. } else {
  159. factory( global );
  160. }
  161.  
  162. // Pass this if window is not defined yet
  163. } )( typeof window !== "undefined" ? window : this, function( window, noGlobal ) {
  164.  
  165. // Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1
  166. // throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode
  167. // arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), strict mode should be common
  168. // enough that all such attempts are guarded in a try block.
  169. "use strict";
  170.  
  171. var arr = [];
  172.  
  173. var getProto = Object.getPrototypeOf;
  174.  
  175. var slice = arr.slice;
  176.  
  177. var flat = arr.flat ? function( array ) {
  178. return arr.flat.call( array );
  179. } : function( array ) {
  180. return arr.concat.apply( [], array );
  181. };
  182.  
  183.  
  184. var push = arr.push;
  185.  
  186. var indexOf = arr.indexOf;
  187.  
  188. var class2type = {};
  189.  
  190. var toString = class2type.toString;
  191.  
  192. var hasOwn = class2type.hasOwnProperty;
  193.  
  194. var fnToString = hasOwn.toString;
  195.  
  196. var ObjectFunctionString = fnToString.call( Object );
  197.  
  198. var support = {};
  199.  
  200. var isFunction = function isFunction( obj ) {
  201.  
  202. // Support: Chrome <=57, Firefox <=52
  203. // In some browsers, typeof returns "function" for HTML <object> elements
  204. // (i.e., `typeof document.createElement( "object" ) === "function"`).
  205. // We don't want to classify *any* DOM node as a function.
  206. // Support: QtWeb <=3.8.5, WebKit <=534.34, wkhtmltopdf tool <=0.12.5
  207. // Plus for old WebKit, typeof returns "function" for HTML collections
  208. // (e.g., `typeof document.getElementsByTagName("div") === "function"`). (gh-4756)
  209. return typeof obj === "function" && typeof obj.nodeType !== "number" &&
  210. typeof obj.item !== "function";
  211. };
  212.  
  213.  
  214. var isWindow = function isWindow( obj ) {
  215. return obj != null && obj === obj.window;
  216. };
  217.  
  218.  
  219. var document = window.document;
  220.  
  221.  
  222.  
  223. var preservedScriptAttributes = {
  224. type: true,
  225. src: true,
  226. nonce: true,
  227. noModule: true
  228. };
  229.  
  230. function DOMEval( code, node, doc ) {
  231. doc = doc || document;
  232.  
  233. var i, val,
  234. script = doc.createElement( "script" );
  235.  
  236. script.text = code;
  237. if ( node ) {
  238. for ( i in preservedScriptAttributes ) {
  239.  
  240. // Support: Firefox 64+, Edge 18+
  241. // Some browsers don't support the "nonce" property on scripts.
  242. // On the other hand, just using `getAttribute` is not enough as
  243. // the `nonce` attribute is reset to an empty string whenever it
  244. // becomes browsing-context connected.
  245. // See https://github.com/whatwg/html/issues/2369
  246. // See https://html.spec.whatwg.org/#nonce-attributes
  247. // The `node.getAttribute` check was added for the sake of
  248. // `jQuery.globalEval` so that it can fake a nonce-containing node
  249. // via an object.
  250. val = node[ i ] || node.getAttribute && node.getAttribute( i );
  251. if ( val ) {
  252. script.setAttribute( i, val );
  253. }
  254. }
  255. }
  256. doc.head.appendChild( script ).parentNode.removeChild( script );
  257. }
  258.  
  259.  
  260. function toType( obj ) {
  261. if ( obj == null ) {
  262. return obj + "";
  263. }
  264.  
  265. // Support: Android <=2.3 only (functionish RegExp)
  266. return typeof obj === "object" || typeof obj === "function" ?
  267. class2type[ toString.call( obj ) ] || "object" :
  268. typeof obj;
  269. }
  270. /* global Symbol */
  271. // Defining this global in .eslintrc.json would create a danger of using the global
  272. // unguarded in another place, it seems safer to define global only for this module
  273.  
  274.  
  275.  
  276. var version = "3.7.1 -ajax,-ajax/jsonp,-ajax/load,-ajax/script,-ajax/var/location,-ajax/var/nonce,-ajax/var/rquery,-ajax/xhr,-manipulation/_evalUrl,-deprecated/ajax-event-alias,-effects,-effects/animatedSelector,-effects/Tween",
  277.  
  278. rhtmlSuffix = /HTML$/i,
  279.  
  280. // Define a local copy of jQuery
  281. jQuery = function( selector, context ) {
  282.  
  283. // The jQuery object is actually just the init constructor 'enhanced'
  284. // Need init if jQuery is called (just allow error to be thrown if not included)
  285. return new jQuery.fn.init( selector, context );
  286. };
  287.  
  288. jQuery.fn = jQuery.prototype = {
  289.  
  290. // The current version of jQuery being used
  291. jquery: version,
  292.  
  293. constructor: jQuery,
  294.  
  295. // The default length of a jQuery object is 0
  296. length: 0,
  297.  
  298. toArray: function() {
  299. return slice.call( this );
  300. },
  301.  
  302. // Get the Nth element in the matched element set OR
  303. // Get the whole matched element set as a clean array
  304. get: function( num ) {
  305.  
  306. // Return all the elements in a clean array
  307. if ( num == null ) {
  308. return slice.call( this );
  309. }
  310.  
  311. // Return just the one element from the set
  312. return num < 0 ? this[ num + this.length ] : this[ num ];
  313. },
  314.  
  315. // Take an array of elements and push it onto the stack
  316. // (returning the new matched element set)
  317. pushStack: function( elems ) {
  318.  
  319. // Build a new jQuery matched element set
  320. var ret = jQuery.merge( this.constructor(), elems );
  321.  
  322. // Add the old object onto the stack (as a reference)
  323. ret.prevObject = this;
  324.  
  325. // Return the newly-formed element set
  326. return ret;
  327. },
  328.  
  329. // Execute a callback for every element in the matched set.
  330. each: function( callback ) {
  331. return jQuery.each( this, callback );
  332. },
  333.  
  334. map: function( callback ) {
  335. return this.pushStack( jQuery.map( this, function( elem, i ) {
  336. return callback.call( elem, i, elem );
  337. } ) );
  338. },
  339.  
  340. slice: function() {
  341. return this.pushStack( slice.apply( this, arguments ) );
  342. },
  343.  
  344. first: function() {
  345. return this.eq( 0 );
  346. },
  347.  
  348. last: function() {
  349. return this.eq( -1 );
  350. },
  351.  
  352. even: function() {
  353. return this.pushStack( jQuery.grep( this, function( _elem, i ) {
  354. return ( i + 1 ) % 2;
  355. } ) );
  356. },
  357.  
  358. odd: function() {
  359. return this.pushStack( jQuery.grep( this, function( _elem, i ) {
  360. return i % 2;
  361. } ) );
  362. },
  363.  
  364. eq: function( i ) {
  365. var len = this.length,
  366. j = +i + ( i < 0 ? len : 0 );
  367. return this.pushStack( j >= 0 && j < len ? [ this[ j ] ] : [] );
  368. },
  369.  
  370. end: function() {
  371. return this.prevObject || this.constructor();
  372. },
  373.  
  374. // For internal use only.
  375. // Behaves like an Array's method, not like a jQuery method.
  376. push: push,
  377. sort: arr.sort,
  378. splice: arr.splice
  379. };
  380.  
  381. jQuery.extend = jQuery.fn.extend = function() {
  382. var options, name, src, copy, copyIsArray, clone,
  383. target = arguments[ 0 ] || {},
  384. i = 1,
  385. length = arguments.length,
  386. deep = false;
  387.  
  388. // Handle a deep copy situation
  389. if ( typeof target === "boolean" ) {
  390. deep = target;
  391.  
  392. // Skip the boolean and the target
  393. target = arguments[ i ] || {};
  394. i++;
  395. }
  396.  
  397. // Handle case when target is a string or something (possible in deep copy)
  398. if ( typeof target !== "object" && !isFunction( target ) ) {
  399. target = {};
  400. }
  401.  
  402. // Extend jQuery itself if only one argument is passed
  403. if ( i === length ) {
  404. target = this;
  405. i--;
  406. }
  407.  
  408. for ( ; i < length; i++ ) {
  409.  
  410. // Only deal with non-null/undefined values
  411. if ( ( options = arguments[ i ] ) != null ) {
  412.  
  413. // Extend the base object
  414. for ( name in options ) {
  415. copy = options[ name ];
  416.  
  417. // Prevent Object.prototype pollution
  418. // Prevent never-ending loop
  419. if ( name === "__proto__" || target === copy ) {
  420. continue;
  421. }
  422.  
  423. // Recurse if we're merging plain objects or arrays
  424. if ( deep && copy && ( jQuery.isPlainObject( copy ) ||
  425. ( copyIsArray = Array.isArray( copy ) ) ) ) {
  426. src = target[ name ];
  427.  
  428. // Ensure proper type for the source value
  429. if ( copyIsArray && !Array.isArray( src ) ) {
  430. clone = [];
  431. } else if ( !copyIsArray && !jQuery.isPlainObject( src ) ) {
  432. clone = {};
  433. } else {
  434. clone = src;
  435. }
  436. copyIsArray = false;
  437.  
  438. // Never move original objects, clone them
  439. target[ name ] = jQuery.extend( deep, clone, copy );
  440.  
  441. // Don't bring in undefined values
  442. } else if ( copy !== undefined ) {
  443. target[ name ] = copy;
  444. }
  445. }
  446. }
  447. }
  448.  
  449. // Return the modified object
  450. return target;
  451. };
  452.  
  453. jQuery.extend( {
  454.  
  455. // Unique for each copy of jQuery on the page
  456. expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ),
  457.  
  458. // Assume jQuery is ready without the ready module
  459. isReady: true,
  460.  
  461. error: function( msg ) {
  462. throw new Error( msg );
  463. },
  464.  
  465. noop: function() {},
  466.  
  467. isPlainObject: function( obj ) {
  468. var proto, Ctor;
  469.  
  470. // Detect obvious negatives
  471. // Use toString instead of jQuery.type to catch host objects
  472. if ( !obj || toString.call( obj ) !== "[object Object]" ) {
  473. return false;
  474. }
  475.  
  476. proto = getProto( obj );
  477.  
  478. // Objects with no prototype (e.g., `Object.create( null )`) are plain
  479. if ( !proto ) {
  480. return true;
  481. }
  482.  
  483. // Objects with prototype are plain iff they were constructed by a global Object function
  484. Ctor = hasOwn.call( proto, "constructor" ) && proto.constructor;
  485. return typeof Ctor === "function" && fnToString.call( Ctor ) === ObjectFunctionString;
  486. },
  487.  
  488. isEmptyObject: function( obj ) {
  489. var name;
  490.  
  491. for ( name in obj ) {
  492. return false;
  493. }
  494. return true;
  495. },
  496.  
  497. // Evaluates a script in a provided context; falls back to the global one
  498. // if not specified.
  499. globalEval: function( code, options, doc ) {
  500. DOMEval( code, { nonce: options && options.nonce }, doc );
  501. },
  502.  
  503. each: function( obj, callback ) {
  504. var length, i = 0;
  505.  
  506. if ( isArrayLike( obj ) ) {
  507. length = obj.length;
  508. for ( ; i < length; i++ ) {
  509. if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
  510. break;
  511. }
  512. }
  513. } else {
  514. for ( i in obj ) {
  515. if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
  516. break;
  517. }
  518. }
  519. }
  520.  
  521. return obj;
  522. },
  523.  
  524.  
  525. // Retrieve the text value of an array of DOM nodes
  526. text: function( elem ) {
  527. var node,
  528. ret = "",
  529. i = 0,
  530. nodeType = elem.nodeType;
  531.  
  532. if ( !nodeType ) {
  533.  
  534. // If no nodeType, this is expected to be an array
  535. while ( ( node = elem[ i++ ] ) ) {
  536.  
  537. // Do not traverse comment nodes
  538. ret += jQuery.text( node );
  539. }
  540. }
  541. if ( nodeType === 1 || nodeType === 11 ) {
  542. return elem.textContent;
  543. }
  544. if ( nodeType === 9 ) {
  545. return elem.documentElement.textContent;
  546. }
  547. if ( nodeType === 3 || nodeType === 4 ) {
  548. return elem.nodeValue;
  549. }
  550.  
  551. // Do not include comment or processing instruction nodes
  552.  
  553. return ret;
  554. },
  555.  
  556. // results is for internal usage only
  557. makeArray: function( arr, results ) {
  558. var ret = results || [];
  559.  
  560. if ( arr != null ) {
  561. if ( isArrayLike( Object( arr ) ) ) {
  562. jQuery.merge( ret,
  563. typeof arr === "string" ?
  564. [ arr ] : arr
  565. );
  566. } else {
  567. push.call( ret, arr );
  568. }
  569. }
  570.  
  571. return ret;
  572. },
  573.  
  574. inArray: function( elem, arr, i ) {
  575. return arr == null ? -1 : indexOf.call( arr, elem, i );
  576. },
  577.  
  578. isXMLDoc: function( elem ) {
  579. var namespace = elem && elem.namespaceURI,
  580. docElem = elem && ( elem.ownerDocument || elem ).documentElement;
  581.  
  582. // Assume HTML when documentElement doesn't yet exist, such as inside
  583. // document fragments.
  584. return !rhtmlSuffix.test( namespace || docElem && docElem.nodeName || "HTML" );
  585. },
  586.  
  587. // Support: Android <=4.0 only, PhantomJS 1 only
  588. // push.apply(_, arraylike) throws on ancient WebKit
  589. merge: function( first, second ) {
  590. var len = +second.length,
  591. j = 0,
  592. i = first.length;
  593.  
  594. for ( ; j < len; j++ ) {
  595. first[ i++ ] = second[ j ];
  596. }
  597.  
  598. first.length = i;
  599.  
  600. return first;
  601. },
  602.  
  603. grep: function( elems, callback, invert ) {
  604. var callbackInverse,
  605. matches = [],
  606. i = 0,
  607. length = elems.length,
  608. callbackExpect = !invert;
  609.  
  610. // Go through the array, only saving the items
  611. // that pass the validator function
  612. for ( ; i < length; i++ ) {
  613. callbackInverse = !callback( elems[ i ], i );
  614. if ( callbackInverse !== callbackExpect ) {
  615. matches.push( elems[ i ] );
  616. }
  617. }
  618.  
  619. return matches;
  620. },
  621.  
  622. // arg is for internal usage only
  623. map: function( elems, callback, arg ) {
  624. var length, value,
  625. i = 0,
  626. ret = [];
  627.  
  628. // Go through the array, translating each of the items to their new values
  629. if ( isArrayLike( elems ) ) {
  630. length = elems.length;
  631. for ( ; i < length; i++ ) {
  632. value = callback( elems[ i ], i, arg );
  633.  
  634. if ( value != null ) {
  635. ret.push( value );
  636. }
  637. }
  638.  
  639. // Go through every key on the object,
  640. } else {
  641. for ( i in elems ) {
  642. value = callback( elems[ i ], i, arg );
  643.  
  644. if ( value != null ) {
  645. ret.push( value );
  646. }
  647. }
  648. }
  649.  
  650. // Flatten any nested arrays
  651. return flat( ret );
  652. },
  653.  
  654. // A global GUID counter for objects
  655. guid: 1,
  656.  
  657. // jQuery.support is not used in Core but other projects attach their
  658. // properties to it so it needs to exist.
  659. support: support
  660. } );
  661.  
  662. if ( typeof Symbol === "function" ) {
  663. jQuery.fn[ Symbol.iterator ] = arr[ Symbol.iterator ];
  664. }
  665.  
  666. // Populate the class2type map
  667. jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ),
  668. function( _i, name ) {
  669. class2type[ "[object " + name + "]" ] = name.toLowerCase();
  670. } );
  671.  
  672. function isArrayLike( obj ) {
  673.  
  674. // Support: real iOS 8.2 only (not reproducible in simulator)
  675. // `in` check used to prevent JIT error (gh-2145)
  676. // hasOwn isn't used here due to false negatives
  677. // regarding Nodelist length in IE
  678. var length = !!obj && "length" in obj && obj.length,
  679. type = toType( obj );
  680.  
  681. if ( isFunction( obj ) || isWindow( obj ) ) {
  682. return false;
  683. }
  684.  
  685. return type === "array" || length === 0 ||
  686. typeof length === "number" && length > 0 && ( length - 1 ) in obj;
  687. }
  688.  
  689.  
  690. function nodeName( elem, name ) {
  691.  
  692. return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
  693.  
  694. }
  695. var pop = arr.pop;
  696.  
  697.  
  698. var sort = arr.sort;
  699.  
  700.  
  701. var splice = arr.splice;
  702.  
  703.  
  704. var whitespace = "[\\x20\\t\\r\\n\\f]";
  705.  
  706.  
  707. var rtrimCSS = new RegExp(
  708. "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$",
  709. "g"
  710. );
  711.  
  712.  
  713.  
  714.  
  715. // Note: an element does not contain itself
  716. jQuery.contains = function( a, b ) {
  717. var bup = b && b.parentNode;
  718.  
  719. return a === bup || !!( bup && bup.nodeType === 1 && (
  720.  
  721. // Support: IE 9 - 11+
  722. // IE doesn't have `contains` on SVG.
  723. a.contains ?
  724. a.contains( bup ) :
  725. a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16
  726. ) );
  727. };
  728.  
  729.  
  730.  
  731.  
  732. // CSS string/identifier serialization
  733. // https://drafts.csswg.org/cssom/#common-serializing-idioms
  734. var rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\x80-\uFFFF\w-]/g;
  735.  
  736. function fcssescape( ch, asCodePoint ) {
  737. if ( asCodePoint ) {
  738.  
  739. // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER
  740. if ( ch === "\0" ) {
  741. return "\uFFFD";
  742. }
  743.  
  744. // Control characters and (dependent upon position) numbers get escaped as code points
  745. return ch.slice( 0, -1 ) + "\\" + ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " ";
  746. }
  747.  
  748. // Other potentially-special ASCII characters get backslash-escaped
  749. return "\\" + ch;
  750. }
  751.  
  752. jQuery.escapeSelector = function( sel ) {
  753. return ( sel + "" ).replace( rcssescape, fcssescape );
  754. };
  755.  
  756.  
  757.  
  758.  
  759. var preferredDoc = document,
  760. pushNative = push;
  761.  
  762. ( function() {
  763.  
  764. var i,
  765. Expr,
  766. outermostContext,
  767. sortInput,
  768. hasDuplicate,
  769. push = pushNative,
  770.  
  771. // Local document vars
  772. document,
  773. documentElement,
  774. documentIsHTML,
  775. rbuggyQSA,
  776. matches,
  777.  
  778. // Instance-specific data
  779. expando = jQuery.expando,
  780. dirruns = 0,
  781. done = 0,
  782. classCache = createCache(),
  783. tokenCache = createCache(),
  784. compilerCache = createCache(),
  785. nonnativeSelectorCache = createCache(),
  786. sortOrder = function( a, b ) {
  787. if ( a === b ) {
  788. hasDuplicate = true;
  789. }
  790. return 0;
  791. },
  792.  
  793. booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|" +
  794. "loop|multiple|open|readonly|required|scoped",
  795.  
  796. // Regular expressions
  797.  
  798. // https://www.w3.org/TR/css-syntax-3/#ident-token-diagram
  799. identifier = "(?:\\\\[\\da-fA-F]{1,6}" + whitespace +
  800. "?|\\\\[^\\r\\n\\f]|[\\w-]|[^\0-\\x7f])+",
  801.  
  802. // Attribute selectors: https://www.w3.org/TR/selectors/#attribute-selectors
  803. attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace +
  804.  
  805. // Operator (capture 2)
  806. "*([*^$|!~]?=)" + whitespace +
  807.  
  808. // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]"
  809. "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" +
  810. whitespace + "*\\]",
  811.  
  812. pseudos = ":(" + identifier + ")(?:\\((" +
  813.  
  814. // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments:
  815. // 1. quoted (capture 3; capture 4 or capture 5)
  816. "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" +
  817.  
  818. // 2. simple (capture 6)
  819. "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" +
  820.  
  821. // 3. anything else (capture 2)
  822. ".*" +
  823. ")\\)|)",
  824.  
  825. // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
  826. rwhitespace = new RegExp( whitespace + "+", "g" ),
  827.  
  828. rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ),
  829. rleadingCombinator = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" +
  830. whitespace + "*" ),
  831. rdescend = new RegExp( whitespace + "|>" ),
  832.  
  833. rpseudo = new RegExp( pseudos ),
  834. ridentifier = new RegExp( "^" + identifier + "$" ),
  835.  
  836. matchExpr = {
  837. ID: new RegExp( "^#(" + identifier + ")" ),
  838. CLASS: new RegExp( "^\\.(" + identifier + ")" ),
  839. TAG: new RegExp( "^(" + identifier + "|[*])" ),
  840. ATTR: new RegExp( "^" + attributes ),
  841. PSEUDO: new RegExp( "^" + pseudos ),
  842. CHILD: new RegExp(
  843. "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" +
  844. whitespace + "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" +
  845. whitespace + "*(\\d+)|))" + whitespace + "*\\)|)", "i" ),
  846. bool: new RegExp( "^(?:" + booleans + ")$", "i" ),
  847.  
  848. // For use in libraries implementing .is()
  849. // We use this for POS matching in `select`
  850. needsContext: new RegExp( "^" + whitespace +
  851. "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + whitespace +
  852. "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" )
  853. },
  854.  
  855. rinputs = /^(?:input|select|textarea|button)$/i,
  856. rheader = /^h\d$/i,
  857.  
  858. // Easily-parseable/retrievable ID or TAG or CLASS selectors
  859. rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
  860.  
  861. rsibling = /[+~]/,
  862.  
  863. // CSS escapes
  864. // https://www.w3.org/TR/CSS21/syndata.html#escaped-characters
  865. runescape = new RegExp( "\\\\[\\da-fA-F]{1,6}" + whitespace +
  866. "?|\\\\([^\\r\\n\\f])", "g" ),
  867. funescape = function( escape, nonHex ) {
  868. var high = "0x" + escape.slice( 1 ) - 0x10000;
  869.  
  870. if ( nonHex ) {
  871.  
  872. // Strip the backslash prefix from a non-hex escape sequence
  873. return nonHex;
  874. }
  875.  
  876. // Replace a hexadecimal escape sequence with the encoded Unicode code point
  877. // Support: IE <=11+
  878. // For values outside the Basic Multilingual Plane (BMP), manually construct a
  879. // surrogate pair
  880. return high < 0 ?
  881. String.fromCharCode( high + 0x10000 ) :
  882. String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 );
  883. },
  884.  
  885. // Used for iframes; see `setDocument`.
  886. // Support: IE 9 - 11+, Edge 12 - 18+
  887. // Removing the function wrapper causes a "Permission Denied"
  888. // error in IE/Edge.
  889. unloadHandler = function() {
  890. setDocument();
  891. },
  892.  
  893. inDisabledFieldset = addCombinator(
  894. function( elem ) {
  895. return elem.disabled === true && nodeName( elem, "fieldset" );
  896. },
  897. { dir: "parentNode", next: "legend" }
  898. );
  899.  
  900. // Support: IE <=9 only
  901. // Accessing document.activeElement can throw unexpectedly
  902. // https://bugs.jquery.com/ticket/13393
  903. function safeActiveElement() {
  904. try {
  905. return document.activeElement;
  906. } catch ( err ) { }
  907. }
  908.  
  909. // Optimize for push.apply( _, NodeList )
  910. try {
  911. push.apply(
  912. ( arr = slice.call( preferredDoc.childNodes ) ),
  913. preferredDoc.childNodes
  914. );
  915.  
  916. // Support: Android <=4.0
  917. // Detect silently failing push.apply
  918. // eslint-disable-next-line no-unused-expressions
  919. arr[ preferredDoc.childNodes.length ].nodeType;
  920. } catch ( e ) {
  921. push = {
  922. apply: function( target, els ) {
  923. pushNative.apply( target, slice.call( els ) );
  924. },
  925. call: function( target ) {
  926. pushNative.apply( target, slice.call( arguments, 1 ) );
  927. }
  928. };
  929. }
  930.  
  931. function find( selector, context, results, seed ) {
  932. var m, i, elem, nid, match, groups, newSelector,
  933. newContext = context && context.ownerDocument,
  934.  
  935. // nodeType defaults to 9, since context defaults to document
  936. nodeType = context ? context.nodeType : 9;
  937.  
  938. results = results || [];
  939.  
  940. // Return early from calls with invalid selector or context
  941. if ( typeof selector !== "string" || !selector ||
  942. nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) {
  943.  
  944. return results;
  945. }
  946.  
  947. // Try to shortcut find operations (as opposed to filters) in HTML documents
  948. if ( !seed ) {
  949. setDocument( context );
  950. context = context || document;
  951.  
  952. if ( documentIsHTML ) {
  953.  
  954. // If the selector is sufficiently simple, try using a "get*By*" DOM method
  955. // (excepting DocumentFragment context, where the methods don't exist)
  956. if ( nodeType !== 11 && ( match = rquickExpr.exec( selector ) ) ) {
  957.  
  958. // ID selector
  959. if ( ( m = match[ 1 ] ) ) {
  960.  
  961. // Document context
  962. if ( nodeType === 9 ) {
  963. if ( ( elem = context.getElementById( m ) ) ) {
  964.  
  965. // Support: IE 9 only
  966. // getElementById can match elements by name instead of ID
  967. if ( elem.id === m ) {
  968. push.call( results, elem );
  969. return results;
  970. }
  971. } else {
  972. return results;
  973. }
  974.  
  975. // Element context
  976. } else {
  977.  
  978. // Support: IE 9 only
  979. // getElementById can match elements by name instead of ID
  980. if ( newContext && ( elem = newContext.getElementById( m ) ) &&
  981. find.contains( context, elem ) &&
  982. elem.id === m ) {
  983.  
  984. push.call( results, elem );
  985. return results;
  986. }
  987. }
  988.  
  989. // Type selector
  990. } else if ( match[ 2 ] ) {
  991. push.apply( results, context.getElementsByTagName( selector ) );
  992. return results;
  993.  
  994. // Class selector
  995. } else if ( ( m = match[ 3 ] ) && context.getElementsByClassName ) {
  996. push.apply( results, context.getElementsByClassName( m ) );
  997. return results;
  998. }
  999. }
  1000.  
  1001. // Take advantage of querySelectorAll
  1002. if ( !nonnativeSelectorCache[ selector + " " ] &&
  1003. ( !rbuggyQSA || !rbuggyQSA.test( selector ) ) ) {
  1004.  
  1005. newSelector = selector;
  1006. newContext = context;
  1007.  
  1008. // qSA considers elements outside a scoping root when evaluating child or
  1009. // descendant combinators, which is not what we want.
  1010. // In such cases, we work around the behavior by prefixing every selector in the
  1011. // list with an ID selector referencing the scope context.
  1012. // The technique has to be used as well when a leading combinator is used
  1013. // as such selectors are not recognized by querySelectorAll.
  1014. // Thanks to Andrew Dupont for this technique.
  1015. if ( nodeType === 1 &&
  1016. ( rdescend.test( selector ) || rleadingCombinator.test( selector ) ) ) {
  1017.  
  1018. // Expand context for sibling selectors
  1019. newContext = rsibling.test( selector ) && testContext( context.parentNode ) ||
  1020. context;
  1021.  
  1022. // We can use :scope instead of the ID hack if the browser
  1023. // supports it & if we're not changing the context.
  1024. // Support: IE 11+, Edge 17 - 18+
  1025. // IE/Edge sometimes throw a "Permission denied" error when
  1026. // strict-comparing two documents; shallow comparisons work.
  1027. // eslint-disable-next-line eqeqeq
  1028. if ( newContext != context || !support.scope ) {
  1029.  
  1030. // Capture the context ID, setting it first if necessary
  1031. if ( ( nid = context.getAttribute( "id" ) ) ) {
  1032. nid = jQuery.escapeSelector( nid );
  1033. } else {
  1034. context.setAttribute( "id", ( nid = expando ) );
  1035. }
  1036. }
  1037.  
  1038. // Prefix every selector in the list
  1039. groups = tokenize( selector );
  1040. i = groups.length;
  1041. while ( i-- ) {
  1042. groups[ i ] = ( nid ? "#" + nid : ":scope" ) + " " +
  1043. toSelector( groups[ i ] );
  1044. }
  1045. newSelector = groups.join( "," );
  1046. }
  1047.  
  1048. try {
  1049. push.apply( results,
  1050. newContext.querySelectorAll( newSelector )
  1051. );
  1052. return results;
  1053. } catch ( qsaError ) {
  1054. nonnativeSelectorCache( selector, true );
  1055. } finally {
  1056. if ( nid === expando ) {
  1057. context.removeAttribute( "id" );
  1058. }
  1059. }
  1060. }
  1061. }
  1062. }
  1063.  
  1064. // All others
  1065. return select( selector.replace( rtrimCSS, "$1" ), context, results, seed );
  1066. }
  1067.  
  1068. /**
  1069. * Create key-value caches of limited size
  1070. * @returns {function(string, object)} Returns the Object data after storing it on itself with
  1071. * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)
  1072. * deleting the oldest entry
  1073. */
  1074. function createCache() {
  1075. var keys = [];
  1076.  
  1077. function cache( key, value ) {
  1078.  
  1079. // Use (key + " ") to avoid collision with native prototype properties
  1080. // (see https://github.com/jquery/sizzle/issues/157)
  1081. if ( keys.push( key + " " ) > Expr.cacheLength ) {
  1082.  
  1083. // Only keep the most recent entries
  1084. delete cache[ keys.shift() ];
  1085. }
  1086. return ( cache[ key + " " ] = value );
  1087. }
  1088. return cache;
  1089. }
  1090.  
  1091. /**
  1092. * Mark a function for special use by jQuery selector module
  1093. * @param {Function} fn The function to mark
  1094. */
  1095. function markFunction( fn ) {
  1096. fn[ expando ] = true;
  1097. return fn;
  1098. }
  1099.  
  1100. /**
  1101. * Support testing using an element
  1102. * @param {Function} fn Passed the created element and returns a boolean result
  1103. */
  1104. function assert( fn ) {
  1105. var el = document.createElement( "fieldset" );
  1106.  
  1107. try {
  1108. return !!fn( el );
  1109. } catch ( e ) {
  1110. return false;
  1111. } finally {
  1112.  
  1113. // Remove from its parent by default
  1114. if ( el.parentNode ) {
  1115. el.parentNode.removeChild( el );
  1116. }
  1117.  
  1118. // release memory in IE
  1119. el = null;
  1120. }
  1121. }
  1122.  
  1123. /**
  1124. * Returns a function to use in pseudos for input types
  1125. * @param {String} type
  1126. */
  1127. function createInputPseudo( type ) {
  1128. return function( elem ) {
  1129. return nodeName( elem, "input" ) && elem.type === type;
  1130. };
  1131. }
  1132.  
  1133. /**
  1134. * Returns a function to use in pseudos for buttons
  1135. * @param {String} type
  1136. */
  1137. function createButtonPseudo( type ) {
  1138. return function( elem ) {
  1139. return ( nodeName( elem, "input" ) || nodeName( elem, "button" ) ) &&
  1140. elem.type === type;
  1141. };
  1142. }
  1143.  
  1144. /**
  1145. * Returns a function to use in pseudos for :enabled/:disabled
  1146. * @param {Boolean} disabled true for :disabled; false for :enabled
  1147. */
  1148. function createDisabledPseudo( disabled ) {
  1149.  
  1150. // Known :disabled false positives: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable
  1151. return function( elem ) {
  1152.  
  1153. // Only certain elements can match :enabled or :disabled
  1154. // https://html.spec.whatwg.org/multipage/scripting.html#selector-enabled
  1155. // https://html.spec.whatwg.org/multipage/scripting.html#selector-disabled
  1156. if ( "form" in elem ) {
  1157.  
  1158. // Check for inherited disabledness on relevant non-disabled elements:
  1159. // * listed form-associated elements in a disabled fieldset
  1160. // https://html.spec.whatwg.org/multipage/forms.html#category-listed
  1161. // https://html.spec.whatwg.org/multipage/forms.html#concept-fe-disabled
  1162. // * option elements in a disabled optgroup
  1163. // https://html.spec.whatwg.org/multipage/forms.html#concept-option-disabled
  1164. // All such elements have a "form" property.
  1165. if ( elem.parentNode && elem.disabled === false ) {
  1166.  
  1167. // Option elements defer to a parent optgroup if present
  1168. if ( "label" in elem ) {
  1169. if ( "label" in elem.parentNode ) {
  1170. return elem.parentNode.disabled === disabled;
  1171. } else {
  1172. return elem.disabled === disabled;
  1173. }
  1174. }
  1175.  
  1176. // Support: IE 6 - 11+
  1177. // Use the isDisabled shortcut property to check for disabled fieldset ancestors
  1178. return elem.isDisabled === disabled ||
  1179.  
  1180. // Where there is no isDisabled, check manually
  1181. elem.isDisabled !== !disabled &&
  1182. inDisabledFieldset( elem ) === disabled;
  1183. }
  1184.  
  1185. return elem.disabled === disabled;
  1186.  
  1187. // Try to winnow out elements that can't be disabled before trusting the disabled property.
  1188. // Some victims get caught in our net (label, legend, menu, track), but it shouldn't
  1189. // even exist on them, let alone have a boolean value.
  1190. } else if ( "label" in elem ) {
  1191. return elem.disabled === disabled;
  1192. }
  1193.  
  1194. // Remaining elements are neither :enabled nor :disabled
  1195. return false;
  1196. };
  1197. }
  1198.  
  1199. /**
  1200. * Returns a function to use in pseudos for positionals
  1201. * @param {Function} fn
  1202. */
  1203. function createPositionalPseudo( fn ) {
  1204. return markFunction( function( argument ) {
  1205. argument = +argument;
  1206. return markFunction( function( seed, matches ) {
  1207. var j,
  1208. matchIndexes = fn( [], seed.length, argument ),
  1209. i = matchIndexes.length;
  1210.  
  1211. // Match elements found at the specified indexes
  1212. while ( i-- ) {
  1213. if ( seed[ ( j = matchIndexes[ i ] ) ] ) {
  1214. seed[ j ] = !( matches[ j ] = seed[ j ] );
  1215. }
  1216. }
  1217. } );
  1218. } );
  1219. }
  1220.  
  1221. /**
  1222. * Checks a node for validity as a jQuery selector context
  1223. * @param {Element|Object=} context
  1224. * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value
  1225. */
  1226. function testContext( context ) {
  1227. return context && typeof context.getElementsByTagName !== "undefined" && context;
  1228. }
  1229.  
  1230. /**
  1231. * Sets document-related variables once based on the current document
  1232. * @param {Element|Object} [node] An element or document object to use to set the document
  1233. * @returns {Object} Returns the current document
  1234. */
  1235. function setDocument( node ) {
  1236. var subWindow,
  1237. doc = node ? node.ownerDocument || node : preferredDoc;
  1238.  
  1239. // Return early if doc is invalid or already selected
  1240. // Support: IE 11+, Edge 17 - 18+
  1241. // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
  1242. // two documents; shallow comparisons work.
  1243. // eslint-disable-next-line eqeqeq
  1244. if ( doc == document || doc.nodeType !== 9 || !doc.documentElement ) {
  1245. return document;
  1246. }
  1247.  
  1248. // Update global variables
  1249. document = doc;
  1250. documentElement = document.documentElement;
  1251. documentIsHTML = !jQuery.isXMLDoc( document );
  1252.  
  1253. // Support: iOS 7 only, IE 9 - 11+
  1254. // Older browsers didn't support unprefixed `matches`.
  1255. matches = documentElement.matches ||
  1256. documentElement.webkitMatchesSelector ||
  1257. documentElement.msMatchesSelector;
  1258.  
  1259. // Support: IE 9 - 11+, Edge 12 - 18+
  1260. // Accessing iframe documents after unload throws "permission denied" errors
  1261. // (see trac-13936).
  1262. // Limit the fix to IE & Edge Legacy; despite Edge 15+ implementing `matches`,
  1263. // all IE 9+ and Edge Legacy versions implement `msMatchesSelector` as well.
  1264. if ( documentElement.msMatchesSelector &&
  1265.  
  1266. // Support: IE 11+, Edge 17 - 18+
  1267. // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
  1268. // two documents; shallow comparisons work.
  1269. // eslint-disable-next-line eqeqeq
  1270. preferredDoc != document &&
  1271. ( subWindow = document.defaultView ) && subWindow.top !== subWindow ) {
  1272.  
  1273. // Support: IE 9 - 11+, Edge 12 - 18+
  1274. subWindow.addEventListener( "unload", unloadHandler );
  1275. }
  1276.  
  1277. // Support: IE <10
  1278. // Check if getElementById returns elements by name
  1279. // The broken getElementById methods don't pick up programmatically-set names,
  1280. // so use a roundabout getElementsByName test
  1281. support.getById = assert( function( el ) {
  1282. documentElement.appendChild( el ).id = jQuery.expando;
  1283. return !document.getElementsByName ||
  1284. !document.getElementsByName( jQuery.expando ).length;
  1285. } );
  1286.  
  1287. // Support: IE 9 only
  1288. // Check to see if it's possible to do matchesSelector
  1289. // on a disconnected node.
  1290. support.disconnectedMatch = assert( function( el ) {
  1291. return matches.call( el, "*" );
  1292. } );
  1293.  
  1294. // Support: IE 9 - 11+, Edge 12 - 18+
  1295. // IE/Edge don't support the :scope pseudo-class.
  1296. support.scope = assert( function() {
  1297. return document.querySelectorAll( ":scope" );
  1298. } );
  1299.  
  1300. // Support: Chrome 105 - 111 only, Safari 15.4 - 16.3 only
  1301. // Make sure the `:has()` argument is parsed unforgivingly.
  1302. // We include `*` in the test to detect buggy implementations that are
  1303. // _selectively_ forgiving (specifically when the list includes at least
  1304. // one valid selector).
  1305. // Note that we treat complete lack of support for `:has()` as if it were
  1306. // spec-compliant support, which is fine because use of `:has()` in such
  1307. // environments will fail in the qSA path and fall back to jQuery traversal
  1308. // anyway.
  1309. support.cssHas = assert( function() {
  1310. try {
  1311. document.querySelector( ":has(*,:jqfake)" );
  1312. return false;
  1313. } catch ( e ) {
  1314. return true;
  1315. }
  1316. } );
  1317.  
  1318. // ID filter and find
  1319. if ( support.getById ) {
  1320. Expr.filter.ID = function( id ) {
  1321. var attrId = id.replace( runescape, funescape );
  1322. return function( elem ) {
  1323. return elem.getAttribute( "id" ) === attrId;
  1324. };
  1325. };
  1326. Expr.find.ID = function( id, context ) {
  1327. if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
  1328. var elem = context.getElementById( id );
  1329. return elem ? [ elem ] : [];
  1330. }
  1331. };
  1332. } else {
  1333. Expr.filter.ID = function( id ) {
  1334. var attrId = id.replace( runescape, funescape );
  1335. return function( elem ) {
  1336. var node = typeof elem.getAttributeNode !== "undefined" &&
  1337. elem.getAttributeNode( "id" );
  1338. return node && node.value === attrId;
  1339. };
  1340. };
  1341.  
  1342. // Support: IE 6 - 7 only
  1343. // getElementById is not reliable as a find shortcut
  1344. Expr.find.ID = function( id, context ) {
  1345. if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
  1346. var node, i, elems,
  1347. elem = context.getElementById( id );
  1348.  
  1349. if ( elem ) {
  1350.  
  1351. // Verify the id attribute
  1352. node = elem.getAttributeNode( "id" );
  1353. if ( node && node.value === id ) {
  1354. return [ elem ];
  1355. }
  1356.  
  1357. // Fall back on getElementsByName
  1358. elems = context.getElementsByName( id );
  1359. i = 0;
  1360. while ( ( elem = elems[ i++ ] ) ) {
  1361. node = elem.getAttributeNode( "id" );
  1362. if ( node && node.value === id ) {
  1363. return [ elem ];
  1364. }
  1365. }
  1366. }
  1367.  
  1368. return [];
  1369. }
  1370. };
  1371. }
  1372.  
  1373. // Tag
  1374. Expr.find.TAG = function( tag, context ) {
  1375. if ( typeof context.getElementsByTagName !== "undefined" ) {
  1376. return context.getElementsByTagName( tag );
  1377.  
  1378. // DocumentFragment nodes don't have gEBTN
  1379. } else {
  1380. return context.querySelectorAll( tag );
  1381. }
  1382. };
  1383.  
  1384. // Class
  1385. Expr.find.CLASS = function( className, context ) {
  1386. if ( typeof context.getElementsByClassName !== "undefined" && documentIsHTML ) {
  1387. return context.getElementsByClassName( className );
  1388. }
  1389. };
  1390.  
  1391. /* QSA/matchesSelector
  1392. ---------------------------------------------------------------------- */
  1393.  
  1394. // QSA and matchesSelector support
  1395.  
  1396. rbuggyQSA = [];
  1397.  
  1398. // Build QSA regex
  1399. // Regex strategy adopted from Diego Perini
  1400. assert( function( el ) {
  1401.  
  1402. var input;
  1403.  
  1404. documentElement.appendChild( el ).innerHTML =
  1405. "<a id='" + expando + "' href='' disabled='disabled'></a>" +
  1406. "<select id='" + expando + "-\r\\' disabled='disabled'>" +
  1407. "<option selected=''></option></select>";
  1408.  
  1409. // Support: iOS <=7 - 8 only
  1410. // Boolean attributes and "value" are not treated correctly in some XML documents
  1411. if ( !el.querySelectorAll( "[selected]" ).length ) {
  1412. rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" );
  1413. }
  1414.  
  1415. // Support: iOS <=7 - 8 only
  1416. if ( !el.querySelectorAll( "[id~=" + expando + "-]" ).length ) {
  1417. rbuggyQSA.push( "~=" );
  1418. }
  1419.  
  1420. // Support: iOS 8 only
  1421. // https://bugs.webkit.org/show_bug.cgi?id=136851
  1422. // In-page `selector#id sibling-combinator selector` fails
  1423. if ( !el.querySelectorAll( "a#" + expando + "+*" ).length ) {
  1424. rbuggyQSA.push( ".#.+[+~]" );
  1425. }
  1426.  
  1427. // Support: Chrome <=105+, Firefox <=104+, Safari <=15.4+
  1428. // In some of the document kinds, these selectors wouldn't work natively.
  1429. // This is probably OK but for backwards compatibility we want to maintain
  1430. // handling them through jQuery traversal in jQuery 3.x.
  1431. if ( !el.querySelectorAll( ":checked" ).length ) {
  1432. rbuggyQSA.push( ":checked" );
  1433. }
  1434.  
  1435. // Support: Windows 8 Native Apps
  1436. // The type and name attributes are restricted during .innerHTML assignment
  1437. input = document.createElement( "input" );
  1438. input.setAttribute( "type", "hidden" );
  1439. el.appendChild( input ).setAttribute( "name", "D" );
  1440.  
  1441. // Support: IE 9 - 11+
  1442. // IE's :disabled selector does not pick up the children of disabled fieldsets
  1443. // Support: Chrome <=105+, Firefox <=104+, Safari <=15.4+
  1444. // In some of the document kinds, these selectors wouldn't work natively.
  1445. // This is probably OK but for backwards compatibility we want to maintain
  1446. // handling them through jQuery traversal in jQuery 3.x.
  1447. documentElement.appendChild( el ).disabled = true;
  1448. if ( el.querySelectorAll( ":disabled" ).length !== 2 ) {
  1449. rbuggyQSA.push( ":enabled", ":disabled" );
  1450. }
  1451.  
  1452. // Support: IE 11+, Edge 15 - 18+
  1453. // IE 11/Edge don't find elements on a `[name='']` query in some cases.
  1454. // Adding a temporary attribute to the document before the selection works
  1455. // around the issue.
  1456. // Interestingly, IE 10 & older don't seem to have the issue.
  1457. input = document.createElement( "input" );
  1458. input.setAttribute( "name", "" );
  1459. el.appendChild( input );
  1460. if ( !el.querySelectorAll( "[name='']" ).length ) {
  1461. rbuggyQSA.push( "\\[" + whitespace + "*name" + whitespace + "*=" +
  1462. whitespace + "*(?:''|\"\")" );
  1463. }
  1464. } );
  1465.  
  1466. if ( !support.cssHas ) {
  1467.  
  1468. // Support: Chrome 105 - 110+, Safari 15.4 - 16.3+
  1469. // Our regular `try-catch` mechanism fails to detect natively-unsupported
  1470. // pseudo-classes inside `:has()` (such as `:has(:contains("Foo"))`)
  1471. // in browsers that parse the `:has()` argument as a forgiving selector list.
  1472. // https://drafts.csswg.org/selectors/#relational now requires the argument
  1473. // to be parsed unforgivingly, but browsers have not yet fully adjusted.
  1474. rbuggyQSA.push( ":has" );
  1475. }
  1476.  
  1477. rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join( "|" ) );
  1478.  
  1479. /* Sorting
  1480. ---------------------------------------------------------------------- */
  1481.  
  1482. // Document order sorting
  1483. sortOrder = function( a, b ) {
  1484.  
  1485. // Flag for duplicate removal
  1486. if ( a === b ) {
  1487. hasDuplicate = true;
  1488. return 0;
  1489. }
  1490.  
  1491. // Sort on method existence if only one input has compareDocumentPosition
  1492. var compare = !a.compareDocumentPosition - !b.compareDocumentPosition;
  1493. if ( compare ) {
  1494. return compare;
  1495. }
  1496.  
  1497. // Calculate position if both inputs belong to the same document
  1498. // Support: IE 11+, Edge 17 - 18+
  1499. // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
  1500. // two documents; shallow comparisons work.
  1501. // eslint-disable-next-line eqeqeq
  1502. compare = ( a.ownerDocument || a ) == ( b.ownerDocument || b ) ?
  1503. a.compareDocumentPosition( b ) :
  1504.  
  1505. // Otherwise we know they are disconnected
  1506. 1;
  1507.  
  1508. // Disconnected nodes
  1509. if ( compare & 1 ||
  1510. ( !support.sortDetached && b.compareDocumentPosition( a ) === compare ) ) {
  1511.  
  1512. // Choose the first element that is related to our preferred document
  1513. // Support: IE 11+, Edge 17 - 18+
  1514. // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
  1515. // two documents; shallow comparisons work.
  1516. // eslint-disable-next-line eqeqeq
  1517. if ( a === document || a.ownerDocument == preferredDoc &&
  1518. find.contains( preferredDoc, a ) ) {
  1519. return -1;
  1520. }
  1521.  
  1522. // Support: IE 11+, Edge 17 - 18+
  1523. // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
  1524. // two documents; shallow comparisons work.
  1525. // eslint-disable-next-line eqeqeq
  1526. if ( b === document || b.ownerDocument == preferredDoc &&
  1527. find.contains( preferredDoc, b ) ) {
  1528. return 1;
  1529. }
  1530.  
  1531. // Maintain original order
  1532. return sortInput ?
  1533. ( indexOf.call( sortInput, a ) - indexOf.call( sortInput, b ) ) :
  1534. 0;
  1535. }
  1536.  
  1537. return compare & 4 ? -1 : 1;
  1538. };
  1539.  
  1540. return document;
  1541. }
  1542.  
  1543. find.matches = function( expr, elements ) {
  1544. return find( expr, null, null, elements );
  1545. };
  1546.  
  1547. find.matchesSelector = function( elem, expr ) {
  1548. setDocument( elem );
  1549.  
  1550. if ( documentIsHTML &&
  1551. !nonnativeSelectorCache[ expr + " " ] &&
  1552. ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) {
  1553.  
  1554. try {
  1555. var ret = matches.call( elem, expr );
  1556.  
  1557. // IE 9's matchesSelector returns false on disconnected nodes
  1558. if ( ret || support.disconnectedMatch ||
  1559.  
  1560. // As well, disconnected nodes are said to be in a document
  1561. // fragment in IE 9
  1562. elem.document && elem.document.nodeType !== 11 ) {
  1563. return ret;
  1564. }
  1565. } catch ( e ) {
  1566. nonnativeSelectorCache( expr, true );
  1567. }
  1568. }
  1569.  
  1570. return find( expr, document, null, [ elem ] ).length > 0;
  1571. };
  1572.  
  1573. find.contains = function( context, elem ) {
  1574.  
  1575. // Set document vars if needed
  1576. // Support: IE 11+, Edge 17 - 18+
  1577. // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
  1578. // two documents; shallow comparisons work.
  1579. // eslint-disable-next-line eqeqeq
  1580. if ( ( context.ownerDocument || context ) != document ) {
  1581. setDocument( context );
  1582. }
  1583. return jQuery.contains( context, elem );
  1584. };
  1585.  
  1586.  
  1587. find.attr = function( elem, name ) {
  1588.  
  1589. // Set document vars if needed
  1590. // Support: IE 11+, Edge 17 - 18+
  1591. // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
  1592. // two documents; shallow comparisons work.
  1593. // eslint-disable-next-line eqeqeq
  1594. if ( ( elem.ownerDocument || elem ) != document ) {
  1595. setDocument( elem );
  1596. }
  1597.  
  1598. var fn = Expr.attrHandle[ name.toLowerCase() ],
  1599.  
  1600. // Don't get fooled by Object.prototype properties (see trac-13807)
  1601. val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ?
  1602. fn( elem, name, !documentIsHTML ) :
  1603. undefined;
  1604.  
  1605. if ( val !== undefined ) {
  1606. return val;
  1607. }
  1608.  
  1609. return elem.getAttribute( name );
  1610. };
  1611.  
  1612. find.error = function( msg ) {
  1613. throw new Error( "Syntax error, unrecognized expression: " + msg );
  1614. };
  1615.  
  1616. /**
  1617. * Document sorting and removing duplicates
  1618. * @param {ArrayLike} results
  1619. */
  1620. jQuery.uniqueSort = function( results ) {
  1621. var elem,
  1622. duplicates = [],
  1623. j = 0,
  1624. i = 0;
  1625.  
  1626. // Unless we *know* we can detect duplicates, assume their presence
  1627. //
  1628. // Support: Android <=4.0+
  1629. // Testing for detecting duplicates is unpredictable so instead assume we can't
  1630. // depend on duplicate detection in all browsers without a stable sort.
  1631. hasDuplicate = !support.sortStable;
  1632. sortInput = !support.sortStable && slice.call( results, 0 );
  1633. sort.call( results, sortOrder );
  1634.  
  1635. if ( hasDuplicate ) {
  1636. while ( ( elem = results[ i++ ] ) ) {
  1637. if ( elem === results[ i ] ) {
  1638. j = duplicates.push( i );
  1639. }
  1640. }
  1641. while ( j-- ) {
  1642. splice.call( results, duplicates[ j ], 1 );
  1643. }
  1644. }
  1645.  
  1646. // Clear input after sorting to release objects
  1647. // See https://github.com/jquery/sizzle/pull/225
  1648. sortInput = null;
  1649.  
  1650. return results;
  1651. };
  1652.  
  1653. jQuery.fn.uniqueSort = function() {
  1654. return this.pushStack( jQuery.uniqueSort( slice.apply( this ) ) );
  1655. };
  1656.  
  1657. Expr = jQuery.expr = {
  1658.  
  1659. // Can be adjusted by the user
  1660. cacheLength: 50,
  1661.  
  1662. createPseudo: markFunction,
  1663.  
  1664. match: matchExpr,
  1665.  
  1666. attrHandle: {},
  1667.  
  1668. find: {},
  1669.  
  1670. relative: {
  1671. ">": { dir: "parentNode", first: true },
  1672. " ": { dir: "parentNode" },
  1673. "+": { dir: "previousSibling", first: true },
  1674. "~": { dir: "previousSibling" }
  1675. },
  1676.  
  1677. preFilter: {
  1678. ATTR: function( match ) {
  1679. match[ 1 ] = match[ 1 ].replace( runescape, funescape );
  1680.  
  1681. // Move the given value to match[3] whether quoted or unquoted
  1682. match[ 3 ] = ( match[ 3 ] || match[ 4 ] || match[ 5 ] || "" )
  1683. .replace( runescape, funescape );
  1684.  
  1685. if ( match[ 2 ] === "~=" ) {
  1686. match[ 3 ] = " " + match[ 3 ] + " ";
  1687. }
  1688.  
  1689. return match.slice( 0, 4 );
  1690. },
  1691.  
  1692. CHILD: function( match ) {
  1693.  
  1694. /* matches from matchExpr["CHILD"]
  1695. 1 type (only|nth|...)
  1696. 2 what (child|of-type)
  1697. 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...)
  1698. 4 xn-component of xn+y argument ([+-]?\d*n|)
  1699. 5 sign of xn-component
  1700. 6 x of xn-component
  1701. 7 sign of y-component
  1702. 8 y of y-component
  1703. */
  1704. match[ 1 ] = match[ 1 ].toLowerCase();
  1705.  
  1706. if ( match[ 1 ].slice( 0, 3 ) === "nth" ) {
  1707.  
  1708. // nth-* requires argument
  1709. if ( !match[ 3 ] ) {
  1710. find.error( match[ 0 ] );
  1711. }
  1712.  
  1713. // numeric x and y parameters for Expr.filter.CHILD
  1714. // remember that false/true cast respectively to 0/1
  1715. match[ 4 ] = +( match[ 4 ] ?
  1716. match[ 5 ] + ( match[ 6 ] || 1 ) :
  1717. 2 * ( match[ 3 ] === "even" || match[ 3 ] === "odd" )
  1718. );
  1719. match[ 5 ] = +( ( match[ 7 ] + match[ 8 ] ) || match[ 3 ] === "odd" );
  1720.  
  1721. // other types prohibit arguments
  1722. } else if ( match[ 3 ] ) {
  1723. find.error( match[ 0 ] );
  1724. }
  1725.  
  1726. return match;
  1727. },
  1728.  
  1729. PSEUDO: function( match ) {
  1730. var excess,
  1731. unquoted = !match[ 6 ] && match[ 2 ];
  1732.  
  1733. if ( matchExpr.CHILD.test( match[ 0 ] ) ) {
  1734. return null;
  1735. }
  1736.  
  1737. // Accept quoted arguments as-is
  1738. if ( match[ 3 ] ) {
  1739. match[ 2 ] = match[ 4 ] || match[ 5 ] || "";
  1740.  
  1741. // Strip excess characters from unquoted arguments
  1742. } else if ( unquoted && rpseudo.test( unquoted ) &&
  1743.  
  1744. // Get excess from tokenize (recursively)
  1745. ( excess = tokenize( unquoted, true ) ) &&
  1746.  
  1747. // advance to the next closing parenthesis
  1748. ( excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length ) ) {
  1749.  
  1750. // excess is a negative index
  1751. match[ 0 ] = match[ 0 ].slice( 0, excess );
  1752. match[ 2 ] = unquoted.slice( 0, excess );
  1753. }
  1754.  
  1755. // Return only captures needed by the pseudo filter method (type and argument)
  1756. return match.slice( 0, 3 );
  1757. }
  1758. },
  1759.  
  1760. filter: {
  1761.  
  1762. TAG: function( nodeNameSelector ) {
  1763. var expectedNodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase();
  1764. return nodeNameSelector === "*" ?
  1765. function() {
  1766. return true;
  1767. } :
  1768. function( elem ) {
  1769. return nodeName( elem, expectedNodeName );
  1770. };
  1771. },
  1772.  
  1773. CLASS: function( className ) {
  1774. var pattern = classCache[ className + " " ];
  1775.  
  1776. return pattern ||
  1777. ( pattern = new RegExp( "(^|" + whitespace + ")" + className +
  1778. "(" + whitespace + "|$)" ) ) &&
  1779. classCache( className, function( elem ) {
  1780. return pattern.test(
  1781. typeof elem.className === "string" && elem.className ||
  1782. typeof elem.getAttribute !== "undefined" &&
  1783. elem.getAttribute( "class" ) ||
  1784. ""
  1785. );
  1786. } );
  1787. },
  1788.  
  1789. ATTR: function( name, operator, check ) {
  1790. return function( elem ) {
  1791. var result = find.attr( elem, name );
  1792.  
  1793. if ( result == null ) {
  1794. return operator === "!=";
  1795. }
  1796. if ( !operator ) {
  1797. return true;
  1798. }
  1799.  
  1800. result += "";
  1801.  
  1802. if ( operator === "=" ) {
  1803. return result === check;
  1804. }
  1805. if ( operator === "!=" ) {
  1806. return result !== check;
  1807. }
  1808. if ( operator === "^=" ) {
  1809. return check && result.indexOf( check ) === 0;
  1810. }
  1811. if ( operator === "*=" ) {
  1812. return check && result.indexOf( check ) > -1;
  1813. }
  1814. if ( operator === "$=" ) {
  1815. return check && result.slice( -check.length ) === check;
  1816. }
  1817. if ( operator === "~=" ) {
  1818. return ( " " + result.replace( rwhitespace, " " ) + " " )
  1819. .indexOf( check ) > -1;
  1820. }
  1821. if ( operator === "|=" ) {
  1822. return result === check || result.slice( 0, check.length + 1 ) === check + "-";
  1823. }
  1824.  
  1825. return false;
  1826. };
  1827. },
  1828.  
  1829. CHILD: function( type, what, _argument, first, last ) {
  1830. var simple = type.slice( 0, 3 ) !== "nth",
  1831. forward = type.slice( -4 ) !== "last",
  1832. ofType = what === "of-type";
  1833.  
  1834. return first === 1 && last === 0 ?
  1835.  
  1836. // Shortcut for :nth-*(n)
  1837. function( elem ) {
  1838. return !!elem.parentNode;
  1839. } :
  1840.  
  1841. function( elem, _context, xml ) {
  1842. var cache, outerCache, node, nodeIndex, start,
  1843. dir = simple !== forward ? "nextSibling" : "previousSibling",
  1844. parent = elem.parentNode,
  1845. name = ofType && elem.nodeName.toLowerCase(),
  1846. useCache = !xml && !ofType,
  1847. diff = false;
  1848.  
  1849. if ( parent ) {
  1850.  
  1851. // :(first|last|only)-(child|of-type)
  1852. if ( simple ) {
  1853. while ( dir ) {
  1854. node = elem;
  1855. while ( ( node = node[ dir ] ) ) {
  1856. if ( ofType ?
  1857. nodeName( node, name ) :
  1858. node.nodeType === 1 ) {
  1859.  
  1860. return false;
  1861. }
  1862. }
  1863.  
  1864. // Reverse direction for :only-* (if we haven't yet done so)
  1865. start = dir = type === "only" && !start && "nextSibling";
  1866. }
  1867. return true;
  1868. }
  1869.  
  1870. start = [ forward ? parent.firstChild : parent.lastChild ];
  1871.  
  1872. // non-xml :nth-child(...) stores cache data on `parent`
  1873. if ( forward && useCache ) {
  1874.  
  1875. // Seek `elem` from a previously-cached index
  1876. outerCache = parent[ expando ] || ( parent[ expando ] = {} );
  1877. cache = outerCache[ type ] || [];
  1878. nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
  1879. diff = nodeIndex && cache[ 2 ];
  1880. node = nodeIndex && parent.childNodes[ nodeIndex ];
  1881.  
  1882. while ( ( node = ++nodeIndex && node && node[ dir ] ||
  1883.  
  1884. // Fallback to seeking `elem` from the start
  1885. ( diff = nodeIndex = 0 ) || start.pop() ) ) {
  1886.  
  1887. // When found, cache indexes on `parent` and break
  1888. if ( node.nodeType === 1 && ++diff && node === elem ) {
  1889. outerCache[ type ] = [ dirruns, nodeIndex, diff ];
  1890. break;
  1891. }
  1892. }
  1893.  
  1894. } else {
  1895.  
  1896. // Use previously-cached element index if available
  1897. if ( useCache ) {
  1898. outerCache = elem[ expando ] || ( elem[ expando ] = {} );
  1899. cache = outerCache[ type ] || [];
  1900. nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
  1901. diff = nodeIndex;
  1902. }
  1903.  
  1904. // xml :nth-child(...)
  1905. // or :nth-last-child(...) or :nth(-last)?-of-type(...)
  1906. if ( diff === false ) {
  1907.  
  1908. // Use the same loop as above to seek `elem` from the start
  1909. while ( ( node = ++nodeIndex && node && node[ dir ] ||
  1910. ( diff = nodeIndex = 0 ) || start.pop() ) ) {
  1911.  
  1912. if ( ( ofType ?
  1913. nodeName( node, name ) :
  1914. node.nodeType === 1 ) &&
  1915. ++diff ) {
  1916.  
  1917. // Cache the index of each encountered element
  1918. if ( useCache ) {
  1919. outerCache = node[ expando ] ||
  1920. ( node[ expando ] = {} );
  1921. outerCache[ type ] = [ dirruns, diff ];
  1922. }
  1923.  
  1924. if ( node === elem ) {
  1925. break;
  1926. }
  1927. }
  1928. }
  1929. }
  1930. }
  1931.  
  1932. // Incorporate the offset, then check against cycle size
  1933. diff -= last;
  1934. return diff === first || ( diff % first === 0 && diff / first >= 0 );
  1935. }
  1936. };
  1937. },
  1938.  
  1939. PSEUDO: function( pseudo, argument ) {
  1940.  
  1941. // pseudo-class names are case-insensitive
  1942. // https://www.w3.org/TR/selectors/#pseudo-classes
  1943. // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
  1944. // Remember that setFilters inherits from pseudos
  1945. var args,
  1946. fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] ||
  1947. find.error( "unsupported pseudo: " + pseudo );
  1948.  
  1949. // The user may use createPseudo to indicate that
  1950. // arguments are needed to create the filter function
  1951. // just as jQuery does
  1952. if ( fn[ expando ] ) {
  1953. return fn( argument );
  1954. }
  1955.  
  1956. // But maintain support for old signatures
  1957. if ( fn.length > 1 ) {
  1958. args = [ pseudo, pseudo, "", argument ];
  1959. return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ?
  1960. markFunction( function( seed, matches ) {
  1961. var idx,
  1962. matched = fn( seed, argument ),
  1963. i = matched.length;
  1964. while ( i-- ) {
  1965. idx = indexOf.call( seed, matched[ i ] );
  1966. seed[ idx ] = !( matches[ idx ] = matched[ i ] );
  1967. }
  1968. } ) :
  1969. function( elem ) {
  1970. return fn( elem, 0, args );
  1971. };
  1972. }
  1973.  
  1974. return fn;
  1975. }
  1976. },
  1977.  
  1978. pseudos: {
  1979.  
  1980. // Potentially complex pseudos
  1981. not: markFunction( function( selector ) {
  1982.  
  1983. // Trim the selector passed to compile
  1984. // to avoid treating leading and trailing
  1985. // spaces as combinators
  1986. var input = [],
  1987. results = [],
  1988. matcher = compile( selector.replace( rtrimCSS, "$1" ) );
  1989.  
  1990. return matcher[ expando ] ?
  1991. markFunction( function( seed, matches, _context, xml ) {
  1992. var elem,
  1993. unmatched = matcher( seed, null, xml, [] ),
  1994. i = seed.length;
  1995.  
  1996. // Match elements unmatched by `matcher`
  1997. while ( i-- ) {
  1998. if ( ( elem = unmatched[ i ] ) ) {
  1999. seed[ i ] = !( matches[ i ] = elem );
  2000. }
  2001. }
  2002. } ) :
  2003. function( elem, _context, xml ) {
  2004. input[ 0 ] = elem;
  2005. matcher( input, null, xml, results );
  2006.  
  2007. // Don't keep the element
  2008. // (see https://github.com/jquery/sizzle/issues/299)
  2009. input[ 0 ] = null;
  2010. return !results.pop();
  2011. };
  2012. } ),
  2013.  
  2014. has: markFunction( function( selector ) {
  2015. return function( elem ) {
  2016. return find( selector, elem ).length > 0;
  2017. };
  2018. } ),
  2019.  
  2020. contains: markFunction( function( text ) {
  2021. text = text.replace( runescape, funescape );
  2022. return function( elem ) {
  2023. return ( elem.textContent || jQuery.text( elem ) ).indexOf( text ) > -1;
  2024. };
  2025. } ),
  2026.  
  2027. // "Whether an element is represented by a :lang() selector
  2028. // is based solely on the element's language value
  2029. // being equal to the identifier C,
  2030. // or beginning with the identifier C immediately followed by "-".
  2031. // The matching of C against the element's language value is performed case-insensitively.
  2032. // The identifier C does not have to be a valid language name."
  2033. // https://www.w3.org/TR/selectors/#lang-pseudo
  2034. lang: markFunction( function( lang ) {
  2035.  
  2036. // lang value must be a valid identifier
  2037. if ( !ridentifier.test( lang || "" ) ) {
  2038. find.error( "unsupported lang: " + lang );
  2039. }
  2040. lang = lang.replace( runescape, funescape ).toLowerCase();
  2041. return function( elem ) {
  2042. var elemLang;
  2043. do {
  2044. if ( ( elemLang = documentIsHTML ?
  2045. elem.lang :
  2046. elem.getAttribute( "xml:lang" ) || elem.getAttribute( "lang" ) ) ) {
  2047.  
  2048. elemLang = elemLang.toLowerCase();
  2049. return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0;
  2050. }
  2051. } while ( ( elem = elem.parentNode ) && elem.nodeType === 1 );
  2052. return false;
  2053. };
  2054. } ),
  2055.  
  2056. // Miscellaneous
  2057. target: function( elem ) {
  2058. var hash = window.location && window.location.hash;
  2059. return hash && hash.slice( 1 ) === elem.id;
  2060. },
  2061.  
  2062. root: function( elem ) {
  2063. return elem === documentElement;
  2064. },
  2065.  
  2066. focus: function( elem ) {
  2067. return elem === safeActiveElement() &&
  2068. document.hasFocus() &&
  2069. !!( elem.type || elem.href || ~elem.tabIndex );
  2070. },
  2071.  
  2072. // Boolean properties
  2073. enabled: createDisabledPseudo( false ),
  2074. disabled: createDisabledPseudo( true ),
  2075.  
  2076. checked: function( elem ) {
  2077.  
  2078. // In CSS3, :checked should return both checked and selected elements
  2079. // https://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  2080. return ( nodeName( elem, "input" ) && !!elem.checked ) ||
  2081. ( nodeName( elem, "option" ) && !!elem.selected );
  2082. },
  2083.  
  2084. selected: function( elem ) {
  2085.  
  2086. // Support: IE <=11+
  2087. // Accessing the selectedIndex property
  2088. // forces the browser to treat the default option as
  2089. // selected when in an optgroup.
  2090. if ( elem.parentNode ) {
  2091. // eslint-disable-next-line no-unused-expressions
  2092. elem.parentNode.selectedIndex;
  2093. }
  2094.  
  2095. return elem.selected === true;
  2096. },
  2097.  
  2098. // Contents
  2099. empty: function( elem ) {
  2100.  
  2101. // https://www.w3.org/TR/selectors/#empty-pseudo
  2102. // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5),
  2103. // but not by others (comment: 8; processing instruction: 7; etc.)
  2104. // nodeType < 6 works because attributes (2) do not appear as children
  2105. for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
  2106. if ( elem.nodeType < 6 ) {
  2107. return false;
  2108. }
  2109. }
  2110. return true;
  2111. },
  2112.  
  2113. parent: function( elem ) {
  2114. return !Expr.pseudos.empty( elem );
  2115. },
  2116.  
  2117. // Element/input types
  2118. header: function( elem ) {
  2119. return rheader.test( elem.nodeName );
  2120. },
  2121.  
  2122. input: function( elem ) {
  2123. return rinputs.test( elem.nodeName );
  2124. },
  2125.  
  2126. button: function( elem ) {
  2127. return nodeName( elem, "input" ) && elem.type === "button" ||
  2128. nodeName( elem, "button" );
  2129. },
  2130.  
  2131. text: function( elem ) {
  2132. var attr;
  2133. return nodeName( elem, "input" ) && elem.type === "text" &&
  2134.  
  2135. // Support: IE <10 only
  2136. // New HTML5 attribute values (e.g., "search") appear
  2137. // with elem.type === "text"
  2138. ( ( attr = elem.getAttribute( "type" ) ) == null ||
  2139. attr.toLowerCase() === "text" );
  2140. },
  2141.  
  2142. // Position-in-collection
  2143. first: createPositionalPseudo( function() {
  2144. return [ 0 ];
  2145. } ),
  2146.  
  2147. last: createPositionalPseudo( function( _matchIndexes, length ) {
  2148. return [ length - 1 ];
  2149. } ),
  2150.  
  2151. eq: createPositionalPseudo( function( _matchIndexes, length, argument ) {
  2152. return [ argument < 0 ? argument + length : argument ];
  2153. } ),
  2154.  
  2155. even: createPositionalPseudo( function( matchIndexes, length ) {
  2156. var i = 0;
  2157. for ( ; i < length; i += 2 ) {
  2158. matchIndexes.push( i );
  2159. }
  2160. return matchIndexes;
  2161. } ),
  2162.  
  2163. odd: createPositionalPseudo( function( matchIndexes, length ) {
  2164. var i = 1;
  2165. for ( ; i < length; i += 2 ) {
  2166. matchIndexes.push( i );
  2167. }
  2168. return matchIndexes;
  2169. } ),
  2170.  
  2171. lt: createPositionalPseudo( function( matchIndexes, length, argument ) {
  2172. var i;
  2173.  
  2174. if ( argument < 0 ) {
  2175. i = argument + length;
  2176. } else if ( argument > length ) {
  2177. i = length;
  2178. } else {
  2179. i = argument;
  2180. }
  2181.  
  2182. for ( ; --i >= 0; ) {
  2183. matchIndexes.push( i );
  2184. }
  2185. return matchIndexes;
  2186. } ),
  2187.  
  2188. gt: createPositionalPseudo( function( matchIndexes, length, argument ) {
  2189. var i = argument < 0 ? argument + length : argument;
  2190. for ( ; ++i < length; ) {
  2191. matchIndexes.push( i );
  2192. }
  2193. return matchIndexes;
  2194. } )
  2195. }
  2196. };
  2197.  
  2198. Expr.pseudos.nth = Expr.pseudos.eq;
  2199.  
  2200. // Add button/input type pseudos
  2201. for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) {
  2202. Expr.pseudos[ i ] = createInputPseudo( i );
  2203. }
  2204. for ( i in { submit: true, reset: true } ) {
  2205. Expr.pseudos[ i ] = createButtonPseudo( i );
  2206. }
  2207.  
  2208. // Easy API for creating new setFilters
  2209. function setFilters() {}
  2210. setFilters.prototype = Expr.filters = Expr.pseudos;
  2211. Expr.setFilters = new setFilters();
  2212.  
  2213. function tokenize( selector, parseOnly ) {
  2214. var matched, match, tokens, type,
  2215. soFar, groups, preFilters,
  2216. cached = tokenCache[ selector + " " ];
  2217.  
  2218. if ( cached ) {
  2219. return parseOnly ? 0 : cached.slice( 0 );
  2220. }
  2221.  
  2222. soFar = selector;
  2223. groups = [];
  2224. preFilters = Expr.preFilter;
  2225.  
  2226. while ( soFar ) {
  2227.  
  2228. // Comma and first run
  2229. if ( !matched || ( match = rcomma.exec( soFar ) ) ) {
  2230. if ( match ) {
  2231.  
  2232. // Don't consume trailing commas as valid
  2233. soFar = soFar.slice( match[ 0 ].length ) || soFar;
  2234. }
  2235. groups.push( ( tokens = [] ) );
  2236. }
  2237.  
  2238. matched = false;
  2239.  
  2240. // Combinators
  2241. if ( ( match = rleadingCombinator.exec( soFar ) ) ) {
  2242. matched = match.shift();
  2243. tokens.push( {
  2244. value: matched,
  2245.  
  2246. // Cast descendant combinators to space
  2247. type: match[ 0 ].replace( rtrimCSS, " " )
  2248. } );
  2249. soFar = soFar.slice( matched.length );
  2250. }
  2251.  
  2252. // Filters
  2253. for ( type in Expr.filter ) {
  2254. if ( ( match = matchExpr[ type ].exec( soFar ) ) && ( !preFilters[ type ] ||
  2255. ( match = preFilters[ type ]( match ) ) ) ) {
  2256. matched = match.shift();
  2257. tokens.push( {
  2258. value: matched,
  2259. type: type,
  2260. matches: match
  2261. } );
  2262. soFar = soFar.slice( matched.length );
  2263. }
  2264. }
  2265.  
  2266. if ( !matched ) {
  2267. break;
  2268. }
  2269. }
  2270.  
  2271. // Return the length of the invalid excess
  2272. // if we're just parsing
  2273. // Otherwise, throw an error or return tokens
  2274. if ( parseOnly ) {
  2275. return soFar.length;
  2276. }
  2277.  
  2278. return soFar ?
  2279. find.error( selector ) :
  2280.  
  2281. // Cache the tokens
  2282. tokenCache( selector, groups ).slice( 0 );
  2283. }
  2284.  
  2285. function toSelector( tokens ) {
  2286. var i = 0,
  2287. len = tokens.length,
  2288. selector = "";
  2289. for ( ; i < len; i++ ) {
  2290. selector += tokens[ i ].value;
  2291. }
  2292. return selector;
  2293. }
  2294.  
  2295. function addCombinator( matcher, combinator, base ) {
  2296. var dir = combinator.dir,
  2297. skip = combinator.next,
  2298. key = skip || dir,
  2299. checkNonElements = base && key === "parentNode",
  2300. doneName = done++;
  2301.  
  2302. return combinator.first ?
  2303.  
  2304. // Check against closest ancestor/preceding element
  2305. function( elem, context, xml ) {
  2306. while ( ( elem = elem[ dir ] ) ) {
  2307. if ( elem.nodeType === 1 || checkNonElements ) {
  2308. return matcher( elem, context, xml );
  2309. }
  2310. }
  2311. return false;
  2312. } :
  2313.  
  2314. // Check against all ancestor/preceding elements
  2315. function( elem, context, xml ) {
  2316. var oldCache, outerCache,
  2317. newCache = [ dirruns, doneName ];
  2318.  
  2319. // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching
  2320. if ( xml ) {
  2321. while ( ( elem = elem[ dir ] ) ) {
  2322. if ( elem.nodeType === 1 || checkNonElements ) {
  2323. if ( matcher( elem, context, xml ) ) {
  2324. return true;
  2325. }
  2326. }
  2327. }
  2328. } else {
  2329. while ( ( elem = elem[ dir ] ) ) {
  2330. if ( elem.nodeType === 1 || checkNonElements ) {
  2331. outerCache = elem[ expando ] || ( elem[ expando ] = {} );
  2332.  
  2333. if ( skip && nodeName( elem, skip ) ) {
  2334. elem = elem[ dir ] || elem;
  2335. } else if ( ( oldCache = outerCache[ key ] ) &&
  2336. oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) {
  2337.  
  2338. // Assign to newCache so results back-propagate to previous elements
  2339. return ( newCache[ 2 ] = oldCache[ 2 ] );
  2340. } else {
  2341.  
  2342. // Reuse newcache so results back-propagate to previous elements
  2343. outerCache[ key ] = newCache;
  2344.  
  2345. // A match means we're done; a fail means we have to keep checking
  2346. if ( ( newCache[ 2 ] = matcher( elem, context, xml ) ) ) {
  2347. return true;
  2348. }
  2349. }
  2350. }
  2351. }
  2352. }
  2353. return false;
  2354. };
  2355. }
  2356.  
  2357. function elementMatcher( matchers ) {
  2358. return matchers.length > 1 ?
  2359. function( elem, context, xml ) {
  2360. var i = matchers.length;
  2361. while ( i-- ) {
  2362. if ( !matchers[ i ]( elem, context, xml ) ) {
  2363. return false;
  2364. }
  2365. }
  2366. return true;
  2367. } :
  2368. matchers[ 0 ];
  2369. }
  2370.  
  2371. function multipleContexts( selector, contexts, results ) {
  2372. var i = 0,
  2373. len = contexts.length;
  2374. for ( ; i < len; i++ ) {
  2375. find( selector, contexts[ i ], results );
  2376. }
  2377. return results;
  2378. }
  2379.  
  2380. function condense( unmatched, map, filter, context, xml ) {
  2381. var elem,
  2382. newUnmatched = [],
  2383. i = 0,
  2384. len = unmatched.length,
  2385. mapped = map != null;
  2386.  
  2387. for ( ; i < len; i++ ) {
  2388. if ( ( elem = unmatched[ i ] ) ) {
  2389. if ( !filter || filter( elem, context, xml ) ) {
  2390. newUnmatched.push( elem );
  2391. if ( mapped ) {
  2392. map.push( i );
  2393. }
  2394. }
  2395. }
  2396. }
  2397.  
  2398. return newUnmatched;
  2399. }
  2400.  
  2401. function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {
  2402. if ( postFilter && !postFilter[ expando ] ) {
  2403. postFilter = setMatcher( postFilter );
  2404. }
  2405. if ( postFinder && !postFinder[ expando ] ) {
  2406. postFinder = setMatcher( postFinder, postSelector );
  2407. }
  2408. return markFunction( function( seed, results, context, xml ) {
  2409. var temp, i, elem, matcherOut,
  2410. preMap = [],
  2411. postMap = [],
  2412. preexisting = results.length,
  2413.  
  2414. // Get initial elements from seed or context
  2415. elems = seed ||
  2416. multipleContexts( selector || "*",
  2417. context.nodeType ? [ context ] : context, [] ),
  2418.  
  2419. // Prefilter to get matcher input, preserving a map for seed-results synchronization
  2420. matcherIn = preFilter && ( seed || !selector ) ?
  2421. condense( elems, preMap, preFilter, context, xml ) :
  2422. elems;
  2423.  
  2424. if ( matcher ) {
  2425.  
  2426. // If we have a postFinder, or filtered seed, or non-seed postFilter
  2427. // or preexisting results,
  2428. matcherOut = postFinder || ( seed ? preFilter : preexisting || postFilter ) ?
  2429.  
  2430. // ...intermediate processing is necessary
  2431. [] :
  2432.  
  2433. // ...otherwise use results directly
  2434. results;
  2435.  
  2436. // Find primary matches
  2437. matcher( matcherIn, matcherOut, context, xml );
  2438. } else {
  2439. matcherOut = matcherIn;
  2440. }
  2441.  
  2442. // Apply postFilter
  2443. if ( postFilter ) {
  2444. temp = condense( matcherOut, postMap );
  2445. postFilter( temp, [], context, xml );
  2446.  
  2447. // Un-match failing elements by moving them back to matcherIn
  2448. i = temp.length;
  2449. while ( i-- ) {
  2450. if ( ( elem = temp[ i ] ) ) {
  2451. matcherOut[ postMap[ i ] ] = !( matcherIn[ postMap[ i ] ] = elem );
  2452. }
  2453. }
  2454. }
  2455.  
  2456. if ( seed ) {
  2457. if ( postFinder || preFilter ) {
  2458. if ( postFinder ) {
  2459.  
  2460. // Get the final matcherOut by condensing this intermediate into postFinder contexts
  2461. temp = [];
  2462. i = matcherOut.length;
  2463. while ( i-- ) {
  2464. if ( ( elem = matcherOut[ i ] ) ) {
  2465.  
  2466. // Restore matcherIn since elem is not yet a final match
  2467. temp.push( ( matcherIn[ i ] = elem ) );
  2468. }
  2469. }
  2470. postFinder( null, ( matcherOut = [] ), temp, xml );
  2471. }
  2472.  
  2473. // Move matched elements from seed to results to keep them synchronized
  2474. i = matcherOut.length;
  2475. while ( i-- ) {
  2476. if ( ( elem = matcherOut[ i ] ) &&
  2477. ( temp = postFinder ? indexOf.call( seed, elem ) : preMap[ i ] ) > -1 ) {
  2478.  
  2479. seed[ temp ] = !( results[ temp ] = elem );
  2480. }
  2481. }
  2482. }
  2483.  
  2484. // Add elements to results, through postFinder if defined
  2485. } else {
  2486. matcherOut = condense(
  2487. matcherOut === results ?
  2488. matcherOut.splice( preexisting, matcherOut.length ) :
  2489. matcherOut
  2490. );
  2491. if ( postFinder ) {
  2492. postFinder( null, results, matcherOut, xml );
  2493. } else {
  2494. push.apply( results, matcherOut );
  2495. }
  2496. }
  2497. } );
  2498. }
  2499.  
  2500. function matcherFromTokens( tokens ) {
  2501. var checkContext, matcher, j,
  2502. len = tokens.length,
  2503. leadingRelative = Expr.relative[ tokens[ 0 ].type ],
  2504. implicitRelative = leadingRelative || Expr.relative[ " " ],
  2505. i = leadingRelative ? 1 : 0,
  2506.  
  2507. // The foundational matcher ensures that elements are reachable from top-level context(s)
  2508. matchContext = addCombinator( function( elem ) {
  2509. return elem === checkContext;
  2510. }, implicitRelative, true ),
  2511. matchAnyContext = addCombinator( function( elem ) {
  2512. return indexOf.call( checkContext, elem ) > -1;
  2513. }, implicitRelative, true ),
  2514. matchers = [ function( elem, context, xml ) {
  2515.  
  2516. // Support: IE 11+, Edge 17 - 18+
  2517. // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
  2518. // two documents; shallow comparisons work.
  2519. // eslint-disable-next-line eqeqeq
  2520. var ret = ( !leadingRelative && ( xml || context != outermostContext ) ) || (
  2521. ( checkContext = context ).nodeType ?
  2522. matchContext( elem, context, xml ) :
  2523. matchAnyContext( elem, context, xml ) );
  2524.  
  2525. // Avoid hanging onto element
  2526. // (see https://github.com/jquery/sizzle/issues/299)
  2527. checkContext = null;
  2528. return ret;
  2529. } ];
  2530.  
  2531. for ( ; i < len; i++ ) {
  2532. if ( ( matcher = Expr.relative[ tokens[ i ].type ] ) ) {
  2533. matchers = [ addCombinator( elementMatcher( matchers ), matcher ) ];
  2534. } else {
  2535. matcher = Expr.filter[ tokens[ i ].type ].apply( null, tokens[ i ].matches );
  2536.  
  2537. // Return special upon seeing a positional matcher
  2538. if ( matcher[ expando ] ) {
  2539.  
  2540. // Find the next relative operator (if any) for proper handling
  2541. j = ++i;
  2542. for ( ; j < len; j++ ) {
  2543. if ( Expr.relative[ tokens[ j ].type ] ) {
  2544. break;
  2545. }
  2546. }
  2547. return setMatcher(
  2548. i > 1 && elementMatcher( matchers ),
  2549. i > 1 && toSelector(
  2550.  
  2551. // If the preceding token was a descendant combinator, insert an implicit any-element `*`
  2552. tokens.slice( 0, i - 1 )
  2553. .concat( { value: tokens[ i - 2 ].type === " " ? "*" : "" } )
  2554. ).replace( rtrimCSS, "$1" ),
  2555. matcher,
  2556. i < j && matcherFromTokens( tokens.slice( i, j ) ),
  2557. j < len && matcherFromTokens( ( tokens = tokens.slice( j ) ) ),
  2558. j < len && toSelector( tokens )
  2559. );
  2560. }
  2561. matchers.push( matcher );
  2562. }
  2563. }
  2564.  
  2565. return elementMatcher( matchers );
  2566. }
  2567.  
  2568. function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
  2569. var bySet = setMatchers.length > 0,
  2570. byElement = elementMatchers.length > 0,
  2571. superMatcher = function( seed, context, xml, results, outermost ) {
  2572. var elem, j, matcher,
  2573. matchedCount = 0,
  2574. i = "0",
  2575. unmatched = seed && [],
  2576. setMatched = [],
  2577. contextBackup = outermostContext,
  2578.  
  2579. // We must always have either seed elements or outermost context
  2580. elems = seed || byElement && Expr.find.TAG( "*", outermost ),
  2581.  
  2582. // Use integer dirruns iff this is the outermost matcher
  2583. dirrunsUnique = ( dirruns += contextBackup == null ? 1 : Math.random() || 0.1 ),
  2584. len = elems.length;
  2585.  
  2586. if ( outermost ) {
  2587.  
  2588. // Support: IE 11+, Edge 17 - 18+
  2589. // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
  2590. // two documents; shallow comparisons work.
  2591. // eslint-disable-next-line eqeqeq
  2592. outermostContext = context == document || context || outermost;
  2593. }
  2594.  
  2595. // Add elements passing elementMatchers directly to results
  2596. // Support: iOS <=7 - 9 only
  2597. // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching
  2598. // elements by id. (see trac-14142)
  2599. for ( ; i !== len && ( elem = elems[ i ] ) != null; i++ ) {
  2600. if ( byElement && elem ) {
  2601. j = 0;
  2602.  
  2603. // Support: IE 11+, Edge 17 - 18+
  2604. // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
  2605. // two documents; shallow comparisons work.
  2606. // eslint-disable-next-line eqeqeq
  2607. if ( !context && elem.ownerDocument != document ) {
  2608. setDocument( elem );
  2609. xml = !documentIsHTML;
  2610. }
  2611. while ( ( matcher = elementMatchers[ j++ ] ) ) {
  2612. if ( matcher( elem, context || document, xml ) ) {
  2613. push.call( results, elem );
  2614. break;
  2615. }
  2616. }
  2617. if ( outermost ) {
  2618. dirruns = dirrunsUnique;
  2619. }
  2620. }
  2621.  
  2622. // Track unmatched elements for set filters
  2623. if ( bySet ) {
  2624.  
  2625. // They will have gone through all possible matchers
  2626. if ( ( elem = !matcher && elem ) ) {
  2627. matchedCount--;
  2628. }
  2629.  
  2630. // Lengthen the array for every element, matched or not
  2631. if ( seed ) {
  2632. unmatched.push( elem );
  2633. }
  2634. }
  2635. }
  2636.  
  2637. // `i` is now the count of elements visited above, and adding it to `matchedCount`
  2638. // makes the latter nonnegative.
  2639. matchedCount += i;
  2640.  
  2641. // Apply set filters to unmatched elements
  2642. // NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount`
  2643. // equals `i`), unless we didn't visit _any_ elements in the above loop because we have
  2644. // no element matchers and no seed.
  2645. // Incrementing an initially-string "0" `i` allows `i` to remain a string only in that
  2646. // case, which will result in a "00" `matchedCount` that differs from `i` but is also
  2647. // numerically zero.
  2648. if ( bySet && i !== matchedCount ) {
  2649. j = 0;
  2650. while ( ( matcher = setMatchers[ j++ ] ) ) {
  2651. matcher( unmatched, setMatched, context, xml );
  2652. }
  2653.  
  2654. if ( seed ) {
  2655.  
  2656. // Reintegrate element matches to eliminate the need for sorting
  2657. if ( matchedCount > 0 ) {
  2658. while ( i-- ) {
  2659. if ( !( unmatched[ i ] || setMatched[ i ] ) ) {
  2660. setMatched[ i ] = pop.call( results );
  2661. }
  2662. }
  2663. }
  2664.  
  2665. // Discard index placeholder values to get only actual matches
  2666. setMatched = condense( setMatched );
  2667. }
  2668.  
  2669. // Add matches to results
  2670. push.apply( results, setMatched );
  2671.  
  2672. // Seedless set matches succeeding multiple successful matchers stipulate sorting
  2673. if ( outermost && !seed && setMatched.length > 0 &&
  2674. ( matchedCount + setMatchers.length ) > 1 ) {
  2675.  
  2676. jQuery.uniqueSort( results );
  2677. }
  2678. }
  2679.  
  2680. // Override manipulation of globals by nested matchers
  2681. if ( outermost ) {
  2682. dirruns = dirrunsUnique;
  2683. outermostContext = contextBackup;
  2684. }
  2685.  
  2686. return unmatched;
  2687. };
  2688.  
  2689. return bySet ?
  2690. markFunction( superMatcher ) :
  2691. superMatcher;
  2692. }
  2693.  
  2694. function compile( selector, match /* Internal Use Only */ ) {
  2695. var i,
  2696. setMatchers = [],
  2697. elementMatchers = [],
  2698. cached = compilerCache[ selector + " " ];
  2699.  
  2700. if ( !cached ) {
  2701.  
  2702. // Generate a function of recursive functions that can be used to check each element
  2703. if ( !match ) {
  2704. match = tokenize( selector );
  2705. }
  2706. i = match.length;
  2707. while ( i-- ) {
  2708. cached = matcherFromTokens( match[ i ] );
  2709. if ( cached[ expando ] ) {
  2710. setMatchers.push( cached );
  2711. } else {
  2712. elementMatchers.push( cached );
  2713. }
  2714. }
  2715.  
  2716. // Cache the compiled function
  2717. cached = compilerCache( selector,
  2718. matcherFromGroupMatchers( elementMatchers, setMatchers ) );
  2719.  
  2720. // Save selector and tokenization
  2721. cached.selector = selector;
  2722. }
  2723. return cached;
  2724. }
  2725.  
  2726. /**
  2727. * A low-level selection function that works with jQuery's compiled
  2728. * selector functions
  2729. * @param {String|Function} selector A selector or a pre-compiled
  2730. * selector function built with jQuery selector compile
  2731. * @param {Element} context
  2732. * @param {Array} [results]
  2733. * @param {Array} [seed] A set of elements to match against
  2734. */
  2735. function select( selector, context, results, seed ) {
  2736. var i, tokens, token, type, find,
  2737. compiled = typeof selector === "function" && selector,
  2738. match = !seed && tokenize( ( selector = compiled.selector || selector ) );
  2739.  
  2740. results = results || [];
  2741.  
  2742. // Try to minimize operations if there is only one selector in the list and no seed
  2743. // (the latter of which guarantees us context)
  2744. if ( match.length === 1 ) {
  2745.  
  2746. // Reduce context if the leading compound selector is an ID
  2747. tokens = match[ 0 ] = match[ 0 ].slice( 0 );
  2748. if ( tokens.length > 2 && ( token = tokens[ 0 ] ).type === "ID" &&
  2749. context.nodeType === 9 && documentIsHTML && Expr.relative[ tokens[ 1 ].type ] ) {
  2750.  
  2751. context = ( Expr.find.ID(
  2752. token.matches[ 0 ].replace( runescape, funescape ),
  2753. context
  2754. ) || [] )[ 0 ];
  2755. if ( !context ) {
  2756. return results;
  2757.  
  2758. // Precompiled matchers will still verify ancestry, so step up a level
  2759. } else if ( compiled ) {
  2760. context = context.parentNode;
  2761. }
  2762.  
  2763. selector = selector.slice( tokens.shift().value.length );
  2764. }
  2765.  
  2766. // Fetch a seed set for right-to-left matching
  2767. i = matchExpr.needsContext.test( selector ) ? 0 : tokens.length;
  2768. while ( i-- ) {
  2769. token = tokens[ i ];
  2770.  
  2771. // Abort if we hit a combinator
  2772. if ( Expr.relative[ ( type = token.type ) ] ) {
  2773. break;
  2774. }
  2775. if ( ( find = Expr.find[ type ] ) ) {
  2776.  
  2777. // Search, expanding context for leading sibling combinators
  2778. if ( ( seed = find(
  2779. token.matches[ 0 ].replace( runescape, funescape ),
  2780. rsibling.test( tokens[ 0 ].type ) &&
  2781. testContext( context.parentNode ) || context
  2782. ) ) ) {
  2783.  
  2784. // If seed is empty or no tokens remain, we can return early
  2785. tokens.splice( i, 1 );
  2786. selector = seed.length && toSelector( tokens );
  2787. if ( !selector ) {
  2788. push.apply( results, seed );
  2789. return results;
  2790. }
  2791.  
  2792. break;
  2793. }
  2794. }
  2795. }
  2796. }
  2797.  
  2798. // Compile and execute a filtering function if one is not provided
  2799. // Provide `match` to avoid retokenization if we modified the selector above
  2800. ( compiled || compile( selector, match ) )(
  2801. seed,
  2802. context,
  2803. !documentIsHTML,
  2804. results,
  2805. !context || rsibling.test( selector ) && testContext( context.parentNode ) || context
  2806. );
  2807. return results;
  2808. }
  2809.  
  2810. // One-time assignments
  2811.  
  2812. // Support: Android <=4.0 - 4.1+
  2813. // Sort stability
  2814. support.sortStable = expando.split( "" ).sort( sortOrder ).join( "" ) === expando;
  2815.  
  2816. // Initialize against the default document
  2817. setDocument();
  2818.  
  2819. // Support: Android <=4.0 - 4.1+
  2820. // Detached nodes confoundingly follow *each other*
  2821. support.sortDetached = assert( function( el ) {
  2822.  
  2823. // Should return 1, but returns 4 (following)
  2824. return el.compareDocumentPosition( document.createElement( "fieldset" ) ) & 1;
  2825. } );
  2826.  
  2827. jQuery.find = find;
  2828.  
  2829. // Deprecated
  2830. jQuery.expr[ ":" ] = jQuery.expr.pseudos;
  2831. jQuery.unique = jQuery.uniqueSort;
  2832.  
  2833. // These have always been private, but they used to be documented as part of
  2834. // Sizzle so let's maintain them for now for backwards compatibility purposes.
  2835. find.compile = compile;
  2836. find.select = select;
  2837. find.setDocument = setDocument;
  2838. find.tokenize = tokenize;
  2839.  
  2840. find.escape = jQuery.escapeSelector;
  2841. find.getText = jQuery.text;
  2842. find.isXML = jQuery.isXMLDoc;
  2843. find.selectors = jQuery.expr;
  2844. find.support = jQuery.support;
  2845. find.uniqueSort = jQuery.uniqueSort;
  2846.  
  2847. /* eslint-enable */
  2848.  
  2849. } )();
  2850.  
  2851.  
  2852. var dir = function( elem, dir, until ) {
  2853. var matched = [],
  2854. truncate = until !== undefined;
  2855.  
  2856. while ( ( elem = elem[ dir ] ) && elem.nodeType !== 9 ) {
  2857. if ( elem.nodeType === 1 ) {
  2858. if ( truncate && jQuery( elem ).is( until ) ) {
  2859. break;
  2860. }
  2861. matched.push( elem );
  2862. }
  2863. }
  2864. return matched;
  2865. };
  2866.  
  2867.  
  2868. var siblings = function( n, elem ) {
  2869. var matched = [];
  2870.  
  2871. for ( ; n; n = n.nextSibling ) {
  2872. if ( n.nodeType === 1 && n !== elem ) {
  2873. matched.push( n );
  2874. }
  2875. }
  2876.  
  2877. return matched;
  2878. };
  2879.  
  2880.  
  2881. var rneedsContext = jQuery.expr.match.needsContext;
  2882.  
  2883. var rsingleTag = ( /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i );
  2884.  
  2885.  
  2886.  
  2887. // Implement the identical functionality for filter and not
  2888. function winnow( elements, qualifier, not ) {
  2889. if ( isFunction( qualifier ) ) {
  2890. return jQuery.grep( elements, function( elem, i ) {
  2891. return !!qualifier.call( elem, i, elem ) !== not;
  2892. } );
  2893. }
  2894.  
  2895. // Single element
  2896. if ( qualifier.nodeType ) {
  2897. return jQuery.grep( elements, function( elem ) {
  2898. return ( elem === qualifier ) !== not;
  2899. } );
  2900. }
  2901.  
  2902. // Arraylike of elements (jQuery, arguments, Array)
  2903. if ( typeof qualifier !== "string" ) {
  2904. return jQuery.grep( elements, function( elem ) {
  2905. return ( indexOf.call( qualifier, elem ) > -1 ) !== not;
  2906. } );
  2907. }
  2908.  
  2909. // Filtered directly for both simple and complex selectors
  2910. return jQuery.filter( qualifier, elements, not );
  2911. }
  2912.  
  2913. jQuery.filter = function( expr, elems, not ) {
  2914. var elem = elems[ 0 ];
  2915.  
  2916. if ( not ) {
  2917. expr = ":not(" + expr + ")";
  2918. }
  2919.  
  2920. if ( elems.length === 1 && elem.nodeType === 1 ) {
  2921. return jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [];
  2922. }
  2923.  
  2924. return jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) {
  2925. return elem.nodeType === 1;
  2926. } ) );
  2927. };
  2928.  
  2929. jQuery.fn.extend( {
  2930. find: function( selector ) {
  2931. var i, ret,
  2932. len = this.length,
  2933. self = this;
  2934.  
  2935. if ( typeof selector !== "string" ) {
  2936. return this.pushStack( jQuery( selector ).filter( function() {
  2937. for ( i = 0; i < len; i++ ) {
  2938. if ( jQuery.contains( self[ i ], this ) ) {
  2939. return true;
  2940. }
  2941. }
  2942. } ) );
  2943. }
  2944.  
  2945. ret = this.pushStack( [] );
  2946.  
  2947. for ( i = 0; i < len; i++ ) {
  2948. jQuery.find( selector, self[ i ], ret );
  2949. }
  2950.  
  2951. return len > 1 ? jQuery.uniqueSort( ret ) : ret;
  2952. },
  2953. filter: function( selector ) {
  2954. return this.pushStack( winnow( this, selector || [], false ) );
  2955. },
  2956. not: function( selector ) {
  2957. return this.pushStack( winnow( this, selector || [], true ) );
  2958. },
  2959. is: function( selector ) {
  2960. return !!winnow(
  2961. this,
  2962.  
  2963. // If this is a positional/relative selector, check membership in the returned set
  2964. // so $("p:first").is("p:last") won't return true for a doc with two "p".
  2965. typeof selector === "string" && rneedsContext.test( selector ) ?
  2966. jQuery( selector ) :
  2967. selector || [],
  2968. false
  2969. ).length;
  2970. }
  2971. } );
  2972.  
  2973.  
  2974. // Initialize a jQuery object
  2975.  
  2976.  
  2977. // A central reference to the root jQuery(document)
  2978. var rootjQuery,
  2979.  
  2980. // A simple way to check for HTML strings
  2981. // Prioritize #id over <tag> to avoid XSS via location.hash (trac-9521)
  2982. // Strict HTML recognition (trac-11290: must start with <)
  2983. // Shortcut simple #id case for speed
  2984. rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/,
  2985.  
  2986. init = jQuery.fn.init = function( selector, context, root ) {
  2987. var match, elem;
  2988.  
  2989. // HANDLE: $(""), $(null), $(undefined), $(false)
  2990. if ( !selector ) {
  2991. return this;
  2992. }
  2993.  
  2994. // Method init() accepts an alternate rootjQuery
  2995. // so migrate can support jQuery.sub (gh-2101)
  2996. root = root || rootjQuery;
  2997.  
  2998. // Handle HTML strings
  2999. if ( typeof selector === "string" ) {
  3000. if ( selector[ 0 ] === "<" &&
  3001. selector[ selector.length - 1 ] === ">" &&
  3002. selector.length >= 3 ) {
  3003.  
  3004. // Assume that strings that start and end with <> are HTML and skip the regex check
  3005. match = [ null, selector, null ];
  3006.  
  3007. } else {
  3008. match = rquickExpr.exec( selector );
  3009. }
  3010.  
  3011. // Match html or make sure no context is specified for #id
  3012. if ( match && ( match[ 1 ] || !context ) ) {
  3013.  
  3014. // HANDLE: $(html) -> $(array)
  3015. if ( match[ 1 ] ) {
  3016. context = context instanceof jQuery ? context[ 0 ] : context;
  3017.  
  3018. // Option to run scripts is true for back-compat
  3019. // Intentionally let the error be thrown if parseHTML is not present
  3020. jQuery.merge( this, jQuery.parseHTML(
  3021. match[ 1 ],
  3022. context && context.nodeType ? context.ownerDocument || context : document,
  3023. true
  3024. ) );
  3025.  
  3026. // HANDLE: $(html, props)
  3027. if ( rsingleTag.test( match[ 1 ] ) && jQuery.isPlainObject( context ) ) {
  3028. for ( match in context ) {
  3029.  
  3030. // Properties of context are called as methods if possible
  3031. if ( isFunction( this[ match ] ) ) {
  3032. this[ match ]( context[ match ] );
  3033.  
  3034. // ...and otherwise set as attributes
  3035. } else {
  3036. this.attr( match, context[ match ] );
  3037. }
  3038. }
  3039. }
  3040.  
  3041. return this;
  3042.  
  3043. // HANDLE: $(#id)
  3044. } else {
  3045. elem = document.getElementById( match[ 2 ] );
  3046.  
  3047. if ( elem ) {
  3048.  
  3049. // Inject the element directly into the jQuery object
  3050. this[ 0 ] = elem;
  3051. this.length = 1;
  3052. }
  3053. return this;
  3054. }
  3055.  
  3056. // HANDLE: $(expr, $(...))
  3057. } else if ( !context || context.jquery ) {
  3058. return ( context || root ).find( selector );
  3059.  
  3060. // HANDLE: $(expr, context)
  3061. // (which is just equivalent to: $(context).find(expr)
  3062. } else {
  3063. return this.constructor( context ).find( selector );
  3064. }
  3065.  
  3066. // HANDLE: $(DOMElement)
  3067. } else if ( selector.nodeType ) {
  3068. this[ 0 ] = selector;
  3069. this.length = 1;
  3070. return this;
  3071.  
  3072. // HANDLE: $(function)
  3073. // Shortcut for document ready
  3074. } else if ( isFunction( selector ) ) {
  3075. return root.ready !== undefined ?
  3076. root.ready( selector ) :
  3077.  
  3078. // Execute immediately if ready is not present
  3079. selector( jQuery );
  3080. }
  3081.  
  3082. return jQuery.makeArray( selector, this );
  3083. };
  3084.  
  3085. // Give the init function the jQuery prototype for later instantiation
  3086. init.prototype = jQuery.fn;
  3087.  
  3088. // Initialize central reference
  3089. rootjQuery = jQuery( document );
  3090.  
  3091.  
  3092. var rparentsprev = /^(?:parents|prev(?:Until|All))/,
  3093.  
  3094. // Methods guaranteed to produce a unique set when starting from a unique set
  3095. guaranteedUnique = {
  3096. children: true,
  3097. contents: true,
  3098. next: true,
  3099. prev: true
  3100. };
  3101.  
  3102. jQuery.fn.extend( {
  3103. has: function( target ) {
  3104. var targets = jQuery( target, this ),
  3105. l = targets.length;
  3106.  
  3107. return this.filter( function() {
  3108. var i = 0;
  3109. for ( ; i < l; i++ ) {
  3110. if ( jQuery.contains( this, targets[ i ] ) ) {
  3111. return true;
  3112. }
  3113. }
  3114. } );
  3115. },
  3116.  
  3117. closest: function( selectors, context ) {
  3118. var cur,
  3119. i = 0,
  3120. l = this.length,
  3121. matched = [],
  3122. targets = typeof selectors !== "string" && jQuery( selectors );
  3123.  
  3124. // Positional selectors never match, since there's no _selection_ context
  3125. if ( !rneedsContext.test( selectors ) ) {
  3126. for ( ; i < l; i++ ) {
  3127. for ( cur = this[ i ]; cur && cur !== context; cur = cur.parentNode ) {
  3128.  
  3129. // Always skip document fragments
  3130. if ( cur.nodeType < 11 && ( targets ?
  3131. targets.index( cur ) > -1 :
  3132.  
  3133. // Don't pass non-elements to jQuery#find
  3134. cur.nodeType === 1 &&
  3135. jQuery.find.matchesSelector( cur, selectors ) ) ) {
  3136.  
  3137. matched.push( cur );
  3138. break;
  3139. }
  3140. }
  3141. }
  3142. }
  3143.  
  3144. return this.pushStack( matched.length > 1 ? jQuery.uniqueSort( matched ) : matched );
  3145. },
  3146.  
  3147. // Determine the position of an element within the set
  3148. index: function( elem ) {
  3149.  
  3150. // No argument, return index in parent
  3151. if ( !elem ) {
  3152. return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1;
  3153. }
  3154.  
  3155. // Index in selector
  3156. if ( typeof elem === "string" ) {
  3157. return indexOf.call( jQuery( elem ), this[ 0 ] );
  3158. }
  3159.  
  3160. // Locate the position of the desired element
  3161. return indexOf.call( this,
  3162.  
  3163. // If it receives a jQuery object, the first element is used
  3164. elem.jquery ? elem[ 0 ] : elem
  3165. );
  3166. },
  3167.  
  3168. add: function( selector, context ) {
  3169. return this.pushStack(
  3170. jQuery.uniqueSort(
  3171. jQuery.merge( this.get(), jQuery( selector, context ) )
  3172. )
  3173. );
  3174. },
  3175.  
  3176. addBack: function( selector ) {
  3177. return this.add( selector == null ?
  3178. this.prevObject : this.prevObject.filter( selector )
  3179. );
  3180. }
  3181. } );
  3182.  
  3183. function sibling( cur, dir ) {
  3184. while ( ( cur = cur[ dir ] ) && cur.nodeType !== 1 ) {}
  3185. return cur;
  3186. }
  3187.  
  3188. jQuery.each( {
  3189. parent: function( elem ) {
  3190. var parent = elem.parentNode;
  3191. return parent && parent.nodeType !== 11 ? parent : null;
  3192. },
  3193. parents: function( elem ) {
  3194. return dir( elem, "parentNode" );
  3195. },
  3196. parentsUntil: function( elem, _i, until ) {
  3197. return dir( elem, "parentNode", until );
  3198. },
  3199. next: function( elem ) {
  3200. return sibling( elem, "nextSibling" );
  3201. },
  3202. prev: function( elem ) {
  3203. return sibling( elem, "previousSibling" );
  3204. },
  3205. nextAll: function( elem ) {
  3206. return dir( elem, "nextSibling" );
  3207. },
  3208. prevAll: function( elem ) {
  3209. return dir( elem, "previousSibling" );
  3210. },
  3211. nextUntil: function( elem, _i, until ) {
  3212. return dir( elem, "nextSibling", until );
  3213. },
  3214. prevUntil: function( elem, _i, until ) {
  3215. return dir( elem, "previousSibling", until );
  3216. },
  3217. siblings: function( elem ) {
  3218. return siblings( ( elem.parentNode || {} ).firstChild, elem );
  3219. },
  3220. children: function( elem ) {
  3221. return siblings( elem.firstChild );
  3222. },
  3223. contents: function( elem ) {
  3224. if ( elem.contentDocument != null &&
  3225.  
  3226. // Support: IE 11+
  3227. // <object> elements with no `data` attribute has an object
  3228. // `contentDocument` with a `null` prototype.
  3229. getProto( elem.contentDocument ) ) {
  3230.  
  3231. return elem.contentDocument;
  3232. }
  3233.  
  3234. // Support: IE 9 - 11 only, iOS 7 only, Android Browser <=4.3 only
  3235. // Treat the template element as a regular one in browsers that
  3236. // don't support it.
  3237. if ( nodeName( elem, "template" ) ) {
  3238. elem = elem.content || elem;
  3239. }
  3240.  
  3241. return jQuery.merge( [], elem.childNodes );
  3242. }
  3243. }, function( name, fn ) {
  3244. jQuery.fn[ name ] = function( until, selector ) {
  3245. var matched = jQuery.map( this, fn, until );
  3246.  
  3247. if ( name.slice( -5 ) !== "Until" ) {
  3248. selector = until;
  3249. }
  3250.  
  3251. if ( selector && typeof selector === "string" ) {
  3252. matched = jQuery.filter( selector, matched );
  3253. }
  3254.  
  3255. if ( this.length > 1 ) {
  3256.  
  3257. // Remove duplicates
  3258. if ( !guaranteedUnique[ name ] ) {
  3259. jQuery.uniqueSort( matched );
  3260. }
  3261.  
  3262. // Reverse order for parents* and prev-derivatives
  3263. if ( rparentsprev.test( name ) ) {
  3264. matched.reverse();
  3265. }
  3266. }
  3267.  
  3268. return this.pushStack( matched );
  3269. };
  3270. } );
  3271. var rnothtmlwhite = ( /[^\x20\t\r\n\f]+/g );
  3272.  
  3273.  
  3274.  
  3275. // Convert String-formatted options into Object-formatted ones
  3276. function createOptions( options ) {
  3277. var object = {};
  3278. jQuery.each( options.match( rnothtmlwhite ) || [], function( _, flag ) {
  3279. object[ flag ] = true;
  3280. } );
  3281. return object;
  3282. }
  3283.  
  3284. /*
  3285. * Create a callback list using the following parameters:
  3286. *
  3287. * options: an optional list of space-separated options that will change how
  3288. * the callback list behaves or a more traditional option object
  3289. *
  3290. * By default a callback list will act like an event callback list and can be
  3291. * "fired" multiple times.
  3292. *
  3293. * Possible options:
  3294. *
  3295. * once: will ensure the callback list can only be fired once (like a Deferred)
  3296. *
  3297. * memory: will keep track of previous values and will call any callback added
  3298. * after the list has been fired right away with the latest "memorized"
  3299. * values (like a Deferred)
  3300. *
  3301. * unique: will ensure a callback can only be added once (no duplicate in the list)
  3302. *
  3303. * stopOnFalse: interrupt callings when a callback returns false
  3304. *
  3305. */
  3306. jQuery.Callbacks = function( options ) {
  3307.  
  3308. // Convert options from String-formatted to Object-formatted if needed
  3309. // (we check in cache first)
  3310. options = typeof options === "string" ?
  3311. createOptions( options ) :
  3312. jQuery.extend( {}, options );
  3313.  
  3314. var // Flag to know if list is currently firing
  3315. firing,
  3316.  
  3317. // Last fire value for non-forgettable lists
  3318. memory,
  3319.  
  3320. // Flag to know if list was already fired
  3321. fired,
  3322.  
  3323. // Flag to prevent firing
  3324. locked,
  3325.  
  3326. // Actual callback list
  3327. list = [],
  3328.  
  3329. // Queue of execution data for repeatable lists
  3330. queue = [],
  3331.  
  3332. // Index of currently firing callback (modified by add/remove as needed)
  3333. firingIndex = -1,
  3334.  
  3335. // Fire callbacks
  3336. fire = function() {
  3337.  
  3338. // Enforce single-firing
  3339. locked = locked || options.once;
  3340.  
  3341. // Execute callbacks for all pending executions,
  3342. // respecting firingIndex overrides and runtime changes
  3343. fired = firing = true;
  3344. for ( ; queue.length; firingIndex = -1 ) {
  3345. memory = queue.shift();
  3346. while ( ++firingIndex < list.length ) {
  3347.  
  3348. // Run callback and check for early termination
  3349. if ( list[ firingIndex ].apply( memory[ 0 ], memory[ 1 ] ) === false &&
  3350. options.stopOnFalse ) {
  3351.  
  3352. // Jump to end and forget the data so .add doesn't re-fire
  3353. firingIndex = list.length;
  3354. memory = false;
  3355. }
  3356. }
  3357. }
  3358.  
  3359. // Forget the data if we're done with it
  3360. if ( !options.memory ) {
  3361. memory = false;
  3362. }
  3363.  
  3364. firing = false;
  3365.  
  3366. // Clean up if we're done firing for good
  3367. if ( locked ) {
  3368.  
  3369. // Keep an empty list if we have data for future add calls
  3370. if ( memory ) {
  3371. list = [];
  3372.  
  3373. // Otherwise, this object is spent
  3374. } else {
  3375. list = "";
  3376. }
  3377. }
  3378. },
  3379.  
  3380. // Actual Callbacks object
  3381. self = {
  3382.  
  3383. // Add a callback or a collection of callbacks to the list
  3384. add: function() {
  3385. if ( list ) {
  3386.  
  3387. // If we have memory from a past run, we should fire after adding
  3388. if ( memory && !firing ) {
  3389. firingIndex = list.length - 1;
  3390. queue.push( memory );
  3391. }
  3392.  
  3393. ( function add( args ) {
  3394. jQuery.each( args, function( _, arg ) {
  3395. if ( isFunction( arg ) ) {
  3396. if ( !options.unique || !self.has( arg ) ) {
  3397. list.push( arg );
  3398. }
  3399. } else if ( arg && arg.length && toType( arg ) !== "string" ) {
  3400.  
  3401. // Inspect recursively
  3402. add( arg );
  3403. }
  3404. } );
  3405. } )( arguments );
  3406.  
  3407. if ( memory && !firing ) {
  3408. fire();
  3409. }
  3410. }
  3411. return this;
  3412. },
  3413.  
  3414. // Remove a callback from the list
  3415. remove: function() {
  3416. jQuery.each( arguments, function( _, arg ) {
  3417. var index;
  3418. while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) {
  3419. list.splice( index, 1 );
  3420.  
  3421. // Handle firing indexes
  3422. if ( index <= firingIndex ) {
  3423. firingIndex--;
  3424. }
  3425. }
  3426. } );
  3427. return this;
  3428. },
  3429.  
  3430. // Check if a given callback is in the list.
  3431. // If no argument is given, return whether or not list has callbacks attached.
  3432. has: function( fn ) {
  3433. return fn ?
  3434. jQuery.inArray( fn, list ) > -1 :
  3435. list.length > 0;
  3436. },
  3437.  
  3438. // Remove all callbacks from the list
  3439. empty: function() {
  3440. if ( list ) {
  3441. list = [];
  3442. }
  3443. return this;
  3444. },
  3445.  
  3446. // Disable .fire and .add
  3447. // Abort any current/pending executions
  3448. // Clear all callbacks and values
  3449. disable: function() {
  3450. locked = queue = [];
  3451. list = memory = "";
  3452. return this;
  3453. },
  3454. disabled: function() {
  3455. return !list;
  3456. },
  3457.  
  3458. // Disable .fire
  3459. // Also disable .add unless we have memory (since it would have no effect)
  3460. // Abort any pending executions
  3461. lock: function() {
  3462. locked = queue = [];
  3463. if ( !memory && !firing ) {
  3464. list = memory = "";
  3465. }
  3466. return this;
  3467. },
  3468. locked: function() {
  3469. return !!locked;
  3470. },
  3471.  
  3472. // Call all callbacks with the given context and arguments
  3473. fireWith: function( context, args ) {
  3474. if ( !locked ) {
  3475. args = args || [];
  3476. args = [ context, args.slice ? args.slice() : args ];
  3477. queue.push( args );
  3478. if ( !firing ) {
  3479. fire();
  3480. }
  3481. }
  3482. return this;
  3483. },
  3484.  
  3485. // Call all the callbacks with the given arguments
  3486. fire: function() {
  3487. self.fireWith( this, arguments );
  3488. return this;
  3489. },
  3490.  
  3491. // To know if the callbacks have already been called at least once
  3492. fired: function() {
  3493. return !!fired;
  3494. }
  3495. };
  3496.  
  3497. return self;
  3498. };
  3499.  
  3500.  
  3501. function Identity( v ) {
  3502. return v;
  3503. }
  3504. function Thrower( ex ) {
  3505. throw ex;
  3506. }
  3507.  
  3508. function adoptValue( value, resolve, reject, noValue ) {
  3509. var method;
  3510.  
  3511. try {
  3512.  
  3513. // Check for promise aspect first to privilege synchronous behavior
  3514. if ( value && isFunction( ( method = value.promise ) ) ) {
  3515. method.call( value ).done( resolve ).fail( reject );
  3516.  
  3517. // Other thenables
  3518. } else if ( value && isFunction( ( method = value.then ) ) ) {
  3519. method.call( value, resolve, reject );
  3520.  
  3521. // Other non-thenables
  3522. } else {
  3523.  
  3524. // Control `resolve` arguments by letting Array#slice cast boolean `noValue` to integer:
  3525. // * false: [ value ].slice( 0 ) => resolve( value )
  3526. // * true: [ value ].slice( 1 ) => resolve()
  3527. resolve.apply( undefined, [ value ].slice( noValue ) );
  3528. }
  3529.  
  3530. // For Promises/A+, convert exceptions into rejections
  3531. // Since jQuery.when doesn't unwrap thenables, we can skip the extra checks appearing in
  3532. // Deferred#then to conditionally suppress rejection.
  3533. } catch ( value ) {
  3534.  
  3535. // Support: Android 4.0 only
  3536. // Strict mode functions invoked without .call/.apply get global-object context
  3537. reject.apply( undefined, [ value ] );
  3538. }
  3539. }
  3540.  
  3541. jQuery.extend( {
  3542.  
  3543. Deferred: function( func ) {
  3544. var tuples = [
  3545.  
  3546. // action, add listener, callbacks,
  3547. // ... .then handlers, argument index, [final state]
  3548. [ "notify", "progress", jQuery.Callbacks( "memory" ),
  3549. jQuery.Callbacks( "memory" ), 2 ],
  3550. [ "resolve", "done", jQuery.Callbacks( "once memory" ),
  3551. jQuery.Callbacks( "once memory" ), 0, "resolved" ],
  3552. [ "reject", "fail", jQuery.Callbacks( "once memory" ),
  3553. jQuery.Callbacks( "once memory" ), 1, "rejected" ]
  3554. ],
  3555. state = "pending",
  3556. promise = {
  3557. state: function() {
  3558. return state;
  3559. },
  3560. always: function() {
  3561. deferred.done( arguments ).fail( arguments );
  3562. return this;
  3563. },
  3564. "catch": function( fn ) {
  3565. return promise.then( null, fn );
  3566. },
  3567.  
  3568. // Keep pipe for back-compat
  3569. pipe: function( /* fnDone, fnFail, fnProgress */ ) {
  3570. var fns = arguments;
  3571.  
  3572. return jQuery.Deferred( function( newDefer ) {
  3573. jQuery.each( tuples, function( _i, tuple ) {
  3574.  
  3575. // Map tuples (progress, done, fail) to arguments (done, fail, progress)
  3576. var fn = isFunction( fns[ tuple[ 4 ] ] ) && fns[ tuple[ 4 ] ];
  3577.  
  3578. // deferred.progress(function() { bind to newDefer or newDefer.notify })
  3579. // deferred.done(function() { bind to newDefer or newDefer.resolve })
  3580. // deferred.fail(function() { bind to newDefer or newDefer.reject })
  3581. deferred[ tuple[ 1 ] ]( function() {
  3582. var returned = fn && fn.apply( this, arguments );
  3583. if ( returned && isFunction( returned.promise ) ) {
  3584. returned.promise()
  3585. .progress( newDefer.notify )
  3586. .done( newDefer.resolve )
  3587. .fail( newDefer.reject );
  3588. } else {
  3589. newDefer[ tuple[ 0 ] + "With" ](
  3590. this,
  3591. fn ? [ returned ] : arguments
  3592. );
  3593. }
  3594. } );
  3595. } );
  3596. fns = null;
  3597. } ).promise();
  3598. },
  3599. then: function( onFulfilled, onRejected, onProgress ) {
  3600. var maxDepth = 0;
  3601. function resolve( depth, deferred, handler, special ) {
  3602. return function() {
  3603. var that = this,
  3604. args = arguments,
  3605. mightThrow = function() {
  3606. var returned, then;
  3607.  
  3608. // Support: Promises/A+ section 2.3.3.3.3
  3609. // https://promisesaplus.com/#point-59
  3610. // Ignore double-resolution attempts
  3611. if ( depth < maxDepth ) {
  3612. return;
  3613. }
  3614.  
  3615. returned = handler.apply( that, args );
  3616.  
  3617. // Support: Promises/A+ section 2.3.1
  3618. // https://promisesaplus.com/#point-48
  3619. if ( returned === deferred.promise() ) {
  3620. throw new TypeError( "Thenable self-resolution" );
  3621. }
  3622.  
  3623. // Support: Promises/A+ sections 2.3.3.1, 3.5
  3624. // https://promisesaplus.com/#point-54
  3625. // https://promisesaplus.com/#point-75
  3626. // Retrieve `then` only once
  3627. then = returned &&
  3628.  
  3629. // Support: Promises/A+ section 2.3.4
  3630. // https://promisesaplus.com/#point-64
  3631. // Only check objects and functions for thenability
  3632. ( typeof returned === "object" ||
  3633. typeof returned === "function" ) &&
  3634. returned.then;
  3635.  
  3636. // Handle a returned thenable
  3637. if ( isFunction( then ) ) {
  3638.  
  3639. // Special processors (notify) just wait for resolution
  3640. if ( special ) {
  3641. then.call(
  3642. returned,
  3643. resolve( maxDepth, deferred, Identity, special ),
  3644. resolve( maxDepth, deferred, Thrower, special )
  3645. );
  3646.  
  3647. // Normal processors (resolve) also hook into progress
  3648. } else {
  3649.  
  3650. // ...and disregard older resolution values
  3651. maxDepth++;
  3652.  
  3653. then.call(
  3654. returned,
  3655. resolve( maxDepth, deferred, Identity, special ),
  3656. resolve( maxDepth, deferred, Thrower, special ),
  3657. resolve( maxDepth, deferred, Identity,
  3658. deferred.notifyWith )
  3659. );
  3660. }
  3661.  
  3662. // Handle all other returned values
  3663. } else {
  3664.  
  3665. // Only substitute handlers pass on context
  3666. // and multiple values (non-spec behavior)
  3667. if ( handler !== Identity ) {
  3668. that = undefined;
  3669. args = [ returned ];
  3670. }
  3671.  
  3672. // Process the value(s)
  3673. // Default process is resolve
  3674. ( special || deferred.resolveWith )( that, args );
  3675. }
  3676. },
  3677.  
  3678. // Only normal processors (resolve) catch and reject exceptions
  3679. process = special ?
  3680. mightThrow :
  3681. function() {
  3682. try {
  3683. mightThrow();
  3684. } catch ( e ) {
  3685.  
  3686. if ( jQuery.Deferred.exceptionHook ) {
  3687. jQuery.Deferred.exceptionHook( e,
  3688. process.error );
  3689. }
  3690.  
  3691. // Support: Promises/A+ section 2.3.3.3.4.1
  3692. // https://promisesaplus.com/#point-61
  3693. // Ignore post-resolution exceptions
  3694. if ( depth + 1 >= maxDepth ) {
  3695.  
  3696. // Only substitute handlers pass on context
  3697. // and multiple values (non-spec behavior)
  3698. if ( handler !== Thrower ) {
  3699. that = undefined;
  3700. args = [ e ];
  3701. }
  3702.  
  3703. deferred.rejectWith( that, args );
  3704. }
  3705. }
  3706. };
  3707.  
  3708. // Support: Promises/A+ section 2.3.3.3.1
  3709. // https://promisesaplus.com/#point-57
  3710. // Re-resolve promises immediately to dodge false rejection from
  3711. // subsequent errors
  3712. if ( depth ) {
  3713. process();
  3714. } else {
  3715.  
  3716. // Call an optional hook to record the error, in case of exception
  3717. // since it's otherwise lost when execution goes async
  3718. if ( jQuery.Deferred.getErrorHook ) {
  3719. process.error = jQuery.Deferred.getErrorHook();
  3720.  
  3721. // The deprecated alias of the above. While the name suggests
  3722. // returning the stack, not an error instance, jQuery just passes
  3723. // it directly to `console.warn` so both will work; an instance
  3724. // just better cooperates with source maps.
  3725. } else if ( jQuery.Deferred.getStackHook ) {
  3726. process.error = jQuery.Deferred.getStackHook();
  3727. }
  3728. window.setTimeout( process );
  3729. }
  3730. };
  3731. }
  3732.  
  3733. return jQuery.Deferred( function( newDefer ) {
  3734.  
  3735. // progress_handlers.add( ... )
  3736. tuples[ 0 ][ 3 ].add(
  3737. resolve(
  3738. 0,
  3739. newDefer,
  3740. isFunction( onProgress ) ?
  3741. onProgress :
  3742. Identity,
  3743. newDefer.notifyWith
  3744. )
  3745. );
  3746.  
  3747. // fulfilled_handlers.add( ... )
  3748. tuples[ 1 ][ 3 ].add(
  3749. resolve(
  3750. 0,
  3751. newDefer,
  3752. isFunction( onFulfilled ) ?
  3753. onFulfilled :
  3754. Identity
  3755. )
  3756. );
  3757.  
  3758. // rejected_handlers.add( ... )
  3759. tuples[ 2 ][ 3 ].add(
  3760. resolve(
  3761. 0,
  3762. newDefer,
  3763. isFunction( onRejected ) ?
  3764. onRejected :
  3765. Thrower
  3766. )
  3767. );
  3768. } ).promise();
  3769. },
  3770.  
  3771. // Get a promise for this deferred
  3772. // If obj is provided, the promise aspect is added to the object
  3773. promise: function( obj ) {
  3774. return obj != null ? jQuery.extend( obj, promise ) : promise;
  3775. }
  3776. },
  3777. deferred = {};
  3778.  
  3779. // Add list-specific methods
  3780. jQuery.each( tuples, function( i, tuple ) {
  3781. var list = tuple[ 2 ],
  3782. stateString = tuple[ 5 ];
  3783.  
  3784. // promise.progress = list.add
  3785. // promise.done = list.add
  3786. // promise.fail = list.add
  3787. promise[ tuple[ 1 ] ] = list.add;
  3788.  
  3789. // Handle state
  3790. if ( stateString ) {
  3791. list.add(
  3792. function() {
  3793.  
  3794. // state = "resolved" (i.e., fulfilled)
  3795. // state = "rejected"
  3796. state = stateString;
  3797. },
  3798.  
  3799. // rejected_callbacks.disable
  3800. // fulfilled_callbacks.disable
  3801. tuples[ 3 - i ][ 2 ].disable,
  3802.  
  3803. // rejected_handlers.disable
  3804. // fulfilled_handlers.disable
  3805. tuples[ 3 - i ][ 3 ].disable,
  3806.  
  3807. // progress_callbacks.lock
  3808. tuples[ 0 ][ 2 ].lock,
  3809.  
  3810. // progress_handlers.lock
  3811. tuples[ 0 ][ 3 ].lock
  3812. );
  3813. }
  3814.  
  3815. // progress_handlers.fire
  3816. // fulfilled_handlers.fire
  3817. // rejected_handlers.fire
  3818. list.add( tuple[ 3 ].fire );
  3819.  
  3820. // deferred.notify = function() { deferred.notifyWith(...) }
  3821. // deferred.resolve = function() { deferred.resolveWith(...) }
  3822. // deferred.reject = function() { deferred.rejectWith(...) }
  3823. deferred[ tuple[ 0 ] ] = function() {
  3824. deferred[ tuple[ 0 ] + "With" ]( this === deferred ? undefined : this, arguments );
  3825. return this;
  3826. };
  3827.  
  3828. // deferred.notifyWith = list.fireWith
  3829. // deferred.resolveWith = list.fireWith
  3830. // deferred.rejectWith = list.fireWith
  3831. deferred[ tuple[ 0 ] + "With" ] = list.fireWith;
  3832. } );
  3833.  
  3834. // Make the deferred a promise
  3835. promise.promise( deferred );
  3836.  
  3837. // Call given func if any
  3838. if ( func ) {
  3839. func.call( deferred, deferred );
  3840. }
  3841.  
  3842. // All done!
  3843. return deferred;
  3844. },
  3845.  
  3846. // Deferred helper
  3847. when: function( singleValue ) {
  3848. var
  3849.  
  3850. // count of uncompleted subordinates
  3851. remaining = arguments.length,
  3852.  
  3853. // count of unprocessed arguments
  3854. i = remaining,
  3855.  
  3856. // subordinate fulfillment data
  3857. resolveContexts = Array( i ),
  3858. resolveValues = slice.call( arguments ),
  3859.  
  3860. // the primary Deferred
  3861. primary = jQuery.Deferred(),
  3862.  
  3863. // subordinate callback factory
  3864. updateFunc = function( i ) {
  3865. return function( value ) {
  3866. resolveContexts[ i ] = this;
  3867. resolveValues[ i ] = arguments.length > 1 ? slice.call( arguments ) : value;
  3868. if ( !( --remaining ) ) {
  3869. primary.resolveWith( resolveContexts, resolveValues );
  3870. }
  3871. };
  3872. };
  3873.  
  3874. // Single- and empty arguments are adopted like Promise.resolve
  3875. if ( remaining <= 1 ) {
  3876. adoptValue( singleValue, primary.done( updateFunc( i ) ).resolve, primary.reject,
  3877. !remaining );
  3878.  
  3879. // Use .then() to unwrap secondary thenables (cf. gh-3000)
  3880. if ( primary.state() === "pending" ||
  3881. isFunction( resolveValues[ i ] && resolveValues[ i ].then ) ) {
  3882.  
  3883. return primary.then();
  3884. }
  3885. }
  3886.  
  3887. // Multiple arguments are aggregated like Promise.all array elements
  3888. while ( i-- ) {
  3889. adoptValue( resolveValues[ i ], updateFunc( i ), primary.reject );
  3890. }
  3891.  
  3892. return primary.promise();
  3893. }
  3894. } );
  3895.  
  3896.  
  3897. // These usually indicate a programmer mistake during development,
  3898. // warn about them ASAP rather than swallowing them by default.
  3899. var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;
  3900.  
  3901. // If `jQuery.Deferred.getErrorHook` is defined, `asyncError` is an error
  3902. // captured before the async barrier to get the original error cause
  3903. // which may otherwise be hidden.
  3904. jQuery.Deferred.exceptionHook = function( error, asyncError ) {
  3905.  
  3906. // Support: IE 8 - 9 only
  3907. // Console exists when dev tools are open, which can happen at any time
  3908. if ( window.console && window.console.warn && error && rerrorNames.test( error.name ) ) {
  3909. window.console.warn( "jQuery.Deferred exception: " + error.message,
  3910. error.stack, asyncError );
  3911. }
  3912. };
  3913.  
  3914.  
  3915.  
  3916.  
  3917. jQuery.readyException = function( error ) {
  3918. window.setTimeout( function() {
  3919. throw error;
  3920. } );
  3921. };
  3922.  
  3923.  
  3924.  
  3925.  
  3926. // The deferred used on DOM ready
  3927. var readyList = jQuery.Deferred();
  3928.  
  3929. jQuery.fn.ready = function( fn ) {
  3930.  
  3931. readyList
  3932. .then( fn )
  3933.  
  3934. // Wrap jQuery.readyException in a function so that the lookup
  3935. // happens at the time of error handling instead of callback
  3936. // registration.
  3937. .catch( function( error ) {
  3938. jQuery.readyException( error );
  3939. } );
  3940.  
  3941. return this;
  3942. };
  3943.  
  3944. jQuery.extend( {
  3945.  
  3946. // Is the DOM ready to be used? Set to true once it occurs.
  3947. isReady: false,
  3948.  
  3949. // A counter to track how many items to wait for before
  3950. // the ready event fires. See trac-6781
  3951. readyWait: 1,
  3952.  
  3953. // Handle when the DOM is ready
  3954. ready: function( wait ) {
  3955.  
  3956. // Abort if there are pending holds or we're already ready
  3957. if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) {
  3958. return;
  3959. }
  3960.  
  3961. // Remember that the DOM is ready
  3962. jQuery.isReady = true;
  3963.  
  3964. // If a normal DOM Ready event fired, decrement, and wait if need be
  3965. if ( wait !== true && --jQuery.readyWait > 0 ) {
  3966. return;
  3967. }
  3968.  
  3969. // If there are functions bound, to execute
  3970. readyList.resolveWith( document, [ jQuery ] );
  3971. }
  3972. } );
  3973.  
  3974. jQuery.ready.then = readyList.then;
  3975.  
  3976. // The ready event handler and self cleanup method
  3977. function completed() {
  3978. document.removeEventListener( "DOMContentLoaded", completed );
  3979. window.removeEventListener( "load", completed );
  3980. jQuery.ready();
  3981. }
  3982.  
  3983. // Catch cases where $(document).ready() is called
  3984. // after the browser event has already occurred.
  3985. // Support: IE <=9 - 10 only
  3986. // Older IE sometimes signals "interactive" too soon
  3987. if ( document.readyState === "complete" ||
  3988. ( document.readyState !== "loading" && !document.documentElement.doScroll ) ) {
  3989.  
  3990. // Handle it asynchronously to allow scripts the opportunity to delay ready
  3991. window.setTimeout( jQuery.ready );
  3992.  
  3993. } else {
  3994.  
  3995. // Use the handy event callback
  3996. document.addEventListener( "DOMContentLoaded", completed );
  3997.  
  3998. // A fallback to window.onload, that will always work
  3999. window.addEventListener( "load", completed );
  4000. }
  4001.  
  4002.  
  4003.  
  4004.  
  4005. // Multifunctional method to get and set values of a collection
  4006. // The value/s can optionally be executed if it's a function
  4007. var access = function( elems, fn, key, value, chainable, emptyGet, raw ) {
  4008. var i = 0,
  4009. len = elems.length,
  4010. bulk = key == null;
  4011.  
  4012. // Sets many values
  4013. if ( toType( key ) === "object" ) {
  4014. chainable = true;
  4015. for ( i in key ) {
  4016. access( elems, fn, i, key[ i ], true, emptyGet, raw );
  4017. }
  4018.  
  4019. // Sets one value
  4020. } else if ( value !== undefined ) {
  4021. chainable = true;
  4022.  
  4023. if ( !isFunction( value ) ) {
  4024. raw = true;
  4025. }
  4026.  
  4027. if ( bulk ) {
  4028.  
  4029. // Bulk operations run against the entire set
  4030. if ( raw ) {
  4031. fn.call( elems, value );
  4032. fn = null;
  4033.  
  4034. // ...except when executing function values
  4035. } else {
  4036. bulk = fn;
  4037. fn = function( elem, _key, value ) {
  4038. return bulk.call( jQuery( elem ), value );
  4039. };
  4040. }
  4041. }
  4042.  
  4043. if ( fn ) {
  4044. for ( ; i < len; i++ ) {
  4045. fn(
  4046. elems[ i ], key, raw ?
  4047. value :
  4048. value.call( elems[ i ], i, fn( elems[ i ], key ) )
  4049. );
  4050. }
  4051. }
  4052. }
  4053.  
  4054. if ( chainable ) {
  4055. return elems;
  4056. }
  4057.  
  4058. // Gets
  4059. if ( bulk ) {
  4060. return fn.call( elems );
  4061. }
  4062.  
  4063. return len ? fn( elems[ 0 ], key ) : emptyGet;
  4064. };
  4065.  
  4066.  
  4067. // Matches dashed string for camelizing
  4068. var rmsPrefix = /^-ms-/,
  4069. rdashAlpha = /-([a-z])/g;
  4070.  
  4071. // Used by camelCase as callback to replace()
  4072. function fcamelCase( _all, letter ) {
  4073. return letter.toUpperCase();
  4074. }
  4075.  
  4076. // Convert dashed to camelCase; used by the css and data modules
  4077. // Support: IE <=9 - 11, Edge 12 - 15
  4078. // Microsoft forgot to hump their vendor prefix (trac-9572)
  4079. function camelCase( string ) {
  4080. return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
  4081. }
  4082. var acceptData = function( owner ) {
  4083.  
  4084. // Accepts only:
  4085. // - Node
  4086. // - Node.ELEMENT_NODE
  4087. // - Node.DOCUMENT_NODE
  4088. // - Object
  4089. // - Any
  4090. return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType );
  4091. };
  4092.  
  4093.  
  4094.  
  4095.  
  4096. function Data() {
  4097. this.expando = jQuery.expando + Data.uid++;
  4098. }
  4099.  
  4100. Data.uid = 1;
  4101.  
  4102. Data.prototype = {
  4103.  
  4104. cache: function( owner ) {
  4105.  
  4106. // Check if the owner object already has a cache
  4107. var value = owner[ this.expando ];
  4108.  
  4109. // If not, create one
  4110. if ( !value ) {
  4111. value = {};
  4112.  
  4113. // We can accept data for non-element nodes in modern browsers,
  4114. // but we should not, see trac-8335.
  4115. // Always return an empty object.
  4116. if ( acceptData( owner ) ) {
  4117.  
  4118. // If it is a node unlikely to be stringify-ed or looped over
  4119. // use plain assignment
  4120. if ( owner.nodeType ) {
  4121. owner[ this.expando ] = value;
  4122.  
  4123. // Otherwise secure it in a non-enumerable property
  4124. // configurable must be true to allow the property to be
  4125. // deleted when data is removed
  4126. } else {
  4127. Object.defineProperty( owner, this.expando, {
  4128. value: value,
  4129. configurable: true
  4130. } );
  4131. }
  4132. }
  4133. }
  4134.  
  4135. return value;
  4136. },
  4137. set: function( owner, data, value ) {
  4138. var prop,
  4139. cache = this.cache( owner );
  4140.  
  4141. // Handle: [ owner, key, value ] args
  4142. // Always use camelCase key (gh-2257)
  4143. if ( typeof data === "string" ) {
  4144. cache[ camelCase( data ) ] = value;
  4145.  
  4146. // Handle: [ owner, { properties } ] args
  4147. } else {
  4148.  
  4149. // Copy the properties one-by-one to the cache object
  4150. for ( prop in data ) {
  4151. cache[ camelCase( prop ) ] = data[ prop ];
  4152. }
  4153. }
  4154. return cache;
  4155. },
  4156. get: function( owner, key ) {
  4157. return key === undefined ?
  4158. this.cache( owner ) :
  4159.  
  4160. // Always use camelCase key (gh-2257)
  4161. owner[ this.expando ] && owner[ this.expando ][ camelCase( key ) ];
  4162. },
  4163. access: function( owner, key, value ) {
  4164.  
  4165. // In cases where either:
  4166. //
  4167. // 1. No key was specified
  4168. // 2. A string key was specified, but no value provided
  4169. //
  4170. // Take the "read" path and allow the get method to determine
  4171. // which value to return, respectively either:
  4172. //
  4173. // 1. The entire cache object
  4174. // 2. The data stored at the key
  4175. //
  4176. if ( key === undefined ||
  4177. ( ( key && typeof key === "string" ) && value === undefined ) ) {
  4178.  
  4179. return this.get( owner, key );
  4180. }
  4181.  
  4182. // When the key is not a string, or both a key and value
  4183. // are specified, set or extend (existing objects) with either:
  4184. //
  4185. // 1. An object of properties
  4186. // 2. A key and value
  4187. //
  4188. this.set( owner, key, value );
  4189.  
  4190. // Since the "set" path can have two possible entry points
  4191. // return the expected data based on which path was taken[*]
  4192. return value !== undefined ? value : key;
  4193. },
  4194. remove: function( owner, key ) {
  4195. var i,
  4196. cache = owner[ this.expando ];
  4197.  
  4198. if ( cache === undefined ) {
  4199. return;
  4200. }
  4201.  
  4202. if ( key !== undefined ) {
  4203.  
  4204. // Support array or space separated string of keys
  4205. if ( Array.isArray( key ) ) {
  4206.  
  4207. // If key is an array of keys...
  4208. // We always set camelCase keys, so remove that.
  4209. key = key.map( camelCase );
  4210. } else {
  4211. key = camelCase( key );
  4212.  
  4213. // If a key with the spaces exists, use it.
  4214. // Otherwise, create an array by matching non-whitespace
  4215. key = key in cache ?
  4216. [ key ] :
  4217. ( key.match( rnothtmlwhite ) || [] );
  4218. }
  4219.  
  4220. i = key.length;
  4221.  
  4222. while ( i-- ) {
  4223. delete cache[ key[ i ] ];
  4224. }
  4225. }
  4226.  
  4227. // Remove the expando if there's no more data
  4228. if ( key === undefined || jQuery.isEmptyObject( cache ) ) {
  4229.  
  4230. // Support: Chrome <=35 - 45
  4231. // Webkit & Blink performance suffers when deleting properties
  4232. // from DOM nodes, so set to undefined instead
  4233. // https://bugs.chromium.org/p/chromium/issues/detail?id=378607 (bug restricted)
  4234. if ( owner.nodeType ) {
  4235. owner[ this.expando ] = undefined;
  4236. } else {
  4237. delete owner[ this.expando ];
  4238. }
  4239. }
  4240. },
  4241. hasData: function( owner ) {
  4242. var cache = owner[ this.expando ];
  4243. return cache !== undefined && !jQuery.isEmptyObject( cache );
  4244. }
  4245. };
  4246. var dataPriv = new Data();
  4247.  
  4248. var dataUser = new Data();
  4249.  
  4250.  
  4251.  
  4252. // Implementation Summary
  4253. //
  4254. // 1. Enforce API surface and semantic compatibility with 1.9.x branch
  4255. // 2. Improve the module's maintainability by reducing the storage
  4256. // paths to a single mechanism.
  4257. // 3. Use the same single mechanism to support "private" and "user" data.
  4258. // 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData)
  4259. // 5. Avoid exposing implementation details on user objects (eg. expando properties)
  4260. // 6. Provide a clear path for implementation upgrade to WeakMap in 2014
  4261.  
  4262. var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,
  4263. rmultiDash = /[A-Z]/g;
  4264.  
  4265. function getData( data ) {
  4266. if ( data === "true" ) {
  4267. return true;
  4268. }
  4269.  
  4270. if ( data === "false" ) {
  4271. return false;
  4272. }
  4273.  
  4274. if ( data === "null" ) {
  4275. return null;
  4276. }
  4277.  
  4278. // Only convert to a number if it doesn't change the string
  4279. if ( data === +data + "" ) {
  4280. return +data;
  4281. }
  4282.  
  4283. if ( rbrace.test( data ) ) {
  4284. return JSON.parse( data );
  4285. }
  4286.  
  4287. return data;
  4288. }
  4289.  
  4290. function dataAttr( elem, key, data ) {
  4291. var name;
  4292.  
  4293. // If nothing was found internally, try to fetch any
  4294. // data from the HTML5 data-* attribute
  4295. if ( data === undefined && elem.nodeType === 1 ) {
  4296. name = "data-" + key.replace( rmultiDash, "-$&" ).toLowerCase();
  4297. data = elem.getAttribute( name );
  4298.  
  4299. if ( typeof data === "string" ) {
  4300. try {
  4301. data = getData( data );
  4302. } catch ( e ) {}
  4303.  
  4304. // Make sure we set the data so it isn't changed later
  4305. dataUser.set( elem, key, data );
  4306. } else {
  4307. data = undefined;
  4308. }
  4309. }
  4310. return data;
  4311. }
  4312.  
  4313. jQuery.extend( {
  4314. hasData: function( elem ) {
  4315. return dataUser.hasData( elem ) || dataPriv.hasData( elem );
  4316. },
  4317.  
  4318. data: function( elem, name, data ) {
  4319. return dataUser.access( elem, name, data );
  4320. },
  4321.  
  4322. removeData: function( elem, name ) {
  4323. dataUser.remove( elem, name );
  4324. },
  4325.  
  4326. // TODO: Now that all calls to _data and _removeData have been replaced
  4327. // with direct calls to dataPriv methods, these can be deprecated.
  4328. _data: function( elem, name, data ) {
  4329. return dataPriv.access( elem, name, data );
  4330. },
  4331.  
  4332. _removeData: function( elem, name ) {
  4333. dataPriv.remove( elem, name );
  4334. }
  4335. } );
  4336.  
  4337. jQuery.fn.extend( {
  4338. data: function( key, value ) {
  4339. var i, name, data,
  4340. elem = this[ 0 ],
  4341. attrs = elem && elem.attributes;
  4342.  
  4343. // Gets all values
  4344. if ( key === undefined ) {
  4345. if ( this.length ) {
  4346. data = dataUser.get( elem );
  4347.  
  4348. if ( elem.nodeType === 1 && !dataPriv.get( elem, "hasDataAttrs" ) ) {
  4349. i = attrs.length;
  4350. while ( i-- ) {
  4351.  
  4352. // Support: IE 11 only
  4353. // The attrs elements can be null (trac-14894)
  4354. if ( attrs[ i ] ) {
  4355. name = attrs[ i ].name;
  4356. if ( name.indexOf( "data-" ) === 0 ) {
  4357. name = camelCase( name.slice( 5 ) );
  4358. dataAttr( elem, name, data[ name ] );
  4359. }
  4360. }
  4361. }
  4362. dataPriv.set( elem, "hasDataAttrs", true );
  4363. }
  4364. }
  4365.  
  4366. return data;
  4367. }
  4368.  
  4369. // Sets multiple values
  4370. if ( typeof key === "object" ) {
  4371. return this.each( function() {
  4372. dataUser.set( this, key );
  4373. } );
  4374. }
  4375.  
  4376. return access( this, function( value ) {
  4377. var data;
  4378.  
  4379. // The calling jQuery object (element matches) is not empty
  4380. // (and therefore has an element appears at this[ 0 ]) and the
  4381. // `value` parameter was not undefined. An empty jQuery object
  4382. // will result in `undefined` for elem = this[ 0 ] which will
  4383. // throw an exception if an attempt to read a data cache is made.
  4384. if ( elem && value === undefined ) {
  4385.  
  4386. // Attempt to get data from the cache
  4387. // The key will always be camelCased in Data
  4388. data = dataUser.get( elem, key );
  4389. if ( data !== undefined ) {
  4390. return data;
  4391. }
  4392.  
  4393. // Attempt to "discover" the data in
  4394. // HTML5 custom data-* attrs
  4395. data = dataAttr( elem, key );
  4396. if ( data !== undefined ) {
  4397. return data;
  4398. }
  4399.  
  4400. // We tried really hard, but the data doesn't exist.
  4401. return;
  4402. }
  4403.  
  4404. // Set the data...
  4405. this.each( function() {
  4406.  
  4407. // We always store the camelCased key
  4408. dataUser.set( this, key, value );
  4409. } );
  4410. }, null, value, arguments.length > 1, null, true );
  4411. },
  4412.  
  4413. removeData: function( key ) {
  4414. return this.each( function() {
  4415. dataUser.remove( this, key );
  4416. } );
  4417. }
  4418. } );
  4419.  
  4420.  
  4421. jQuery.extend( {
  4422. queue: function( elem, type, data ) {
  4423. var queue;
  4424.  
  4425. if ( elem ) {
  4426. type = ( type || "fx" ) + "queue";
  4427. queue = dataPriv.get( elem, type );
  4428.  
  4429. // Speed up dequeue by getting out quickly if this is just a lookup
  4430. if ( data ) {
  4431. if ( !queue || Array.isArray( data ) ) {
  4432. queue = dataPriv.access( elem, type, jQuery.makeArray( data ) );
  4433. } else {
  4434. queue.push( data );
  4435. }
  4436. }
  4437. return queue || [];
  4438. }
  4439. },
  4440.  
  4441. dequeue: function( elem, type ) {
  4442. type = type || "fx";
  4443.  
  4444. var queue = jQuery.queue( elem, type ),
  4445. startLength = queue.length,
  4446. fn = queue.shift(),
  4447. hooks = jQuery._queueHooks( elem, type ),
  4448. next = function() {
  4449. jQuery.dequeue( elem, type );
  4450. };
  4451.  
  4452. // If the fx queue is dequeued, always remove the progress sentinel
  4453. if ( fn === "inprogress" ) {
  4454. fn = queue.shift();
  4455. startLength--;
  4456. }
  4457.  
  4458. if ( fn ) {
  4459.  
  4460. // Add a progress sentinel to prevent the fx queue from being
  4461. // automatically dequeued
  4462. if ( type === "fx" ) {
  4463. queue.unshift( "inprogress" );
  4464. }
  4465.  
  4466. // Clear up the last queue stop function
  4467. delete hooks.stop;
  4468. fn.call( elem, next, hooks );
  4469. }
  4470.  
  4471. if ( !startLength && hooks ) {
  4472. hooks.empty.fire();
  4473. }
  4474. },
  4475.  
  4476. // Not public - generate a queueHooks object, or return the current one
  4477. _queueHooks: function( elem, type ) {
  4478. var key = type + "queueHooks";
  4479. return dataPriv.get( elem, key ) || dataPriv.access( elem, key, {
  4480. empty: jQuery.Callbacks( "once memory" ).add( function() {
  4481. dataPriv.remove( elem, [ type + "queue", key ] );
  4482. } )
  4483. } );
  4484. }
  4485. } );
  4486.  
  4487. jQuery.fn.extend( {
  4488. queue: function( type, data ) {
  4489. var setter = 2;
  4490.  
  4491. if ( typeof type !== "string" ) {
  4492. data = type;
  4493. type = "fx";
  4494. setter--;
  4495. }
  4496.  
  4497. if ( arguments.length < setter ) {
  4498. return jQuery.queue( this[ 0 ], type );
  4499. }
  4500.  
  4501. return data === undefined ?
  4502. this :
  4503. this.each( function() {
  4504. var queue = jQuery.queue( this, type, data );
  4505.  
  4506. // Ensure a hooks for this queue
  4507. jQuery._queueHooks( this, type );
  4508.  
  4509. if ( type === "fx" && queue[ 0 ] !== "inprogress" ) {
  4510. jQuery.dequeue( this, type );
  4511. }
  4512. } );
  4513. },
  4514. dequeue: function( type ) {
  4515. return this.each( function() {
  4516. jQuery.dequeue( this, type );
  4517. } );
  4518. },
  4519. clearQueue: function( type ) {
  4520. return this.queue( type || "fx", [] );
  4521. },
  4522.  
  4523. // Get a promise resolved when queues of a certain type
  4524. // are emptied (fx is the type by default)
  4525. promise: function( type, obj ) {
  4526. var tmp,
  4527. count = 1,
  4528. defer = jQuery.Deferred(),
  4529. elements = this,
  4530. i = this.length,
  4531. resolve = function() {
  4532. if ( !( --count ) ) {
  4533. defer.resolveWith( elements, [ elements ] );
  4534. }
  4535. };
  4536.  
  4537. if ( typeof type !== "string" ) {
  4538. obj = type;
  4539. type = undefined;
  4540. }
  4541. type = type || "fx";
  4542.  
  4543. while ( i-- ) {
  4544. tmp = dataPriv.get( elements[ i ], type + "queueHooks" );
  4545. if ( tmp && tmp.empty ) {
  4546. count++;
  4547. tmp.empty.add( resolve );
  4548. }
  4549. }
  4550. resolve();
  4551. return defer.promise( obj );
  4552. }
  4553. } );
  4554. var pnum = ( /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/ ).source;
  4555.  
  4556. var rcssNum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" );
  4557.  
  4558.  
  4559. var cssExpand = [ "Top", "Right", "Bottom", "Left" ];
  4560.  
  4561. var documentElement = document.documentElement;
  4562.  
  4563.  
  4564.  
  4565. var isAttached = function( elem ) {
  4566. return jQuery.contains( elem.ownerDocument, elem );
  4567. },
  4568. composed = { composed: true };
  4569.  
  4570. // Support: IE 9 - 11+, Edge 12 - 18+, iOS 10.0 - 10.2 only
  4571. // Check attachment across shadow DOM boundaries when possible (gh-3504)
  4572. // Support: iOS 10.0-10.2 only
  4573. // Early iOS 10 versions support `attachShadow` but not `getRootNode`,
  4574. // leading to errors. We need to check for `getRootNode`.
  4575. if ( documentElement.getRootNode ) {
  4576. isAttached = function( elem ) {
  4577. return jQuery.contains( elem.ownerDocument, elem ) ||
  4578. elem.getRootNode( composed ) === elem.ownerDocument;
  4579. };
  4580. }
  4581. var isHiddenWithinTree = function( elem, el ) {
  4582.  
  4583. // isHiddenWithinTree might be called from jQuery#filter function;
  4584. // in that case, element will be second argument
  4585. elem = el || elem;
  4586.  
  4587. // Inline style trumps all
  4588. return elem.style.display === "none" ||
  4589. elem.style.display === "" &&
  4590.  
  4591. // Otherwise, check computed style
  4592. // Support: Firefox <=43 - 45
  4593. // Disconnected elements can have computed display: none, so first confirm that elem is
  4594. // in the document.
  4595. isAttached( elem ) &&
  4596.  
  4597. jQuery.css( elem, "display" ) === "none";
  4598. };
  4599.  
  4600.  
  4601.  
  4602. function adjustCSS( elem, prop, valueParts, tween ) {
  4603. var adjusted, scale,
  4604. maxIterations = 20,
  4605. currentValue = tween ?
  4606. function() {
  4607. return tween.cur();
  4608. } :
  4609. function() {
  4610. return jQuery.css( elem, prop, "" );
  4611. },
  4612. initial = currentValue(),
  4613. unit = valueParts && valueParts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ),
  4614.  
  4615. // Starting value computation is required for potential unit mismatches
  4616. initialInUnit = elem.nodeType &&
  4617. ( jQuery.cssNumber[ prop ] || unit !== "px" && +initial ) &&
  4618. rcssNum.exec( jQuery.css( elem, prop ) );
  4619.  
  4620. if ( initialInUnit && initialInUnit[ 3 ] !== unit ) {
  4621.  
  4622. // Support: Firefox <=54
  4623. // Halve the iteration target value to prevent interference from CSS upper bounds (gh-2144)
  4624. initial = initial / 2;
  4625.  
  4626. // Trust units reported by jQuery.css
  4627. unit = unit || initialInUnit[ 3 ];
  4628.  
  4629. // Iteratively approximate from a nonzero starting point
  4630. initialInUnit = +initial || 1;
  4631.  
  4632. while ( maxIterations-- ) {
  4633.  
  4634. // Evaluate and update our best guess (doubling guesses that zero out).
  4635. // Finish if the scale equals or crosses 1 (making the old*new product non-positive).
  4636. jQuery.style( elem, prop, initialInUnit + unit );
  4637. if ( ( 1 - scale ) * ( 1 - ( scale = currentValue() / initial || 0.5 ) ) <= 0 ) {
  4638. maxIterations = 0;
  4639. }
  4640. initialInUnit = initialInUnit / scale;
  4641.  
  4642. }
  4643.  
  4644. initialInUnit = initialInUnit * 2;
  4645. jQuery.style( elem, prop, initialInUnit + unit );
  4646.  
  4647. // Make sure we update the tween properties later on
  4648. valueParts = valueParts || [];
  4649. }
  4650.  
  4651. if ( valueParts ) {
  4652. initialInUnit = +initialInUnit || +initial || 0;
  4653.  
  4654. // Apply relative offset (+=/-=) if specified
  4655. adjusted = valueParts[ 1 ] ?
  4656. initialInUnit + ( valueParts[ 1 ] + 1 ) * valueParts[ 2 ] :
  4657. +valueParts[ 2 ];
  4658. if ( tween ) {
  4659. tween.unit = unit;
  4660. tween.start = initialInUnit;
  4661. tween.end = adjusted;
  4662. }
  4663. }
  4664. return adjusted;
  4665. }
  4666.  
  4667.  
  4668. var defaultDisplayMap = {};
  4669.  
  4670. function getDefaultDisplay( elem ) {
  4671. var temp,
  4672. doc = elem.ownerDocument,
  4673. nodeName = elem.nodeName,
  4674. display = defaultDisplayMap[ nodeName ];
  4675.  
  4676. if ( display ) {
  4677. return display;
  4678. }
  4679.  
  4680. temp = doc.body.appendChild( doc.createElement( nodeName ) );
  4681. display = jQuery.css( temp, "display" );
  4682.  
  4683. temp.parentNode.removeChild( temp );
  4684.  
  4685. if ( display === "none" ) {
  4686. display = "block";
  4687. }
  4688. defaultDisplayMap[ nodeName ] = display;
  4689.  
  4690. return display;
  4691. }
  4692.  
  4693. function showHide( elements, show ) {
  4694. var display, elem,
  4695. values = [],
  4696. index = 0,
  4697. length = elements.length;
  4698.  
  4699. // Determine new display value for elements that need to change
  4700. for ( ; index < length; index++ ) {
  4701. elem = elements[ index ];
  4702. if ( !elem.style ) {
  4703. continue;
  4704. }
  4705.  
  4706. display = elem.style.display;
  4707. if ( show ) {
  4708.  
  4709. // Since we force visibility upon cascade-hidden elements, an immediate (and slow)
  4710. // check is required in this first loop unless we have a nonempty display value (either
  4711. // inline or about-to-be-restored)
  4712. if ( display === "none" ) {
  4713. values[ index ] = dataPriv.get( elem, "display" ) || null;
  4714. if ( !values[ index ] ) {
  4715. elem.style.display = "";
  4716. }
  4717. }
  4718. if ( elem.style.display === "" && isHiddenWithinTree( elem ) ) {
  4719. values[ index ] = getDefaultDisplay( elem );
  4720. }
  4721. } else {
  4722. if ( display !== "none" ) {
  4723. values[ index ] = "none";
  4724.  
  4725. // Remember what we're overwriting
  4726. dataPriv.set( elem, "display", display );
  4727. }
  4728. }
  4729. }
  4730.  
  4731. // Set the display of the elements in a second loop to avoid constant reflow
  4732. for ( index = 0; index < length; index++ ) {
  4733. if ( values[ index ] != null ) {
  4734. elements[ index ].style.display = values[ index ];
  4735. }
  4736. }
  4737.  
  4738. return elements;
  4739. }
  4740.  
  4741. jQuery.fn.extend( {
  4742. show: function() {
  4743. return showHide( this, true );
  4744. },
  4745. hide: function() {
  4746. return showHide( this );
  4747. },
  4748. toggle: function( state ) {
  4749. if ( typeof state === "boolean" ) {
  4750. return state ? this.show() : this.hide();
  4751. }
  4752.  
  4753. return this.each( function() {
  4754. if ( isHiddenWithinTree( this ) ) {
  4755. jQuery( this ).show();
  4756. } else {
  4757. jQuery( this ).hide();
  4758. }
  4759. } );
  4760. }
  4761. } );
  4762. var rcheckableType = ( /^(?:checkbox|radio)$/i );
  4763.  
  4764. var rtagName = ( /<([a-z][^\/\0>\x20\t\r\n\f]*)/i );
  4765.  
  4766. var rscriptType = ( /^$|^module$|\/(?:java|ecma)script/i );
  4767.  
  4768.  
  4769.  
  4770. ( function() {
  4771. var fragment = document.createDocumentFragment(),
  4772. div = fragment.appendChild( document.createElement( "div" ) ),
  4773. input = document.createElement( "input" );
  4774.  
  4775. // Support: Android 4.0 - 4.3 only
  4776. // Check state lost if the name is set (trac-11217)
  4777. // Support: Windows Web Apps (WWA)
  4778. // `name` and `type` must use .setAttribute for WWA (trac-14901)
  4779. input.setAttribute( "type", "radio" );
  4780. input.setAttribute( "checked", "checked" );
  4781. input.setAttribute( "name", "t" );
  4782.  
  4783. div.appendChild( input );
  4784.  
  4785. // Support: Android <=4.1 only
  4786. // Older WebKit doesn't clone checked state correctly in fragments
  4787. support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked;
  4788.  
  4789. // Support: IE <=11 only
  4790. // Make sure textarea (and checkbox) defaultValue is properly cloned
  4791. div.innerHTML = "<textarea>x</textarea>";
  4792. support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue;
  4793.  
  4794. // Support: IE <=9 only
  4795. // IE <=9 replaces <option> tags with their contents when inserted outside of
  4796. // the select element.
  4797. div.innerHTML = "<option></option>";
  4798. support.option = !!div.lastChild;
  4799. } )();
  4800.  
  4801.  
  4802. // We have to close these tags to support XHTML (trac-13200)
  4803. var wrapMap = {
  4804.  
  4805. // XHTML parsers do not magically insert elements in the
  4806. // same way that tag soup parsers do. So we cannot shorten
  4807. // this by omitting <tbody> or other required elements.
  4808. thead: [ 1, "<table>", "</table>" ],
  4809. col: [ 2, "<table><colgroup>", "</colgroup></table>" ],
  4810. tr: [ 2, "<table><tbody>", "</tbody></table>" ],
  4811. td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
  4812.  
  4813. _default: [ 0, "", "" ]
  4814. };
  4815.  
  4816. wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
  4817. wrapMap.th = wrapMap.td;
  4818.  
  4819. // Support: IE <=9 only
  4820. if ( !support.option ) {
  4821. wrapMap.optgroup = wrapMap.option = [ 1, "<select multiple='multiple'>", "</select>" ];
  4822. }
  4823.  
  4824.  
  4825. function getAll( context, tag ) {
  4826.  
  4827. // Support: IE <=9 - 11 only
  4828. // Use typeof to avoid zero-argument method invocation on host objects (trac-15151)
  4829. var ret;
  4830.  
  4831. if ( typeof context.getElementsByTagName !== "undefined" ) {
  4832. ret = context.getElementsByTagName( tag || "*" );
  4833.  
  4834. } else if ( typeof context.querySelectorAll !== "undefined" ) {
  4835. ret = context.querySelectorAll( tag || "*" );
  4836.  
  4837. } else {
  4838. ret = [];
  4839. }
  4840.  
  4841. if ( tag === undefined || tag && nodeName( context, tag ) ) {
  4842. return jQuery.merge( [ context ], ret );
  4843. }
  4844.  
  4845. return ret;
  4846. }
  4847.  
  4848.  
  4849. // Mark scripts as having already been evaluated
  4850. function setGlobalEval( elems, refElements ) {
  4851. var i = 0,
  4852. l = elems.length;
  4853.  
  4854. for ( ; i < l; i++ ) {
  4855. dataPriv.set(
  4856. elems[ i ],
  4857. "globalEval",
  4858. !refElements || dataPriv.get( refElements[ i ], "globalEval" )
  4859. );
  4860. }
  4861. }
  4862.  
  4863.  
  4864. var rhtml = /<|&#?\w+;/;
  4865.  
  4866. function buildFragment( elems, context, scripts, selection, ignored ) {
  4867. var elem, tmp, tag, wrap, attached, j,
  4868. fragment = context.createDocumentFragment(),
  4869. nodes = [],
  4870. i = 0,
  4871. l = elems.length;
  4872.  
  4873. for ( ; i < l; i++ ) {
  4874. elem = elems[ i ];
  4875.  
  4876. if ( elem || elem === 0 ) {
  4877.  
  4878. // Add nodes directly
  4879. if ( toType( elem ) === "object" ) {
  4880.  
  4881. // Support: Android <=4.0 only, PhantomJS 1 only
  4882. // push.apply(_, arraylike) throws on ancient WebKit
  4883. jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem );
  4884.  
  4885. // Convert non-html into a text node
  4886. } else if ( !rhtml.test( elem ) ) {
  4887. nodes.push( context.createTextNode( elem ) );
  4888.  
  4889. // Convert html into DOM nodes
  4890. } else {
  4891. tmp = tmp || fragment.appendChild( context.createElement( "div" ) );
  4892.  
  4893. // Deserialize a standard representation
  4894. tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase();
  4895. wrap = wrapMap[ tag ] || wrapMap._default;
  4896. tmp.innerHTML = wrap[ 1 ] + jQuery.htmlPrefilter( elem ) + wrap[ 2 ];
  4897.  
  4898. // Descend through wrappers to the right content
  4899. j = wrap[ 0 ];
  4900. while ( j-- ) {
  4901. tmp = tmp.lastChild;
  4902. }
  4903.  
  4904. // Support: Android <=4.0 only, PhantomJS 1 only
  4905. // push.apply(_, arraylike) throws on ancient WebKit
  4906. jQuery.merge( nodes, tmp.childNodes );
  4907.  
  4908. // Remember the top-level container
  4909. tmp = fragment.firstChild;
  4910.  
  4911. // Ensure the created nodes are orphaned (trac-12392)
  4912. tmp.textContent = "";
  4913. }
  4914. }
  4915. }
  4916.  
  4917. // Remove wrapper from fragment
  4918. fragment.textContent = "";
  4919.  
  4920. i = 0;
  4921. while ( ( elem = nodes[ i++ ] ) ) {
  4922.  
  4923. // Skip elements already in the context collection (trac-4087)
  4924. if ( selection && jQuery.inArray( elem, selection ) > -1 ) {
  4925. if ( ignored ) {
  4926. ignored.push( elem );
  4927. }
  4928. continue;
  4929. }
  4930.  
  4931. attached = isAttached( elem );
  4932.  
  4933. // Append to fragment
  4934. tmp = getAll( fragment.appendChild( elem ), "script" );
  4935.  
  4936. // Preserve script evaluation history
  4937. if ( attached ) {
  4938. setGlobalEval( tmp );
  4939. }
  4940.  
  4941. // Capture executables
  4942. if ( scripts ) {
  4943. j = 0;
  4944. while ( ( elem = tmp[ j++ ] ) ) {
  4945. if ( rscriptType.test( elem.type || "" ) ) {
  4946. scripts.push( elem );
  4947. }
  4948. }
  4949. }
  4950. }
  4951.  
  4952. return fragment;
  4953. }
  4954.  
  4955.  
  4956. var rtypenamespace = /^([^.]*)(?:\.(.+)|)/;
  4957.  
  4958. function returnTrue() {
  4959. return true;
  4960. }
  4961.  
  4962. function returnFalse() {
  4963. return false;
  4964. }
  4965.  
  4966. function on( elem, types, selector, data, fn, one ) {
  4967. var origFn, type;
  4968.  
  4969. // Types can be a map of types/handlers
  4970. if ( typeof types === "object" ) {
  4971.  
  4972. // ( types-Object, selector, data )
  4973. if ( typeof selector !== "string" ) {
  4974.  
  4975. // ( types-Object, data )
  4976. data = data || selector;
  4977. selector = undefined;
  4978. }
  4979. for ( type in types ) {
  4980. on( elem, type, selector, data, types[ type ], one );
  4981. }
  4982. return elem;
  4983. }
  4984.  
  4985. if ( data == null && fn == null ) {
  4986.  
  4987. // ( types, fn )
  4988. fn = selector;
  4989. data = selector = undefined;
  4990. } else if ( fn == null ) {
  4991. if ( typeof selector === "string" ) {
  4992.  
  4993. // ( types, selector, fn )
  4994. fn = data;
  4995. data = undefined;
  4996. } else {
  4997.  
  4998. // ( types, data, fn )
  4999. fn = data;
  5000. data = selector;
  5001. selector = undefined;
  5002. }
  5003. }
  5004. if ( fn === false ) {
  5005. fn = returnFalse;
  5006. } else if ( !fn ) {
  5007. return elem;
  5008. }
  5009.  
  5010. if ( one === 1 ) {
  5011. origFn = fn;
  5012. fn = function( event ) {
  5013.  
  5014. // Can use an empty set, since event contains the info
  5015. jQuery().off( event );
  5016. return origFn.apply( this, arguments );
  5017. };
  5018.  
  5019. // Use same guid so caller can remove using origFn
  5020. fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ );
  5021. }
  5022. return elem.each( function() {
  5023. jQuery.event.add( this, types, fn, data, selector );
  5024. } );
  5025. }
  5026.  
  5027. /*
  5028. * Helper functions for managing events -- not part of the public interface.
  5029. * Props to Dean Edwards' addEvent library for many of the ideas.
  5030. */
  5031. jQuery.event = {
  5032.  
  5033. global: {},
  5034.  
  5035. add: function( elem, types, handler, data, selector ) {
  5036.  
  5037. var handleObjIn, eventHandle, tmp,
  5038. events, t, handleObj,
  5039. special, handlers, type, namespaces, origType,
  5040. elemData = dataPriv.get( elem );
  5041.  
  5042. // Only attach events to objects that accept data
  5043. if ( !acceptData( elem ) ) {
  5044. return;
  5045. }
  5046.  
  5047. // Caller can pass in an object of custom data in lieu of the handler
  5048. if ( handler.handler ) {
  5049. handleObjIn = handler;
  5050. handler = handleObjIn.handler;
  5051. selector = handleObjIn.selector;
  5052. }
  5053.  
  5054. // Ensure that invalid selectors throw exceptions at attach time
  5055. // Evaluate against documentElement in case elem is a non-element node (e.g., document)
  5056. if ( selector ) {
  5057. jQuery.find.matchesSelector( documentElement, selector );
  5058. }
  5059.  
  5060. // Make sure that the handler has a unique ID, used to find/remove it later
  5061. if ( !handler.guid ) {
  5062. handler.guid = jQuery.guid++;
  5063. }
  5064.  
  5065. // Init the element's event structure and main handler, if this is the first
  5066. if ( !( events = elemData.events ) ) {
  5067. events = elemData.events = Object.create( null );
  5068. }
  5069. if ( !( eventHandle = elemData.handle ) ) {
  5070. eventHandle = elemData.handle = function( e ) {
  5071.  
  5072. // Discard the second event of a jQuery.event.trigger() and
  5073. // when an event is called after a page has unloaded
  5074. return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ?
  5075. jQuery.event.dispatch.apply( elem, arguments ) : undefined;
  5076. };
  5077. }
  5078.  
  5079. // Handle multiple events separated by a space
  5080. types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
  5081. t = types.length;
  5082. while ( t-- ) {
  5083. tmp = rtypenamespace.exec( types[ t ] ) || [];
  5084. type = origType = tmp[ 1 ];
  5085. namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
  5086.  
  5087. // There *must* be a type, no attaching namespace-only handlers
  5088. if ( !type ) {
  5089. continue;
  5090. }
  5091.  
  5092. // If event changes its type, use the special event handlers for the changed type
  5093. special = jQuery.event.special[ type ] || {};
  5094.  
  5095. // If selector defined, determine special event api type, otherwise given type
  5096. type = ( selector ? special.delegateType : special.bindType ) || type;
  5097.  
  5098. // Update special based on newly reset type
  5099. special = jQuery.event.special[ type ] || {};
  5100.  
  5101. // handleObj is passed to all event handlers
  5102. handleObj = jQuery.extend( {
  5103. type: type,
  5104. origType: origType,
  5105. data: data,
  5106. handler: handler,
  5107. guid: handler.guid,
  5108. selector: selector,
  5109. needsContext: selector && jQuery.expr.match.needsContext.test( selector ),
  5110. namespace: namespaces.join( "." )
  5111. }, handleObjIn );
  5112.  
  5113. // Init the event handler queue if we're the first
  5114. if ( !( handlers = events[ type ] ) ) {
  5115. handlers = events[ type ] = [];
  5116. handlers.delegateCount = 0;
  5117.  
  5118. // Only use addEventListener if the special events handler returns false
  5119. if ( !special.setup ||
  5120. special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
  5121.  
  5122. if ( elem.addEventListener ) {
  5123. elem.addEventListener( type, eventHandle );
  5124. }
  5125. }
  5126. }
  5127.  
  5128. if ( special.add ) {
  5129. special.add.call( elem, handleObj );
  5130.  
  5131. if ( !handleObj.handler.guid ) {
  5132. handleObj.handler.guid = handler.guid;
  5133. }
  5134. }
  5135.  
  5136. // Add to the element's handler list, delegates in front
  5137. if ( selector ) {
  5138. handlers.splice( handlers.delegateCount++, 0, handleObj );
  5139. } else {
  5140. handlers.push( handleObj );
  5141. }
  5142.  
  5143. // Keep track of which events have ever been used, for event optimization
  5144. jQuery.event.global[ type ] = true;
  5145. }
  5146.  
  5147. },
  5148.  
  5149. // Detach an event or set of events from an element
  5150. remove: function( elem, types, handler, selector, mappedTypes ) {
  5151.  
  5152. var j, origCount, tmp,
  5153. events, t, handleObj,
  5154. special, handlers, type, namespaces, origType,
  5155. elemData = dataPriv.hasData( elem ) && dataPriv.get( elem );
  5156.  
  5157. if ( !elemData || !( events = elemData.events ) ) {
  5158. return;
  5159. }
  5160.  
  5161. // Once for each type.namespace in types; type may be omitted
  5162. types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
  5163. t = types.length;
  5164. while ( t-- ) {
  5165. tmp = rtypenamespace.exec( types[ t ] ) || [];
  5166. type = origType = tmp[ 1 ];
  5167. namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
  5168.  
  5169. // Unbind all events (on this namespace, if provided) for the element
  5170. if ( !type ) {
  5171. for ( type in events ) {
  5172. jQuery.event.remove( elem, type + types[ t ], handler, selector, true );
  5173. }
  5174. continue;
  5175. }
  5176.  
  5177. special = jQuery.event.special[ type ] || {};
  5178. type = ( selector ? special.delegateType : special.bindType ) || type;
  5179. handlers = events[ type ] || [];
  5180. tmp = tmp[ 2 ] &&
  5181. new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" );
  5182.  
  5183. // Remove matching events
  5184. origCount = j = handlers.length;
  5185. while ( j-- ) {
  5186. handleObj = handlers[ j ];
  5187.  
  5188. if ( ( mappedTypes || origType === handleObj.origType ) &&
  5189. ( !handler || handler.guid === handleObj.guid ) &&
  5190. ( !tmp || tmp.test( handleObj.namespace ) ) &&
  5191. ( !selector || selector === handleObj.selector ||
  5192. selector === "**" && handleObj.selector ) ) {
  5193. handlers.splice( j, 1 );
  5194.  
  5195. if ( handleObj.selector ) {
  5196. handlers.delegateCount--;
  5197. }
  5198. if ( special.remove ) {
  5199. special.remove.call( elem, handleObj );
  5200. }
  5201. }
  5202. }
  5203.  
  5204. // Remove generic event handler if we removed something and no more handlers exist
  5205. // (avoids potential for endless recursion during removal of special event handlers)
  5206. if ( origCount && !handlers.length ) {
  5207. if ( !special.teardown ||
  5208. special.teardown.call( elem, namespaces, elemData.handle ) === false ) {
  5209.  
  5210. jQuery.removeEvent( elem, type, elemData.handle );
  5211. }
  5212.  
  5213. delete events[ type ];
  5214. }
  5215. }
  5216.  
  5217. // Remove data and the expando if it's no longer used
  5218. if ( jQuery.isEmptyObject( events ) ) {
  5219. dataPriv.remove( elem, "handle events" );
  5220. }
  5221. },
  5222.  
  5223. dispatch: function( nativeEvent ) {
  5224.  
  5225. var i, j, ret, matched, handleObj, handlerQueue,
  5226. args = new Array( arguments.length ),
  5227.  
  5228. // Make a writable jQuery.Event from the native event object
  5229. event = jQuery.event.fix( nativeEvent ),
  5230.  
  5231. handlers = (
  5232. dataPriv.get( this, "events" ) || Object.create( null )
  5233. )[ event.type ] || [],
  5234. special = jQuery.event.special[ event.type ] || {};
  5235.  
  5236. // Use the fix-ed jQuery.Event rather than the (read-only) native event
  5237. args[ 0 ] = event;
  5238.  
  5239. for ( i = 1; i < arguments.length; i++ ) {
  5240. args[ i ] = arguments[ i ];
  5241. }
  5242.  
  5243. event.delegateTarget = this;
  5244.  
  5245. // Call the preDispatch hook for the mapped type, and let it bail if desired
  5246. if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) {
  5247. return;
  5248. }
  5249.  
  5250. // Determine handlers
  5251. handlerQueue = jQuery.event.handlers.call( this, event, handlers );
  5252.  
  5253. // Run delegates first; they may want to stop propagation beneath us
  5254. i = 0;
  5255. while ( ( matched = handlerQueue[ i++ ] ) && !event.isPropagationStopped() ) {
  5256. event.currentTarget = matched.elem;
  5257.  
  5258. j = 0;
  5259. while ( ( handleObj = matched.handlers[ j++ ] ) &&
  5260. !event.isImmediatePropagationStopped() ) {
  5261.  
  5262. // If the event is namespaced, then each handler is only invoked if it is
  5263. // specially universal or its namespaces are a superset of the event's.
  5264. if ( !event.rnamespace || handleObj.namespace === false ||
  5265. event.rnamespace.test( handleObj.namespace ) ) {
  5266.  
  5267. event.handleObj = handleObj;
  5268. event.data = handleObj.data;
  5269.  
  5270. ret = ( ( jQuery.event.special[ handleObj.origType ] || {} ).handle ||
  5271. handleObj.handler ).apply( matched.elem, args );
  5272.  
  5273. if ( ret !== undefined ) {
  5274. if ( ( event.result = ret ) === false ) {
  5275. event.preventDefault();
  5276. event.stopPropagation();
  5277. }
  5278. }
  5279. }
  5280. }
  5281. }
  5282.  
  5283. // Call the postDispatch hook for the mapped type
  5284. if ( special.postDispatch ) {
  5285. special.postDispatch.call( this, event );
  5286. }
  5287.  
  5288. return event.result;
  5289. },
  5290.  
  5291. handlers: function( event, handlers ) {
  5292. var i, handleObj, sel, matchedHandlers, matchedSelectors,
  5293. handlerQueue = [],
  5294. delegateCount = handlers.delegateCount,
  5295. cur = event.target;
  5296.  
  5297. // Find delegate handlers
  5298. if ( delegateCount &&
  5299.  
  5300. // Support: IE <=9
  5301. // Black-hole SVG <use> instance trees (trac-13180)
  5302. cur.nodeType &&
  5303.  
  5304. // Support: Firefox <=42
  5305. // Suppress spec-violating clicks indicating a non-primary pointer button (trac-3861)
  5306. // https://www.w3.org/TR/DOM-Level-3-Events/#event-type-click
  5307. // Support: IE 11 only
  5308. // ...but not arrow key "clicks" of radio inputs, which can have `button` -1 (gh-2343)
  5309. !( event.type === "click" && event.button >= 1 ) ) {
  5310.  
  5311. for ( ; cur !== this; cur = cur.parentNode || this ) {
  5312.  
  5313. // Don't check non-elements (trac-13208)
  5314. // Don't process clicks on disabled elements (trac-6911, trac-8165, trac-11382, trac-11764)
  5315. if ( cur.nodeType === 1 && !( event.type === "click" && cur.disabled === true ) ) {
  5316. matchedHandlers = [];
  5317. matchedSelectors = {};
  5318. for ( i = 0; i < delegateCount; i++ ) {
  5319. handleObj = handlers[ i ];
  5320.  
  5321. // Don't conflict with Object.prototype properties (trac-13203)
  5322. sel = handleObj.selector + " ";
  5323.  
  5324. if ( matchedSelectors[ sel ] === undefined ) {
  5325. matchedSelectors[ sel ] = handleObj.needsContext ?
  5326. jQuery( sel, this ).index( cur ) > -1 :
  5327. jQuery.find( sel, this, null, [ cur ] ).length;
  5328. }
  5329. if ( matchedSelectors[ sel ] ) {
  5330. matchedHandlers.push( handleObj );
  5331. }
  5332. }
  5333. if ( matchedHandlers.length ) {
  5334. handlerQueue.push( { elem: cur, handlers: matchedHandlers } );
  5335. }
  5336. }
  5337. }
  5338. }
  5339.  
  5340. // Add the remaining (directly-bound) handlers
  5341. cur = this;
  5342. if ( delegateCount < handlers.length ) {
  5343. handlerQueue.push( { elem: cur, handlers: handlers.slice( delegateCount ) } );
  5344. }
  5345.  
  5346. return handlerQueue;
  5347. },
  5348.  
  5349. addProp: function( name, hook ) {
  5350. Object.defineProperty( jQuery.Event.prototype, name, {
  5351. enumerable: true,
  5352. configurable: true,
  5353.  
  5354. get: isFunction( hook ) ?
  5355. function() {
  5356. if ( this.originalEvent ) {
  5357. return hook( this.originalEvent );
  5358. }
  5359. } :
  5360. function() {
  5361. if ( this.originalEvent ) {
  5362. return this.originalEvent[ name ];
  5363. }
  5364. },
  5365.  
  5366. set: function( value ) {
  5367. Object.defineProperty( this, name, {
  5368. enumerable: true,
  5369. configurable: true,
  5370. writable: true,
  5371. value: value
  5372. } );
  5373. }
  5374. } );
  5375. },
  5376.  
  5377. fix: function( originalEvent ) {
  5378. return originalEvent[ jQuery.expando ] ?
  5379. originalEvent :
  5380. new jQuery.Event( originalEvent );
  5381. },
  5382.  
  5383. special: {
  5384. load: {
  5385.  
  5386. // Prevent triggered image.load events from bubbling to window.load
  5387. noBubble: true
  5388. },
  5389. click: {
  5390.  
  5391. // Utilize native event to ensure correct state for checkable inputs
  5392. setup: function( data ) {
  5393.  
  5394. // For mutual compressibility with _default, replace `this` access with a local var.
  5395. // `|| data` is dead code meant only to preserve the variable through minification.
  5396. var el = this || data;
  5397.  
  5398. // Claim the first handler
  5399. if ( rcheckableType.test( el.type ) &&
  5400. el.click && nodeName( el, "input" ) ) {
  5401.  
  5402. // dataPriv.set( el, "click", ... )
  5403. leverageNative( el, "click", true );
  5404. }
  5405.  
  5406. // Return false to allow normal processing in the caller
  5407. return false;
  5408. },
  5409. trigger: function( data ) {
  5410.  
  5411. // For mutual compressibility with _default, replace `this` access with a local var.
  5412. // `|| data` is dead code meant only to preserve the variable through minification.
  5413. var el = this || data;
  5414.  
  5415. // Force setup before triggering a click
  5416. if ( rcheckableType.test( el.type ) &&
  5417. el.click && nodeName( el, "input" ) ) {
  5418.  
  5419. leverageNative( el, "click" );
  5420. }
  5421.  
  5422. // Return non-false to allow normal event-path propagation
  5423. return true;
  5424. },
  5425.  
  5426. // For cross-browser consistency, suppress native .click() on links
  5427. // Also prevent it if we're currently inside a leveraged native-event stack
  5428. _default: function( event ) {
  5429. var target = event.target;
  5430. return rcheckableType.test( target.type ) &&
  5431. target.click && nodeName( target, "input" ) &&
  5432. dataPriv.get( target, "click" ) ||
  5433. nodeName( target, "a" );
  5434. }
  5435. },
  5436.  
  5437. beforeunload: {
  5438. postDispatch: function( event ) {
  5439.  
  5440. // Support: Firefox 20+
  5441. // Firefox doesn't alert if the returnValue field is not set.
  5442. if ( event.result !== undefined && event.originalEvent ) {
  5443. event.originalEvent.returnValue = event.result;
  5444. }
  5445. }
  5446. }
  5447. }
  5448. };
  5449.  
  5450. // Ensure the presence of an event listener that handles manually-triggered
  5451. // synthetic events by interrupting progress until reinvoked in response to
  5452. // *native* events that it fires directly, ensuring that state changes have
  5453. // already occurred before other listeners are invoked.
  5454. function leverageNative( el, type, isSetup ) {
  5455.  
  5456. // Missing `isSetup` indicates a trigger call, which must force setup through jQuery.event.add
  5457. if ( !isSetup ) {
  5458. if ( dataPriv.get( el, type ) === undefined ) {
  5459. jQuery.event.add( el, type, returnTrue );
  5460. }
  5461. return;
  5462. }
  5463.  
  5464. // Register the controller as a special universal handler for all event namespaces
  5465. dataPriv.set( el, type, false );
  5466. jQuery.event.add( el, type, {
  5467. namespace: false,
  5468. handler: function( event ) {
  5469. var result,
  5470. saved = dataPriv.get( this, type );
  5471.  
  5472. if ( ( event.isTrigger & 1 ) && this[ type ] ) {
  5473.  
  5474. // Interrupt processing of the outer synthetic .trigger()ed event
  5475. if ( !saved ) {
  5476.  
  5477. // Store arguments for use when handling the inner native event
  5478. // There will always be at least one argument (an event object), so this array
  5479. // will not be confused with a leftover capture object.
  5480. saved = slice.call( arguments );
  5481. dataPriv.set( this, type, saved );
  5482.  
  5483. // Trigger the native event and capture its result
  5484. this[ type ]();
  5485. result = dataPriv.get( this, type );
  5486. dataPriv.set( this, type, false );
  5487.  
  5488. if ( saved !== result ) {
  5489.  
  5490. // Cancel the outer synthetic event
  5491. event.stopImmediatePropagation();
  5492. event.preventDefault();
  5493.  
  5494. return result;
  5495. }
  5496.  
  5497. // If this is an inner synthetic event for an event with a bubbling surrogate
  5498. // (focus or blur), assume that the surrogate already propagated from triggering
  5499. // the native event and prevent that from happening again here.
  5500. // This technically gets the ordering wrong w.r.t. to `.trigger()` (in which the
  5501. // bubbling surrogate propagates *after* the non-bubbling base), but that seems
  5502. // less bad than duplication.
  5503. } else if ( ( jQuery.event.special[ type ] || {} ).delegateType ) {
  5504. event.stopPropagation();
  5505. }
  5506.  
  5507. // If this is a native event triggered above, everything is now in order
  5508. // Fire an inner synthetic event with the original arguments
  5509. } else if ( saved ) {
  5510.  
  5511. // ...and capture the result
  5512. dataPriv.set( this, type, jQuery.event.trigger(
  5513. saved[ 0 ],
  5514. saved.slice( 1 ),
  5515. this
  5516. ) );
  5517.  
  5518. // Abort handling of the native event by all jQuery handlers while allowing
  5519. // native handlers on the same element to run. On target, this is achieved
  5520. // by stopping immediate propagation just on the jQuery event. However,
  5521. // the native event is re-wrapped by a jQuery one on each level of the
  5522. // propagation so the only way to stop it for jQuery is to stop it for
  5523. // everyone via native `stopPropagation()`. This is not a problem for
  5524. // focus/blur which don't bubble, but it does also stop click on checkboxes
  5525. // and radios. We accept this limitation.
  5526. event.stopPropagation();
  5527. event.isImmediatePropagationStopped = returnTrue;
  5528. }
  5529. }
  5530. } );
  5531. }
  5532.  
  5533. jQuery.removeEvent = function( elem, type, handle ) {
  5534.  
  5535. // This "if" is needed for plain objects
  5536. if ( elem.removeEventListener ) {
  5537. elem.removeEventListener( type, handle );
  5538. }
  5539. };
  5540.  
  5541. jQuery.Event = function( src, props ) {
  5542.  
  5543. // Allow instantiation without the 'new' keyword
  5544. if ( !( this instanceof jQuery.Event ) ) {
  5545. return new jQuery.Event( src, props );
  5546. }
  5547.  
  5548. // Event object
  5549. if ( src && src.type ) {
  5550. this.originalEvent = src;
  5551. this.type = src.type;
  5552.  
  5553. // Events bubbling up the document may have been marked as prevented
  5554. // by a handler lower down the tree; reflect the correct value.
  5555. this.isDefaultPrevented = src.defaultPrevented ||
  5556. src.defaultPrevented === undefined &&
  5557.  
  5558. // Support: Android <=2.3 only
  5559. src.returnValue === false ?
  5560. returnTrue :
  5561. returnFalse;
  5562.  
  5563. // Create target properties
  5564. // Support: Safari <=6 - 7 only
  5565. // Target should not be a text node (trac-504, trac-13143)
  5566. this.target = ( src.target && src.target.nodeType === 3 ) ?
  5567. src.target.parentNode :
  5568. src.target;
  5569.  
  5570. this.currentTarget = src.currentTarget;
  5571. this.relatedTarget = src.relatedTarget;
  5572.  
  5573. // Event type
  5574. } else {
  5575. this.type = src;
  5576. }
  5577.  
  5578. // Put explicitly provided properties onto the event object
  5579. if ( props ) {
  5580. jQuery.extend( this, props );
  5581. }
  5582.  
  5583. // Create a timestamp if incoming event doesn't have one
  5584. this.timeStamp = src && src.timeStamp || Date.now();
  5585.  
  5586. // Mark it as fixed
  5587. this[ jQuery.expando ] = true;
  5588. };
  5589.  
  5590. // jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
  5591. // https://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
  5592. jQuery.Event.prototype = {
  5593. constructor: jQuery.Event,
  5594. isDefaultPrevented: returnFalse,
  5595. isPropagationStopped: returnFalse,
  5596. isImmediatePropagationStopped: returnFalse,
  5597. isSimulated: false,
  5598.  
  5599. preventDefault: function() {
  5600. var e = this.originalEvent;
  5601.  
  5602. this.isDefaultPrevented = returnTrue;
  5603.  
  5604. if ( e && !this.isSimulated ) {
  5605. e.preventDefault();
  5606. }
  5607. },
  5608. stopPropagation: function() {
  5609. var e = this.originalEvent;
  5610.  
  5611. this.isPropagationStopped = returnTrue;
  5612.  
  5613. if ( e && !this.isSimulated ) {
  5614. e.stopPropagation();
  5615. }
  5616. },
  5617. stopImmediatePropagation: function() {
  5618. var e = this.originalEvent;
  5619.  
  5620. this.isImmediatePropagationStopped = returnTrue;
  5621.  
  5622. if ( e && !this.isSimulated ) {
  5623. e.stopImmediatePropagation();
  5624. }
  5625.  
  5626. this.stopPropagation();
  5627. }
  5628. };
  5629.  
  5630. // Includes all common event props including KeyEvent and MouseEvent specific props
  5631. jQuery.each( {
  5632. altKey: true,
  5633. bubbles: true,
  5634. cancelable: true,
  5635. changedTouches: true,
  5636. ctrlKey: true,
  5637. detail: true,
  5638. eventPhase: true,
  5639. metaKey: true,
  5640. pageX: true,
  5641. pageY: true,
  5642. shiftKey: true,
  5643. view: true,
  5644. "char": true,
  5645. code: true,
  5646. charCode: true,
  5647. key: true,
  5648. keyCode: true,
  5649. button: true,
  5650. buttons: true,
  5651. clientX: true,
  5652. clientY: true,
  5653. offsetX: true,
  5654. offsetY: true,
  5655. pointerId: true,
  5656. pointerType: true,
  5657. screenX: true,
  5658. screenY: true,
  5659. targetTouches: true,
  5660. toElement: true,
  5661. touches: true,
  5662. which: true
  5663. }, jQuery.event.addProp );
  5664.  
  5665. jQuery.each( { focus: "focusin", blur: "focusout" }, function( type, delegateType ) {
  5666.  
  5667. function focusMappedHandler( nativeEvent ) {
  5668. if ( document.documentMode ) {
  5669.  
  5670. // Support: IE 11+
  5671. // Attach a single focusin/focusout handler on the document while someone wants
  5672. // focus/blur. This is because the former are synchronous in IE while the latter
  5673. // are async. In other browsers, all those handlers are invoked synchronously.
  5674.  
  5675. // `handle` from private data would already wrap the event, but we need
  5676. // to change the `type` here.
  5677. var handle = dataPriv.get( this, "handle" ),
  5678. event = jQuery.event.fix( nativeEvent );
  5679. event.type = nativeEvent.type === "focusin" ? "focus" : "blur";
  5680. event.isSimulated = true;
  5681.  
  5682. // First, handle focusin/focusout
  5683. handle( nativeEvent );
  5684.  
  5685. // ...then, handle focus/blur
  5686. //
  5687. // focus/blur don't bubble while focusin/focusout do; simulate the former by only
  5688. // invoking the handler at the lower level.
  5689. if ( event.target === event.currentTarget ) {
  5690.  
  5691. // The setup part calls `leverageNative`, which, in turn, calls
  5692. // `jQuery.event.add`, so event handle will already have been set
  5693. // by this point.
  5694. handle( event );
  5695. }
  5696. } else {
  5697.  
  5698. // For non-IE browsers, attach a single capturing handler on the document
  5699. // while someone wants focusin/focusout.
  5700. jQuery.event.simulate( delegateType, nativeEvent.target,
  5701. jQuery.event.fix( nativeEvent ) );
  5702. }
  5703. }
  5704.  
  5705. jQuery.event.special[ type ] = {
  5706.  
  5707. // Utilize native event if possible so blur/focus sequence is correct
  5708. setup: function() {
  5709.  
  5710. var attaches;
  5711.  
  5712. // Claim the first handler
  5713. // dataPriv.set( this, "focus", ... )
  5714. // dataPriv.set( this, "blur", ... )
  5715. leverageNative( this, type, true );
  5716.  
  5717. if ( document.documentMode ) {
  5718.  
  5719. // Support: IE 9 - 11+
  5720. // We use the same native handler for focusin & focus (and focusout & blur)
  5721. // so we need to coordinate setup & teardown parts between those events.
  5722. // Use `delegateType` as the key as `type` is already used by `leverageNative`.
  5723. attaches = dataPriv.get( this, delegateType );
  5724. if ( !attaches ) {
  5725. this.addEventListener( delegateType, focusMappedHandler );
  5726. }
  5727. dataPriv.set( this, delegateType, ( attaches || 0 ) + 1 );
  5728. } else {
  5729.  
  5730. // Return false to allow normal processing in the caller
  5731. return false;
  5732. }
  5733. },
  5734. trigger: function() {
  5735.  
  5736. // Force setup before trigger
  5737. leverageNative( this, type );
  5738.  
  5739. // Return non-false to allow normal event-path propagation
  5740. return true;
  5741. },
  5742.  
  5743. teardown: function() {
  5744. var attaches;
  5745.  
  5746. if ( document.documentMode ) {
  5747. attaches = dataPriv.get( this, delegateType ) - 1;
  5748. if ( !attaches ) {
  5749. this.removeEventListener( delegateType, focusMappedHandler );
  5750. dataPriv.remove( this, delegateType );
  5751. } else {
  5752. dataPriv.set( this, delegateType, attaches );
  5753. }
  5754. } else {
  5755.  
  5756. // Return false to indicate standard teardown should be applied
  5757. return false;
  5758. }
  5759. },
  5760.  
  5761. // Suppress native focus or blur if we're currently inside
  5762. // a leveraged native-event stack
  5763. _default: function( event ) {
  5764. return dataPriv.get( event.target, type );
  5765. },
  5766.  
  5767. delegateType: delegateType
  5768. };
  5769.  
  5770. // Support: Firefox <=44
  5771. // Firefox doesn't have focus(in | out) events
  5772. // Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787
  5773. //
  5774. // Support: Chrome <=48 - 49, Safari <=9.0 - 9.1
  5775. // focus(in | out) events fire after focus & blur events,
  5776. // which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order
  5777. // Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857
  5778. //
  5779. // Support: IE 9 - 11+
  5780. // To preserve relative focusin/focus & focusout/blur event order guaranteed on the 3.x branch,
  5781. // attach a single handler for both events in IE.
  5782. jQuery.event.special[ delegateType ] = {
  5783. setup: function() {
  5784.  
  5785. // Handle: regular nodes (via `this.ownerDocument`), window
  5786. // (via `this.document`) & document (via `this`).
  5787. var doc = this.ownerDocument || this.document || this,
  5788. dataHolder = document.documentMode ? this : doc,
  5789. attaches = dataPriv.get( dataHolder, delegateType );
  5790.  
  5791. // Support: IE 9 - 11+
  5792. // We use the same native handler for focusin & focus (and focusout & blur)
  5793. // so we need to coordinate setup & teardown parts between those events.
  5794. // Use `delegateType` as the key as `type` is already used by `leverageNative`.
  5795. if ( !attaches ) {
  5796. if ( document.documentMode ) {
  5797. this.addEventListener( delegateType, focusMappedHandler );
  5798. } else {
  5799. doc.addEventListener( type, focusMappedHandler, true );
  5800. }
  5801. }
  5802. dataPriv.set( dataHolder, delegateType, ( attaches || 0 ) + 1 );
  5803. },
  5804. teardown: function() {
  5805. var doc = this.ownerDocument || this.document || this,
  5806. dataHolder = document.documentMode ? this : doc,
  5807. attaches = dataPriv.get( dataHolder, delegateType ) - 1;
  5808.  
  5809. if ( !attaches ) {
  5810. if ( document.documentMode ) {
  5811. this.removeEventListener( delegateType, focusMappedHandler );
  5812. } else {
  5813. doc.removeEventListener( type, focusMappedHandler, true );
  5814. }
  5815. dataPriv.remove( dataHolder, delegateType );
  5816. } else {
  5817. dataPriv.set( dataHolder, delegateType, attaches );
  5818. }
  5819. }
  5820. };
  5821. } );
  5822.  
  5823. // Create mouseenter/leave events using mouseover/out and event-time checks
  5824. // so that event delegation works in jQuery.
  5825. // Do the same for pointerenter/pointerleave and pointerover/pointerout
  5826. //
  5827. // Support: Safari 7 only
  5828. // Safari sends mouseenter too often; see:
  5829. // https://bugs.chromium.org/p/chromium/issues/detail?id=470258
  5830. // for the description of the bug (it existed in older Chrome versions as well).
  5831. jQuery.each( {
  5832. mouseenter: "mouseover",
  5833. mouseleave: "mouseout",
  5834. pointerenter: "pointerover",
  5835. pointerleave: "pointerout"
  5836. }, function( orig, fix ) {
  5837. jQuery.event.special[ orig ] = {
  5838. delegateType: fix,
  5839. bindType: fix,
  5840.  
  5841. handle: function( event ) {
  5842. var ret,
  5843. target = this,
  5844. related = event.relatedTarget,
  5845. handleObj = event.handleObj;
  5846.  
  5847. // For mouseenter/leave call the handler if related is outside the target.
  5848. // NB: No relatedTarget if the mouse left/entered the browser window
  5849. if ( !related || ( related !== target && !jQuery.contains( target, related ) ) ) {
  5850. event.type = handleObj.origType;
  5851. ret = handleObj.handler.apply( this, arguments );
  5852. event.type = fix;
  5853. }
  5854. return ret;
  5855. }
  5856. };
  5857. } );
  5858.  
  5859. jQuery.fn.extend( {
  5860.  
  5861. on: function( types, selector, data, fn ) {
  5862. return on( this, types, selector, data, fn );
  5863. },
  5864. one: function( types, selector, data, fn ) {
  5865. return on( this, types, selector, data, fn, 1 );
  5866. },
  5867. off: function( types, selector, fn ) {
  5868. var handleObj, type;
  5869. if ( types && types.preventDefault && types.handleObj ) {
  5870.  
  5871. // ( event ) dispatched jQuery.Event
  5872. handleObj = types.handleObj;
  5873. jQuery( types.delegateTarget ).off(
  5874. handleObj.namespace ?
  5875. handleObj.origType + "." + handleObj.namespace :
  5876. handleObj.origType,
  5877. handleObj.selector,
  5878. handleObj.handler
  5879. );
  5880. return this;
  5881. }
  5882. if ( typeof types === "object" ) {
  5883.  
  5884. // ( types-object [, selector] )
  5885. for ( type in types ) {
  5886. this.off( type, selector, types[ type ] );
  5887. }
  5888. return this;
  5889. }
  5890. if ( selector === false || typeof selector === "function" ) {
  5891.  
  5892. // ( types [, fn] )
  5893. fn = selector;
  5894. selector = undefined;
  5895. }
  5896. if ( fn === false ) {
  5897. fn = returnFalse;
  5898. }
  5899. return this.each( function() {
  5900. jQuery.event.remove( this, types, fn, selector );
  5901. } );
  5902. }
  5903. } );
  5904.  
  5905.  
  5906. var
  5907.  
  5908. // Support: IE <=10 - 11, Edge 12 - 13 only
  5909. // In IE/Edge using regex groups here causes severe slowdowns.
  5910. // See https://connect.microsoft.com/IE/feedback/details/1736512/
  5911. rnoInnerhtml = /<script|<style|<link/i,
  5912.  
  5913. // checked="checked" or checked
  5914. rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
  5915.  
  5916. rcleanScript = /^\s*<!\[CDATA\[|\]\]>\s*$/g;
  5917.  
  5918. // Prefer a tbody over its parent table for containing new rows
  5919. function manipulationTarget( elem, content ) {
  5920. if ( nodeName( elem, "table" ) &&
  5921. nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ) {
  5922.  
  5923. return jQuery( elem ).children( "tbody" )[ 0 ] || elem;
  5924. }
  5925.  
  5926. return elem;
  5927. }
  5928.  
  5929. // Replace/restore the type attribute of script elements for safe DOM manipulation
  5930. function disableScript( elem ) {
  5931. elem.type = ( elem.getAttribute( "type" ) !== null ) + "/" + elem.type;
  5932. return elem;
  5933. }
  5934. function restoreScript( elem ) {
  5935. if ( ( elem.type || "" ).slice( 0, 5 ) === "true/" ) {
  5936. elem.type = elem.type.slice( 5 );
  5937. } else {
  5938. elem.removeAttribute( "type" );
  5939. }
  5940.  
  5941. return elem;
  5942. }
  5943.  
  5944. function cloneCopyEvent( src, dest ) {
  5945. var i, l, type, pdataOld, udataOld, udataCur, events;
  5946.  
  5947. if ( dest.nodeType !== 1 ) {
  5948. return;
  5949. }
  5950.  
  5951. // 1. Copy private data: events, handlers, etc.
  5952. if ( dataPriv.hasData( src ) ) {
  5953. pdataOld = dataPriv.get( src );
  5954. events = pdataOld.events;
  5955.  
  5956. if ( events ) {
  5957. dataPriv.remove( dest, "handle events" );
  5958.  
  5959. for ( type in events ) {
  5960. for ( i = 0, l = events[ type ].length; i < l; i++ ) {
  5961. jQuery.event.add( dest, type, events[ type ][ i ] );
  5962. }
  5963. }
  5964. }
  5965. }
  5966.  
  5967. // 2. Copy user data
  5968. if ( dataUser.hasData( src ) ) {
  5969. udataOld = dataUser.access( src );
  5970. udataCur = jQuery.extend( {}, udataOld );
  5971.  
  5972. dataUser.set( dest, udataCur );
  5973. }
  5974. }
  5975.  
  5976. // Fix IE bugs, see support tests
  5977. function fixInput( src, dest ) {
  5978. var nodeName = dest.nodeName.toLowerCase();
  5979.  
  5980. // Fails to persist the checked state of a cloned checkbox or radio button.
  5981. if ( nodeName === "input" && rcheckableType.test( src.type ) ) {
  5982. dest.checked = src.checked;
  5983.  
  5984. // Fails to return the selected option to the default selected state when cloning options
  5985. } else if ( nodeName === "input" || nodeName === "textarea" ) {
  5986. dest.defaultValue = src.defaultValue;
  5987. }
  5988. }
  5989.  
  5990. function domManip( collection, args, callback, ignored ) {
  5991.  
  5992. // Flatten any nested arrays
  5993. args = flat( args );
  5994.  
  5995. var fragment, first, scripts, hasScripts, node, doc,
  5996. i = 0,
  5997. l = collection.length,
  5998. iNoClone = l - 1,
  5999. value = args[ 0 ],
  6000. valueIsFunction = isFunction( value );
  6001.  
  6002. // We can't cloneNode fragments that contain checked, in WebKit
  6003. if ( valueIsFunction ||
  6004. ( l > 1 && typeof value === "string" &&
  6005. !support.checkClone && rchecked.test( value ) ) ) {
  6006. return collection.each( function( index ) {
  6007. var self = collection.eq( index );
  6008. if ( valueIsFunction ) {
  6009. args[ 0 ] = value.call( this, index, self.html() );
  6010. }
  6011. domManip( self, args, callback, ignored );
  6012. } );
  6013. }
  6014.  
  6015. if ( l ) {
  6016. fragment = buildFragment( args, collection[ 0 ].ownerDocument, false, collection, ignored );
  6017. first = fragment.firstChild;
  6018.  
  6019. if ( fragment.childNodes.length === 1 ) {
  6020. fragment = first;
  6021. }
  6022.  
  6023. // Require either new content or an interest in ignored elements to invoke the callback
  6024. if ( first || ignored ) {
  6025. scripts = jQuery.map( getAll( fragment, "script" ), disableScript );
  6026. hasScripts = scripts.length;
  6027.  
  6028. // Use the original fragment for the last item
  6029. // instead of the first because it can end up
  6030. // being emptied incorrectly in certain situations (trac-8070).
  6031. for ( ; i < l; i++ ) {
  6032. node = fragment;
  6033.  
  6034. if ( i !== iNoClone ) {
  6035. node = jQuery.clone( node, true, true );
  6036.  
  6037. // Keep references to cloned scripts for later restoration
  6038. if ( hasScripts ) {
  6039.  
  6040. // Support: Android <=4.0 only, PhantomJS 1 only
  6041. // push.apply(_, arraylike) throws on ancient WebKit
  6042. jQuery.merge( scripts, getAll( node, "script" ) );
  6043. }
  6044. }
  6045.  
  6046. callback.call( collection[ i ], node, i );
  6047. }
  6048.  
  6049. if ( hasScripts ) {
  6050. doc = scripts[ scripts.length - 1 ].ownerDocument;
  6051.  
  6052. // Re-enable scripts
  6053. jQuery.map( scripts, restoreScript );
  6054.  
  6055. // Evaluate executable scripts on first document insertion
  6056. for ( i = 0; i < hasScripts; i++ ) {
  6057. node = scripts[ i ];
  6058. if ( rscriptType.test( node.type || "" ) &&
  6059. !dataPriv.access( node, "globalEval" ) &&
  6060. jQuery.contains( doc, node ) ) {
  6061.  
  6062. if ( node.src && ( node.type || "" ).toLowerCase() !== "module" ) {
  6063.  
  6064. // Optional AJAX dependency, but won't run scripts if not present
  6065. if ( jQuery._evalUrl && !node.noModule ) {
  6066. jQuery._evalUrl( node.src, {
  6067. nonce: node.nonce || node.getAttribute( "nonce" )
  6068. }, doc );
  6069. }
  6070. } else {
  6071.  
  6072. // Unwrap a CDATA section containing script contents. This shouldn't be
  6073. // needed as in XML documents they're already not visible when
  6074. // inspecting element contents and in HTML documents they have no
  6075. // meaning but we're preserving that logic for backwards compatibility.
  6076. // This will be removed completely in 4.0. See gh-4904.
  6077. DOMEval( node.textContent.replace( rcleanScript, "" ), node, doc );
  6078. }
  6079. }
  6080. }
  6081. }
  6082. }
  6083. }
  6084.  
  6085. return collection;
  6086. }
  6087.  
  6088. function remove( elem, selector, keepData ) {
  6089. var node,
  6090. nodes = selector ? jQuery.filter( selector, elem ) : elem,
  6091. i = 0;
  6092.  
  6093. for ( ; ( node = nodes[ i ] ) != null; i++ ) {
  6094. if ( !keepData && node.nodeType === 1 ) {
  6095. jQuery.cleanData( getAll( node ) );
  6096. }
  6097.  
  6098. if ( node.parentNode ) {
  6099. if ( keepData && isAttached( node ) ) {
  6100. setGlobalEval( getAll( node, "script" ) );
  6101. }
  6102. node.parentNode.removeChild( node );
  6103. }
  6104. }
  6105.  
  6106. return elem;
  6107. }
  6108.  
  6109. jQuery.extend( {
  6110. htmlPrefilter: function( html ) {
  6111. return html;
  6112. },
  6113.  
  6114. clone: function( elem, dataAndEvents, deepDataAndEvents ) {
  6115. var i, l, srcElements, destElements,
  6116. clone = elem.cloneNode( true ),
  6117. inPage = isAttached( elem );
  6118.  
  6119. // Fix IE cloning issues
  6120. if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) &&
  6121. !jQuery.isXMLDoc( elem ) ) {
  6122.  
  6123. // We eschew jQuery#find here for performance reasons:
  6124. // https://jsperf.com/getall-vs-sizzle/2
  6125. destElements = getAll( clone );
  6126. srcElements = getAll( elem );
  6127.  
  6128. for ( i = 0, l = srcElements.length; i < l; i++ ) {
  6129. fixInput( srcElements[ i ], destElements[ i ] );
  6130. }
  6131. }
  6132.  
  6133. // Copy the events from the original to the clone
  6134. if ( dataAndEvents ) {
  6135. if ( deepDataAndEvents ) {
  6136. srcElements = srcElements || getAll( elem );
  6137. destElements = destElements || getAll( clone );
  6138.  
  6139. for ( i = 0, l = srcElements.length; i < l; i++ ) {
  6140. cloneCopyEvent( srcElements[ i ], destElements[ i ] );
  6141. }
  6142. } else {
  6143. cloneCopyEvent( elem, clone );
  6144. }
  6145. }
  6146.  
  6147. // Preserve script evaluation history
  6148. destElements = getAll( clone, "script" );
  6149. if ( destElements.length > 0 ) {
  6150. setGlobalEval( destElements, !inPage && getAll( elem, "script" ) );
  6151. }
  6152.  
  6153. // Return the cloned set
  6154. return clone;
  6155. },
  6156.  
  6157. cleanData: function( elems ) {
  6158. var data, elem, type,
  6159. special = jQuery.event.special,
  6160. i = 0;
  6161.  
  6162. for ( ; ( elem = elems[ i ] ) !== undefined; i++ ) {
  6163. if ( acceptData( elem ) ) {
  6164. if ( ( data = elem[ dataPriv.expando ] ) ) {
  6165. if ( data.events ) {
  6166. for ( type in data.events ) {
  6167. if ( special[ type ] ) {
  6168. jQuery.event.remove( elem, type );
  6169.  
  6170. // This is a shortcut to avoid jQuery.event.remove's overhead
  6171. } else {
  6172. jQuery.removeEvent( elem, type, data.handle );
  6173. }
  6174. }
  6175. }
  6176.  
  6177. // Support: Chrome <=35 - 45+
  6178. // Assign undefined instead of using delete, see Data#remove
  6179. elem[ dataPriv.expando ] = undefined;
  6180. }
  6181. if ( elem[ dataUser.expando ] ) {
  6182.  
  6183. // Support: Chrome <=35 - 45+
  6184. // Assign undefined instead of using delete, see Data#remove
  6185. elem[ dataUser.expando ] = undefined;
  6186. }
  6187. }
  6188. }
  6189. }
  6190. } );
  6191.  
  6192. jQuery.fn.extend( {
  6193. detach: function( selector ) {
  6194. return remove( this, selector, true );
  6195. },
  6196.  
  6197. remove: function( selector ) {
  6198. return remove( this, selector );
  6199. },
  6200.  
  6201. text: function( value ) {
  6202. return access( this, function( value ) {
  6203. return value === undefined ?
  6204. jQuery.text( this ) :
  6205. this.empty().each( function() {
  6206. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  6207. this.textContent = value;
  6208. }
  6209. } );
  6210. }, null, value, arguments.length );
  6211. },
  6212.  
  6213. append: function() {
  6214. return domManip( this, arguments, function( elem ) {
  6215. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  6216. var target = manipulationTarget( this, elem );
  6217. target.appendChild( elem );
  6218. }
  6219. } );
  6220. },
  6221.  
  6222. prepend: function() {
  6223. return domManip( this, arguments, function( elem ) {
  6224. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  6225. var target = manipulationTarget( this, elem );
  6226. target.insertBefore( elem, target.firstChild );
  6227. }
  6228. } );
  6229. },
  6230.  
  6231. before: function() {
  6232. return domManip( this, arguments, function( elem ) {
  6233. if ( this.parentNode ) {
  6234. this.parentNode.insertBefore( elem, this );
  6235. }
  6236. } );
  6237. },
  6238.  
  6239. after: function() {
  6240. return domManip( this, arguments, function( elem ) {
  6241. if ( this.parentNode ) {
  6242. this.parentNode.insertBefore( elem, this.nextSibling );
  6243. }
  6244. } );
  6245. },
  6246.  
  6247. empty: function() {
  6248. var elem,
  6249. i = 0;
  6250.  
  6251. for ( ; ( elem = this[ i ] ) != null; i++ ) {
  6252. if ( elem.nodeType === 1 ) {
  6253.  
  6254. // Prevent memory leaks
  6255. jQuery.cleanData( getAll( elem, false ) );
  6256.  
  6257. // Remove any remaining nodes
  6258. elem.textContent = "";
  6259. }
  6260. }
  6261.  
  6262. return this;
  6263. },
  6264.  
  6265. clone: function( dataAndEvents, deepDataAndEvents ) {
  6266. dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
  6267. deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
  6268.  
  6269. return this.map( function() {
  6270. return jQuery.clone( this, dataAndEvents, deepDataAndEvents );
  6271. } );
  6272. },
  6273.  
  6274. html: function( value ) {
  6275. return access( this, function( value ) {
  6276. var elem = this[ 0 ] || {},
  6277. i = 0,
  6278. l = this.length;
  6279.  
  6280. if ( value === undefined && elem.nodeType === 1 ) {
  6281. return elem.innerHTML;
  6282. }
  6283.  
  6284. // See if we can take a shortcut and just use innerHTML
  6285. if ( typeof value === "string" && !rnoInnerhtml.test( value ) &&
  6286. !wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) {
  6287.  
  6288. value = jQuery.htmlPrefilter( value );
  6289.  
  6290. try {
  6291. for ( ; i < l; i++ ) {
  6292. elem = this[ i ] || {};
  6293.  
  6294. // Remove element nodes and prevent memory leaks
  6295. if ( elem.nodeType === 1 ) {
  6296. jQuery.cleanData( getAll( elem, false ) );
  6297. elem.innerHTML = value;
  6298. }
  6299. }
  6300.  
  6301. elem = 0;
  6302.  
  6303. // If using innerHTML throws an exception, use the fallback method
  6304. } catch ( e ) {}
  6305. }
  6306.  
  6307. if ( elem ) {
  6308. this.empty().append( value );
  6309. }
  6310. }, null, value, arguments.length );
  6311. },
  6312.  
  6313. replaceWith: function() {
  6314. var ignored = [];
  6315.  
  6316. // Make the changes, replacing each non-ignored context element with the new content
  6317. return domManip( this, arguments, function( elem ) {
  6318. var parent = this.parentNode;
  6319.  
  6320. if ( jQuery.inArray( this, ignored ) < 0 ) {
  6321. jQuery.cleanData( getAll( this ) );
  6322. if ( parent ) {
  6323. parent.replaceChild( elem, this );
  6324. }
  6325. }
  6326.  
  6327. // Force callback invocation
  6328. }, ignored );
  6329. }
  6330. } );
  6331.  
  6332. jQuery.each( {
  6333. appendTo: "append",
  6334. prependTo: "prepend",
  6335. insertBefore: "before",
  6336. insertAfter: "after",
  6337. replaceAll: "replaceWith"
  6338. }, function( name, original ) {
  6339. jQuery.fn[ name ] = function( selector ) {
  6340. var elems,
  6341. ret = [],
  6342. insert = jQuery( selector ),
  6343. last = insert.length - 1,
  6344. i = 0;
  6345.  
  6346. for ( ; i <= last; i++ ) {
  6347. elems = i === last ? this : this.clone( true );
  6348. jQuery( insert[ i ] )[ original ]( elems );
  6349.  
  6350. // Support: Android <=4.0 only, PhantomJS 1 only
  6351. // .get() because push.apply(_, arraylike) throws on ancient WebKit
  6352. push.apply( ret, elems.get() );
  6353. }
  6354.  
  6355. return this.pushStack( ret );
  6356. };
  6357. } );
  6358. var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" );
  6359.  
  6360. var rcustomProp = /^--/;
  6361.  
  6362.  
  6363. var getStyles = function( elem ) {
  6364.  
  6365. // Support: IE <=11 only, Firefox <=30 (trac-15098, trac-14150)
  6366. // IE throws on elements created in popups
  6367. // FF meanwhile throws on frame elements through "defaultView.getComputedStyle"
  6368. var view = elem.ownerDocument.defaultView;
  6369.  
  6370. if ( !view || !view.opener ) {
  6371. view = window;
  6372. }
  6373.  
  6374. return view.getComputedStyle( elem );
  6375. };
  6376.  
  6377. var swap = function( elem, options, callback ) {
  6378. var ret, name,
  6379. old = {};
  6380.  
  6381. // Remember the old values, and insert the new ones
  6382. for ( name in options ) {
  6383. old[ name ] = elem.style[ name ];
  6384. elem.style[ name ] = options[ name ];
  6385. }
  6386.  
  6387. ret = callback.call( elem );
  6388.  
  6389. // Revert the old values
  6390. for ( name in options ) {
  6391. elem.style[ name ] = old[ name ];
  6392. }
  6393.  
  6394. return ret;
  6395. };
  6396.  
  6397.  
  6398. var rboxStyle = new RegExp( cssExpand.join( "|" ), "i" );
  6399.  
  6400.  
  6401.  
  6402. ( function() {
  6403.  
  6404. // Executing both pixelPosition & boxSizingReliable tests require only one layout
  6405. // so they're executed at the same time to save the second computation.
  6406. function computeStyleTests() {
  6407.  
  6408. // This is a singleton, we need to execute it only once
  6409. if ( !div ) {
  6410. return;
  6411. }
  6412.  
  6413. container.style.cssText = "position:absolute;left:-11111px;width:60px;" +
  6414. "margin-top:1px;padding:0;border:0";
  6415. div.style.cssText =
  6416. "position:relative;display:block;box-sizing:border-box;overflow:scroll;" +
  6417. "margin:auto;border:1px;padding:1px;" +
  6418. "width:60%;top:1%";
  6419. documentElement.appendChild( container ).appendChild( div );
  6420.  
  6421. var divStyle = window.getComputedStyle( div );
  6422. pixelPositionVal = divStyle.top !== "1%";
  6423.  
  6424. // Support: Android 4.0 - 4.3 only, Firefox <=3 - 44
  6425. reliableMarginLeftVal = roundPixelMeasures( divStyle.marginLeft ) === 12;
  6426.  
  6427. // Support: Android 4.0 - 4.3 only, Safari <=9.1 - 10.1, iOS <=7.0 - 9.3
  6428. // Some styles come back with percentage values, even though they shouldn't
  6429. div.style.right = "60%";
  6430. pixelBoxStylesVal = roundPixelMeasures( divStyle.right ) === 36;
  6431.  
  6432. // Support: IE 9 - 11 only
  6433. // Detect misreporting of content dimensions for box-sizing:border-box elements
  6434. boxSizingReliableVal = roundPixelMeasures( divStyle.width ) === 36;
  6435.  
  6436. // Support: IE 9 only
  6437. // Detect overflow:scroll screwiness (gh-3699)
  6438. // Support: Chrome <=64
  6439. // Don't get tricked when zoom affects offsetWidth (gh-4029)
  6440. div.style.position = "absolute";
  6441. scrollboxSizeVal = roundPixelMeasures( div.offsetWidth / 3 ) === 12;
  6442.  
  6443. documentElement.removeChild( container );
  6444.  
  6445. // Nullify the div so it wouldn't be stored in the memory and
  6446. // it will also be a sign that checks already performed
  6447. div = null;
  6448. }
  6449.  
  6450. function roundPixelMeasures( measure ) {
  6451. return Math.round( parseFloat( measure ) );
  6452. }
  6453.  
  6454. var pixelPositionVal, boxSizingReliableVal, scrollboxSizeVal, pixelBoxStylesVal,
  6455. reliableTrDimensionsVal, reliableMarginLeftVal,
  6456. container = document.createElement( "div" ),
  6457. div = document.createElement( "div" );
  6458.  
  6459. // Finish early in limited (non-browser) environments
  6460. if ( !div.style ) {
  6461. return;
  6462. }
  6463.  
  6464. // Support: IE <=9 - 11 only
  6465. // Style of cloned element affects source element cloned (trac-8908)
  6466. div.style.backgroundClip = "content-box";
  6467. div.cloneNode( true ).style.backgroundClip = "";
  6468. support.clearCloneStyle = div.style.backgroundClip === "content-box";
  6469.  
  6470. jQuery.extend( support, {
  6471. boxSizingReliable: function() {
  6472. computeStyleTests();
  6473. return boxSizingReliableVal;
  6474. },
  6475. pixelBoxStyles: function() {
  6476. computeStyleTests();
  6477. return pixelBoxStylesVal;
  6478. },
  6479. pixelPosition: function() {
  6480. computeStyleTests();
  6481. return pixelPositionVal;
  6482. },
  6483. reliableMarginLeft: function() {
  6484. computeStyleTests();
  6485. return reliableMarginLeftVal;
  6486. },
  6487. scrollboxSize: function() {
  6488. computeStyleTests();
  6489. return scrollboxSizeVal;
  6490. },
  6491.  
  6492. // Support: IE 9 - 11+, Edge 15 - 18+
  6493. // IE/Edge misreport `getComputedStyle` of table rows with width/height
  6494. // set in CSS while `offset*` properties report correct values.
  6495. // Behavior in IE 9 is more subtle than in newer versions & it passes
  6496. // some versions of this test; make sure not to make it pass there!
  6497. //
  6498. // Support: Firefox 70+
  6499. // Only Firefox includes border widths
  6500. // in computed dimensions. (gh-4529)
  6501. reliableTrDimensions: function() {
  6502. var table, tr, trChild, trStyle;
  6503. if ( reliableTrDimensionsVal == null ) {
  6504. table = document.createElement( "table" );
  6505. tr = document.createElement( "tr" );
  6506. trChild = document.createElement( "div" );
  6507.  
  6508. table.style.cssText = "position:absolute;left:-11111px;border-collapse:separate";
  6509. tr.style.cssText = "box-sizing:content-box;border:1px solid";
  6510.  
  6511. // Support: Chrome 86+
  6512. // Height set through cssText does not get applied.
  6513. // Computed height then comes back as 0.
  6514. tr.style.height = "1px";
  6515. trChild.style.height = "9px";
  6516.  
  6517. // Support: Android 8 Chrome 86+
  6518. // In our bodyBackground.html iframe,
  6519. // display for all div elements is set to "inline",
  6520. // which causes a problem only in Android 8 Chrome 86.
  6521. // Ensuring the div is `display: block`
  6522. // gets around this issue.
  6523. trChild.style.display = "block";
  6524.  
  6525. documentElement
  6526. .appendChild( table )
  6527. .appendChild( tr )
  6528. .appendChild( trChild );
  6529.  
  6530. trStyle = window.getComputedStyle( tr );
  6531. reliableTrDimensionsVal = ( parseInt( trStyle.height, 10 ) +
  6532. parseInt( trStyle.borderTopWidth, 10 ) +
  6533. parseInt( trStyle.borderBottomWidth, 10 ) ) === tr.offsetHeight;
  6534.  
  6535. documentElement.removeChild( table );
  6536. }
  6537. return reliableTrDimensionsVal;
  6538. }
  6539. } );
  6540. } )();
  6541.  
  6542.  
  6543. function curCSS( elem, name, computed ) {
  6544. var width, minWidth, maxWidth, ret,
  6545. isCustomProp = rcustomProp.test( name ),
  6546.  
  6547. // Support: Firefox 51+
  6548. // Retrieving style before computed somehow
  6549. // fixes an issue with getting wrong values
  6550. // on detached elements
  6551. style = elem.style;
  6552.  
  6553. computed = computed || getStyles( elem );
  6554.  
  6555. // getPropertyValue is needed for:
  6556. // .css('filter') (IE 9 only, trac-12537)
  6557. // .css('--customProperty) (gh-3144)
  6558. if ( computed ) {
  6559.  
  6560. // Support: IE <=9 - 11+
  6561. // IE only supports `"float"` in `getPropertyValue`; in computed styles
  6562. // it's only available as `"cssFloat"`. We no longer modify properties
  6563. // sent to `.css()` apart from camelCasing, so we need to check both.
  6564. // Normally, this would create difference in behavior: if
  6565. // `getPropertyValue` returns an empty string, the value returned
  6566. // by `.css()` would be `undefined`. This is usually the case for
  6567. // disconnected elements. However, in IE even disconnected elements
  6568. // with no styles return `"none"` for `getPropertyValue( "float" )`
  6569. ret = computed.getPropertyValue( name ) || computed[ name ];
  6570.  
  6571. if ( isCustomProp && ret ) {
  6572.  
  6573. // Support: Firefox 105+, Chrome <=105+
  6574. // Spec requires trimming whitespace for custom properties (gh-4926).
  6575. // Firefox only trims leading whitespace. Chrome just collapses
  6576. // both leading & trailing whitespace to a single space.
  6577. //
  6578. // Fall back to `undefined` if empty string returned.
  6579. // This collapses a missing definition with property defined
  6580. // and set to an empty string but there's no standard API
  6581. // allowing us to differentiate them without a performance penalty
  6582. // and returning `undefined` aligns with older jQuery.
  6583. //
  6584. // rtrimCSS treats U+000D CARRIAGE RETURN and U+000C FORM FEED
  6585. // as whitespace while CSS does not, but this is not a problem
  6586. // because CSS preprocessing replaces them with U+000A LINE FEED
  6587. // (which *is* CSS whitespace)
  6588. // https://www.w3.org/TR/css-syntax-3/#input-preprocessing
  6589. ret = ret.replace( rtrimCSS, "$1" ) || undefined;
  6590. }
  6591.  
  6592. if ( ret === "" && !isAttached( elem ) ) {
  6593. ret = jQuery.style( elem, name );
  6594. }
  6595.  
  6596. // A tribute to the "awesome hack by Dean Edwards"
  6597. // Android Browser returns percentage for some values,
  6598. // but width seems to be reliably pixels.
  6599. // This is against the CSSOM draft spec:
  6600. // https://drafts.csswg.org/cssom/#resolved-values
  6601. if ( !support.pixelBoxStyles() && rnumnonpx.test( ret ) && rboxStyle.test( name ) ) {
  6602.  
  6603. // Remember the original values
  6604. width = style.width;
  6605. minWidth = style.minWidth;
  6606. maxWidth = style.maxWidth;
  6607.  
  6608. // Put in the new values to get a computed value out
  6609. style.minWidth = style.maxWidth = style.width = ret;
  6610. ret = computed.width;
  6611.  
  6612. // Revert the changed values
  6613. style.width = width;
  6614. style.minWidth = minWidth;
  6615. style.maxWidth = maxWidth;
  6616. }
  6617. }
  6618.  
  6619. return ret !== undefined ?
  6620.  
  6621. // Support: IE <=9 - 11 only
  6622. // IE returns zIndex value as an integer.
  6623. ret + "" :
  6624. ret;
  6625. }
  6626.  
  6627.  
  6628. function addGetHookIf( conditionFn, hookFn ) {
  6629.  
  6630. // Define the hook, we'll check on the first run if it's really needed.
  6631. return {
  6632. get: function() {
  6633. if ( conditionFn() ) {
  6634.  
  6635. // Hook not needed (or it's not possible to use it due
  6636. // to missing dependency), remove it.
  6637. delete this.get;
  6638. return;
  6639. }
  6640.  
  6641. // Hook needed; redefine it so that the support test is not executed again.
  6642. return ( this.get = hookFn ).apply( this, arguments );
  6643. }
  6644. };
  6645. }
  6646.  
  6647.  
  6648. var cssPrefixes = [ "Webkit", "Moz", "ms" ],
  6649. emptyStyle = document.createElement( "div" ).style,
  6650. vendorProps = {};
  6651.  
  6652. // Return a vendor-prefixed property or undefined
  6653. function vendorPropName( name ) {
  6654.  
  6655. // Check for vendor prefixed names
  6656. var capName = name[ 0 ].toUpperCase() + name.slice( 1 ),
  6657. i = cssPrefixes.length;
  6658.  
  6659. while ( i-- ) {
  6660. name = cssPrefixes[ i ] + capName;
  6661. if ( name in emptyStyle ) {
  6662. return name;
  6663. }
  6664. }
  6665. }
  6666.  
  6667. // Return a potentially-mapped jQuery.cssProps or vendor prefixed property
  6668. function finalPropName( name ) {
  6669. var final = jQuery.cssProps[ name ] || vendorProps[ name ];
  6670.  
  6671. if ( final ) {
  6672. return final;
  6673. }
  6674. if ( name in emptyStyle ) {
  6675. return name;
  6676. }
  6677. return vendorProps[ name ] = vendorPropName( name ) || name;
  6678. }
  6679.  
  6680.  
  6681. var
  6682.  
  6683. // Swappable if display is none or starts with table
  6684. // except "table", "table-cell", or "table-caption"
  6685. // See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display
  6686. rdisplayswap = /^(none|table(?!-c[ea]).+)/,
  6687. cssShow = { position: "absolute", visibility: "hidden", display: "block" },
  6688. cssNormalTransform = {
  6689. letterSpacing: "0",
  6690. fontWeight: "400"
  6691. };
  6692.  
  6693. function setPositiveNumber( _elem, value, subtract ) {
  6694.  
  6695. // Any relative (+/-) values have already been
  6696. // normalized at this point
  6697. var matches = rcssNum.exec( value );
  6698. return matches ?
  6699.  
  6700. // Guard against undefined "subtract", e.g., when used as in cssHooks
  6701. Math.max( 0, matches[ 2 ] - ( subtract || 0 ) ) + ( matches[ 3 ] || "px" ) :
  6702. value;
  6703. }
  6704.  
  6705. function boxModelAdjustment( elem, dimension, box, isBorderBox, styles, computedVal ) {
  6706. var i = dimension === "width" ? 1 : 0,
  6707. extra = 0,
  6708. delta = 0,
  6709. marginDelta = 0;
  6710.  
  6711. // Adjustment may not be necessary
  6712. if ( box === ( isBorderBox ? "border" : "content" ) ) {
  6713. return 0;
  6714. }
  6715.  
  6716. for ( ; i < 4; i += 2 ) {
  6717.  
  6718. // Both box models exclude margin
  6719. // Count margin delta separately to only add it after scroll gutter adjustment.
  6720. // This is needed to make negative margins work with `outerHeight( true )` (gh-3982).
  6721. if ( box === "margin" ) {
  6722. marginDelta += jQuery.css( elem, box + cssExpand[ i ], true, styles );
  6723. }
  6724.  
  6725. // If we get here with a content-box, we're seeking "padding" or "border" or "margin"
  6726. if ( !isBorderBox ) {
  6727.  
  6728. // Add padding
  6729. delta += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
  6730.  
  6731. // For "border" or "margin", add border
  6732. if ( box !== "padding" ) {
  6733. delta += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  6734.  
  6735. // But still keep track of it otherwise
  6736. } else {
  6737. extra += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  6738. }
  6739.  
  6740. // If we get here with a border-box (content + padding + border), we're seeking "content" or
  6741. // "padding" or "margin"
  6742. } else {
  6743.  
  6744. // For "content", subtract padding
  6745. if ( box === "content" ) {
  6746. delta -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
  6747. }
  6748.  
  6749. // For "content" or "padding", subtract border
  6750. if ( box !== "margin" ) {
  6751. delta -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  6752. }
  6753. }
  6754. }
  6755.  
  6756. // Account for positive content-box scroll gutter when requested by providing computedVal
  6757. if ( !isBorderBox && computedVal >= 0 ) {
  6758.  
  6759. // offsetWidth/offsetHeight is a rounded sum of content, padding, scroll gutter, and border
  6760. // Assuming integer scroll gutter, subtract the rest and round down
  6761. delta += Math.max( 0, Math.ceil(
  6762. elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] -
  6763. computedVal -
  6764. delta -
  6765. extra -
  6766. 0.5
  6767.  
  6768. // If offsetWidth/offsetHeight is unknown, then we can't determine content-box scroll gutter
  6769. // Use an explicit zero to avoid NaN (gh-3964)
  6770. ) ) || 0;
  6771. }
  6772.  
  6773. return delta + marginDelta;
  6774. }
  6775.  
  6776. function getWidthOrHeight( elem, dimension, extra ) {
  6777.  
  6778. // Start with computed style
  6779. var styles = getStyles( elem ),
  6780.  
  6781. // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-4322).
  6782. // Fake content-box until we know it's needed to know the true value.
  6783. boxSizingNeeded = !support.boxSizingReliable() || extra,
  6784. isBorderBox = boxSizingNeeded &&
  6785. jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
  6786. valueIsBorderBox = isBorderBox,
  6787.  
  6788. val = curCSS( elem, dimension, styles ),
  6789. offsetProp = "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 );
  6790.  
  6791. // Support: Firefox <=54
  6792. // Return a confounding non-pixel value or feign ignorance, as appropriate.
  6793. if ( rnumnonpx.test( val ) ) {
  6794. if ( !extra ) {
  6795. return val;
  6796. }
  6797. val = "auto";
  6798. }
  6799.  
  6800.  
  6801. // Support: IE 9 - 11 only
  6802. // Use offsetWidth/offsetHeight for when box sizing is unreliable.
  6803. // In those cases, the computed value can be trusted to be border-box.
  6804. if ( ( !support.boxSizingReliable() && isBorderBox ||
  6805.  
  6806. // Support: IE 10 - 11+, Edge 15 - 18+
  6807. // IE/Edge misreport `getComputedStyle` of table rows with width/height
  6808. // set in CSS while `offset*` properties report correct values.
  6809. // Interestingly, in some cases IE 9 doesn't suffer from this issue.
  6810. !support.reliableTrDimensions() && nodeName( elem, "tr" ) ||
  6811.  
  6812. // Fall back to offsetWidth/offsetHeight when value is "auto"
  6813. // This happens for inline elements with no explicit setting (gh-3571)
  6814. val === "auto" ||
  6815.  
  6816. // Support: Android <=4.1 - 4.3 only
  6817. // Also use offsetWidth/offsetHeight for misreported inline dimensions (gh-3602)
  6818. !parseFloat( val ) && jQuery.css( elem, "display", false, styles ) === "inline" ) &&
  6819.  
  6820. // Make sure the element is visible & connected
  6821. elem.getClientRects().length ) {
  6822.  
  6823. isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box";
  6824.  
  6825. // Where available, offsetWidth/offsetHeight approximate border box dimensions.
  6826. // Where not available (e.g., SVG), assume unreliable box-sizing and interpret the
  6827. // retrieved value as a content box dimension.
  6828. valueIsBorderBox = offsetProp in elem;
  6829. if ( valueIsBorderBox ) {
  6830. val = elem[ offsetProp ];
  6831. }
  6832. }
  6833.  
  6834. // Normalize "" and auto
  6835. val = parseFloat( val ) || 0;
  6836.  
  6837. // Adjust for the element's box model
  6838. return ( val +
  6839. boxModelAdjustment(
  6840. elem,
  6841. dimension,
  6842. extra || ( isBorderBox ? "border" : "content" ),
  6843. valueIsBorderBox,
  6844. styles,
  6845.  
  6846. // Provide the current computed size to request scroll gutter calculation (gh-3589)
  6847. val
  6848. )
  6849. ) + "px";
  6850. }
  6851.  
  6852. jQuery.extend( {
  6853.  
  6854. // Add in style property hooks for overriding the default
  6855. // behavior of getting and setting a style property
  6856. cssHooks: {
  6857. opacity: {
  6858. get: function( elem, computed ) {
  6859. if ( computed ) {
  6860.  
  6861. // We should always get a number back from opacity
  6862. var ret = curCSS( elem, "opacity" );
  6863. return ret === "" ? "1" : ret;
  6864. }
  6865. }
  6866. }
  6867. },
  6868.  
  6869. // Don't automatically add "px" to these possibly-unitless properties
  6870. cssNumber: {
  6871. animationIterationCount: true,
  6872. aspectRatio: true,
  6873. borderImageSlice: true,
  6874. columnCount: true,
  6875. flexGrow: true,
  6876. flexShrink: true,
  6877. fontWeight: true,
  6878. gridArea: true,
  6879. gridColumn: true,
  6880. gridColumnEnd: true,
  6881. gridColumnStart: true,
  6882. gridRow: true,
  6883. gridRowEnd: true,
  6884. gridRowStart: true,
  6885. lineHeight: true,
  6886. opacity: true,
  6887. order: true,
  6888. orphans: true,
  6889. scale: true,
  6890. widows: true,
  6891. zIndex: true,
  6892. zoom: true,
  6893.  
  6894. // SVG-related
  6895. fillOpacity: true,
  6896. floodOpacity: true,
  6897. stopOpacity: true,
  6898. strokeMiterlimit: true,
  6899. strokeOpacity: true
  6900. },
  6901.  
  6902. // Add in properties whose names you wish to fix before
  6903. // setting or getting the value
  6904. cssProps: {},
  6905.  
  6906. // Get and set the style property on a DOM Node
  6907. style: function( elem, name, value, extra ) {
  6908.  
  6909. // Don't set styles on text and comment nodes
  6910. if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {
  6911. return;
  6912. }
  6913.  
  6914. // Make sure that we're working with the right name
  6915. var ret, type, hooks,
  6916. origName = camelCase( name ),
  6917. isCustomProp = rcustomProp.test( name ),
  6918. style = elem.style;
  6919.  
  6920. // Make sure that we're working with the right name. We don't
  6921. // want to query the value if it is a CSS custom property
  6922. // since they are user-defined.
  6923. if ( !isCustomProp ) {
  6924. name = finalPropName( origName );
  6925. }
  6926.  
  6927. // Gets hook for the prefixed version, then unprefixed version
  6928. hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
  6929.  
  6930. // Check if we're setting a value
  6931. if ( value !== undefined ) {
  6932. type = typeof value;
  6933.  
  6934. // Convert "+=" or "-=" to relative numbers (trac-7345)
  6935. if ( type === "string" && ( ret = rcssNum.exec( value ) ) && ret[ 1 ] ) {
  6936. value = adjustCSS( elem, name, ret );
  6937.  
  6938. // Fixes bug trac-9237
  6939. type = "number";
  6940. }
  6941.  
  6942. // Make sure that null and NaN values aren't set (trac-7116)
  6943. if ( value == null || value !== value ) {
  6944. return;
  6945. }
  6946.  
  6947. // If a number was passed in, add the unit (except for certain CSS properties)
  6948. // The isCustomProp check can be removed in jQuery 4.0 when we only auto-append
  6949. // "px" to a few hardcoded values.
  6950. if ( type === "number" && !isCustomProp ) {
  6951. value += ret && ret[ 3 ] || ( jQuery.cssNumber[ origName ] ? "" : "px" );
  6952. }
  6953.  
  6954. // background-* props affect original clone's values
  6955. if ( !support.clearCloneStyle && value === "" && name.indexOf( "background" ) === 0 ) {
  6956. style[ name ] = "inherit";
  6957. }
  6958.  
  6959. // If a hook was provided, use that value, otherwise just set the specified value
  6960. if ( !hooks || !( "set" in hooks ) ||
  6961. ( value = hooks.set( elem, value, extra ) ) !== undefined ) {
  6962.  
  6963. if ( isCustomProp ) {
  6964. style.setProperty( name, value );
  6965. } else {
  6966. style[ name ] = value;
  6967. }
  6968. }
  6969.  
  6970. } else {
  6971.  
  6972. // If a hook was provided get the non-computed value from there
  6973. if ( hooks && "get" in hooks &&
  6974. ( ret = hooks.get( elem, false, extra ) ) !== undefined ) {
  6975.  
  6976. return ret;
  6977. }
  6978.  
  6979. // Otherwise just get the value from the style object
  6980. return style[ name ];
  6981. }
  6982. },
  6983.  
  6984. css: function( elem, name, extra, styles ) {
  6985. var val, num, hooks,
  6986. origName = camelCase( name ),
  6987. isCustomProp = rcustomProp.test( name );
  6988.  
  6989. // Make sure that we're working with the right name. We don't
  6990. // want to modify the value if it is a CSS custom property
  6991. // since they are user-defined.
  6992. if ( !isCustomProp ) {
  6993. name = finalPropName( origName );
  6994. }
  6995.  
  6996. // Try prefixed name followed by the unprefixed name
  6997. hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
  6998.  
  6999. // If a hook was provided get the computed value from there
  7000. if ( hooks && "get" in hooks ) {
  7001. val = hooks.get( elem, true, extra );
  7002. }
  7003.  
  7004. // Otherwise, if a way to get the computed value exists, use that
  7005. if ( val === undefined ) {
  7006. val = curCSS( elem, name, styles );
  7007. }
  7008.  
  7009. // Convert "normal" to computed value
  7010. if ( val === "normal" && name in cssNormalTransform ) {
  7011. val = cssNormalTransform[ name ];
  7012. }
  7013.  
  7014. // Make numeric if forced or a qualifier was provided and val looks numeric
  7015. if ( extra === "" || extra ) {
  7016. num = parseFloat( val );
  7017. return extra === true || isFinite( num ) ? num || 0 : val;
  7018. }
  7019.  
  7020. return val;
  7021. }
  7022. } );
  7023.  
  7024. jQuery.each( [ "height", "width" ], function( _i, dimension ) {
  7025. jQuery.cssHooks[ dimension ] = {
  7026. get: function( elem, computed, extra ) {
  7027. if ( computed ) {
  7028.  
  7029. // Certain elements can have dimension info if we invisibly show them
  7030. // but it must have a current display style that would benefit
  7031. return rdisplayswap.test( jQuery.css( elem, "display" ) ) &&
  7032.  
  7033. // Support: Safari 8+
  7034. // Table columns in Safari have non-zero offsetWidth & zero
  7035. // getBoundingClientRect().width unless display is changed.
  7036. // Support: IE <=11 only
  7037. // Running getBoundingClientRect on a disconnected node
  7038. // in IE throws an error.
  7039. ( !elem.getClientRects().length || !elem.getBoundingClientRect().width ) ?
  7040. swap( elem, cssShow, function() {
  7041. return getWidthOrHeight( elem, dimension, extra );
  7042. } ) :
  7043. getWidthOrHeight( elem, dimension, extra );
  7044. }
  7045. },
  7046.  
  7047. set: function( elem, value, extra ) {
  7048. var matches,
  7049. styles = getStyles( elem ),
  7050.  
  7051. // Only read styles.position if the test has a chance to fail
  7052. // to avoid forcing a reflow.
  7053. scrollboxSizeBuggy = !support.scrollboxSize() &&
  7054. styles.position === "absolute",
  7055.  
  7056. // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-3991)
  7057. boxSizingNeeded = scrollboxSizeBuggy || extra,
  7058. isBorderBox = boxSizingNeeded &&
  7059. jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
  7060. subtract = extra ?
  7061. boxModelAdjustment(
  7062. elem,
  7063. dimension,
  7064. extra,
  7065. isBorderBox,
  7066. styles
  7067. ) :
  7068. 0;
  7069.  
  7070. // Account for unreliable border-box dimensions by comparing offset* to computed and
  7071. // faking a content-box to get border and padding (gh-3699)
  7072. if ( isBorderBox && scrollboxSizeBuggy ) {
  7073. subtract -= Math.ceil(
  7074. elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] -
  7075. parseFloat( styles[ dimension ] ) -
  7076. boxModelAdjustment( elem, dimension, "border", false, styles ) -
  7077. 0.5
  7078. );
  7079. }
  7080.  
  7081. // Convert to pixels if value adjustment is needed
  7082. if ( subtract && ( matches = rcssNum.exec( value ) ) &&
  7083. ( matches[ 3 ] || "px" ) !== "px" ) {
  7084.  
  7085. elem.style[ dimension ] = value;
  7086. value = jQuery.css( elem, dimension );
  7087. }
  7088.  
  7089. return setPositiveNumber( elem, value, subtract );
  7090. }
  7091. };
  7092. } );
  7093.  
  7094. jQuery.cssHooks.marginLeft = addGetHookIf( support.reliableMarginLeft,
  7095. function( elem, computed ) {
  7096. if ( computed ) {
  7097. return ( parseFloat( curCSS( elem, "marginLeft" ) ) ||
  7098. elem.getBoundingClientRect().left -
  7099. swap( elem, { marginLeft: 0 }, function() {
  7100. return elem.getBoundingClientRect().left;
  7101. } )
  7102. ) + "px";
  7103. }
  7104. }
  7105. );
  7106.  
  7107. // These hooks are used by animate to expand properties
  7108. jQuery.each( {
  7109. margin: "",
  7110. padding: "",
  7111. border: "Width"
  7112. }, function( prefix, suffix ) {
  7113. jQuery.cssHooks[ prefix + suffix ] = {
  7114. expand: function( value ) {
  7115. var i = 0,
  7116. expanded = {},
  7117.  
  7118. // Assumes a single number if not a string
  7119. parts = typeof value === "string" ? value.split( " " ) : [ value ];
  7120.  
  7121. for ( ; i < 4; i++ ) {
  7122. expanded[ prefix + cssExpand[ i ] + suffix ] =
  7123. parts[ i ] || parts[ i - 2 ] || parts[ 0 ];
  7124. }
  7125.  
  7126. return expanded;
  7127. }
  7128. };
  7129.  
  7130. if ( prefix !== "margin" ) {
  7131. jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber;
  7132. }
  7133. } );
  7134.  
  7135. jQuery.fn.extend( {
  7136. css: function( name, value ) {
  7137. return access( this, function( elem, name, value ) {
  7138. var styles, len,
  7139. map = {},
  7140. i = 0;
  7141.  
  7142. if ( Array.isArray( name ) ) {
  7143. styles = getStyles( elem );
  7144. len = name.length;
  7145.  
  7146. for ( ; i < len; i++ ) {
  7147. map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles );
  7148. }
  7149.  
  7150. return map;
  7151. }
  7152.  
  7153. return value !== undefined ?
  7154. jQuery.style( elem, name, value ) :
  7155. jQuery.css( elem, name );
  7156. }, name, value, arguments.length > 1 );
  7157. }
  7158. } );
  7159.  
  7160.  
  7161. // Based off of the plugin by Clint Helfers, with permission.
  7162. jQuery.fn.delay = function( time, type ) {
  7163. time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time;
  7164. type = type || "fx";
  7165.  
  7166. return this.queue( type, function( next, hooks ) {
  7167. var timeout = window.setTimeout( next, time );
  7168. hooks.stop = function() {
  7169. window.clearTimeout( timeout );
  7170. };
  7171. } );
  7172. };
  7173.  
  7174.  
  7175. ( function() {
  7176. var input = document.createElement( "input" ),
  7177. select = document.createElement( "select" ),
  7178. opt = select.appendChild( document.createElement( "option" ) );
  7179.  
  7180. input.type = "checkbox";
  7181.  
  7182. // Support: Android <=4.3 only
  7183. // Default value for a checkbox should be "on"
  7184. support.checkOn = input.value !== "";
  7185.  
  7186. // Support: IE <=11 only
  7187. // Must access selectedIndex to make default options select
  7188. support.optSelected = opt.selected;
  7189.  
  7190. // Support: IE <=11 only
  7191. // An input loses its value after becoming a radio
  7192. input = document.createElement( "input" );
  7193. input.value = "t";
  7194. input.type = "radio";
  7195. support.radioValue = input.value === "t";
  7196. } )();
  7197.  
  7198.  
  7199. var boolHook,
  7200. attrHandle = jQuery.expr.attrHandle;
  7201.  
  7202. jQuery.fn.extend( {
  7203. attr: function( name, value ) {
  7204. return access( this, jQuery.attr, name, value, arguments.length > 1 );
  7205. },
  7206.  
  7207. removeAttr: function( name ) {
  7208. return this.each( function() {
  7209. jQuery.removeAttr( this, name );
  7210. } );
  7211. }
  7212. } );
  7213.  
  7214. jQuery.extend( {
  7215. attr: function( elem, name, value ) {
  7216. var ret, hooks,
  7217. nType = elem.nodeType;
  7218.  
  7219. // Don't get/set attributes on text, comment and attribute nodes
  7220. if ( nType === 3 || nType === 8 || nType === 2 ) {
  7221. return;
  7222. }
  7223.  
  7224. // Fallback to prop when attributes are not supported
  7225. if ( typeof elem.getAttribute === "undefined" ) {
  7226. return jQuery.prop( elem, name, value );
  7227. }
  7228.  
  7229. // Attribute hooks are determined by the lowercase version
  7230. // Grab necessary hook if one is defined
  7231. if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
  7232. hooks = jQuery.attrHooks[ name.toLowerCase() ] ||
  7233. ( jQuery.expr.match.bool.test( name ) ? boolHook : undefined );
  7234. }
  7235.  
  7236. if ( value !== undefined ) {
  7237. if ( value === null ) {
  7238. jQuery.removeAttr( elem, name );
  7239. return;
  7240. }
  7241.  
  7242. if ( hooks && "set" in hooks &&
  7243. ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
  7244. return ret;
  7245. }
  7246.  
  7247. elem.setAttribute( name, value + "" );
  7248. return value;
  7249. }
  7250.  
  7251. if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
  7252. return ret;
  7253. }
  7254.  
  7255. ret = jQuery.find.attr( elem, name );
  7256.  
  7257. // Non-existent attributes return null, we normalize to undefined
  7258. return ret == null ? undefined : ret;
  7259. },
  7260.  
  7261. attrHooks: {
  7262. type: {
  7263. set: function( elem, value ) {
  7264. if ( !support.radioValue && value === "radio" &&
  7265. nodeName( elem, "input" ) ) {
  7266. var val = elem.value;
  7267. elem.setAttribute( "type", value );
  7268. if ( val ) {
  7269. elem.value = val;
  7270. }
  7271. return value;
  7272. }
  7273. }
  7274. }
  7275. },
  7276.  
  7277. removeAttr: function( elem, value ) {
  7278. var name,
  7279. i = 0,
  7280.  
  7281. // Attribute names can contain non-HTML whitespace characters
  7282. // https://html.spec.whatwg.org/multipage/syntax.html#attributes-2
  7283. attrNames = value && value.match( rnothtmlwhite );
  7284.  
  7285. if ( attrNames && elem.nodeType === 1 ) {
  7286. while ( ( name = attrNames[ i++ ] ) ) {
  7287. elem.removeAttribute( name );
  7288. }
  7289. }
  7290. }
  7291. } );
  7292.  
  7293. // Hooks for boolean attributes
  7294. boolHook = {
  7295. set: function( elem, value, name ) {
  7296. if ( value === false ) {
  7297.  
  7298. // Remove boolean attributes when set to false
  7299. jQuery.removeAttr( elem, name );
  7300. } else {
  7301. elem.setAttribute( name, name );
  7302. }
  7303. return name;
  7304. }
  7305. };
  7306.  
  7307. jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( _i, name ) {
  7308. var getter = attrHandle[ name ] || jQuery.find.attr;
  7309.  
  7310. attrHandle[ name ] = function( elem, name, isXML ) {
  7311. var ret, handle,
  7312. lowercaseName = name.toLowerCase();
  7313.  
  7314. if ( !isXML ) {
  7315.  
  7316. // Avoid an infinite loop by temporarily removing this function from the getter
  7317. handle = attrHandle[ lowercaseName ];
  7318. attrHandle[ lowercaseName ] = ret;
  7319. ret = getter( elem, name, isXML ) != null ?
  7320. lowercaseName :
  7321. null;
  7322. attrHandle[ lowercaseName ] = handle;
  7323. }
  7324. return ret;
  7325. };
  7326. } );
  7327.  
  7328.  
  7329.  
  7330.  
  7331. var rfocusable = /^(?:input|select|textarea|button)$/i,
  7332. rclickable = /^(?:a|area)$/i;
  7333.  
  7334. jQuery.fn.extend( {
  7335. prop: function( name, value ) {
  7336. return access( this, jQuery.prop, name, value, arguments.length > 1 );
  7337. },
  7338.  
  7339. removeProp: function( name ) {
  7340. return this.each( function() {
  7341. delete this[ jQuery.propFix[ name ] || name ];
  7342. } );
  7343. }
  7344. } );
  7345.  
  7346. jQuery.extend( {
  7347. prop: function( elem, name, value ) {
  7348. var ret, hooks,
  7349. nType = elem.nodeType;
  7350.  
  7351. // Don't get/set properties on text, comment and attribute nodes
  7352. if ( nType === 3 || nType === 8 || nType === 2 ) {
  7353. return;
  7354. }
  7355.  
  7356. if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
  7357.  
  7358. // Fix name and attach hooks
  7359. name = jQuery.propFix[ name ] || name;
  7360. hooks = jQuery.propHooks[ name ];
  7361. }
  7362.  
  7363. if ( value !== undefined ) {
  7364. if ( hooks && "set" in hooks &&
  7365. ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
  7366. return ret;
  7367. }
  7368.  
  7369. return ( elem[ name ] = value );
  7370. }
  7371.  
  7372. if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
  7373. return ret;
  7374. }
  7375.  
  7376. return elem[ name ];
  7377. },
  7378.  
  7379. propHooks: {
  7380. tabIndex: {
  7381. get: function( elem ) {
  7382.  
  7383. // Support: IE <=9 - 11 only
  7384. // elem.tabIndex doesn't always return the
  7385. // correct value when it hasn't been explicitly set
  7386. // Use proper attribute retrieval (trac-12072)
  7387. var tabindex = jQuery.find.attr( elem, "tabindex" );
  7388.  
  7389. if ( tabindex ) {
  7390. return parseInt( tabindex, 10 );
  7391. }
  7392.  
  7393. if (
  7394. rfocusable.test( elem.nodeName ) ||
  7395. rclickable.test( elem.nodeName ) &&
  7396. elem.href
  7397. ) {
  7398. return 0;
  7399. }
  7400.  
  7401. return -1;
  7402. }
  7403. }
  7404. },
  7405.  
  7406. propFix: {
  7407. "for": "htmlFor",
  7408. "class": "className"
  7409. }
  7410. } );
  7411.  
  7412. // Support: IE <=11 only
  7413. // Accessing the selectedIndex property
  7414. // forces the browser to respect setting selected
  7415. // on the option
  7416. // The getter ensures a default option is selected
  7417. // when in an optgroup
  7418. // eslint rule "no-unused-expressions" is disabled for this code
  7419. // since it considers such accessions noop
  7420. if ( !support.optSelected ) {
  7421. jQuery.propHooks.selected = {
  7422. get: function( elem ) {
  7423.  
  7424. /* eslint no-unused-expressions: "off" */
  7425.  
  7426. var parent = elem.parentNode;
  7427. if ( parent && parent.parentNode ) {
  7428. parent.parentNode.selectedIndex;
  7429. }
  7430. return null;
  7431. },
  7432. set: function( elem ) {
  7433.  
  7434. /* eslint no-unused-expressions: "off" */
  7435.  
  7436. var parent = elem.parentNode;
  7437. if ( parent ) {
  7438. parent.selectedIndex;
  7439.  
  7440. if ( parent.parentNode ) {
  7441. parent.parentNode.selectedIndex;
  7442. }
  7443. }
  7444. }
  7445. };
  7446. }
  7447.  
  7448. jQuery.each( [
  7449. "tabIndex",
  7450. "readOnly",
  7451. "maxLength",
  7452. "cellSpacing",
  7453. "cellPadding",
  7454. "rowSpan",
  7455. "colSpan",
  7456. "useMap",
  7457. "frameBorder",
  7458. "contentEditable"
  7459. ], function() {
  7460. jQuery.propFix[ this.toLowerCase() ] = this;
  7461. } );
  7462.  
  7463.  
  7464.  
  7465.  
  7466. // Strip and collapse whitespace according to HTML spec
  7467. // https://infra.spec.whatwg.org/#strip-and-collapse-ascii-whitespace
  7468. function stripAndCollapse( value ) {
  7469. var tokens = value.match( rnothtmlwhite ) || [];
  7470. return tokens.join( " " );
  7471. }
  7472.  
  7473.  
  7474. function getClass( elem ) {
  7475. return elem.getAttribute && elem.getAttribute( "class" ) || "";
  7476. }
  7477.  
  7478. function classesToArray( value ) {
  7479. if ( Array.isArray( value ) ) {
  7480. return value;
  7481. }
  7482. if ( typeof value === "string" ) {
  7483. return value.match( rnothtmlwhite ) || [];
  7484. }
  7485. return [];
  7486. }
  7487.  
  7488. jQuery.fn.extend( {
  7489. addClass: function( value ) {
  7490. var classNames, cur, curValue, className, i, finalValue;
  7491.  
  7492. if ( isFunction( value ) ) {
  7493. return this.each( function( j ) {
  7494. jQuery( this ).addClass( value.call( this, j, getClass( this ) ) );
  7495. } );
  7496. }
  7497.  
  7498. classNames = classesToArray( value );
  7499.  
  7500. if ( classNames.length ) {
  7501. return this.each( function() {
  7502. curValue = getClass( this );
  7503. cur = this.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
  7504.  
  7505. if ( cur ) {
  7506. for ( i = 0; i < classNames.length; i++ ) {
  7507. className = classNames[ i ];
  7508. if ( cur.indexOf( " " + className + " " ) < 0 ) {
  7509. cur += className + " ";
  7510. }
  7511. }
  7512.  
  7513. // Only assign if different to avoid unneeded rendering.
  7514. finalValue = stripAndCollapse( cur );
  7515. if ( curValue !== finalValue ) {
  7516. this.setAttribute( "class", finalValue );
  7517. }
  7518. }
  7519. } );
  7520. }
  7521.  
  7522. return this;
  7523. },
  7524.  
  7525. removeClass: function( value ) {
  7526. var classNames, cur, curValue, className, i, finalValue;
  7527.  
  7528. if ( isFunction( value ) ) {
  7529. return this.each( function( j ) {
  7530. jQuery( this ).removeClass( value.call( this, j, getClass( this ) ) );
  7531. } );
  7532. }
  7533.  
  7534. if ( !arguments.length ) {
  7535. return this.attr( "class", "" );
  7536. }
  7537.  
  7538. classNames = classesToArray( value );
  7539.  
  7540. if ( classNames.length ) {
  7541. return this.each( function() {
  7542. curValue = getClass( this );
  7543.  
  7544. // This expression is here for better compressibility (see addClass)
  7545. cur = this.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
  7546.  
  7547. if ( cur ) {
  7548. for ( i = 0; i < classNames.length; i++ ) {
  7549. className = classNames[ i ];
  7550.  
  7551. // Remove *all* instances
  7552. while ( cur.indexOf( " " + className + " " ) > -1 ) {
  7553. cur = cur.replace( " " + className + " ", " " );
  7554. }
  7555. }
  7556.  
  7557. // Only assign if different to avoid unneeded rendering.
  7558. finalValue = stripAndCollapse( cur );
  7559. if ( curValue !== finalValue ) {
  7560. this.setAttribute( "class", finalValue );
  7561. }
  7562. }
  7563. } );
  7564. }
  7565.  
  7566. return this;
  7567. },
  7568.  
  7569. toggleClass: function( value, stateVal ) {
  7570. var classNames, className, i, self,
  7571. type = typeof value,
  7572. isValidValue = type === "string" || Array.isArray( value );
  7573.  
  7574. if ( isFunction( value ) ) {
  7575. return this.each( function( i ) {
  7576. jQuery( this ).toggleClass(
  7577. value.call( this, i, getClass( this ), stateVal ),
  7578. stateVal
  7579. );
  7580. } );
  7581. }
  7582.  
  7583. if ( typeof stateVal === "boolean" && isValidValue ) {
  7584. return stateVal ? this.addClass( value ) : this.removeClass( value );
  7585. }
  7586.  
  7587. classNames = classesToArray( value );
  7588.  
  7589. return this.each( function() {
  7590. if ( isValidValue ) {
  7591.  
  7592. // Toggle individual class names
  7593. self = jQuery( this );
  7594.  
  7595. for ( i = 0; i < classNames.length; i++ ) {
  7596. className = classNames[ i ];
  7597.  
  7598. // Check each className given, space separated list
  7599. if ( self.hasClass( className ) ) {
  7600. self.removeClass( className );
  7601. } else {
  7602. self.addClass( className );
  7603. }
  7604. }
  7605.  
  7606. // Toggle whole class name
  7607. } else if ( value === undefined || type === "boolean" ) {
  7608. className = getClass( this );
  7609. if ( className ) {
  7610.  
  7611. // Store className if set
  7612. dataPriv.set( this, "__className__", className );
  7613. }
  7614.  
  7615. // If the element has a class name or if we're passed `false`,
  7616. // then remove the whole classname (if there was one, the above saved it).
  7617. // Otherwise bring back whatever was previously saved (if anything),
  7618. // falling back to the empty string if nothing was stored.
  7619. if ( this.setAttribute ) {
  7620. this.setAttribute( "class",
  7621. className || value === false ?
  7622. "" :
  7623. dataPriv.get( this, "__className__" ) || ""
  7624. );
  7625. }
  7626. }
  7627. } );
  7628. },
  7629.  
  7630. hasClass: function( selector ) {
  7631. var className, elem,
  7632. i = 0;
  7633.  
  7634. className = " " + selector + " ";
  7635. while ( ( elem = this[ i++ ] ) ) {
  7636. if ( elem.nodeType === 1 &&
  7637. ( " " + stripAndCollapse( getClass( elem ) ) + " " ).indexOf( className ) > -1 ) {
  7638. return true;
  7639. }
  7640. }
  7641.  
  7642. return false;
  7643. }
  7644. } );
  7645.  
  7646.  
  7647.  
  7648.  
  7649. var rreturn = /\r/g;
  7650.  
  7651. jQuery.fn.extend( {
  7652. val: function( value ) {
  7653. var hooks, ret, valueIsFunction,
  7654. elem = this[ 0 ];
  7655.  
  7656. if ( !arguments.length ) {
  7657. if ( elem ) {
  7658. hooks = jQuery.valHooks[ elem.type ] ||
  7659. jQuery.valHooks[ elem.nodeName.toLowerCase() ];
  7660.  
  7661. if ( hooks &&
  7662. "get" in hooks &&
  7663. ( ret = hooks.get( elem, "value" ) ) !== undefined
  7664. ) {
  7665. return ret;
  7666. }
  7667.  
  7668. ret = elem.value;
  7669.  
  7670. // Handle most common string cases
  7671. if ( typeof ret === "string" ) {
  7672. return ret.replace( rreturn, "" );
  7673. }
  7674.  
  7675. // Handle cases where value is null/undef or number
  7676. return ret == null ? "" : ret;
  7677. }
  7678.  
  7679. return;
  7680. }
  7681.  
  7682. valueIsFunction = isFunction( value );
  7683.  
  7684. return this.each( function( i ) {
  7685. var val;
  7686.  
  7687. if ( this.nodeType !== 1 ) {
  7688. return;
  7689. }
  7690.  
  7691. if ( valueIsFunction ) {
  7692. val = value.call( this, i, jQuery( this ).val() );
  7693. } else {
  7694. val = value;
  7695. }
  7696.  
  7697. // Treat null/undefined as ""; convert numbers to string
  7698. if ( val == null ) {
  7699. val = "";
  7700.  
  7701. } else if ( typeof val === "number" ) {
  7702. val += "";
  7703.  
  7704. } else if ( Array.isArray( val ) ) {
  7705. val = jQuery.map( val, function( value ) {
  7706. return value == null ? "" : value + "";
  7707. } );
  7708. }
  7709.  
  7710. hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ];
  7711.  
  7712. // If set returns undefined, fall back to normal setting
  7713. if ( !hooks || !( "set" in hooks ) || hooks.set( this, val, "value" ) === undefined ) {
  7714. this.value = val;
  7715. }
  7716. } );
  7717. }
  7718. } );
  7719.  
  7720. jQuery.extend( {
  7721. valHooks: {
  7722. option: {
  7723. get: function( elem ) {
  7724.  
  7725. var val = jQuery.find.attr( elem, "value" );
  7726. return val != null ?
  7727. val :
  7728.  
  7729. // Support: IE <=10 - 11 only
  7730. // option.text throws exceptions (trac-14686, trac-14858)
  7731. // Strip and collapse whitespace
  7732. // https://html.spec.whatwg.org/#strip-and-collapse-whitespace
  7733. stripAndCollapse( jQuery.text( elem ) );
  7734. }
  7735. },
  7736. select: {
  7737. get: function( elem ) {
  7738. var value, option, i,
  7739. options = elem.options,
  7740. index = elem.selectedIndex,
  7741. one = elem.type === "select-one",
  7742. values = one ? null : [],
  7743. max = one ? index + 1 : options.length;
  7744.  
  7745. if ( index < 0 ) {
  7746. i = max;
  7747.  
  7748. } else {
  7749. i = one ? index : 0;
  7750. }
  7751.  
  7752. // Loop through all the selected options
  7753. for ( ; i < max; i++ ) {
  7754. option = options[ i ];
  7755.  
  7756. // Support: IE <=9 only
  7757. // IE8-9 doesn't update selected after form reset (trac-2551)
  7758. if ( ( option.selected || i === index ) &&
  7759.  
  7760. // Don't return options that are disabled or in a disabled optgroup
  7761. !option.disabled &&
  7762. ( !option.parentNode.disabled ||
  7763. !nodeName( option.parentNode, "optgroup" ) ) ) {
  7764.  
  7765. // Get the specific value for the option
  7766. value = jQuery( option ).val();
  7767.  
  7768. // We don't need an array for one selects
  7769. if ( one ) {
  7770. return value;
  7771. }
  7772.  
  7773. // Multi-Selects return an array
  7774. values.push( value );
  7775. }
  7776. }
  7777.  
  7778. return values;
  7779. },
  7780.  
  7781. set: function( elem, value ) {
  7782. var optionSet, option,
  7783. options = elem.options,
  7784. values = jQuery.makeArray( value ),
  7785. i = options.length;
  7786.  
  7787. while ( i-- ) {
  7788. option = options[ i ];
  7789.  
  7790. /* eslint-disable no-cond-assign */
  7791.  
  7792. if ( option.selected =
  7793. jQuery.inArray( jQuery.valHooks.option.get( option ), values ) > -1
  7794. ) {
  7795. optionSet = true;
  7796. }
  7797.  
  7798. /* eslint-enable no-cond-assign */
  7799. }
  7800.  
  7801. // Force browsers to behave consistently when non-matching value is set
  7802. if ( !optionSet ) {
  7803. elem.selectedIndex = -1;
  7804. }
  7805. return values;
  7806. }
  7807. }
  7808. }
  7809. } );
  7810.  
  7811. // Radios and checkboxes getter/setter
  7812. jQuery.each( [ "radio", "checkbox" ], function() {
  7813. jQuery.valHooks[ this ] = {
  7814. set: function( elem, value ) {
  7815. if ( Array.isArray( value ) ) {
  7816. return ( elem.checked = jQuery.inArray( jQuery( elem ).val(), value ) > -1 );
  7817. }
  7818. }
  7819. };
  7820. if ( !support.checkOn ) {
  7821. jQuery.valHooks[ this ].get = function( elem ) {
  7822. return elem.getAttribute( "value" ) === null ? "on" : elem.value;
  7823. };
  7824. }
  7825. } );
  7826.  
  7827.  
  7828.  
  7829.  
  7830. // Return jQuery for attributes-only inclusion
  7831.  
  7832.  
  7833. // Cross-browser xml parsing
  7834. jQuery.parseXML = function( data ) {
  7835. var xml, parserErrorElem;
  7836. if ( !data || typeof data !== "string" ) {
  7837. return null;
  7838. }
  7839.  
  7840. // Support: IE 9 - 11 only
  7841. // IE throws on parseFromString with invalid input.
  7842. try {
  7843. xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" );
  7844. } catch ( e ) {}
  7845.  
  7846. parserErrorElem = xml && xml.getElementsByTagName( "parsererror" )[ 0 ];
  7847. if ( !xml || parserErrorElem ) {
  7848. jQuery.error( "Invalid XML: " + (
  7849. parserErrorElem ?
  7850. jQuery.map( parserErrorElem.childNodes, function( el ) {
  7851. return el.textContent;
  7852. } ).join( "\n" ) :
  7853. data
  7854. ) );
  7855. }
  7856. return xml;
  7857. };
  7858.  
  7859.  
  7860. var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
  7861. stopPropagationCallback = function( e ) {
  7862. e.stopPropagation();
  7863. };
  7864.  
  7865. jQuery.extend( jQuery.event, {
  7866.  
  7867. trigger: function( event, data, elem, onlyHandlers ) {
  7868.  
  7869. var i, cur, tmp, bubbleType, ontype, handle, special, lastElement,
  7870. eventPath = [ elem || document ],
  7871. type = hasOwn.call( event, "type" ) ? event.type : event,
  7872. namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split( "." ) : [];
  7873.  
  7874. cur = lastElement = tmp = elem = elem || document;
  7875.  
  7876. // Don't do events on text and comment nodes
  7877. if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
  7878. return;
  7879. }
  7880.  
  7881. // focus/blur morphs to focusin/out; ensure we're not firing them right now
  7882. if ( rfocusMorph.test( type + jQuery.event.triggered ) ) {
  7883. return;
  7884. }
  7885.  
  7886. if ( type.indexOf( "." ) > -1 ) {
  7887.  
  7888. // Namespaced trigger; create a regexp to match event type in handle()
  7889. namespaces = type.split( "." );
  7890. type = namespaces.shift();
  7891. namespaces.sort();
  7892. }
  7893. ontype = type.indexOf( ":" ) < 0 && "on" + type;
  7894.  
  7895. // Caller can pass in a jQuery.Event object, Object, or just an event type string
  7896. event = event[ jQuery.expando ] ?
  7897. event :
  7898. new jQuery.Event( type, typeof event === "object" && event );
  7899.  
  7900. // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true)
  7901. event.isTrigger = onlyHandlers ? 2 : 3;
  7902. event.namespace = namespaces.join( "." );
  7903. event.rnamespace = event.namespace ?
  7904. new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ) :
  7905. null;
  7906.  
  7907. // Clean up the event in case it is being reused
  7908. event.result = undefined;
  7909. if ( !event.target ) {
  7910. event.target = elem;
  7911. }
  7912.  
  7913. // Clone any incoming data and prepend the event, creating the handler arg list
  7914. data = data == null ?
  7915. [ event ] :
  7916. jQuery.makeArray( data, [ event ] );
  7917.  
  7918. // Allow special events to draw outside the lines
  7919. special = jQuery.event.special[ type ] || {};
  7920. if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) {
  7921. return;
  7922. }
  7923.  
  7924. // Determine event propagation path in advance, per W3C events spec (trac-9951)
  7925. // Bubble up to document, then to window; watch for a global ownerDocument var (trac-9724)
  7926. if ( !onlyHandlers && !special.noBubble && !isWindow( elem ) ) {
  7927.  
  7928. bubbleType = special.delegateType || type;
  7929. if ( !rfocusMorph.test( bubbleType + type ) ) {
  7930. cur = cur.parentNode;
  7931. }
  7932. for ( ; cur; cur = cur.parentNode ) {
  7933. eventPath.push( cur );
  7934. tmp = cur;
  7935. }
  7936.  
  7937. // Only add window if we got to document (e.g., not plain obj or detached DOM)
  7938. if ( tmp === ( elem.ownerDocument || document ) ) {
  7939. eventPath.push( tmp.defaultView || tmp.parentWindow || window );
  7940. }
  7941. }
  7942.  
  7943. // Fire handlers on the event path
  7944. i = 0;
  7945. while ( ( cur = eventPath[ i++ ] ) && !event.isPropagationStopped() ) {
  7946. lastElement = cur;
  7947. event.type = i > 1 ?
  7948. bubbleType :
  7949. special.bindType || type;
  7950.  
  7951. // jQuery handler
  7952. handle = ( dataPriv.get( cur, "events" ) || Object.create( null ) )[ event.type ] &&
  7953. dataPriv.get( cur, "handle" );
  7954. if ( handle ) {
  7955. handle.apply( cur, data );
  7956. }
  7957.  
  7958. // Native handler
  7959. handle = ontype && cur[ ontype ];
  7960. if ( handle && handle.apply && acceptData( cur ) ) {
  7961. event.result = handle.apply( cur, data );
  7962. if ( event.result === false ) {
  7963. event.preventDefault();
  7964. }
  7965. }
  7966. }
  7967. event.type = type;
  7968.  
  7969. // If nobody prevented the default action, do it now
  7970. if ( !onlyHandlers && !event.isDefaultPrevented() ) {
  7971.  
  7972. if ( ( !special._default ||
  7973. special._default.apply( eventPath.pop(), data ) === false ) &&
  7974. acceptData( elem ) ) {
  7975.  
  7976. // Call a native DOM method on the target with the same name as the event.
  7977. // Don't do default actions on window, that's where global variables be (trac-6170)
  7978. if ( ontype && isFunction( elem[ type ] ) && !isWindow( elem ) ) {
  7979.  
  7980. // Don't re-trigger an onFOO event when we call its FOO() method
  7981. tmp = elem[ ontype ];
  7982.  
  7983. if ( tmp ) {
  7984. elem[ ontype ] = null;
  7985. }
  7986.  
  7987. // Prevent re-triggering of the same event, since we already bubbled it above
  7988. jQuery.event.triggered = type;
  7989.  
  7990. if ( event.isPropagationStopped() ) {
  7991. lastElement.addEventListener( type, stopPropagationCallback );
  7992. }
  7993.  
  7994. elem[ type ]();
  7995.  
  7996. if ( event.isPropagationStopped() ) {
  7997. lastElement.removeEventListener( type, stopPropagationCallback );
  7998. }
  7999.  
  8000. jQuery.event.triggered = undefined;
  8001.  
  8002. if ( tmp ) {
  8003. elem[ ontype ] = tmp;
  8004. }
  8005. }
  8006. }
  8007. }
  8008.  
  8009. return event.result;
  8010. },
  8011.  
  8012. // Piggyback on a donor event to simulate a different one
  8013. // Used only for `focus(in | out)` events
  8014. simulate: function( type, elem, event ) {
  8015. var e = jQuery.extend(
  8016. new jQuery.Event(),
  8017. event,
  8018. {
  8019. type: type,
  8020. isSimulated: true
  8021. }
  8022. );
  8023.  
  8024. jQuery.event.trigger( e, null, elem );
  8025. }
  8026.  
  8027. } );
  8028.  
  8029. jQuery.fn.extend( {
  8030.  
  8031. trigger: function( type, data ) {
  8032. return this.each( function() {
  8033. jQuery.event.trigger( type, data, this );
  8034. } );
  8035. },
  8036. triggerHandler: function( type, data ) {
  8037. var elem = this[ 0 ];
  8038. if ( elem ) {
  8039. return jQuery.event.trigger( type, data, elem, true );
  8040. }
  8041. }
  8042. } );
  8043.  
  8044.  
  8045. var
  8046. rbracket = /\[\]$/,
  8047. rCRLF = /\r?\n/g,
  8048. rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i,
  8049. rsubmittable = /^(?:input|select|textarea|keygen)/i;
  8050.  
  8051. function buildParams( prefix, obj, traditional, add ) {
  8052. var name;
  8053.  
  8054. if ( Array.isArray( obj ) ) {
  8055.  
  8056. // Serialize array item.
  8057. jQuery.each( obj, function( i, v ) {
  8058. if ( traditional || rbracket.test( prefix ) ) {
  8059.  
  8060. // Treat each array item as a scalar.
  8061. add( prefix, v );
  8062.  
  8063. } else {
  8064.  
  8065. // Item is non-scalar (array or object), encode its numeric index.
  8066. buildParams(
  8067. prefix + "[" + ( typeof v === "object" && v != null ? i : "" ) + "]",
  8068. v,
  8069. traditional,
  8070. add
  8071. );
  8072. }
  8073. } );
  8074.  
  8075. } else if ( !traditional && toType( obj ) === "object" ) {
  8076.  
  8077. // Serialize object item.
  8078. for ( name in obj ) {
  8079. buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
  8080. }
  8081.  
  8082. } else {
  8083.  
  8084. // Serialize scalar item.
  8085. add( prefix, obj );
  8086. }
  8087. }
  8088.  
  8089. // Serialize an array of form elements or a set of
  8090. // key/values into a query string
  8091. jQuery.param = function( a, traditional ) {
  8092. var prefix,
  8093. s = [],
  8094. add = function( key, valueOrFunction ) {
  8095.  
  8096. // If value is a function, invoke it and use its return value
  8097. var value = isFunction( valueOrFunction ) ?
  8098. valueOrFunction() :
  8099. valueOrFunction;
  8100.  
  8101. s[ s.length ] = encodeURIComponent( key ) + "=" +
  8102. encodeURIComponent( value == null ? "" : value );
  8103. };
  8104.  
  8105. if ( a == null ) {
  8106. return "";
  8107. }
  8108.  
  8109. // If an array was passed in, assume that it is an array of form elements.
  8110. if ( Array.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {
  8111.  
  8112. // Serialize the form elements
  8113. jQuery.each( a, function() {
  8114. add( this.name, this.value );
  8115. } );
  8116.  
  8117. } else {
  8118.  
  8119. // If traditional, encode the "old" way (the way 1.3.2 or older
  8120. // did it), otherwise encode params recursively.
  8121. for ( prefix in a ) {
  8122. buildParams( prefix, a[ prefix ], traditional, add );
  8123. }
  8124. }
  8125.  
  8126. // Return the resulting serialization
  8127. return s.join( "&" );
  8128. };
  8129.  
  8130. jQuery.fn.extend( {
  8131. serialize: function() {
  8132. return jQuery.param( this.serializeArray() );
  8133. },
  8134. serializeArray: function() {
  8135. return this.map( function() {
  8136.  
  8137. // Can add propHook for "elements" to filter or add form elements
  8138. var elements = jQuery.prop( this, "elements" );
  8139. return elements ? jQuery.makeArray( elements ) : this;
  8140. } ).filter( function() {
  8141. var type = this.type;
  8142.  
  8143. // Use .is( ":disabled" ) so that fieldset[disabled] works
  8144. return this.name && !jQuery( this ).is( ":disabled" ) &&
  8145. rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) &&
  8146. ( this.checked || !rcheckableType.test( type ) );
  8147. } ).map( function( _i, elem ) {
  8148. var val = jQuery( this ).val();
  8149.  
  8150. if ( val == null ) {
  8151. return null;
  8152. }
  8153.  
  8154. if ( Array.isArray( val ) ) {
  8155. return jQuery.map( val, function( val ) {
  8156. return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
  8157. } );
  8158. }
  8159.  
  8160. return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
  8161. } ).get();
  8162. }
  8163. } );
  8164.  
  8165.  
  8166. jQuery.fn.extend( {
  8167. wrapAll: function( html ) {
  8168. var wrap;
  8169.  
  8170. if ( this[ 0 ] ) {
  8171. if ( isFunction( html ) ) {
  8172. html = html.call( this[ 0 ] );
  8173. }
  8174.  
  8175. // The elements to wrap the target around
  8176. wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true );
  8177.  
  8178. if ( this[ 0 ].parentNode ) {
  8179. wrap.insertBefore( this[ 0 ] );
  8180. }
  8181.  
  8182. wrap.map( function() {
  8183. var elem = this;
  8184.  
  8185. while ( elem.firstElementChild ) {
  8186. elem = elem.firstElementChild;
  8187. }
  8188.  
  8189. return elem;
  8190. } ).append( this );
  8191. }
  8192.  
  8193. return this;
  8194. },
  8195.  
  8196. wrapInner: function( html ) {
  8197. if ( isFunction( html ) ) {
  8198. return this.each( function( i ) {
  8199. jQuery( this ).wrapInner( html.call( this, i ) );
  8200. } );
  8201. }
  8202.  
  8203. return this.each( function() {
  8204. var self = jQuery( this ),
  8205. contents = self.contents();
  8206.  
  8207. if ( contents.length ) {
  8208. contents.wrapAll( html );
  8209.  
  8210. } else {
  8211. self.append( html );
  8212. }
  8213. } );
  8214. },
  8215.  
  8216. wrap: function( html ) {
  8217. var htmlIsFunction = isFunction( html );
  8218.  
  8219. return this.each( function( i ) {
  8220. jQuery( this ).wrapAll( htmlIsFunction ? html.call( this, i ) : html );
  8221. } );
  8222. },
  8223.  
  8224. unwrap: function( selector ) {
  8225. this.parent( selector ).not( "body" ).each( function() {
  8226. jQuery( this ).replaceWith( this.childNodes );
  8227. } );
  8228. return this;
  8229. }
  8230. } );
  8231.  
  8232.  
  8233. jQuery.expr.pseudos.hidden = function( elem ) {
  8234. return !jQuery.expr.pseudos.visible( elem );
  8235. };
  8236. jQuery.expr.pseudos.visible = function( elem ) {
  8237. return !!( elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length );
  8238. };
  8239.  
  8240.  
  8241.  
  8242.  
  8243. // Support: Safari 8 only
  8244. // In Safari 8 documents created via document.implementation.createHTMLDocument
  8245. // collapse sibling forms: the second one becomes a child of the first one.
  8246. // Because of that, this security measure has to be disabled in Safari 8.
  8247. // https://bugs.webkit.org/show_bug.cgi?id=137337
  8248. support.createHTMLDocument = ( function() {
  8249. var body = document.implementation.createHTMLDocument( "" ).body;
  8250. body.innerHTML = "<form></form><form></form>";
  8251. return body.childNodes.length === 2;
  8252. } )();
  8253.  
  8254.  
  8255. // Argument "data" should be string of html
  8256. // context (optional): If specified, the fragment will be created in this context,
  8257. // defaults to document
  8258. // keepScripts (optional): If true, will include scripts passed in the html string
  8259. jQuery.parseHTML = function( data, context, keepScripts ) {
  8260. if ( typeof data !== "string" ) {
  8261. return [];
  8262. }
  8263. if ( typeof context === "boolean" ) {
  8264. keepScripts = context;
  8265. context = false;
  8266. }
  8267.  
  8268. var base, parsed, scripts;
  8269.  
  8270. if ( !context ) {
  8271.  
  8272. // Stop scripts or inline event handlers from being executed immediately
  8273. // by using document.implementation
  8274. if ( support.createHTMLDocument ) {
  8275. context = document.implementation.createHTMLDocument( "" );
  8276.  
  8277. // Set the base href for the created document
  8278. // so any parsed elements with URLs
  8279. // are based on the document's URL (gh-2965)
  8280. base = context.createElement( "base" );
  8281. base.href = document.location.href;
  8282. context.head.appendChild( base );
  8283. } else {
  8284. context = document;
  8285. }
  8286. }
  8287.  
  8288. parsed = rsingleTag.exec( data );
  8289. scripts = !keepScripts && [];
  8290.  
  8291. // Single tag
  8292. if ( parsed ) {
  8293. return [ context.createElement( parsed[ 1 ] ) ];
  8294. }
  8295.  
  8296. parsed = buildFragment( [ data ], context, scripts );
  8297.  
  8298. if ( scripts && scripts.length ) {
  8299. jQuery( scripts ).remove();
  8300. }
  8301.  
  8302. return jQuery.merge( [], parsed.childNodes );
  8303. };
  8304.  
  8305.  
  8306. jQuery.offset = {
  8307. setOffset: function( elem, options, i ) {
  8308. var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition,
  8309. position = jQuery.css( elem, "position" ),
  8310. curElem = jQuery( elem ),
  8311. props = {};
  8312.  
  8313. // Set position first, in-case top/left are set even on static elem
  8314. if ( position === "static" ) {
  8315. elem.style.position = "relative";
  8316. }
  8317.  
  8318. curOffset = curElem.offset();
  8319. curCSSTop = jQuery.css( elem, "top" );
  8320. curCSSLeft = jQuery.css( elem, "left" );
  8321. calculatePosition = ( position === "absolute" || position === "fixed" ) &&
  8322. ( curCSSTop + curCSSLeft ).indexOf( "auto" ) > -1;
  8323.  
  8324. // Need to be able to calculate position if either
  8325. // top or left is auto and position is either absolute or fixed
  8326. if ( calculatePosition ) {
  8327. curPosition = curElem.position();
  8328. curTop = curPosition.top;
  8329. curLeft = curPosition.left;
  8330.  
  8331. } else {
  8332. curTop = parseFloat( curCSSTop ) || 0;
  8333. curLeft = parseFloat( curCSSLeft ) || 0;
  8334. }
  8335.  
  8336. if ( isFunction( options ) ) {
  8337.  
  8338. // Use jQuery.extend here to allow modification of coordinates argument (gh-1848)
  8339. options = options.call( elem, i, jQuery.extend( {}, curOffset ) );
  8340. }
  8341.  
  8342. if ( options.top != null ) {
  8343. props.top = ( options.top - curOffset.top ) + curTop;
  8344. }
  8345. if ( options.left != null ) {
  8346. props.left = ( options.left - curOffset.left ) + curLeft;
  8347. }
  8348.  
  8349. if ( "using" in options ) {
  8350. options.using.call( elem, props );
  8351.  
  8352. } else {
  8353. curElem.css( props );
  8354. }
  8355. }
  8356. };
  8357.  
  8358. jQuery.fn.extend( {
  8359.  
  8360. // offset() relates an element's border box to the document origin
  8361. offset: function( options ) {
  8362.  
  8363. // Preserve chaining for setter
  8364. if ( arguments.length ) {
  8365. return options === undefined ?
  8366. this :
  8367. this.each( function( i ) {
  8368. jQuery.offset.setOffset( this, options, i );
  8369. } );
  8370. }
  8371.  
  8372. var rect, win,
  8373. elem = this[ 0 ];
  8374.  
  8375. if ( !elem ) {
  8376. return;
  8377. }
  8378.  
  8379. // Return zeros for disconnected and hidden (display: none) elements (gh-2310)
  8380. // Support: IE <=11 only
  8381. // Running getBoundingClientRect on a
  8382. // disconnected node in IE throws an error
  8383. if ( !elem.getClientRects().length ) {
  8384. return { top: 0, left: 0 };
  8385. }
  8386.  
  8387. // Get document-relative position by adding viewport scroll to viewport-relative gBCR
  8388. rect = elem.getBoundingClientRect();
  8389. win = elem.ownerDocument.defaultView;
  8390. return {
  8391. top: rect.top + win.pageYOffset,
  8392. left: rect.left + win.pageXOffset
  8393. };
  8394. },
  8395.  
  8396. // position() relates an element's margin box to its offset parent's padding box
  8397. // This corresponds to the behavior of CSS absolute positioning
  8398. position: function() {
  8399. if ( !this[ 0 ] ) {
  8400. return;
  8401. }
  8402.  
  8403. var offsetParent, offset, doc,
  8404. elem = this[ 0 ],
  8405. parentOffset = { top: 0, left: 0 };
  8406.  
  8407. // position:fixed elements are offset from the viewport, which itself always has zero offset
  8408. if ( jQuery.css( elem, "position" ) === "fixed" ) {
  8409.  
  8410. // Assume position:fixed implies availability of getBoundingClientRect
  8411. offset = elem.getBoundingClientRect();
  8412.  
  8413. } else {
  8414. offset = this.offset();
  8415.  
  8416. // Account for the *real* offset parent, which can be the document or its root element
  8417. // when a statically positioned element is identified
  8418. doc = elem.ownerDocument;
  8419. offsetParent = elem.offsetParent || doc.documentElement;
  8420. while ( offsetParent &&
  8421. ( offsetParent === doc.body || offsetParent === doc.documentElement ) &&
  8422. jQuery.css( offsetParent, "position" ) === "static" ) {
  8423.  
  8424. offsetParent = offsetParent.parentNode;
  8425. }
  8426. if ( offsetParent && offsetParent !== elem && offsetParent.nodeType === 1 ) {
  8427.  
  8428. // Incorporate borders into its offset, since they are outside its content origin
  8429. parentOffset = jQuery( offsetParent ).offset();
  8430. parentOffset.top += jQuery.css( offsetParent, "borderTopWidth", true );
  8431. parentOffset.left += jQuery.css( offsetParent, "borderLeftWidth", true );
  8432. }
  8433. }
  8434.  
  8435. // Subtract parent offsets and element margins
  8436. return {
  8437. top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ),
  8438. left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true )
  8439. };
  8440. },
  8441.  
  8442. // This method will return documentElement in the following cases:
  8443. // 1) For the element inside the iframe without offsetParent, this method will return
  8444. // documentElement of the parent window
  8445. // 2) For the hidden or detached element
  8446. // 3) For body or html element, i.e. in case of the html node - it will return itself
  8447. //
  8448. // but those exceptions were never presented as a real life use-cases
  8449. // and might be considered as more preferable results.
  8450. //
  8451. // This logic, however, is not guaranteed and can change at any point in the future
  8452. offsetParent: function() {
  8453. return this.map( function() {
  8454. var offsetParent = this.offsetParent;
  8455.  
  8456. while ( offsetParent && jQuery.css( offsetParent, "position" ) === "static" ) {
  8457. offsetParent = offsetParent.offsetParent;
  8458. }
  8459.  
  8460. return offsetParent || documentElement;
  8461. } );
  8462. }
  8463. } );
  8464.  
  8465. // Create scrollLeft and scrollTop methods
  8466. jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function( method, prop ) {
  8467. var top = "pageYOffset" === prop;
  8468.  
  8469. jQuery.fn[ method ] = function( val ) {
  8470. return access( this, function( elem, method, val ) {
  8471.  
  8472. // Coalesce documents and windows
  8473. var win;
  8474. if ( isWindow( elem ) ) {
  8475. win = elem;
  8476. } else if ( elem.nodeType === 9 ) {
  8477. win = elem.defaultView;
  8478. }
  8479.  
  8480. if ( val === undefined ) {
  8481. return win ? win[ prop ] : elem[ method ];
  8482. }
  8483.  
  8484. if ( win ) {
  8485. win.scrollTo(
  8486. !top ? val : win.pageXOffset,
  8487. top ? val : win.pageYOffset
  8488. );
  8489.  
  8490. } else {
  8491. elem[ method ] = val;
  8492. }
  8493. }, method, val, arguments.length );
  8494. };
  8495. } );
  8496.  
  8497. // Support: Safari <=7 - 9.1, Chrome <=37 - 49
  8498. // Add the top/left cssHooks using jQuery.fn.position
  8499. // Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
  8500. // Blink bug: https://bugs.chromium.org/p/chromium/issues/detail?id=589347
  8501. // getComputedStyle returns percent when specified for top/left/bottom/right;
  8502. // rather than make the css module depend on the offset module, just check for it here
  8503. jQuery.each( [ "top", "left" ], function( _i, prop ) {
  8504. jQuery.cssHooks[ prop ] = addGetHookIf( support.pixelPosition,
  8505. function( elem, computed ) {
  8506. if ( computed ) {
  8507. computed = curCSS( elem, prop );
  8508.  
  8509. // If curCSS returns percentage, fallback to offset
  8510. return rnumnonpx.test( computed ) ?
  8511. jQuery( elem ).position()[ prop ] + "px" :
  8512. computed;
  8513. }
  8514. }
  8515. );
  8516. } );
  8517.  
  8518.  
  8519. // Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
  8520. jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
  8521. jQuery.each( {
  8522. padding: "inner" + name,
  8523. content: type,
  8524. "": "outer" + name
  8525. }, function( defaultExtra, funcName ) {
  8526.  
  8527. // Margin is only for outerHeight, outerWidth
  8528. jQuery.fn[ funcName ] = function( margin, value ) {
  8529. var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ),
  8530. extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" );
  8531.  
  8532. return access( this, function( elem, type, value ) {
  8533. var doc;
  8534.  
  8535. if ( isWindow( elem ) ) {
  8536.  
  8537. // $( window ).outerWidth/Height return w/h including scrollbars (gh-1729)
  8538. return funcName.indexOf( "outer" ) === 0 ?
  8539. elem[ "inner" + name ] :
  8540. elem.document.documentElement[ "client" + name ];
  8541. }
  8542.  
  8543. // Get document width or height
  8544. if ( elem.nodeType === 9 ) {
  8545. doc = elem.documentElement;
  8546.  
  8547. // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height],
  8548. // whichever is greatest
  8549. return Math.max(
  8550. elem.body[ "scroll" + name ], doc[ "scroll" + name ],
  8551. elem.body[ "offset" + name ], doc[ "offset" + name ],
  8552. doc[ "client" + name ]
  8553. );
  8554. }
  8555.  
  8556. return value === undefined ?
  8557.  
  8558. // Get width or height on the element, requesting but not forcing parseFloat
  8559. jQuery.css( elem, type, extra ) :
  8560.  
  8561. // Set width or height on the element
  8562. jQuery.style( elem, type, value, extra );
  8563. }, type, chainable ? margin : undefined, chainable );
  8564. };
  8565. } );
  8566. } );
  8567.  
  8568.  
  8569. jQuery.fn.extend( {
  8570.  
  8571. bind: function( types, data, fn ) {
  8572. return this.on( types, null, data, fn );
  8573. },
  8574. unbind: function( types, fn ) {
  8575. return this.off( types, null, fn );
  8576. },
  8577.  
  8578. delegate: function( selector, types, data, fn ) {
  8579. return this.on( types, selector, data, fn );
  8580. },
  8581. undelegate: function( selector, types, fn ) {
  8582.  
  8583. // ( namespace ) or ( selector, types [, fn] )
  8584. return arguments.length === 1 ?
  8585. this.off( selector, "**" ) :
  8586. this.off( types, selector || "**", fn );
  8587. },
  8588.  
  8589. hover: function( fnOver, fnOut ) {
  8590. return this
  8591. .on( "mouseenter", fnOver )
  8592. .on( "mouseleave", fnOut || fnOver );
  8593. }
  8594. } );
  8595.  
  8596. jQuery.each(
  8597. ( "blur focus focusin focusout resize scroll click dblclick " +
  8598. "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
  8599. "change select submit keydown keypress keyup contextmenu" ).split( " " ),
  8600. function( _i, name ) {
  8601.  
  8602. // Handle event binding
  8603. jQuery.fn[ name ] = function( data, fn ) {
  8604. return arguments.length > 0 ?
  8605. this.on( name, null, data, fn ) :
  8606. this.trigger( name );
  8607. };
  8608. }
  8609. );
  8610.  
  8611.  
  8612.  
  8613.  
  8614. // Support: Android <=4.0 only
  8615. // Make sure we trim BOM and NBSP
  8616. // Require that the "whitespace run" starts from a non-whitespace
  8617. // to avoid O(N^2) behavior when the engine would try matching "\s+$" at each space position.
  8618. var rtrim = /^[\s\uFEFF\xA0]+|([^\s\uFEFF\xA0])[\s\uFEFF\xA0]+$/g;
  8619.  
  8620. // Bind a function to a context, optionally partially applying any
  8621. // arguments.
  8622. // jQuery.proxy is deprecated to promote standards (specifically Function#bind)
  8623. // However, it is not slated for removal any time soon
  8624. jQuery.proxy = function( fn, context ) {
  8625. var tmp, args, proxy;
  8626.  
  8627. if ( typeof context === "string" ) {
  8628. tmp = fn[ context ];
  8629. context = fn;
  8630. fn = tmp;
  8631. }
  8632.  
  8633. // Quick check to determine if target is callable, in the spec
  8634. // this throws a TypeError, but we will just return undefined.
  8635. if ( !isFunction( fn ) ) {
  8636. return undefined;
  8637. }
  8638.  
  8639. // Simulated bind
  8640. args = slice.call( arguments, 2 );
  8641. proxy = function() {
  8642. return fn.apply( context || this, args.concat( slice.call( arguments ) ) );
  8643. };
  8644.  
  8645. // Set the guid of unique handler to the same of original handler, so it can be removed
  8646. proxy.guid = fn.guid = fn.guid || jQuery.guid++;
  8647.  
  8648. return proxy;
  8649. };
  8650.  
  8651. jQuery.holdReady = function( hold ) {
  8652. if ( hold ) {
  8653. jQuery.readyWait++;
  8654. } else {
  8655. jQuery.ready( true );
  8656. }
  8657. };
  8658. jQuery.isArray = Array.isArray;
  8659. jQuery.parseJSON = JSON.parse;
  8660. jQuery.nodeName = nodeName;
  8661. jQuery.isFunction = isFunction;
  8662. jQuery.isWindow = isWindow;
  8663. jQuery.camelCase = camelCase;
  8664. jQuery.type = toType;
  8665.  
  8666. jQuery.now = Date.now;
  8667.  
  8668. jQuery.isNumeric = function( obj ) {
  8669.  
  8670. // As of jQuery 3.0, isNumeric is limited to
  8671. // strings and numbers (primitives or objects)
  8672. // that can be coerced to finite numbers (gh-2662)
  8673. var type = jQuery.type( obj );
  8674. return ( type === "number" || type === "string" ) &&
  8675.  
  8676. // parseFloat NaNs numeric-cast false positives ("")
  8677. // ...but misinterprets leading-number strings, particularly hex literals ("0x...")
  8678. // subtraction forces infinities to NaN
  8679. !isNaN( obj - parseFloat( obj ) );
  8680. };
  8681.  
  8682. jQuery.trim = function( text ) {
  8683. return text == null ?
  8684. "" :
  8685. ( text + "" ).replace( rtrim, "$1" );
  8686. };
  8687.  
  8688.  
  8689.  
  8690. // Register as a named AMD module, since jQuery can be concatenated with other
  8691. // files that may use define, but not via a proper concatenation script that
  8692. // understands anonymous AMD modules. A named AMD is safest and most robust
  8693. // way to register. Lowercase jquery is used because AMD module names are
  8694. // derived from file names, and jQuery is normally delivered in a lowercase
  8695. // file name. Do this after creating the global so that if an AMD module wants
  8696. // to call noConflict to hide this version of jQuery, it will work.
  8697.  
  8698. // Note that for maximum portability, libraries that are not jQuery should
  8699. // declare themselves as anonymous modules, and avoid setting a global if an
  8700. // AMD loader is present. jQuery is a special case. For more information, see
  8701. // https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon
  8702.  
  8703. if ( true ) {
  8704. !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function() {
  8705. return jQuery;
  8706. }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
  8707. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  8708. }
  8709.  
  8710.  
  8711.  
  8712.  
  8713. var
  8714.  
  8715. // Map over jQuery in case of overwrite
  8716. _jQuery = window.jQuery,
  8717.  
  8718. // Map over the $ in case of overwrite
  8719. _$ = window.$;
  8720.  
  8721. jQuery.noConflict = function( deep ) {
  8722. if ( window.$ === jQuery ) {
  8723. window.$ = _$;
  8724. }
  8725.  
  8726. if ( deep && window.jQuery === jQuery ) {
  8727. window.jQuery = _jQuery;
  8728. }
  8729.  
  8730. return jQuery;
  8731. };
  8732.  
  8733. // Expose jQuery and $ identifiers, even in AMD
  8734. // (trac-7102#comment:10, https://github.com/jquery/jquery/pull/557)
  8735. // and CommonJS for browser emulators (trac-13566)
  8736. if ( typeof noGlobal === "undefined" ) {
  8737. window.jQuery = window.$ = jQuery;
  8738. }
  8739.  
  8740.  
  8741.  
  8742.  
  8743. return jQuery;
  8744. } );
  8745.  
  8746.  
  8747. /***/ }),
  8748. /* 2 */
  8749. /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
  8750.  
  8751. "use strict";
  8752.  
  8753. var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
  8754. if (k2 === undefined) k2 = k;
  8755. var desc = Object.getOwnPropertyDescriptor(m, k);
  8756. if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
  8757. desc = { enumerable: true, get: function() { return m[k]; } };
  8758. }
  8759. Object.defineProperty(o, k2, desc);
  8760. }) : (function(o, m, k, k2) {
  8761. if (k2 === undefined) k2 = k;
  8762. o[k2] = m[k];
  8763. }));
  8764. var __exportStar = (this && this.__exportStar) || function(m, exports) {
  8765. for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
  8766. };
  8767. Object.defineProperty(exports, "__esModule", ({ value: true }));
  8768. __exportStar(__webpack_require__(34), exports);
  8769. __exportStar(__webpack_require__(29), exports);
  8770. __exportStar(__webpack_require__(35), exports);
  8771. __exportStar(__webpack_require__(36), exports);
  8772. __exportStar(__webpack_require__(9), exports);
  8773. __exportStar(__webpack_require__(16), exports);
  8774. __exportStar(__webpack_require__(31), exports);
  8775. __exportStar(__webpack_require__(8), exports);
  8776. __exportStar(__webpack_require__(10), exports);
  8777. __exportStar(__webpack_require__(3), exports);
  8778. __exportStar(__webpack_require__(18), exports);
  8779. __exportStar(__webpack_require__(50), exports);
  8780. __exportStar(__webpack_require__(19), exports);
  8781.  
  8782.  
  8783. /***/ }),
  8784. /* 3 */
  8785. /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
  8786.  
  8787. "use strict";
  8788.  
  8789. var __importDefault = (this && this.__importDefault) || function (mod) {
  8790. return (mod && mod.__esModule) ? mod : { "default": mod };
  8791. };
  8792. Object.defineProperty(exports, "__esModule", ({ value: true }));
  8793. exports.HttpClient = void 0;
  8794. const axios_1 = __importDefault(__webpack_require__(4));
  8795. const axios_cache_interceptor_1 = __webpack_require__(32);
  8796. const storage = (0, axios_cache_interceptor_1.buildWebStorage)(window.sessionStorage, 'gs-');
  8797. class HttpClient {
  8798. constructor(baseURL) {
  8799. this._handleResponse = ({ data }) => data;
  8800. this._handleError = (error) => Promise.reject(error);
  8801. this.client = (0, axios_cache_interceptor_1.setupCache)(axios_1.default.create({ baseURL }), {
  8802. storage: storage,
  8803. generateKey: axios_cache_interceptor_1.defaultKeyGenerator,
  8804. headerInterpreter: axios_cache_interceptor_1.defaultHeaderInterpreter,
  8805. debug: (msg) => console.log(msg),
  8806. ttl: 1000 * 15,
  8807. cachePredicate: {
  8808. statusCheck: (status) => status >= 200 && status < 400,
  8809. },
  8810. });
  8811. this._initializeResponseInterceptor();
  8812. }
  8813. _initializeResponseInterceptor() {
  8814. this.client.interceptors.response.use(this._handleResponse, this._handleError);
  8815. }
  8816. }
  8817. exports.HttpClient = HttpClient;
  8818.  
  8819.  
  8820. /***/ }),
  8821. /* 4 */
  8822. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  8823.  
  8824. "use strict";
  8825. // Axios v1.5.0 Copyright (c) 2023 Matt Zabriskie and contributors
  8826.  
  8827.  
  8828. function bind(fn, thisArg) {
  8829. return function wrap() {
  8830. return fn.apply(thisArg, arguments);
  8831. };
  8832. }
  8833.  
  8834. // utils is a library of generic helper functions non-specific to axios
  8835.  
  8836. const {toString} = Object.prototype;
  8837. const {getPrototypeOf} = Object;
  8838.  
  8839. const kindOf = (cache => thing => {
  8840. const str = toString.call(thing);
  8841. return cache[str] || (cache[str] = str.slice(8, -1).toLowerCase());
  8842. })(Object.create(null));
  8843.  
  8844. const kindOfTest = (type) => {
  8845. type = type.toLowerCase();
  8846. return (thing) => kindOf(thing) === type
  8847. };
  8848.  
  8849. const typeOfTest = type => thing => typeof thing === type;
  8850.  
  8851. /**
  8852. * Determine if a value is an Array
  8853. *
  8854. * @param {Object} val The value to test
  8855. *
  8856. * @returns {boolean} True if value is an Array, otherwise false
  8857. */
  8858. const {isArray} = Array;
  8859.  
  8860. /**
  8861. * Determine if a value is undefined
  8862. *
  8863. * @param {*} val The value to test
  8864. *
  8865. * @returns {boolean} True if the value is undefined, otherwise false
  8866. */
  8867. const isUndefined = typeOfTest('undefined');
  8868.  
  8869. /**
  8870. * Determine if a value is a Buffer
  8871. *
  8872. * @param {*} val The value to test
  8873. *
  8874. * @returns {boolean} True if value is a Buffer, otherwise false
  8875. */
  8876. function isBuffer(val) {
  8877. return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor)
  8878. && isFunction(val.constructor.isBuffer) && val.constructor.isBuffer(val);
  8879. }
  8880.  
  8881. /**
  8882. * Determine if a value is an ArrayBuffer
  8883. *
  8884. * @param {*} val The value to test
  8885. *
  8886. * @returns {boolean} True if value is an ArrayBuffer, otherwise false
  8887. */
  8888. const isArrayBuffer = kindOfTest('ArrayBuffer');
  8889.  
  8890.  
  8891. /**
  8892. * Determine if a value is a view on an ArrayBuffer
  8893. *
  8894. * @param {*} val The value to test
  8895. *
  8896. * @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false
  8897. */
  8898. function isArrayBufferView(val) {
  8899. let result;
  8900. if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) {
  8901. result = ArrayBuffer.isView(val);
  8902. } else {
  8903. result = (val) && (val.buffer) && (isArrayBuffer(val.buffer));
  8904. }
  8905. return result;
  8906. }
  8907.  
  8908. /**
  8909. * Determine if a value is a String
  8910. *
  8911. * @param {*} val The value to test
  8912. *
  8913. * @returns {boolean} True if value is a String, otherwise false
  8914. */
  8915. const isString = typeOfTest('string');
  8916.  
  8917. /**
  8918. * Determine if a value is a Function
  8919. *
  8920. * @param {*} val The value to test
  8921. * @returns {boolean} True if value is a Function, otherwise false
  8922. */
  8923. const isFunction = typeOfTest('function');
  8924.  
  8925. /**
  8926. * Determine if a value is a Number
  8927. *
  8928. * @param {*} val The value to test
  8929. *
  8930. * @returns {boolean} True if value is a Number, otherwise false
  8931. */
  8932. const isNumber = typeOfTest('number');
  8933.  
  8934. /**
  8935. * Determine if a value is an Object
  8936. *
  8937. * @param {*} thing The value to test
  8938. *
  8939. * @returns {boolean} True if value is an Object, otherwise false
  8940. */
  8941. const isObject = (thing) => thing !== null && typeof thing === 'object';
  8942.  
  8943. /**
  8944. * Determine if a value is a Boolean
  8945. *
  8946. * @param {*} thing The value to test
  8947. * @returns {boolean} True if value is a Boolean, otherwise false
  8948. */
  8949. const isBoolean = thing => thing === true || thing === false;
  8950.  
  8951. /**
  8952. * Determine if a value is a plain Object
  8953. *
  8954. * @param {*} val The value to test
  8955. *
  8956. * @returns {boolean} True if value is a plain Object, otherwise false
  8957. */
  8958. const isPlainObject = (val) => {
  8959. if (kindOf(val) !== 'object') {
  8960. return false;
  8961. }
  8962.  
  8963. const prototype = getPrototypeOf(val);
  8964. return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(Symbol.toStringTag in val) && !(Symbol.iterator in val);
  8965. };
  8966.  
  8967. /**
  8968. * Determine if a value is a Date
  8969. *
  8970. * @param {*} val The value to test
  8971. *
  8972. * @returns {boolean} True if value is a Date, otherwise false
  8973. */
  8974. const isDate = kindOfTest('Date');
  8975.  
  8976. /**
  8977. * Determine if a value is a File
  8978. *
  8979. * @param {*} val The value to test
  8980. *
  8981. * @returns {boolean} True if value is a File, otherwise false
  8982. */
  8983. const isFile = kindOfTest('File');
  8984.  
  8985. /**
  8986. * Determine if a value is a Blob
  8987. *
  8988. * @param {*} val The value to test
  8989. *
  8990. * @returns {boolean} True if value is a Blob, otherwise false
  8991. */
  8992. const isBlob = kindOfTest('Blob');
  8993.  
  8994. /**
  8995. * Determine if a value is a FileList
  8996. *
  8997. * @param {*} val The value to test
  8998. *
  8999. * @returns {boolean} True if value is a File, otherwise false
  9000. */
  9001. const isFileList = kindOfTest('FileList');
  9002.  
  9003. /**
  9004. * Determine if a value is a Stream
  9005. *
  9006. * @param {*} val The value to test
  9007. *
  9008. * @returns {boolean} True if value is a Stream, otherwise false
  9009. */
  9010. const isStream = (val) => isObject(val) && isFunction(val.pipe);
  9011.  
  9012. /**
  9013. * Determine if a value is a FormData
  9014. *
  9015. * @param {*} thing The value to test
  9016. *
  9017. * @returns {boolean} True if value is an FormData, otherwise false
  9018. */
  9019. const isFormData = (thing) => {
  9020. let kind;
  9021. return thing && (
  9022. (typeof FormData === 'function' && thing instanceof FormData) || (
  9023. isFunction(thing.append) && (
  9024. (kind = kindOf(thing)) === 'formdata' ||
  9025. // detect form-data instance
  9026. (kind === 'object' && isFunction(thing.toString) && thing.toString() === '[object FormData]')
  9027. )
  9028. )
  9029. )
  9030. };
  9031.  
  9032. /**
  9033. * Determine if a value is a URLSearchParams object
  9034. *
  9035. * @param {*} val The value to test
  9036. *
  9037. * @returns {boolean} True if value is a URLSearchParams object, otherwise false
  9038. */
  9039. const isURLSearchParams = kindOfTest('URLSearchParams');
  9040.  
  9041. /**
  9042. * Trim excess whitespace off the beginning and end of a string
  9043. *
  9044. * @param {String} str The String to trim
  9045. *
  9046. * @returns {String} The String freed of excess whitespace
  9047. */
  9048. const trim = (str) => str.trim ?
  9049. str.trim() : str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, '');
  9050.  
  9051. /**
  9052. * Iterate over an Array or an Object invoking a function for each item.
  9053. *
  9054. * If `obj` is an Array callback will be called passing
  9055. * the value, index, and complete array for each item.
  9056. *
  9057. * If 'obj' is an Object callback will be called passing
  9058. * the value, key, and complete object for each property.
  9059. *
  9060. * @param {Object|Array} obj The object to iterate
  9061. * @param {Function} fn The callback to invoke for each item
  9062. *
  9063. * @param {Boolean} [allOwnKeys = false]
  9064. * @returns {any}
  9065. */
  9066. function forEach(obj, fn, {allOwnKeys = false} = {}) {
  9067. // Don't bother if no value provided
  9068. if (obj === null || typeof obj === 'undefined') {
  9069. return;
  9070. }
  9071.  
  9072. let i;
  9073. let l;
  9074.  
  9075. // Force an array if not already something iterable
  9076. if (typeof obj !== 'object') {
  9077. /*eslint no-param-reassign:0*/
  9078. obj = [obj];
  9079. }
  9080.  
  9081. if (isArray(obj)) {
  9082. // Iterate over array values
  9083. for (i = 0, l = obj.length; i < l; i++) {
  9084. fn.call(null, obj[i], i, obj);
  9085. }
  9086. } else {
  9087. // Iterate over object keys
  9088. const keys = allOwnKeys ? Object.getOwnPropertyNames(obj) : Object.keys(obj);
  9089. const len = keys.length;
  9090. let key;
  9091.  
  9092. for (i = 0; i < len; i++) {
  9093. key = keys[i];
  9094. fn.call(null, obj[key], key, obj);
  9095. }
  9096. }
  9097. }
  9098.  
  9099. function findKey(obj, key) {
  9100. key = key.toLowerCase();
  9101. const keys = Object.keys(obj);
  9102. let i = keys.length;
  9103. let _key;
  9104. while (i-- > 0) {
  9105. _key = keys[i];
  9106. if (key === _key.toLowerCase()) {
  9107. return _key;
  9108. }
  9109. }
  9110. return null;
  9111. }
  9112.  
  9113. const _global = (() => {
  9114. /*eslint no-undef:0*/
  9115. if (typeof globalThis !== "undefined") return globalThis;
  9116. return typeof self !== "undefined" ? self : (typeof window !== 'undefined' ? window : __webpack_require__.g)
  9117. })();
  9118.  
  9119. const isContextDefined = (context) => !isUndefined(context) && context !== _global;
  9120.  
  9121. /**
  9122. * Accepts varargs expecting each argument to be an object, then
  9123. * immutably merges the properties of each object and returns result.
  9124. *
  9125. * When multiple objects contain the same key the later object in
  9126. * the arguments list will take precedence.
  9127. *
  9128. * Example:
  9129. *
  9130. * ```js
  9131. * var result = merge({foo: 123}, {foo: 456});
  9132. * console.log(result.foo); // outputs 456
  9133. * ```
  9134. *
  9135. * @param {Object} obj1 Object to merge
  9136. *
  9137. * @returns {Object} Result of all merge properties
  9138. */
  9139. function merge(/* obj1, obj2, obj3, ... */) {
  9140. const {caseless} = isContextDefined(this) && this || {};
  9141. const result = {};
  9142. const assignValue = (val, key) => {
  9143. const targetKey = caseless && findKey(result, key) || key;
  9144. if (isPlainObject(result[targetKey]) && isPlainObject(val)) {
  9145. result[targetKey] = merge(result[targetKey], val);
  9146. } else if (isPlainObject(val)) {
  9147. result[targetKey] = merge({}, val);
  9148. } else if (isArray(val)) {
  9149. result[targetKey] = val.slice();
  9150. } else {
  9151. result[targetKey] = val;
  9152. }
  9153. };
  9154.  
  9155. for (let i = 0, l = arguments.length; i < l; i++) {
  9156. arguments[i] && forEach(arguments[i], assignValue);
  9157. }
  9158. return result;
  9159. }
  9160.  
  9161. /**
  9162. * Extends object a by mutably adding to it the properties of object b.
  9163. *
  9164. * @param {Object} a The object to be extended
  9165. * @param {Object} b The object to copy properties from
  9166. * @param {Object} thisArg The object to bind function to
  9167. *
  9168. * @param {Boolean} [allOwnKeys]
  9169. * @returns {Object} The resulting value of object a
  9170. */
  9171. const extend = (a, b, thisArg, {allOwnKeys}= {}) => {
  9172. forEach(b, (val, key) => {
  9173. if (thisArg && isFunction(val)) {
  9174. a[key] = bind(val, thisArg);
  9175. } else {
  9176. a[key] = val;
  9177. }
  9178. }, {allOwnKeys});
  9179. return a;
  9180. };
  9181.  
  9182. /**
  9183. * Remove byte order marker. This catches EF BB BF (the UTF-8 BOM)
  9184. *
  9185. * @param {string} content with BOM
  9186. *
  9187. * @returns {string} content value without BOM
  9188. */
  9189. const stripBOM = (content) => {
  9190. if (content.charCodeAt(0) === 0xFEFF) {
  9191. content = content.slice(1);
  9192. }
  9193. return content;
  9194. };
  9195.  
  9196. /**
  9197. * Inherit the prototype methods from one constructor into another
  9198. * @param {function} constructor
  9199. * @param {function} superConstructor
  9200. * @param {object} [props]
  9201. * @param {object} [descriptors]
  9202. *
  9203. * @returns {void}
  9204. */
  9205. const inherits = (constructor, superConstructor, props, descriptors) => {
  9206. constructor.prototype = Object.create(superConstructor.prototype, descriptors);
  9207. constructor.prototype.constructor = constructor;
  9208. Object.defineProperty(constructor, 'super', {
  9209. value: superConstructor.prototype
  9210. });
  9211. props && Object.assign(constructor.prototype, props);
  9212. };
  9213.  
  9214. /**
  9215. * Resolve object with deep prototype chain to a flat object
  9216. * @param {Object} sourceObj source object
  9217. * @param {Object} [destObj]
  9218. * @param {Function|Boolean} [filter]
  9219. * @param {Function} [propFilter]
  9220. *
  9221. * @returns {Object}
  9222. */
  9223. const toFlatObject = (sourceObj, destObj, filter, propFilter) => {
  9224. let props;
  9225. let i;
  9226. let prop;
  9227. const merged = {};
  9228.  
  9229. destObj = destObj || {};
  9230. // eslint-disable-next-line no-eq-null,eqeqeq
  9231. if (sourceObj == null) return destObj;
  9232.  
  9233. do {
  9234. props = Object.getOwnPropertyNames(sourceObj);
  9235. i = props.length;
  9236. while (i-- > 0) {
  9237. prop = props[i];
  9238. if ((!propFilter || propFilter(prop, sourceObj, destObj)) && !merged[prop]) {
  9239. destObj[prop] = sourceObj[prop];
  9240. merged[prop] = true;
  9241. }
  9242. }
  9243. sourceObj = filter !== false && getPrototypeOf(sourceObj);
  9244. } while (sourceObj && (!filter || filter(sourceObj, destObj)) && sourceObj !== Object.prototype);
  9245.  
  9246. return destObj;
  9247. };
  9248.  
  9249. /**
  9250. * Determines whether a string ends with the characters of a specified string
  9251. *
  9252. * @param {String} str
  9253. * @param {String} searchString
  9254. * @param {Number} [position= 0]
  9255. *
  9256. * @returns {boolean}
  9257. */
  9258. const endsWith = (str, searchString, position) => {
  9259. str = String(str);
  9260. if (position === undefined || position > str.length) {
  9261. position = str.length;
  9262. }
  9263. position -= searchString.length;
  9264. const lastIndex = str.indexOf(searchString, position);
  9265. return lastIndex !== -1 && lastIndex === position;
  9266. };
  9267.  
  9268.  
  9269. /**
  9270. * Returns new array from array like object or null if failed
  9271. *
  9272. * @param {*} [thing]
  9273. *
  9274. * @returns {?Array}
  9275. */
  9276. const toArray = (thing) => {
  9277. if (!thing) return null;
  9278. if (isArray(thing)) return thing;
  9279. let i = thing.length;
  9280. if (!isNumber(i)) return null;
  9281. const arr = new Array(i);
  9282. while (i-- > 0) {
  9283. arr[i] = thing[i];
  9284. }
  9285. return arr;
  9286. };
  9287.  
  9288. /**
  9289. * Checking if the Uint8Array exists and if it does, it returns a function that checks if the
  9290. * thing passed in is an instance of Uint8Array
  9291. *
  9292. * @param {TypedArray}
  9293. *
  9294. * @returns {Array}
  9295. */
  9296. // eslint-disable-next-line func-names
  9297. const isTypedArray = (TypedArray => {
  9298. // eslint-disable-next-line func-names
  9299. return thing => {
  9300. return TypedArray && thing instanceof TypedArray;
  9301. };
  9302. })(typeof Uint8Array !== 'undefined' && getPrototypeOf(Uint8Array));
  9303.  
  9304. /**
  9305. * For each entry in the object, call the function with the key and value.
  9306. *
  9307. * @param {Object<any, any>} obj - The object to iterate over.
  9308. * @param {Function} fn - The function to call for each entry.
  9309. *
  9310. * @returns {void}
  9311. */
  9312. const forEachEntry = (obj, fn) => {
  9313. const generator = obj && obj[Symbol.iterator];
  9314.  
  9315. const iterator = generator.call(obj);
  9316.  
  9317. let result;
  9318.  
  9319. while ((result = iterator.next()) && !result.done) {
  9320. const pair = result.value;
  9321. fn.call(obj, pair[0], pair[1]);
  9322. }
  9323. };
  9324.  
  9325. /**
  9326. * It takes a regular expression and a string, and returns an array of all the matches
  9327. *
  9328. * @param {string} regExp - The regular expression to match against.
  9329. * @param {string} str - The string to search.
  9330. *
  9331. * @returns {Array<boolean>}
  9332. */
  9333. const matchAll = (regExp, str) => {
  9334. let matches;
  9335. const arr = [];
  9336.  
  9337. while ((matches = regExp.exec(str)) !== null) {
  9338. arr.push(matches);
  9339. }
  9340.  
  9341. return arr;
  9342. };
  9343.  
  9344. /* Checking if the kindOfTest function returns true when passed an HTMLFormElement. */
  9345. const isHTMLForm = kindOfTest('HTMLFormElement');
  9346.  
  9347. const toCamelCase = str => {
  9348. return str.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,
  9349. function replacer(m, p1, p2) {
  9350. return p1.toUpperCase() + p2;
  9351. }
  9352. );
  9353. };
  9354.  
  9355. /* Creating a function that will check if an object has a property. */
  9356. const hasOwnProperty = (({hasOwnProperty}) => (obj, prop) => hasOwnProperty.call(obj, prop))(Object.prototype);
  9357.  
  9358. /**
  9359. * Determine if a value is a RegExp object
  9360. *
  9361. * @param {*} val The value to test
  9362. *
  9363. * @returns {boolean} True if value is a RegExp object, otherwise false
  9364. */
  9365. const isRegExp = kindOfTest('RegExp');
  9366.  
  9367. const reduceDescriptors = (obj, reducer) => {
  9368. const descriptors = Object.getOwnPropertyDescriptors(obj);
  9369. const reducedDescriptors = {};
  9370.  
  9371. forEach(descriptors, (descriptor, name) => {
  9372. let ret;
  9373. if ((ret = reducer(descriptor, name, obj)) !== false) {
  9374. reducedDescriptors[name] = ret || descriptor;
  9375. }
  9376. });
  9377.  
  9378. Object.defineProperties(obj, reducedDescriptors);
  9379. };
  9380.  
  9381. /**
  9382. * Makes all methods read-only
  9383. * @param {Object} obj
  9384. */
  9385.  
  9386. const freezeMethods = (obj) => {
  9387. reduceDescriptors(obj, (descriptor, name) => {
  9388. // skip restricted props in strict mode
  9389. if (isFunction(obj) && ['arguments', 'caller', 'callee'].indexOf(name) !== -1) {
  9390. return false;
  9391. }
  9392.  
  9393. const value = obj[name];
  9394.  
  9395. if (!isFunction(value)) return;
  9396.  
  9397. descriptor.enumerable = false;
  9398.  
  9399. if ('writable' in descriptor) {
  9400. descriptor.writable = false;
  9401. return;
  9402. }
  9403.  
  9404. if (!descriptor.set) {
  9405. descriptor.set = () => {
  9406. throw Error('Can not rewrite read-only method \'' + name + '\'');
  9407. };
  9408. }
  9409. });
  9410. };
  9411.  
  9412. const toObjectSet = (arrayOrString, delimiter) => {
  9413. const obj = {};
  9414.  
  9415. const define = (arr) => {
  9416. arr.forEach(value => {
  9417. obj[value] = true;
  9418. });
  9419. };
  9420.  
  9421. isArray(arrayOrString) ? define(arrayOrString) : define(String(arrayOrString).split(delimiter));
  9422.  
  9423. return obj;
  9424. };
  9425.  
  9426. const noop = () => {};
  9427.  
  9428. const toFiniteNumber = (value, defaultValue) => {
  9429. value = +value;
  9430. return Number.isFinite(value) ? value : defaultValue;
  9431. };
  9432.  
  9433. const ALPHA = 'abcdefghijklmnopqrstuvwxyz';
  9434.  
  9435. const DIGIT = '0123456789';
  9436.  
  9437. const ALPHABET = {
  9438. DIGIT,
  9439. ALPHA,
  9440. ALPHA_DIGIT: ALPHA + ALPHA.toUpperCase() + DIGIT
  9441. };
  9442.  
  9443. const generateString = (size = 16, alphabet = ALPHABET.ALPHA_DIGIT) => {
  9444. let str = '';
  9445. const {length} = alphabet;
  9446. while (size--) {
  9447. str += alphabet[Math.random() * length|0];
  9448. }
  9449.  
  9450. return str;
  9451. };
  9452.  
  9453. /**
  9454. * If the thing is a FormData object, return true, otherwise return false.
  9455. *
  9456. * @param {unknown} thing - The thing to check.
  9457. *
  9458. * @returns {boolean}
  9459. */
  9460. function isSpecCompliantForm(thing) {
  9461. return !!(thing && isFunction(thing.append) && thing[Symbol.toStringTag] === 'FormData' && thing[Symbol.iterator]);
  9462. }
  9463.  
  9464. const toJSONObject = (obj) => {
  9465. const stack = new Array(10);
  9466.  
  9467. const visit = (source, i) => {
  9468.  
  9469. if (isObject(source)) {
  9470. if (stack.indexOf(source) >= 0) {
  9471. return;
  9472. }
  9473.  
  9474. if(!('toJSON' in source)) {
  9475. stack[i] = source;
  9476. const target = isArray(source) ? [] : {};
  9477.  
  9478. forEach(source, (value, key) => {
  9479. const reducedValue = visit(value, i + 1);
  9480. !isUndefined(reducedValue) && (target[key] = reducedValue);
  9481. });
  9482.  
  9483. stack[i] = undefined;
  9484.  
  9485. return target;
  9486. }
  9487. }
  9488.  
  9489. return source;
  9490. };
  9491.  
  9492. return visit(obj, 0);
  9493. };
  9494.  
  9495. const isAsyncFn = kindOfTest('AsyncFunction');
  9496.  
  9497. const isThenable = (thing) =>
  9498. thing && (isObject(thing) || isFunction(thing)) && isFunction(thing.then) && isFunction(thing.catch);
  9499.  
  9500. var utils = {
  9501. isArray,
  9502. isArrayBuffer,
  9503. isBuffer,
  9504. isFormData,
  9505. isArrayBufferView,
  9506. isString,
  9507. isNumber,
  9508. isBoolean,
  9509. isObject,
  9510. isPlainObject,
  9511. isUndefined,
  9512. isDate,
  9513. isFile,
  9514. isBlob,
  9515. isRegExp,
  9516. isFunction,
  9517. isStream,
  9518. isURLSearchParams,
  9519. isTypedArray,
  9520. isFileList,
  9521. forEach,
  9522. merge,
  9523. extend,
  9524. trim,
  9525. stripBOM,
  9526. inherits,
  9527. toFlatObject,
  9528. kindOf,
  9529. kindOfTest,
  9530. endsWith,
  9531. toArray,
  9532. forEachEntry,
  9533. matchAll,
  9534. isHTMLForm,
  9535. hasOwnProperty,
  9536. hasOwnProp: hasOwnProperty, // an alias to avoid ESLint no-prototype-builtins detection
  9537. reduceDescriptors,
  9538. freezeMethods,
  9539. toObjectSet,
  9540. toCamelCase,
  9541. noop,
  9542. toFiniteNumber,
  9543. findKey,
  9544. global: _global,
  9545. isContextDefined,
  9546. ALPHABET,
  9547. generateString,
  9548. isSpecCompliantForm,
  9549. toJSONObject,
  9550. isAsyncFn,
  9551. isThenable
  9552. };
  9553.  
  9554. /**
  9555. * Create an Error with the specified message, config, error code, request and response.
  9556. *
  9557. * @param {string} message The error message.
  9558. * @param {string} [code] The error code (for example, 'ECONNABORTED').
  9559. * @param {Object} [config] The config.
  9560. * @param {Object} [request] The request.
  9561. * @param {Object} [response] The response.
  9562. *
  9563. * @returns {Error} The created error.
  9564. */
  9565. function AxiosError(message, code, config, request, response) {
  9566. Error.call(this);
  9567.  
  9568. if (Error.captureStackTrace) {
  9569. Error.captureStackTrace(this, this.constructor);
  9570. } else {
  9571. this.stack = (new Error()).stack;
  9572. }
  9573.  
  9574. this.message = message;
  9575. this.name = 'AxiosError';
  9576. code && (this.code = code);
  9577. config && (this.config = config);
  9578. request && (this.request = request);
  9579. response && (this.response = response);
  9580. }
  9581.  
  9582. utils.inherits(AxiosError, Error, {
  9583. toJSON: function toJSON() {
  9584. return {
  9585. // Standard
  9586. message: this.message,
  9587. name: this.name,
  9588. // Microsoft
  9589. description: this.description,
  9590. number: this.number,
  9591. // Mozilla
  9592. fileName: this.fileName,
  9593. lineNumber: this.lineNumber,
  9594. columnNumber: this.columnNumber,
  9595. stack: this.stack,
  9596. // Axios
  9597. config: utils.toJSONObject(this.config),
  9598. code: this.code,
  9599. status: this.response && this.response.status ? this.response.status : null
  9600. };
  9601. }
  9602. });
  9603.  
  9604. const prototype$1 = AxiosError.prototype;
  9605. const descriptors = {};
  9606.  
  9607. [
  9608. 'ERR_BAD_OPTION_VALUE',
  9609. 'ERR_BAD_OPTION',
  9610. 'ECONNABORTED',
  9611. 'ETIMEDOUT',
  9612. 'ERR_NETWORK',
  9613. 'ERR_FR_TOO_MANY_REDIRECTS',
  9614. 'ERR_DEPRECATED',
  9615. 'ERR_BAD_RESPONSE',
  9616. 'ERR_BAD_REQUEST',
  9617. 'ERR_CANCELED',
  9618. 'ERR_NOT_SUPPORT',
  9619. 'ERR_INVALID_URL'
  9620. // eslint-disable-next-line func-names
  9621. ].forEach(code => {
  9622. descriptors[code] = {value: code};
  9623. });
  9624.  
  9625. Object.defineProperties(AxiosError, descriptors);
  9626. Object.defineProperty(prototype$1, 'isAxiosError', {value: true});
  9627.  
  9628. // eslint-disable-next-line func-names
  9629. AxiosError.from = (error, code, config, request, response, customProps) => {
  9630. const axiosError = Object.create(prototype$1);
  9631.  
  9632. utils.toFlatObject(error, axiosError, function filter(obj) {
  9633. return obj !== Error.prototype;
  9634. }, prop => {
  9635. return prop !== 'isAxiosError';
  9636. });
  9637.  
  9638. AxiosError.call(axiosError, error.message, code, config, request, response);
  9639.  
  9640. axiosError.cause = error;
  9641.  
  9642. axiosError.name = error.name;
  9643.  
  9644. customProps && Object.assign(axiosError, customProps);
  9645.  
  9646. return axiosError;
  9647. };
  9648.  
  9649. // eslint-disable-next-line strict
  9650. var httpAdapter = null;
  9651.  
  9652. /**
  9653. * Determines if the given thing is a array or js object.
  9654. *
  9655. * @param {string} thing - The object or array to be visited.
  9656. *
  9657. * @returns {boolean}
  9658. */
  9659. function isVisitable(thing) {
  9660. return utils.isPlainObject(thing) || utils.isArray(thing);
  9661. }
  9662.  
  9663. /**
  9664. * It removes the brackets from the end of a string
  9665. *
  9666. * @param {string} key - The key of the parameter.
  9667. *
  9668. * @returns {string} the key without the brackets.
  9669. */
  9670. function removeBrackets(key) {
  9671. return utils.endsWith(key, '[]') ? key.slice(0, -2) : key;
  9672. }
  9673.  
  9674. /**
  9675. * It takes a path, a key, and a boolean, and returns a string
  9676. *
  9677. * @param {string} path - The path to the current key.
  9678. * @param {string} key - The key of the current object being iterated over.
  9679. * @param {string} dots - If true, the key will be rendered with dots instead of brackets.
  9680. *
  9681. * @returns {string} The path to the current key.
  9682. */
  9683. function renderKey(path, key, dots) {
  9684. if (!path) return key;
  9685. return path.concat(key).map(function each(token, i) {
  9686. // eslint-disable-next-line no-param-reassign
  9687. token = removeBrackets(token);
  9688. return !dots && i ? '[' + token + ']' : token;
  9689. }).join(dots ? '.' : '');
  9690. }
  9691.  
  9692. /**
  9693. * If the array is an array and none of its elements are visitable, then it's a flat array.
  9694. *
  9695. * @param {Array<any>} arr - The array to check
  9696. *
  9697. * @returns {boolean}
  9698. */
  9699. function isFlatArray(arr) {
  9700. return utils.isArray(arr) && !arr.some(isVisitable);
  9701. }
  9702.  
  9703. const predicates = utils.toFlatObject(utils, {}, null, function filter(prop) {
  9704. return /^is[A-Z]/.test(prop);
  9705. });
  9706.  
  9707. /**
  9708. * Convert a data object to FormData
  9709. *
  9710. * @param {Object} obj
  9711. * @param {?Object} [formData]
  9712. * @param {?Object} [options]
  9713. * @param {Function} [options.visitor]
  9714. * @param {Boolean} [options.metaTokens = true]
  9715. * @param {Boolean} [options.dots = false]
  9716. * @param {?Boolean} [options.indexes = false]
  9717. *
  9718. * @returns {Object}
  9719. **/
  9720.  
  9721. /**
  9722. * It converts an object into a FormData object
  9723. *
  9724. * @param {Object<any, any>} obj - The object to convert to form data.
  9725. * @param {string} formData - The FormData object to append to.
  9726. * @param {Object<string, any>} options
  9727. *
  9728. * @returns
  9729. */
  9730. function toFormData(obj, formData, options) {
  9731. if (!utils.isObject(obj)) {
  9732. throw new TypeError('target must be an object');
  9733. }
  9734.  
  9735. // eslint-disable-next-line no-param-reassign
  9736. formData = formData || new (FormData)();
  9737.  
  9738. // eslint-disable-next-line no-param-reassign
  9739. options = utils.toFlatObject(options, {
  9740. metaTokens: true,
  9741. dots: false,
  9742. indexes: false
  9743. }, false, function defined(option, source) {
  9744. // eslint-disable-next-line no-eq-null,eqeqeq
  9745. return !utils.isUndefined(source[option]);
  9746. });
  9747.  
  9748. const metaTokens = options.metaTokens;
  9749. // eslint-disable-next-line no-use-before-define
  9750. const visitor = options.visitor || defaultVisitor;
  9751. const dots = options.dots;
  9752. const indexes = options.indexes;
  9753. const _Blob = options.Blob || typeof Blob !== 'undefined' && Blob;
  9754. const useBlob = _Blob && utils.isSpecCompliantForm(formData);
  9755.  
  9756. if (!utils.isFunction(visitor)) {
  9757. throw new TypeError('visitor must be a function');
  9758. }
  9759.  
  9760. function convertValue(value) {
  9761. if (value === null) return '';
  9762.  
  9763. if (utils.isDate(value)) {
  9764. return value.toISOString();
  9765. }
  9766.  
  9767. if (!useBlob && utils.isBlob(value)) {
  9768. throw new AxiosError('Blob is not supported. Use a Buffer instead.');
  9769. }
  9770.  
  9771. if (utils.isArrayBuffer(value) || utils.isTypedArray(value)) {
  9772. return useBlob && typeof Blob === 'function' ? new Blob([value]) : Buffer.from(value);
  9773. }
  9774.  
  9775. return value;
  9776. }
  9777.  
  9778. /**
  9779. * Default visitor.
  9780. *
  9781. * @param {*} value
  9782. * @param {String|Number} key
  9783. * @param {Array<String|Number>} path
  9784. * @this {FormData}
  9785. *
  9786. * @returns {boolean} return true to visit the each prop of the value recursively
  9787. */
  9788. function defaultVisitor(value, key, path) {
  9789. let arr = value;
  9790.  
  9791. if (value && !path && typeof value === 'object') {
  9792. if (utils.endsWith(key, '{}')) {
  9793. // eslint-disable-next-line no-param-reassign
  9794. key = metaTokens ? key : key.slice(0, -2);
  9795. // eslint-disable-next-line no-param-reassign
  9796. value = JSON.stringify(value);
  9797. } else if (
  9798. (utils.isArray(value) && isFlatArray(value)) ||
  9799. ((utils.isFileList(value) || utils.endsWith(key, '[]')) && (arr = utils.toArray(value))
  9800. )) {
  9801. // eslint-disable-next-line no-param-reassign
  9802. key = removeBrackets(key);
  9803.  
  9804. arr.forEach(function each(el, index) {
  9805. !(utils.isUndefined(el) || el === null) && formData.append(
  9806. // eslint-disable-next-line no-nested-ternary
  9807. indexes === true ? renderKey([key], index, dots) : (indexes === null ? key : key + '[]'),
  9808. convertValue(el)
  9809. );
  9810. });
  9811. return false;
  9812. }
  9813. }
  9814.  
  9815. if (isVisitable(value)) {
  9816. return true;
  9817. }
  9818.  
  9819. formData.append(renderKey(path, key, dots), convertValue(value));
  9820.  
  9821. return false;
  9822. }
  9823.  
  9824. const stack = [];
  9825.  
  9826. const exposedHelpers = Object.assign(predicates, {
  9827. defaultVisitor,
  9828. convertValue,
  9829. isVisitable
  9830. });
  9831.  
  9832. function build(value, path) {
  9833. if (utils.isUndefined(value)) return;
  9834.  
  9835. if (stack.indexOf(value) !== -1) {
  9836. throw Error('Circular reference detected in ' + path.join('.'));
  9837. }
  9838.  
  9839. stack.push(value);
  9840.  
  9841. utils.forEach(value, function each(el, key) {
  9842. const result = !(utils.isUndefined(el) || el === null) && visitor.call(
  9843. formData, el, utils.isString(key) ? key.trim() : key, path, exposedHelpers
  9844. );
  9845.  
  9846. if (result === true) {
  9847. build(el, path ? path.concat(key) : [key]);
  9848. }
  9849. });
  9850.  
  9851. stack.pop();
  9852. }
  9853.  
  9854. if (!utils.isObject(obj)) {
  9855. throw new TypeError('data must be an object');
  9856. }
  9857.  
  9858. build(obj);
  9859.  
  9860. return formData;
  9861. }
  9862.  
  9863. /**
  9864. * It encodes a string by replacing all characters that are not in the unreserved set with
  9865. * their percent-encoded equivalents
  9866. *
  9867. * @param {string} str - The string to encode.
  9868. *
  9869. * @returns {string} The encoded string.
  9870. */
  9871. function encode$1(str) {
  9872. const charMap = {
  9873. '!': '%21',
  9874. "'": '%27',
  9875. '(': '%28',
  9876. ')': '%29',
  9877. '~': '%7E',
  9878. '%20': '+',
  9879. '%00': '\x00'
  9880. };
  9881. return encodeURIComponent(str).replace(/[!'()~]|%20|%00/g, function replacer(match) {
  9882. return charMap[match];
  9883. });
  9884. }
  9885.  
  9886. /**
  9887. * It takes a params object and converts it to a FormData object
  9888. *
  9889. * @param {Object<string, any>} params - The parameters to be converted to a FormData object.
  9890. * @param {Object<string, any>} options - The options object passed to the Axios constructor.
  9891. *
  9892. * @returns {void}
  9893. */
  9894. function AxiosURLSearchParams(params, options) {
  9895. this._pairs = [];
  9896.  
  9897. params && toFormData(params, this, options);
  9898. }
  9899.  
  9900. const prototype = AxiosURLSearchParams.prototype;
  9901.  
  9902. prototype.append = function append(name, value) {
  9903. this._pairs.push([name, value]);
  9904. };
  9905.  
  9906. prototype.toString = function toString(encoder) {
  9907. const _encode = encoder ? function(value) {
  9908. return encoder.call(this, value, encode$1);
  9909. } : encode$1;
  9910.  
  9911. return this._pairs.map(function each(pair) {
  9912. return _encode(pair[0]) + '=' + _encode(pair[1]);
  9913. }, '').join('&');
  9914. };
  9915.  
  9916. /**
  9917. * It replaces all instances of the characters `:`, `$`, `,`, `+`, `[`, and `]` with their
  9918. * URI encoded counterparts
  9919. *
  9920. * @param {string} val The value to be encoded.
  9921. *
  9922. * @returns {string} The encoded value.
  9923. */
  9924. function encode(val) {
  9925. return encodeURIComponent(val).
  9926. replace(/%3A/gi, ':').
  9927. replace(/%24/g, '$').
  9928. replace(/%2C/gi, ',').
  9929. replace(/%20/g, '+').
  9930. replace(/%5B/gi, '[').
  9931. replace(/%5D/gi, ']');
  9932. }
  9933.  
  9934. /**
  9935. * Build a URL by appending params to the end
  9936. *
  9937. * @param {string} url The base of the url (e.g., http://www.google.com)
  9938. * @param {object} [params] The params to be appended
  9939. * @param {?object} options
  9940. *
  9941. * @returns {string} The formatted url
  9942. */
  9943. function buildURL(url, params, options) {
  9944. /*eslint no-param-reassign:0*/
  9945. if (!params) {
  9946. return url;
  9947. }
  9948. const _encode = options && options.encode || encode;
  9949.  
  9950. const serializeFn = options && options.serialize;
  9951.  
  9952. let serializedParams;
  9953.  
  9954. if (serializeFn) {
  9955. serializedParams = serializeFn(params, options);
  9956. } else {
  9957. serializedParams = utils.isURLSearchParams(params) ?
  9958. params.toString() :
  9959. new AxiosURLSearchParams(params, options).toString(_encode);
  9960. }
  9961.  
  9962. if (serializedParams) {
  9963. const hashmarkIndex = url.indexOf("#");
  9964.  
  9965. if (hashmarkIndex !== -1) {
  9966. url = url.slice(0, hashmarkIndex);
  9967. }
  9968. url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;
  9969. }
  9970.  
  9971. return url;
  9972. }
  9973.  
  9974. class InterceptorManager {
  9975. constructor() {
  9976. this.handlers = [];
  9977. }
  9978.  
  9979. /**
  9980. * Add a new interceptor to the stack
  9981. *
  9982. * @param {Function} fulfilled The function to handle `then` for a `Promise`
  9983. * @param {Function} rejected The function to handle `reject` for a `Promise`
  9984. *
  9985. * @return {Number} An ID used to remove interceptor later
  9986. */
  9987. use(fulfilled, rejected, options) {
  9988. this.handlers.push({
  9989. fulfilled,
  9990. rejected,
  9991. synchronous: options ? options.synchronous : false,
  9992. runWhen: options ? options.runWhen : null
  9993. });
  9994. return this.handlers.length - 1;
  9995. }
  9996.  
  9997. /**
  9998. * Remove an interceptor from the stack
  9999. *
  10000. * @param {Number} id The ID that was returned by `use`
  10001. *
  10002. * @returns {Boolean} `true` if the interceptor was removed, `false` otherwise
  10003. */
  10004. eject(id) {
  10005. if (this.handlers[id]) {
  10006. this.handlers[id] = null;
  10007. }
  10008. }
  10009.  
  10010. /**
  10011. * Clear all interceptors from the stack
  10012. *
  10013. * @returns {void}
  10014. */
  10015. clear() {
  10016. if (this.handlers) {
  10017. this.handlers = [];
  10018. }
  10019. }
  10020.  
  10021. /**
  10022. * Iterate over all the registered interceptors
  10023. *
  10024. * This method is particularly useful for skipping over any
  10025. * interceptors that may have become `null` calling `eject`.
  10026. *
  10027. * @param {Function} fn The function to call for each interceptor
  10028. *
  10029. * @returns {void}
  10030. */
  10031. forEach(fn) {
  10032. utils.forEach(this.handlers, function forEachHandler(h) {
  10033. if (h !== null) {
  10034. fn(h);
  10035. }
  10036. });
  10037. }
  10038. }
  10039.  
  10040. var InterceptorManager$1 = InterceptorManager;
  10041.  
  10042. var transitionalDefaults = {
  10043. silentJSONParsing: true,
  10044. forcedJSONParsing: true,
  10045. clarifyTimeoutError: false
  10046. };
  10047.  
  10048. var URLSearchParams$1 = typeof URLSearchParams !== 'undefined' ? URLSearchParams : AxiosURLSearchParams;
  10049.  
  10050. var FormData$1 = typeof FormData !== 'undefined' ? FormData : null;
  10051.  
  10052. var Blob$1 = typeof Blob !== 'undefined' ? Blob : null;
  10053.  
  10054. /**
  10055. * Determine if we're running in a standard browser environment
  10056. *
  10057. * This allows axios to run in a web worker, and react-native.
  10058. * Both environments support XMLHttpRequest, but not fully standard globals.
  10059. *
  10060. * web workers:
  10061. * typeof window -> undefined
  10062. * typeof document -> undefined
  10063. *
  10064. * react-native:
  10065. * navigator.product -> 'ReactNative'
  10066. * nativescript
  10067. * navigator.product -> 'NativeScript' or 'NS'
  10068. *
  10069. * @returns {boolean}
  10070. */
  10071. const isStandardBrowserEnv = (() => {
  10072. let product;
  10073. if (typeof navigator !== 'undefined' && (
  10074. (product = navigator.product) === 'ReactNative' ||
  10075. product === 'NativeScript' ||
  10076. product === 'NS')
  10077. ) {
  10078. return false;
  10079. }
  10080.  
  10081. return typeof window !== 'undefined' && typeof document !== 'undefined';
  10082. })();
  10083.  
  10084. /**
  10085. * Determine if we're running in a standard browser webWorker environment
  10086. *
  10087. * Although the `isStandardBrowserEnv` method indicates that
  10088. * `allows axios to run in a web worker`, the WebWorker will still be
  10089. * filtered out due to its judgment standard
  10090. * `typeof window !== 'undefined' && typeof document !== 'undefined'`.
  10091. * This leads to a problem when axios post `FormData` in webWorker
  10092. */
  10093. const isStandardBrowserWebWorkerEnv = (() => {
  10094. return (
  10095. typeof WorkerGlobalScope !== 'undefined' &&
  10096. // eslint-disable-next-line no-undef
  10097. self instanceof WorkerGlobalScope &&
  10098. typeof self.importScripts === 'function'
  10099. );
  10100. })();
  10101.  
  10102.  
  10103. var platform = {
  10104. isBrowser: true,
  10105. classes: {
  10106. URLSearchParams: URLSearchParams$1,
  10107. FormData: FormData$1,
  10108. Blob: Blob$1
  10109. },
  10110. isStandardBrowserEnv,
  10111. isStandardBrowserWebWorkerEnv,
  10112. protocols: ['http', 'https', 'file', 'blob', 'url', 'data']
  10113. };
  10114.  
  10115. function toURLEncodedForm(data, options) {
  10116. return toFormData(data, new platform.classes.URLSearchParams(), Object.assign({
  10117. visitor: function(value, key, path, helpers) {
  10118. if (platform.isNode && utils.isBuffer(value)) {
  10119. this.append(key, value.toString('base64'));
  10120. return false;
  10121. }
  10122.  
  10123. return helpers.defaultVisitor.apply(this, arguments);
  10124. }
  10125. }, options));
  10126. }
  10127.  
  10128. /**
  10129. * It takes a string like `foo[x][y][z]` and returns an array like `['foo', 'x', 'y', 'z']
  10130. *
  10131. * @param {string} name - The name of the property to get.
  10132. *
  10133. * @returns An array of strings.
  10134. */
  10135. function parsePropPath(name) {
  10136. // foo[x][y][z]
  10137. // foo.x.y.z
  10138. // foo-x-y-z
  10139. // foo x y z
  10140. return utils.matchAll(/\w+|\[(\w*)]/g, name).map(match => {
  10141. return match[0] === '[]' ? '' : match[1] || match[0];
  10142. });
  10143. }
  10144.  
  10145. /**
  10146. * Convert an array to an object.
  10147. *
  10148. * @param {Array<any>} arr - The array to convert to an object.
  10149. *
  10150. * @returns An object with the same keys and values as the array.
  10151. */
  10152. function arrayToObject(arr) {
  10153. const obj = {};
  10154. const keys = Object.keys(arr);
  10155. let i;
  10156. const len = keys.length;
  10157. let key;
  10158. for (i = 0; i < len; i++) {
  10159. key = keys[i];
  10160. obj[key] = arr[key];
  10161. }
  10162. return obj;
  10163. }
  10164.  
  10165. /**
  10166. * It takes a FormData object and returns a JavaScript object
  10167. *
  10168. * @param {string} formData The FormData object to convert to JSON.
  10169. *
  10170. * @returns {Object<string, any> | null} The converted object.
  10171. */
  10172. function formDataToJSON(formData) {
  10173. function buildPath(path, value, target, index) {
  10174. let name = path[index++];
  10175. const isNumericKey = Number.isFinite(+name);
  10176. const isLast = index >= path.length;
  10177. name = !name && utils.isArray(target) ? target.length : name;
  10178.  
  10179. if (isLast) {
  10180. if (utils.hasOwnProp(target, name)) {
  10181. target[name] = [target[name], value];
  10182. } else {
  10183. target[name] = value;
  10184. }
  10185.  
  10186. return !isNumericKey;
  10187. }
  10188.  
  10189. if (!target[name] || !utils.isObject(target[name])) {
  10190. target[name] = [];
  10191. }
  10192.  
  10193. const result = buildPath(path, value, target[name], index);
  10194.  
  10195. if (result && utils.isArray(target[name])) {
  10196. target[name] = arrayToObject(target[name]);
  10197. }
  10198.  
  10199. return !isNumericKey;
  10200. }
  10201.  
  10202. if (utils.isFormData(formData) && utils.isFunction(formData.entries)) {
  10203. const obj = {};
  10204.  
  10205. utils.forEachEntry(formData, (name, value) => {
  10206. buildPath(parsePropPath(name), value, obj, 0);
  10207. });
  10208.  
  10209. return obj;
  10210. }
  10211.  
  10212. return null;
  10213. }
  10214.  
  10215. /**
  10216. * It takes a string, tries to parse it, and if it fails, it returns the stringified version
  10217. * of the input
  10218. *
  10219. * @param {any} rawValue - The value to be stringified.
  10220. * @param {Function} parser - A function that parses a string into a JavaScript object.
  10221. * @param {Function} encoder - A function that takes a value and returns a string.
  10222. *
  10223. * @returns {string} A stringified version of the rawValue.
  10224. */
  10225. function stringifySafely(rawValue, parser, encoder) {
  10226. if (utils.isString(rawValue)) {
  10227. try {
  10228. (parser || JSON.parse)(rawValue);
  10229. return utils.trim(rawValue);
  10230. } catch (e) {
  10231. if (e.name !== 'SyntaxError') {
  10232. throw e;
  10233. }
  10234. }
  10235. }
  10236.  
  10237. return (encoder || JSON.stringify)(rawValue);
  10238. }
  10239.  
  10240. const defaults = {
  10241.  
  10242. transitional: transitionalDefaults,
  10243.  
  10244. adapter: platform.isNode ? 'http' : 'xhr',
  10245.  
  10246. transformRequest: [function transformRequest(data, headers) {
  10247. const contentType = headers.getContentType() || '';
  10248. const hasJSONContentType = contentType.indexOf('application/json') > -1;
  10249. const isObjectPayload = utils.isObject(data);
  10250.  
  10251. if (isObjectPayload && utils.isHTMLForm(data)) {
  10252. data = new FormData(data);
  10253. }
  10254.  
  10255. const isFormData = utils.isFormData(data);
  10256.  
  10257. if (isFormData) {
  10258. if (!hasJSONContentType) {
  10259. return data;
  10260. }
  10261. return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data;
  10262. }
  10263.  
  10264. if (utils.isArrayBuffer(data) ||
  10265. utils.isBuffer(data) ||
  10266. utils.isStream(data) ||
  10267. utils.isFile(data) ||
  10268. utils.isBlob(data)
  10269. ) {
  10270. return data;
  10271. }
  10272. if (utils.isArrayBufferView(data)) {
  10273. return data.buffer;
  10274. }
  10275. if (utils.isURLSearchParams(data)) {
  10276. headers.setContentType('application/x-www-form-urlencoded;charset=utf-8', false);
  10277. return data.toString();
  10278. }
  10279.  
  10280. let isFileList;
  10281.  
  10282. if (isObjectPayload) {
  10283. if (contentType.indexOf('application/x-www-form-urlencoded') > -1) {
  10284. return toURLEncodedForm(data, this.formSerializer).toString();
  10285. }
  10286.  
  10287. if ((isFileList = utils.isFileList(data)) || contentType.indexOf('multipart/form-data') > -1) {
  10288. const _FormData = this.env && this.env.FormData;
  10289.  
  10290. return toFormData(
  10291. isFileList ? {'files[]': data} : data,
  10292. _FormData && new _FormData(),
  10293. this.formSerializer
  10294. );
  10295. }
  10296. }
  10297.  
  10298. if (isObjectPayload || hasJSONContentType ) {
  10299. headers.setContentType('application/json', false);
  10300. return stringifySafely(data);
  10301. }
  10302.  
  10303. return data;
  10304. }],
  10305.  
  10306. transformResponse: [function transformResponse(data) {
  10307. const transitional = this.transitional || defaults.transitional;
  10308. const forcedJSONParsing = transitional && transitional.forcedJSONParsing;
  10309. const JSONRequested = this.responseType === 'json';
  10310.  
  10311. if (data && utils.isString(data) && ((forcedJSONParsing && !this.responseType) || JSONRequested)) {
  10312. const silentJSONParsing = transitional && transitional.silentJSONParsing;
  10313. const strictJSONParsing = !silentJSONParsing && JSONRequested;
  10314.  
  10315. try {
  10316. return JSON.parse(data);
  10317. } catch (e) {
  10318. if (strictJSONParsing) {
  10319. if (e.name === 'SyntaxError') {
  10320. throw AxiosError.from(e, AxiosError.ERR_BAD_RESPONSE, this, null, this.response);
  10321. }
  10322. throw e;
  10323. }
  10324. }
  10325. }
  10326.  
  10327. return data;
  10328. }],
  10329.  
  10330. /**
  10331. * A timeout in milliseconds to abort a request. If set to 0 (default) a
  10332. * timeout is not created.
  10333. */
  10334. timeout: 0,
  10335.  
  10336. xsrfCookieName: 'XSRF-TOKEN',
  10337. xsrfHeaderName: 'X-XSRF-TOKEN',
  10338.  
  10339. maxContentLength: -1,
  10340. maxBodyLength: -1,
  10341.  
  10342. env: {
  10343. FormData: platform.classes.FormData,
  10344. Blob: platform.classes.Blob
  10345. },
  10346.  
  10347. validateStatus: function validateStatus(status) {
  10348. return status >= 200 && status < 300;
  10349. },
  10350.  
  10351. headers: {
  10352. common: {
  10353. 'Accept': 'application/json, text/plain, */*',
  10354. 'Content-Type': undefined
  10355. }
  10356. }
  10357. };
  10358.  
  10359. utils.forEach(['delete', 'get', 'head', 'post', 'put', 'patch'], (method) => {
  10360. defaults.headers[method] = {};
  10361. });
  10362.  
  10363. var defaults$1 = defaults;
  10364.  
  10365. // RawAxiosHeaders whose duplicates are ignored by node
  10366. // c.f. https://nodejs.org/api/http.html#http_message_headers
  10367. const ignoreDuplicateOf = utils.toObjectSet([
  10368. 'age', 'authorization', 'content-length', 'content-type', 'etag',
  10369. 'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since',
  10370. 'last-modified', 'location', 'max-forwards', 'proxy-authorization',
  10371. 'referer', 'retry-after', 'user-agent'
  10372. ]);
  10373.  
  10374. /**
  10375. * Parse headers into an object
  10376. *
  10377. * ```
  10378. * Date: Wed, 27 Aug 2014 08:58:49 GMT
  10379. * Content-Type: application/json
  10380. * Connection: keep-alive
  10381. * Transfer-Encoding: chunked
  10382. * ```
  10383. *
  10384. * @param {String} rawHeaders Headers needing to be parsed
  10385. *
  10386. * @returns {Object} Headers parsed into an object
  10387. */
  10388. var parseHeaders = rawHeaders => {
  10389. const parsed = {};
  10390. let key;
  10391. let val;
  10392. let i;
  10393.  
  10394. rawHeaders && rawHeaders.split('\n').forEach(function parser(line) {
  10395. i = line.indexOf(':');
  10396. key = line.substring(0, i).trim().toLowerCase();
  10397. val = line.substring(i + 1).trim();
  10398.  
  10399. if (!key || (parsed[key] && ignoreDuplicateOf[key])) {
  10400. return;
  10401. }
  10402.  
  10403. if (key === 'set-cookie') {
  10404. if (parsed[key]) {
  10405. parsed[key].push(val);
  10406. } else {
  10407. parsed[key] = [val];
  10408. }
  10409. } else {
  10410. parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
  10411. }
  10412. });
  10413.  
  10414. return parsed;
  10415. };
  10416.  
  10417. const $internals = Symbol('internals');
  10418.  
  10419. function normalizeHeader(header) {
  10420. return header && String(header).trim().toLowerCase();
  10421. }
  10422.  
  10423. function normalizeValue(value) {
  10424. if (value === false || value == null) {
  10425. return value;
  10426. }
  10427.  
  10428. return utils.isArray(value) ? value.map(normalizeValue) : String(value);
  10429. }
  10430.  
  10431. function parseTokens(str) {
  10432. const tokens = Object.create(null);
  10433. const tokensRE = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;
  10434. let match;
  10435.  
  10436. while ((match = tokensRE.exec(str))) {
  10437. tokens[match[1]] = match[2];
  10438. }
  10439.  
  10440. return tokens;
  10441. }
  10442.  
  10443. const isValidHeaderName = (str) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str.trim());
  10444.  
  10445. function matchHeaderValue(context, value, header, filter, isHeaderNameFilter) {
  10446. if (utils.isFunction(filter)) {
  10447. return filter.call(this, value, header);
  10448. }
  10449.  
  10450. if (isHeaderNameFilter) {
  10451. value = header;
  10452. }
  10453.  
  10454. if (!utils.isString(value)) return;
  10455.  
  10456. if (utils.isString(filter)) {
  10457. return value.indexOf(filter) !== -1;
  10458. }
  10459.  
  10460. if (utils.isRegExp(filter)) {
  10461. return filter.test(value);
  10462. }
  10463. }
  10464.  
  10465. function formatHeader(header) {
  10466. return header.trim()
  10467. .toLowerCase().replace(/([a-z\d])(\w*)/g, (w, char, str) => {
  10468. return char.toUpperCase() + str;
  10469. });
  10470. }
  10471.  
  10472. function buildAccessors(obj, header) {
  10473. const accessorName = utils.toCamelCase(' ' + header);
  10474.  
  10475. ['get', 'set', 'has'].forEach(methodName => {
  10476. Object.defineProperty(obj, methodName + accessorName, {
  10477. value: function(arg1, arg2, arg3) {
  10478. return this[methodName].call(this, header, arg1, arg2, arg3);
  10479. },
  10480. configurable: true
  10481. });
  10482. });
  10483. }
  10484.  
  10485. class AxiosHeaders {
  10486. constructor(headers) {
  10487. headers && this.set(headers);
  10488. }
  10489.  
  10490. set(header, valueOrRewrite, rewrite) {
  10491. const self = this;
  10492.  
  10493. function setHeader(_value, _header, _rewrite) {
  10494. const lHeader = normalizeHeader(_header);
  10495.  
  10496. if (!lHeader) {
  10497. throw new Error('header name must be a non-empty string');
  10498. }
  10499.  
  10500. const key = utils.findKey(self, lHeader);
  10501.  
  10502. if(!key || self[key] === undefined || _rewrite === true || (_rewrite === undefined && self[key] !== false)) {
  10503. self[key || _header] = normalizeValue(_value);
  10504. }
  10505. }
  10506.  
  10507. const setHeaders = (headers, _rewrite) =>
  10508. utils.forEach(headers, (_value, _header) => setHeader(_value, _header, _rewrite));
  10509.  
  10510. if (utils.isPlainObject(header) || header instanceof this.constructor) {
  10511. setHeaders(header, valueOrRewrite);
  10512. } else if(utils.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
  10513. setHeaders(parseHeaders(header), valueOrRewrite);
  10514. } else {
  10515. header != null && setHeader(valueOrRewrite, header, rewrite);
  10516. }
  10517.  
  10518. return this;
  10519. }
  10520.  
  10521. get(header, parser) {
  10522. header = normalizeHeader(header);
  10523.  
  10524. if (header) {
  10525. const key = utils.findKey(this, header);
  10526.  
  10527. if (key) {
  10528. const value = this[key];
  10529.  
  10530. if (!parser) {
  10531. return value;
  10532. }
  10533.  
  10534. if (parser === true) {
  10535. return parseTokens(value);
  10536. }
  10537.  
  10538. if (utils.isFunction(parser)) {
  10539. return parser.call(this, value, key);
  10540. }
  10541.  
  10542. if (utils.isRegExp(parser)) {
  10543. return parser.exec(value);
  10544. }
  10545.  
  10546. throw new TypeError('parser must be boolean|regexp|function');
  10547. }
  10548. }
  10549. }
  10550.  
  10551. has(header, matcher) {
  10552. header = normalizeHeader(header);
  10553.  
  10554. if (header) {
  10555. const key = utils.findKey(this, header);
  10556.  
  10557. return !!(key && this[key] !== undefined && (!matcher || matchHeaderValue(this, this[key], key, matcher)));
  10558. }
  10559.  
  10560. return false;
  10561. }
  10562.  
  10563. delete(header, matcher) {
  10564. const self = this;
  10565. let deleted = false;
  10566.  
  10567. function deleteHeader(_header) {
  10568. _header = normalizeHeader(_header);
  10569.  
  10570. if (_header) {
  10571. const key = utils.findKey(self, _header);
  10572.  
  10573. if (key && (!matcher || matchHeaderValue(self, self[key], key, matcher))) {
  10574. delete self[key];
  10575.  
  10576. deleted = true;
  10577. }
  10578. }
  10579. }
  10580.  
  10581. if (utils.isArray(header)) {
  10582. header.forEach(deleteHeader);
  10583. } else {
  10584. deleteHeader(header);
  10585. }
  10586.  
  10587. return deleted;
  10588. }
  10589.  
  10590. clear(matcher) {
  10591. const keys = Object.keys(this);
  10592. let i = keys.length;
  10593. let deleted = false;
  10594.  
  10595. while (i--) {
  10596. const key = keys[i];
  10597. if(!matcher || matchHeaderValue(this, this[key], key, matcher, true)) {
  10598. delete this[key];
  10599. deleted = true;
  10600. }
  10601. }
  10602.  
  10603. return deleted;
  10604. }
  10605.  
  10606. normalize(format) {
  10607. const self = this;
  10608. const headers = {};
  10609.  
  10610. utils.forEach(this, (value, header) => {
  10611. const key = utils.findKey(headers, header);
  10612.  
  10613. if (key) {
  10614. self[key] = normalizeValue(value);
  10615. delete self[header];
  10616. return;
  10617. }
  10618.  
  10619. const normalized = format ? formatHeader(header) : String(header).trim();
  10620.  
  10621. if (normalized !== header) {
  10622. delete self[header];
  10623. }
  10624.  
  10625. self[normalized] = normalizeValue(value);
  10626.  
  10627. headers[normalized] = true;
  10628. });
  10629.  
  10630. return this;
  10631. }
  10632.  
  10633. concat(...targets) {
  10634. return this.constructor.concat(this, ...targets);
  10635. }
  10636.  
  10637. toJSON(asStrings) {
  10638. const obj = Object.create(null);
  10639.  
  10640. utils.forEach(this, (value, header) => {
  10641. value != null && value !== false && (obj[header] = asStrings && utils.isArray(value) ? value.join(', ') : value);
  10642. });
  10643.  
  10644. return obj;
  10645. }
  10646.  
  10647. [Symbol.iterator]() {
  10648. return Object.entries(this.toJSON())[Symbol.iterator]();
  10649. }
  10650.  
  10651. toString() {
  10652. return Object.entries(this.toJSON()).map(([header, value]) => header + ': ' + value).join('\n');
  10653. }
  10654.  
  10655. get [Symbol.toStringTag]() {
  10656. return 'AxiosHeaders';
  10657. }
  10658.  
  10659. static from(thing) {
  10660. return thing instanceof this ? thing : new this(thing);
  10661. }
  10662.  
  10663. static concat(first, ...targets) {
  10664. const computed = new this(first);
  10665.  
  10666. targets.forEach((target) => computed.set(target));
  10667.  
  10668. return computed;
  10669. }
  10670.  
  10671. static accessor(header) {
  10672. const internals = this[$internals] = (this[$internals] = {
  10673. accessors: {}
  10674. });
  10675.  
  10676. const accessors = internals.accessors;
  10677. const prototype = this.prototype;
  10678.  
  10679. function defineAccessor(_header) {
  10680. const lHeader = normalizeHeader(_header);
  10681.  
  10682. if (!accessors[lHeader]) {
  10683. buildAccessors(prototype, _header);
  10684. accessors[lHeader] = true;
  10685. }
  10686. }
  10687.  
  10688. utils.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header);
  10689.  
  10690. return this;
  10691. }
  10692. }
  10693.  
  10694. AxiosHeaders.accessor(['Content-Type', 'Content-Length', 'Accept', 'Accept-Encoding', 'User-Agent', 'Authorization']);
  10695.  
  10696. // reserved names hotfix
  10697. utils.reduceDescriptors(AxiosHeaders.prototype, ({value}, key) => {
  10698. let mapped = key[0].toUpperCase() + key.slice(1); // map `set` => `Set`
  10699. return {
  10700. get: () => value,
  10701. set(headerValue) {
  10702. this[mapped] = headerValue;
  10703. }
  10704. }
  10705. });
  10706.  
  10707. utils.freezeMethods(AxiosHeaders);
  10708.  
  10709. var AxiosHeaders$1 = AxiosHeaders;
  10710.  
  10711. /**
  10712. * Transform the data for a request or a response
  10713. *
  10714. * @param {Array|Function} fns A single function or Array of functions
  10715. * @param {?Object} response The response object
  10716. *
  10717. * @returns {*} The resulting transformed data
  10718. */
  10719. function transformData(fns, response) {
  10720. const config = this || defaults$1;
  10721. const context = response || config;
  10722. const headers = AxiosHeaders$1.from(context.headers);
  10723. let data = context.data;
  10724.  
  10725. utils.forEach(fns, function transform(fn) {
  10726. data = fn.call(config, data, headers.normalize(), response ? response.status : undefined);
  10727. });
  10728.  
  10729. headers.normalize();
  10730.  
  10731. return data;
  10732. }
  10733.  
  10734. function isCancel(value) {
  10735. return !!(value && value.__CANCEL__);
  10736. }
  10737.  
  10738. /**
  10739. * A `CanceledError` is an object that is thrown when an operation is canceled.
  10740. *
  10741. * @param {string=} message The message.
  10742. * @param {Object=} config The config.
  10743. * @param {Object=} request The request.
  10744. *
  10745. * @returns {CanceledError} The created error.
  10746. */
  10747. function CanceledError(message, config, request) {
  10748. // eslint-disable-next-line no-eq-null,eqeqeq
  10749. AxiosError.call(this, message == null ? 'canceled' : message, AxiosError.ERR_CANCELED, config, request);
  10750. this.name = 'CanceledError';
  10751. }
  10752.  
  10753. utils.inherits(CanceledError, AxiosError, {
  10754. __CANCEL__: true
  10755. });
  10756.  
  10757. /**
  10758. * Resolve or reject a Promise based on response status.
  10759. *
  10760. * @param {Function} resolve A function that resolves the promise.
  10761. * @param {Function} reject A function that rejects the promise.
  10762. * @param {object} response The response.
  10763. *
  10764. * @returns {object} The response.
  10765. */
  10766. function settle(resolve, reject, response) {
  10767. const validateStatus = response.config.validateStatus;
  10768. if (!response.status || !validateStatus || validateStatus(response.status)) {
  10769. resolve(response);
  10770. } else {
  10771. reject(new AxiosError(
  10772. 'Request failed with status code ' + response.status,
  10773. [AxiosError.ERR_BAD_REQUEST, AxiosError.ERR_BAD_RESPONSE][Math.floor(response.status / 100) - 4],
  10774. response.config,
  10775. response.request,
  10776. response
  10777. ));
  10778. }
  10779. }
  10780.  
  10781. var cookies = platform.isStandardBrowserEnv ?
  10782.  
  10783. // Standard browser envs support document.cookie
  10784. (function standardBrowserEnv() {
  10785. return {
  10786. write: function write(name, value, expires, path, domain, secure) {
  10787. const cookie = [];
  10788. cookie.push(name + '=' + encodeURIComponent(value));
  10789.  
  10790. if (utils.isNumber(expires)) {
  10791. cookie.push('expires=' + new Date(expires).toGMTString());
  10792. }
  10793.  
  10794. if (utils.isString(path)) {
  10795. cookie.push('path=' + path);
  10796. }
  10797.  
  10798. if (utils.isString(domain)) {
  10799. cookie.push('domain=' + domain);
  10800. }
  10801.  
  10802. if (secure === true) {
  10803. cookie.push('secure');
  10804. }
  10805.  
  10806. document.cookie = cookie.join('; ');
  10807. },
  10808.  
  10809. read: function read(name) {
  10810. const match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)'));
  10811. return (match ? decodeURIComponent(match[3]) : null);
  10812. },
  10813.  
  10814. remove: function remove(name) {
  10815. this.write(name, '', Date.now() - 86400000);
  10816. }
  10817. };
  10818. })() :
  10819.  
  10820. // Non standard browser env (web workers, react-native) lack needed support.
  10821. (function nonStandardBrowserEnv() {
  10822. return {
  10823. write: function write() {},
  10824. read: function read() { return null; },
  10825. remove: function remove() {}
  10826. };
  10827. })();
  10828.  
  10829. /**
  10830. * Determines whether the specified URL is absolute
  10831. *
  10832. * @param {string} url The URL to test
  10833. *
  10834. * @returns {boolean} True if the specified URL is absolute, otherwise false
  10835. */
  10836. function isAbsoluteURL(url) {
  10837. // A URL is considered absolute if it begins with "<scheme>://" or "//" (protocol-relative URL).
  10838. // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed
  10839. // by any combination of letters, digits, plus, period, or hyphen.
  10840. return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(url);
  10841. }
  10842.  
  10843. /**
  10844. * Creates a new URL by combining the specified URLs
  10845. *
  10846. * @param {string} baseURL The base URL
  10847. * @param {string} relativeURL The relative URL
  10848. *
  10849. * @returns {string} The combined URL
  10850. */
  10851. function combineURLs(baseURL, relativeURL) {
  10852. return relativeURL
  10853. ? baseURL.replace(/\/+$/, '') + '/' + relativeURL.replace(/^\/+/, '')
  10854. : baseURL;
  10855. }
  10856.  
  10857. /**
  10858. * Creates a new URL by combining the baseURL with the requestedURL,
  10859. * only when the requestedURL is not already an absolute URL.
  10860. * If the requestURL is absolute, this function returns the requestedURL untouched.
  10861. *
  10862. * @param {string} baseURL The base URL
  10863. * @param {string} requestedURL Absolute or relative URL to combine
  10864. *
  10865. * @returns {string} The combined full path
  10866. */
  10867. function buildFullPath(baseURL, requestedURL) {
  10868. if (baseURL && !isAbsoluteURL(requestedURL)) {
  10869. return combineURLs(baseURL, requestedURL);
  10870. }
  10871. return requestedURL;
  10872. }
  10873.  
  10874. var isURLSameOrigin = platform.isStandardBrowserEnv ?
  10875.  
  10876. // Standard browser envs have full support of the APIs needed to test
  10877. // whether the request URL is of the same origin as current location.
  10878. (function standardBrowserEnv() {
  10879. const msie = /(msie|trident)/i.test(navigator.userAgent);
  10880. const urlParsingNode = document.createElement('a');
  10881. let originURL;
  10882.  
  10883. /**
  10884. * Parse a URL to discover it's components
  10885. *
  10886. * @param {String} url The URL to be parsed
  10887. * @returns {Object}
  10888. */
  10889. function resolveURL(url) {
  10890. let href = url;
  10891.  
  10892. if (msie) {
  10893. // IE needs attribute set twice to normalize properties
  10894. urlParsingNode.setAttribute('href', href);
  10895. href = urlParsingNode.href;
  10896. }
  10897.  
  10898. urlParsingNode.setAttribute('href', href);
  10899.  
  10900. // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils
  10901. return {
  10902. href: urlParsingNode.href,
  10903. protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',
  10904. host: urlParsingNode.host,
  10905. search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '',
  10906. hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',
  10907. hostname: urlParsingNode.hostname,
  10908. port: urlParsingNode.port,
  10909. pathname: (urlParsingNode.pathname.charAt(0) === '/') ?
  10910. urlParsingNode.pathname :
  10911. '/' + urlParsingNode.pathname
  10912. };
  10913. }
  10914.  
  10915. originURL = resolveURL(window.location.href);
  10916.  
  10917. /**
  10918. * Determine if a URL shares the same origin as the current location
  10919. *
  10920. * @param {String} requestURL The URL to test
  10921. * @returns {boolean} True if URL shares the same origin, otherwise false
  10922. */
  10923. return function isURLSameOrigin(requestURL) {
  10924. const parsed = (utils.isString(requestURL)) ? resolveURL(requestURL) : requestURL;
  10925. return (parsed.protocol === originURL.protocol &&
  10926. parsed.host === originURL.host);
  10927. };
  10928. })() :
  10929.  
  10930. // Non standard browser envs (web workers, react-native) lack needed support.
  10931. (function nonStandardBrowserEnv() {
  10932. return function isURLSameOrigin() {
  10933. return true;
  10934. };
  10935. })();
  10936.  
  10937. function parseProtocol(url) {
  10938. const match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url);
  10939. return match && match[1] || '';
  10940. }
  10941.  
  10942. /**
  10943. * Calculate data maxRate
  10944. * @param {Number} [samplesCount= 10]
  10945. * @param {Number} [min= 1000]
  10946. * @returns {Function}
  10947. */
  10948. function speedometer(samplesCount, min) {
  10949. samplesCount = samplesCount || 10;
  10950. const bytes = new Array(samplesCount);
  10951. const timestamps = new Array(samplesCount);
  10952. let head = 0;
  10953. let tail = 0;
  10954. let firstSampleTS;
  10955.  
  10956. min = min !== undefined ? min : 1000;
  10957.  
  10958. return function push(chunkLength) {
  10959. const now = Date.now();
  10960.  
  10961. const startedAt = timestamps[tail];
  10962.  
  10963. if (!firstSampleTS) {
  10964. firstSampleTS = now;
  10965. }
  10966.  
  10967. bytes[head] = chunkLength;
  10968. timestamps[head] = now;
  10969.  
  10970. let i = tail;
  10971. let bytesCount = 0;
  10972.  
  10973. while (i !== head) {
  10974. bytesCount += bytes[i++];
  10975. i = i % samplesCount;
  10976. }
  10977.  
  10978. head = (head + 1) % samplesCount;
  10979.  
  10980. if (head === tail) {
  10981. tail = (tail + 1) % samplesCount;
  10982. }
  10983.  
  10984. if (now - firstSampleTS < min) {
  10985. return;
  10986. }
  10987.  
  10988. const passed = startedAt && now - startedAt;
  10989.  
  10990. return passed ? Math.round(bytesCount * 1000 / passed) : undefined;
  10991. };
  10992. }
  10993.  
  10994. function progressEventReducer(listener, isDownloadStream) {
  10995. let bytesNotified = 0;
  10996. const _speedometer = speedometer(50, 250);
  10997.  
  10998. return e => {
  10999. const loaded = e.loaded;
  11000. const total = e.lengthComputable ? e.total : undefined;
  11001. const progressBytes = loaded - bytesNotified;
  11002. const rate = _speedometer(progressBytes);
  11003. const inRange = loaded <= total;
  11004.  
  11005. bytesNotified = loaded;
  11006.  
  11007. const data = {
  11008. loaded,
  11009. total,
  11010. progress: total ? (loaded / total) : undefined,
  11011. bytes: progressBytes,
  11012. rate: rate ? rate : undefined,
  11013. estimated: rate && total && inRange ? (total - loaded) / rate : undefined,
  11014. event: e
  11015. };
  11016.  
  11017. data[isDownloadStream ? 'download' : 'upload'] = true;
  11018.  
  11019. listener(data);
  11020. };
  11021. }
  11022.  
  11023. const isXHRAdapterSupported = typeof XMLHttpRequest !== 'undefined';
  11024.  
  11025. var xhrAdapter = isXHRAdapterSupported && function (config) {
  11026. return new Promise(function dispatchXhrRequest(resolve, reject) {
  11027. let requestData = config.data;
  11028. const requestHeaders = AxiosHeaders$1.from(config.headers).normalize();
  11029. const responseType = config.responseType;
  11030. let onCanceled;
  11031. function done() {
  11032. if (config.cancelToken) {
  11033. config.cancelToken.unsubscribe(onCanceled);
  11034. }
  11035.  
  11036. if (config.signal) {
  11037. config.signal.removeEventListener('abort', onCanceled);
  11038. }
  11039. }
  11040.  
  11041. if (utils.isFormData(requestData)) {
  11042. if (platform.isStandardBrowserEnv || platform.isStandardBrowserWebWorkerEnv) {
  11043. requestHeaders.setContentType(false); // Let the browser set it
  11044. } else {
  11045. requestHeaders.setContentType('multipart/form-data;', false); // mobile/desktop app frameworks
  11046. }
  11047. }
  11048.  
  11049. let request = new XMLHttpRequest();
  11050.  
  11051. // HTTP basic authentication
  11052. if (config.auth) {
  11053. const username = config.auth.username || '';
  11054. const password = config.auth.password ? unescape(encodeURIComponent(config.auth.password)) : '';
  11055. requestHeaders.set('Authorization', 'Basic ' + btoa(username + ':' + password));
  11056. }
  11057.  
  11058. const fullPath = buildFullPath(config.baseURL, config.url);
  11059.  
  11060. request.open(config.method.toUpperCase(), buildURL(fullPath, config.params, config.paramsSerializer), true);
  11061.  
  11062. // Set the request timeout in MS
  11063. request.timeout = config.timeout;
  11064.  
  11065. function onloadend() {
  11066. if (!request) {
  11067. return;
  11068. }
  11069. // Prepare the response
  11070. const responseHeaders = AxiosHeaders$1.from(
  11071. 'getAllResponseHeaders' in request && request.getAllResponseHeaders()
  11072. );
  11073. const responseData = !responseType || responseType === 'text' || responseType === 'json' ?
  11074. request.responseText : request.response;
  11075. const response = {
  11076. data: responseData,
  11077. status: request.status,
  11078. statusText: request.statusText,
  11079. headers: responseHeaders,
  11080. config,
  11081. request
  11082. };
  11083.  
  11084. settle(function _resolve(value) {
  11085. resolve(value);
  11086. done();
  11087. }, function _reject(err) {
  11088. reject(err);
  11089. done();
  11090. }, response);
  11091.  
  11092. // Clean up request
  11093. request = null;
  11094. }
  11095.  
  11096. if ('onloadend' in request) {
  11097. // Use onloadend if available
  11098. request.onloadend = onloadend;
  11099. } else {
  11100. // Listen for ready state to emulate onloadend
  11101. request.onreadystatechange = function handleLoad() {
  11102. if (!request || request.readyState !== 4) {
  11103. return;
  11104. }
  11105.  
  11106. // The request errored out and we didn't get a response, this will be
  11107. // handled by onerror instead
  11108. // With one exception: request that using file: protocol, most browsers
  11109. // will return status as 0 even though it's a successful request
  11110. if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) {
  11111. return;
  11112. }
  11113. // readystate handler is calling before onerror or ontimeout handlers,
  11114. // so we should call onloadend on the next 'tick'
  11115. setTimeout(onloadend);
  11116. };
  11117. }
  11118.  
  11119. // Handle browser request cancellation (as opposed to a manual cancellation)
  11120. request.onabort = function handleAbort() {
  11121. if (!request) {
  11122. return;
  11123. }
  11124.  
  11125. reject(new AxiosError('Request aborted', AxiosError.ECONNABORTED, config, request));
  11126.  
  11127. // Clean up request
  11128. request = null;
  11129. };
  11130.  
  11131. // Handle low level network errors
  11132. request.onerror = function handleError() {
  11133. // Real errors are hidden from us by the browser
  11134. // onerror should only fire if it's a network error
  11135. reject(new AxiosError('Network Error', AxiosError.ERR_NETWORK, config, request));
  11136.  
  11137. // Clean up request
  11138. request = null;
  11139. };
  11140.  
  11141. // Handle timeout
  11142. request.ontimeout = function handleTimeout() {
  11143. let timeoutErrorMessage = config.timeout ? 'timeout of ' + config.timeout + 'ms exceeded' : 'timeout exceeded';
  11144. const transitional = config.transitional || transitionalDefaults;
  11145. if (config.timeoutErrorMessage) {
  11146. timeoutErrorMessage = config.timeoutErrorMessage;
  11147. }
  11148. reject(new AxiosError(
  11149. timeoutErrorMessage,
  11150. transitional.clarifyTimeoutError ? AxiosError.ETIMEDOUT : AxiosError.ECONNABORTED,
  11151. config,
  11152. request));
  11153.  
  11154. // Clean up request
  11155. request = null;
  11156. };
  11157.  
  11158. // Add xsrf header
  11159. // This is only done if running in a standard browser environment.
  11160. // Specifically not if we're in a web worker, or react-native.
  11161. if (platform.isStandardBrowserEnv) {
  11162. // Add xsrf header
  11163. const xsrfValue = (config.withCredentials || isURLSameOrigin(fullPath))
  11164. && config.xsrfCookieName && cookies.read(config.xsrfCookieName);
  11165.  
  11166. if (xsrfValue) {
  11167. requestHeaders.set(config.xsrfHeaderName, xsrfValue);
  11168. }
  11169. }
  11170.  
  11171. // Remove Content-Type if data is undefined
  11172. requestData === undefined && requestHeaders.setContentType(null);
  11173.  
  11174. // Add headers to the request
  11175. if ('setRequestHeader' in request) {
  11176. utils.forEach(requestHeaders.toJSON(), function setRequestHeader(val, key) {
  11177. request.setRequestHeader(key, val);
  11178. });
  11179. }
  11180.  
  11181. // Add withCredentials to request if needed
  11182. if (!utils.isUndefined(config.withCredentials)) {
  11183. request.withCredentials = !!config.withCredentials;
  11184. }
  11185.  
  11186. // Add responseType to request if needed
  11187. if (responseType && responseType !== 'json') {
  11188. request.responseType = config.responseType;
  11189. }
  11190.  
  11191. // Handle progress if needed
  11192. if (typeof config.onDownloadProgress === 'function') {
  11193. request.addEventListener('progress', progressEventReducer(config.onDownloadProgress, true));
  11194. }
  11195.  
  11196. // Not all browsers support upload events
  11197. if (typeof config.onUploadProgress === 'function' && request.upload) {
  11198. request.upload.addEventListener('progress', progressEventReducer(config.onUploadProgress));
  11199. }
  11200.  
  11201. if (config.cancelToken || config.signal) {
  11202. // Handle cancellation
  11203. // eslint-disable-next-line func-names
  11204. onCanceled = cancel => {
  11205. if (!request) {
  11206. return;
  11207. }
  11208. reject(!cancel || cancel.type ? new CanceledError(null, config, request) : cancel);
  11209. request.abort();
  11210. request = null;
  11211. };
  11212.  
  11213. config.cancelToken && config.cancelToken.subscribe(onCanceled);
  11214. if (config.signal) {
  11215. config.signal.aborted ? onCanceled() : config.signal.addEventListener('abort', onCanceled);
  11216. }
  11217. }
  11218.  
  11219. const protocol = parseProtocol(fullPath);
  11220.  
  11221. if (protocol && platform.protocols.indexOf(protocol) === -1) {
  11222. reject(new AxiosError('Unsupported protocol ' + protocol + ':', AxiosError.ERR_BAD_REQUEST, config));
  11223. return;
  11224. }
  11225.  
  11226.  
  11227. // Send the request
  11228. request.send(requestData || null);
  11229. });
  11230. };
  11231.  
  11232. const knownAdapters = {
  11233. http: httpAdapter,
  11234. xhr: xhrAdapter
  11235. };
  11236.  
  11237. utils.forEach(knownAdapters, (fn, value) => {
  11238. if(fn) {
  11239. try {
  11240. Object.defineProperty(fn, 'name', {value});
  11241. } catch (e) {
  11242. // eslint-disable-next-line no-empty
  11243. }
  11244. Object.defineProperty(fn, 'adapterName', {value});
  11245. }
  11246. });
  11247.  
  11248. var adapters = {
  11249. getAdapter: (adapters) => {
  11250. adapters = utils.isArray(adapters) ? adapters : [adapters];
  11251.  
  11252. const {length} = adapters;
  11253. let nameOrAdapter;
  11254. let adapter;
  11255.  
  11256. for (let i = 0; i < length; i++) {
  11257. nameOrAdapter = adapters[i];
  11258. if((adapter = utils.isString(nameOrAdapter) ? knownAdapters[nameOrAdapter.toLowerCase()] : nameOrAdapter)) {
  11259. break;
  11260. }
  11261. }
  11262.  
  11263. if (!adapter) {
  11264. if (adapter === false) {
  11265. throw new AxiosError(
  11266. `Adapter ${nameOrAdapter} is not supported by the environment`,
  11267. 'ERR_NOT_SUPPORT'
  11268. );
  11269. }
  11270.  
  11271. throw new Error(
  11272. utils.hasOwnProp(knownAdapters, nameOrAdapter) ?
  11273. `Adapter '${nameOrAdapter}' is not available in the build` :
  11274. `Unknown adapter '${nameOrAdapter}'`
  11275. );
  11276. }
  11277.  
  11278. if (!utils.isFunction(adapter)) {
  11279. throw new TypeError('adapter is not a function');
  11280. }
  11281.  
  11282. return adapter;
  11283. },
  11284. adapters: knownAdapters
  11285. };
  11286.  
  11287. /**
  11288. * Throws a `CanceledError` if cancellation has been requested.
  11289. *
  11290. * @param {Object} config The config that is to be used for the request
  11291. *
  11292. * @returns {void}
  11293. */
  11294. function throwIfCancellationRequested(config) {
  11295. if (config.cancelToken) {
  11296. config.cancelToken.throwIfRequested();
  11297. }
  11298.  
  11299. if (config.signal && config.signal.aborted) {
  11300. throw new CanceledError(null, config);
  11301. }
  11302. }
  11303.  
  11304. /**
  11305. * Dispatch a request to the server using the configured adapter.
  11306. *
  11307. * @param {object} config The config that is to be used for the request
  11308. *
  11309. * @returns {Promise} The Promise to be fulfilled
  11310. */
  11311. function dispatchRequest(config) {
  11312. throwIfCancellationRequested(config);
  11313.  
  11314. config.headers = AxiosHeaders$1.from(config.headers);
  11315.  
  11316. // Transform request data
  11317. config.data = transformData.call(
  11318. config,
  11319. config.transformRequest
  11320. );
  11321.  
  11322. if (['post', 'put', 'patch'].indexOf(config.method) !== -1) {
  11323. config.headers.setContentType('application/x-www-form-urlencoded', false);
  11324. }
  11325.  
  11326. const adapter = adapters.getAdapter(config.adapter || defaults$1.adapter);
  11327.  
  11328. return adapter(config).then(function onAdapterResolution(response) {
  11329. throwIfCancellationRequested(config);
  11330.  
  11331. // Transform response data
  11332. response.data = transformData.call(
  11333. config,
  11334. config.transformResponse,
  11335. response
  11336. );
  11337.  
  11338. response.headers = AxiosHeaders$1.from(response.headers);
  11339.  
  11340. return response;
  11341. }, function onAdapterRejection(reason) {
  11342. if (!isCancel(reason)) {
  11343. throwIfCancellationRequested(config);
  11344.  
  11345. // Transform response data
  11346. if (reason && reason.response) {
  11347. reason.response.data = transformData.call(
  11348. config,
  11349. config.transformResponse,
  11350. reason.response
  11351. );
  11352. reason.response.headers = AxiosHeaders$1.from(reason.response.headers);
  11353. }
  11354. }
  11355.  
  11356. return Promise.reject(reason);
  11357. });
  11358. }
  11359.  
  11360. const headersToObject = (thing) => thing instanceof AxiosHeaders$1 ? thing.toJSON() : thing;
  11361.  
  11362. /**
  11363. * Config-specific merge-function which creates a new config-object
  11364. * by merging two configuration objects together.
  11365. *
  11366. * @param {Object} config1
  11367. * @param {Object} config2
  11368. *
  11369. * @returns {Object} New object resulting from merging config2 to config1
  11370. */
  11371. function mergeConfig(config1, config2) {
  11372. // eslint-disable-next-line no-param-reassign
  11373. config2 = config2 || {};
  11374. const config = {};
  11375.  
  11376. function getMergedValue(target, source, caseless) {
  11377. if (utils.isPlainObject(target) && utils.isPlainObject(source)) {
  11378. return utils.merge.call({caseless}, target, source);
  11379. } else if (utils.isPlainObject(source)) {
  11380. return utils.merge({}, source);
  11381. } else if (utils.isArray(source)) {
  11382. return source.slice();
  11383. }
  11384. return source;
  11385. }
  11386.  
  11387. // eslint-disable-next-line consistent-return
  11388. function mergeDeepProperties(a, b, caseless) {
  11389. if (!utils.isUndefined(b)) {
  11390. return getMergedValue(a, b, caseless);
  11391. } else if (!utils.isUndefined(a)) {
  11392. return getMergedValue(undefined, a, caseless);
  11393. }
  11394. }
  11395.  
  11396. // eslint-disable-next-line consistent-return
  11397. function valueFromConfig2(a, b) {
  11398. if (!utils.isUndefined(b)) {
  11399. return getMergedValue(undefined, b);
  11400. }
  11401. }
  11402.  
  11403. // eslint-disable-next-line consistent-return
  11404. function defaultToConfig2(a, b) {
  11405. if (!utils.isUndefined(b)) {
  11406. return getMergedValue(undefined, b);
  11407. } else if (!utils.isUndefined(a)) {
  11408. return getMergedValue(undefined, a);
  11409. }
  11410. }
  11411.  
  11412. // eslint-disable-next-line consistent-return
  11413. function mergeDirectKeys(a, b, prop) {
  11414. if (prop in config2) {
  11415. return getMergedValue(a, b);
  11416. } else if (prop in config1) {
  11417. return getMergedValue(undefined, a);
  11418. }
  11419. }
  11420.  
  11421. const mergeMap = {
  11422. url: valueFromConfig2,
  11423. method: valueFromConfig2,
  11424. data: valueFromConfig2,
  11425. baseURL: defaultToConfig2,
  11426. transformRequest: defaultToConfig2,
  11427. transformResponse: defaultToConfig2,
  11428. paramsSerializer: defaultToConfig2,
  11429. timeout: defaultToConfig2,
  11430. timeoutMessage: defaultToConfig2,
  11431. withCredentials: defaultToConfig2,
  11432. adapter: defaultToConfig2,
  11433. responseType: defaultToConfig2,
  11434. xsrfCookieName: defaultToConfig2,
  11435. xsrfHeaderName: defaultToConfig2,
  11436. onUploadProgress: defaultToConfig2,
  11437. onDownloadProgress: defaultToConfig2,
  11438. decompress: defaultToConfig2,
  11439. maxContentLength: defaultToConfig2,
  11440. maxBodyLength: defaultToConfig2,
  11441. beforeRedirect: defaultToConfig2,
  11442. transport: defaultToConfig2,
  11443. httpAgent: defaultToConfig2,
  11444. httpsAgent: defaultToConfig2,
  11445. cancelToken: defaultToConfig2,
  11446. socketPath: defaultToConfig2,
  11447. responseEncoding: defaultToConfig2,
  11448. validateStatus: mergeDirectKeys,
  11449. headers: (a, b) => mergeDeepProperties(headersToObject(a), headersToObject(b), true)
  11450. };
  11451.  
  11452. utils.forEach(Object.keys(Object.assign({}, config1, config2)), function computeConfigValue(prop) {
  11453. const merge = mergeMap[prop] || mergeDeepProperties;
  11454. const configValue = merge(config1[prop], config2[prop], prop);
  11455. (utils.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);
  11456. });
  11457.  
  11458. return config;
  11459. }
  11460.  
  11461. const VERSION = "1.5.0";
  11462.  
  11463. const validators$1 = {};
  11464.  
  11465. // eslint-disable-next-line func-names
  11466. ['object', 'boolean', 'number', 'function', 'string', 'symbol'].forEach((type, i) => {
  11467. validators$1[type] = function validator(thing) {
  11468. return typeof thing === type || 'a' + (i < 1 ? 'n ' : ' ') + type;
  11469. };
  11470. });
  11471.  
  11472. const deprecatedWarnings = {};
  11473.  
  11474. /**
  11475. * Transitional option validator
  11476. *
  11477. * @param {function|boolean?} validator - set to false if the transitional option has been removed
  11478. * @param {string?} version - deprecated version / removed since version
  11479. * @param {string?} message - some message with additional info
  11480. *
  11481. * @returns {function}
  11482. */
  11483. validators$1.transitional = function transitional(validator, version, message) {
  11484. function formatMessage(opt, desc) {
  11485. return '[Axios v' + VERSION + '] Transitional option \'' + opt + '\'' + desc + (message ? '. ' + message : '');
  11486. }
  11487.  
  11488. // eslint-disable-next-line func-names
  11489. return (value, opt, opts) => {
  11490. if (validator === false) {
  11491. throw new AxiosError(
  11492. formatMessage(opt, ' has been removed' + (version ? ' in ' + version : '')),
  11493. AxiosError.ERR_DEPRECATED
  11494. );
  11495. }
  11496.  
  11497. if (version && !deprecatedWarnings[opt]) {
  11498. deprecatedWarnings[opt] = true;
  11499. // eslint-disable-next-line no-console
  11500. console.warn(
  11501. formatMessage(
  11502. opt,
  11503. ' has been deprecated since v' + version + ' and will be removed in the near future'
  11504. )
  11505. );
  11506. }
  11507.  
  11508. return validator ? validator(value, opt, opts) : true;
  11509. };
  11510. };
  11511.  
  11512. /**
  11513. * Assert object's properties type
  11514. *
  11515. * @param {object} options
  11516. * @param {object} schema
  11517. * @param {boolean?} allowUnknown
  11518. *
  11519. * @returns {object}
  11520. */
  11521.  
  11522. function assertOptions(options, schema, allowUnknown) {
  11523. if (typeof options !== 'object') {
  11524. throw new AxiosError('options must be an object', AxiosError.ERR_BAD_OPTION_VALUE);
  11525. }
  11526. const keys = Object.keys(options);
  11527. let i = keys.length;
  11528. while (i-- > 0) {
  11529. const opt = keys[i];
  11530. const validator = schema[opt];
  11531. if (validator) {
  11532. const value = options[opt];
  11533. const result = value === undefined || validator(value, opt, options);
  11534. if (result !== true) {
  11535. throw new AxiosError('option ' + opt + ' must be ' + result, AxiosError.ERR_BAD_OPTION_VALUE);
  11536. }
  11537. continue;
  11538. }
  11539. if (allowUnknown !== true) {
  11540. throw new AxiosError('Unknown option ' + opt, AxiosError.ERR_BAD_OPTION);
  11541. }
  11542. }
  11543. }
  11544.  
  11545. var validator = {
  11546. assertOptions,
  11547. validators: validators$1
  11548. };
  11549.  
  11550. const validators = validator.validators;
  11551.  
  11552. /**
  11553. * Create a new instance of Axios
  11554. *
  11555. * @param {Object} instanceConfig The default config for the instance
  11556. *
  11557. * @return {Axios} A new instance of Axios
  11558. */
  11559. class Axios {
  11560. constructor(instanceConfig) {
  11561. this.defaults = instanceConfig;
  11562. this.interceptors = {
  11563. request: new InterceptorManager$1(),
  11564. response: new InterceptorManager$1()
  11565. };
  11566. }
  11567.  
  11568. /**
  11569. * Dispatch a request
  11570. *
  11571. * @param {String|Object} configOrUrl The config specific for this request (merged with this.defaults)
  11572. * @param {?Object} config
  11573. *
  11574. * @returns {Promise} The Promise to be fulfilled
  11575. */
  11576. request(configOrUrl, config) {
  11577. /*eslint no-param-reassign:0*/
  11578. // Allow for axios('example/url'[, config]) a la fetch API
  11579. if (typeof configOrUrl === 'string') {
  11580. config = config || {};
  11581. config.url = configOrUrl;
  11582. } else {
  11583. config = configOrUrl || {};
  11584. }
  11585.  
  11586. config = mergeConfig(this.defaults, config);
  11587.  
  11588. const {transitional, paramsSerializer, headers} = config;
  11589.  
  11590. if (transitional !== undefined) {
  11591. validator.assertOptions(transitional, {
  11592. silentJSONParsing: validators.transitional(validators.boolean),
  11593. forcedJSONParsing: validators.transitional(validators.boolean),
  11594. clarifyTimeoutError: validators.transitional(validators.boolean)
  11595. }, false);
  11596. }
  11597.  
  11598. if (paramsSerializer != null) {
  11599. if (utils.isFunction(paramsSerializer)) {
  11600. config.paramsSerializer = {
  11601. serialize: paramsSerializer
  11602. };
  11603. } else {
  11604. validator.assertOptions(paramsSerializer, {
  11605. encode: validators.function,
  11606. serialize: validators.function
  11607. }, true);
  11608. }
  11609. }
  11610.  
  11611. // Set config.method
  11612. config.method = (config.method || this.defaults.method || 'get').toLowerCase();
  11613.  
  11614. // Flatten headers
  11615. let contextHeaders = headers && utils.merge(
  11616. headers.common,
  11617. headers[config.method]
  11618. );
  11619.  
  11620. headers && utils.forEach(
  11621. ['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],
  11622. (method) => {
  11623. delete headers[method];
  11624. }
  11625. );
  11626.  
  11627. config.headers = AxiosHeaders$1.concat(contextHeaders, headers);
  11628.  
  11629. // filter out skipped interceptors
  11630. const requestInterceptorChain = [];
  11631. let synchronousRequestInterceptors = true;
  11632. this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {
  11633. if (typeof interceptor.runWhen === 'function' && interceptor.runWhen(config) === false) {
  11634. return;
  11635. }
  11636.  
  11637. synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous;
  11638.  
  11639. requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected);
  11640. });
  11641.  
  11642. const responseInterceptorChain = [];
  11643. this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {
  11644. responseInterceptorChain.push(interceptor.fulfilled, interceptor.rejected);
  11645. });
  11646.  
  11647. let promise;
  11648. let i = 0;
  11649. let len;
  11650.  
  11651. if (!synchronousRequestInterceptors) {
  11652. const chain = [dispatchRequest.bind(this), undefined];
  11653. chain.unshift.apply(chain, requestInterceptorChain);
  11654. chain.push.apply(chain, responseInterceptorChain);
  11655. len = chain.length;
  11656.  
  11657. promise = Promise.resolve(config);
  11658.  
  11659. while (i < len) {
  11660. promise = promise.then(chain[i++], chain[i++]);
  11661. }
  11662.  
  11663. return promise;
  11664. }
  11665.  
  11666. len = requestInterceptorChain.length;
  11667.  
  11668. let newConfig = config;
  11669.  
  11670. i = 0;
  11671.  
  11672. while (i < len) {
  11673. const onFulfilled = requestInterceptorChain[i++];
  11674. const onRejected = requestInterceptorChain[i++];
  11675. try {
  11676. newConfig = onFulfilled(newConfig);
  11677. } catch (error) {
  11678. onRejected.call(this, error);
  11679. break;
  11680. }
  11681. }
  11682.  
  11683. try {
  11684. promise = dispatchRequest.call(this, newConfig);
  11685. } catch (error) {
  11686. return Promise.reject(error);
  11687. }
  11688.  
  11689. i = 0;
  11690. len = responseInterceptorChain.length;
  11691.  
  11692. while (i < len) {
  11693. promise = promise.then(responseInterceptorChain[i++], responseInterceptorChain[i++]);
  11694. }
  11695.  
  11696. return promise;
  11697. }
  11698.  
  11699. getUri(config) {
  11700. config = mergeConfig(this.defaults, config);
  11701. const fullPath = buildFullPath(config.baseURL, config.url);
  11702. return buildURL(fullPath, config.params, config.paramsSerializer);
  11703. }
  11704. }
  11705.  
  11706. // Provide aliases for supported request methods
  11707. utils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {
  11708. /*eslint func-names:0*/
  11709. Axios.prototype[method] = function(url, config) {
  11710. return this.request(mergeConfig(config || {}, {
  11711. method,
  11712. url,
  11713. data: (config || {}).data
  11714. }));
  11715. };
  11716. });
  11717.  
  11718. utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
  11719. /*eslint func-names:0*/
  11720.  
  11721. function generateHTTPMethod(isForm) {
  11722. return function httpMethod(url, data, config) {
  11723. return this.request(mergeConfig(config || {}, {
  11724. method,
  11725. headers: isForm ? {
  11726. 'Content-Type': 'multipart/form-data'
  11727. } : {},
  11728. url,
  11729. data
  11730. }));
  11731. };
  11732. }
  11733.  
  11734. Axios.prototype[method] = generateHTTPMethod();
  11735.  
  11736. Axios.prototype[method + 'Form'] = generateHTTPMethod(true);
  11737. });
  11738.  
  11739. var Axios$1 = Axios;
  11740.  
  11741. /**
  11742. * A `CancelToken` is an object that can be used to request cancellation of an operation.
  11743. *
  11744. * @param {Function} executor The executor function.
  11745. *
  11746. * @returns {CancelToken}
  11747. */
  11748. class CancelToken {
  11749. constructor(executor) {
  11750. if (typeof executor !== 'function') {
  11751. throw new TypeError('executor must be a function.');
  11752. }
  11753.  
  11754. let resolvePromise;
  11755.  
  11756. this.promise = new Promise(function promiseExecutor(resolve) {
  11757. resolvePromise = resolve;
  11758. });
  11759.  
  11760. const token = this;
  11761.  
  11762. // eslint-disable-next-line func-names
  11763. this.promise.then(cancel => {
  11764. if (!token._listeners) return;
  11765.  
  11766. let i = token._listeners.length;
  11767.  
  11768. while (i-- > 0) {
  11769. token._listeners[i](cancel);
  11770. }
  11771. token._listeners = null;
  11772. });
  11773.  
  11774. // eslint-disable-next-line func-names
  11775. this.promise.then = onfulfilled => {
  11776. let _resolve;
  11777. // eslint-disable-next-line func-names
  11778. const promise = new Promise(resolve => {
  11779. token.subscribe(resolve);
  11780. _resolve = resolve;
  11781. }).then(onfulfilled);
  11782.  
  11783. promise.cancel = function reject() {
  11784. token.unsubscribe(_resolve);
  11785. };
  11786.  
  11787. return promise;
  11788. };
  11789.  
  11790. executor(function cancel(message, config, request) {
  11791. if (token.reason) {
  11792. // Cancellation has already been requested
  11793. return;
  11794. }
  11795.  
  11796. token.reason = new CanceledError(message, config, request);
  11797. resolvePromise(token.reason);
  11798. });
  11799. }
  11800.  
  11801. /**
  11802. * Throws a `CanceledError` if cancellation has been requested.
  11803. */
  11804. throwIfRequested() {
  11805. if (this.reason) {
  11806. throw this.reason;
  11807. }
  11808. }
  11809.  
  11810. /**
  11811. * Subscribe to the cancel signal
  11812. */
  11813.  
  11814. subscribe(listener) {
  11815. if (this.reason) {
  11816. listener(this.reason);
  11817. return;
  11818. }
  11819.  
  11820. if (this._listeners) {
  11821. this._listeners.push(listener);
  11822. } else {
  11823. this._listeners = [listener];
  11824. }
  11825. }
  11826.  
  11827. /**
  11828. * Unsubscribe from the cancel signal
  11829. */
  11830.  
  11831. unsubscribe(listener) {
  11832. if (!this._listeners) {
  11833. return;
  11834. }
  11835. const index = this._listeners.indexOf(listener);
  11836. if (index !== -1) {
  11837. this._listeners.splice(index, 1);
  11838. }
  11839. }
  11840.  
  11841. /**
  11842. * Returns an object that contains a new `CancelToken` and a function that, when called,
  11843. * cancels the `CancelToken`.
  11844. */
  11845. static source() {
  11846. let cancel;
  11847. const token = new CancelToken(function executor(c) {
  11848. cancel = c;
  11849. });
  11850. return {
  11851. token,
  11852. cancel
  11853. };
  11854. }
  11855. }
  11856.  
  11857. var CancelToken$1 = CancelToken;
  11858.  
  11859. /**
  11860. * Syntactic sugar for invoking a function and expanding an array for arguments.
  11861. *
  11862. * Common use case would be to use `Function.prototype.apply`.
  11863. *
  11864. * ```js
  11865. * function f(x, y, z) {}
  11866. * var args = [1, 2, 3];
  11867. * f.apply(null, args);
  11868. * ```
  11869. *
  11870. * With `spread` this example can be re-written.
  11871. *
  11872. * ```js
  11873. * spread(function(x, y, z) {})([1, 2, 3]);
  11874. * ```
  11875. *
  11876. * @param {Function} callback
  11877. *
  11878. * @returns {Function}
  11879. */
  11880. function spread(callback) {
  11881. return function wrap(arr) {
  11882. return callback.apply(null, arr);
  11883. };
  11884. }
  11885.  
  11886. /**
  11887. * Determines whether the payload is an error thrown by Axios
  11888. *
  11889. * @param {*} payload The value to test
  11890. *
  11891. * @returns {boolean} True if the payload is an error thrown by Axios, otherwise false
  11892. */
  11893. function isAxiosError(payload) {
  11894. return utils.isObject(payload) && (payload.isAxiosError === true);
  11895. }
  11896.  
  11897. const HttpStatusCode = {
  11898. Continue: 100,
  11899. SwitchingProtocols: 101,
  11900. Processing: 102,
  11901. EarlyHints: 103,
  11902. Ok: 200,
  11903. Created: 201,
  11904. Accepted: 202,
  11905. NonAuthoritativeInformation: 203,
  11906. NoContent: 204,
  11907. ResetContent: 205,
  11908. PartialContent: 206,
  11909. MultiStatus: 207,
  11910. AlreadyReported: 208,
  11911. ImUsed: 226,
  11912. MultipleChoices: 300,
  11913. MovedPermanently: 301,
  11914. Found: 302,
  11915. SeeOther: 303,
  11916. NotModified: 304,
  11917. UseProxy: 305,
  11918. Unused: 306,
  11919. TemporaryRedirect: 307,
  11920. PermanentRedirect: 308,
  11921. BadRequest: 400,
  11922. Unauthorized: 401,
  11923. PaymentRequired: 402,
  11924. Forbidden: 403,
  11925. NotFound: 404,
  11926. MethodNotAllowed: 405,
  11927. NotAcceptable: 406,
  11928. ProxyAuthenticationRequired: 407,
  11929. RequestTimeout: 408,
  11930. Conflict: 409,
  11931. Gone: 410,
  11932. LengthRequired: 411,
  11933. PreconditionFailed: 412,
  11934. PayloadTooLarge: 413,
  11935. UriTooLong: 414,
  11936. UnsupportedMediaType: 415,
  11937. RangeNotSatisfiable: 416,
  11938. ExpectationFailed: 417,
  11939. ImATeapot: 418,
  11940. MisdirectedRequest: 421,
  11941. UnprocessableEntity: 422,
  11942. Locked: 423,
  11943. FailedDependency: 424,
  11944. TooEarly: 425,
  11945. UpgradeRequired: 426,
  11946. PreconditionRequired: 428,
  11947. TooManyRequests: 429,
  11948. RequestHeaderFieldsTooLarge: 431,
  11949. UnavailableForLegalReasons: 451,
  11950. InternalServerError: 500,
  11951. NotImplemented: 501,
  11952. BadGateway: 502,
  11953. ServiceUnavailable: 503,
  11954. GatewayTimeout: 504,
  11955. HttpVersionNotSupported: 505,
  11956. VariantAlsoNegotiates: 506,
  11957. InsufficientStorage: 507,
  11958. LoopDetected: 508,
  11959. NotExtended: 510,
  11960. NetworkAuthenticationRequired: 511,
  11961. };
  11962.  
  11963. Object.entries(HttpStatusCode).forEach(([key, value]) => {
  11964. HttpStatusCode[value] = key;
  11965. });
  11966.  
  11967. var HttpStatusCode$1 = HttpStatusCode;
  11968.  
  11969. /**
  11970. * Create an instance of Axios
  11971. *
  11972. * @param {Object} defaultConfig The default config for the instance
  11973. *
  11974. * @returns {Axios} A new instance of Axios
  11975. */
  11976. function createInstance(defaultConfig) {
  11977. const context = new Axios$1(defaultConfig);
  11978. const instance = bind(Axios$1.prototype.request, context);
  11979.  
  11980. // Copy axios.prototype to instance
  11981. utils.extend(instance, Axios$1.prototype, context, {allOwnKeys: true});
  11982.  
  11983. // Copy context to instance
  11984. utils.extend(instance, context, null, {allOwnKeys: true});
  11985.  
  11986. // Factory for creating new instances
  11987. instance.create = function create(instanceConfig) {
  11988. return createInstance(mergeConfig(defaultConfig, instanceConfig));
  11989. };
  11990.  
  11991. return instance;
  11992. }
  11993.  
  11994. // Create the default instance to be exported
  11995. const axios = createInstance(defaults$1);
  11996.  
  11997. // Expose Axios class to allow class inheritance
  11998. axios.Axios = Axios$1;
  11999.  
  12000. // Expose Cancel & CancelToken
  12001. axios.CanceledError = CanceledError;
  12002. axios.CancelToken = CancelToken$1;
  12003. axios.isCancel = isCancel;
  12004. axios.VERSION = VERSION;
  12005. axios.toFormData = toFormData;
  12006.  
  12007. // Expose AxiosError class
  12008. axios.AxiosError = AxiosError;
  12009.  
  12010. // alias for CanceledError for backward compatibility
  12011. axios.Cancel = axios.CanceledError;
  12012.  
  12013. // Expose all/spread
  12014. axios.all = function all(promises) {
  12015. return Promise.all(promises);
  12016. };
  12017.  
  12018. axios.spread = spread;
  12019.  
  12020. // Expose isAxiosError
  12021. axios.isAxiosError = isAxiosError;
  12022.  
  12023. // Expose mergeConfig
  12024. axios.mergeConfig = mergeConfig;
  12025.  
  12026. axios.AxiosHeaders = AxiosHeaders$1;
  12027.  
  12028. axios.formToJSON = thing => formDataToJSON(utils.isHTMLForm(thing) ? new FormData(thing) : thing);
  12029.  
  12030. axios.getAdapter = adapters.getAdapter;
  12031.  
  12032. axios.HttpStatusCode = HttpStatusCode$1;
  12033.  
  12034. axios.default = axios;
  12035.  
  12036. module.exports = axios;
  12037. //# sourceMappingURL=axios.cjs.map
  12038.  
  12039.  
  12040. /***/ }),
  12041. /* 5 */
  12042. /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
  12043.  
  12044. "use strict";
  12045.  
  12046. var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
  12047. if (k2 === undefined) k2 = k;
  12048. var desc = Object.getOwnPropertyDescriptor(m, k);
  12049. if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
  12050. desc = { enumerable: true, get: function() { return m[k]; } };
  12051. }
  12052. Object.defineProperty(o, k2, desc);
  12053. }) : (function(o, m, k, k2) {
  12054. if (k2 === undefined) k2 = k;
  12055. o[k2] = m[k];
  12056. }));
  12057. var __exportStar = (this && this.__exportStar) || function(m, exports) {
  12058. for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
  12059. };
  12060. Object.defineProperty(exports, "__esModule", ({ value: true }));
  12061. __exportStar(__webpack_require__(37), exports);
  12062. __exportStar(__webpack_require__(38), exports);
  12063. __exportStar(__webpack_require__(39), exports);
  12064. __exportStar(__webpack_require__(40), exports);
  12065. __exportStar(__webpack_require__(41), exports);
  12066. __exportStar(__webpack_require__(42), exports);
  12067. __exportStar(__webpack_require__(17), exports);
  12068. __exportStar(__webpack_require__(43), exports);
  12069. __exportStar(__webpack_require__(44), exports);
  12070. __exportStar(__webpack_require__(45), exports);
  12071. __exportStar(__webpack_require__(46), exports);
  12072. __exportStar(__webpack_require__(30), exports);
  12073.  
  12074.  
  12075. /***/ }),
  12076. /* 6 */
  12077. /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
  12078.  
  12079. "use strict";
  12080.  
  12081. var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
  12082. if (k2 === undefined) k2 = k;
  12083. var desc = Object.getOwnPropertyDescriptor(m, k);
  12084. if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
  12085. desc = { enumerable: true, get: function() { return m[k]; } };
  12086. }
  12087. Object.defineProperty(o, k2, desc);
  12088. }) : (function(o, m, k, k2) {
  12089. if (k2 === undefined) k2 = k;
  12090. o[k2] = m[k];
  12091. }));
  12092. var __exportStar = (this && this.__exportStar) || function(m, exports) {
  12093. for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
  12094. };
  12095. Object.defineProperty(exports, "__esModule", ({ value: true }));
  12096. __exportStar(__webpack_require__(12), exports);
  12097. __exportStar(__webpack_require__(20), exports);
  12098. __exportStar(__webpack_require__(13), exports);
  12099. __exportStar(__webpack_require__(7), exports);
  12100. __exportStar(__webpack_require__(25), exports);
  12101. __exportStar(__webpack_require__(51), exports);
  12102. __exportStar(__webpack_require__(26), exports);
  12103.  
  12104.  
  12105. /***/ }),
  12106. /* 7 */
  12107. /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
  12108.  
  12109. "use strict";
  12110.  
  12111. var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
  12112. if (k2 === undefined) k2 = k;
  12113. var desc = Object.getOwnPropertyDescriptor(m, k);
  12114. if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
  12115. desc = { enumerable: true, get: function() { return m[k]; } };
  12116. }
  12117. Object.defineProperty(o, k2, desc);
  12118. }) : (function(o, m, k, k2) {
  12119. if (k2 === undefined) k2 = k;
  12120. o[k2] = m[k];
  12121. }));
  12122. var __exportStar = (this && this.__exportStar) || function(m, exports) {
  12123. for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
  12124. };
  12125. Object.defineProperty(exports, "__esModule", ({ value: true }));
  12126. __exportStar(__webpack_require__(21), exports);
  12127. __exportStar(__webpack_require__(22), exports);
  12128. __exportStar(__webpack_require__(23), exports);
  12129. __exportStar(__webpack_require__(24), exports);
  12130.  
  12131.  
  12132. /***/ }),
  12133. /* 8 */
  12134. /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
  12135.  
  12136. "use strict";
  12137.  
  12138. var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
  12139. function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
  12140. return new (P || (P = Promise))(function (resolve, reject) {
  12141. function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
  12142. function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
  12143. function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
  12144. step((generator = generator.apply(thisArg, _arguments || [])).next());
  12145. });
  12146. };
  12147. Object.defineProperty(exports, "__esModule", ({ value: true }));
  12148. exports.GitlabHttpClient = void 0;
  12149. const axios_1 = __webpack_require__(4);
  12150. const config_1 = __webpack_require__(0);
  12151. const types_1 = __webpack_require__(5);
  12152. const get_gl_token_1 = __webpack_require__(9);
  12153. const http_client_base_1 = __webpack_require__(3);
  12154. class GitlabHttpClient extends http_client_base_1.HttpClient {
  12155. constructor(_token) {
  12156. super(config_1.gitlabApiUrl);
  12157. this._token = _token;
  12158. this._handleRequest = (config) => {
  12159. if (!!config && !!config.headers) {
  12160. config.headers['PRIVATE-TOKEN'] = this._token || '';
  12161. }
  12162. return config;
  12163. };
  12164. this._handleUnauthorizedError = (error) => {
  12165. var _a;
  12166. if (((_a = error.response) === null || _a === void 0 ? void 0 : _a.status) === 401) {
  12167. this._token = (0, get_gl_token_1.getGitlabToken)();
  12168. }
  12169. return Promise.reject(error);
  12170. };
  12171. this._initInterceptor = () => {
  12172. this.client.interceptors.request.use(this._handleRequest, this._handleError);
  12173. };
  12174. this._init();
  12175. }
  12176. static getInstance() {
  12177. if (!this.instance) {
  12178. this.instance = new GitlabHttpClient();
  12179. }
  12180. return this.instance;
  12181. }
  12182. getPipelines() {
  12183. return __awaiter(this, void 0, void 0, function* () {
  12184. try {
  12185. const pipelines = yield this.client.get(`projects/${config_1.gitlabProjectId}/pipelines`);
  12186. return pipelines;
  12187. }
  12188. catch (error) {
  12189. if (error instanceof axios_1.AxiosError) {
  12190. this._handleUnauthorizedError(error);
  12191. }
  12192. }
  12193. });
  12194. }
  12195. getPipelineSchedules() {
  12196. return __awaiter(this, void 0, void 0, function* () {
  12197. try {
  12198. const schedules = yield this.client.get(`projects/${config_1.gitlabProjectId}/pipeline_schedules`);
  12199. return schedules;
  12200. }
  12201. catch (error) {
  12202. if (error instanceof axios_1.AxiosError) {
  12203. this._handleUnauthorizedError(error);
  12204. }
  12205. }
  12206. });
  12207. }
  12208. getPipeLineScheduleById(scheduleId) {
  12209. return __awaiter(this, void 0, void 0, function* () {
  12210. if (!scheduleId) {
  12211. throw new Error('scheduleId is required');
  12212. }
  12213. try {
  12214. const schedule = yield this.client.get(`projects/${config_1.gitlabProjectId}/pipeline_schedules/${scheduleId}`);
  12215. return schedule;
  12216. }
  12217. catch (error) {
  12218. if (error instanceof axios_1.AxiosError) {
  12219. this._handleUnauthorizedError(error);
  12220. }
  12221. }
  12222. });
  12223. }
  12224. createPipelineSchedule(schedule) {
  12225. return __awaiter(this, void 0, void 0, function* () {
  12226. try {
  12227. const newSchedule = yield this.client.post(`projects/${config_1.gitlabProjectId}/pipeline_schedules`, schedule);
  12228. const { id } = newSchedule;
  12229. yield Promise.all((schedule.variables || []).map((variable) => this.createPipelineScheduleVariable(id, variable)));
  12230. return newSchedule;
  12231. }
  12232. catch (error) {
  12233. if (error instanceof axios_1.AxiosError) {
  12234. this._handleUnauthorizedError(error);
  12235. }
  12236. }
  12237. });
  12238. }
  12239. createPipelineScheduleVariable(scheduleId, variable) {
  12240. return __awaiter(this, void 0, void 0, function* () {
  12241. if (!scheduleId) {
  12242. throw new Error('scheduleId is required');
  12243. }
  12244. const _newVariable = {
  12245. key: variable.key,
  12246. value: variable.value,
  12247. variable_type: variable.variable_type !== types_1.CreateGitlabScheduleVariableTypes.FILE
  12248. ? types_1.CreateGitlabScheduleVariableTypes.ENV_VAR
  12249. : types_1.CreateGitlabScheduleVariableTypes.FILE,
  12250. };
  12251. try {
  12252. const newVariable = yield this.client.post(`projects/${config_1.gitlabProjectId}/pipeline_schedules/${scheduleId}/variables`, _newVariable);
  12253. return newVariable;
  12254. }
  12255. catch (error) {
  12256. if (error instanceof axios_1.AxiosError) {
  12257. this._handleUnauthorizedError(error);
  12258. }
  12259. }
  12260. });
  12261. }
  12262. getProjectBranches(projectId) {
  12263. return __awaiter(this, void 0, void 0, function* () {
  12264. try {
  12265. const branches = yield this.client.get(`projects/${projectId || config_1.gitlabProjectId}/repository/branches?per_page=${config_1.gitlabRestPerPage}`);
  12266. return branches.map((branch) => branch.name);
  12267. }
  12268. catch (error) {
  12269. if (error instanceof axios_1.AxiosError) {
  12270. this._handleUnauthorizedError(error);
  12271. }
  12272. }
  12273. });
  12274. }
  12275. getProjectVariables(projectId) {
  12276. return __awaiter(this, void 0, void 0, function* () {
  12277. try {
  12278. const variables = yield this.client.get(`projects/${projectId}/variables`);
  12279. return variables;
  12280. }
  12281. catch (error) {
  12282. if (error instanceof axios_1.AxiosError) {
  12283. this._handleUnauthorizedError(error);
  12284. }
  12285. }
  12286. });
  12287. }
  12288. _init() {
  12289. this._token = (0, get_gl_token_1.getTokenFromLocalStorage)();
  12290. this._initInterceptor();
  12291. }
  12292. }
  12293. exports.GitlabHttpClient = GitlabHttpClient;
  12294.  
  12295.  
  12296. /***/ }),
  12297. /* 9 */
  12298. /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
  12299.  
  12300. "use strict";
  12301.  
  12302. Object.defineProperty(exports, "__esModule", ({ value: true }));
  12303. exports.getGitlabToken = exports.getTokenFromLocalStorage = void 0;
  12304. const config_1 = __webpack_require__(0);
  12305. function getTokenFromLocalStorage() {
  12306. const _lsToken = window.atob(localStorage.getItem(config_1.gitlabTokenLocalStorageKey) || '');
  12307. if (_lsToken && _lsToken.length > 0) {
  12308. return _lsToken;
  12309. }
  12310. else {
  12311. return '';
  12312. }
  12313. }
  12314. exports.getTokenFromLocalStorage = getTokenFromLocalStorage;
  12315. function getGitlabToken() {
  12316. const inputToken = prompt('Invalid Gitlab token. Please enter a valid token:');
  12317. if (inputToken && inputToken.length > 0) {
  12318. (0, config_1.saveGitlabToken)(inputToken);
  12319. return inputToken;
  12320. }
  12321. else {
  12322. throw new Error('token is required');
  12323. }
  12324. }
  12325. exports.getGitlabToken = getGitlabToken;
  12326.  
  12327.  
  12328. /***/ }),
  12329. /* 10 */
  12330. /***/ ((__unused_webpack_module, exports) => {
  12331.  
  12332. "use strict";
  12333.  
  12334. Object.defineProperty(exports, "__esModule", ({ value: true }));
  12335. exports.getProjectIdFromTemplateVar = exports.getScheduleIdFromUrl = exports.getScheduleIdFromGid = exports.getOptionsFromVarDescription = exports.getProjectFullPath = exports.isPipelineScheduleUrl = exports.isEditPipelineScheduleUrl = exports.getGitlabScheduleIdFromUrl = void 0;
  12336. const getGitlabScheduleIdFromUrl = (url) => {
  12337. const regex = /\/pipeline_schedules\/(\d+)/;
  12338. const match = url === null || url === void 0 ? void 0 : url.match(regex);
  12339. return (match === null || match === void 0 ? void 0 : match[1]) || '';
  12340. };
  12341. exports.getGitlabScheduleIdFromUrl = getGitlabScheduleIdFromUrl;
  12342. const isEditPipelineScheduleUrl = (url) => {
  12343. const regex = /\/pipeline_schedules\/(\d+)\/edit/;
  12344. return regex.test(url || '');
  12345. };
  12346. exports.isEditPipelineScheduleUrl = isEditPipelineScheduleUrl;
  12347. const isPipelineScheduleUrl = (url) => {
  12348. const regex = /\/pipeline_schedules$/;
  12349. return regex.test(url || '');
  12350. };
  12351. exports.isPipelineScheduleUrl = isPipelineScheduleUrl;
  12352. const getProjectFullPath = (url) => {
  12353. const regex = /\/(.*?)\/-\/pipeline_schedules/;
  12354. const match = url.match(regex);
  12355. return (match === null || match === void 0 ? void 0 : match[1]) || '';
  12356. };
  12357. exports.getProjectFullPath = getProjectFullPath;
  12358. const getOptionsFromVarDescription = (description) => {
  12359. var _a;
  12360. const regex = /^\[(.*?)\]/;
  12361. const match = description.match(regex);
  12362. return ((_a = match === null || match === void 0 ? void 0 : match[1]) === null || _a === void 0 ? void 0 : _a.split(',').map((value) => value.trim())) || [];
  12363. };
  12364. exports.getOptionsFromVarDescription = getOptionsFromVarDescription;
  12365. const getScheduleIdFromGid = (gid) => {
  12366. //gid://gitlab/Ci::PipelineSchedule/<six_digits>
  12367. const regex = /\/(\d+)$/;
  12368. const match = gid.match(regex);
  12369. return (match === null || match === void 0 ? void 0 : match[1]) || '';
  12370. };
  12371. exports.getScheduleIdFromGid = getScheduleIdFromGid;
  12372. const getScheduleIdFromUrl = (url) => {
  12373. //https://gitlab.com/<project_path>/-/pipeline_schedules/<schedule_id>/edit?id=<schedule_id>
  12374. const regex = /\/pipeline_schedules\/(\d+)/;
  12375. const match = url.match(regex);
  12376. return (match === null || match === void 0 ? void 0 : match[1]) || '';
  12377. };
  12378. exports.getScheduleIdFromUrl = getScheduleIdFromUrl;
  12379. /**
  12380. * Get project id from template variable string format '$glBranches(:project_id)'
  12381. * @param varStr sample string: '$glBranches(41703858)'
  12382. * @returns project id
  12383. */
  12384. const getProjectIdFromTemplateVar = (varStr) => {
  12385. const regex = /\$glBranches\((\d+)?\)/;
  12386. const match = varStr.match(regex);
  12387. return (match === null || match === void 0 ? void 0 : match[1]) || '';
  12388. };
  12389. exports.getProjectIdFromTemplateVar = getProjectIdFromTemplateVar;
  12390.  
  12391.  
  12392. /***/ }),
  12393. /* 11 */
  12394. /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
  12395.  
  12396. "use strict";
  12397.  
  12398. var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
  12399. if (k2 === undefined) k2 = k;
  12400. var desc = Object.getOwnPropertyDescriptor(m, k);
  12401. if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
  12402. desc = { enumerable: true, get: function() { return m[k]; } };
  12403. }
  12404. Object.defineProperty(o, k2, desc);
  12405. }) : (function(o, m, k, k2) {
  12406. if (k2 === undefined) k2 = k;
  12407. o[k2] = m[k];
  12408. }));
  12409. var __exportStar = (this && this.__exportStar) || function(m, exports) {
  12410. for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
  12411. };
  12412. Object.defineProperty(exports, "__esModule", ({ value: true }));
  12413. __exportStar(__webpack_require__(15), exports);
  12414. __exportStar(__webpack_require__(28), exports);
  12415.  
  12416.  
  12417. /***/ }),
  12418. /* 12 */
  12419. /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
  12420.  
  12421. "use strict";
  12422.  
  12423. var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
  12424. function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
  12425. return new (P || (P = Promise))(function (resolve, reject) {
  12426. function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
  12427. function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
  12428. function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
  12429. step((generator = generator.apply(thisArg, _arguments || [])).next());
  12430. });
  12431. };
  12432. var __importDefault = (this && this.__importDefault) || function (mod) {
  12433. return (mod && mod.__esModule) ? mod : { "default": mod };
  12434. };
  12435. Object.defineProperty(exports, "__esModule", ({ value: true }));
  12436. exports.DuplicateBtnComponent = void 0;
  12437. const jquery_slim_1 = __importDefault(__webpack_require__(1));
  12438. const config_1 = __webpack_require__(0);
  12439. const shared_1 = __webpack_require__(2);
  12440. function DuplicateBtnComponent(scheduleId) {
  12441. if (!scheduleId) {
  12442. return;
  12443. }
  12444. const duplicateBtnHtml = `
  12445. <a title="Duplicate" class="btn gl-button btn-default btn-icon" style="margin-right: 1em;">
  12446. <svg class="s16" data-testid="duplicate-icon">
  12447. <use href="${config_1.gitlabSvgIconUrl}#duplicate"></use>
  12448. </svg>
  12449. </a>`;
  12450. const duplicateBtnJObject = (0, jquery_slim_1.default)(duplicateBtnHtml);
  12451. // add click event to the duplicateBtn
  12452. duplicateBtnJObject.on('click', function () {
  12453. return __awaiter(this, void 0, void 0, function* () {
  12454. const glClient = shared_1.GitlabHttpClient.getInstance();
  12455. const schedule = yield glClient.getPipeLineScheduleById(scheduleId);
  12456. if (!schedule)
  12457. return;
  12458. const newSchedule = yield glClient.createPipelineSchedule({
  12459. active: schedule.active,
  12460. cron: schedule.cron,
  12461. cron_timezone: schedule.cron_timezone,
  12462. description: `${schedule.description}-copy`,
  12463. ref: schedule.ref,
  12464. variables: schedule.variables,
  12465. });
  12466. if (!!newSchedule && confirm(`Duplicated successfully! Go to the edit page?`)) {
  12467. window.location.href = `${window.location.href}/${newSchedule === null || newSchedule === void 0 ? void 0 : newSchedule.id}/edit`;
  12468. }
  12469. else {
  12470. window.location.reload();
  12471. }
  12472. });
  12473. });
  12474. return duplicateBtnJObject;
  12475. }
  12476. exports.DuplicateBtnComponent = DuplicateBtnComponent;
  12477.  
  12478.  
  12479. /***/ }),
  12480. /* 13 */
  12481. /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
  12482.  
  12483. "use strict";
  12484.  
  12485. var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
  12486. function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
  12487. return new (P || (P = Promise))(function (resolve, reject) {
  12488. function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
  12489. function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
  12490. function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
  12491. step((generator = generator.apply(thisArg, _arguments || [])).next());
  12492. });
  12493. };
  12494. var __importDefault = (this && this.__importDefault) || function (mod) {
  12495. return (mod && mod.__esModule) ? mod : { "default": mod };
  12496. };
  12497. Object.defineProperty(exports, "__esModule", ({ value: true }));
  12498. exports.DownloadEnvBtnComponent = void 0;
  12499. const jquery_slim_1 = __importDefault(__webpack_require__(1));
  12500. const config_1 = __webpack_require__(0);
  12501. const shared_1 = __webpack_require__(2);
  12502. function DownloadEnvBtnComponent(scheduleId) {
  12503. if (!scheduleId) {
  12504. return;
  12505. }
  12506. const downloadEnvBtnHtml = `<a title="Download Env File" class="btn gl-button btn-default btn-icon">
  12507. <svg class="s16" data-testid="download-icon">
  12508. <use href="${config_1.gitlabSvgIconUrl}#download"></use>
  12509. </svg>
  12510. </a>`;
  12511. const downloadEnvBtnJObject = (0, jquery_slim_1.default)(downloadEnvBtnHtml);
  12512. // add click event to the downloadEnvBtn
  12513. downloadEnvBtnJObject.on('click', () => __awaiter(this, void 0, void 0, function* () {
  12514. var _a, _b;
  12515. const glClient = shared_1.GitlabHttpClient.getInstance();
  12516. const glGraphqlClient = shared_1.GitlabGraphqlClient.getInstance();
  12517. const variables = [];
  12518. const schedule = yield glClient.getPipeLineScheduleById(scheduleId);
  12519. if (!schedule)
  12520. return;
  12521. if (config_1.includeAllVariables) {
  12522. const fullPath = (0, shared_1.getProjectFullPath)(window.location.pathname);
  12523. const ciVariables = (yield glGraphqlClient.getCiConfigVariables(fullPath, (schedule === null || schedule === void 0 ? void 0 : schedule.ref) || config_1.gitlabDefaultPipelineSchedule.ref)) || [];
  12524. // left join ciVariables and schedule.variables
  12525. const joined = (0, shared_1.leftJoin)(ciVariables, (_a = schedule === null || schedule === void 0 ? void 0 : schedule.variables) !== null && _a !== void 0 ? _a : [], 'key', (left, right) => (Object.assign(Object.assign({}, left), right)));
  12526. variables.push(...joined);
  12527. }
  12528. else {
  12529. variables.push(...((_b = schedule === null || schedule === void 0 ? void 0 : schedule.variables) !== null && _b !== void 0 ? _b : []));
  12530. }
  12531. (0, shared_1.downloadEnvFile)(variables, schedule.description);
  12532. }));
  12533. return downloadEnvBtnJObject;
  12534. }
  12535. exports.DownloadEnvBtnComponent = DownloadEnvBtnComponent;
  12536.  
  12537.  
  12538. /***/ }),
  12539. /* 14 */
  12540. /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
  12541.  
  12542. "use strict";
  12543.  
  12544. var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
  12545. function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
  12546. return new (P || (P = Promise))(function (resolve, reject) {
  12547. function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
  12548. function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
  12549. function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
  12550. step((generator = generator.apply(thisArg, _arguments || [])).next());
  12551. });
  12552. };
  12553. Object.defineProperty(exports, "__esModule", ({ value: true }));
  12554. const styles_1 = __webpack_require__(33);
  12555. const pages_1 = __webpack_require__(11);
  12556. const shared_1 = __webpack_require__(2);
  12557. const RUN_SCRIPT_AFTER_MS = 0;
  12558. const main = () => __awaiter(void 0, void 0, void 0, function* () {
  12559. const url = window.location.href;
  12560. GM_addStyle(styles_1.css);
  12561. if ((0, shared_1.isPipelineScheduleUrl)(url)) {
  12562. setTimeout(pages_1.pipelineSchedulesPage, RUN_SCRIPT_AFTER_MS);
  12563. }
  12564. else if ((0, shared_1.isEditPipelineScheduleUrl)(url)) {
  12565. setTimeout(pages_1.editPipelineSchedulePage, RUN_SCRIPT_AFTER_MS);
  12566. }
  12567. });
  12568. (() => __awaiter(void 0, void 0, void 0, function* () {
  12569. try {
  12570. main();
  12571. }
  12572. catch (error) {
  12573. console.error(error);
  12574. }
  12575. }))();
  12576.  
  12577.  
  12578. /***/ }),
  12579. /* 15 */
  12580. /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
  12581.  
  12582. "use strict";
  12583.  
  12584. var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
  12585. function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
  12586. return new (P || (P = Promise))(function (resolve, reject) {
  12587. function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
  12588. function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
  12589. function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
  12590. step((generator = generator.apply(thisArg, _arguments || [])).next());
  12591. });
  12592. };
  12593. Object.defineProperty(exports, "__esModule", ({ value: true }));
  12594. exports.pipelineSchedulesPage = void 0;
  12595. const components_1 = __webpack_require__(6);
  12596. const shared_1 = __webpack_require__(2);
  12597. const pipelineSchedulesPage = () => __awaiter(void 0, void 0, void 0, function* () {
  12598. const glGraphqlClient = shared_1.GitlabGraphqlClient.getInstance();
  12599. const fullPath = (0, shared_1.getProjectFullPath)(window.location.pathname);
  12600. const [pipeLineIds, _] = yield Promise.all([
  12601. glGraphqlClient.getPipelineScheduleIdsQuery(fullPath),
  12602. (0, shared_1.waitForElement)('tr[data-testid="pipeline-schedule-table-row"]'), // wait for the pipeline schedule table to be rendered
  12603. ]);
  12604. // find the buttons with attribute title="Play" in the btnGroup
  12605. // let playBtns = $('.tab-pane.active').find('.btn-group').find(`[title='Run pipeline schedule']`);
  12606. // if (playBtns.length === 0) {
  12607. // playBtns = $('.btn-group').find(`[title='Play']`);
  12608. // }
  12609. // find the buttons with attribute datat-testid="delete-pipeline-schedule-btn" in the btnGroup
  12610. const deleteBtns = $('.tab-pane.active')
  12611. .find('.btn-group')
  12612. .find(`[data-testid='delete-pipeline-schedule-btn']`);
  12613. for (const [index, btnItem] of Array.from(deleteBtns).entries()) {
  12614. const delBtn = $(btnItem);
  12615. // const playBtnHref = editBtn.attr('href') as string;
  12616. // const scheduleId = getGitlabScheduleIdFromUrl(playBtnHref);
  12617. const duplicateBtn = (0, components_1.DuplicateBtnComponent)(pipeLineIds[index]);
  12618. if (duplicateBtn) {
  12619. duplicateBtn.insertBefore(delBtn);
  12620. const downloadEnvFileBtn = (0, components_1.DownloadEnvBtnComponent)(pipeLineIds[index]);
  12621. if (downloadEnvFileBtn) {
  12622. downloadEnvFileBtn.insertBefore(duplicateBtn);
  12623. }
  12624. }
  12625. }
  12626. // find the button with text "New schedule"
  12627. const newScheduleBtns = $('.btn.btn-confirm:contains("New schedule")');
  12628. const newScheduleBtn = $(newScheduleBtns.get());
  12629. const quickNewScheduleBtn = (0, components_1.QuickNewScheduleBtnComponent)();
  12630. const settingsBtn = (0, components_1.GitlabToolSettingsBtnComponent)();
  12631. // create a new div btnGroup with class ml-auto, move the newScheduleBtn to the enter of the new btnGroup
  12632. const newBtnGroup = $('<div class="gl-ml-auto"></div>');
  12633. newBtnGroup.insertBefore(newScheduleBtn);
  12634. newScheduleBtn.appendTo(newBtnGroup);
  12635. if (quickNewScheduleBtn) {
  12636. quickNewScheduleBtn.insertBefore(newScheduleBtn);
  12637. settingsBtn.insertAfter(newScheduleBtn);
  12638. }
  12639. const glChooseBranchDropdown = yield (0, components_1.ChooseBranchDropdownComponent)();
  12640. glChooseBranchDropdown.insertBefore(quickNewScheduleBtn);
  12641. });
  12642. exports.pipelineSchedulesPage = pipelineSchedulesPage;
  12643.  
  12644.  
  12645. /***/ }),
  12646. /* 16 */
  12647. /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
  12648.  
  12649. "use strict";
  12650.  
  12651. var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
  12652. function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
  12653. return new (P || (P = Promise))(function (resolve, reject) {
  12654. function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
  12655. function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
  12656. function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
  12657. step((generator = generator.apply(thisArg, _arguments || [])).next());
  12658. });
  12659. };
  12660. Object.defineProperty(exports, "__esModule", ({ value: true }));
  12661. exports.GitlabGraphqlClient = void 0;
  12662. const axios_1 = __webpack_require__(4);
  12663. const config_1 = __webpack_require__(0);
  12664. const types_1 = __webpack_require__(5);
  12665. const get_gl_token_1 = __webpack_require__(9);
  12666. const gitlab_graphql_query_1 = __webpack_require__(31);
  12667. const gitlab_resource_extractor_1 = __webpack_require__(10);
  12668. const http_client_base_1 = __webpack_require__(3);
  12669. class GitlabGraphqlClient extends http_client_base_1.HttpClient {
  12670. constructor(_token) {
  12671. super(config_1.gitlabGraphqlUrl);
  12672. this._token = _token;
  12673. this.RETRIES = 5;
  12674. this._handleRequest = (config) => {
  12675. if (!!config && !!config.headers) {
  12676. config.headers['Authorization'] = `Bearer ${this._token}`;
  12677. }
  12678. return config;
  12679. };
  12680. this._handleUnauthorizedError = (error) => {
  12681. var _a;
  12682. if (((_a = error.response) === null || _a === void 0 ? void 0 : _a.status) === 401) {
  12683. this._token = (0, get_gl_token_1.getGitlabToken)();
  12684. }
  12685. };
  12686. this._initInterceptor = () => {
  12687. this.client.interceptors.request.use(this._handleRequest, this._handleError);
  12688. };
  12689. this._init();
  12690. }
  12691. static getInstance() {
  12692. if (!this.instance) {
  12693. this.instance = new GitlabGraphqlClient();
  12694. }
  12695. return this.instance;
  12696. }
  12697. getCiConfigVariables(projectUrl, ref) {
  12698. var _a, _b, _c;
  12699. return __awaiter(this, void 0, void 0, function* () {
  12700. let ciConfigVariables = [];
  12701. let retries = 0;
  12702. try {
  12703. let isBreak = false;
  12704. while (!isBreak && retries < this.RETRIES) {
  12705. const { data: glGetCiConfigVarRes } = yield this.client.post('', {
  12706. operationName: 'ciConfigVariables',
  12707. query: gitlab_graphql_query_1.getCiConfigVariablesQueryStr,
  12708. variables: {
  12709. fullPath: projectUrl,
  12710. ref,
  12711. },
  12712. });
  12713. if (((_a = glGetCiConfigVarRes === null || glGetCiConfigVarRes === void 0 ? void 0 : glGetCiConfigVarRes.project) === null || _a === void 0 ? void 0 : _a.ciConfigVariables) !== null &&
  12714. !!glGetCiConfigVarRes &&
  12715. ((_c = (_b = glGetCiConfigVarRes === null || glGetCiConfigVarRes === void 0 ? void 0 : glGetCiConfigVarRes.project) === null || _b === void 0 ? void 0 : _b.ciConfigVariables) === null || _c === void 0 ? void 0 : _c.length) != 0) {
  12716. ciConfigVariables = glGetCiConfigVarRes.project.ciConfigVariables;
  12717. isBreak = true;
  12718. }
  12719. retries++;
  12720. }
  12721. return ciConfigVariables
  12722. ? ciConfigVariables
  12723. .filter((variable) => variable.description !== null)
  12724. .map((variable) => ({
  12725. key: variable.key,
  12726. value: variable.value,
  12727. description: variable.description,
  12728. variable_type: types_1.GitlabScheduleVariableTypes.ENV_VAR,
  12729. valueOptions: variable.valueOptions,
  12730. }))
  12731. : [];
  12732. }
  12733. catch (error) {
  12734. if (error instanceof axios_1.AxiosError) {
  12735. this._handleUnauthorizedError(error);
  12736. }
  12737. }
  12738. });
  12739. }
  12740. /**
  12741. * Get Gitlab pipeline schedules by ids
  12742. * @param projectPath
  12743. * @param ids - let null to get all schedules
  12744. * @returns
  12745. */
  12746. getPipelineSchedulesQuery(projectPath, ids = null) {
  12747. return __awaiter(this, void 0, void 0, function* () {
  12748. const { data } = yield this.client.post('', {
  12749. operationName: 'getPipelineSchedulesQuery',
  12750. query: gitlab_graphql_query_1.getPipelineSchedulesQueryStr,
  12751. variables: {
  12752. ids: ids,
  12753. projectPath,
  12754. },
  12755. });
  12756. return data;
  12757. });
  12758. }
  12759. getPipelineScheduleIdsQuery(projectPath) {
  12760. var _a, _b, _c;
  12761. return __awaiter(this, void 0, void 0, function* () {
  12762. const res = yield this.getPipelineSchedulesQuery(projectPath);
  12763. return (_c = (_b = (_a = res === null || res === void 0 ? void 0 : res.project) === null || _a === void 0 ? void 0 : _a.pipelineSchedules) === null || _b === void 0 ? void 0 : _b.nodes) === null || _c === void 0 ? void 0 : _c.map((node) => {
  12764. return (0, gitlab_resource_extractor_1.getScheduleIdFromGid)(node.id);
  12765. });
  12766. });
  12767. }
  12768. updatePipelineSchedule(pipelineScheduleId, projectPath, updatedPipelineSchedule) {
  12769. var _a;
  12770. return __awaiter(this, void 0, void 0, function* () {
  12771. const updatedVariables = updatedPipelineSchedule.variables;
  12772. const crtPipelineSchedule = yield this.getPipelineSchedulesQuery(projectPath, pipelineScheduleId);
  12773. const crtPipelineScheduleVariables = (_a = crtPipelineSchedule.project.pipelineSchedules.nodes[0]) === null || _a === void 0 ? void 0 : _a.variables.nodes;
  12774. const _variables = crtPipelineScheduleVariables === null || crtPipelineScheduleVariables === void 0 ? void 0 : crtPipelineScheduleVariables.map((pipelineVariable) => {
  12775. const updatedVariable = updatedVariables.find((variable) => variable.key === pipelineVariable.key);
  12776. // check pipelineVariable is deleted by key
  12777. const isDeleted = updatedVariables.findIndex((variable) => variable.key === pipelineVariable.key) === -1;
  12778. return Object.assign(Object.assign({}, pipelineVariable), { __typename: undefined, value: (updatedVariable === null || updatedVariable === void 0 ? void 0 : updatedVariable.value) || '', destroy: isDeleted });
  12779. });
  12780. // check if there are new variables in updatedVariables by key
  12781. const newVariables = updatedVariables.filter((variable) => {
  12782. return ((crtPipelineScheduleVariables === null || crtPipelineScheduleVariables === void 0 ? void 0 : crtPipelineScheduleVariables.findIndex((pipelineVariable) => pipelineVariable.key === variable.key)) === -1);
  12783. });
  12784. const _newVariables = newVariables.map((_newVariable) => {
  12785. return {
  12786. key: _newVariable.key,
  12787. value: _newVariable.value,
  12788. variableType: 'ENV_VAR',
  12789. };
  12790. });
  12791. if (newVariables.length > 0) {
  12792. _variables === null || _variables === void 0 ? void 0 : _variables.push(..._newVariables);
  12793. }
  12794. const payload = {
  12795. operationName: 'updatePipelineSchedule',
  12796. query: gitlab_graphql_query_1.updatePipelineScheduleMutationStr,
  12797. variables: {
  12798. input: Object.assign(Object.assign({}, crtPipelineSchedule.project.pipelineSchedules.nodes[0]), { active: updatedPipelineSchedule.activate, cron: updatedPipelineSchedule.cron, cronTimezone: updatedPipelineSchedule.cronTimezone, description: updatedPipelineSchedule.description, ref: updatedPipelineSchedule.ref, variables: _variables,
  12799. // remove unused fields
  12800. __typename: undefined, editPath: undefined, forTag: undefined, lastPipeline: undefined, nextRunAt: undefined, realNextRun: undefined, refForDisplay: undefined, refPath: undefined, userPermissions: undefined, owner: undefined }),
  12801. },
  12802. };
  12803. const res = yield this.client.post('', payload);
  12804. return res;
  12805. });
  12806. }
  12807. _init() {
  12808. this._token = (0, get_gl_token_1.getTokenFromLocalStorage)();
  12809. this._initInterceptor();
  12810. }
  12811. }
  12812. exports.GitlabGraphqlClient = GitlabGraphqlClient;
  12813.  
  12814.  
  12815. /***/ }),
  12816. /* 17 */
  12817. /***/ ((__unused_webpack_module, exports) => {
  12818.  
  12819. "use strict";
  12820.  
  12821. Object.defineProperty(exports, "__esModule", ({ value: true }));
  12822. exports.CreateGitlabScheduleVariableTypes = exports.GitlabScheduleVariableTypes = void 0;
  12823. var GitlabScheduleVariableTypes;
  12824. (function (GitlabScheduleVariableTypes) {
  12825. GitlabScheduleVariableTypes["ENV_VAR"] = "Variable";
  12826. GitlabScheduleVariableTypes["FILE"] = "File";
  12827. })(GitlabScheduleVariableTypes = exports.GitlabScheduleVariableTypes || (exports.GitlabScheduleVariableTypes = {}));
  12828. var CreateGitlabScheduleVariableTypes;
  12829. (function (CreateGitlabScheduleVariableTypes) {
  12830. CreateGitlabScheduleVariableTypes["ENV_VAR"] = "env_var";
  12831. CreateGitlabScheduleVariableTypes["FILE"] = "file";
  12832. })(CreateGitlabScheduleVariableTypes = exports.CreateGitlabScheduleVariableTypes || (exports.CreateGitlabScheduleVariableTypes = {}));
  12833.  
  12834.  
  12835. /***/ }),
  12836. /* 18 */
  12837. /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
  12838.  
  12839. "use strict";
  12840.  
  12841. var __importDefault = (this && this.__importDefault) || function (mod) {
  12842. return (mod && mod.__esModule) ? mod : { "default": mod };
  12843. };
  12844. Object.defineProperty(exports, "__esModule", ({ value: true }));
  12845. exports.$ = void 0;
  12846. const jquery_slim_1 = __importDefault(__webpack_require__(1));
  12847. function $(selector) {
  12848. const htmlElements = (0, jquery_slim_1.default)(selector);
  12849. if (htmlElements.length === 0) {
  12850. console.error(`No element found for selector ${selector}`);
  12851. }
  12852. return htmlElements;
  12853. }
  12854. exports.$ = $;
  12855.  
  12856.  
  12857. /***/ }),
  12858. /* 19 */
  12859. /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
  12860.  
  12861. "use strict";
  12862.  
  12863. var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
  12864. function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
  12865. return new (P || (P = Promise))(function (resolve, reject) {
  12866. function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
  12867. function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
  12868. function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
  12869. step((generator = generator.apply(thisArg, _arguments || [])).next());
  12870. });
  12871. };
  12872. Object.defineProperty(exports, "__esModule", ({ value: true }));
  12873. exports.VarOptionStorage = void 0;
  12874. const gitlab_http_client_1 = __webpack_require__(8);
  12875. const gitlab_resource_extractor_1 = __webpack_require__(10);
  12876. class VarOptionStorage {
  12877. constructor() {
  12878. this.glHttpClient = gitlab_http_client_1.GitlabHttpClient.getInstance();
  12879. this.options = {};
  12880. }
  12881. static getInstance() {
  12882. if (!VarOptionStorage.instance) {
  12883. VarOptionStorage.instance = new VarOptionStorage();
  12884. }
  12885. return VarOptionStorage.instance;
  12886. }
  12887. // Extract the options from the variable description
  12888. setOptions(options) {
  12889. return __awaiter(this, void 0, void 0, function* () {
  12890. const promises = [];
  12891. for (const key of Object.keys(options)) {
  12892. const values = options[key];
  12893. if (!!values) {
  12894. for (let i = 0; i < values.length; i++) {
  12895. const value = values[i];
  12896. if (!!value) {
  12897. if (value.match(/\$glBranches\((\d+)?\)/)) {
  12898. const projectId = (0, gitlab_resource_extractor_1.getProjectIdFromTemplateVar)(value);
  12899. promises.push(this.glHttpClient.getProjectBranches(projectId).then((branches) => {
  12900. values.splice(i, 1, ...(branches || []));
  12901. }));
  12902. }
  12903. }
  12904. }
  12905. }
  12906. }
  12907. yield Promise.all(promises);
  12908. this.options = options;
  12909. });
  12910. }
  12911. getOptions() {
  12912. return this.options;
  12913. }
  12914. getOptionsByKey(key) {
  12915. return this.options[key] || [];
  12916. }
  12917. hasOptions() {
  12918. return Object.keys(this.options).length > 0;
  12919. }
  12920. addOption(key, value) {
  12921. var _a, _b;
  12922. if (!this.options[key]) {
  12923. this.options[key] = [];
  12924. }
  12925. if (((_a = this.options[key]) === null || _a === void 0 ? void 0 : _a.indexOf(value)) === -1) {
  12926. (_b = this.options[key]) === null || _b === void 0 ? void 0 : _b.push(value);
  12927. }
  12928. }
  12929. removeOption(key, value) {
  12930. var _a, _b;
  12931. if (!this.options[key]) {
  12932. return;
  12933. }
  12934. const index = ((_a = this.options[key]) === null || _a === void 0 ? void 0 : _a.indexOf(value)) || -1;
  12935. if (index !== -1) {
  12936. (_b = this.options[key]) === null || _b === void 0 ? void 0 : _b.splice(index, 1);
  12937. }
  12938. }
  12939. }
  12940. exports.VarOptionStorage = VarOptionStorage;
  12941.  
  12942.  
  12943. /***/ }),
  12944. /* 20 */
  12945. /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
  12946.  
  12947. "use strict";
  12948.  
  12949. var __importDefault = (this && this.__importDefault) || function (mod) {
  12950. return (mod && mod.__esModule) ? mod : { "default": mod };
  12951. };
  12952. Object.defineProperty(exports, "__esModule", ({ value: true }));
  12953. exports.QuickNewScheduleBtnComponent = void 0;
  12954. const jquery_slim_1 = __importDefault(__webpack_require__(1));
  12955. function QuickNewScheduleBtnComponent() {
  12956. const quickNewScheduleBtnHtml = `
  12957. <a class="btn gl-button btn-success mr-2">
  12958. <span>Quick new schedule</span>
  12959. </a>`;
  12960. const quickNewScheduleBtnJObject = (0, jquery_slim_1.default)(quickNewScheduleBtnHtml);
  12961. quickNewScheduleBtnJObject.on('click', function () {
  12962. (0, jquery_slim_1.default)(`#gs-dropdown-choose-branch`).toggle();
  12963. });
  12964. return quickNewScheduleBtnJObject;
  12965. }
  12966. exports.QuickNewScheduleBtnComponent = QuickNewScheduleBtnComponent;
  12967.  
  12968.  
  12969. /***/ }),
  12970. /* 21 */
  12971. /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
  12972.  
  12973. "use strict";
  12974.  
  12975. var __importDefault = (this && this.__importDefault) || function (mod) {
  12976. return (mod && mod.__esModule) ? mod : { "default": mod };
  12977. };
  12978. Object.defineProperty(exports, "__esModule", ({ value: true }));
  12979. exports.GitlabCheckboxComponent = void 0;
  12980. const jquery_slim_1 = __importDefault(__webpack_require__(1));
  12981. function GitlabCheckboxComponent(label, controlLabel, className, checked = true, checkboxId) {
  12982. const _checkboxId = checkboxId !== null && checkboxId !== void 0 ? checkboxId : label.replaceAll(' ', '') + '_checkbox';
  12983. const checkboxComponentHtml = `
  12984. <div class="${className !== null && className !== void 0 ? className : 'col-md-2'}">
  12985. <label class="label-bold" for="${_checkboxId}">${label}</label>
  12986. <div>
  12987. <div class="gl-form-checkbox custom-control custom-checkbox">
  12988. <input class="custom-control-input" type="checkbox" id="${_checkboxId}" ${checked ? 'checked' : ''}>
  12989. <label class="custom-control-label" for="${_checkboxId}"><span>${controlLabel}</span></label>
  12990. </div>
  12991. </div>
  12992. </div>
  12993. `;
  12994. return (0, jquery_slim_1.default)(checkboxComponentHtml);
  12995. }
  12996. exports.GitlabCheckboxComponent = GitlabCheckboxComponent;
  12997.  
  12998.  
  12999. /***/ }),
  13000. /* 22 */
  13001. /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
  13002.  
  13003. "use strict";
  13004.  
  13005. var __importDefault = (this && this.__importDefault) || function (mod) {
  13006. return (mod && mod.__esModule) ? mod : { "default": mod };
  13007. };
  13008. Object.defineProperty(exports, "__esModule", ({ value: true }));
  13009. exports.GitlabDropdownComponent = void 0;
  13010. const jquery_slim_1 = __importDefault(__webpack_require__(1));
  13011. const config_1 = __webpack_require__(0);
  13012. function GitlabDropdownComponent(dropdownName, dropdownTitle, dropdownItems) {
  13013. // Dropdown
  13014. const glDropdownHtml = `
  13015. <div class="dropdown b-dropdown gl-dropdown undefined btn-group" id="gs-dropdown-${dropdownName}">
  13016. </div>`;
  13017. const glDropdownJObject = (0, jquery_slim_1.default)(glDropdownHtml);
  13018. glDropdownJObject.hide();
  13019. // Dropdown toggle button
  13020. const glDropdownToggleBtnHtml = `
  13021. <button aria-haspopup="true" aria-expanded="false" type="button" class="btn dropdown-toggle btn-default btn-md gl-button gl-dropdown-toggle">
  13022. <span class="gl-dropdown-button-text">${dropdownTitle}</span>
  13023. <svg data-testid="chevron-down-icon" role="img" aria-hidden="true" class="gl-button-icon dropdown-chevron gl-icon s16">
  13024. <use href="${config_1.gitlabSvgIconUrl}#chevron-down"></use>
  13025. </svg>
  13026. </button>`;
  13027. const glDropdownToggleBtnJObject = (0, jquery_slim_1.default)(glDropdownToggleBtnHtml);
  13028. glDropdownJObject.on('click', () => {
  13029. (0, jquery_slim_1.default)(`#gs-dropdown-${dropdownName}`).toggleClass('show');
  13030. });
  13031. glDropdownJObject.append(glDropdownToggleBtnJObject);
  13032. // Dropdown menu
  13033. const glDropdownMenuHtml = `
  13034. <ul role="menu" tabindex="-1" class="dropdown-menu" aria-labelledby="" style="">
  13035. <div class="gl-dropdown-inner">
  13036. <div class="gl-dropdown-contents" id="gs-dropdown-contents-${dropdownName}">
  13037. </div>
  13038. </div>
  13039. </ul>`;
  13040. const glDropdownMenuJObject = (0, jquery_slim_1.default)(glDropdownMenuHtml);
  13041. glDropdownJObject.append(glDropdownMenuJObject);
  13042. // Dropdown menu items
  13043. const addItemsToDropdown = (items) => {
  13044. for (const item of items) {
  13045. const glDropdownMenuItemHtml = `
  13046. <li role="presentation" class="gl-dropdown-item">
  13047. <button role="menuitem" type="button" class="dropdown-item">
  13048. <div class="gl-dropdown-item-text-wrapper">
  13049. <p class="gl-dropdown-item-text-primary">${item.text}</p>
  13050. </div>
  13051. </button>
  13052. </li>`;
  13053. const glDropdownMenuItemJObject = (0, jquery_slim_1.default)(glDropdownMenuItemHtml);
  13054. glDropdownMenuItemJObject.on('click', item.fn);
  13055. glDropdownMenuJObject
  13056. .find(`#gs-dropdown-contents-${dropdownName}`)
  13057. .append(glDropdownMenuItemJObject);
  13058. }
  13059. };
  13060. if (dropdownItems instanceof Promise) {
  13061. dropdownItems.then((items) => {
  13062. addItemsToDropdown(items);
  13063. return items;
  13064. });
  13065. }
  13066. else {
  13067. addItemsToDropdown(dropdownItems);
  13068. }
  13069. // remove class 'show' when clicking outside of dropdown
  13070. (0, jquery_slim_1.default)(document).on('click', (e) => {
  13071. if (!(0, jquery_slim_1.default)(e.target).closest(glDropdownJObject).length) {
  13072. glDropdownJObject.removeClass('show');
  13073. }
  13074. });
  13075. return glDropdownJObject;
  13076. }
  13077. exports.GitlabDropdownComponent = GitlabDropdownComponent;
  13078.  
  13079.  
  13080. /***/ }),
  13081. /* 23 */
  13082. /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
  13083.  
  13084. "use strict";
  13085.  
  13086. var __importDefault = (this && this.__importDefault) || function (mod) {
  13087. return (mod && mod.__esModule) ? mod : { "default": mod };
  13088. };
  13089. Object.defineProperty(exports, "__esModule", ({ value: true }));
  13090. exports.GitlabRemoveVariableRowComponent = void 0;
  13091. const jquery_slim_1 = __importDefault(__webpack_require__(1));
  13092. const config_1 = __webpack_require__(0);
  13093. function GitlabRemoveVariableRowComponent() {
  13094. const removeBtnHtml = `
  13095. <button data-testid="remove-ci-variable-row" aria-label="Remove variable" type="button" class="btn gl-md-ml-3 gl-mb-3 custom-remove-variable-btn btn-danger btn-md gl-button btn-danger-secondary btn-icon">
  13096. <svg data-testid="clear-icon" role="img" aria-hidden="true" class="gl-button-icon gl-icon s16">
  13097. <use href="${config_1.gitlabSvgIconUrl}#clear">
  13098. </use>
  13099. </svg>
  13100. </button>`;
  13101. return (0, jquery_slim_1.default)(removeBtnHtml);
  13102. }
  13103. exports.GitlabRemoveVariableRowComponent = GitlabRemoveVariableRowComponent;
  13104.  
  13105.  
  13106. /***/ }),
  13107. /* 24 */
  13108. /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
  13109.  
  13110. "use strict";
  13111.  
  13112. var __importDefault = (this && this.__importDefault) || function (mod) {
  13113. return (mod && mod.__esModule) ? mod : { "default": mod };
  13114. };
  13115. Object.defineProperty(exports, "__esModule", ({ value: true }));
  13116. exports.GitlabSelectionComponent = void 0;
  13117. const jquery_slim_1 = __importDefault(__webpack_require__(1));
  13118. function GitlabSelectionComponent(options, selectedValue, data_testId, data_qaSelector, action) {
  13119. const gitlabSelectionHtml = `
  13120. <select class="js-ci-variable-input-variable-type form-control select-control custom-select table-section" data-testid=${data_testId} data-qa-selector=${data_qaSelector}>
  13121. ${options.map((option) => {
  13122. return `<option ${option === selectedValue ? 'selected="selected"' : ''} value="${option}">${option}</option>`;
  13123. })}
  13124. </select>`;
  13125. const gitlabSelectionJObject = (0, jquery_slim_1.default)(gitlabSelectionHtml);
  13126. gitlabSelectionJObject.change(function () {
  13127. action((0, jquery_slim_1.default)(this).val());
  13128. });
  13129. return gitlabSelectionJObject;
  13130. }
  13131. exports.GitlabSelectionComponent = GitlabSelectionComponent;
  13132.  
  13133.  
  13134. /***/ }),
  13135. /* 25 */
  13136. /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
  13137.  
  13138. "use strict";
  13139.  
  13140. var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
  13141. function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
  13142. return new (P || (P = Promise))(function (resolve, reject) {
  13143. function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
  13144. function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
  13145. function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
  13146. step((generator = generator.apply(thisArg, _arguments || [])).next());
  13147. });
  13148. };
  13149. Object.defineProperty(exports, "__esModule", ({ value: true }));
  13150. exports.ChooseBranchDropdownComponent = void 0;
  13151. const config_1 = __webpack_require__(0);
  13152. const shared_1 = __webpack_require__(2);
  13153. const shared_components_1 = __webpack_require__(7);
  13154. function ChooseBranchDropdownComponent() {
  13155. return __awaiter(this, void 0, void 0, function* () {
  13156. const glClient = shared_1.GitlabHttpClient.getInstance();
  13157. const glGraphqlClient = shared_1.GitlabGraphqlClient.getInstance();
  13158. const branches = yield glClient.getProjectBranches();
  13159. const dropdownItems = branches === null || branches === void 0 ? void 0 : branches.map((branchName) => ({
  13160. text: branchName,
  13161. fn: () => __awaiter(this, void 0, void 0, function* () {
  13162. const fullPath = (0, shared_1.getProjectFullPath)(window.location.pathname);
  13163. if (fullPath) {
  13164. const vars = yield glGraphqlClient.getCiConfigVariables(fullPath, `refs/heads/${branchName}`);
  13165. if (!vars)
  13166. return;
  13167. const newPipelineSchedule = yield glClient.createPipelineSchedule(Object.assign(Object.assign({}, config_1.gitlabDefaultPipelineSchedule), { ref: branchName }));
  13168. yield Promise.all(vars.map((_var) => glClient.createPipelineScheduleVariable(newPipelineSchedule === null || newPipelineSchedule === void 0 ? void 0 : newPipelineSchedule.id, _var)));
  13169. if (!!newPipelineSchedule && confirm(`Create schedule success! Go to the edit page?`)) {
  13170. window.location.href = `${window.location.href}/${newPipelineSchedule === null || newPipelineSchedule === void 0 ? void 0 : newPipelineSchedule.id}/edit`;
  13171. }
  13172. else {
  13173. window.location.reload();
  13174. }
  13175. }
  13176. }),
  13177. }));
  13178. return (0, shared_components_1.GitlabDropdownComponent)('choose-branch', 'Copy vars from branch', dropdownItems || [{ text: 'No branches found', fn: () => { } }]);
  13179. });
  13180. }
  13181. exports.ChooseBranchDropdownComponent = ChooseBranchDropdownComponent;
  13182.  
  13183.  
  13184. /***/ }),
  13185. /* 26 */
  13186. /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
  13187.  
  13188. "use strict";
  13189.  
  13190. var __importDefault = (this && this.__importDefault) || function (mod) {
  13191. return (mod && mod.__esModule) ? mod : { "default": mod };
  13192. };
  13193. Object.defineProperty(exports, "__esModule", ({ value: true }));
  13194. exports.GitlabToolSettingsBtnComponent = void 0;
  13195. const jquery_slim_1 = __importDefault(__webpack_require__(1));
  13196. const config_1 = __webpack_require__(0);
  13197. const gl_settings_modal_component_1 = __webpack_require__(27);
  13198. let glToolsSettingsModalOpenedState = false;
  13199. function GitlabToolSettingsBtnComponent() {
  13200. const glToolSettingsBtnHtml = `
  13201. <a class="btn gl-button btn-default ml-2">
  13202. <svg class="s16" data-testid="settings-icon">
  13203. <use href="${config_1.gitlabSvgIconUrl}#settings"></use>
  13204. </svg>
  13205. <span>Schedule Settings</span>
  13206. </a>`;
  13207. const glToolSettingsBtn = (0, jquery_slim_1.default)(glToolSettingsBtnHtml);
  13208. const addModal = () => {
  13209. const modalJObject = (0, gl_settings_modal_component_1.GitlabToolSettingsModalComponent)((eventType, payload) => {
  13210. switch (eventType) {
  13211. case 'close':
  13212. case 'cancel':
  13213. modalJObject.remove();
  13214. break;
  13215. case 'okay':
  13216. const [gitlabToken, gitlabToolSettings] = payload;
  13217. (0, config_1.saveGitlabToken)(gitlabToken);
  13218. (0, config_1.saveGitlabToolSettings)(gitlabToolSettings);
  13219. modalJObject.remove();
  13220. // reload page
  13221. window.location.reload();
  13222. break;
  13223. default:
  13224. modalJObject.remove();
  13225. break;
  13226. }
  13227. });
  13228. (0, jquery_slim_1.default)('body').append(modalJObject);
  13229. (0, jquery_slim_1.default)('body').addClass('modal-open');
  13230. };
  13231. const removeModal = () => {
  13232. (0, jquery_slim_1.default)('.modal').remove();
  13233. (0, jquery_slim_1.default)('body').removeClass('modal-open');
  13234. glToolsSettingsModalOpenedState = false;
  13235. };
  13236. const toggleModal = () => {
  13237. if (glToolsSettingsModalOpenedState) {
  13238. removeModal();
  13239. }
  13240. else {
  13241. addModal();
  13242. }
  13243. };
  13244. glToolSettingsBtn.on('click', toggleModal);
  13245. return glToolSettingsBtn;
  13246. }
  13247. exports.GitlabToolSettingsBtnComponent = GitlabToolSettingsBtnComponent;
  13248.  
  13249.  
  13250. /***/ }),
  13251. /* 27 */
  13252. /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
  13253.  
  13254. "use strict";
  13255.  
  13256. var __importDefault = (this && this.__importDefault) || function (mod) {
  13257. return (mod && mod.__esModule) ? mod : { "default": mod };
  13258. };
  13259. Object.defineProperty(exports, "__esModule", ({ value: true }));
  13260. exports.GitlabToolSettingsModalComponent = void 0;
  13261. const jquery_slim_1 = __importDefault(__webpack_require__(1));
  13262. const config_1 = __webpack_require__(0);
  13263. const shared_1 = __webpack_require__(2);
  13264. function GitlabToolSettingsModalComponent(cbEvent) {
  13265. const modalHtml = `<div style="position: absolute; z-index: 1040;">
  13266. <div role="dialog" aria-label="Gitlab Tool Settings" class="modal show gl-modal" aria-modal="true"
  13267. style="display: flex;">
  13268. <div class="modal-dialog modal-md modal-dialog-scrollable">
  13269. <span tabindex="0" />
  13270. <div tabindex="-1" class="modal-content">
  13271. <header class="modal-header">
  13272. <h4 class="modal-title">Gitlab Tool Settings</h4>
  13273. <button aria-label="Close" type="button"
  13274. class="btn btn-default btn-sm gl-button btn-default-tertiary btn-icon js-modal-action-close">
  13275. <svg data-testid="close-icon" role="img" aria-hidden="true" class="gl-button-icon gl-icon s16">
  13276. <use href="${config_1.gitlabSvgIconUrl}#close" />
  13277. </svg>
  13278. </button>
  13279. </header>
  13280. <div class="modal-body" style="height: 60vh;">
  13281. <form class="">
  13282. <div class="separator" style="margin-top:0;">Gitlab API Settings</div>
  13283. <div role="group" class="form-group gl-form-group">
  13284. <label for="input-1" class="d-block col-form-label">Gitlab token:</label>
  13285. <div>
  13286. <div role="group" class="input-group">
  13287. <div class="input-group-prepend">
  13288. <div class="input-group-text">Token</div>
  13289. </div>
  13290. <input id="i-gitlab-token" type="password" class="form-control gl-form-input" aria-label="">
  13291. </div>
  13292. <div class="gl-alert gl-alert-warning mt-1">
  13293. <svg data-testid="warning-icon" role="img" aria-hidden="true" class="gl-icon s16 gl-alert-icon">
  13294. <use href="${config_1.gitlabSvgIconUrl}#warning"></use>
  13295. </svg>
  13296. <div role="alert" aria-live="assertive" class="gl-alert-content">
  13297. <h2 class="gl-alert-title">Warning</h2>
  13298. <div class="gl-alert-body"> Do not share your token with anyone. <br> Access to the \`api\` with
  13299. read/write permission is mandatory for the token!!! </div>
  13300. </div>
  13301. </div>
  13302. <span class="form-text text-gl-muted">Don't have a token? <a
  13303. href="https://gitlab.com/-/profile/personal_access_tokens" target="_blank">Create one</a>
  13304. </span>
  13305. </div>
  13306. <div role="group" class="form-group gl-form-group mt-1">
  13307. <label for="i-gitlab-rest-per-page" class="d-block col-form-label"> Number of items per page: </label>
  13308. <div>
  13309. <input id="i-gitlab-rest-per-page" type="number" placeholder="50" required="required"
  13310. aria-required="true" class="gl-form-input form-control">
  13311. </div>
  13312. </div>
  13313. </div>
  13314. <div class="separator">Download ENV vars file Settings</div>
  13315. <div role="group" class="form-group gl-form-group">
  13316. <label for="i-wrap-var-value" class="d-block col-form-label"> Wrap the variable value with: </label>
  13317. <div>
  13318. <select id="i-wrap-the-variable-value-with" required="required" aria-required="true"
  13319. class="gl-form-select custom-select">
  13320. <option value="none">None</option>
  13321. <option value="single_quotation_mark">Single quotation mark <b>'</b>
  13322. </option>
  13323. <option value="double_quotation_mark">Double quotation mark <b>"</b>
  13324. </option>
  13325. </select>
  13326. </div>
  13327. <small class="form-text text-gl-muted">Wrap the variable value in the ENV vars download file. Example:
  13328. <span style="color: dimgray;">VAR_X='abc'</span> or <span style="color: dimgray;">VAR_X="abc"</span>,
  13329. etc. </small>
  13330. </div>
  13331. <div role="group" class="form-group gl-form-group mb-1"
  13332. title="Including variables defined in .gitlab-ci.yml. See: https://docs.gitlab.com/ee/api/graphql/reference/#ciconfigvariable">
  13333. <div class="gl-form-checkbox custom-control custom-checkbox">
  13334. <input id="i-include-all-variables" type="checkbox" name="checkboxes-4" class="custom-control-input"
  13335. value="squash">
  13336. <label for="i-include-all-variables" class="custom-control-label">Include all variables </label>
  13337. </div>
  13338. </div>
  13339. <div role="group" class="form-group gl-form-group mb-1">
  13340. <div class="gl-form-checkbox custom-control custom-checkbox">
  13341. <input id="i-replace-enter-with-n" type="checkbox" name="checkboxes-8" class="custom-control-input"
  13342. value="squash">
  13343. <label for="i-replace-enter-with-n" class="custom-control-label">Replace enter with <code>\\n</code>
  13344. </label>
  13345. </div>
  13346. </div>
  13347. <div class="separator">Schedule page Settings</div>
  13348. <div role="group" class="form-group gl-form-group">
  13349. <label for="i-wrap-var-value" class="d-block col-form-label"
  13350. title="Choose to take options from variable description or from Gitlab variable options (defined in .gitlab-ci.yml) or both.">
  13351. Get the options from: </label>
  13352. <div>
  13353. <select id="i-get-the-options-from" required="required" aria-required="true"
  13354. class="gl-form-select custom-select">
  13355. <option value="var_description">Variable description</option>
  13356. <option value="gitlab_variable_options"
  13357. title="See: https://docs.gitlab.com/ee/ci/yaml/#variablesoptions">Gitlab variable options</option>
  13358. <option value="merge_both">Combine both</option>
  13359. </select>
  13360. </div>
  13361. <small class="form-text text-gl-muted">Choose to take options from variable description or from Gitlab variable options (defined in .gitlab-ci.yml, see: <a
  13362. href="https://docs.gitlab.com/ee/ci/yaml/#variablesoptions" target="_blank">Gitlab variable options</a>) or both.
  13363. </small>
  13364. </div>
  13365. <div role="group" class="form-group gl-form-group mb-1">
  13366. <div class="gl-form-checkbox custom-control custom-checkbox">
  13367. <input id="i-schedule-page-auto-show-dropdown" type="checkbox" name="checkboxes-5"
  13368. class="custom-control-input" disabled checked="checked">
  13369. <label for="i-schedule-page-auto-show-dropdown" class="custom-control-label">Auto show dropdown(s)
  13370. </label>
  13371. </div>
  13372. </div>
  13373. <div role="group" class="form-group gl-form-group mb-1">
  13374. <div class="gl-form-checkbox custom-control custom-checkbox">
  13375. <input id="i-enable-markdown-var-description" type="checkbox" name="checkboxes-6"
  13376. class="custom-control-input" disabled checked="checked">
  13377. <label for="i-enable-markdown-var-description" class="custom-control-label">Enable markdown variable
  13378. description
  13379. </label>
  13380. </div>
  13381. </div>
  13382. <div role="group" class="form-group gl-form-group mb-1">
  13383. <div class="gl-form-checkbox custom-control custom-checkbox">
  13384. <input id="i-sort-var-by-name" type="checkbox" name="checkboxes-7" class="custom-control-input"
  13385. disabled checked="unchecked">
  13386. <label for="i-sort-var-by-name" class="custom-control-label">Sort variables by name (A-Z)
  13387. </label>
  13388. </div>
  13389. </div>
  13390. <div class="separator">Default new Schedule Settings</div>
  13391. <div role="group" class="form-group gl-form-group">
  13392. <label for="i-default-schedule-description" class="d-block col-form-label"> Description: </label>
  13393. <div>
  13394. <input id="i-default-schedule-description" type="text" placeholder="default schedule description"
  13395. required="required" aria-required="true" class="gl-form-input form-control">
  13396. </div>
  13397. </div>
  13398. <div role="group" class="form-group gl-form-group">
  13399. <label for="i-default-schedule-interval-pattern" class="d-block col-form-label"> Interval pattern:
  13400. </label>
  13401. <div>
  13402. <input id="i-default-schedule-interval-pattern" type="text" placeholder="0 15 * * *" required="required"
  13403. aria-required="true" class="gl-form-input form-control">
  13404. </div>
  13405. </div>
  13406. <div role="group" class="form-group gl-form-group">
  13407. <label for="i-default-schedule-cron-timezone" class="d-block col-form-label"> Cron timezone: </label>
  13408. <div>
  13409. <input id="i-default-schedule-cron-timezone" type="text" placeholder="UTC" required="required"
  13410. aria-required="true" class="gl-form-input form-control">
  13411. </div>
  13412. </div>
  13413. <div role="group" class="form-group gl-form-group">
  13414. <label for="i-default-schedule-target-branch" class="d-block col-form-label"> Target branch: </label>
  13415. <div>
  13416. <input id="i-default-schedule-target-branch" type="text" placeholder="main" required="required"
  13417. aria-required="true" class="gl-form-input form-control">
  13418. </div>
  13419. </div>
  13420. <div role="group" class="form-group gl-form-group">
  13421. <div class="gl-form-checkbox custom-control custom-checkbox">
  13422. <input id="i-default-schedule-active-by-default" type="checkbox" name="checkboxes-4"
  13423. class="custom-control-input" value="squash">
  13424. <label for="i-default-schedule-active-by-default" class="custom-control-label">Active by default
  13425. </label>
  13426. </div>
  13427. </div>
  13428. </form>
  13429. </div>
  13430. <footer class="modal-footer">
  13431. <button type="button" class="btn js-modal-action-cancel btn-default btn-md gl-button">
  13432. <span class="gl-button-text">Cancel</span>
  13433. </button>
  13434. <button type="button"
  13435. class="btn js-modal-action-secondary btn-confirm btn-md gl-button btn-confirm-secondary">
  13436. <span class="gl-button-text">Discard Changes</span>
  13437. </button>
  13438. <button type="button" class="btn js-modal-action-primary btn-confirm btn-md gl-button">
  13439. <span class="gl-button-text">Okay</span>
  13440. </button>
  13441. </footer>
  13442. </div>
  13443. <span tabindex="0" />
  13444. </div>
  13445. </div>
  13446. <div class="modal-backdrop" />
  13447. </div>
  13448. `;
  13449. const modalJObject = (0, jquery_slim_1.default)(modalHtml);
  13450. // Inject the values to the modal
  13451. const updateData = () => {
  13452. // Gitlab token
  13453. modalJObject.find('#i-gitlab-token').val(config_1.gitlabToken);
  13454. modalJObject.find('#i-gitlab-rest-per-page').val(config_1.gitlabRestPerPage);
  13455. // wrap the variable value with
  13456. switch (config_1.wrappedVarBy) {
  13457. case '':
  13458. modalJObject.find('select#i-wrap-the-variable-value-with').val('none');
  13459. break;
  13460. case "'":
  13461. modalJObject.find('select#i-wrap-the-variable-value-with').val('single_quotation_mark');
  13462. break;
  13463. case '"':
  13464. modalJObject.find('select#i-wrap-the-variable-value-with').val('double_quotation_mark');
  13465. break;
  13466. default:
  13467. modalJObject.find('select#i-wrap-the-variable-value-with').val('none');
  13468. break;
  13469. }
  13470. modalJObject.find('#i-include-all-variables').prop('checked', config_1.includeAllVariables);
  13471. modalJObject.find('#i-get-the-options-from').val(config_1.getTheOptionsFrom);
  13472. modalJObject.find('#i-schedule-page-auto-show-dropdown').prop('checked', config_1.autoShowDropDown);
  13473. modalJObject
  13474. .find('#i-enable-markdown-var-description')
  13475. .prop('checked', config_1.enableMarkdownVarDescription);
  13476. modalJObject.find('#i-sort-var-by-name').prop('checked', config_1.sortVarByName);
  13477. modalJObject.find('#i-replace-enter-with-n').prop('checked', config_1.replaceEnterWithN);
  13478. const { active, cron, description, cron_timezone, ref } = config_1.gitlabDefaultPipelineSchedule;
  13479. modalJObject.find('#i-default-schedule-description').val(description);
  13480. modalJObject.find('#i-default-schedule-interval-pattern').val(cron);
  13481. modalJObject.find('#i-default-schedule-cron-timezone').val(cron_timezone);
  13482. modalJObject.find('#i-default-schedule-target-branch').val(ref);
  13483. modalJObject.find('#i-default-schedule-active-by-default').prop('checked', active);
  13484. modalJObject.find('#i-include-all-variables').prop('checked', config_1.includeAllVariables);
  13485. };
  13486. updateData();
  13487. // Get the values from the modal
  13488. const getValues = () => {
  13489. var _a, _b, _c, _d, _e, _f;
  13490. const gitlabToken = ((_a = modalJObject.find('#i-gitlab-token').val()) === null || _a === void 0 ? void 0 : _a.toString()) || '';
  13491. const gitlabRestPerPage = parseInt(((_b = modalJObject.find('#i-gitlab-rest-per-page').val()) === null || _b === void 0 ? void 0 : _b.toString()) || '50');
  13492. const wrappedVarByOption = modalJObject.find('select#i-wrap-the-variable-value-with').val();
  13493. let wrappedVarBy = '';
  13494. switch (wrappedVarByOption) {
  13495. case 'none':
  13496. wrappedVarBy = '';
  13497. break;
  13498. case 'single_quotation_mark':
  13499. wrappedVarBy = "'";
  13500. break;
  13501. case 'double_quotation_mark':
  13502. wrappedVarBy = '"';
  13503. break;
  13504. default:
  13505. wrappedVarBy = '';
  13506. break;
  13507. }
  13508. const getTheOptionsFromOption = modalJObject.find('select#i-get-the-options-from').val();
  13509. let getTheOptionsFrom = shared_1.GetTheOptionsFrom.VAR_DESCRIPTION;
  13510. switch (getTheOptionsFromOption) {
  13511. case 'var_description':
  13512. getTheOptionsFrom = shared_1.GetTheOptionsFrom.VAR_DESCRIPTION;
  13513. break;
  13514. case 'gitlab_variable_options':
  13515. getTheOptionsFrom = shared_1.GetTheOptionsFrom.GITLAB_VARIABLE_OPTIONS;
  13516. break;
  13517. case 'merge_both':
  13518. getTheOptionsFrom = shared_1.GetTheOptionsFrom.MERGE_BOTH;
  13519. break;
  13520. default:
  13521. getTheOptionsFrom = shared_1.GetTheOptionsFrom.VAR_DESCRIPTION;
  13522. break;
  13523. }
  13524. const autoShowDropDown = modalJObject
  13525. .find('#i-schedule-page-auto-show-dropdown')
  13526. .prop('checked');
  13527. const enableMarkdownVarDescription = modalJObject
  13528. .find('#i-enable-markdown-var-description')
  13529. .prop('checked');
  13530. const sortVarByName = modalJObject.find('#i-sort-var-by-name').prop('checked');
  13531. const includeAllVariables = modalJObject.find('#i-include-all-variables').prop('checked');
  13532. const replaceEnterWithN = modalJObject.find('#i-replace-enter-with-n').prop('checked');
  13533. const gitlabDefaultPipelineSchedule = {
  13534. active: modalJObject.find('#i-default-schedule-active-by-default').prop('checked'),
  13535. cron: ((_c = modalJObject.find('#i-default-schedule-interval-pattern').val()) === null || _c === void 0 ? void 0 : _c.toString()) || '0 15 * * *',
  13536. description: ((_d = modalJObject.find('#i-default-schedule-description').val()) === null || _d === void 0 ? void 0 : _d.toString()) ||
  13537. 'Default schedule',
  13538. cron_timezone: ((_e = modalJObject.find('#i-default-schedule-cron-timezone').val()) === null || _e === void 0 ? void 0 : _e.toString()) || 'UTC',
  13539. ref: ((_f = modalJObject.find('#i-default-schedule-target-branch').val()) === null || _f === void 0 ? void 0 : _f.toString()) || 'main',
  13540. };
  13541. return [
  13542. gitlabToken,
  13543. {
  13544. gitlabRestPerPage,
  13545. wrappedVarBy,
  13546. includeAllVariables,
  13547. gitlabDefaultPipelineSchedule,
  13548. getTheOptionsFrom,
  13549. autoShowDropDown,
  13550. enableMarkdownVarDescription,
  13551. sortVarByName,
  13552. replaceEnterWithN,
  13553. },
  13554. ];
  13555. };
  13556. modalJObject.find('.js-modal-action-cancel').on('click', function () {
  13557. cbEvent('cancel', null);
  13558. });
  13559. modalJObject.find('.js-modal-action-secondary').on('click', function () {
  13560. updateData();
  13561. });
  13562. modalJObject.find('.js-modal-action-primary').on('click', function () {
  13563. cbEvent('okay', getValues());
  13564. });
  13565. modalJObject.find('.js-modal-action-close').on('click', function () {
  13566. cbEvent('close', null);
  13567. });
  13568. // outside click
  13569. modalJObject.find('.modal').on('click', function (e) {
  13570. if (e.target === this) {
  13571. cbEvent('discard', null);
  13572. }
  13573. });
  13574. return modalJObject;
  13575. }
  13576. exports.GitlabToolSettingsModalComponent = GitlabToolSettingsModalComponent;
  13577.  
  13578.  
  13579. /***/ }),
  13580. /* 28 */
  13581. /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
  13582.  
  13583. "use strict";
  13584.  
  13585. var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
  13586. function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
  13587. return new (P || (P = Promise))(function (resolve, reject) {
  13588. function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
  13589. function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
  13590. function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
  13591. step((generator = generator.apply(thisArg, _arguments || [])).next());
  13592. });
  13593. };
  13594. Object.defineProperty(exports, "__esModule", ({ value: true }));
  13595. exports.editPipelineSchedulePage = void 0;
  13596. const components_1 = __webpack_require__(6);
  13597. const config_1 = __webpack_require__(0);
  13598. const shared_1 = __webpack_require__(2);
  13599. const getPersistedVariables = () => {
  13600. let persistedVariables = (0, shared_1.$)('div[data-qa-selector="ci_variable_row_container"]');
  13601. if (persistedVariables.length === 0) {
  13602. console.error('[GitLab Duplicator]-persistedVariables is empty');
  13603. }
  13604. else {
  13605. // remove last persistedVariables item from array
  13606. persistedVariables = Array.from(persistedVariables).slice(0, -1);
  13607. }
  13608. return persistedVariables;
  13609. };
  13610. const editPipelineSchedulePage = () => __awaiter(void 0, void 0, void 0, function* () {
  13611. var _a, _b, _c;
  13612. const isShowDropdown = true;
  13613. const varOptionStorage = shared_1.VarOptionStorage.getInstance();
  13614. const glGraphqlClient = shared_1.GitlabGraphqlClient.getInstance();
  13615. // wait for the page to be rendered
  13616. yield Promise.all([
  13617. (0, shared_1.waitForElement)('div[data-qa-selector="ci_variable_row_container"]'),
  13618. (0, shared_1.waitForElement)('button[data-testid="variable-security-btn"'),
  13619. (0, shared_1.waitForElement)('button[data-testid="schedule-submit-button"'),
  13620. (0, shared_1.waitForElement)('div[id="schedule-target-branch-tag"]'),
  13621. ]);
  13622. const revealValuesBtn = (0, shared_1.$)('button[data-testid="variable-security-btn"');
  13623. // $('.ci-variable-row-remove-button').css({ 'margin-left': '3rem' });
  13624. const editPipelineScheduleBtn = (0, shared_1.$)('button[data-testid="schedule-submit-button"');
  13625. editPipelineScheduleBtn.hide();
  13626. const newEditPipelineScheduleBtn = (0, shared_1.$)('<button type="button" class="btn btn-confirm btn-md gl-button">Edit pipeline schedule</button>');
  13627. newEditPipelineScheduleBtn.insertAfter(editPipelineScheduleBtn);
  13628. const currentBranch = (0, shared_1.$)('div[id="schedule-target-branch-tag"]')
  13629. .find('button')
  13630. .first()
  13631. .text()
  13632. .trim();
  13633. if (revealValuesBtn) {
  13634. revealValuesBtn.trigger('click');
  13635. }
  13636. const fullPath = (0, shared_1.getProjectFullPath)(window.location.pathname);
  13637. const ciConfigVariables = (yield glGraphqlClient.getCiConfigVariables(fullPath, `refs/heads/${currentBranch}`)) || [];
  13638. const descriptionOption = {};
  13639. for (const ciConfigVar of ciConfigVariables) {
  13640. const varOptions = (0, shared_1.getOptionsFromVarDescription)(ciConfigVar.description);
  13641. if (config_1.getTheOptionsFrom === shared_1.GetTheOptionsFrom.VAR_DESCRIPTION) {
  13642. if (varOptions.length > 0) {
  13643. descriptionOption[ciConfigVar.key] = (0, shared_1.getOptionsFromVarDescription)(ciConfigVar.description);
  13644. }
  13645. }
  13646. else if (config_1.getTheOptionsFrom === shared_1.GetTheOptionsFrom.GITLAB_VARIABLE_OPTIONS) {
  13647. if (!!ciConfigVar.valueOptions && ciConfigVar.valueOptions.length > 0) {
  13648. descriptionOption[ciConfigVar.key] = ciConfigVar.valueOptions;
  13649. }
  13650. }
  13651. else if (config_1.getTheOptionsFrom === shared_1.GetTheOptionsFrom.MERGE_BOTH) {
  13652. if (varOptions.length > 0 ||
  13653. (!!ciConfigVar.valueOptions && ciConfigVar.valueOptions.length > 0)) {
  13654. const glValueOptions = ciConfigVar.valueOptions || [];
  13655. // create a set to remove duplicate values
  13656. const mergedOptions = new Set([
  13657. ...(0, shared_1.getOptionsFromVarDescription)(ciConfigVar.description),
  13658. ...glValueOptions,
  13659. ]);
  13660. descriptionOption[ciConfigVar.key] = Array.from(mergedOptions);
  13661. }
  13662. }
  13663. }
  13664. yield varOptionStorage.setOptions(descriptionOption);
  13665. const keyOptions = varOptionStorage.getOptions();
  13666. const persistedVariables = getPersistedVariables();
  13667. // Activated checkbox
  13668. const checkBoxRow = (0, shared_1.$)('.gl-form-checkbox.gl-mb-3.custom-control.custom-checkbox');
  13669. const showValueOptionsDropdownCheckbox = (0, components_1.GitlabCheckboxComponent)('Show dropdown(s)', 'Turn on', 'pl-0', isShowDropdown, 'show_dropdown_checkbox');
  13670. showValueOptionsDropdownCheckbox.insertAfter(checkBoxRow);
  13671. const _rows = [];
  13672. for (const persistedVariable of persistedVariables) {
  13673. const persistedVariableRow = (0, shared_1.$)(persistedVariable);
  13674. persistedVariableRow.find('div[data-testid="ci-variable-row"]').removeClass('gl-mb-3 gl-pb-2');
  13675. //#region Get components
  13676. const variableTypeSelect = persistedVariableRow.find('button.btn.dropdown-toggle.gl-dropdown-toggle');
  13677. const variableType = variableTypeSelect.text().trim();
  13678. const variableKeyInput = persistedVariableRow.find('input[data-qa-selector="ci_variable_key_field"]');
  13679. const variableKey = variableKeyInput.val();
  13680. const variableSecretValueInput = persistedVariableRow.find('textarea[data-qa-selector="ci_variable_value_field"]');
  13681. const variableSecretValue = variableSecretValueInput.val();
  13682. const removeVariableBtn = persistedVariableRow.find('button[data-testid="remove-ci-variable-row"]');
  13683. removeVariableBtn.addClass('origin-remove-variable-btn');
  13684. removeVariableBtn.hide();
  13685. const newRemoveVariableBtn = (0, components_1.GitlabRemoveVariableRowComponent)();
  13686. newRemoveVariableBtn.insertAfter(removeVariableBtn);
  13687. newRemoveVariableBtn.on('click', () => {
  13688. persistedVariableRow.remove();
  13689. });
  13690. //#endregion
  13691. //#region Adding var description
  13692. const descriptionTxt = (_a = ciConfigVariables.find((v) => v.key === variableKey)) === null || _a === void 0 ? void 0 : _a.description;
  13693. if (descriptionTxt) {
  13694. const varDescriptionComponent = (0, components_1.VarDescriptionComponent)((0, shared_1.convertMarkdownToHtml)(descriptionTxt));
  13695. removeVariableBtn.on('click', () => {
  13696. varDescriptionComponent.remove();
  13697. });
  13698. // varDescriptionComponent.insertAfter(persistedVariableRow.find('.ci-variable-row'));
  13699. persistedVariableRow.append(varDescriptionComponent);
  13700. }
  13701. else {
  13702. persistedVariableRow
  13703. .find('div[data-testid="ci-variable-row"]')
  13704. .attr('style', 'padding-bottom: 16px;');
  13705. }
  13706. //#endregion
  13707. // if variableSecretValue is not in the list of options, add it to the list
  13708. if (((_b = keyOptions[variableKey]) === null || _b === void 0 ? void 0 : _b.indexOf(variableSecretValue)) === -1) {
  13709. (_c = keyOptions[variableKey]) === null || _c === void 0 ? void 0 : _c.push(variableSecretValue);
  13710. }
  13711. let variableSecretValueDropdown = null;
  13712. if ((keyOptions[variableKey] || []).length > 0) {
  13713. variableSecretValueDropdown = (0, components_1.GitlabSelectionComponent)(keyOptions[variableKey] || [], variableSecretValue, 'pipeline-form-ci-variable-value', 'ci_variable_value_field', (value) => {
  13714. console.log('value', value);
  13715. });
  13716. }
  13717. _rows.push({
  13718. key: variableKey,
  13719. variableType,
  13720. original: {
  13721. valueInput: variableSecretValueInput,
  13722. },
  13723. clone: variableSecretValueDropdown
  13724. ? {
  13725. valueInput: variableSecretValueDropdown,
  13726. }
  13727. : null,
  13728. });
  13729. }
  13730. const reloadForm = (allowShowDropdown) => {
  13731. var _a, _b;
  13732. for (const row of _rows) {
  13733. if (allowShowDropdown) {
  13734. if (row.clone) {
  13735. if (row.original.valueInput.is(':visible')) {
  13736. // alow empty value
  13737. const currentValue = row.original.valueInput.val();
  13738. if (((_a = keyOptions[row.key]) === null || _a === void 0 ? void 0 : _a.indexOf(currentValue)) === -1) {
  13739. (_b = keyOptions[row.key]) === null || _b === void 0 ? void 0 : _b.push(currentValue);
  13740. }
  13741. row.clone.valueInput = (0, components_1.GitlabSelectionComponent)(keyOptions[row.key] || [], currentValue, 'pipeline-form-ci-variable-value', 'ci_variable_value_field', (value) => {
  13742. console.log('value', value);
  13743. });
  13744. row.clone.valueInput.val(currentValue);
  13745. row.clone.valueInput.replaceAll(row.original.valueInput);
  13746. }
  13747. }
  13748. }
  13749. else {
  13750. if (row.clone) {
  13751. if (row.clone.valueInput.is(':visible')) {
  13752. const currentValue = row.clone.valueInput.val();
  13753. row.original.valueInput.val(currentValue);
  13754. row.original.valueInput.replaceAll(row.clone.valueInput);
  13755. }
  13756. }
  13757. }
  13758. }
  13759. };
  13760. if (isShowDropdown) {
  13761. reloadForm(isShowDropdown);
  13762. }
  13763. showValueOptionsDropdownCheckbox.on('click', (e) => {
  13764. if (e.target.nodeName !== 'INPUT')
  13765. return;
  13766. else {
  13767. const isChecked = (0, shared_1.$)('#show_dropdown_checkbox').is(':checked');
  13768. reloadForm(isChecked);
  13769. editPipelineScheduleBtn.show();
  13770. newEditPipelineScheduleBtn.hide();
  13771. (0, shared_1.$)('.origin-remove-variable-btn').show();
  13772. (0, shared_1.$)('.custom-remove-variable-btn').hide();
  13773. }
  13774. });
  13775. //#region Reveal button click event
  13776. revealValuesBtn.on('click', () => {
  13777. var _a, _b;
  13778. const _isShowDropdown = (0, shared_1.$)('#show_dropdown_checkbox').is(':checked');
  13779. const isHidden = revealValuesBtn.text().includes('Reveal value');
  13780. if (isHidden) {
  13781. if (_isShowDropdown) {
  13782. for (const row of _rows) {
  13783. (_a = row.clone) === null || _a === void 0 ? void 0 : _a.valueInput.show();
  13784. }
  13785. }
  13786. else {
  13787. // do nothing
  13788. }
  13789. }
  13790. else {
  13791. if (_isShowDropdown) {
  13792. for (const row of _rows) {
  13793. (_b = row.clone) === null || _b === void 0 ? void 0 : _b.valueInput.hide();
  13794. }
  13795. }
  13796. else {
  13797. // do nothing
  13798. }
  13799. }
  13800. });
  13801. //#endregion
  13802. newEditPipelineScheduleBtn.on('click', () => __awaiter(void 0, void 0, void 0, function* () {
  13803. var _d;
  13804. const updatedVariables = [];
  13805. const crtPersistedVariables = getPersistedVariables();
  13806. for (const persistedVariable of crtPersistedVariables) {
  13807. const persistedVariableRow = (0, shared_1.$)(persistedVariable);
  13808. const variableKeyInput = persistedVariableRow.find('input[data-qa-selector="ci_variable_key_field"]');
  13809. const variableKey = variableKeyInput.val();
  13810. if (variableKey === undefined)
  13811. continue;
  13812. const variableSecretValueInput = persistedVariableRow.find('[data-qa-selector="ci_variable_value_field"]');
  13813. const variableSecretValue = variableSecretValueInput.val();
  13814. if (variableSecretValue === undefined)
  13815. continue;
  13816. updatedVariables.push({
  13817. key: variableKey,
  13818. value: variableSecretValue,
  13819. });
  13820. }
  13821. // get last div
  13822. const scheduleVueElement = (_d = (0, shared_1.$)('#content-body > div.col-lg-8.gl-pl-0')) === null || _d === void 0 ? void 0 : _d.get()[0];
  13823. const scheduleVueInstanceData = scheduleVueElement.__vue__.$data;
  13824. const updatedPipelineSchedule = {
  13825. description: scheduleVueInstanceData.description,
  13826. cron: scheduleVueInstanceData.cron,
  13827. cronTimezone: scheduleVueInstanceData.cronTimezone,
  13828. ref: scheduleVueInstanceData.scheduleRef,
  13829. activate: scheduleVueInstanceData.activated,
  13830. variables: updatedVariables,
  13831. };
  13832. yield glGraphqlClient.updatePipelineSchedule((0, shared_1.getScheduleIdFromUrl)(window.location.pathname), fullPath, updatedPipelineSchedule);
  13833. // navigate to pipeline schedules page
  13834. window.location.href = `${window.location.origin}/${fullPath}/-/pipeline_schedules`;
  13835. }));
  13836. //#endregion
  13837. });
  13838. exports.editPipelineSchedulePage = editPipelineSchedulePage;
  13839.  
  13840.  
  13841. /***/ }),
  13842. /* 29 */
  13843. /***/ ((__unused_webpack_module, exports) => {
  13844.  
  13845. "use strict";
  13846.  
  13847. Object.defineProperty(exports, "__esModule", ({ value: true }));
  13848. exports.GetTheOptionsFrom = void 0;
  13849. var GetTheOptionsFrom;
  13850. (function (GetTheOptionsFrom) {
  13851. GetTheOptionsFrom["VAR_DESCRIPTION"] = "var_description";
  13852. GetTheOptionsFrom["GITLAB_VARIABLE_OPTIONS"] = "gitlab_variable_options";
  13853. GetTheOptionsFrom["MERGE_BOTH"] = "merge_both";
  13854. })(GetTheOptionsFrom = exports.GetTheOptionsFrom || (exports.GetTheOptionsFrom = {}));
  13855.  
  13856.  
  13857. /***/ }),
  13858. /* 30 */
  13859. /***/ ((__unused_webpack_module, exports) => {
  13860.  
  13861. "use strict";
  13862.  
  13863. Object.defineProperty(exports, "__esModule", ({ value: true }));
  13864. exports.HttpMethods = void 0;
  13865. var HttpMethods;
  13866. (function (HttpMethods) {
  13867. HttpMethods["GET"] = "GET";
  13868. HttpMethods["POST"] = "POST";
  13869. HttpMethods["PUT"] = "PUT";
  13870. HttpMethods["PATCH"] = "PATCH";
  13871. HttpMethods["DELETE"] = "DELETE";
  13872. })(HttpMethods = exports.HttpMethods || (exports.HttpMethods = {}));
  13873.  
  13874.  
  13875. /***/ }),
  13876. /* 31 */
  13877. /***/ ((__unused_webpack_module, exports) => {
  13878.  
  13879. "use strict";
  13880.  
  13881. Object.defineProperty(exports, "__esModule", ({ value: true }));
  13882. exports.updatePipelineScheduleMutationStr = exports.getPipelineScheduleQueryStr = exports.getPipelineSchedulesQueryStr = exports.getCiConfigVariablesQueryStr = void 0;
  13883. exports.getCiConfigVariablesQueryStr = `query ciConfigVariables($fullPath: ID!, $ref: String!) {
  13884. project(fullPath: $fullPath) {
  13885. id
  13886. ciConfigVariables(ref: $ref) {
  13887. description
  13888. key
  13889. value
  13890. valueOptions
  13891. __typename
  13892. }
  13893. __typename
  13894. }
  13895. }
  13896. `;
  13897. exports.getPipelineSchedulesQueryStr = `query getPipelineSchedulesQuery($projectPath: ID!, $status: PipelineScheduleStatus, $ids: [ID!] = null) {
  13898. currentUser {
  13899. id
  13900. username
  13901. __typename
  13902. }
  13903. project(fullPath: $projectPath) {
  13904. id
  13905. pipelineSchedules(status: $status, ids: $ids) {
  13906. count
  13907. nodes {
  13908. id
  13909. description
  13910. cron
  13911. cronTimezone
  13912. ref
  13913. forTag
  13914. editPath
  13915. refPath
  13916. refForDisplay
  13917. lastPipeline {
  13918. id
  13919. detailedStatus {
  13920. id
  13921. group
  13922. icon
  13923. label
  13924. text
  13925. detailsPath
  13926. __typename
  13927. }
  13928. __typename
  13929. }
  13930. active
  13931. nextRunAt
  13932. realNextRun
  13933. owner {
  13934. id
  13935. username
  13936. avatarUrl
  13937. name
  13938. webPath
  13939. __typename
  13940. }
  13941. variables {
  13942. nodes {
  13943. id
  13944. variableType
  13945. key
  13946. value
  13947. __typename
  13948. }
  13949. __typename
  13950. }
  13951. userPermissions {
  13952. playPipelineSchedule
  13953. updatePipelineSchedule
  13954. adminPipelineSchedule
  13955. __typename
  13956. }
  13957. __typename
  13958. }
  13959. __typename
  13960. }
  13961. __typename
  13962. }
  13963. }
  13964. `;
  13965. exports.getPipelineScheduleQueryStr = `query getPipelineSchedulesQuery($projectPath: ID!, $status: PipelineScheduleStatus, $ids: [ID!] = null) {
  13966. currentUser {
  13967. id
  13968. username
  13969. __typename
  13970. }
  13971. project(fullPath: $projectPath) {
  13972. id
  13973. pipelineSchedules(status: $status, ids: $ids) {
  13974. count
  13975. nodes {
  13976. id
  13977. description
  13978. cron
  13979. cronTimezone
  13980. ref
  13981. forTag
  13982. editPath
  13983. refPath
  13984. refForDisplay
  13985. lastPipeline {
  13986. id
  13987. detailedStatus {
  13988. id
  13989. group
  13990. icon
  13991. label
  13992. text
  13993. detailsPath
  13994. __typename
  13995. }
  13996. __typename
  13997. }
  13998. active
  13999. nextRunAt
  14000. realNextRun
  14001. owner {
  14002. id
  14003. username
  14004. avatarUrl
  14005. name
  14006. webPath
  14007. __typename
  14008. }
  14009. variables {
  14010. nodes {
  14011. id
  14012. variableType
  14013. key
  14014. value
  14015. __typename
  14016. }
  14017. __typename
  14018. }
  14019. userPermissions {
  14020. playPipelineSchedule
  14021. updatePipelineSchedule
  14022. adminPipelineSchedule
  14023. __typename
  14024. }
  14025. __typename
  14026. }
  14027. __typename
  14028. }
  14029. __typename
  14030. }
  14031. }
  14032. `;
  14033. exports.updatePipelineScheduleMutationStr = `mutation updatePipelineSchedule($input: PipelineScheduleUpdateInput!) {
  14034. pipelineScheduleUpdate(input: $input) {
  14035. clientMutationId
  14036. errors
  14037. __typename
  14038. }
  14039. }
  14040. `;
  14041.  
  14042.  
  14043. /***/ }),
  14044. /* 32 */
  14045. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  14046.  
  14047. (()=>{"use strict";var e={d:(t,a)=>{for(var r in a)e.o(a,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:a[r]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{Header:()=>r,buildKeyGenerator:()=>b,buildMemoryStorage:()=>v,buildStorage:()=>w,buildWebStorage:()=>C,canStale:()=>p,createCacheResponse:()=>d,createValidateStatus:()=>i,defaultHeaderInterpreter:()=>n,defaultKeyGenerator:()=>I,defaultRequestInterceptor:()=>u,defaultResponseInterceptor:()=>h,isExpired:()=>m,isMethodIn:()=>s,isStorage:()=>g,setupCache:()=>x,testCachePredicate:()=>f,updateCache:()=>l,updateStaleRequest:()=>c});const a=__webpack_require__(47),r=Object.freeze({IfModifiedSince:"if-modified-since",LastModified:"last-modified",IfNoneMatch:"if-none-match",CacheControl:"cache-control",ETag:"etag",Expires:"expires",Age:"age",XAxiosCacheEtag:"x-axios-cache-etag",XAxiosCacheLastModified:"x-axios-cache-last-modified",XAxiosCacheStaleIfError:"x-axios-cache-stale-if-error"}),n=e=>{if(!e)return"not enough headers";const t=e[r.CacheControl];if(t){const{noCache:n,noStore:o,mustRevalidate:i,maxAge:s,immutable:c}=(0,a.parse)(String(t));if(n||o)return"dont cache";if(c)return 31536e6;if(i)return 0;if(void 0!==s){const t=e[r.Age];return t?1e3*(s-Number(t)):1e3*s}}const n=e[r.Expires];if(n){const e=Date.parse(String(n))-Date.now();return e>=0?e:"dont cache"}return"not enough headers"},o=__webpack_require__(48);function i(e){return e?t=>e(t)||304===t:e=>e>=200&&e<300||304===e}function s(e="get",t=[]){return e=e.toLowerCase(),t.some((t=>t===e))}function c(e,t){var a;t.headers||(t.headers={});const{etag:n,modifiedSince:o}=t.cache;if(n){const o=!0===n?null===(a=e.data)||void 0===a?void 0:a.headers[r.ETag]:n;o&&(t.headers[r.IfNoneMatch]=o)}o&&(t.headers[r.IfModifiedSince]=!0===o?e.data.headers[r.LastModified]||new Date(e.createdAt).toUTCString():o.toUTCString())}function d(e,t){return 304===e.status&&t?(e.cached=!0,e.data=t.data,e.status=t.status,e.statusText=t.statusText,e.headers=Object.assign(Object.assign({},t.headers),e.headers),t):{data:e.data,status:e.status,statusText:e.statusText,headers:e.headers}}function u(e){const t=async t=>{var a;const r=t.id=e.generateKey(t);if(!1===t.cache)return t;if(t.cache=Object.assign(Object.assign({},e.defaults.cache),t.cache),!s(t.method,t.cache.methods))return t;let n=await e.storage.get(r,t);const d=t.cache.override;e:if("empty"===n.state||"stale"===n.state||d){if(e.waiting[r]&&!d&&(n=await e.storage.get(r,t),"empty"!==n.state)){0;break e}return e.waiting[r]=(0,o.deferred)(),null===(a=e.waiting[r])||void 0===a||a.catch((()=>{})),await e.storage.set(r,{state:"loading",previous:d?n.data?"stale":"empty":n.state,data:n.data,createdAt:d&&!n.createdAt?Date.now():n.createdAt},t),"stale"===n.state&&c(n,t),t.validateStatus=i(t.validateStatus),t}let u;if("loading"===n.state){const a=e.waiting[r];if(!a)return await e.storage.remove(r,t),t;0;try{u=await a}catch(e){return t}}else u=n.data;return t.adapter=()=>Promise.resolve({config:t,data:u.data,headers:u.headers,status:u.status,statusText:u.statusText,cached:!0,id:r}),t};return{onFulfilled:t,apply:()=>e.interceptors.request.use(t)}}async function f(e,t){var a;if("function"==typeof t)return t(e);const{statusCheck:r,responseMatch:n,containsHeaders:o}=t;if(r&&!await r(e.status)||n&&!await n(e))return!1;if(o)for(const[t,r]of Object.entries(o))if(!await r(null!==(a=e.headers[t.toLowerCase()])&&void 0!==a?a:e.headers[t]))return!1;return!0}async function l(e,t,a){if("function"==typeof a)return a(t);for(const[r,n]of Object.entries(a)){if("delete"===n){await e.remove(r,t.config);continue}const a=await e.get(r,t.config);if("loading"===a.state)continue;const o=await n(a,t);"delete"!==o?"ignore"!==o&&await e.set(r,o,t.config):await e.remove(r,t.config)}}function h(e){const t=async(t,a)=>{var r;await e.storage.remove(t,a),null===(r=e.waiting[t])||void 0===r||r.reject(),delete e.waiting[t]},a=async a=>{var n,o,i;const s=a.id=null!==(n=(i=a.config).id)&&void 0!==n?n:i.id=e.generateKey(a.config);if(null!==(o=a.cached)&&void 0!==o||(a.cached=!1),a.cached)return a;const c=a.config.cache;if(!c)return Object.assign(Object.assign({},a),{cached:!1});const u=a.config,h=await e.storage.get(s,u);if((null==c?void 0:c.update)&&await l(e.storage,a,c.update),"loading"!==h.state)return a;if(!h.data&&!await f(a,c.cachePredicate))return await t(s,u),a;for(const e of Object.keys(a.headers))e.startsWith("x-axios-cache")&&delete a.headers[e];c.etag&&!0!==c.etag&&(a.headers[r.XAxiosCacheEtag]=c.etag),c.modifiedSince&&(a.headers[r.XAxiosCacheLastModified]=!0===c.modifiedSince?"use-cache-timestamp":c.modifiedSince.toUTCString());let g=c.ttl||-1;if(null==c?void 0:c.interpretHeader){const r=e.headerInterpreter(a.headers);if("dont cache"===r)return await t(s,u),a;g="not enough headers"===r?g:r}const p=d(a,h.data);"function"==typeof g&&(g=await g(a)),c.staleIfError&&(a.headers[r.XAxiosCacheStaleIfError]=String(g));const m={state:"cached",ttl:g,createdAt:Date.now(),data:p},w=e.waiting[s];return w&&(w.resolve(m.data),delete e.waiting[s]),await e.storage.set(s,m,u),a},n=async a=>{var r;const n=a.config;if(!(null==n?void 0:n.cache)||!n.id)throw a;const o=await e.storage.get(n.id,n),i=n.cache;if("loading"!==o.state||"stale"!==o.previous)throw await t(n.id,n),a;if(null==i?void 0:i.staleIfError){const t="function"==typeof i.staleIfError?await i.staleIfError(a.response,o,a):i.staleIfError;if(!0===t||"number"==typeof t&&o.createdAt+t>Date.now())return null===(r=e.waiting[n.id])||void 0===r||r.resolve(o.data),delete e.waiting[n.id],await e.storage.set(n.id,{state:"stale",createdAt:Date.now(),data:o.data},n),{cached:!0,config:n,id:n.id,data:o.data.data,headers:o.data.headers,status:o.data.status,statusText:o.data.statusText}}throw a};return{onFulfilled:a,onRejected:n,apply:()=>e.interceptors.response.use(a,n)}}const g=e=>!!e&&!!e["is-storage"];function p(e){const t=e.data.headers;return r.ETag in t||r.LastModified in t||r.XAxiosCacheEtag in t||r.XAxiosCacheStaleIfError in t||r.XAxiosCacheLastModified in t}function m(e){return e.createdAt+e.ttl<=Date.now()}function w({set:e,find:t,remove:a}){return{"is-storage":1,set:e,remove:a,get:async(r,n)=>{const o=await t(r,n);if(!o)return{state:"empty"};if("cached"!==o.state||!m(o))return o;if(p(o)){const t={state:"stale",createdAt:o.createdAt,data:o.data};return await e(r,t,n),t}return await a(r,n),{state:"empty"}}}}function v(e=!1){const t=w({set:(e,a)=>{t.data[e]=a},remove:e=>{delete t.data[e]},find:a=>{const r=t.data[a];return e&&void 0!==r?"function"==typeof structuredClone?structuredClone(r):JSON.parse(JSON.stringify(r)):r}});return t.data=Object.create(null),t}const y=__webpack_require__(49),S=/^\/|\/$/g;function b(e){return t=>{if(t.id)return t.id;const a=e(t);return"string"==typeof a||"number"==typeof a?`${a}`:`${(0,y.hash)(a)}`}}const I=b((({baseURL:e="",url:t="",method:a="get",params:r,data:n})=>(e&&(e=e.replace(S,"")),t&&(t=t.replace(S,"")),a&&(a=a.toLowerCase()),{url:e+(e&&t?"/":"")+t,params:r,method:a,data:n})));function x(e,t={}){var a,r,o,i,s;const c=e;if(c.storage=t.storage||v(),!g(c.storage))throw new Error("Use buildStorage() function");return c.waiting=t.waiting||{},c.generateKey=t.generateKey||I,c.headerInterpreter=t.headerInterpreter||n,c.requestInterceptor=t.requestInterceptor||u(c),c.responseInterceptor=t.responseInterceptor||h(c),c.debug=t.debug,c.defaults.cache={update:t.update||{},ttl:null!==(a=t.ttl)&&void 0!==a?a:3e5,methods:t.methods||["get"],cachePredicate:t.cachePredicate||{statusCheck:e=>e>=200&&e<400},etag:null===(r=t.etag)||void 0===r||r,modifiedSince:null!==(o=t.modifiedSince)&&void 0!==o?o:!1===t.etag,interpretHeader:null===(i=t.interpretHeader)||void 0===i||i,staleIfError:null===(s=t.staleIfError)||void 0===s||s,override:!1},c.requestInterceptor.apply(),c.responseInterceptor.apply(),c}function C(e,t=""){return w({find:a=>{const r=e.getItem(t+a);return r?JSON.parse(r):void 0},remove:a=>{e.removeItem(t+a)},set:(a,r)=>{const n=()=>e.setItem(t+a,JSON.stringify(r));try{return n()}catch(r){const o=Object.entries(e).filter((e=>e[0].startsWith(t))).map((e=>[e[0],JSON.parse(e[1])]));for(const t of o)"cached"===t[1].state&&m(t[1])&&!p(t[1])&&e.removeItem(t[0]);try{return n()}catch(t){const a=o.sort(((e,t)=>(e[1].createdAt||0)-(t[1].createdAt||0)));for(const t of a){e.removeItem(t[0]);try{return n()}catch(e){}}}e.removeItem(t+a)}}})}module.exports=t})();
  14048.  
  14049. /***/ }),
  14050. /* 33 */
  14051. /***/ ((__unused_webpack_module, exports) => {
  14052.  
  14053. "use strict";
  14054.  
  14055. Object.defineProperty(exports, "__esModule", ({ value: true }));
  14056. exports.css = void 0;
  14057. exports.css = `
  14058. .separator {
  14059. display: flex;
  14060. align-items: center;
  14061. text-align: center;
  14062. color: #737278;
  14063. font-size: 0.9rem;
  14064. font-weight: 500;
  14065. margin: 2rem 0 0.2rem 0;
  14066. }
  14067.  
  14068. .separator::before,
  14069. .separator::after {
  14070. content: '';
  14071. flex: 1;
  14072. border-bottom: 1px dashed #737278;
  14073. }
  14074.  
  14075. .separator:not(:empty)::before {
  14076. margin-right: .5em;
  14077. }
  14078.  
  14079. .separator:not(:empty)::after {
  14080. margin-left: .5em;
  14081. }
  14082.  
  14083. .modal-body label {
  14084. webkit-user-select: none;
  14085. -khtml-user-select: none;
  14086. -moz-user-select: -moz-none;
  14087. -o-user-select: none;
  14088. user-select: none;
  14089. }
  14090.  
  14091. `;
  14092.  
  14093.  
  14094. /***/ }),
  14095. /* 34 */
  14096. /***/ ((__unused_webpack_module, exports) => {
  14097.  
  14098. "use strict";
  14099.  
  14100. Object.defineProperty(exports, "__esModule", ({ value: true }));
  14101. exports.leftJoin = void 0;
  14102. function leftJoin(left, right, key, select) {
  14103. const rightLookup = right.reduce((lookup, item) => {
  14104. lookup.set(item[key], item);
  14105. return lookup;
  14106. }, new Map());
  14107. return left.map((item) => {
  14108. return select(item, rightLookup.get(item[key]));
  14109. });
  14110. }
  14111. exports.leftJoin = leftJoin;
  14112.  
  14113.  
  14114. /***/ }),
  14115. /* 35 */
  14116. /***/ ((__unused_webpack_module, exports) => {
  14117.  
  14118. "use strict";
  14119.  
  14120. Object.defineProperty(exports, "__esModule", ({ value: true }));
  14121. exports.htmlVarInjector = exports.waitForElement = void 0;
  14122. function waitForElement(selector) {
  14123. return new Promise((resolve) => {
  14124. if (document.querySelector(selector)) {
  14125. return resolve(document.querySelector(selector));
  14126. }
  14127. // eslint-disable-next-line @typescript-eslint/no-unused-vars
  14128. const observer = new MutationObserver((mutations) => {
  14129. if (document.querySelector(selector)) {
  14130. observer.disconnect();
  14131. resolve(document.querySelector(selector));
  14132. }
  14133. });
  14134. observer.observe(document.body, {
  14135. childList: true,
  14136. subtree: true,
  14137. });
  14138. });
  14139. }
  14140. exports.waitForElement = waitForElement;
  14141. // this method will replace all ${key} in html with the value of params[key]
  14142. function htmlVarInjector(html, params) {
  14143. return html.replace(/\${(.*?)}/g, (match, key) => {
  14144. return params[key];
  14145. });
  14146. }
  14147. exports.htmlVarInjector = htmlVarInjector;
  14148.  
  14149.  
  14150. /***/ }),
  14151. /* 36 */
  14152. /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
  14153.  
  14154. "use strict";
  14155.  
  14156. Object.defineProperty(exports, "__esModule", ({ value: true }));
  14157. exports.downloadEnvFile = void 0;
  14158. const config_1 = __webpack_require__(0);
  14159. function saveAs(blob, filename) {
  14160. const url = window.URL.createObjectURL(blob);
  14161. const a = document.createElement('a');
  14162. a.href = url;
  14163. a.download = filename;
  14164. a.click();
  14165. window.URL.revokeObjectURL(url);
  14166. }
  14167. function downloadEnvFile(variables, description) {
  14168. const envFileContent = variables
  14169. .map((variable) => {
  14170. const keyValue = `${variable.key}=${config_1.wrappedVarBy}${variable.value.replaceAll('"', '\\"')}${config_1.wrappedVarBy}`;
  14171. return config_1.replaceEnterWithN ? keyValue.replaceAll('\n', '\\n') : keyValue;
  14172. })
  14173. .join('\n');
  14174. const blob = new Blob([envFileContent], { type: 'text/plain;charset=utf-8' });
  14175. saveAs(blob, `${description}.env`);
  14176. }
  14177. exports.downloadEnvFile = downloadEnvFile;
  14178.  
  14179.  
  14180. /***/ }),
  14181. /* 37 */
  14182. /***/ ((__unused_webpack_module, exports) => {
  14183.  
  14184. "use strict";
  14185.  
  14186. Object.defineProperty(exports, "__esModule", ({ value: true }));
  14187.  
  14188.  
  14189. /***/ }),
  14190. /* 38 */
  14191. /***/ ((__unused_webpack_module, exports) => {
  14192.  
  14193. "use strict";
  14194.  
  14195. Object.defineProperty(exports, "__esModule", ({ value: true }));
  14196.  
  14197.  
  14198. /***/ }),
  14199. /* 39 */
  14200. /***/ ((__unused_webpack_module, exports) => {
  14201.  
  14202. "use strict";
  14203.  
  14204. Object.defineProperty(exports, "__esModule", ({ value: true }));
  14205.  
  14206.  
  14207. /***/ }),
  14208. /* 40 */
  14209. /***/ ((__unused_webpack_module, exports) => {
  14210.  
  14211. "use strict";
  14212.  
  14213. Object.defineProperty(exports, "__esModule", ({ value: true }));
  14214.  
  14215.  
  14216. /***/ }),
  14217. /* 41 */
  14218. /***/ ((__unused_webpack_module, exports) => {
  14219.  
  14220. "use strict";
  14221.  
  14222. Object.defineProperty(exports, "__esModule", ({ value: true }));
  14223.  
  14224.  
  14225. /***/ }),
  14226. /* 42 */
  14227. /***/ ((__unused_webpack_module, exports) => {
  14228.  
  14229. "use strict";
  14230.  
  14231. Object.defineProperty(exports, "__esModule", ({ value: true }));
  14232.  
  14233.  
  14234. /***/ }),
  14235. /* 43 */
  14236. /***/ ((__unused_webpack_module, exports) => {
  14237.  
  14238. "use strict";
  14239.  
  14240. Object.defineProperty(exports, "__esModule", ({ value: true }));
  14241.  
  14242.  
  14243. /***/ }),
  14244. /* 44 */
  14245. /***/ ((__unused_webpack_module, exports) => {
  14246.  
  14247. "use strict";
  14248.  
  14249. Object.defineProperty(exports, "__esModule", ({ value: true }));
  14250.  
  14251.  
  14252. /***/ }),
  14253. /* 45 */
  14254. /***/ ((__unused_webpack_module, exports) => {
  14255.  
  14256. "use strict";
  14257.  
  14258. Object.defineProperty(exports, "__esModule", ({ value: true }));
  14259.  
  14260.  
  14261. /***/ }),
  14262. /* 46 */
  14263. /***/ ((__unused_webpack_module, exports) => {
  14264.  
  14265. "use strict";
  14266.  
  14267. Object.defineProperty(exports, "__esModule", ({ value: true }));
  14268.  
  14269.  
  14270. /***/ }),
  14271. /* 47 */
  14272. /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
  14273.  
  14274. "use strict";
  14275. __webpack_require__.r(__webpack_exports__);
  14276. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  14277. /* harmony export */ "isCacheControl": () => (/* binding */ i),
  14278. /* harmony export */ "parse": () => (/* binding */ s),
  14279. /* harmony export */ "tokenize": () => (/* binding */ n)
  14280. /* harmony export */ });
  14281. var e=Symbol("cache-parser");function a(e){return("string"==typeof e||"number"==typeof e)&&(e=Number(e))>=0&&e<Infinity}function r(e){return!0===e||"number"==typeof e||"string"==typeof e&&"false"!==e}var t=Number;function s(s){var n=Object.defineProperty({},e,{enumerable:!1,value:1});if(!s||"string"!=typeof s)return n;var i=function(e){var a={},r=e.toLowerCase().replace(/\s+/g,"").split(",");for(var t in r){var s,n=r[t].split("=",2);a[n[0]]=null==(s=n[1])||s}return a}(s),u=i["max-age"],l=i["max-stale"],o=i["min-fresh"],m=i["s-maxage"],p=i["stale-if-error"],h=i["stale-while-revalidate"];return r(i.immutable)&&(n.immutable=!0),a(u)&&(n.maxAge=t(u)),a(l)&&(n.maxStale=t(l)),a(o)&&(n.minFresh=t(o)),r(i["must-revalidate"])&&(n.mustRevalidate=!0),r(i["must-understand"])&&(n.mustUnderstand=!0),r(i["no-cache"])&&(n.noCache=!0),r(i["no-store"])&&(n.noStore=!0),r(i["no-transform"])&&(n.noTransform=!0),r(i["only-if-cached"])&&(n.onlyIfCached=!0),r(i.private)&&(n.private=!0),r(i["proxy-revalidate"])&&(n.proxyRevalidate=!0),r(i.public)&&(n.public=!0),a(m)&&(n.sMaxAge=t(m)),a(p)&&(n.staleIfError=t(p)),a(h)&&(n.staleWhileRevalidate=t(h)),n}function n(e){if(!e||"object"!=typeof e)return[];var t=[];return r(e.immutable)&&t.push("immutable"),a(e.maxAge)&&t.push("max-age="+e.maxAge),a(e.maxStale)&&t.push("max-stale="+e.maxStale),a(e.minFresh)&&t.push("min-fresh="+e.minFresh),r(e.mustRevalidate)&&t.push("must-revalidate"),r(e.mustUnderstand)&&t.push("must-understand"),r(e.noCache)&&t.push("no-cache"),r(e.noStore)&&t.push("no-store"),r(e.noTransform)&&t.push("no-transform"),r(e.onlyIfCached)&&t.push("only-if-cached"),r(e.private)&&t.push("private"),r(e.proxyRevalidate)&&t.push("proxy-revalidate"),r(e.public)&&t.push("public"),a(e.sMaxAge)&&t.push("s-maxage="+e.sMaxAge),a(e.staleIfError)&&t.push("stale-if-error="+e.staleIfError),a(e.staleWhileRevalidate)&&t.push("stale-while-revalidate="+e.staleWhileRevalidate),t}function i(a){return!!a&&!!a[e]}
  14282. //# sourceMappingURL=index.mjs.map
  14283.  
  14284.  
  14285. /***/ }),
  14286. /* 48 */
  14287. /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
  14288.  
  14289. "use strict";
  14290. __webpack_require__.r(__webpack_exports__);
  14291. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  14292. /* harmony export */ "deferred": () => (/* binding */ e),
  14293. /* harmony export */ "isDeferred": () => (/* binding */ n)
  14294. /* harmony export */ });
  14295. var r=Symbol();function e(){var e,n,o=new Promise(function(r,o){e=r,n=o});return o.resolve=e,o.reject=n,o[r]=1,o}function n(e){return!!e&&!!e[r]}
  14296. //# sourceMappingURL=index.mjs.map
  14297.  
  14298.  
  14299. /***/ }),
  14300. /* 49 */
  14301. /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
  14302.  
  14303. "use strict";
  14304. __webpack_require__.r(__webpack_exports__);
  14305. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  14306. /* harmony export */ "hash": () => (/* binding */ t),
  14307. /* harmony export */ "serialize": () => (/* binding */ r)
  14308. /* harmony export */ });
  14309. function r(t){var n=typeof t;if(t&&"object"===n&&!(t instanceof Date||t instanceof RegExp)){for(var e=Array.isArray(t)?[]:{},o=Object.keys(t).sort(function(r,t){return r>t?1:-1}),i=o.length;i--;){var a=o[i];e[a]=r(t[a])}return String(t.constructor)+JSON.stringify(e,o)}return n+String(t)}function t(t){t=r(t);for(var n=5381,e=0;e<t.length;)n=33*n^t.charCodeAt(e++);return n}
  14310. //# sourceMappingURL=index.mjs.map
  14311.  
  14312.  
  14313. /***/ }),
  14314. /* 50 */
  14315. /***/ ((__unused_webpack_module, exports) => {
  14316.  
  14317. "use strict";
  14318.  
  14319. Object.defineProperty(exports, "__esModule", ({ value: true }));
  14320. exports.convertMarkdownToHtml = void 0;
  14321. function convertMarkdownToHtml(markdownString) {
  14322. const boldRegex = /\*\*(.*?)\*\*/g;
  14323. const italicRegex = /\*(.*?)\*/g;
  14324. const strikethroughRegex = /~~(.*?)~~/g;
  14325. const codeRegex = /`(.*?)`/g;
  14326. const linkRegex = /\[(.*?)\]\((.*?)\)/g;
  14327. const breakLineRegex = /\n/g;
  14328. const tabRegex = /\t/g;
  14329. const customOpenTagRegex = /<(.*?)>/g;
  14330. const customCloseTagRegex = /<\/(.*?)>/g;
  14331. const boldHtml = '<strong>$1</strong>';
  14332. const italicHtml = '<em>$1</em>';
  14333. const strikethroughHtml = '<del>$1</del>';
  14334. const codeHtml = '<code>$1</code>';
  14335. const linkHtml = '<a href="$2" target="_blank">$1</a>';
  14336. const breakLineHtml = '<br />';
  14337. const tabHtml = '&nbsp;&nbsp;&nbsp;&nbsp;';
  14338. const customOpenTagHtml = '&lt;$1&gt;';
  14339. const customCloseTagHtml = '&lt;/$1&gt;';
  14340. // convert special characters between backticks to html entities
  14341. // get the text between backticks
  14342. const textBetweenBackticks = markdownString.match(/`(.*?)`/g);
  14343. if (textBetweenBackticks) {
  14344. textBetweenBackticks.forEach((text) => {
  14345. // get the text between backticks
  14346. const textWithoutBackticks = text.replace(/`/g, '');
  14347. // convert special characters to html entities
  14348. const div = document.createElement('div');
  14349. div.innerText = div.textContent = textWithoutBackticks;
  14350. const textWithHtmlEntities = div.innerHTML;
  14351. // replace the text between backticks with the text with html entities
  14352. markdownString = markdownString.replace(text, `\`${textWithHtmlEntities}\``);
  14353. });
  14354. }
  14355. // convert markdown to html
  14356. const htmlString = markdownString
  14357. .replace(customCloseTagRegex, customCloseTagHtml)
  14358. .replace(customOpenTagRegex, customOpenTagHtml)
  14359. .replace(boldRegex, boldHtml)
  14360. .replace(italicRegex, italicHtml)
  14361. .replace(strikethroughRegex, strikethroughHtml)
  14362. .replace(codeRegex, codeHtml)
  14363. .replace(linkRegex, linkHtml)
  14364. .replace(breakLineRegex, breakLineHtml)
  14365. .replace(tabRegex, tabHtml);
  14366. return htmlString;
  14367. }
  14368. exports.convertMarkdownToHtml = convertMarkdownToHtml;
  14369.  
  14370.  
  14371. /***/ }),
  14372. /* 51 */
  14373. /***/ ((__unused_webpack_module, exports) => {
  14374.  
  14375. "use strict";
  14376.  
  14377. Object.defineProperty(exports, "__esModule", ({ value: true }));
  14378. exports.VarDescriptionComponent = void 0;
  14379. function VarDescriptionComponent(text) {
  14380. const varDescriptionHtml = `
  14381. <div class="gl-text-gray-500 pb-4 pt-0 mt-0">
  14382. ${text}
  14383. </div>`;
  14384. return $(varDescriptionHtml);
  14385. }
  14386. exports.VarDescriptionComponent = VarDescriptionComponent;
  14387.  
  14388.  
  14389. /***/ })
  14390. /******/ ]);
  14391. /************************************************************************/
  14392. /******/ // The module cache
  14393. /******/ var __webpack_module_cache__ = {};
  14394. /******/
  14395. /******/ // The require function
  14396. /******/ function __webpack_require__(moduleId) {
  14397. /******/ // Check if module is in cache
  14398. /******/ var cachedModule = __webpack_module_cache__[moduleId];
  14399. /******/ if (cachedModule !== undefined) {
  14400. /******/ return cachedModule.exports;
  14401. /******/ }
  14402. /******/ // Create a new module (and put it into the cache)
  14403. /******/ var module = __webpack_module_cache__[moduleId] = {
  14404. /******/ // no module.id needed
  14405. /******/ // no module.loaded needed
  14406. /******/ exports: {}
  14407. /******/ };
  14408. /******/
  14409. /******/ // Execute the module function
  14410. /******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  14411. /******/
  14412. /******/ // Return the exports of the module
  14413. /******/ return module.exports;
  14414. /******/ }
  14415. /******/
  14416. /************************************************************************/
  14417. /******/ /* webpack/runtime/define property getters */
  14418. /******/ (() => {
  14419. /******/ // define getter functions for harmony exports
  14420. /******/ __webpack_require__.d = (exports, definition) => {
  14421. /******/ for(var key in definition) {
  14422. /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
  14423. /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
  14424. /******/ }
  14425. /******/ }
  14426. /******/ };
  14427. /******/ })();
  14428. /******/
  14429. /******/ /* webpack/runtime/global */
  14430. /******/ (() => {
  14431. /******/ __webpack_require__.g = (function() {
  14432. /******/ if (typeof globalThis === 'object') return globalThis;
  14433. /******/ try {
  14434. /******/ return this || new Function('return this')();
  14435. /******/ } catch (e) {
  14436. /******/ if (typeof window === 'object') return window;
  14437. /******/ }
  14438. /******/ })();
  14439. /******/ })();
  14440. /******/
  14441. /******/ /* webpack/runtime/hasOwnProperty shorthand */
  14442. /******/ (() => {
  14443. /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
  14444. /******/ })();
  14445. /******/
  14446. /******/ /* webpack/runtime/make namespace object */
  14447. /******/ (() => {
  14448. /******/ // define __esModule on exports
  14449. /******/ __webpack_require__.r = (exports) => {
  14450. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  14451. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  14452. /******/ }
  14453. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  14454. /******/ };
  14455. /******/ })();
  14456. /******/
  14457. /************************************************************************/
  14458. /******/
  14459. /******/ // startup
  14460. /******/ // Load entry module and return exports
  14461. /******/ // This entry module is referenced by other modules so it can't be inlined
  14462. /******/ var __webpack_exports__ = __webpack_require__(14);
  14463. /******/
  14464. /******/ })()
  14465. ;

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址