Gitlab Schedule Duplicator

The [gs-duplicator] is a utility tool for GitLab that simplifies the duplication, creation, and updating of GitLab pipeline schedules. Its key features include cloning schedules with identical configurations, editing schedules using dropdown options derived from variable descriptions, and downloading schedule configurations as .env files for backup and transfer. The gs-duplicator aims to streamline and optimize the GitLab workflow, providing users with an efficient and user-friendly experience.

  1. // ==UserScript==
  2. // @name Gitlab Schedule Duplicator
  3. // @namespace https://github.com/tranphuquy19
  4. // @description The [gs-duplicator] is a utility tool for GitLab that simplifies the duplication, creation, and updating of GitLab pipeline schedules. Its key features include cloning schedules with identical configurations, editing schedules using dropdown options derived from variable descriptions, and downloading schedule configurations as .env files for backup and transfer. The gs-duplicator aims to streamline and optimize the GitLab workflow, providing users with an efficient and user-friendly experience.
  5. // @match https://gitlab.com/*/pipeline_schedules*
  6. // @match https://*.gitlab.com/*/pipeline_schedules*
  7. // @grant GM_addStyle
  8. // @grant GM_log
  9. // @run-at document-end
  10. // @supportURL https://github.com/tranphuquy19/gs-duplicator/issues
  11. // @license MIT
  12. // @author tranphuquy19
  13. // @version 1731698918162
  14. // ==/UserScript==
  15. /******/ (() => { // webpackBootstrap
  16. /******/ var __webpack_modules__ = ([
  17. /* 0 */
  18. /***/ ((__unused_webpack_module, exports) => {
  19.  
  20. "use strict";
  21.  
  22. var _a, _b;
  23. Object.defineProperty(exports, "__esModule", ({ value: true }));
  24. 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;
  25. const gitlabTokenLocalStorageKey = 'gitlab_token';
  26. exports.gitlabTokenLocalStorageKey = gitlabTokenLocalStorageKey;
  27. const gitlabUrl = document.location.origin;
  28. exports.gitlabUrl = gitlabUrl;
  29. const gitlabApiUrl = `${gitlabUrl}/api/v4`;
  30. exports.gitlabApiUrl = gitlabApiUrl;
  31. const gitlabGraphqlUrl = `${gitlabUrl}/api/graphql`;
  32. exports.gitlabGraphqlUrl = gitlabGraphqlUrl;
  33. const gitlabProjectId = ((_a = document.querySelector('#project_id')) === null || _a === void 0 ? void 0 : _a.value) ||
  34. ((_b = document.querySelector('body')) === null || _b === void 0 ? void 0 : _b.getAttribute('data-project-id'));
  35. exports.gitlabProjectId = gitlabProjectId;
  36. const gitlabToken = window.atob(localStorage.getItem(gitlabTokenLocalStorageKey) || '');
  37. exports.gitlabToken = gitlabToken;
  38. let includeAllVariables = false;
  39. exports.includeAllVariables = includeAllVariables;
  40. let gitlabSvgIconUrl = `/assets/icons-29e9caf34d9cc5889ea5f1dce460a0578cd14318aabc385b1fe54ce6069c9874.svg`;
  41. exports.gitlabSvgIconUrl = gitlabSvgIconUrl;
  42. let gitlabRestPerPage = 9999; // Number of items per page for REST API
  43. exports.gitlabRestPerPage = gitlabRestPerPage;
  44. let gitlabDefaultPipelineSchedule = {
  45. active: false,
  46. cron: '0 15 * * *',
  47. description: 'New pipeline schedule',
  48. cron_timezone: 'UTC',
  49. ref: 'main',
  50. };
  51. exports.gitlabDefaultPipelineSchedule = gitlabDefaultPipelineSchedule;
  52. let wrappedVarBy = '"';
  53. exports.wrappedVarBy = wrappedVarBy;
  54. let replaceEnterWithN = true;
  55. exports.replaceEnterWithN = replaceEnterWithN;
  56. let getTheOptionsFrom = 'merge_both'; // var_description, gitlab_variable_options, merge_both
  57. exports.getTheOptionsFrom = getTheOptionsFrom;
  58. let autoShowDropDown = true;
  59. exports.autoShowDropDown = autoShowDropDown;
  60. let enableMarkdownVarDescription = true;
  61. exports.enableMarkdownVarDescription = enableMarkdownVarDescription;
  62. let sortVarByName = true;
  63. exports.sortVarByName = sortVarByName;
  64. const gitlabToolSettingsLSKey = 'gitlab-tool-settings';
  65. const gitlabToolSettings = localStorage.getItem(gitlabToolSettingsLSKey);
  66. if (gitlabToolSettings === null) {
  67. localStorage.setItem(gitlabToolSettingsLSKey, JSON.stringify({
  68. gitlabDefaultPipelineSchedule,
  69. wrappedVarBy,
  70. gitlabSvgIconUrl,
  71. gitlabRestPerPage,
  72. includeAllVariables,
  73. getTheOptionsFrom,
  74. autoShowDropDown,
  75. enableMarkdownVarDescription,
  76. sortVarByName,
  77. replaceEnterWithN,
  78. }));
  79. }
  80. else {
  81. const settings = JSON.parse(gitlabToolSettings);
  82. exports.gitlabDefaultPipelineSchedule = gitlabDefaultPipelineSchedule = settings.gitlabDefaultPipelineSchedule;
  83. exports.wrappedVarBy = wrappedVarBy = settings.wrappedVarBy;
  84. exports.gitlabSvgIconUrl = gitlabSvgIconUrl = settings.gitlabSvgIconUrl;
  85. exports.gitlabRestPerPage = gitlabRestPerPage = settings.gitlabRestPerPage;
  86. exports.includeAllVariables = includeAllVariables = settings.includeAllVariables || false;
  87. exports.getTheOptionsFrom = getTheOptionsFrom = settings.getTheOptionsFrom || 'merge_both';
  88. exports.autoShowDropDown = autoShowDropDown = settings.autoShowDropDown || true;
  89. exports.enableMarkdownVarDescription = enableMarkdownVarDescription = settings.enableMarkdownVarDescription || true;
  90. exports.sortVarByName = sortVarByName = settings.sortVarByName || false;
  91. exports.replaceEnterWithN = replaceEnterWithN = settings.replaceEnterWithN || true;
  92. }
  93. const saveGitlabToken = (token) => {
  94. localStorage.setItem(gitlabTokenLocalStorageKey, window.btoa(token));
  95. };
  96. exports.saveGitlabToken = saveGitlabToken;
  97. const saveGitlabToolSettings = (settings) => {
  98. const oldSettings = JSON.parse(localStorage.getItem(gitlabToolSettingsLSKey) || '');
  99. const newSettings = Object.assign(Object.assign({}, oldSettings), settings);
  100. localStorage.setItem(gitlabToolSettingsLSKey, JSON.stringify(newSettings));
  101. };
  102. exports.saveGitlabToolSettings = saveGitlabToolSettings;
  103. exports["default"] = {
  104. gitlabTokenLocalStorageKey,
  105. gitlabUrl,
  106. gitlabApiUrl,
  107. gitlabGraphqlUrl,
  108. gitlabProjectId,
  109. gitlabToken,
  110. gitlabSvgIconUrl,
  111. gitlabRestPerPage,
  112. gitlabDefaultPipelineSchedule,
  113. wrappedVarBy,
  114. includeAllVariables,
  115. getTheOptionsFrom,
  116. autoShowDropDown,
  117. enableMarkdownVarDescription,
  118. sortVarByName,
  119. replaceEnterWithN,
  120. saveGitlabToken,
  121. saveGitlabToolSettings,
  122. };
  123.  
  124.  
  125. /***/ }),
  126. /* 1 */
  127. /***/ (function(module, exports) {
  128.  
  129. var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
  130. * 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
  131. * https://jquery.com/
  132. *
  133. * Copyright OpenJS Foundation and other contributors
  134. * Released under the MIT license
  135. * https://jquery.org/license
  136. *
  137. * Date: 2023-08-28T13:37Z
  138. */
  139. ( function( global, factory ) {
  140.  
  141. "use strict";
  142.  
  143. if ( true && typeof module.exports === "object" ) {
  144.  
  145. // For CommonJS and CommonJS-like environments where a proper `window`
  146. // is present, execute the factory and get jQuery.
  147. // For environments that do not have a `window` with a `document`
  148. // (such as Node.js), expose a factory as module.exports.
  149. // This accentuates the need for the creation of a real `window`.
  150. // e.g. var jQuery = require("jquery")(window);
  151. // See ticket trac-14549 for more info.
  152. module.exports = global.document ?
  153. factory( global, true ) :
  154. function( w ) {
  155. if ( !w.document ) {
  156. throw new Error( "jQuery requires a window with a document" );
  157. }
  158. return factory( w );
  159. };
  160. } else {
  161. factory( global );
  162. }
  163.  
  164. // Pass this if window is not defined yet
  165. } )( typeof window !== "undefined" ? window : this, function( window, noGlobal ) {
  166.  
  167. // Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1
  168. // throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode
  169. // arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), strict mode should be common
  170. // enough that all such attempts are guarded in a try block.
  171. "use strict";
  172.  
  173. var arr = [];
  174.  
  175. var getProto = Object.getPrototypeOf;
  176.  
  177. var slice = arr.slice;
  178.  
  179. var flat = arr.flat ? function( array ) {
  180. return arr.flat.call( array );
  181. } : function( array ) {
  182. return arr.concat.apply( [], array );
  183. };
  184.  
  185.  
  186. var push = arr.push;
  187.  
  188. var indexOf = arr.indexOf;
  189.  
  190. var class2type = {};
  191.  
  192. var toString = class2type.toString;
  193.  
  194. var hasOwn = class2type.hasOwnProperty;
  195.  
  196. var fnToString = hasOwn.toString;
  197.  
  198. var ObjectFunctionString = fnToString.call( Object );
  199.  
  200. var support = {};
  201.  
  202. var isFunction = function isFunction( obj ) {
  203.  
  204. // Support: Chrome <=57, Firefox <=52
  205. // In some browsers, typeof returns "function" for HTML <object> elements
  206. // (i.e., `typeof document.createElement( "object" ) === "function"`).
  207. // We don't want to classify *any* DOM node as a function.
  208. // Support: QtWeb <=3.8.5, WebKit <=534.34, wkhtmltopdf tool <=0.12.5
  209. // Plus for old WebKit, typeof returns "function" for HTML collections
  210. // (e.g., `typeof document.getElementsByTagName("div") === "function"`). (gh-4756)
  211. return typeof obj === "function" && typeof obj.nodeType !== "number" &&
  212. typeof obj.item !== "function";
  213. };
  214.  
  215.  
  216. var isWindow = function isWindow( obj ) {
  217. return obj != null && obj === obj.window;
  218. };
  219.  
  220.  
  221. var document = window.document;
  222.  
  223.  
  224.  
  225. var preservedScriptAttributes = {
  226. type: true,
  227. src: true,
  228. nonce: true,
  229. noModule: true
  230. };
  231.  
  232. function DOMEval( code, node, doc ) {
  233. doc = doc || document;
  234.  
  235. var i, val,
  236. script = doc.createElement( "script" );
  237.  
  238. script.text = code;
  239. if ( node ) {
  240. for ( i in preservedScriptAttributes ) {
  241.  
  242. // Support: Firefox 64+, Edge 18+
  243. // Some browsers don't support the "nonce" property on scripts.
  244. // On the other hand, just using `getAttribute` is not enough as
  245. // the `nonce` attribute is reset to an empty string whenever it
  246. // becomes browsing-context connected.
  247. // See https://github.com/whatwg/html/issues/2369
  248. // See https://html.spec.whatwg.org/#nonce-attributes
  249. // The `node.getAttribute` check was added for the sake of
  250. // `jQuery.globalEval` so that it can fake a nonce-containing node
  251. // via an object.
  252. val = node[ i ] || node.getAttribute && node.getAttribute( i );
  253. if ( val ) {
  254. script.setAttribute( i, val );
  255. }
  256. }
  257. }
  258. doc.head.appendChild( script ).parentNode.removeChild( script );
  259. }
  260.  
  261.  
  262. function toType( obj ) {
  263. if ( obj == null ) {
  264. return obj + "";
  265. }
  266.  
  267. // Support: Android <=2.3 only (functionish RegExp)
  268. return typeof obj === "object" || typeof obj === "function" ?
  269. class2type[ toString.call( obj ) ] || "object" :
  270. typeof obj;
  271. }
  272. /* global Symbol */
  273. // Defining this global in .eslintrc.json would create a danger of using the global
  274. // unguarded in another place, it seems safer to define global only for this module
  275.  
  276.  
  277.  
  278. 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",
  279.  
  280. rhtmlSuffix = /HTML$/i,
  281.  
  282. // Define a local copy of jQuery
  283. jQuery = function( selector, context ) {
  284.  
  285. // The jQuery object is actually just the init constructor 'enhanced'
  286. // Need init if jQuery is called (just allow error to be thrown if not included)
  287. return new jQuery.fn.init( selector, context );
  288. };
  289.  
  290. jQuery.fn = jQuery.prototype = {
  291.  
  292. // The current version of jQuery being used
  293. jquery: version,
  294.  
  295. constructor: jQuery,
  296.  
  297. // The default length of a jQuery object is 0
  298. length: 0,
  299.  
  300. toArray: function() {
  301. return slice.call( this );
  302. },
  303.  
  304. // Get the Nth element in the matched element set OR
  305. // Get the whole matched element set as a clean array
  306. get: function( num ) {
  307.  
  308. // Return all the elements in a clean array
  309. if ( num == null ) {
  310. return slice.call( this );
  311. }
  312.  
  313. // Return just the one element from the set
  314. return num < 0 ? this[ num + this.length ] : this[ num ];
  315. },
  316.  
  317. // Take an array of elements and push it onto the stack
  318. // (returning the new matched element set)
  319. pushStack: function( elems ) {
  320.  
  321. // Build a new jQuery matched element set
  322. var ret = jQuery.merge( this.constructor(), elems );
  323.  
  324. // Add the old object onto the stack (as a reference)
  325. ret.prevObject = this;
  326.  
  327. // Return the newly-formed element set
  328. return ret;
  329. },
  330.  
  331. // Execute a callback for every element in the matched set.
  332. each: function( callback ) {
  333. return jQuery.each( this, callback );
  334. },
  335.  
  336. map: function( callback ) {
  337. return this.pushStack( jQuery.map( this, function( elem, i ) {
  338. return callback.call( elem, i, elem );
  339. } ) );
  340. },
  341.  
  342. slice: function() {
  343. return this.pushStack( slice.apply( this, arguments ) );
  344. },
  345.  
  346. first: function() {
  347. return this.eq( 0 );
  348. },
  349.  
  350. last: function() {
  351. return this.eq( -1 );
  352. },
  353.  
  354. even: function() {
  355. return this.pushStack( jQuery.grep( this, function( _elem, i ) {
  356. return ( i + 1 ) % 2;
  357. } ) );
  358. },
  359.  
  360. odd: function() {
  361. return this.pushStack( jQuery.grep( this, function( _elem, i ) {
  362. return i % 2;
  363. } ) );
  364. },
  365.  
  366. eq: function( i ) {
  367. var len = this.length,
  368. j = +i + ( i < 0 ? len : 0 );
  369. return this.pushStack( j >= 0 && j < len ? [ this[ j ] ] : [] );
  370. },
  371.  
  372. end: function() {
  373. return this.prevObject || this.constructor();
  374. },
  375.  
  376. // For internal use only.
  377. // Behaves like an Array's method, not like a jQuery method.
  378. push: push,
  379. sort: arr.sort,
  380. splice: arr.splice
  381. };
  382.  
  383. jQuery.extend = jQuery.fn.extend = function() {
  384. var options, name, src, copy, copyIsArray, clone,
  385. target = arguments[ 0 ] || {},
  386. i = 1,
  387. length = arguments.length,
  388. deep = false;
  389.  
  390. // Handle a deep copy situation
  391. if ( typeof target === "boolean" ) {
  392. deep = target;
  393.  
  394. // Skip the boolean and the target
  395. target = arguments[ i ] || {};
  396. i++;
  397. }
  398.  
  399. // Handle case when target is a string or something (possible in deep copy)
  400. if ( typeof target !== "object" && !isFunction( target ) ) {
  401. target = {};
  402. }
  403.  
  404. // Extend jQuery itself if only one argument is passed
  405. if ( i === length ) {
  406. target = this;
  407. i--;
  408. }
  409.  
  410. for ( ; i < length; i++ ) {
  411.  
  412. // Only deal with non-null/undefined values
  413. if ( ( options = arguments[ i ] ) != null ) {
  414.  
  415. // Extend the base object
  416. for ( name in options ) {
  417. copy = options[ name ];
  418.  
  419. // Prevent Object.prototype pollution
  420. // Prevent never-ending loop
  421. if ( name === "__proto__" || target === copy ) {
  422. continue;
  423. }
  424.  
  425. // Recurse if we're merging plain objects or arrays
  426. if ( deep && copy && ( jQuery.isPlainObject( copy ) ||
  427. ( copyIsArray = Array.isArray( copy ) ) ) ) {
  428. src = target[ name ];
  429.  
  430. // Ensure proper type for the source value
  431. if ( copyIsArray && !Array.isArray( src ) ) {
  432. clone = [];
  433. } else if ( !copyIsArray && !jQuery.isPlainObject( src ) ) {
  434. clone = {};
  435. } else {
  436. clone = src;
  437. }
  438. copyIsArray = false;
  439.  
  440. // Never move original objects, clone them
  441. target[ name ] = jQuery.extend( deep, clone, copy );
  442.  
  443. // Don't bring in undefined values
  444. } else if ( copy !== undefined ) {
  445. target[ name ] = copy;
  446. }
  447. }
  448. }
  449. }
  450.  
  451. // Return the modified object
  452. return target;
  453. };
  454.  
  455. jQuery.extend( {
  456.  
  457. // Unique for each copy of jQuery on the page
  458. expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ),
  459.  
  460. // Assume jQuery is ready without the ready module
  461. isReady: true,
  462.  
  463. error: function( msg ) {
  464. throw new Error( msg );
  465. },
  466.  
  467. noop: function() {},
  468.  
  469. isPlainObject: function( obj ) {
  470. var proto, Ctor;
  471.  
  472. // Detect obvious negatives
  473. // Use toString instead of jQuery.type to catch host objects
  474. if ( !obj || toString.call( obj ) !== "[object Object]" ) {
  475. return false;
  476. }
  477.  
  478. proto = getProto( obj );
  479.  
  480. // Objects with no prototype (e.g., `Object.create( null )`) are plain
  481. if ( !proto ) {
  482. return true;
  483. }
  484.  
  485. // Objects with prototype are plain iff they were constructed by a global Object function
  486. Ctor = hasOwn.call( proto, "constructor" ) && proto.constructor;
  487. return typeof Ctor === "function" && fnToString.call( Ctor ) === ObjectFunctionString;
  488. },
  489.  
  490. isEmptyObject: function( obj ) {
  491. var name;
  492.  
  493. for ( name in obj ) {
  494. return false;
  495. }
  496. return true;
  497. },
  498.  
  499. // Evaluates a script in a provided context; falls back to the global one
  500. // if not specified.
  501. globalEval: function( code, options, doc ) {
  502. DOMEval( code, { nonce: options && options.nonce }, doc );
  503. },
  504.  
  505. each: function( obj, callback ) {
  506. var length, i = 0;
  507.  
  508. if ( isArrayLike( obj ) ) {
  509. length = obj.length;
  510. for ( ; i < length; i++ ) {
  511. if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
  512. break;
  513. }
  514. }
  515. } else {
  516. for ( i in obj ) {
  517. if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
  518. break;
  519. }
  520. }
  521. }
  522.  
  523. return obj;
  524. },
  525.  
  526.  
  527. // Retrieve the text value of an array of DOM nodes
  528. text: function( elem ) {
  529. var node,
  530. ret = "",
  531. i = 0,
  532. nodeType = elem.nodeType;
  533.  
  534. if ( !nodeType ) {
  535.  
  536. // If no nodeType, this is expected to be an array
  537. while ( ( node = elem[ i++ ] ) ) {
  538.  
  539. // Do not traverse comment nodes
  540. ret += jQuery.text( node );
  541. }
  542. }
  543. if ( nodeType === 1 || nodeType === 11 ) {
  544. return elem.textContent;
  545. }
  546. if ( nodeType === 9 ) {
  547. return elem.documentElement.textContent;
  548. }
  549. if ( nodeType === 3 || nodeType === 4 ) {
  550. return elem.nodeValue;
  551. }
  552.  
  553. // Do not include comment or processing instruction nodes
  554.  
  555. return ret;
  556. },
  557.  
  558. // results is for internal usage only
  559. makeArray: function( arr, results ) {
  560. var ret = results || [];
  561.  
  562. if ( arr != null ) {
  563. if ( isArrayLike( Object( arr ) ) ) {
  564. jQuery.merge( ret,
  565. typeof arr === "string" ?
  566. [ arr ] : arr
  567. );
  568. } else {
  569. push.call( ret, arr );
  570. }
  571. }
  572.  
  573. return ret;
  574. },
  575.  
  576. inArray: function( elem, arr, i ) {
  577. return arr == null ? -1 : indexOf.call( arr, elem, i );
  578. },
  579.  
  580. isXMLDoc: function( elem ) {
  581. var namespace = elem && elem.namespaceURI,
  582. docElem = elem && ( elem.ownerDocument || elem ).documentElement;
  583.  
  584. // Assume HTML when documentElement doesn't yet exist, such as inside
  585. // document fragments.
  586. return !rhtmlSuffix.test( namespace || docElem && docElem.nodeName || "HTML" );
  587. },
  588.  
  589. // Support: Android <=4.0 only, PhantomJS 1 only
  590. // push.apply(_, arraylike) throws on ancient WebKit
  591. merge: function( first, second ) {
  592. var len = +second.length,
  593. j = 0,
  594. i = first.length;
  595.  
  596. for ( ; j < len; j++ ) {
  597. first[ i++ ] = second[ j ];
  598. }
  599.  
  600. first.length = i;
  601.  
  602. return first;
  603. },
  604.  
  605. grep: function( elems, callback, invert ) {
  606. var callbackInverse,
  607. matches = [],
  608. i = 0,
  609. length = elems.length,
  610. callbackExpect = !invert;
  611.  
  612. // Go through the array, only saving the items
  613. // that pass the validator function
  614. for ( ; i < length; i++ ) {
  615. callbackInverse = !callback( elems[ i ], i );
  616. if ( callbackInverse !== callbackExpect ) {
  617. matches.push( elems[ i ] );
  618. }
  619. }
  620.  
  621. return matches;
  622. },
  623.  
  624. // arg is for internal usage only
  625. map: function( elems, callback, arg ) {
  626. var length, value,
  627. i = 0,
  628. ret = [];
  629.  
  630. // Go through the array, translating each of the items to their new values
  631. if ( isArrayLike( elems ) ) {
  632. length = elems.length;
  633. for ( ; i < length; i++ ) {
  634. value = callback( elems[ i ], i, arg );
  635.  
  636. if ( value != null ) {
  637. ret.push( value );
  638. }
  639. }
  640.  
  641. // Go through every key on the object,
  642. } else {
  643. for ( i in elems ) {
  644. value = callback( elems[ i ], i, arg );
  645.  
  646. if ( value != null ) {
  647. ret.push( value );
  648. }
  649. }
  650. }
  651.  
  652. // Flatten any nested arrays
  653. return flat( ret );
  654. },
  655.  
  656. // A global GUID counter for objects
  657. guid: 1,
  658.  
  659. // jQuery.support is not used in Core but other projects attach their
  660. // properties to it so it needs to exist.
  661. support: support
  662. } );
  663.  
  664. if ( typeof Symbol === "function" ) {
  665. jQuery.fn[ Symbol.iterator ] = arr[ Symbol.iterator ];
  666. }
  667.  
  668. // Populate the class2type map
  669. jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ),
  670. function( _i, name ) {
  671. class2type[ "[object " + name + "]" ] = name.toLowerCase();
  672. } );
  673.  
  674. function isArrayLike( obj ) {
  675.  
  676. // Support: real iOS 8.2 only (not reproducible in simulator)
  677. // `in` check used to prevent JIT error (gh-2145)
  678. // hasOwn isn't used here due to false negatives
  679. // regarding Nodelist length in IE
  680. var length = !!obj && "length" in obj && obj.length,
  681. type = toType( obj );
  682.  
  683. if ( isFunction( obj ) || isWindow( obj ) ) {
  684. return false;
  685. }
  686.  
  687. return type === "array" || length === 0 ||
  688. typeof length === "number" && length > 0 && ( length - 1 ) in obj;
  689. }
  690.  
  691.  
  692. function nodeName( elem, name ) {
  693.  
  694. return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
  695.  
  696. }
  697. var pop = arr.pop;
  698.  
  699.  
  700. var sort = arr.sort;
  701.  
  702.  
  703. var splice = arr.splice;
  704.  
  705.  
  706. var whitespace = "[\\x20\\t\\r\\n\\f]";
  707.  
  708.  
  709. var rtrimCSS = new RegExp(
  710. "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$",
  711. "g"
  712. );
  713.  
  714.  
  715.  
  716.  
  717. // Note: an element does not contain itself
  718. jQuery.contains = function( a, b ) {
  719. var bup = b && b.parentNode;
  720.  
  721. return a === bup || !!( bup && bup.nodeType === 1 && (
  722.  
  723. // Support: IE 9 - 11+
  724. // IE doesn't have `contains` on SVG.
  725. a.contains ?
  726. a.contains( bup ) :
  727. a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16
  728. ) );
  729. };
  730.  
  731.  
  732.  
  733.  
  734. // CSS string/identifier serialization
  735. // https://drafts.csswg.org/cssom/#common-serializing-idioms
  736. var rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\x80-\uFFFF\w-]/g;
  737.  
  738. function fcssescape( ch, asCodePoint ) {
  739. if ( asCodePoint ) {
  740.  
  741. // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER
  742. if ( ch === "\0" ) {
  743. return "\uFFFD";
  744. }
  745.  
  746. // Control characters and (dependent upon position) numbers get escaped as code points
  747. return ch.slice( 0, -1 ) + "\\" + ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " ";
  748. }
  749.  
  750. // Other potentially-special ASCII characters get backslash-escaped
  751. return "\\" + ch;
  752. }
  753.  
  754. jQuery.escapeSelector = function( sel ) {
  755. return ( sel + "" ).replace( rcssescape, fcssescape );
  756. };
  757.  
  758.  
  759.  
  760.  
  761. var preferredDoc = document,
  762. pushNative = push;
  763.  
  764. ( function() {
  765.  
  766. var i,
  767. Expr,
  768. outermostContext,
  769. sortInput,
  770. hasDuplicate,
  771. push = pushNative,
  772.  
  773. // Local document vars
  774. document,
  775. documentElement,
  776. documentIsHTML,
  777. rbuggyQSA,
  778. matches,
  779.  
  780. // Instance-specific data
  781. expando = jQuery.expando,
  782. dirruns = 0,
  783. done = 0,
  784. classCache = createCache(),
  785. tokenCache = createCache(),
  786. compilerCache = createCache(),
  787. nonnativeSelectorCache = createCache(),
  788. sortOrder = function( a, b ) {
  789. if ( a === b ) {
  790. hasDuplicate = true;
  791. }
  792. return 0;
  793. },
  794.  
  795. booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|" +
  796. "loop|multiple|open|readonly|required|scoped",
  797.  
  798. // Regular expressions
  799.  
  800. // https://www.w3.org/TR/css-syntax-3/#ident-token-diagram
  801. identifier = "(?:\\\\[\\da-fA-F]{1,6}" + whitespace +
  802. "?|\\\\[^\\r\\n\\f]|[\\w-]|[^\0-\\x7f])+",
  803.  
  804. // Attribute selectors: https://www.w3.org/TR/selectors/#attribute-selectors
  805. attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace +
  806.  
  807. // Operator (capture 2)
  808. "*([*^$|!~]?=)" + whitespace +
  809.  
  810. // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]"
  811. "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" +
  812. whitespace + "*\\]",
  813.  
  814. pseudos = ":(" + identifier + ")(?:\\((" +
  815.  
  816. // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments:
  817. // 1. quoted (capture 3; capture 4 or capture 5)
  818. "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" +
  819.  
  820. // 2. simple (capture 6)
  821. "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" +
  822.  
  823. // 3. anything else (capture 2)
  824. ".*" +
  825. ")\\)|)",
  826.  
  827. // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
  828. rwhitespace = new RegExp( whitespace + "+", "g" ),
  829.  
  830. rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ),
  831. rleadingCombinator = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" +
  832. whitespace + "*" ),
  833. rdescend = new RegExp( whitespace + "|>" ),
  834.  
  835. rpseudo = new RegExp( pseudos ),
  836. ridentifier = new RegExp( "^" + identifier + "$" ),
  837.  
  838. matchExpr = {
  839. ID: new RegExp( "^#(" + identifier + ")" ),
  840. CLASS: new RegExp( "^\\.(" + identifier + ")" ),
  841. TAG: new RegExp( "^(" + identifier + "|[*])" ),
  842. ATTR: new RegExp( "^" + attributes ),
  843. PSEUDO: new RegExp( "^" + pseudos ),
  844. CHILD: new RegExp(
  845. "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" +
  846. whitespace + "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" +
  847. whitespace + "*(\\d+)|))" + whitespace + "*\\)|)", "i" ),
  848. bool: new RegExp( "^(?:" + booleans + ")$", "i" ),
  849.  
  850. // For use in libraries implementing .is()
  851. // We use this for POS matching in `select`
  852. needsContext: new RegExp( "^" + whitespace +
  853. "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + whitespace +
  854. "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" )
  855. },
  856.  
  857. rinputs = /^(?:input|select|textarea|button)$/i,
  858. rheader = /^h\d$/i,
  859.  
  860. // Easily-parseable/retrievable ID or TAG or CLASS selectors
  861. rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
  862.  
  863. rsibling = /[+~]/,
  864.  
  865. // CSS escapes
  866. // https://www.w3.org/TR/CSS21/syndata.html#escaped-characters
  867. runescape = new RegExp( "\\\\[\\da-fA-F]{1,6}" + whitespace +
  868. "?|\\\\([^\\r\\n\\f])", "g" ),
  869. funescape = function( escape, nonHex ) {
  870. var high = "0x" + escape.slice( 1 ) - 0x10000;
  871.  
  872. if ( nonHex ) {
  873.  
  874. // Strip the backslash prefix from a non-hex escape sequence
  875. return nonHex;
  876. }
  877.  
  878. // Replace a hexadecimal escape sequence with the encoded Unicode code point
  879. // Support: IE <=11+
  880. // For values outside the Basic Multilingual Plane (BMP), manually construct a
  881. // surrogate pair
  882. return high < 0 ?
  883. String.fromCharCode( high + 0x10000 ) :
  884. String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 );
  885. },
  886.  
  887. // Used for iframes; see `setDocument`.
  888. // Support: IE 9 - 11+, Edge 12 - 18+
  889. // Removing the function wrapper causes a "Permission Denied"
  890. // error in IE/Edge.
  891. unloadHandler = function() {
  892. setDocument();
  893. },
  894.  
  895. inDisabledFieldset = addCombinator(
  896. function( elem ) {
  897. return elem.disabled === true && nodeName( elem, "fieldset" );
  898. },
  899. { dir: "parentNode", next: "legend" }
  900. );
  901.  
  902. // Support: IE <=9 only
  903. // Accessing document.activeElement can throw unexpectedly
  904. // https://bugs.jquery.com/ticket/13393
  905. function safeActiveElement() {
  906. try {
  907. return document.activeElement;
  908. } catch ( err ) { }
  909. }
  910.  
  911. // Optimize for push.apply( _, NodeList )
  912. try {
  913. push.apply(
  914. ( arr = slice.call( preferredDoc.childNodes ) ),
  915. preferredDoc.childNodes
  916. );
  917.  
  918. // Support: Android <=4.0
  919. // Detect silently failing push.apply
  920. // eslint-disable-next-line no-unused-expressions
  921. arr[ preferredDoc.childNodes.length ].nodeType;
  922. } catch ( e ) {
  923. push = {
  924. apply: function( target, els ) {
  925. pushNative.apply( target, slice.call( els ) );
  926. },
  927. call: function( target ) {
  928. pushNative.apply( target, slice.call( arguments, 1 ) );
  929. }
  930. };
  931. }
  932.  
  933. function find( selector, context, results, seed ) {
  934. var m, i, elem, nid, match, groups, newSelector,
  935. newContext = context && context.ownerDocument,
  936.  
  937. // nodeType defaults to 9, since context defaults to document
  938. nodeType = context ? context.nodeType : 9;
  939.  
  940. results = results || [];
  941.  
  942. // Return early from calls with invalid selector or context
  943. if ( typeof selector !== "string" || !selector ||
  944. nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) {
  945.  
  946. return results;
  947. }
  948.  
  949. // Try to shortcut find operations (as opposed to filters) in HTML documents
  950. if ( !seed ) {
  951. setDocument( context );
  952. context = context || document;
  953.  
  954. if ( documentIsHTML ) {
  955.  
  956. // If the selector is sufficiently simple, try using a "get*By*" DOM method
  957. // (excepting DocumentFragment context, where the methods don't exist)
  958. if ( nodeType !== 11 && ( match = rquickExpr.exec( selector ) ) ) {
  959.  
  960. // ID selector
  961. if ( ( m = match[ 1 ] ) ) {
  962.  
  963. // Document context
  964. if ( nodeType === 9 ) {
  965. if ( ( elem = context.getElementById( m ) ) ) {
  966.  
  967. // Support: IE 9 only
  968. // getElementById can match elements by name instead of ID
  969. if ( elem.id === m ) {
  970. push.call( results, elem );
  971. return results;
  972. }
  973. } else {
  974. return results;
  975. }
  976.  
  977. // Element context
  978. } else {
  979.  
  980. // Support: IE 9 only
  981. // getElementById can match elements by name instead of ID
  982. if ( newContext && ( elem = newContext.getElementById( m ) ) &&
  983. find.contains( context, elem ) &&
  984. elem.id === m ) {
  985.  
  986. push.call( results, elem );
  987. return results;
  988. }
  989. }
  990.  
  991. // Type selector
  992. } else if ( match[ 2 ] ) {
  993. push.apply( results, context.getElementsByTagName( selector ) );
  994. return results;
  995.  
  996. // Class selector
  997. } else if ( ( m = match[ 3 ] ) && context.getElementsByClassName ) {
  998. push.apply( results, context.getElementsByClassName( m ) );
  999. return results;
  1000. }
  1001. }
  1002.  
  1003. // Take advantage of querySelectorAll
  1004. if ( !nonnativeSelectorCache[ selector + " " ] &&
  1005. ( !rbuggyQSA || !rbuggyQSA.test( selector ) ) ) {
  1006.  
  1007. newSelector = selector;
  1008. newContext = context;
  1009.  
  1010. // qSA considers elements outside a scoping root when evaluating child or
  1011. // descendant combinators, which is not what we want.
  1012. // In such cases, we work around the behavior by prefixing every selector in the
  1013. // list with an ID selector referencing the scope context.
  1014. // The technique has to be used as well when a leading combinator is used
  1015. // as such selectors are not recognized by querySelectorAll.
  1016. // Thanks to Andrew Dupont for this technique.
  1017. if ( nodeType === 1 &&
  1018. ( rdescend.test( selector ) || rleadingCombinator.test( selector ) ) ) {
  1019.  
  1020. // Expand context for sibling selectors
  1021. newContext = rsibling.test( selector ) && testContext( context.parentNode ) ||
  1022. context;
  1023.  
  1024. // We can use :scope instead of the ID hack if the browser
  1025. // supports it & if we're not changing the context.
  1026. // Support: IE 11+, Edge 17 - 18+
  1027. // IE/Edge sometimes throw a "Permission denied" error when
  1028. // strict-comparing two documents; shallow comparisons work.
  1029. // eslint-disable-next-line eqeqeq
  1030. if ( newContext != context || !support.scope ) {
  1031.  
  1032. // Capture the context ID, setting it first if necessary
  1033. if ( ( nid = context.getAttribute( "id" ) ) ) {
  1034. nid = jQuery.escapeSelector( nid );
  1035. } else {
  1036. context.setAttribute( "id", ( nid = expando ) );
  1037. }
  1038. }
  1039.  
  1040. // Prefix every selector in the list
  1041. groups = tokenize( selector );
  1042. i = groups.length;
  1043. while ( i-- ) {
  1044. groups[ i ] = ( nid ? "#" + nid : ":scope" ) + " " +
  1045. toSelector( groups[ i ] );
  1046. }
  1047. newSelector = groups.join( "," );
  1048. }
  1049.  
  1050. try {
  1051. push.apply( results,
  1052. newContext.querySelectorAll( newSelector )
  1053. );
  1054. return results;
  1055. } catch ( qsaError ) {
  1056. nonnativeSelectorCache( selector, true );
  1057. } finally {
  1058. if ( nid === expando ) {
  1059. context.removeAttribute( "id" );
  1060. }
  1061. }
  1062. }
  1063. }
  1064. }
  1065.  
  1066. // All others
  1067. return select( selector.replace( rtrimCSS, "$1" ), context, results, seed );
  1068. }
  1069.  
  1070. /**
  1071. * Create key-value caches of limited size
  1072. * @returns {function(string, object)} Returns the Object data after storing it on itself with
  1073. * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)
  1074. * deleting the oldest entry
  1075. */
  1076. function createCache() {
  1077. var keys = [];
  1078.  
  1079. function cache( key, value ) {
  1080.  
  1081. // Use (key + " ") to avoid collision with native prototype properties
  1082. // (see https://github.com/jquery/sizzle/issues/157)
  1083. if ( keys.push( key + " " ) > Expr.cacheLength ) {
  1084.  
  1085. // Only keep the most recent entries
  1086. delete cache[ keys.shift() ];
  1087. }
  1088. return ( cache[ key + " " ] = value );
  1089. }
  1090. return cache;
  1091. }
  1092.  
  1093. /**
  1094. * Mark a function for special use by jQuery selector module
  1095. * @param {Function} fn The function to mark
  1096. */
  1097. function markFunction( fn ) {
  1098. fn[ expando ] = true;
  1099. return fn;
  1100. }
  1101.  
  1102. /**
  1103. * Support testing using an element
  1104. * @param {Function} fn Passed the created element and returns a boolean result
  1105. */
  1106. function assert( fn ) {
  1107. var el = document.createElement( "fieldset" );
  1108.  
  1109. try {
  1110. return !!fn( el );
  1111. } catch ( e ) {
  1112. return false;
  1113. } finally {
  1114.  
  1115. // Remove from its parent by default
  1116. if ( el.parentNode ) {
  1117. el.parentNode.removeChild( el );
  1118. }
  1119.  
  1120. // release memory in IE
  1121. el = null;
  1122. }
  1123. }
  1124.  
  1125. /**
  1126. * Returns a function to use in pseudos for input types
  1127. * @param {String} type
  1128. */
  1129. function createInputPseudo( type ) {
  1130. return function( elem ) {
  1131. return nodeName( elem, "input" ) && elem.type === type;
  1132. };
  1133. }
  1134.  
  1135. /**
  1136. * Returns a function to use in pseudos for buttons
  1137. * @param {String} type
  1138. */
  1139. function createButtonPseudo( type ) {
  1140. return function( elem ) {
  1141. return ( nodeName( elem, "input" ) || nodeName( elem, "button" ) ) &&
  1142. elem.type === type;
  1143. };
  1144. }
  1145.  
  1146. /**
  1147. * Returns a function to use in pseudos for :enabled/:disabled
  1148. * @param {Boolean} disabled true for :disabled; false for :enabled
  1149. */
  1150. function createDisabledPseudo( disabled ) {
  1151.  
  1152. // Known :disabled false positives: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable
  1153. return function( elem ) {
  1154.  
  1155. // Only certain elements can match :enabled or :disabled
  1156. // https://html.spec.whatwg.org/multipage/scripting.html#selector-enabled
  1157. // https://html.spec.whatwg.org/multipage/scripting.html#selector-disabled
  1158. if ( "form" in elem ) {
  1159.  
  1160. // Check for inherited disabledness on relevant non-disabled elements:
  1161. // * listed form-associated elements in a disabled fieldset
  1162. // https://html.spec.whatwg.org/multipage/forms.html#category-listed
  1163. // https://html.spec.whatwg.org/multipage/forms.html#concept-fe-disabled
  1164. // * option elements in a disabled optgroup
  1165. // https://html.spec.whatwg.org/multipage/forms.html#concept-option-disabled
  1166. // All such elements have a "form" property.
  1167. if ( elem.parentNode && elem.disabled === false ) {
  1168.  
  1169. // Option elements defer to a parent optgroup if present
  1170. if ( "label" in elem ) {
  1171. if ( "label" in elem.parentNode ) {
  1172. return elem.parentNode.disabled === disabled;
  1173. } else {
  1174. return elem.disabled === disabled;
  1175. }
  1176. }
  1177.  
  1178. // Support: IE 6 - 11+
  1179. // Use the isDisabled shortcut property to check for disabled fieldset ancestors
  1180. return elem.isDisabled === disabled ||
  1181.  
  1182. // Where there is no isDisabled, check manually
  1183. elem.isDisabled !== !disabled &&
  1184. inDisabledFieldset( elem ) === disabled;
  1185. }
  1186.  
  1187. return elem.disabled === disabled;
  1188.  
  1189. // Try to winnow out elements that can't be disabled before trusting the disabled property.
  1190. // Some victims get caught in our net (label, legend, menu, track), but it shouldn't
  1191. // even exist on them, let alone have a boolean value.
  1192. } else if ( "label" in elem ) {
  1193. return elem.disabled === disabled;
  1194. }
  1195.  
  1196. // Remaining elements are neither :enabled nor :disabled
  1197. return false;
  1198. };
  1199. }
  1200.  
  1201. /**
  1202. * Returns a function to use in pseudos for positionals
  1203. * @param {Function} fn
  1204. */
  1205. function createPositionalPseudo( fn ) {
  1206. return markFunction( function( argument ) {
  1207. argument = +argument;
  1208. return markFunction( function( seed, matches ) {
  1209. var j,
  1210. matchIndexes = fn( [], seed.length, argument ),
  1211. i = matchIndexes.length;
  1212.  
  1213. // Match elements found at the specified indexes
  1214. while ( i-- ) {
  1215. if ( seed[ ( j = matchIndexes[ i ] ) ] ) {
  1216. seed[ j ] = !( matches[ j ] = seed[ j ] );
  1217. }
  1218. }
  1219. } );
  1220. } );
  1221. }
  1222.  
  1223. /**
  1224. * Checks a node for validity as a jQuery selector context
  1225. * @param {Element|Object=} context
  1226. * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value
  1227. */
  1228. function testContext( context ) {
  1229. return context && typeof context.getElementsByTagName !== "undefined" && context;
  1230. }
  1231.  
  1232. /**
  1233. * Sets document-related variables once based on the current document
  1234. * @param {Element|Object} [node] An element or document object to use to set the document
  1235. * @returns {Object} Returns the current document
  1236. */
  1237. function setDocument( node ) {
  1238. var subWindow,
  1239. doc = node ? node.ownerDocument || node : preferredDoc;
  1240.  
  1241. // Return early if doc is invalid or already selected
  1242. // Support: IE 11+, Edge 17 - 18+
  1243. // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
  1244. // two documents; shallow comparisons work.
  1245. // eslint-disable-next-line eqeqeq
  1246. if ( doc == document || doc.nodeType !== 9 || !doc.documentElement ) {
  1247. return document;
  1248. }
  1249.  
  1250. // Update global variables
  1251. document = doc;
  1252. documentElement = document.documentElement;
  1253. documentIsHTML = !jQuery.isXMLDoc( document );
  1254.  
  1255. // Support: iOS 7 only, IE 9 - 11+
  1256. // Older browsers didn't support unprefixed `matches`.
  1257. matches = documentElement.matches ||
  1258. documentElement.webkitMatchesSelector ||
  1259. documentElement.msMatchesSelector;
  1260.  
  1261. // Support: IE 9 - 11+, Edge 12 - 18+
  1262. // Accessing iframe documents after unload throws "permission denied" errors
  1263. // (see trac-13936).
  1264. // Limit the fix to IE & Edge Legacy; despite Edge 15+ implementing `matches`,
  1265. // all IE 9+ and Edge Legacy versions implement `msMatchesSelector` as well.
  1266. if ( documentElement.msMatchesSelector &&
  1267.  
  1268. // Support: IE 11+, Edge 17 - 18+
  1269. // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
  1270. // two documents; shallow comparisons work.
  1271. // eslint-disable-next-line eqeqeq
  1272. preferredDoc != document &&
  1273. ( subWindow = document.defaultView ) && subWindow.top !== subWindow ) {
  1274.  
  1275. // Support: IE 9 - 11+, Edge 12 - 18+
  1276. subWindow.addEventListener( "unload", unloadHandler );
  1277. }
  1278.  
  1279. // Support: IE <10
  1280. // Check if getElementById returns elements by name
  1281. // The broken getElementById methods don't pick up programmatically-set names,
  1282. // so use a roundabout getElementsByName test
  1283. support.getById = assert( function( el ) {
  1284. documentElement.appendChild( el ).id = jQuery.expando;
  1285. return !document.getElementsByName ||
  1286. !document.getElementsByName( jQuery.expando ).length;
  1287. } );
  1288.  
  1289. // Support: IE 9 only
  1290. // Check to see if it's possible to do matchesSelector
  1291. // on a disconnected node.
  1292. support.disconnectedMatch = assert( function( el ) {
  1293. return matches.call( el, "*" );
  1294. } );
  1295.  
  1296. // Support: IE 9 - 11+, Edge 12 - 18+
  1297. // IE/Edge don't support the :scope pseudo-class.
  1298. support.scope = assert( function() {
  1299. return document.querySelectorAll( ":scope" );
  1300. } );
  1301.  
  1302. // Support: Chrome 105 - 111 only, Safari 15.4 - 16.3 only
  1303. // Make sure the `:has()` argument is parsed unforgivingly.
  1304. // We include `*` in the test to detect buggy implementations that are
  1305. // _selectively_ forgiving (specifically when the list includes at least
  1306. // one valid selector).
  1307. // Note that we treat complete lack of support for `:has()` as if it were
  1308. // spec-compliant support, which is fine because use of `:has()` in such
  1309. // environments will fail in the qSA path and fall back to jQuery traversal
  1310. // anyway.
  1311. support.cssHas = assert( function() {
  1312. try {
  1313. document.querySelector( ":has(*,:jqfake)" );
  1314. return false;
  1315. } catch ( e ) {
  1316. return true;
  1317. }
  1318. } );
  1319.  
  1320. // ID filter and find
  1321. if ( support.getById ) {
  1322. Expr.filter.ID = function( id ) {
  1323. var attrId = id.replace( runescape, funescape );
  1324. return function( elem ) {
  1325. return elem.getAttribute( "id" ) === attrId;
  1326. };
  1327. };
  1328. Expr.find.ID = function( id, context ) {
  1329. if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
  1330. var elem = context.getElementById( id );
  1331. return elem ? [ elem ] : [];
  1332. }
  1333. };
  1334. } else {
  1335. Expr.filter.ID = function( id ) {
  1336. var attrId = id.replace( runescape, funescape );
  1337. return function( elem ) {
  1338. var node = typeof elem.getAttributeNode !== "undefined" &&
  1339. elem.getAttributeNode( "id" );
  1340. return node && node.value === attrId;
  1341. };
  1342. };
  1343.  
  1344. // Support: IE 6 - 7 only
  1345. // getElementById is not reliable as a find shortcut
  1346. Expr.find.ID = function( id, context ) {
  1347. if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
  1348. var node, i, elems,
  1349. elem = context.getElementById( id );
  1350.  
  1351. if ( elem ) {
  1352.  
  1353. // Verify the id attribute
  1354. node = elem.getAttributeNode( "id" );
  1355. if ( node && node.value === id ) {
  1356. return [ elem ];
  1357. }
  1358.  
  1359. // Fall back on getElementsByName
  1360. elems = context.getElementsByName( id );
  1361. i = 0;
  1362. while ( ( elem = elems[ i++ ] ) ) {
  1363. node = elem.getAttributeNode( "id" );
  1364. if ( node && node.value === id ) {
  1365. return [ elem ];
  1366. }
  1367. }
  1368. }
  1369.  
  1370. return [];
  1371. }
  1372. };
  1373. }
  1374.  
  1375. // Tag
  1376. Expr.find.TAG = function( tag, context ) {
  1377. if ( typeof context.getElementsByTagName !== "undefined" ) {
  1378. return context.getElementsByTagName( tag );
  1379.  
  1380. // DocumentFragment nodes don't have gEBTN
  1381. } else {
  1382. return context.querySelectorAll( tag );
  1383. }
  1384. };
  1385.  
  1386. // Class
  1387. Expr.find.CLASS = function( className, context ) {
  1388. if ( typeof context.getElementsByClassName !== "undefined" && documentIsHTML ) {
  1389. return context.getElementsByClassName( className );
  1390. }
  1391. };
  1392.  
  1393. /* QSA/matchesSelector
  1394. ---------------------------------------------------------------------- */
  1395.  
  1396. // QSA and matchesSelector support
  1397.  
  1398. rbuggyQSA = [];
  1399.  
  1400. // Build QSA regex
  1401. // Regex strategy adopted from Diego Perini
  1402. assert( function( el ) {
  1403.  
  1404. var input;
  1405.  
  1406. documentElement.appendChild( el ).innerHTML =
  1407. "<a id='" + expando + "' href='' disabled='disabled'></a>" +
  1408. "<select id='" + expando + "-\r\\' disabled='disabled'>" +
  1409. "<option selected=''></option></select>";
  1410.  
  1411. // Support: iOS <=7 - 8 only
  1412. // Boolean attributes and "value" are not treated correctly in some XML documents
  1413. if ( !el.querySelectorAll( "[selected]" ).length ) {
  1414. rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" );
  1415. }
  1416.  
  1417. // Support: iOS <=7 - 8 only
  1418. if ( !el.querySelectorAll( "[id~=" + expando + "-]" ).length ) {
  1419. rbuggyQSA.push( "~=" );
  1420. }
  1421.  
  1422. // Support: iOS 8 only
  1423. // https://bugs.webkit.org/show_bug.cgi?id=136851
  1424. // In-page `selector#id sibling-combinator selector` fails
  1425. if ( !el.querySelectorAll( "a#" + expando + "+*" ).length ) {
  1426. rbuggyQSA.push( ".#.+[+~]" );
  1427. }
  1428.  
  1429. // Support: Chrome <=105+, Firefox <=104+, Safari <=15.4+
  1430. // In some of the document kinds, these selectors wouldn't work natively.
  1431. // This is probably OK but for backwards compatibility we want to maintain
  1432. // handling them through jQuery traversal in jQuery 3.x.
  1433. if ( !el.querySelectorAll( ":checked" ).length ) {
  1434. rbuggyQSA.push( ":checked" );
  1435. }
  1436.  
  1437. // Support: Windows 8 Native Apps
  1438. // The type and name attributes are restricted during .innerHTML assignment
  1439. input = document.createElement( "input" );
  1440. input.setAttribute( "type", "hidden" );
  1441. el.appendChild( input ).setAttribute( "name", "D" );
  1442.  
  1443. // Support: IE 9 - 11+
  1444. // IE's :disabled selector does not pick up the children of disabled fieldsets
  1445. // Support: Chrome <=105+, Firefox <=104+, Safari <=15.4+
  1446. // In some of the document kinds, these selectors wouldn't work natively.
  1447. // This is probably OK but for backwards compatibility we want to maintain
  1448. // handling them through jQuery traversal in jQuery 3.x.
  1449. documentElement.appendChild( el ).disabled = true;
  1450. if ( el.querySelectorAll( ":disabled" ).length !== 2 ) {
  1451. rbuggyQSA.push( ":enabled", ":disabled" );
  1452. }
  1453.  
  1454. // Support: IE 11+, Edge 15 - 18+
  1455. // IE 11/Edge don't find elements on a `[name='']` query in some cases.
  1456. // Adding a temporary attribute to the document before the selection works
  1457. // around the issue.
  1458. // Interestingly, IE 10 & older don't seem to have the issue.
  1459. input = document.createElement( "input" );
  1460. input.setAttribute( "name", "" );
  1461. el.appendChild( input );
  1462. if ( !el.querySelectorAll( "[name='']" ).length ) {
  1463. rbuggyQSA.push( "\\[" + whitespace + "*name" + whitespace + "*=" +
  1464. whitespace + "*(?:''|\"\")" );
  1465. }
  1466. } );
  1467.  
  1468. if ( !support.cssHas ) {
  1469.  
  1470. // Support: Chrome 105 - 110+, Safari 15.4 - 16.3+
  1471. // Our regular `try-catch` mechanism fails to detect natively-unsupported
  1472. // pseudo-classes inside `:has()` (such as `:has(:contains("Foo"))`)
  1473. // in browsers that parse the `:has()` argument as a forgiving selector list.
  1474. // https://drafts.csswg.org/selectors/#relational now requires the argument
  1475. // to be parsed unforgivingly, but browsers have not yet fully adjusted.
  1476. rbuggyQSA.push( ":has" );
  1477. }
  1478.  
  1479. rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join( "|" ) );
  1480.  
  1481. /* Sorting
  1482. ---------------------------------------------------------------------- */
  1483.  
  1484. // Document order sorting
  1485. sortOrder = function( a, b ) {
  1486.  
  1487. // Flag for duplicate removal
  1488. if ( a === b ) {
  1489. hasDuplicate = true;
  1490. return 0;
  1491. }
  1492.  
  1493. // Sort on method existence if only one input has compareDocumentPosition
  1494. var compare = !a.compareDocumentPosition - !b.compareDocumentPosition;
  1495. if ( compare ) {
  1496. return compare;
  1497. }
  1498.  
  1499. // Calculate position if both inputs belong to the same document
  1500. // Support: IE 11+, Edge 17 - 18+
  1501. // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
  1502. // two documents; shallow comparisons work.
  1503. // eslint-disable-next-line eqeqeq
  1504. compare = ( a.ownerDocument || a ) == ( b.ownerDocument || b ) ?
  1505. a.compareDocumentPosition( b ) :
  1506.  
  1507. // Otherwise we know they are disconnected
  1508. 1;
  1509.  
  1510. // Disconnected nodes
  1511. if ( compare & 1 ||
  1512. ( !support.sortDetached && b.compareDocumentPosition( a ) === compare ) ) {
  1513.  
  1514. // Choose the first element that is related to our preferred document
  1515. // Support: IE 11+, Edge 17 - 18+
  1516. // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
  1517. // two documents; shallow comparisons work.
  1518. // eslint-disable-next-line eqeqeq
  1519. if ( a === document || a.ownerDocument == preferredDoc &&
  1520. find.contains( preferredDoc, a ) ) {
  1521. return -1;
  1522. }
  1523.  
  1524. // Support: IE 11+, Edge 17 - 18+
  1525. // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
  1526. // two documents; shallow comparisons work.
  1527. // eslint-disable-next-line eqeqeq
  1528. if ( b === document || b.ownerDocument == preferredDoc &&
  1529. find.contains( preferredDoc, b ) ) {
  1530. return 1;
  1531. }
  1532.  
  1533. // Maintain original order
  1534. return sortInput ?
  1535. ( indexOf.call( sortInput, a ) - indexOf.call( sortInput, b ) ) :
  1536. 0;
  1537. }
  1538.  
  1539. return compare & 4 ? -1 : 1;
  1540. };
  1541.  
  1542. return document;
  1543. }
  1544.  
  1545. find.matches = function( expr, elements ) {
  1546. return find( expr, null, null, elements );
  1547. };
  1548.  
  1549. find.matchesSelector = function( elem, expr ) {
  1550. setDocument( elem );
  1551.  
  1552. if ( documentIsHTML &&
  1553. !nonnativeSelectorCache[ expr + " " ] &&
  1554. ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) {
  1555.  
  1556. try {
  1557. var ret = matches.call( elem, expr );
  1558.  
  1559. // IE 9's matchesSelector returns false on disconnected nodes
  1560. if ( ret || support.disconnectedMatch ||
  1561.  
  1562. // As well, disconnected nodes are said to be in a document
  1563. // fragment in IE 9
  1564. elem.document && elem.document.nodeType !== 11 ) {
  1565. return ret;
  1566. }
  1567. } catch ( e ) {
  1568. nonnativeSelectorCache( expr, true );
  1569. }
  1570. }
  1571.  
  1572. return find( expr, document, null, [ elem ] ).length > 0;
  1573. };
  1574.  
  1575. find.contains = function( context, elem ) {
  1576.  
  1577. // Set document vars if needed
  1578. // Support: IE 11+, Edge 17 - 18+
  1579. // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
  1580. // two documents; shallow comparisons work.
  1581. // eslint-disable-next-line eqeqeq
  1582. if ( ( context.ownerDocument || context ) != document ) {
  1583. setDocument( context );
  1584. }
  1585. return jQuery.contains( context, elem );
  1586. };
  1587.  
  1588.  
  1589. find.attr = function( elem, name ) {
  1590.  
  1591. // Set document vars if needed
  1592. // Support: IE 11+, Edge 17 - 18+
  1593. // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
  1594. // two documents; shallow comparisons work.
  1595. // eslint-disable-next-line eqeqeq
  1596. if ( ( elem.ownerDocument || elem ) != document ) {
  1597. setDocument( elem );
  1598. }
  1599.  
  1600. var fn = Expr.attrHandle[ name.toLowerCase() ],
  1601.  
  1602. // Don't get fooled by Object.prototype properties (see trac-13807)
  1603. val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ?
  1604. fn( elem, name, !documentIsHTML ) :
  1605. undefined;
  1606.  
  1607. if ( val !== undefined ) {
  1608. return val;
  1609. }
  1610.  
  1611. return elem.getAttribute( name );
  1612. };
  1613.  
  1614. find.error = function( msg ) {
  1615. throw new Error( "Syntax error, unrecognized expression: " + msg );
  1616. };
  1617.  
  1618. /**
  1619. * Document sorting and removing duplicates
  1620. * @param {ArrayLike} results
  1621. */
  1622. jQuery.uniqueSort = function( results ) {
  1623. var elem,
  1624. duplicates = [],
  1625. j = 0,
  1626. i = 0;
  1627.  
  1628. // Unless we *know* we can detect duplicates, assume their presence
  1629. //
  1630. // Support: Android <=4.0+
  1631. // Testing for detecting duplicates is unpredictable so instead assume we can't
  1632. // depend on duplicate detection in all browsers without a stable sort.
  1633. hasDuplicate = !support.sortStable;
  1634. sortInput = !support.sortStable && slice.call( results, 0 );
  1635. sort.call( results, sortOrder );
  1636.  
  1637. if ( hasDuplicate ) {
  1638. while ( ( elem = results[ i++ ] ) ) {
  1639. if ( elem === results[ i ] ) {
  1640. j = duplicates.push( i );
  1641. }
  1642. }
  1643. while ( j-- ) {
  1644. splice.call( results, duplicates[ j ], 1 );
  1645. }
  1646. }
  1647.  
  1648. // Clear input after sorting to release objects
  1649. // See https://github.com/jquery/sizzle/pull/225
  1650. sortInput = null;
  1651.  
  1652. return results;
  1653. };
  1654.  
  1655. jQuery.fn.uniqueSort = function() {
  1656. return this.pushStack( jQuery.uniqueSort( slice.apply( this ) ) );
  1657. };
  1658.  
  1659. Expr = jQuery.expr = {
  1660.  
  1661. // Can be adjusted by the user
  1662. cacheLength: 50,
  1663.  
  1664. createPseudo: markFunction,
  1665.  
  1666. match: matchExpr,
  1667.  
  1668. attrHandle: {},
  1669.  
  1670. find: {},
  1671.  
  1672. relative: {
  1673. ">": { dir: "parentNode", first: true },
  1674. " ": { dir: "parentNode" },
  1675. "+": { dir: "previousSibling", first: true },
  1676. "~": { dir: "previousSibling" }
  1677. },
  1678.  
  1679. preFilter: {
  1680. ATTR: function( match ) {
  1681. match[ 1 ] = match[ 1 ].replace( runescape, funescape );
  1682.  
  1683. // Move the given value to match[3] whether quoted or unquoted
  1684. match[ 3 ] = ( match[ 3 ] || match[ 4 ] || match[ 5 ] || "" )
  1685. .replace( runescape, funescape );
  1686.  
  1687. if ( match[ 2 ] === "~=" ) {
  1688. match[ 3 ] = " " + match[ 3 ] + " ";
  1689. }
  1690.  
  1691. return match.slice( 0, 4 );
  1692. },
  1693.  
  1694. CHILD: function( match ) {
  1695.  
  1696. /* matches from matchExpr["CHILD"]
  1697. 1 type (only|nth|...)
  1698. 2 what (child|of-type)
  1699. 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...)
  1700. 4 xn-component of xn+y argument ([+-]?\d*n|)
  1701. 5 sign of xn-component
  1702. 6 x of xn-component
  1703. 7 sign of y-component
  1704. 8 y of y-component
  1705. */
  1706. match[ 1 ] = match[ 1 ].toLowerCase();
  1707.  
  1708. if ( match[ 1 ].slice( 0, 3 ) === "nth" ) {
  1709.  
  1710. // nth-* requires argument
  1711. if ( !match[ 3 ] ) {
  1712. find.error( match[ 0 ] );
  1713. }
  1714.  
  1715. // numeric x and y parameters for Expr.filter.CHILD
  1716. // remember that false/true cast respectively to 0/1
  1717. match[ 4 ] = +( match[ 4 ] ?
  1718. match[ 5 ] + ( match[ 6 ] || 1 ) :
  1719. 2 * ( match[ 3 ] === "even" || match[ 3 ] === "odd" )
  1720. );
  1721. match[ 5 ] = +( ( match[ 7 ] + match[ 8 ] ) || match[ 3 ] === "odd" );
  1722.  
  1723. // other types prohibit arguments
  1724. } else if ( match[ 3 ] ) {
  1725. find.error( match[ 0 ] );
  1726. }
  1727.  
  1728. return match;
  1729. },
  1730.  
  1731. PSEUDO: function( match ) {
  1732. var excess,
  1733. unquoted = !match[ 6 ] && match[ 2 ];
  1734.  
  1735. if ( matchExpr.CHILD.test( match[ 0 ] ) ) {
  1736. return null;
  1737. }
  1738.  
  1739. // Accept quoted arguments as-is
  1740. if ( match[ 3 ] ) {
  1741. match[ 2 ] = match[ 4 ] || match[ 5 ] || "";
  1742.  
  1743. // Strip excess characters from unquoted arguments
  1744. } else if ( unquoted && rpseudo.test( unquoted ) &&
  1745.  
  1746. // Get excess from tokenize (recursively)
  1747. ( excess = tokenize( unquoted, true ) ) &&
  1748.  
  1749. // advance to the next closing parenthesis
  1750. ( excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length ) ) {
  1751.  
  1752. // excess is a negative index
  1753. match[ 0 ] = match[ 0 ].slice( 0, excess );
  1754. match[ 2 ] = unquoted.slice( 0, excess );
  1755. }
  1756.  
  1757. // Return only captures needed by the pseudo filter method (type and argument)
  1758. return match.slice( 0, 3 );
  1759. }
  1760. },
  1761.  
  1762. filter: {
  1763.  
  1764. TAG: function( nodeNameSelector ) {
  1765. var expectedNodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase();
  1766. return nodeNameSelector === "*" ?
  1767. function() {
  1768. return true;
  1769. } :
  1770. function( elem ) {
  1771. return nodeName( elem, expectedNodeName );
  1772. };
  1773. },
  1774.  
  1775. CLASS: function( className ) {
  1776. var pattern = classCache[ className + " " ];
  1777.  
  1778. return pattern ||
  1779. ( pattern = new RegExp( "(^|" + whitespace + ")" + className +
  1780. "(" + whitespace + "|$)" ) ) &&
  1781. classCache( className, function( elem ) {
  1782. return pattern.test(
  1783. typeof elem.className === "string" && elem.className ||
  1784. typeof elem.getAttribute !== "undefined" &&
  1785. elem.getAttribute( "class" ) ||
  1786. ""
  1787. );
  1788. } );
  1789. },
  1790.  
  1791. ATTR: function( name, operator, check ) {
  1792. return function( elem ) {
  1793. var result = find.attr( elem, name );
  1794.  
  1795. if ( result == null ) {
  1796. return operator === "!=";
  1797. }
  1798. if ( !operator ) {
  1799. return true;
  1800. }
  1801.  
  1802. result += "";
  1803.  
  1804. if ( operator === "=" ) {
  1805. return result === check;
  1806. }
  1807. if ( operator === "!=" ) {
  1808. return result !== check;
  1809. }
  1810. if ( operator === "^=" ) {
  1811. return check && result.indexOf( check ) === 0;
  1812. }
  1813. if ( operator === "*=" ) {
  1814. return check && result.indexOf( check ) > -1;
  1815. }
  1816. if ( operator === "$=" ) {
  1817. return check && result.slice( -check.length ) === check;
  1818. }
  1819. if ( operator === "~=" ) {
  1820. return ( " " + result.replace( rwhitespace, " " ) + " " )
  1821. .indexOf( check ) > -1;
  1822. }
  1823. if ( operator === "|=" ) {
  1824. return result === check || result.slice( 0, check.length + 1 ) === check + "-";
  1825. }
  1826.  
  1827. return false;
  1828. };
  1829. },
  1830.  
  1831. CHILD: function( type, what, _argument, first, last ) {
  1832. var simple = type.slice( 0, 3 ) !== "nth",
  1833. forward = type.slice( -4 ) !== "last",
  1834. ofType = what === "of-type";
  1835.  
  1836. return first === 1 && last === 0 ?
  1837.  
  1838. // Shortcut for :nth-*(n)
  1839. function( elem ) {
  1840. return !!elem.parentNode;
  1841. } :
  1842.  
  1843. function( elem, _context, xml ) {
  1844. var cache, outerCache, node, nodeIndex, start,
  1845. dir = simple !== forward ? "nextSibling" : "previousSibling",
  1846. parent = elem.parentNode,
  1847. name = ofType && elem.nodeName.toLowerCase(),
  1848. useCache = !xml && !ofType,
  1849. diff = false;
  1850.  
  1851. if ( parent ) {
  1852.  
  1853. // :(first|last|only)-(child|of-type)
  1854. if ( simple ) {
  1855. while ( dir ) {
  1856. node = elem;
  1857. while ( ( node = node[ dir ] ) ) {
  1858. if ( ofType ?
  1859. nodeName( node, name ) :
  1860. node.nodeType === 1 ) {
  1861.  
  1862. return false;
  1863. }
  1864. }
  1865.  
  1866. // Reverse direction for :only-* (if we haven't yet done so)
  1867. start = dir = type === "only" && !start && "nextSibling";
  1868. }
  1869. return true;
  1870. }
  1871.  
  1872. start = [ forward ? parent.firstChild : parent.lastChild ];
  1873.  
  1874. // non-xml :nth-child(...) stores cache data on `parent`
  1875. if ( forward && useCache ) {
  1876.  
  1877. // Seek `elem` from a previously-cached index
  1878. outerCache = parent[ expando ] || ( parent[ expando ] = {} );
  1879. cache = outerCache[ type ] || [];
  1880. nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
  1881. diff = nodeIndex && cache[ 2 ];
  1882. node = nodeIndex && parent.childNodes[ nodeIndex ];
  1883.  
  1884. while ( ( node = ++nodeIndex && node && node[ dir ] ||
  1885.  
  1886. // Fallback to seeking `elem` from the start
  1887. ( diff = nodeIndex = 0 ) || start.pop() ) ) {
  1888.  
  1889. // When found, cache indexes on `parent` and break
  1890. if ( node.nodeType === 1 && ++diff && node === elem ) {
  1891. outerCache[ type ] = [ dirruns, nodeIndex, diff ];
  1892. break;
  1893. }
  1894. }
  1895.  
  1896. } else {
  1897.  
  1898. // Use previously-cached element index if available
  1899. if ( useCache ) {
  1900. outerCache = elem[ expando ] || ( elem[ expando ] = {} );
  1901. cache = outerCache[ type ] || [];
  1902. nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
  1903. diff = nodeIndex;
  1904. }
  1905.  
  1906. // xml :nth-child(...)
  1907. // or :nth-last-child(...) or :nth(-last)?-of-type(...)
  1908. if ( diff === false ) {
  1909.  
  1910. // Use the same loop as above to seek `elem` from the start
  1911. while ( ( node = ++nodeIndex && node && node[ dir ] ||
  1912. ( diff = nodeIndex = 0 ) || start.pop() ) ) {
  1913.  
  1914. if ( ( ofType ?
  1915. nodeName( node, name ) :
  1916. node.nodeType === 1 ) &&
  1917. ++diff ) {
  1918.  
  1919. // Cache the index of each encountered element
  1920. if ( useCache ) {
  1921. outerCache = node[ expando ] ||
  1922. ( node[ expando ] = {} );
  1923. outerCache[ type ] = [ dirruns, diff ];
  1924. }
  1925.  
  1926. if ( node === elem ) {
  1927. break;
  1928. }
  1929. }
  1930. }
  1931. }
  1932. }
  1933.  
  1934. // Incorporate the offset, then check against cycle size
  1935. diff -= last;
  1936. return diff === first || ( diff % first === 0 && diff / first >= 0 );
  1937. }
  1938. };
  1939. },
  1940.  
  1941. PSEUDO: function( pseudo, argument ) {
  1942.  
  1943. // pseudo-class names are case-insensitive
  1944. // https://www.w3.org/TR/selectors/#pseudo-classes
  1945. // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
  1946. // Remember that setFilters inherits from pseudos
  1947. var args,
  1948. fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] ||
  1949. find.error( "unsupported pseudo: " + pseudo );
  1950.  
  1951. // The user may use createPseudo to indicate that
  1952. // arguments are needed to create the filter function
  1953. // just as jQuery does
  1954. if ( fn[ expando ] ) {
  1955. return fn( argument );
  1956. }
  1957.  
  1958. // But maintain support for old signatures
  1959. if ( fn.length > 1 ) {
  1960. args = [ pseudo, pseudo, "", argument ];
  1961. return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ?
  1962. markFunction( function( seed, matches ) {
  1963. var idx,
  1964. matched = fn( seed, argument ),
  1965. i = matched.length;
  1966. while ( i-- ) {
  1967. idx = indexOf.call( seed, matched[ i ] );
  1968. seed[ idx ] = !( matches[ idx ] = matched[ i ] );
  1969. }
  1970. } ) :
  1971. function( elem ) {
  1972. return fn( elem, 0, args );
  1973. };
  1974. }
  1975.  
  1976. return fn;
  1977. }
  1978. },
  1979.  
  1980. pseudos: {
  1981.  
  1982. // Potentially complex pseudos
  1983. not: markFunction( function( selector ) {
  1984.  
  1985. // Trim the selector passed to compile
  1986. // to avoid treating leading and trailing
  1987. // spaces as combinators
  1988. var input = [],
  1989. results = [],
  1990. matcher = compile( selector.replace( rtrimCSS, "$1" ) );
  1991.  
  1992. return matcher[ expando ] ?
  1993. markFunction( function( seed, matches, _context, xml ) {
  1994. var elem,
  1995. unmatched = matcher( seed, null, xml, [] ),
  1996. i = seed.length;
  1997.  
  1998. // Match elements unmatched by `matcher`
  1999. while ( i-- ) {
  2000. if ( ( elem = unmatched[ i ] ) ) {
  2001. seed[ i ] = !( matches[ i ] = elem );
  2002. }
  2003. }
  2004. } ) :
  2005. function( elem, _context, xml ) {
  2006. input[ 0 ] = elem;
  2007. matcher( input, null, xml, results );
  2008.  
  2009. // Don't keep the element
  2010. // (see https://github.com/jquery/sizzle/issues/299)
  2011. input[ 0 ] = null;
  2012. return !results.pop();
  2013. };
  2014. } ),
  2015.  
  2016. has: markFunction( function( selector ) {
  2017. return function( elem ) {
  2018. return find( selector, elem ).length > 0;
  2019. };
  2020. } ),
  2021.  
  2022. contains: markFunction( function( text ) {
  2023. text = text.replace( runescape, funescape );
  2024. return function( elem ) {
  2025. return ( elem.textContent || jQuery.text( elem ) ).indexOf( text ) > -1;
  2026. };
  2027. } ),
  2028.  
  2029. // "Whether an element is represented by a :lang() selector
  2030. // is based solely on the element's language value
  2031. // being equal to the identifier C,
  2032. // or beginning with the identifier C immediately followed by "-".
  2033. // The matching of C against the element's language value is performed case-insensitively.
  2034. // The identifier C does not have to be a valid language name."
  2035. // https://www.w3.org/TR/selectors/#lang-pseudo
  2036. lang: markFunction( function( lang ) {
  2037.  
  2038. // lang value must be a valid identifier
  2039. if ( !ridentifier.test( lang || "" ) ) {
  2040. find.error( "unsupported lang: " + lang );
  2041. }
  2042. lang = lang.replace( runescape, funescape ).toLowerCase();
  2043. return function( elem ) {
  2044. var elemLang;
  2045. do {
  2046. if ( ( elemLang = documentIsHTML ?
  2047. elem.lang :
  2048. elem.getAttribute( "xml:lang" ) || elem.getAttribute( "lang" ) ) ) {
  2049.  
  2050. elemLang = elemLang.toLowerCase();
  2051. return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0;
  2052. }
  2053. } while ( ( elem = elem.parentNode ) && elem.nodeType === 1 );
  2054. return false;
  2055. };
  2056. } ),
  2057.  
  2058. // Miscellaneous
  2059. target: function( elem ) {
  2060. var hash = window.location && window.location.hash;
  2061. return hash && hash.slice( 1 ) === elem.id;
  2062. },
  2063.  
  2064. root: function( elem ) {
  2065. return elem === documentElement;
  2066. },
  2067.  
  2068. focus: function( elem ) {
  2069. return elem === safeActiveElement() &&
  2070. document.hasFocus() &&
  2071. !!( elem.type || elem.href || ~elem.tabIndex );
  2072. },
  2073.  
  2074. // Boolean properties
  2075. enabled: createDisabledPseudo( false ),
  2076. disabled: createDisabledPseudo( true ),
  2077.  
  2078. checked: function( elem ) {
  2079.  
  2080. // In CSS3, :checked should return both checked and selected elements
  2081. // https://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  2082. return ( nodeName( elem, "input" ) && !!elem.checked ) ||
  2083. ( nodeName( elem, "option" ) && !!elem.selected );
  2084. },
  2085.  
  2086. selected: function( elem ) {
  2087.  
  2088. // Support: IE <=11+
  2089. // Accessing the selectedIndex property
  2090. // forces the browser to treat the default option as
  2091. // selected when in an optgroup.
  2092. if ( elem.parentNode ) {
  2093. // eslint-disable-next-line no-unused-expressions
  2094. elem.parentNode.selectedIndex;
  2095. }
  2096.  
  2097. return elem.selected === true;
  2098. },
  2099.  
  2100. // Contents
  2101. empty: function( elem ) {
  2102.  
  2103. // https://www.w3.org/TR/selectors/#empty-pseudo
  2104. // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5),
  2105. // but not by others (comment: 8; processing instruction: 7; etc.)
  2106. // nodeType < 6 works because attributes (2) do not appear as children
  2107. for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
  2108. if ( elem.nodeType < 6 ) {
  2109. return false;
  2110. }
  2111. }
  2112. return true;
  2113. },
  2114.  
  2115. parent: function( elem ) {
  2116. return !Expr.pseudos.empty( elem );
  2117. },
  2118.  
  2119. // Element/input types
  2120. header: function( elem ) {
  2121. return rheader.test( elem.nodeName );
  2122. },
  2123.  
  2124. input: function( elem ) {
  2125. return rinputs.test( elem.nodeName );
  2126. },
  2127.  
  2128. button: function( elem ) {
  2129. return nodeName( elem, "input" ) && elem.type === "button" ||
  2130. nodeName( elem, "button" );
  2131. },
  2132.  
  2133. text: function( elem ) {
  2134. var attr;
  2135. return nodeName( elem, "input" ) && elem.type === "text" &&
  2136.  
  2137. // Support: IE <10 only
  2138. // New HTML5 attribute values (e.g., "search") appear
  2139. // with elem.type === "text"
  2140. ( ( attr = elem.getAttribute( "type" ) ) == null ||
  2141. attr.toLowerCase() === "text" );
  2142. },
  2143.  
  2144. // Position-in-collection
  2145. first: createPositionalPseudo( function() {
  2146. return [ 0 ];
  2147. } ),
  2148.  
  2149. last: createPositionalPseudo( function( _matchIndexes, length ) {
  2150. return [ length - 1 ];
  2151. } ),
  2152.  
  2153. eq: createPositionalPseudo( function( _matchIndexes, length, argument ) {
  2154. return [ argument < 0 ? argument + length : argument ];
  2155. } ),
  2156.  
  2157. even: createPositionalPseudo( function( matchIndexes, length ) {
  2158. var i = 0;
  2159. for ( ; i < length; i += 2 ) {
  2160. matchIndexes.push( i );
  2161. }
  2162. return matchIndexes;
  2163. } ),
  2164.  
  2165. odd: createPositionalPseudo( function( matchIndexes, length ) {
  2166. var i = 1;
  2167. for ( ; i < length; i += 2 ) {
  2168. matchIndexes.push( i );
  2169. }
  2170. return matchIndexes;
  2171. } ),
  2172.  
  2173. lt: createPositionalPseudo( function( matchIndexes, length, argument ) {
  2174. var i;
  2175.  
  2176. if ( argument < 0 ) {
  2177. i = argument + length;
  2178. } else if ( argument > length ) {
  2179. i = length;
  2180. } else {
  2181. i = argument;
  2182. }
  2183.  
  2184. for ( ; --i >= 0; ) {
  2185. matchIndexes.push( i );
  2186. }
  2187. return matchIndexes;
  2188. } ),
  2189.  
  2190. gt: createPositionalPseudo( function( matchIndexes, length, argument ) {
  2191. var i = argument < 0 ? argument + length : argument;
  2192. for ( ; ++i < length; ) {
  2193. matchIndexes.push( i );
  2194. }
  2195. return matchIndexes;
  2196. } )
  2197. }
  2198. };
  2199.  
  2200. Expr.pseudos.nth = Expr.pseudos.eq;
  2201.  
  2202. // Add button/input type pseudos
  2203. for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) {
  2204. Expr.pseudos[ i ] = createInputPseudo( i );
  2205. }
  2206. for ( i in { submit: true, reset: true } ) {
  2207. Expr.pseudos[ i ] = createButtonPseudo( i );
  2208. }
  2209.  
  2210. // Easy API for creating new setFilters
  2211. function setFilters() {}
  2212. setFilters.prototype = Expr.filters = Expr.pseudos;
  2213. Expr.setFilters = new setFilters();
  2214.  
  2215. function tokenize( selector, parseOnly ) {
  2216. var matched, match, tokens, type,
  2217. soFar, groups, preFilters,
  2218. cached = tokenCache[ selector + " " ];
  2219.  
  2220. if ( cached ) {
  2221. return parseOnly ? 0 : cached.slice( 0 );
  2222. }
  2223.  
  2224. soFar = selector;
  2225. groups = [];
  2226. preFilters = Expr.preFilter;
  2227.  
  2228. while ( soFar ) {
  2229.  
  2230. // Comma and first run
  2231. if ( !matched || ( match = rcomma.exec( soFar ) ) ) {
  2232. if ( match ) {
  2233.  
  2234. // Don't consume trailing commas as valid
  2235. soFar = soFar.slice( match[ 0 ].length ) || soFar;
  2236. }
  2237. groups.push( ( tokens = [] ) );
  2238. }
  2239.  
  2240. matched = false;
  2241.  
  2242. // Combinators
  2243. if ( ( match = rleadingCombinator.exec( soFar ) ) ) {
  2244. matched = match.shift();
  2245. tokens.push( {
  2246. value: matched,
  2247.  
  2248. // Cast descendant combinators to space
  2249. type: match[ 0 ].replace( rtrimCSS, " " )
  2250. } );
  2251. soFar = soFar.slice( matched.length );
  2252. }
  2253.  
  2254. // Filters
  2255. for ( type in Expr.filter ) {
  2256. if ( ( match = matchExpr[ type ].exec( soFar ) ) && ( !preFilters[ type ] ||
  2257. ( match = preFilters[ type ]( match ) ) ) ) {
  2258. matched = match.shift();
  2259. tokens.push( {
  2260. value: matched,
  2261. type: type,
  2262. matches: match
  2263. } );
  2264. soFar = soFar.slice( matched.length );
  2265. }
  2266. }
  2267.  
  2268. if ( !matched ) {
  2269. break;
  2270. }
  2271. }
  2272.  
  2273. // Return the length of the invalid excess
  2274. // if we're just parsing
  2275. // Otherwise, throw an error or return tokens
  2276. if ( parseOnly ) {
  2277. return soFar.length;
  2278. }
  2279.  
  2280. return soFar ?
  2281. find.error( selector ) :
  2282.  
  2283. // Cache the tokens
  2284. tokenCache( selector, groups ).slice( 0 );
  2285. }
  2286.  
  2287. function toSelector( tokens ) {
  2288. var i = 0,
  2289. len = tokens.length,
  2290. selector = "";
  2291. for ( ; i < len; i++ ) {
  2292. selector += tokens[ i ].value;
  2293. }
  2294. return selector;
  2295. }
  2296.  
  2297. function addCombinator( matcher, combinator, base ) {
  2298. var dir = combinator.dir,
  2299. skip = combinator.next,
  2300. key = skip || dir,
  2301. checkNonElements = base && key === "parentNode",
  2302. doneName = done++;
  2303.  
  2304. return combinator.first ?
  2305.  
  2306. // Check against closest ancestor/preceding element
  2307. function( elem, context, xml ) {
  2308. while ( ( elem = elem[ dir ] ) ) {
  2309. if ( elem.nodeType === 1 || checkNonElements ) {
  2310. return matcher( elem, context, xml );
  2311. }
  2312. }
  2313. return false;
  2314. } :
  2315.  
  2316. // Check against all ancestor/preceding elements
  2317. function( elem, context, xml ) {
  2318. var oldCache, outerCache,
  2319. newCache = [ dirruns, doneName ];
  2320.  
  2321. // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching
  2322. if ( xml ) {
  2323. while ( ( elem = elem[ dir ] ) ) {
  2324. if ( elem.nodeType === 1 || checkNonElements ) {
  2325. if ( matcher( elem, context, xml ) ) {
  2326. return true;
  2327. }
  2328. }
  2329. }
  2330. } else {
  2331. while ( ( elem = elem[ dir ] ) ) {
  2332. if ( elem.nodeType === 1 || checkNonElements ) {
  2333. outerCache = elem[ expando ] || ( elem[ expando ] = {} );
  2334.  
  2335. if ( skip && nodeName( elem, skip ) ) {
  2336. elem = elem[ dir ] || elem;
  2337. } else if ( ( oldCache = outerCache[ key ] ) &&
  2338. oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) {
  2339.  
  2340. // Assign to newCache so results back-propagate to previous elements
  2341. return ( newCache[ 2 ] = oldCache[ 2 ] );
  2342. } else {
  2343.  
  2344. // Reuse newcache so results back-propagate to previous elements
  2345. outerCache[ key ] = newCache;
  2346.  
  2347. // A match means we're done; a fail means we have to keep checking
  2348. if ( ( newCache[ 2 ] = matcher( elem, context, xml ) ) ) {
  2349. return true;
  2350. }
  2351. }
  2352. }
  2353. }
  2354. }
  2355. return false;
  2356. };
  2357. }
  2358.  
  2359. function elementMatcher( matchers ) {
  2360. return matchers.length > 1 ?
  2361. function( elem, context, xml ) {
  2362. var i = matchers.length;
  2363. while ( i-- ) {
  2364. if ( !matchers[ i ]( elem, context, xml ) ) {
  2365. return false;
  2366. }
  2367. }
  2368. return true;
  2369. } :
  2370. matchers[ 0 ];
  2371. }
  2372.  
  2373. function multipleContexts( selector, contexts, results ) {
  2374. var i = 0,
  2375. len = contexts.length;
  2376. for ( ; i < len; i++ ) {
  2377. find( selector, contexts[ i ], results );
  2378. }
  2379. return results;
  2380. }
  2381.  
  2382. function condense( unmatched, map, filter, context, xml ) {
  2383. var elem,
  2384. newUnmatched = [],
  2385. i = 0,
  2386. len = unmatched.length,
  2387. mapped = map != null;
  2388.  
  2389. for ( ; i < len; i++ ) {
  2390. if ( ( elem = unmatched[ i ] ) ) {
  2391. if ( !filter || filter( elem, context, xml ) ) {
  2392. newUnmatched.push( elem );
  2393. if ( mapped ) {
  2394. map.push( i );
  2395. }
  2396. }
  2397. }
  2398. }
  2399.  
  2400. return newUnmatched;
  2401. }
  2402.  
  2403. function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {
  2404. if ( postFilter && !postFilter[ expando ] ) {
  2405. postFilter = setMatcher( postFilter );
  2406. }
  2407. if ( postFinder && !postFinder[ expando ] ) {
  2408. postFinder = setMatcher( postFinder, postSelector );
  2409. }
  2410. return markFunction( function( seed, results, context, xml ) {
  2411. var temp, i, elem, matcherOut,
  2412. preMap = [],
  2413. postMap = [],
  2414. preexisting = results.length,
  2415.  
  2416. // Get initial elements from seed or context
  2417. elems = seed ||
  2418. multipleContexts( selector || "*",
  2419. context.nodeType ? [ context ] : context, [] ),
  2420.  
  2421. // Prefilter to get matcher input, preserving a map for seed-results synchronization
  2422. matcherIn = preFilter && ( seed || !selector ) ?
  2423. condense( elems, preMap, preFilter, context, xml ) :
  2424. elems;
  2425.  
  2426. if ( matcher ) {
  2427.  
  2428. // If we have a postFinder, or filtered seed, or non-seed postFilter
  2429. // or preexisting results,
  2430. matcherOut = postFinder || ( seed ? preFilter : preexisting || postFilter ) ?
  2431.  
  2432. // ...intermediate processing is necessary
  2433. [] :
  2434.  
  2435. // ...otherwise use results directly
  2436. results;
  2437.  
  2438. // Find primary matches
  2439. matcher( matcherIn, matcherOut, context, xml );
  2440. } else {
  2441. matcherOut = matcherIn;
  2442. }
  2443.  
  2444. // Apply postFilter
  2445. if ( postFilter ) {
  2446. temp = condense( matcherOut, postMap );
  2447. postFilter( temp, [], context, xml );
  2448.  
  2449. // Un-match failing elements by moving them back to matcherIn
  2450. i = temp.length;
  2451. while ( i-- ) {
  2452. if ( ( elem = temp[ i ] ) ) {
  2453. matcherOut[ postMap[ i ] ] = !( matcherIn[ postMap[ i ] ] = elem );
  2454. }
  2455. }
  2456. }
  2457.  
  2458. if ( seed ) {
  2459. if ( postFinder || preFilter ) {
  2460. if ( postFinder ) {
  2461.  
  2462. // Get the final matcherOut by condensing this intermediate into postFinder contexts
  2463. temp = [];
  2464. i = matcherOut.length;
  2465. while ( i-- ) {
  2466. if ( ( elem = matcherOut[ i ] ) ) {
  2467.  
  2468. // Restore matcherIn since elem is not yet a final match
  2469. temp.push( ( matcherIn[ i ] = elem ) );
  2470. }
  2471. }
  2472. postFinder( null, ( matcherOut = [] ), temp, xml );
  2473. }
  2474.  
  2475. // Move matched elements from seed to results to keep them synchronized
  2476. i = matcherOut.length;
  2477. while ( i-- ) {
  2478. if ( ( elem = matcherOut[ i ] ) &&
  2479. ( temp = postFinder ? indexOf.call( seed, elem ) : preMap[ i ] ) > -1 ) {
  2480.  
  2481. seed[ temp ] = !( results[ temp ] = elem );
  2482. }
  2483. }
  2484. }
  2485.  
  2486. // Add elements to results, through postFinder if defined
  2487. } else {
  2488. matcherOut = condense(
  2489. matcherOut === results ?
  2490. matcherOut.splice( preexisting, matcherOut.length ) :
  2491. matcherOut
  2492. );
  2493. if ( postFinder ) {
  2494. postFinder( null, results, matcherOut, xml );
  2495. } else {
  2496. push.apply( results, matcherOut );
  2497. }
  2498. }
  2499. } );
  2500. }
  2501.  
  2502. function matcherFromTokens( tokens ) {
  2503. var checkContext, matcher, j,
  2504. len = tokens.length,
  2505. leadingRelative = Expr.relative[ tokens[ 0 ].type ],
  2506. implicitRelative = leadingRelative || Expr.relative[ " " ],
  2507. i = leadingRelative ? 1 : 0,
  2508.  
  2509. // The foundational matcher ensures that elements are reachable from top-level context(s)
  2510. matchContext = addCombinator( function( elem ) {
  2511. return elem === checkContext;
  2512. }, implicitRelative, true ),
  2513. matchAnyContext = addCombinator( function( elem ) {
  2514. return indexOf.call( checkContext, elem ) > -1;
  2515. }, implicitRelative, true ),
  2516. matchers = [ function( elem, context, xml ) {
  2517.  
  2518. // Support: IE 11+, Edge 17 - 18+
  2519. // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
  2520. // two documents; shallow comparisons work.
  2521. // eslint-disable-next-line eqeqeq
  2522. var ret = ( !leadingRelative && ( xml || context != outermostContext ) ) || (
  2523. ( checkContext = context ).nodeType ?
  2524. matchContext( elem, context, xml ) :
  2525. matchAnyContext( elem, context, xml ) );
  2526.  
  2527. // Avoid hanging onto element
  2528. // (see https://github.com/jquery/sizzle/issues/299)
  2529. checkContext = null;
  2530. return ret;
  2531. } ];
  2532.  
  2533. for ( ; i < len; i++ ) {
  2534. if ( ( matcher = Expr.relative[ tokens[ i ].type ] ) ) {
  2535. matchers = [ addCombinator( elementMatcher( matchers ), matcher ) ];
  2536. } else {
  2537. matcher = Expr.filter[ tokens[ i ].type ].apply( null, tokens[ i ].matches );
  2538.  
  2539. // Return special upon seeing a positional matcher
  2540. if ( matcher[ expando ] ) {
  2541.  
  2542. // Find the next relative operator (if any) for proper handling
  2543. j = ++i;
  2544. for ( ; j < len; j++ ) {
  2545. if ( Expr.relative[ tokens[ j ].type ] ) {
  2546. break;
  2547. }
  2548. }
  2549. return setMatcher(
  2550. i > 1 && elementMatcher( matchers ),
  2551. i > 1 && toSelector(
  2552.  
  2553. // If the preceding token was a descendant combinator, insert an implicit any-element `*`
  2554. tokens.slice( 0, i - 1 )
  2555. .concat( { value: tokens[ i - 2 ].type === " " ? "*" : "" } )
  2556. ).replace( rtrimCSS, "$1" ),
  2557. matcher,
  2558. i < j && matcherFromTokens( tokens.slice( i, j ) ),
  2559. j < len && matcherFromTokens( ( tokens = tokens.slice( j ) ) ),
  2560. j < len && toSelector( tokens )
  2561. );
  2562. }
  2563. matchers.push( matcher );
  2564. }
  2565. }
  2566.  
  2567. return elementMatcher( matchers );
  2568. }
  2569.  
  2570. function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
  2571. var bySet = setMatchers.length > 0,
  2572. byElement = elementMatchers.length > 0,
  2573. superMatcher = function( seed, context, xml, results, outermost ) {
  2574. var elem, j, matcher,
  2575. matchedCount = 0,
  2576. i = "0",
  2577. unmatched = seed && [],
  2578. setMatched = [],
  2579. contextBackup = outermostContext,
  2580.  
  2581. // We must always have either seed elements or outermost context
  2582. elems = seed || byElement && Expr.find.TAG( "*", outermost ),
  2583.  
  2584. // Use integer dirruns iff this is the outermost matcher
  2585. dirrunsUnique = ( dirruns += contextBackup == null ? 1 : Math.random() || 0.1 ),
  2586. len = elems.length;
  2587.  
  2588. if ( outermost ) {
  2589.  
  2590. // Support: IE 11+, Edge 17 - 18+
  2591. // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
  2592. // two documents; shallow comparisons work.
  2593. // eslint-disable-next-line eqeqeq
  2594. outermostContext = context == document || context || outermost;
  2595. }
  2596.  
  2597. // Add elements passing elementMatchers directly to results
  2598. // Support: iOS <=7 - 9 only
  2599. // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching
  2600. // elements by id. (see trac-14142)
  2601. for ( ; i !== len && ( elem = elems[ i ] ) != null; i++ ) {
  2602. if ( byElement && elem ) {
  2603. j = 0;
  2604.  
  2605. // Support: IE 11+, Edge 17 - 18+
  2606. // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
  2607. // two documents; shallow comparisons work.
  2608. // eslint-disable-next-line eqeqeq
  2609. if ( !context && elem.ownerDocument != document ) {
  2610. setDocument( elem );
  2611. xml = !documentIsHTML;
  2612. }
  2613. while ( ( matcher = elementMatchers[ j++ ] ) ) {
  2614. if ( matcher( elem, context || document, xml ) ) {
  2615. push.call( results, elem );
  2616. break;
  2617. }
  2618. }
  2619. if ( outermost ) {
  2620. dirruns = dirrunsUnique;
  2621. }
  2622. }
  2623.  
  2624. // Track unmatched elements for set filters
  2625. if ( bySet ) {
  2626.  
  2627. // They will have gone through all possible matchers
  2628. if ( ( elem = !matcher && elem ) ) {
  2629. matchedCount--;
  2630. }
  2631.  
  2632. // Lengthen the array for every element, matched or not
  2633. if ( seed ) {
  2634. unmatched.push( elem );
  2635. }
  2636. }
  2637. }
  2638.  
  2639. // `i` is now the count of elements visited above, and adding it to `matchedCount`
  2640. // makes the latter nonnegative.
  2641. matchedCount += i;
  2642.  
  2643. // Apply set filters to unmatched elements
  2644. // NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount`
  2645. // equals `i`), unless we didn't visit _any_ elements in the above loop because we have
  2646. // no element matchers and no seed.
  2647. // Incrementing an initially-string "0" `i` allows `i` to remain a string only in that
  2648. // case, which will result in a "00" `matchedCount` that differs from `i` but is also
  2649. // numerically zero.
  2650. if ( bySet && i !== matchedCount ) {
  2651. j = 0;
  2652. while ( ( matcher = setMatchers[ j++ ] ) ) {
  2653. matcher( unmatched, setMatched, context, xml );
  2654. }
  2655.  
  2656. if ( seed ) {
  2657.  
  2658. // Reintegrate element matches to eliminate the need for sorting
  2659. if ( matchedCount > 0 ) {
  2660. while ( i-- ) {
  2661. if ( !( unmatched[ i ] || setMatched[ i ] ) ) {
  2662. setMatched[ i ] = pop.call( results );
  2663. }
  2664. }
  2665. }
  2666.  
  2667. // Discard index placeholder values to get only actual matches
  2668. setMatched = condense( setMatched );
  2669. }
  2670.  
  2671. // Add matches to results
  2672. push.apply( results, setMatched );
  2673.  
  2674. // Seedless set matches succeeding multiple successful matchers stipulate sorting
  2675. if ( outermost && !seed && setMatched.length > 0 &&
  2676. ( matchedCount + setMatchers.length ) > 1 ) {
  2677.  
  2678. jQuery.uniqueSort( results );
  2679. }
  2680. }
  2681.  
  2682. // Override manipulation of globals by nested matchers
  2683. if ( outermost ) {
  2684. dirruns = dirrunsUnique;
  2685. outermostContext = contextBackup;
  2686. }
  2687.  
  2688. return unmatched;
  2689. };
  2690.  
  2691. return bySet ?
  2692. markFunction( superMatcher ) :
  2693. superMatcher;
  2694. }
  2695.  
  2696. function compile( selector, match /* Internal Use Only */ ) {
  2697. var i,
  2698. setMatchers = [],
  2699. elementMatchers = [],
  2700. cached = compilerCache[ selector + " " ];
  2701.  
  2702. if ( !cached ) {
  2703.  
  2704. // Generate a function of recursive functions that can be used to check each element
  2705. if ( !match ) {
  2706. match = tokenize( selector );
  2707. }
  2708. i = match.length;
  2709. while ( i-- ) {
  2710. cached = matcherFromTokens( match[ i ] );
  2711. if ( cached[ expando ] ) {
  2712. setMatchers.push( cached );
  2713. } else {
  2714. elementMatchers.push( cached );
  2715. }
  2716. }
  2717.  
  2718. // Cache the compiled function
  2719. cached = compilerCache( selector,
  2720. matcherFromGroupMatchers( elementMatchers, setMatchers ) );
  2721.  
  2722. // Save selector and tokenization
  2723. cached.selector = selector;
  2724. }
  2725. return cached;
  2726. }
  2727.  
  2728. /**
  2729. * A low-level selection function that works with jQuery's compiled
  2730. * selector functions
  2731. * @param {String|Function} selector A selector or a pre-compiled
  2732. * selector function built with jQuery selector compile
  2733. * @param {Element} context
  2734. * @param {Array} [results]
  2735. * @param {Array} [seed] A set of elements to match against
  2736. */
  2737. function select( selector, context, results, seed ) {
  2738. var i, tokens, token, type, find,
  2739. compiled = typeof selector === "function" && selector,
  2740. match = !seed && tokenize( ( selector = compiled.selector || selector ) );
  2741.  
  2742. results = results || [];
  2743.  
  2744. // Try to minimize operations if there is only one selector in the list and no seed
  2745. // (the latter of which guarantees us context)
  2746. if ( match.length === 1 ) {
  2747.  
  2748. // Reduce context if the leading compound selector is an ID
  2749. tokens = match[ 0 ] = match[ 0 ].slice( 0 );
  2750. if ( tokens.length > 2 && ( token = tokens[ 0 ] ).type === "ID" &&
  2751. context.nodeType === 9 && documentIsHTML && Expr.relative[ tokens[ 1 ].type ] ) {
  2752.  
  2753. context = ( Expr.find.ID(
  2754. token.matches[ 0 ].replace( runescape, funescape ),
  2755. context
  2756. ) || [] )[ 0 ];
  2757. if ( !context ) {
  2758. return results;
  2759.  
  2760. // Precompiled matchers will still verify ancestry, so step up a level
  2761. } else if ( compiled ) {
  2762. context = context.parentNode;
  2763. }
  2764.  
  2765. selector = selector.slice( tokens.shift().value.length );
  2766. }
  2767.  
  2768. // Fetch a seed set for right-to-left matching
  2769. i = matchExpr.needsContext.test( selector ) ? 0 : tokens.length;
  2770. while ( i-- ) {
  2771. token = tokens[ i ];
  2772.  
  2773. // Abort if we hit a combinator
  2774. if ( Expr.relative[ ( type = token.type ) ] ) {
  2775. break;
  2776. }
  2777. if ( ( find = Expr.find[ type ] ) ) {
  2778.  
  2779. // Search, expanding context for leading sibling combinators
  2780. if ( ( seed = find(
  2781. token.matches[ 0 ].replace( runescape, funescape ),
  2782. rsibling.test( tokens[ 0 ].type ) &&
  2783. testContext( context.parentNode ) || context
  2784. ) ) ) {
  2785.  
  2786. // If seed is empty or no tokens remain, we can return early
  2787. tokens.splice( i, 1 );
  2788. selector = seed.length && toSelector( tokens );
  2789. if ( !selector ) {
  2790. push.apply( results, seed );
  2791. return results;
  2792. }
  2793.  
  2794. break;
  2795. }
  2796. }
  2797. }
  2798. }
  2799.  
  2800. // Compile and execute a filtering function if one is not provided
  2801. // Provide `match` to avoid retokenization if we modified the selector above
  2802. ( compiled || compile( selector, match ) )(
  2803. seed,
  2804. context,
  2805. !documentIsHTML,
  2806. results,
  2807. !context || rsibling.test( selector ) && testContext( context.parentNode ) || context
  2808. );
  2809. return results;
  2810. }
  2811.  
  2812. // One-time assignments
  2813.  
  2814. // Support: Android <=4.0 - 4.1+
  2815. // Sort stability
  2816. support.sortStable = expando.split( "" ).sort( sortOrder ).join( "" ) === expando;
  2817.  
  2818. // Initialize against the default document
  2819. setDocument();
  2820.  
  2821. // Support: Android <=4.0 - 4.1+
  2822. // Detached nodes confoundingly follow *each other*
  2823. support.sortDetached = assert( function( el ) {
  2824.  
  2825. // Should return 1, but returns 4 (following)
  2826. return el.compareDocumentPosition( document.createElement( "fieldset" ) ) & 1;
  2827. } );
  2828.  
  2829. jQuery.find = find;
  2830.  
  2831. // Deprecated
  2832. jQuery.expr[ ":" ] = jQuery.expr.pseudos;
  2833. jQuery.unique = jQuery.uniqueSort;
  2834.  
  2835. // These have always been private, but they used to be documented as part of
  2836. // Sizzle so let's maintain them for now for backwards compatibility purposes.
  2837. find.compile = compile;
  2838. find.select = select;
  2839. find.setDocument = setDocument;
  2840. find.tokenize = tokenize;
  2841.  
  2842. find.escape = jQuery.escapeSelector;
  2843. find.getText = jQuery.text;
  2844. find.isXML = jQuery.isXMLDoc;
  2845. find.selectors = jQuery.expr;
  2846. find.support = jQuery.support;
  2847. find.uniqueSort = jQuery.uniqueSort;
  2848.  
  2849. /* eslint-enable */
  2850.  
  2851. } )();
  2852.  
  2853.  
  2854. var dir = function( elem, dir, until ) {
  2855. var matched = [],
  2856. truncate = until !== undefined;
  2857.  
  2858. while ( ( elem = elem[ dir ] ) && elem.nodeType !== 9 ) {
  2859. if ( elem.nodeType === 1 ) {
  2860. if ( truncate && jQuery( elem ).is( until ) ) {
  2861. break;
  2862. }
  2863. matched.push( elem );
  2864. }
  2865. }
  2866. return matched;
  2867. };
  2868.  
  2869.  
  2870. var siblings = function( n, elem ) {
  2871. var matched = [];
  2872.  
  2873. for ( ; n; n = n.nextSibling ) {
  2874. if ( n.nodeType === 1 && n !== elem ) {
  2875. matched.push( n );
  2876. }
  2877. }
  2878.  
  2879. return matched;
  2880. };
  2881.  
  2882.  
  2883. var rneedsContext = jQuery.expr.match.needsContext;
  2884.  
  2885. var rsingleTag = ( /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i );
  2886.  
  2887.  
  2888.  
  2889. // Implement the identical functionality for filter and not
  2890. function winnow( elements, qualifier, not ) {
  2891. if ( isFunction( qualifier ) ) {
  2892. return jQuery.grep( elements, function( elem, i ) {
  2893. return !!qualifier.call( elem, i, elem ) !== not;
  2894. } );
  2895. }
  2896.  
  2897. // Single element
  2898. if ( qualifier.nodeType ) {
  2899. return jQuery.grep( elements, function( elem ) {
  2900. return ( elem === qualifier ) !== not;
  2901. } );
  2902. }
  2903.  
  2904. // Arraylike of elements (jQuery, arguments, Array)
  2905. if ( typeof qualifier !== "string" ) {
  2906. return jQuery.grep( elements, function( elem ) {
  2907. return ( indexOf.call( qualifier, elem ) > -1 ) !== not;
  2908. } );
  2909. }
  2910.  
  2911. // Filtered directly for both simple and complex selectors
  2912. return jQuery.filter( qualifier, elements, not );
  2913. }
  2914.  
  2915. jQuery.filter = function( expr, elems, not ) {
  2916. var elem = elems[ 0 ];
  2917.  
  2918. if ( not ) {
  2919. expr = ":not(" + expr + ")";
  2920. }
  2921.  
  2922. if ( elems.length === 1 && elem.nodeType === 1 ) {
  2923. return jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [];
  2924. }
  2925.  
  2926. return jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) {
  2927. return elem.nodeType === 1;
  2928. } ) );
  2929. };
  2930.  
  2931. jQuery.fn.extend( {
  2932. find: function( selector ) {
  2933. var i, ret,
  2934. len = this.length,
  2935. self = this;
  2936.  
  2937. if ( typeof selector !== "string" ) {
  2938. return this.pushStack( jQuery( selector ).filter( function() {
  2939. for ( i = 0; i < len; i++ ) {
  2940. if ( jQuery.contains( self[ i ], this ) ) {
  2941. return true;
  2942. }
  2943. }
  2944. } ) );
  2945. }
  2946.  
  2947. ret = this.pushStack( [] );
  2948.  
  2949. for ( i = 0; i < len; i++ ) {
  2950. jQuery.find( selector, self[ i ], ret );
  2951. }
  2952.  
  2953. return len > 1 ? jQuery.uniqueSort( ret ) : ret;
  2954. },
  2955. filter: function( selector ) {
  2956. return this.pushStack( winnow( this, selector || [], false ) );
  2957. },
  2958. not: function( selector ) {
  2959. return this.pushStack( winnow( this, selector || [], true ) );
  2960. },
  2961. is: function( selector ) {
  2962. return !!winnow(
  2963. this,
  2964.  
  2965. // If this is a positional/relative selector, check membership in the returned set
  2966. // so $("p:first").is("p:last") won't return true for a doc with two "p".
  2967. typeof selector === "string" && rneedsContext.test( selector ) ?
  2968. jQuery( selector ) :
  2969. selector || [],
  2970. false
  2971. ).length;
  2972. }
  2973. } );
  2974.  
  2975.  
  2976. // Initialize a jQuery object
  2977.  
  2978.  
  2979. // A central reference to the root jQuery(document)
  2980. var rootjQuery,
  2981.  
  2982. // A simple way to check for HTML strings
  2983. // Prioritize #id over <tag> to avoid XSS via location.hash (trac-9521)
  2984. // Strict HTML recognition (trac-11290: must start with <)
  2985. // Shortcut simple #id case for speed
  2986. rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/,
  2987.  
  2988. init = jQuery.fn.init = function( selector, context, root ) {
  2989. var match, elem;
  2990.  
  2991. // HANDLE: $(""), $(null), $(undefined), $(false)
  2992. if ( !selector ) {
  2993. return this;
  2994. }
  2995.  
  2996. // Method init() accepts an alternate rootjQuery
  2997. // so migrate can support jQuery.sub (gh-2101)
  2998. root = root || rootjQuery;
  2999.  
  3000. // Handle HTML strings
  3001. if ( typeof selector === "string" ) {
  3002. if ( selector[ 0 ] === "<" &&
  3003. selector[ selector.length - 1 ] === ">" &&
  3004. selector.length >= 3 ) {
  3005.  
  3006. // Assume that strings that start and end with <> are HTML and skip the regex check
  3007. match = [ null, selector, null ];
  3008.  
  3009. } else {
  3010. match = rquickExpr.exec( selector );
  3011. }
  3012.  
  3013. // Match html or make sure no context is specified for #id
  3014. if ( match && ( match[ 1 ] || !context ) ) {
  3015.  
  3016. // HANDLE: $(html) -> $(array)
  3017. if ( match[ 1 ] ) {
  3018. context = context instanceof jQuery ? context[ 0 ] : context;
  3019.  
  3020. // Option to run scripts is true for back-compat
  3021. // Intentionally let the error be thrown if parseHTML is not present
  3022. jQuery.merge( this, jQuery.parseHTML(
  3023. match[ 1 ],
  3024. context && context.nodeType ? context.ownerDocument || context : document,
  3025. true
  3026. ) );
  3027.  
  3028. // HANDLE: $(html, props)
  3029. if ( rsingleTag.test( match[ 1 ] ) && jQuery.isPlainObject( context ) ) {
  3030. for ( match in context ) {
  3031.  
  3032. // Properties of context are called as methods if possible
  3033. if ( isFunction( this[ match ] ) ) {
  3034. this[ match ]( context[ match ] );
  3035.  
  3036. // ...and otherwise set as attributes
  3037. } else {
  3038. this.attr( match, context[ match ] );
  3039. }
  3040. }
  3041. }
  3042.  
  3043. return this;
  3044.  
  3045. // HANDLE: $(#id)
  3046. } else {
  3047. elem = document.getElementById( match[ 2 ] );
  3048.  
  3049. if ( elem ) {
  3050.  
  3051. // Inject the element directly into the jQuery object
  3052. this[ 0 ] = elem;
  3053. this.length = 1;
  3054. }
  3055. return this;
  3056. }
  3057.  
  3058. // HANDLE: $(expr, $(...))
  3059. } else if ( !context || context.jquery ) {
  3060. return ( context || root ).find( selector );
  3061.  
  3062. // HANDLE: $(expr, context)
  3063. // (which is just equivalent to: $(context).find(expr)
  3064. } else {
  3065. return this.constructor( context ).find( selector );
  3066. }
  3067.  
  3068. // HANDLE: $(DOMElement)
  3069. } else if ( selector.nodeType ) {
  3070. this[ 0 ] = selector;
  3071. this.length = 1;
  3072. return this;
  3073.  
  3074. // HANDLE: $(function)
  3075. // Shortcut for document ready
  3076. } else if ( isFunction( selector ) ) {
  3077. return root.ready !== undefined ?
  3078. root.ready( selector ) :
  3079.  
  3080. // Execute immediately if ready is not present
  3081. selector( jQuery );
  3082. }
  3083.  
  3084. return jQuery.makeArray( selector, this );
  3085. };
  3086.  
  3087. // Give the init function the jQuery prototype for later instantiation
  3088. init.prototype = jQuery.fn;
  3089.  
  3090. // Initialize central reference
  3091. rootjQuery = jQuery( document );
  3092.  
  3093.  
  3094. var rparentsprev = /^(?:parents|prev(?:Until|All))/,
  3095.  
  3096. // Methods guaranteed to produce a unique set when starting from a unique set
  3097. guaranteedUnique = {
  3098. children: true,
  3099. contents: true,
  3100. next: true,
  3101. prev: true
  3102. };
  3103.  
  3104. jQuery.fn.extend( {
  3105. has: function( target ) {
  3106. var targets = jQuery( target, this ),
  3107. l = targets.length;
  3108.  
  3109. return this.filter( function() {
  3110. var i = 0;
  3111. for ( ; i < l; i++ ) {
  3112. if ( jQuery.contains( this, targets[ i ] ) ) {
  3113. return true;
  3114. }
  3115. }
  3116. } );
  3117. },
  3118.  
  3119. closest: function( selectors, context ) {
  3120. var cur,
  3121. i = 0,
  3122. l = this.length,
  3123. matched = [],
  3124. targets = typeof selectors !== "string" && jQuery( selectors );
  3125.  
  3126. // Positional selectors never match, since there's no _selection_ context
  3127. if ( !rneedsContext.test( selectors ) ) {
  3128. for ( ; i < l; i++ ) {
  3129. for ( cur = this[ i ]; cur && cur !== context; cur = cur.parentNode ) {
  3130.  
  3131. // Always skip document fragments
  3132. if ( cur.nodeType < 11 && ( targets ?
  3133. targets.index( cur ) > -1 :
  3134.  
  3135. // Don't pass non-elements to jQuery#find
  3136. cur.nodeType === 1 &&
  3137. jQuery.find.matchesSelector( cur, selectors ) ) ) {
  3138.  
  3139. matched.push( cur );
  3140. break;
  3141. }
  3142. }
  3143. }
  3144. }
  3145.  
  3146. return this.pushStack( matched.length > 1 ? jQuery.uniqueSort( matched ) : matched );
  3147. },
  3148.  
  3149. // Determine the position of an element within the set
  3150. index: function( elem ) {
  3151.  
  3152. // No argument, return index in parent
  3153. if ( !elem ) {
  3154. return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1;
  3155. }
  3156.  
  3157. // Index in selector
  3158. if ( typeof elem === "string" ) {
  3159. return indexOf.call( jQuery( elem ), this[ 0 ] );
  3160. }
  3161.  
  3162. // Locate the position of the desired element
  3163. return indexOf.call( this,
  3164.  
  3165. // If it receives a jQuery object, the first element is used
  3166. elem.jquery ? elem[ 0 ] : elem
  3167. );
  3168. },
  3169.  
  3170. add: function( selector, context ) {
  3171. return this.pushStack(
  3172. jQuery.uniqueSort(
  3173. jQuery.merge( this.get(), jQuery( selector, context ) )
  3174. )
  3175. );
  3176. },
  3177.  
  3178. addBack: function( selector ) {
  3179. return this.add( selector == null ?
  3180. this.prevObject : this.prevObject.filter( selector )
  3181. );
  3182. }
  3183. } );
  3184.  
  3185. function sibling( cur, dir ) {
  3186. while ( ( cur = cur[ dir ] ) && cur.nodeType !== 1 ) {}
  3187. return cur;
  3188. }
  3189.  
  3190. jQuery.each( {
  3191. parent: function( elem ) {
  3192. var parent = elem.parentNode;
  3193. return parent && parent.nodeType !== 11 ? parent : null;
  3194. },
  3195. parents: function( elem ) {
  3196. return dir( elem, "parentNode" );
  3197. },
  3198. parentsUntil: function( elem, _i, until ) {
  3199. return dir( elem, "parentNode", until );
  3200. },
  3201. next: function( elem ) {
  3202. return sibling( elem, "nextSibling" );
  3203. },
  3204. prev: function( elem ) {
  3205. return sibling( elem, "previousSibling" );
  3206. },
  3207. nextAll: function( elem ) {
  3208. return dir( elem, "nextSibling" );
  3209. },
  3210. prevAll: function( elem ) {
  3211. return dir( elem, "previousSibling" );
  3212. },
  3213. nextUntil: function( elem, _i, until ) {
  3214. return dir( elem, "nextSibling", until );
  3215. },
  3216. prevUntil: function( elem, _i, until ) {
  3217. return dir( elem, "previousSibling", until );
  3218. },
  3219. siblings: function( elem ) {
  3220. return siblings( ( elem.parentNode || {} ).firstChild, elem );
  3221. },
  3222. children: function( elem ) {
  3223. return siblings( elem.firstChild );
  3224. },
  3225. contents: function( elem ) {
  3226. if ( elem.contentDocument != null &&
  3227.  
  3228. // Support: IE 11+
  3229. // <object> elements with no `data` attribute has an object
  3230. // `contentDocument` with a `null` prototype.
  3231. getProto( elem.contentDocument ) ) {
  3232.  
  3233. return elem.contentDocument;
  3234. }
  3235.  
  3236. // Support: IE 9 - 11 only, iOS 7 only, Android Browser <=4.3 only
  3237. // Treat the template element as a regular one in browsers that
  3238. // don't support it.
  3239. if ( nodeName( elem, "template" ) ) {
  3240. elem = elem.content || elem;
  3241. }
  3242.  
  3243. return jQuery.merge( [], elem.childNodes );
  3244. }
  3245. }, function( name, fn ) {
  3246. jQuery.fn[ name ] = function( until, selector ) {
  3247. var matched = jQuery.map( this, fn, until );
  3248.  
  3249. if ( name.slice( -5 ) !== "Until" ) {
  3250. selector = until;
  3251. }
  3252.  
  3253. if ( selector && typeof selector === "string" ) {
  3254. matched = jQuery.filter( selector, matched );
  3255. }
  3256.  
  3257. if ( this.length > 1 ) {
  3258.  
  3259. // Remove duplicates
  3260. if ( !guaranteedUnique[ name ] ) {
  3261. jQuery.uniqueSort( matched );
  3262. }
  3263.  
  3264. // Reverse order for parents* and prev-derivatives
  3265. if ( rparentsprev.test( name ) ) {
  3266. matched.reverse();
  3267. }
  3268. }
  3269.  
  3270. return this.pushStack( matched );
  3271. };
  3272. } );
  3273. var rnothtmlwhite = ( /[^\x20\t\r\n\f]+/g );
  3274.  
  3275.  
  3276.  
  3277. // Convert String-formatted options into Object-formatted ones
  3278. function createOptions( options ) {
  3279. var object = {};
  3280. jQuery.each( options.match( rnothtmlwhite ) || [], function( _, flag ) {
  3281. object[ flag ] = true;
  3282. } );
  3283. return object;
  3284. }
  3285.  
  3286. /*
  3287. * Create a callback list using the following parameters:
  3288. *
  3289. * options: an optional list of space-separated options that will change how
  3290. * the callback list behaves or a more traditional option object
  3291. *
  3292. * By default a callback list will act like an event callback list and can be
  3293. * "fired" multiple times.
  3294. *
  3295. * Possible options:
  3296. *
  3297. * once: will ensure the callback list can only be fired once (like a Deferred)
  3298. *
  3299. * memory: will keep track of previous values and will call any callback added
  3300. * after the list has been fired right away with the latest "memorized"
  3301. * values (like a Deferred)
  3302. *
  3303. * unique: will ensure a callback can only be added once (no duplicate in the list)
  3304. *
  3305. * stopOnFalse: interrupt callings when a callback returns false
  3306. *
  3307. */
  3308. jQuery.Callbacks = function( options ) {
  3309.  
  3310. // Convert options from String-formatted to Object-formatted if needed
  3311. // (we check in cache first)
  3312. options = typeof options === "string" ?
  3313. createOptions( options ) :
  3314. jQuery.extend( {}, options );
  3315.  
  3316. var // Flag to know if list is currently firing
  3317. firing,
  3318.  
  3319. // Last fire value for non-forgettable lists
  3320. memory,
  3321.  
  3322. // Flag to know if list was already fired
  3323. fired,
  3324.  
  3325. // Flag to prevent firing
  3326. locked,
  3327.  
  3328. // Actual callback list
  3329. list = [],
  3330.  
  3331. // Queue of execution data for repeatable lists
  3332. queue = [],
  3333.  
  3334. // Index of currently firing callback (modified by add/remove as needed)
  3335. firingIndex = -1,
  3336.  
  3337. // Fire callbacks
  3338. fire = function() {
  3339.  
  3340. // Enforce single-firing
  3341. locked = locked || options.once;
  3342.  
  3343. // Execute callbacks for all pending executions,
  3344. // respecting firingIndex overrides and runtime changes
  3345. fired = firing = true;
  3346. for ( ; queue.length; firingIndex = -1 ) {
  3347. memory = queue.shift();
  3348. while ( ++firingIndex < list.length ) {
  3349.  
  3350. // Run callback and check for early termination
  3351. if ( list[ firingIndex ].apply( memory[ 0 ], memory[ 1 ] ) === false &&
  3352. options.stopOnFalse ) {
  3353.  
  3354. // Jump to end and forget the data so .add doesn't re-fire
  3355. firingIndex = list.length;
  3356. memory = false;
  3357. }
  3358. }
  3359. }
  3360.  
  3361. // Forget the data if we're done with it
  3362. if ( !options.memory ) {
  3363. memory = false;
  3364. }
  3365.  
  3366. firing = false;
  3367.  
  3368. // Clean up if we're done firing for good
  3369. if ( locked ) {
  3370.  
  3371. // Keep an empty list if we have data for future add calls
  3372. if ( memory ) {
  3373. list = [];
  3374.  
  3375. // Otherwise, this object is spent
  3376. } else {
  3377. list = "";
  3378. }
  3379. }
  3380. },
  3381.  
  3382. // Actual Callbacks object
  3383. self = {
  3384.  
  3385. // Add a callback or a collection of callbacks to the list
  3386. add: function() {
  3387. if ( list ) {
  3388.  
  3389. // If we have memory from a past run, we should fire after adding
  3390. if ( memory && !firing ) {
  3391. firingIndex = list.length - 1;
  3392. queue.push( memory );
  3393. }
  3394.  
  3395. ( function add( args ) {
  3396. jQuery.each( args, function( _, arg ) {
  3397. if ( isFunction( arg ) ) {
  3398. if ( !options.unique || !self.has( arg ) ) {
  3399. list.push( arg );
  3400. }
  3401. } else if ( arg && arg.length && toType( arg ) !== "string" ) {
  3402.  
  3403. // Inspect recursively
  3404. add( arg );
  3405. }
  3406. } );
  3407. } )( arguments );
  3408.  
  3409. if ( memory && !firing ) {
  3410. fire();
  3411. }
  3412. }
  3413. return this;
  3414. },
  3415.  
  3416. // Remove a callback from the list
  3417. remove: function() {
  3418. jQuery.each( arguments, function( _, arg ) {
  3419. var index;
  3420. while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) {
  3421. list.splice( index, 1 );
  3422.  
  3423. // Handle firing indexes
  3424. if ( index <= firingIndex ) {
  3425. firingIndex--;
  3426. }
  3427. }
  3428. } );
  3429. return this;
  3430. },
  3431.  
  3432. // Check if a given callback is in the list.
  3433. // If no argument is given, return whether or not list has callbacks attached.
  3434. has: function( fn ) {
  3435. return fn ?
  3436. jQuery.inArray( fn, list ) > -1 :
  3437. list.length > 0;
  3438. },
  3439.  
  3440. // Remove all callbacks from the list
  3441. empty: function() {
  3442. if ( list ) {
  3443. list = [];
  3444. }
  3445. return this;
  3446. },
  3447.  
  3448. // Disable .fire and .add
  3449. // Abort any current/pending executions
  3450. // Clear all callbacks and values
  3451. disable: function() {
  3452. locked = queue = [];
  3453. list = memory = "";
  3454. return this;
  3455. },
  3456. disabled: function() {
  3457. return !list;
  3458. },
  3459.  
  3460. // Disable .fire
  3461. // Also disable .add unless we have memory (since it would have no effect)
  3462. // Abort any pending executions
  3463. lock: function() {
  3464. locked = queue = [];
  3465. if ( !memory && !firing ) {
  3466. list = memory = "";
  3467. }
  3468. return this;
  3469. },
  3470. locked: function() {
  3471. return !!locked;
  3472. },
  3473.  
  3474. // Call all callbacks with the given context and arguments
  3475. fireWith: function( context, args ) {
  3476. if ( !locked ) {
  3477. args = args || [];
  3478. args = [ context, args.slice ? args.slice() : args ];
  3479. queue.push( args );
  3480. if ( !firing ) {
  3481. fire();
  3482. }
  3483. }
  3484. return this;
  3485. },
  3486.  
  3487. // Call all the callbacks with the given arguments
  3488. fire: function() {
  3489. self.fireWith( this, arguments );
  3490. return this;
  3491. },
  3492.  
  3493. // To know if the callbacks have already been called at least once
  3494. fired: function() {
  3495. return !!fired;
  3496. }
  3497. };
  3498.  
  3499. return self;
  3500. };
  3501.  
  3502.  
  3503. function Identity( v ) {
  3504. return v;
  3505. }
  3506. function Thrower( ex ) {
  3507. throw ex;
  3508. }
  3509.  
  3510. function adoptValue( value, resolve, reject, noValue ) {
  3511. var method;
  3512.  
  3513. try {
  3514.  
  3515. // Check for promise aspect first to privilege synchronous behavior
  3516. if ( value && isFunction( ( method = value.promise ) ) ) {
  3517. method.call( value ).done( resolve ).fail( reject );
  3518.  
  3519. // Other thenables
  3520. } else if ( value && isFunction( ( method = value.then ) ) ) {
  3521. method.call( value, resolve, reject );
  3522.  
  3523. // Other non-thenables
  3524. } else {
  3525.  
  3526. // Control `resolve` arguments by letting Array#slice cast boolean `noValue` to integer:
  3527. // * false: [ value ].slice( 0 ) => resolve( value )
  3528. // * true: [ value ].slice( 1 ) => resolve()
  3529. resolve.apply( undefined, [ value ].slice( noValue ) );
  3530. }
  3531.  
  3532. // For Promises/A+, convert exceptions into rejections
  3533. // Since jQuery.when doesn't unwrap thenables, we can skip the extra checks appearing in
  3534. // Deferred#then to conditionally suppress rejection.
  3535. } catch ( value ) {
  3536.  
  3537. // Support: Android 4.0 only
  3538. // Strict mode functions invoked without .call/.apply get global-object context
  3539. reject.apply( undefined, [ value ] );
  3540. }
  3541. }
  3542.  
  3543. jQuery.extend( {
  3544.  
  3545. Deferred: function( func ) {
  3546. var tuples = [
  3547.  
  3548. // action, add listener, callbacks,
  3549. // ... .then handlers, argument index, [final state]
  3550. [ "notify", "progress", jQuery.Callbacks( "memory" ),
  3551. jQuery.Callbacks( "memory" ), 2 ],
  3552. [ "resolve", "done", jQuery.Callbacks( "once memory" ),
  3553. jQuery.Callbacks( "once memory" ), 0, "resolved" ],
  3554. [ "reject", "fail", jQuery.Callbacks( "once memory" ),
  3555. jQuery.Callbacks( "once memory" ), 1, "rejected" ]
  3556. ],
  3557. state = "pending",
  3558. promise = {
  3559. state: function() {
  3560. return state;
  3561. },
  3562. always: function() {
  3563. deferred.done( arguments ).fail( arguments );
  3564. return this;
  3565. },
  3566. "catch": function( fn ) {
  3567. return promise.then( null, fn );
  3568. },
  3569.  
  3570. // Keep pipe for back-compat
  3571. pipe: function( /* fnDone, fnFail, fnProgress */ ) {
  3572. var fns = arguments;
  3573.  
  3574. return jQuery.Deferred( function( newDefer ) {
  3575. jQuery.each( tuples, function( _i, tuple ) {
  3576.  
  3577. // Map tuples (progress, done, fail) to arguments (done, fail, progress)
  3578. var fn = isFunction( fns[ tuple[ 4 ] ] ) && fns[ tuple[ 4 ] ];
  3579.  
  3580. // deferred.progress(function() { bind to newDefer or newDefer.notify })
  3581. // deferred.done(function() { bind to newDefer or newDefer.resolve })
  3582. // deferred.fail(function() { bind to newDefer or newDefer.reject })
  3583. deferred[ tuple[ 1 ] ]( function() {
  3584. var returned = fn && fn.apply( this, arguments );
  3585. if ( returned && isFunction( returned.promise ) ) {
  3586. returned.promise()
  3587. .progress( newDefer.notify )
  3588. .done( newDefer.resolve )
  3589. .fail( newDefer.reject );
  3590. } else {
  3591. newDefer[ tuple[ 0 ] + "With" ](
  3592. this,
  3593. fn ? [ returned ] : arguments
  3594. );
  3595. }
  3596. } );
  3597. } );
  3598. fns = null;
  3599. } ).promise();
  3600. },
  3601. then: function( onFulfilled, onRejected, onProgress ) {
  3602. var maxDepth = 0;
  3603. function resolve( depth, deferred, handler, special ) {
  3604. return function() {
  3605. var that = this,
  3606. args = arguments,
  3607. mightThrow = function() {
  3608. var returned, then;
  3609.  
  3610. // Support: Promises/A+ section 2.3.3.3.3
  3611. // https://promisesaplus.com/#point-59
  3612. // Ignore double-resolution attempts
  3613. if ( depth < maxDepth ) {
  3614. return;
  3615. }
  3616.  
  3617. returned = handler.apply( that, args );
  3618.  
  3619. // Support: Promises/A+ section 2.3.1
  3620. // https://promisesaplus.com/#point-48
  3621. if ( returned === deferred.promise() ) {
  3622. throw new TypeError( "Thenable self-resolution" );
  3623. }
  3624.  
  3625. // Support: Promises/A+ sections 2.3.3.1, 3.5
  3626. // https://promisesaplus.com/#point-54
  3627. // https://promisesaplus.com/#point-75
  3628. // Retrieve `then` only once
  3629. then = returned &&
  3630.  
  3631. // Support: Promises/A+ section 2.3.4
  3632. // https://promisesaplus.com/#point-64
  3633. // Only check objects and functions for thenability
  3634. ( typeof returned === "object" ||
  3635. typeof returned === "function" ) &&
  3636. returned.then;
  3637.  
  3638. // Handle a returned thenable
  3639. if ( isFunction( then ) ) {
  3640.  
  3641. // Special processors (notify) just wait for resolution
  3642. if ( special ) {
  3643. then.call(
  3644. returned,
  3645. resolve( maxDepth, deferred, Identity, special ),
  3646. resolve( maxDepth, deferred, Thrower, special )
  3647. );
  3648.  
  3649. // Normal processors (resolve) also hook into progress
  3650. } else {
  3651.  
  3652. // ...and disregard older resolution values
  3653. maxDepth++;
  3654.  
  3655. then.call(
  3656. returned,
  3657. resolve( maxDepth, deferred, Identity, special ),
  3658. resolve( maxDepth, deferred, Thrower, special ),
  3659. resolve( maxDepth, deferred, Identity,
  3660. deferred.notifyWith )
  3661. );
  3662. }
  3663.  
  3664. // Handle all other returned values
  3665. } else {
  3666.  
  3667. // Only substitute handlers pass on context
  3668. // and multiple values (non-spec behavior)
  3669. if ( handler !== Identity ) {
  3670. that = undefined;
  3671. args = [ returned ];
  3672. }
  3673.  
  3674. // Process the value(s)
  3675. // Default process is resolve
  3676. ( special || deferred.resolveWith )( that, args );
  3677. }
  3678. },
  3679.  
  3680. // Only normal processors (resolve) catch and reject exceptions
  3681. process = special ?
  3682. mightThrow :
  3683. function() {
  3684. try {
  3685. mightThrow();
  3686. } catch ( e ) {
  3687.  
  3688. if ( jQuery.Deferred.exceptionHook ) {
  3689. jQuery.Deferred.exceptionHook( e,
  3690. process.error );
  3691. }
  3692.  
  3693. // Support: Promises/A+ section 2.3.3.3.4.1
  3694. // https://promisesaplus.com/#point-61
  3695. // Ignore post-resolution exceptions
  3696. if ( depth + 1 >= maxDepth ) {
  3697.  
  3698. // Only substitute handlers pass on context
  3699. // and multiple values (non-spec behavior)
  3700. if ( handler !== Thrower ) {
  3701. that = undefined;
  3702. args = [ e ];
  3703. }
  3704.  
  3705. deferred.rejectWith( that, args );
  3706. }
  3707. }
  3708. };
  3709.  
  3710. // Support: Promises/A+ section 2.3.3.3.1
  3711. // https://promisesaplus.com/#point-57
  3712. // Re-resolve promises immediately to dodge false rejection from
  3713. // subsequent errors
  3714. if ( depth ) {
  3715. process();
  3716. } else {
  3717.  
  3718. // Call an optional hook to record the error, in case of exception
  3719. // since it's otherwise lost when execution goes async
  3720. if ( jQuery.Deferred.getErrorHook ) {
  3721. process.error = jQuery.Deferred.getErrorHook();
  3722.  
  3723. // The deprecated alias of the above. While the name suggests
  3724. // returning the stack, not an error instance, jQuery just passes
  3725. // it directly to `console.warn` so both will work; an instance
  3726. // just better cooperates with source maps.
  3727. } else if ( jQuery.Deferred.getStackHook ) {
  3728. process.error = jQuery.Deferred.getStackHook();
  3729. }
  3730. window.setTimeout( process );
  3731. }
  3732. };
  3733. }
  3734.  
  3735. return jQuery.Deferred( function( newDefer ) {
  3736.  
  3737. // progress_handlers.add( ... )
  3738. tuples[ 0 ][ 3 ].add(
  3739. resolve(
  3740. 0,
  3741. newDefer,
  3742. isFunction( onProgress ) ?
  3743. onProgress :
  3744. Identity,
  3745. newDefer.notifyWith
  3746. )
  3747. );
  3748.  
  3749. // fulfilled_handlers.add( ... )
  3750. tuples[ 1 ][ 3 ].add(
  3751. resolve(
  3752. 0,
  3753. newDefer,
  3754. isFunction( onFulfilled ) ?
  3755. onFulfilled :
  3756. Identity
  3757. )
  3758. );
  3759.  
  3760. // rejected_handlers.add( ... )
  3761. tuples[ 2 ][ 3 ].add(
  3762. resolve(
  3763. 0,
  3764. newDefer,
  3765. isFunction( onRejected ) ?
  3766. onRejected :
  3767. Thrower
  3768. )
  3769. );
  3770. } ).promise();
  3771. },
  3772.  
  3773. // Get a promise for this deferred
  3774. // If obj is provided, the promise aspect is added to the object
  3775. promise: function( obj ) {
  3776. return obj != null ? jQuery.extend( obj, promise ) : promise;
  3777. }
  3778. },
  3779. deferred = {};
  3780.  
  3781. // Add list-specific methods
  3782. jQuery.each( tuples, function( i, tuple ) {
  3783. var list = tuple[ 2 ],
  3784. stateString = tuple[ 5 ];
  3785.  
  3786. // promise.progress = list.add
  3787. // promise.done = list.add
  3788. // promise.fail = list.add
  3789. promise[ tuple[ 1 ] ] = list.add;
  3790.  
  3791. // Handle state
  3792. if ( stateString ) {
  3793. list.add(
  3794. function() {
  3795.  
  3796. // state = "resolved" (i.e., fulfilled)
  3797. // state = "rejected"
  3798. state = stateString;
  3799. },
  3800.  
  3801. // rejected_callbacks.disable
  3802. // fulfilled_callbacks.disable
  3803. tuples[ 3 - i ][ 2 ].disable,
  3804.  
  3805. // rejected_handlers.disable
  3806. // fulfilled_handlers.disable
  3807. tuples[ 3 - i ][ 3 ].disable,
  3808.  
  3809. // progress_callbacks.lock
  3810. tuples[ 0 ][ 2 ].lock,
  3811.  
  3812. // progress_handlers.lock
  3813. tuples[ 0 ][ 3 ].lock
  3814. );
  3815. }
  3816.  
  3817. // progress_handlers.fire
  3818. // fulfilled_handlers.fire
  3819. // rejected_handlers.fire
  3820. list.add( tuple[ 3 ].fire );
  3821.  
  3822. // deferred.notify = function() { deferred.notifyWith(...) }
  3823. // deferred.resolve = function() { deferred.resolveWith(...) }
  3824. // deferred.reject = function() { deferred.rejectWith(...) }
  3825. deferred[ tuple[ 0 ] ] = function() {
  3826. deferred[ tuple[ 0 ] + "With" ]( this === deferred ? undefined : this, arguments );
  3827. return this;
  3828. };
  3829.  
  3830. // deferred.notifyWith = list.fireWith
  3831. // deferred.resolveWith = list.fireWith
  3832. // deferred.rejectWith = list.fireWith
  3833. deferred[ tuple[ 0 ] + "With" ] = list.fireWith;
  3834. } );
  3835.  
  3836. // Make the deferred a promise
  3837. promise.promise( deferred );
  3838.  
  3839. // Call given func if any
  3840. if ( func ) {
  3841. func.call( deferred, deferred );
  3842. }
  3843.  
  3844. // All done!
  3845. return deferred;
  3846. },
  3847.  
  3848. // Deferred helper
  3849. when: function( singleValue ) {
  3850. var
  3851.  
  3852. // count of uncompleted subordinates
  3853. remaining = arguments.length,
  3854.  
  3855. // count of unprocessed arguments
  3856. i = remaining,
  3857.  
  3858. // subordinate fulfillment data
  3859. resolveContexts = Array( i ),
  3860. resolveValues = slice.call( arguments ),
  3861.  
  3862. // the primary Deferred
  3863. primary = jQuery.Deferred(),
  3864.  
  3865. // subordinate callback factory
  3866. updateFunc = function( i ) {
  3867. return function( value ) {
  3868. resolveContexts[ i ] = this;
  3869. resolveValues[ i ] = arguments.length > 1 ? slice.call( arguments ) : value;
  3870. if ( !( --remaining ) ) {
  3871. primary.resolveWith( resolveContexts, resolveValues );
  3872. }
  3873. };
  3874. };
  3875.  
  3876. // Single- and empty arguments are adopted like Promise.resolve
  3877. if ( remaining <= 1 ) {
  3878. adoptValue( singleValue, primary.done( updateFunc( i ) ).resolve, primary.reject,
  3879. !remaining );
  3880.  
  3881. // Use .then() to unwrap secondary thenables (cf. gh-3000)
  3882. if ( primary.state() === "pending" ||
  3883. isFunction( resolveValues[ i ] && resolveValues[ i ].then ) ) {
  3884.  
  3885. return primary.then();
  3886. }
  3887. }
  3888.  
  3889. // Multiple arguments are aggregated like Promise.all array elements
  3890. while ( i-- ) {
  3891. adoptValue( resolveValues[ i ], updateFunc( i ), primary.reject );
  3892. }
  3893.  
  3894. return primary.promise();
  3895. }
  3896. } );
  3897.  
  3898.  
  3899. // These usually indicate a programmer mistake during development,
  3900. // warn about them ASAP rather than swallowing them by default.
  3901. var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;
  3902.  
  3903. // If `jQuery.Deferred.getErrorHook` is defined, `asyncError` is an error
  3904. // captured before the async barrier to get the original error cause
  3905. // which may otherwise be hidden.
  3906. jQuery.Deferred.exceptionHook = function( error, asyncError ) {
  3907.  
  3908. // Support: IE 8 - 9 only
  3909. // Console exists when dev tools are open, which can happen at any time
  3910. if ( window.console && window.console.warn && error && rerrorNames.test( error.name ) ) {
  3911. window.console.warn( "jQuery.Deferred exception: " + error.message,
  3912. error.stack, asyncError );
  3913. }
  3914. };
  3915.  
  3916.  
  3917.  
  3918.  
  3919. jQuery.readyException = function( error ) {
  3920. window.setTimeout( function() {
  3921. throw error;
  3922. } );
  3923. };
  3924.  
  3925.  
  3926.  
  3927.  
  3928. // The deferred used on DOM ready
  3929. var readyList = jQuery.Deferred();
  3930.  
  3931. jQuery.fn.ready = function( fn ) {
  3932.  
  3933. readyList
  3934. .then( fn )
  3935.  
  3936. // Wrap jQuery.readyException in a function so that the lookup
  3937. // happens at the time of error handling instead of callback
  3938. // registration.
  3939. .catch( function( error ) {
  3940. jQuery.readyException( error );
  3941. } );
  3942.  
  3943. return this;
  3944. };
  3945.  
  3946. jQuery.extend( {
  3947.  
  3948. // Is the DOM ready to be used? Set to true once it occurs.
  3949. isReady: false,
  3950.  
  3951. // A counter to track how many items to wait for before
  3952. // the ready event fires. See trac-6781
  3953. readyWait: 1,
  3954.  
  3955. // Handle when the DOM is ready
  3956. ready: function( wait ) {
  3957.  
  3958. // Abort if there are pending holds or we're already ready
  3959. if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) {
  3960. return;
  3961. }
  3962.  
  3963. // Remember that the DOM is ready
  3964. jQuery.isReady = true;
  3965.  
  3966. // If a normal DOM Ready event fired, decrement, and wait if need be
  3967. if ( wait !== true && --jQuery.readyWait > 0 ) {
  3968. return;
  3969. }
  3970.  
  3971. // If there are functions bound, to execute
  3972. readyList.resolveWith( document, [ jQuery ] );
  3973. }
  3974. } );
  3975.  
  3976. jQuery.ready.then = readyList.then;
  3977.  
  3978. // The ready event handler and self cleanup method
  3979. function completed() {
  3980. document.removeEventListener( "DOMContentLoaded", completed );
  3981. window.removeEventListener( "load", completed );
  3982. jQuery.ready();
  3983. }
  3984.  
  3985. // Catch cases where $(document).ready() is called
  3986. // after the browser event has already occurred.
  3987. // Support: IE <=9 - 10 only
  3988. // Older IE sometimes signals "interactive" too soon
  3989. if ( document.readyState === "complete" ||
  3990. ( document.readyState !== "loading" && !document.documentElement.doScroll ) ) {
  3991.  
  3992. // Handle it asynchronously to allow scripts the opportunity to delay ready
  3993. window.setTimeout( jQuery.ready );
  3994.  
  3995. } else {
  3996.  
  3997. // Use the handy event callback
  3998. document.addEventListener( "DOMContentLoaded", completed );
  3999.  
  4000. // A fallback to window.onload, that will always work
  4001. window.addEventListener( "load", completed );
  4002. }
  4003.  
  4004.  
  4005.  
  4006.  
  4007. // Multifunctional method to get and set values of a collection
  4008. // The value/s can optionally be executed if it's a function
  4009. var access = function( elems, fn, key, value, chainable, emptyGet, raw ) {
  4010. var i = 0,
  4011. len = elems.length,
  4012. bulk = key == null;
  4013.  
  4014. // Sets many values
  4015. if ( toType( key ) === "object" ) {
  4016. chainable = true;
  4017. for ( i in key ) {
  4018. access( elems, fn, i, key[ i ], true, emptyGet, raw );
  4019. }
  4020.  
  4021. // Sets one value
  4022. } else if ( value !== undefined ) {
  4023. chainable = true;
  4024.  
  4025. if ( !isFunction( value ) ) {
  4026. raw = true;
  4027. }
  4028.  
  4029. if ( bulk ) {
  4030.  
  4031. // Bulk operations run against the entire set
  4032. if ( raw ) {
  4033. fn.call( elems, value );
  4034. fn = null;
  4035.  
  4036. // ...except when executing function values
  4037. } else {
  4038. bulk = fn;
  4039. fn = function( elem, _key, value ) {
  4040. return bulk.call( jQuery( elem ), value );
  4041. };
  4042. }
  4043. }
  4044.  
  4045. if ( fn ) {
  4046. for ( ; i < len; i++ ) {
  4047. fn(
  4048. elems[ i ], key, raw ?
  4049. value :
  4050. value.call( elems[ i ], i, fn( elems[ i ], key ) )
  4051. );
  4052. }
  4053. }
  4054. }
  4055.  
  4056. if ( chainable ) {
  4057. return elems;
  4058. }
  4059.  
  4060. // Gets
  4061. if ( bulk ) {
  4062. return fn.call( elems );
  4063. }
  4064.  
  4065. return len ? fn( elems[ 0 ], key ) : emptyGet;
  4066. };
  4067.  
  4068.  
  4069. // Matches dashed string for camelizing
  4070. var rmsPrefix = /^-ms-/,
  4071. rdashAlpha = /-([a-z])/g;
  4072.  
  4073. // Used by camelCase as callback to replace()
  4074. function fcamelCase( _all, letter ) {
  4075. return letter.toUpperCase();
  4076. }
  4077.  
  4078. // Convert dashed to camelCase; used by the css and data modules
  4079. // Support: IE <=9 - 11, Edge 12 - 15
  4080. // Microsoft forgot to hump their vendor prefix (trac-9572)
  4081. function camelCase( string ) {
  4082. return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
  4083. }
  4084. var acceptData = function( owner ) {
  4085.  
  4086. // Accepts only:
  4087. // - Node
  4088. // - Node.ELEMENT_NODE
  4089. // - Node.DOCUMENT_NODE
  4090. // - Object
  4091. // - Any
  4092. return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType );
  4093. };
  4094.  
  4095.  
  4096.  
  4097.  
  4098. function Data() {
  4099. this.expando = jQuery.expando + Data.uid++;
  4100. }
  4101.  
  4102. Data.uid = 1;
  4103.  
  4104. Data.prototype = {
  4105.  
  4106. cache: function( owner ) {
  4107.  
  4108. // Check if the owner object already has a cache
  4109. var value = owner[ this.expando ];
  4110.  
  4111. // If not, create one
  4112. if ( !value ) {
  4113. value = {};
  4114.  
  4115. // We can accept data for non-element nodes in modern browsers,
  4116. // but we should not, see trac-8335.
  4117. // Always return an empty object.
  4118. if ( acceptData( owner ) ) {
  4119.  
  4120. // If it is a node unlikely to be stringify-ed or looped over
  4121. // use plain assignment
  4122. if ( owner.nodeType ) {
  4123. owner[ this.expando ] = value;
  4124.  
  4125. // Otherwise secure it in a non-enumerable property
  4126. // configurable must be true to allow the property to be
  4127. // deleted when data is removed
  4128. } else {
  4129. Object.defineProperty( owner, this.expando, {
  4130. value: value,
  4131. configurable: true
  4132. } );
  4133. }
  4134. }
  4135. }
  4136.  
  4137. return value;
  4138. },
  4139. set: function( owner, data, value ) {
  4140. var prop,
  4141. cache = this.cache( owner );
  4142.  
  4143. // Handle: [ owner, key, value ] args
  4144. // Always use camelCase key (gh-2257)
  4145. if ( typeof data === "string" ) {
  4146. cache[ camelCase( data ) ] = value;
  4147.  
  4148. // Handle: [ owner, { properties } ] args
  4149. } else {
  4150.  
  4151. // Copy the properties one-by-one to the cache object
  4152. for ( prop in data ) {
  4153. cache[ camelCase( prop ) ] = data[ prop ];
  4154. }
  4155. }
  4156. return cache;
  4157. },
  4158. get: function( owner, key ) {
  4159. return key === undefined ?
  4160. this.cache( owner ) :
  4161.  
  4162. // Always use camelCase key (gh-2257)
  4163. owner[ this.expando ] && owner[ this.expando ][ camelCase( key ) ];
  4164. },
  4165. access: function( owner, key, value ) {
  4166.  
  4167. // In cases where either:
  4168. //
  4169. // 1. No key was specified
  4170. // 2. A string key was specified, but no value provided
  4171. //
  4172. // Take the "read" path and allow the get method to determine
  4173. // which value to return, respectively either:
  4174. //
  4175. // 1. The entire cache object
  4176. // 2. The data stored at the key
  4177. //
  4178. if ( key === undefined ||
  4179. ( ( key && typeof key === "string" ) && value === undefined ) ) {
  4180.  
  4181. return this.get( owner, key );
  4182. }
  4183.  
  4184. // When the key is not a string, or both a key and value
  4185. // are specified, set or extend (existing objects) with either:
  4186. //
  4187. // 1. An object of properties
  4188. // 2. A key and value
  4189. //
  4190. this.set( owner, key, value );
  4191.  
  4192. // Since the "set" path can have two possible entry points
  4193. // return the expected data based on which path was taken[*]
  4194. return value !== undefined ? value : key;
  4195. },
  4196. remove: function( owner, key ) {
  4197. var i,
  4198. cache = owner[ this.expando ];
  4199.  
  4200. if ( cache === undefined ) {
  4201. return;
  4202. }
  4203.  
  4204. if ( key !== undefined ) {
  4205.  
  4206. // Support array or space separated string of keys
  4207. if ( Array.isArray( key ) ) {
  4208.  
  4209. // If key is an array of keys...
  4210. // We always set camelCase keys, so remove that.
  4211. key = key.map( camelCase );
  4212. } else {
  4213. key = camelCase( key );
  4214.  
  4215. // If a key with the spaces exists, use it.
  4216. // Otherwise, create an array by matching non-whitespace
  4217. key = key in cache ?
  4218. [ key ] :
  4219. ( key.match( rnothtmlwhite ) || [] );
  4220. }
  4221.  
  4222. i = key.length;
  4223.  
  4224. while ( i-- ) {
  4225. delete cache[ key[ i ] ];
  4226. }
  4227. }
  4228.  
  4229. // Remove the expando if there's no more data
  4230. if ( key === undefined || jQuery.isEmptyObject( cache ) ) {
  4231.  
  4232. // Support: Chrome <=35 - 45
  4233. // Webkit & Blink performance suffers when deleting properties
  4234. // from DOM nodes, so set to undefined instead
  4235. // https://bugs.chromium.org/p/chromium/issues/detail?id=378607 (bug restricted)
  4236. if ( owner.nodeType ) {
  4237. owner[ this.expando ] = undefined;
  4238. } else {
  4239. delete owner[ this.expando ];
  4240. }
  4241. }
  4242. },
  4243. hasData: function( owner ) {
  4244. var cache = owner[ this.expando ];
  4245. return cache !== undefined && !jQuery.isEmptyObject( cache );
  4246. }
  4247. };
  4248. var dataPriv = new Data();
  4249.  
  4250. var dataUser = new Data();
  4251.  
  4252.  
  4253.  
  4254. // Implementation Summary
  4255. //
  4256. // 1. Enforce API surface and semantic compatibility with 1.9.x branch
  4257. // 2. Improve the module's maintainability by reducing the storage
  4258. // paths to a single mechanism.
  4259. // 3. Use the same single mechanism to support "private" and "user" data.
  4260. // 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData)
  4261. // 5. Avoid exposing implementation details on user objects (eg. expando properties)
  4262. // 6. Provide a clear path for implementation upgrade to WeakMap in 2014
  4263.  
  4264. var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,
  4265. rmultiDash = /[A-Z]/g;
  4266.  
  4267. function getData( data ) {
  4268. if ( data === "true" ) {
  4269. return true;
  4270. }
  4271.  
  4272. if ( data === "false" ) {
  4273. return false;
  4274. }
  4275.  
  4276. if ( data === "null" ) {
  4277. return null;
  4278. }
  4279.  
  4280. // Only convert to a number if it doesn't change the string
  4281. if ( data === +data + "" ) {
  4282. return +data;
  4283. }
  4284.  
  4285. if ( rbrace.test( data ) ) {
  4286. return JSON.parse( data );
  4287. }
  4288.  
  4289. return data;
  4290. }
  4291.  
  4292. function dataAttr( elem, key, data ) {
  4293. var name;
  4294.  
  4295. // If nothing was found internally, try to fetch any
  4296. // data from the HTML5 data-* attribute
  4297. if ( data === undefined && elem.nodeType === 1 ) {
  4298. name = "data-" + key.replace( rmultiDash, "-$&" ).toLowerCase();
  4299. data = elem.getAttribute( name );
  4300.  
  4301. if ( typeof data === "string" ) {
  4302. try {
  4303. data = getData( data );
  4304. } catch ( e ) {}
  4305.  
  4306. // Make sure we set the data so it isn't changed later
  4307. dataUser.set( elem, key, data );
  4308. } else {
  4309. data = undefined;
  4310. }
  4311. }
  4312. return data;
  4313. }
  4314.  
  4315. jQuery.extend( {
  4316. hasData: function( elem ) {
  4317. return dataUser.hasData( elem ) || dataPriv.hasData( elem );
  4318. },
  4319.  
  4320. data: function( elem, name, data ) {
  4321. return dataUser.access( elem, name, data );
  4322. },
  4323.  
  4324. removeData: function( elem, name ) {
  4325. dataUser.remove( elem, name );
  4326. },
  4327.  
  4328. // TODO: Now that all calls to _data and _removeData have been replaced
  4329. // with direct calls to dataPriv methods, these can be deprecated.
  4330. _data: function( elem, name, data ) {
  4331. return dataPriv.access( elem, name, data );
  4332. },
  4333.  
  4334. _removeData: function( elem, name ) {
  4335. dataPriv.remove( elem, name );
  4336. }
  4337. } );
  4338.  
  4339. jQuery.fn.extend( {
  4340. data: function( key, value ) {
  4341. var i, name, data,
  4342. elem = this[ 0 ],
  4343. attrs = elem && elem.attributes;
  4344.  
  4345. // Gets all values
  4346. if ( key === undefined ) {
  4347. if ( this.length ) {
  4348. data = dataUser.get( elem );
  4349.  
  4350. if ( elem.nodeType === 1 && !dataPriv.get( elem, "hasDataAttrs" ) ) {
  4351. i = attrs.length;
  4352. while ( i-- ) {
  4353.  
  4354. // Support: IE 11 only
  4355. // The attrs elements can be null (trac-14894)
  4356. if ( attrs[ i ] ) {
  4357. name = attrs[ i ].name;
  4358. if ( name.indexOf( "data-" ) === 0 ) {
  4359. name = camelCase( name.slice( 5 ) );
  4360. dataAttr( elem, name, data[ name ] );
  4361. }
  4362. }
  4363. }
  4364. dataPriv.set( elem, "hasDataAttrs", true );
  4365. }
  4366. }
  4367.  
  4368. return data;
  4369. }
  4370.  
  4371. // Sets multiple values
  4372. if ( typeof key === "object" ) {
  4373. return this.each( function() {
  4374. dataUser.set( this, key );
  4375. } );
  4376. }
  4377.  
  4378. return access( this, function( value ) {
  4379. var data;
  4380.  
  4381. // The calling jQuery object (element matches) is not empty
  4382. // (and therefore has an element appears at this[ 0 ]) and the
  4383. // `value` parameter was not undefined. An empty jQuery object
  4384. // will result in `undefined` for elem = this[ 0 ] which will
  4385. // throw an exception if an attempt to read a data cache is made.
  4386. if ( elem && value === undefined ) {
  4387.  
  4388. // Attempt to get data from the cache
  4389. // The key will always be camelCased in Data
  4390. data = dataUser.get( elem, key );
  4391. if ( data !== undefined ) {
  4392. return data;
  4393. }
  4394.  
  4395. // Attempt to "discover" the data in
  4396. // HTML5 custom data-* attrs
  4397. data = dataAttr( elem, key );
  4398. if ( data !== undefined ) {
  4399. return data;
  4400. }
  4401.  
  4402. // We tried really hard, but the data doesn't exist.
  4403. return;
  4404. }
  4405.  
  4406. // Set the data...
  4407. this.each( function() {
  4408.  
  4409. // We always store the camelCased key
  4410. dataUser.set( this, key, value );
  4411. } );
  4412. }, null, value, arguments.length > 1, null, true );
  4413. },
  4414.  
  4415. removeData: function( key ) {
  4416. return this.each( function() {
  4417. dataUser.remove( this, key );
  4418. } );
  4419. }
  4420. } );
  4421.  
  4422.  
  4423. jQuery.extend( {
  4424. queue: function( elem, type, data ) {
  4425. var queue;
  4426.  
  4427. if ( elem ) {
  4428. type = ( type || "fx" ) + "queue";
  4429. queue = dataPriv.get( elem, type );
  4430.  
  4431. // Speed up dequeue by getting out quickly if this is just a lookup
  4432. if ( data ) {
  4433. if ( !queue || Array.isArray( data ) ) {
  4434. queue = dataPriv.access( elem, type, jQuery.makeArray( data ) );
  4435. } else {
  4436. queue.push( data );
  4437. }
  4438. }
  4439. return queue || [];
  4440. }
  4441. },
  4442.  
  4443. dequeue: function( elem, type ) {
  4444. type = type || "fx";
  4445.  
  4446. var queue = jQuery.queue( elem, type ),
  4447. startLength = queue.length,
  4448. fn = queue.shift(),
  4449. hooks = jQuery._queueHooks( elem, type ),
  4450. next = function() {
  4451. jQuery.dequeue( elem, type );
  4452. };
  4453.  
  4454. // If the fx queue is dequeued, always remove the progress sentinel
  4455. if ( fn === "inprogress" ) {
  4456. fn = queue.shift();
  4457. startLength--;
  4458. }
  4459.  
  4460. if ( fn ) {
  4461.  
  4462. // Add a progress sentinel to prevent the fx queue from being
  4463. // automatically dequeued
  4464. if ( type === "fx" ) {
  4465. queue.unshift( "inprogress" );
  4466. }
  4467.  
  4468. // Clear up the last queue stop function
  4469. delete hooks.stop;
  4470. fn.call( elem, next, hooks );
  4471. }
  4472.  
  4473. if ( !startLength && hooks ) {
  4474. hooks.empty.fire();
  4475. }
  4476. },
  4477.  
  4478. // Not public - generate a queueHooks object, or return the current one
  4479. _queueHooks: function( elem, type ) {
  4480. var key = type + "queueHooks";
  4481. return dataPriv.get( elem, key ) || dataPriv.access( elem, key, {
  4482. empty: jQuery.Callbacks( "once memory" ).add( function() {
  4483. dataPriv.remove( elem, [ type + "queue", key ] );
  4484. } )
  4485. } );
  4486. }
  4487. } );
  4488.  
  4489. jQuery.fn.extend( {
  4490. queue: function( type, data ) {
  4491. var setter = 2;
  4492.  
  4493. if ( typeof type !== "string" ) {
  4494. data = type;
  4495. type = "fx";
  4496. setter--;
  4497. }
  4498.  
  4499. if ( arguments.length < setter ) {
  4500. return jQuery.queue( this[ 0 ], type );
  4501. }
  4502.  
  4503. return data === undefined ?
  4504. this :
  4505. this.each( function() {
  4506. var queue = jQuery.queue( this, type, data );
  4507.  
  4508. // Ensure a hooks for this queue
  4509. jQuery._queueHooks( this, type );
  4510.  
  4511. if ( type === "fx" && queue[ 0 ] !== "inprogress" ) {
  4512. jQuery.dequeue( this, type );
  4513. }
  4514. } );
  4515. },
  4516. dequeue: function( type ) {
  4517. return this.each( function() {
  4518. jQuery.dequeue( this, type );
  4519. } );
  4520. },
  4521. clearQueue: function( type ) {
  4522. return this.queue( type || "fx", [] );
  4523. },
  4524.  
  4525. // Get a promise resolved when queues of a certain type
  4526. // are emptied (fx is the type by default)
  4527. promise: function( type, obj ) {
  4528. var tmp,
  4529. count = 1,
  4530. defer = jQuery.Deferred(),
  4531. elements = this,
  4532. i = this.length,
  4533. resolve = function() {
  4534. if ( !( --count ) ) {
  4535. defer.resolveWith( elements, [ elements ] );
  4536. }
  4537. };
  4538.  
  4539. if ( typeof type !== "string" ) {
  4540. obj = type;
  4541. type = undefined;
  4542. }
  4543. type = type || "fx";
  4544.  
  4545. while ( i-- ) {
  4546. tmp = dataPriv.get( elements[ i ], type + "queueHooks" );
  4547. if ( tmp && tmp.empty ) {
  4548. count++;
  4549. tmp.empty.add( resolve );
  4550. }
  4551. }
  4552. resolve();
  4553. return defer.promise( obj );
  4554. }
  4555. } );
  4556. var pnum = ( /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/ ).source;
  4557.  
  4558. var rcssNum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" );
  4559.  
  4560.  
  4561. var cssExpand = [ "Top", "Right", "Bottom", "Left" ];
  4562.  
  4563. var documentElement = document.documentElement;
  4564.  
  4565.  
  4566.  
  4567. var isAttached = function( elem ) {
  4568. return jQuery.contains( elem.ownerDocument, elem );
  4569. },
  4570. composed = { composed: true };
  4571.  
  4572. // Support: IE 9 - 11+, Edge 12 - 18+, iOS 10.0 - 10.2 only
  4573. // Check attachment across shadow DOM boundaries when possible (gh-3504)
  4574. // Support: iOS 10.0-10.2 only
  4575. // Early iOS 10 versions support `attachShadow` but not `getRootNode`,
  4576. // leading to errors. We need to check for `getRootNode`.
  4577. if ( documentElement.getRootNode ) {
  4578. isAttached = function( elem ) {
  4579. return jQuery.contains( elem.ownerDocument, elem ) ||
  4580. elem.getRootNode( composed ) === elem.ownerDocument;
  4581. };
  4582. }
  4583. var isHiddenWithinTree = function( elem, el ) {
  4584.  
  4585. // isHiddenWithinTree might be called from jQuery#filter function;
  4586. // in that case, element will be second argument
  4587. elem = el || elem;
  4588.  
  4589. // Inline style trumps all
  4590. return elem.style.display === "none" ||
  4591. elem.style.display === "" &&
  4592.  
  4593. // Otherwise, check computed style
  4594. // Support: Firefox <=43 - 45
  4595. // Disconnected elements can have computed display: none, so first confirm that elem is
  4596. // in the document.
  4597. isAttached( elem ) &&
  4598.  
  4599. jQuery.css( elem, "display" ) === "none";
  4600. };
  4601.  
  4602.  
  4603.  
  4604. function adjustCSS( elem, prop, valueParts, tween ) {
  4605. var adjusted, scale,
  4606. maxIterations = 20,
  4607. currentValue = tween ?
  4608. function() {
  4609. return tween.cur();
  4610. } :
  4611. function() {
  4612. return jQuery.css( elem, prop, "" );
  4613. },
  4614. initial = currentValue(),
  4615. unit = valueParts && valueParts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ),
  4616.  
  4617. // Starting value computation is required for potential unit mismatches
  4618. initialInUnit = elem.nodeType &&
  4619. ( jQuery.cssNumber[ prop ] || unit !== "px" && +initial ) &&
  4620. rcssNum.exec( jQuery.css( elem, prop ) );
  4621.  
  4622. if ( initialInUnit && initialInUnit[ 3 ] !== unit ) {
  4623.  
  4624. // Support: Firefox <=54
  4625. // Halve the iteration target value to prevent interference from CSS upper bounds (gh-2144)
  4626. initial = initial / 2;
  4627.  
  4628. // Trust units reported by jQuery.css
  4629. unit = unit || initialInUnit[ 3 ];
  4630.  
  4631. // Iteratively approximate from a nonzero starting point
  4632. initialInUnit = +initial || 1;
  4633.  
  4634. while ( maxIterations-- ) {
  4635.  
  4636. // Evaluate and update our best guess (doubling guesses that zero out).
  4637. // Finish if the scale equals or crosses 1 (making the old*new product non-positive).
  4638. jQuery.style( elem, prop, initialInUnit + unit );
  4639. if ( ( 1 - scale ) * ( 1 - ( scale = currentValue() / initial || 0.5 ) ) <= 0 ) {
  4640. maxIterations = 0;
  4641. }
  4642. initialInUnit = initialInUnit / scale;
  4643.  
  4644. }
  4645.  
  4646. initialInUnit = initialInUnit * 2;
  4647. jQuery.style( elem, prop, initialInUnit + unit );
  4648.  
  4649. // Make sure we update the tween properties later on
  4650. valueParts = valueParts || [];
  4651. }
  4652.  
  4653. if ( valueParts ) {
  4654. initialInUnit = +initialInUnit || +initial || 0;
  4655.  
  4656. // Apply relative offset (+=/-=) if specified
  4657. adjusted = valueParts[ 1 ] ?
  4658. initialInUnit + ( valueParts[ 1 ] + 1 ) * valueParts[ 2 ] :
  4659. +valueParts[ 2 ];
  4660. if ( tween ) {
  4661. tween.unit = unit;
  4662. tween.start = initialInUnit;
  4663. tween.end = adjusted;
  4664. }
  4665. }
  4666. return adjusted;
  4667. }
  4668.  
  4669.  
  4670. var defaultDisplayMap = {};
  4671.  
  4672. function getDefaultDisplay( elem ) {
  4673. var temp,
  4674. doc = elem.ownerDocument,
  4675. nodeName = elem.nodeName,
  4676. display = defaultDisplayMap[ nodeName ];
  4677.  
  4678. if ( display ) {
  4679. return display;
  4680. }
  4681.  
  4682. temp = doc.body.appendChild( doc.createElement( nodeName ) );
  4683. display = jQuery.css( temp, "display" );
  4684.  
  4685. temp.parentNode.removeChild( temp );
  4686.  
  4687. if ( display === "none" ) {
  4688. display = "block";
  4689. }
  4690. defaultDisplayMap[ nodeName ] = display;
  4691.  
  4692. return display;
  4693. }
  4694.  
  4695. function showHide( elements, show ) {
  4696. var display, elem,
  4697. values = [],
  4698. index = 0,
  4699. length = elements.length;
  4700.  
  4701. // Determine new display value for elements that need to change
  4702. for ( ; index < length; index++ ) {
  4703. elem = elements[ index ];
  4704. if ( !elem.style ) {
  4705. continue;
  4706. }
  4707.  
  4708. display = elem.style.display;
  4709. if ( show ) {
  4710.  
  4711. // Since we force visibility upon cascade-hidden elements, an immediate (and slow)
  4712. // check is required in this first loop unless we have a nonempty display value (either
  4713. // inline or about-to-be-restored)
  4714. if ( display === "none" ) {
  4715. values[ index ] = dataPriv.get( elem, "display" ) || null;
  4716. if ( !values[ index ] ) {
  4717. elem.style.display = "";
  4718. }
  4719. }
  4720. if ( elem.style.display === "" && isHiddenWithinTree( elem ) ) {
  4721. values[ index ] = getDefaultDisplay( elem );
  4722. }
  4723. } else {
  4724. if ( display !== "none" ) {
  4725. values[ index ] = "none";
  4726.  
  4727. // Remember what we're overwriting
  4728. dataPriv.set( elem, "display", display );
  4729. }
  4730. }
  4731. }
  4732.  
  4733. // Set the display of the elements in a second loop to avoid constant reflow
  4734. for ( index = 0; index < length; index++ ) {
  4735. if ( values[ index ] != null ) {
  4736. elements[ index ].style.display = values[ index ];
  4737. }
  4738. }
  4739.  
  4740. return elements;
  4741. }
  4742.  
  4743. jQuery.fn.extend( {
  4744. show: function() {
  4745. return showHide( this, true );
  4746. },
  4747. hide: function() {
  4748. return showHide( this );
  4749. },
  4750. toggle: function( state ) {
  4751. if ( typeof state === "boolean" ) {
  4752. return state ? this.show() : this.hide();
  4753. }
  4754.  
  4755. return this.each( function() {
  4756. if ( isHiddenWithinTree( this ) ) {
  4757. jQuery( this ).show();
  4758. } else {
  4759. jQuery( this ).hide();
  4760. }
  4761. } );
  4762. }
  4763. } );
  4764. var rcheckableType = ( /^(?:checkbox|radio)$/i );
  4765.  
  4766. var rtagName = ( /<([a-z][^\/\0>\x20\t\r\n\f]*)/i );
  4767.  
  4768. var rscriptType = ( /^$|^module$|\/(?:java|ecma)script/i );
  4769.  
  4770.  
  4771.  
  4772. ( function() {
  4773. var fragment = document.createDocumentFragment(),
  4774. div = fragment.appendChild( document.createElement( "div" ) ),
  4775. input = document.createElement( "input" );
  4776.  
  4777. // Support: Android 4.0 - 4.3 only
  4778. // Check state lost if the name is set (trac-11217)
  4779. // Support: Windows Web Apps (WWA)
  4780. // `name` and `type` must use .setAttribute for WWA (trac-14901)
  4781. input.setAttribute( "type", "radio" );
  4782. input.setAttribute( "checked", "checked" );
  4783. input.setAttribute( "name", "t" );
  4784.  
  4785. div.appendChild( input );
  4786.  
  4787. // Support: Android <=4.1 only
  4788. // Older WebKit doesn't clone checked state correctly in fragments
  4789. support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked;
  4790.  
  4791. // Support: IE <=11 only
  4792. // Make sure textarea (and checkbox) defaultValue is properly cloned
  4793. div.innerHTML = "<textarea>x</textarea>";
  4794. support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue;
  4795.  
  4796. // Support: IE <=9 only
  4797. // IE <=9 replaces <option> tags with their contents when inserted outside of
  4798. // the select element.
  4799. div.innerHTML = "<option></option>";
  4800. support.option = !!div.lastChild;
  4801. } )();
  4802.  
  4803.  
  4804. // We have to close these tags to support XHTML (trac-13200)
  4805. var wrapMap = {
  4806.  
  4807. // XHTML parsers do not magically insert elements in the
  4808. // same way that tag soup parsers do. So we cannot shorten
  4809. // this by omitting <tbody> or other required elements.
  4810. thead: [ 1, "<table>", "</table>" ],
  4811. col: [ 2, "<table><colgroup>", "</colgroup></table>" ],
  4812. tr: [ 2, "<table><tbody>", "</tbody></table>" ],
  4813. td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
  4814.  
  4815. _default: [ 0, "", "" ]
  4816. };
  4817.  
  4818. wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
  4819. wrapMap.th = wrapMap.td;
  4820.  
  4821. // Support: IE <=9 only
  4822. if ( !support.option ) {
  4823. wrapMap.optgroup = wrapMap.option = [ 1, "<select multiple='multiple'>", "</select>" ];
  4824. }
  4825.  
  4826.  
  4827. function getAll( context, tag ) {
  4828.  
  4829. // Support: IE <=9 - 11 only
  4830. // Use typeof to avoid zero-argument method invocation on host objects (trac-15151)
  4831. var ret;
  4832.  
  4833. if ( typeof context.getElementsByTagName !== "undefined" ) {
  4834. ret = context.getElementsByTagName( tag || "*" );
  4835.  
  4836. } else if ( typeof context.querySelectorAll !== "undefined" ) {
  4837. ret = context.querySelectorAll( tag || "*" );
  4838.  
  4839. } else {
  4840. ret = [];
  4841. }
  4842.  
  4843. if ( tag === undefined || tag && nodeName( context, tag ) ) {
  4844. return jQuery.merge( [ context ], ret );
  4845. }
  4846.  
  4847. return ret;
  4848. }
  4849.  
  4850.  
  4851. // Mark scripts as having already been evaluated
  4852. function setGlobalEval( elems, refElements ) {
  4853. var i = 0,
  4854. l = elems.length;
  4855.  
  4856. for ( ; i < l; i++ ) {
  4857. dataPriv.set(
  4858. elems[ i ],
  4859. "globalEval",
  4860. !refElements || dataPriv.get( refElements[ i ], "globalEval" )
  4861. );
  4862. }
  4863. }
  4864.  
  4865.  
  4866. var rhtml = /<|&#?\w+;/;
  4867.  
  4868. function buildFragment( elems, context, scripts, selection, ignored ) {
  4869. var elem, tmp, tag, wrap, attached, j,
  4870. fragment = context.createDocumentFragment(),
  4871. nodes = [],
  4872. i = 0,
  4873. l = elems.length;
  4874.  
  4875. for ( ; i < l; i++ ) {
  4876. elem = elems[ i ];
  4877.  
  4878. if ( elem || elem === 0 ) {
  4879.  
  4880. // Add nodes directly
  4881. if ( toType( elem ) === "object" ) {
  4882.  
  4883. // Support: Android <=4.0 only, PhantomJS 1 only
  4884. // push.apply(_, arraylike) throws on ancient WebKit
  4885. jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem );
  4886.  
  4887. // Convert non-html into a text node
  4888. } else if ( !rhtml.test( elem ) ) {
  4889. nodes.push( context.createTextNode( elem ) );
  4890.  
  4891. // Convert html into DOM nodes
  4892. } else {
  4893. tmp = tmp || fragment.appendChild( context.createElement( "div" ) );
  4894.  
  4895. // Deserialize a standard representation
  4896. tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase();
  4897. wrap = wrapMap[ tag ] || wrapMap._default;
  4898. tmp.innerHTML = wrap[ 1 ] + jQuery.htmlPrefilter( elem ) + wrap[ 2 ];
  4899.  
  4900. // Descend through wrappers to the right content
  4901. j = wrap[ 0 ];
  4902. while ( j-- ) {
  4903. tmp = tmp.lastChild;
  4904. }
  4905.  
  4906. // Support: Android <=4.0 only, PhantomJS 1 only
  4907. // push.apply(_, arraylike) throws on ancient WebKit
  4908. jQuery.merge( nodes, tmp.childNodes );
  4909.  
  4910. // Remember the top-level container
  4911. tmp = fragment.firstChild;
  4912.  
  4913. // Ensure the created nodes are orphaned (trac-12392)
  4914. tmp.textContent = "";
  4915. }
  4916. }
  4917. }
  4918.  
  4919. // Remove wrapper from fragment
  4920. fragment.textContent = "";
  4921.  
  4922. i = 0;
  4923. while ( ( elem = nodes[ i++ ] ) ) {
  4924.  
  4925. // Skip elements already in the context collection (trac-4087)
  4926. if ( selection && jQuery.inArray( elem, selection ) > -1 ) {
  4927. if ( ignored ) {
  4928. ignored.push( elem );
  4929. }
  4930. continue;
  4931. }
  4932.  
  4933. attached = isAttached( elem );
  4934.  
  4935. // Append to fragment
  4936. tmp = getAll( fragment.appendChild( elem ), "script" );
  4937.  
  4938. // Preserve script evaluation history
  4939. if ( attached ) {
  4940. setGlobalEval( tmp );
  4941. }
  4942.  
  4943. // Capture executables
  4944. if ( scripts ) {
  4945. j = 0;
  4946. while ( ( elem = tmp[ j++ ] ) ) {
  4947. if ( rscriptType.test( elem.type || "" ) ) {
  4948. scripts.push( elem );
  4949. }
  4950. }
  4951. }
  4952. }
  4953.  
  4954. return fragment;
  4955. }
  4956.  
  4957.  
  4958. var rtypenamespace = /^([^.]*)(?:\.(.+)|)/;
  4959.  
  4960. function returnTrue() {
  4961. return true;
  4962. }
  4963.  
  4964. function returnFalse() {
  4965. return false;
  4966. }
  4967.  
  4968. function on( elem, types, selector, data, fn, one ) {
  4969. var origFn, type;
  4970.  
  4971. // Types can be a map of types/handlers
  4972. if ( typeof types === "object" ) {
  4973.  
  4974. // ( types-Object, selector, data )
  4975. if ( typeof selector !== "string" ) {
  4976.  
  4977. // ( types-Object, data )
  4978. data = data || selector;
  4979. selector = undefined;
  4980. }
  4981. for ( type in types ) {
  4982. on( elem, type, selector, data, types[ type ], one );
  4983. }
  4984. return elem;
  4985. }
  4986.  
  4987. if ( data == null && fn == null ) {
  4988.  
  4989. // ( types, fn )
  4990. fn = selector;
  4991. data = selector = undefined;
  4992. } else if ( fn == null ) {
  4993. if ( typeof selector === "string" ) {
  4994.  
  4995. // ( types, selector, fn )
  4996. fn = data;
  4997. data = undefined;
  4998. } else {
  4999.  
  5000. // ( types, data, fn )
  5001. fn = data;
  5002. data = selector;
  5003. selector = undefined;
  5004. }
  5005. }
  5006. if ( fn === false ) {
  5007. fn = returnFalse;
  5008. } else if ( !fn ) {
  5009. return elem;
  5010. }
  5011.  
  5012. if ( one === 1 ) {
  5013. origFn = fn;
  5014. fn = function( event ) {
  5015.  
  5016. // Can use an empty set, since event contains the info
  5017. jQuery().off( event );
  5018. return origFn.apply( this, arguments );
  5019. };
  5020.  
  5021. // Use same guid so caller can remove using origFn
  5022. fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ );
  5023. }
  5024. return elem.each( function() {
  5025. jQuery.event.add( this, types, fn, data, selector );
  5026. } );
  5027. }
  5028.  
  5029. /*
  5030. * Helper functions for managing events -- not part of the public interface.
  5031. * Props to Dean Edwards' addEvent library for many of the ideas.
  5032. */
  5033. jQuery.event = {
  5034.  
  5035. global: {},
  5036.  
  5037. add: function( elem, types, handler, data, selector ) {
  5038.  
  5039. var handleObjIn, eventHandle, tmp,
  5040. events, t, handleObj,
  5041. special, handlers, type, namespaces, origType,
  5042. elemData = dataPriv.get( elem );
  5043.  
  5044. // Only attach events to objects that accept data
  5045. if ( !acceptData( elem ) ) {
  5046. return;
  5047. }
  5048.  
  5049. // Caller can pass in an object of custom data in lieu of the handler
  5050. if ( handler.handler ) {
  5051. handleObjIn = handler;
  5052. handler = handleObjIn.handler;
  5053. selector = handleObjIn.selector;
  5054. }
  5055.  
  5056. // Ensure that invalid selectors throw exceptions at attach time
  5057. // Evaluate against documentElement in case elem is a non-element node (e.g., document)
  5058. if ( selector ) {
  5059. jQuery.find.matchesSelector( documentElement, selector );
  5060. }
  5061.  
  5062. // Make sure that the handler has a unique ID, used to find/remove it later
  5063. if ( !handler.guid ) {
  5064. handler.guid = jQuery.guid++;
  5065. }
  5066.  
  5067. // Init the element's event structure and main handler, if this is the first
  5068. if ( !( events = elemData.events ) ) {
  5069. events = elemData.events = Object.create( null );
  5070. }
  5071. if ( !( eventHandle = elemData.handle ) ) {
  5072. eventHandle = elemData.handle = function( e ) {
  5073.  
  5074. // Discard the second event of a jQuery.event.trigger() and
  5075. // when an event is called after a page has unloaded
  5076. return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ?
  5077. jQuery.event.dispatch.apply( elem, arguments ) : undefined;
  5078. };
  5079. }
  5080.  
  5081. // Handle multiple events separated by a space
  5082. types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
  5083. t = types.length;
  5084. while ( t-- ) {
  5085. tmp = rtypenamespace.exec( types[ t ] ) || [];
  5086. type = origType = tmp[ 1 ];
  5087. namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
  5088.  
  5089. // There *must* be a type, no attaching namespace-only handlers
  5090. if ( !type ) {
  5091. continue;
  5092. }
  5093.  
  5094. // If event changes its type, use the special event handlers for the changed type
  5095. special = jQuery.event.special[ type ] || {};
  5096.  
  5097. // If selector defined, determine special event api type, otherwise given type
  5098. type = ( selector ? special.delegateType : special.bindType ) || type;
  5099.  
  5100. // Update special based on newly reset type
  5101. special = jQuery.event.special[ type ] || {};
  5102.  
  5103. // handleObj is passed to all event handlers
  5104. handleObj = jQuery.extend( {
  5105. type: type,
  5106. origType: origType,
  5107. data: data,
  5108. handler: handler,
  5109. guid: handler.guid,
  5110. selector: selector,
  5111. needsContext: selector && jQuery.expr.match.needsContext.test( selector ),
  5112. namespace: namespaces.join( "." )
  5113. }, handleObjIn );
  5114.  
  5115. // Init the event handler queue if we're the first
  5116. if ( !( handlers = events[ type ] ) ) {
  5117. handlers = events[ type ] = [];
  5118. handlers.delegateCount = 0;
  5119.  
  5120. // Only use addEventListener if the special events handler returns false
  5121. if ( !special.setup ||
  5122. special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
  5123.  
  5124. if ( elem.addEventListener ) {
  5125. elem.addEventListener( type, eventHandle );
  5126. }
  5127. }
  5128. }
  5129.  
  5130. if ( special.add ) {
  5131. special.add.call( elem, handleObj );
  5132.  
  5133. if ( !handleObj.handler.guid ) {
  5134. handleObj.handler.guid = handler.guid;
  5135. }
  5136. }
  5137.  
  5138. // Add to the element's handler list, delegates in front
  5139. if ( selector ) {
  5140. handlers.splice( handlers.delegateCount++, 0, handleObj );
  5141. } else {
  5142. handlers.push( handleObj );
  5143. }
  5144.  
  5145. // Keep track of which events have ever been used, for event optimization
  5146. jQuery.event.global[ type ] = true;
  5147. }
  5148.  
  5149. },
  5150.  
  5151. // Detach an event or set of events from an element
  5152. remove: function( elem, types, handler, selector, mappedTypes ) {
  5153.  
  5154. var j, origCount, tmp,
  5155. events, t, handleObj,
  5156. special, handlers, type, namespaces, origType,
  5157. elemData = dataPriv.hasData( elem ) && dataPriv.get( elem );
  5158.  
  5159. if ( !elemData || !( events = elemData.events ) ) {
  5160. return;
  5161. }
  5162.  
  5163. // Once for each type.namespace in types; type may be omitted
  5164. types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
  5165. t = types.length;
  5166. while ( t-- ) {
  5167. tmp = rtypenamespace.exec( types[ t ] ) || [];
  5168. type = origType = tmp[ 1 ];
  5169. namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
  5170.  
  5171. // Unbind all events (on this namespace, if provided) for the element
  5172. if ( !type ) {
  5173. for ( type in events ) {
  5174. jQuery.event.remove( elem, type + types[ t ], handler, selector, true );
  5175. }
  5176. continue;
  5177. }
  5178.  
  5179. special = jQuery.event.special[ type ] || {};
  5180. type = ( selector ? special.delegateType : special.bindType ) || type;
  5181. handlers = events[ type ] || [];
  5182. tmp = tmp[ 2 ] &&
  5183. new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" );
  5184.  
  5185. // Remove matching events
  5186. origCount = j = handlers.length;
  5187. while ( j-- ) {
  5188. handleObj = handlers[ j ];
  5189.  
  5190. if ( ( mappedTypes || origType === handleObj.origType ) &&
  5191. ( !handler || handler.guid === handleObj.guid ) &&
  5192. ( !tmp || tmp.test( handleObj.namespace ) ) &&
  5193. ( !selector || selector === handleObj.selector ||
  5194. selector === "**" && handleObj.selector ) ) {
  5195. handlers.splice( j, 1 );
  5196.  
  5197. if ( handleObj.selector ) {
  5198. handlers.delegateCount--;
  5199. }
  5200. if ( special.remove ) {
  5201. special.remove.call( elem, handleObj );
  5202. }
  5203. }
  5204. }
  5205.  
  5206. // Remove generic event handler if we removed something and no more handlers exist
  5207. // (avoids potential for endless recursion during removal of special event handlers)
  5208. if ( origCount && !handlers.length ) {
  5209. if ( !special.teardown ||
  5210. special.teardown.call( elem, namespaces, elemData.handle ) === false ) {
  5211.  
  5212. jQuery.removeEvent( elem, type, elemData.handle );
  5213. }
  5214.  
  5215. delete events[ type ];
  5216. }
  5217. }
  5218.  
  5219. // Remove data and the expando if it's no longer used
  5220. if ( jQuery.isEmptyObject( events ) ) {
  5221. dataPriv.remove( elem, "handle events" );
  5222. }
  5223. },
  5224.  
  5225. dispatch: function( nativeEvent ) {
  5226.  
  5227. var i, j, ret, matched, handleObj, handlerQueue,
  5228. args = new Array( arguments.length ),
  5229.  
  5230. // Make a writable jQuery.Event from the native event object
  5231. event = jQuery.event.fix( nativeEvent ),
  5232.  
  5233. handlers = (
  5234. dataPriv.get( this, "events" ) || Object.create( null )
  5235. )[ event.type ] || [],
  5236. special = jQuery.event.special[ event.type ] || {};
  5237.  
  5238. // Use the fix-ed jQuery.Event rather than the (read-only) native event
  5239. args[ 0 ] = event;
  5240.  
  5241. for ( i = 1; i < arguments.length; i++ ) {
  5242. args[ i ] = arguments[ i ];
  5243. }
  5244.  
  5245. event.delegateTarget = this;
  5246.  
  5247. // Call the preDispatch hook for the mapped type, and let it bail if desired
  5248. if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) {
  5249. return;
  5250. }
  5251.  
  5252. // Determine handlers
  5253. handlerQueue = jQuery.event.handlers.call( this, event, handlers );
  5254.  
  5255. // Run delegates first; they may want to stop propagation beneath us
  5256. i = 0;
  5257. while ( ( matched = handlerQueue[ i++ ] ) && !event.isPropagationStopped() ) {
  5258. event.currentTarget = matched.elem;
  5259.  
  5260. j = 0;
  5261. while ( ( handleObj = matched.handlers[ j++ ] ) &&
  5262. !event.isImmediatePropagationStopped() ) {
  5263.  
  5264. // If the event is namespaced, then each handler is only invoked if it is
  5265. // specially universal or its namespaces are a superset of the event's.
  5266. if ( !event.rnamespace || handleObj.namespace === false ||
  5267. event.rnamespace.test( handleObj.namespace ) ) {
  5268.  
  5269. event.handleObj = handleObj;
  5270. event.data = handleObj.data;
  5271.  
  5272. ret = ( ( jQuery.event.special[ handleObj.origType ] || {} ).handle ||
  5273. handleObj.handler ).apply( matched.elem, args );
  5274.  
  5275. if ( ret !== undefined ) {
  5276. if ( ( event.result = ret ) === false ) {
  5277. event.preventDefault();
  5278. event.stopPropagation();
  5279. }
  5280. }
  5281. }
  5282. }
  5283. }
  5284.  
  5285. // Call the postDispatch hook for the mapped type
  5286. if ( special.postDispatch ) {
  5287. special.postDispatch.call( this, event );
  5288. }
  5289.  
  5290. return event.result;
  5291. },
  5292.  
  5293. handlers: function( event, handlers ) {
  5294. var i, handleObj, sel, matchedHandlers, matchedSelectors,
  5295. handlerQueue = [],
  5296. delegateCount = handlers.delegateCount,
  5297. cur = event.target;
  5298.  
  5299. // Find delegate handlers
  5300. if ( delegateCount &&
  5301.  
  5302. // Support: IE <=9
  5303. // Black-hole SVG <use> instance trees (trac-13180)
  5304. cur.nodeType &&
  5305.  
  5306. // Support: Firefox <=42
  5307. // Suppress spec-violating clicks indicating a non-primary pointer button (trac-3861)
  5308. // https://www.w3.org/TR/DOM-Level-3-Events/#event-type-click
  5309. // Support: IE 11 only
  5310. // ...but not arrow key "clicks" of radio inputs, which can have `button` -1 (gh-2343)
  5311. !( event.type === "click" && event.button >= 1 ) ) {
  5312.  
  5313. for ( ; cur !== this; cur = cur.parentNode || this ) {
  5314.  
  5315. // Don't check non-elements (trac-13208)
  5316. // Don't process clicks on disabled elements (trac-6911, trac-8165, trac-11382, trac-11764)
  5317. if ( cur.nodeType === 1 && !( event.type === "click" && cur.disabled === true ) ) {
  5318. matchedHandlers = [];
  5319. matchedSelectors = {};
  5320. for ( i = 0; i < delegateCount; i++ ) {
  5321. handleObj = handlers[ i ];
  5322.  
  5323. // Don't conflict with Object.prototype properties (trac-13203)
  5324. sel = handleObj.selector + " ";
  5325.  
  5326. if ( matchedSelectors[ sel ] === undefined ) {
  5327. matchedSelectors[ sel ] = handleObj.needsContext ?
  5328. jQuery( sel, this ).index( cur ) > -1 :
  5329. jQuery.find( sel, this, null, [ cur ] ).length;
  5330. }
  5331. if ( matchedSelectors[ sel ] ) {
  5332. matchedHandlers.push( handleObj );
  5333. }
  5334. }
  5335. if ( matchedHandlers.length ) {
  5336. handlerQueue.push( { elem: cur, handlers: matchedHandlers } );
  5337. }
  5338. }
  5339. }
  5340. }
  5341.  
  5342. // Add the remaining (directly-bound) handlers
  5343. cur = this;
  5344. if ( delegateCount < handlers.length ) {
  5345. handlerQueue.push( { elem: cur, handlers: handlers.slice( delegateCount ) } );
  5346. }
  5347.  
  5348. return handlerQueue;
  5349. },
  5350.  
  5351. addProp: function( name, hook ) {
  5352. Object.defineProperty( jQuery.Event.prototype, name, {
  5353. enumerable: true,
  5354. configurable: true,
  5355.  
  5356. get: isFunction( hook ) ?
  5357. function() {
  5358. if ( this.originalEvent ) {
  5359. return hook( this.originalEvent );
  5360. }
  5361. } :
  5362. function() {
  5363. if ( this.originalEvent ) {
  5364. return this.originalEvent[ name ];
  5365. }
  5366. },
  5367.  
  5368. set: function( value ) {
  5369. Object.defineProperty( this, name, {
  5370. enumerable: true,
  5371. configurable: true,
  5372. writable: true,
  5373. value: value
  5374. } );
  5375. }
  5376. } );
  5377. },
  5378.  
  5379. fix: function( originalEvent ) {
  5380. return originalEvent[ jQuery.expando ] ?
  5381. originalEvent :
  5382. new jQuery.Event( originalEvent );
  5383. },
  5384.  
  5385. special: {
  5386. load: {
  5387.  
  5388. // Prevent triggered image.load events from bubbling to window.load
  5389. noBubble: true
  5390. },
  5391. click: {
  5392.  
  5393. // Utilize native event to ensure correct state for checkable inputs
  5394. setup: function( data ) {
  5395.  
  5396. // For mutual compressibility with _default, replace `this` access with a local var.
  5397. // `|| data` is dead code meant only to preserve the variable through minification.
  5398. var el = this || data;
  5399.  
  5400. // Claim the first handler
  5401. if ( rcheckableType.test( el.type ) &&
  5402. el.click && nodeName( el, "input" ) ) {
  5403.  
  5404. // dataPriv.set( el, "click", ... )
  5405. leverageNative( el, "click", true );
  5406. }
  5407.  
  5408. // Return false to allow normal processing in the caller
  5409. return false;
  5410. },
  5411. trigger: function( data ) {
  5412.  
  5413. // For mutual compressibility with _default, replace `this` access with a local var.
  5414. // `|| data` is dead code meant only to preserve the variable through minification.
  5415. var el = this || data;
  5416.  
  5417. // Force setup before triggering a click
  5418. if ( rcheckableType.test( el.type ) &&
  5419. el.click && nodeName( el, "input" ) ) {
  5420.  
  5421. leverageNative( el, "click" );
  5422. }
  5423.  
  5424. // Return non-false to allow normal event-path propagation
  5425. return true;
  5426. },
  5427.  
  5428. // For cross-browser consistency, suppress native .click() on links
  5429. // Also prevent it if we're currently inside a leveraged native-event stack
  5430. _default: function( event ) {
  5431. var target = event.target;
  5432. return rcheckableType.test( target.type ) &&
  5433. target.click && nodeName( target, "input" ) &&
  5434. dataPriv.get( target, "click" ) ||
  5435. nodeName( target, "a" );
  5436. }
  5437. },
  5438.  
  5439. beforeunload: {
  5440. postDispatch: function( event ) {
  5441.  
  5442. // Support: Firefox 20+
  5443. // Firefox doesn't alert if the returnValue field is not set.
  5444. if ( event.result !== undefined && event.originalEvent ) {
  5445. event.originalEvent.returnValue = event.result;
  5446. }
  5447. }
  5448. }
  5449. }
  5450. };
  5451.  
  5452. // Ensure the presence of an event listener that handles manually-triggered
  5453. // synthetic events by interrupting progress until reinvoked in response to
  5454. // *native* events that it fires directly, ensuring that state changes have
  5455. // already occurred before other listeners are invoked.
  5456. function leverageNative( el, type, isSetup ) {
  5457.  
  5458. // Missing `isSetup` indicates a trigger call, which must force setup through jQuery.event.add
  5459. if ( !isSetup ) {
  5460. if ( dataPriv.get( el, type ) === undefined ) {
  5461. jQuery.event.add( el, type, returnTrue );
  5462. }
  5463. return;
  5464. }
  5465.  
  5466. // Register the controller as a special universal handler for all event namespaces
  5467. dataPriv.set( el, type, false );
  5468. jQuery.event.add( el, type, {
  5469. namespace: false,
  5470. handler: function( event ) {
  5471. var result,
  5472. saved = dataPriv.get( this, type );
  5473.  
  5474. if ( ( event.isTrigger & 1 ) && this[ type ] ) {
  5475.  
  5476. // Interrupt processing of the outer synthetic .trigger()ed event
  5477. if ( !saved ) {
  5478.  
  5479. // Store arguments for use when handling the inner native event
  5480. // There will always be at least one argument (an event object), so this array
  5481. // will not be confused with a leftover capture object.
  5482. saved = slice.call( arguments );
  5483. dataPriv.set( this, type, saved );
  5484.  
  5485. // Trigger the native event and capture its result
  5486. this[ type ]();
  5487. result = dataPriv.get( this, type );
  5488. dataPriv.set( this, type, false );
  5489.  
  5490. if ( saved !== result ) {
  5491.  
  5492. // Cancel the outer synthetic event
  5493. event.stopImmediatePropagation();
  5494. event.preventDefault();
  5495.  
  5496. return result;
  5497. }
  5498.  
  5499. // If this is an inner synthetic event for an event with a bubbling surrogate
  5500. // (focus or blur), assume that the surrogate already propagated from triggering
  5501. // the native event and prevent that from happening again here.
  5502. // This technically gets the ordering wrong w.r.t. to `.trigger()` (in which the
  5503. // bubbling surrogate propagates *after* the non-bubbling base), but that seems
  5504. // less bad than duplication.
  5505. } else if ( ( jQuery.event.special[ type ] || {} ).delegateType ) {
  5506. event.stopPropagation();
  5507. }
  5508.  
  5509. // If this is a native event triggered above, everything is now in order
  5510. // Fire an inner synthetic event with the original arguments
  5511. } else if ( saved ) {
  5512.  
  5513. // ...and capture the result
  5514. dataPriv.set( this, type, jQuery.event.trigger(
  5515. saved[ 0 ],
  5516. saved.slice( 1 ),
  5517. this
  5518. ) );
  5519.  
  5520. // Abort handling of the native event by all jQuery handlers while allowing
  5521. // native handlers on the same element to run. On target, this is achieved
  5522. // by stopping immediate propagation just on the jQuery event. However,
  5523. // the native event is re-wrapped by a jQuery one on each level of the
  5524. // propagation so the only way to stop it for jQuery is to stop it for
  5525. // everyone via native `stopPropagation()`. This is not a problem for
  5526. // focus/blur which don't bubble, but it does also stop click on checkboxes
  5527. // and radios. We accept this limitation.
  5528. event.stopPropagation();
  5529. event.isImmediatePropagationStopped = returnTrue;
  5530. }
  5531. }
  5532. } );
  5533. }
  5534.  
  5535. jQuery.removeEvent = function( elem, type, handle ) {
  5536.  
  5537. // This "if" is needed for plain objects
  5538. if ( elem.removeEventListener ) {
  5539. elem.removeEventListener( type, handle );
  5540. }
  5541. };
  5542.  
  5543. jQuery.Event = function( src, props ) {
  5544.  
  5545. // Allow instantiation without the 'new' keyword
  5546. if ( !( this instanceof jQuery.Event ) ) {
  5547. return new jQuery.Event( src, props );
  5548. }
  5549.  
  5550. // Event object
  5551. if ( src && src.type ) {
  5552. this.originalEvent = src;
  5553. this.type = src.type;
  5554.  
  5555. // Events bubbling up the document may have been marked as prevented
  5556. // by a handler lower down the tree; reflect the correct value.
  5557. this.isDefaultPrevented = src.defaultPrevented ||
  5558. src.defaultPrevented === undefined &&
  5559.  
  5560. // Support: Android <=2.3 only
  5561. src.returnValue === false ?
  5562. returnTrue :
  5563. returnFalse;
  5564.  
  5565. // Create target properties
  5566. // Support: Safari <=6 - 7 only
  5567. // Target should not be a text node (trac-504, trac-13143)
  5568. this.target = ( src.target && src.target.nodeType === 3 ) ?
  5569. src.target.parentNode :
  5570. src.target;
  5571.  
  5572. this.currentTarget = src.currentTarget;
  5573. this.relatedTarget = src.relatedTarget;
  5574.  
  5575. // Event type
  5576. } else {
  5577. this.type = src;
  5578. }
  5579.  
  5580. // Put explicitly provided properties onto the event object
  5581. if ( props ) {
  5582. jQuery.extend( this, props );
  5583. }
  5584.  
  5585. // Create a timestamp if incoming event doesn't have one
  5586. this.timeStamp = src && src.timeStamp || Date.now();
  5587.  
  5588. // Mark it as fixed
  5589. this[ jQuery.expando ] = true;
  5590. };
  5591.  
  5592. // jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
  5593. // https://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
  5594. jQuery.Event.prototype = {
  5595. constructor: jQuery.Event,
  5596. isDefaultPrevented: returnFalse,
  5597. isPropagationStopped: returnFalse,
  5598. isImmediatePropagationStopped: returnFalse,
  5599. isSimulated: false,
  5600.  
  5601. preventDefault: function() {
  5602. var e = this.originalEvent;
  5603.  
  5604. this.isDefaultPrevented = returnTrue;
  5605.  
  5606. if ( e && !this.isSimulated ) {
  5607. e.preventDefault();
  5608. }
  5609. },
  5610. stopPropagation: function() {
  5611. var e = this.originalEvent;
  5612.  
  5613. this.isPropagationStopped = returnTrue;
  5614.  
  5615. if ( e && !this.isSimulated ) {
  5616. e.stopPropagation();
  5617. }
  5618. },
  5619. stopImmediatePropagation: function() {
  5620. var e = this.originalEvent;
  5621.  
  5622. this.isImmediatePropagationStopped = returnTrue;
  5623.  
  5624. if ( e && !this.isSimulated ) {
  5625. e.stopImmediatePropagation();
  5626. }
  5627.  
  5628. this.stopPropagation();
  5629. }
  5630. };
  5631.  
  5632. // Includes all common event props including KeyEvent and MouseEvent specific props
  5633. jQuery.each( {
  5634. altKey: true,
  5635. bubbles: true,
  5636. cancelable: true,
  5637. changedTouches: true,
  5638. ctrlKey: true,
  5639. detail: true,
  5640. eventPhase: true,
  5641. metaKey: true,
  5642. pageX: true,
  5643. pageY: true,
  5644. shiftKey: true,
  5645. view: true,
  5646. "char": true,
  5647. code: true,
  5648. charCode: true,
  5649. key: true,
  5650. keyCode: true,
  5651. button: true,
  5652. buttons: true,
  5653. clientX: true,
  5654. clientY: true,
  5655. offsetX: true,
  5656. offsetY: true,
  5657. pointerId: true,
  5658. pointerType: true,
  5659. screenX: true,
  5660. screenY: true,
  5661. targetTouches: true,
  5662. toElement: true,
  5663. touches: true,
  5664. which: true
  5665. }, jQuery.event.addProp );
  5666.  
  5667. jQuery.each( { focus: "focusin", blur: "focusout" }, function( type, delegateType ) {
  5668.  
  5669. function focusMappedHandler( nativeEvent ) {
  5670. if ( document.documentMode ) {
  5671.  
  5672. // Support: IE 11+
  5673. // Attach a single focusin/focusout handler on the document while someone wants
  5674. // focus/blur. This is because the former are synchronous in IE while the latter
  5675. // are async. In other browsers, all those handlers are invoked synchronously.
  5676.  
  5677. // `handle` from private data would already wrap the event, but we need
  5678. // to change the `type` here.
  5679. var handle = dataPriv.get( this, "handle" ),
  5680. event = jQuery.event.fix( nativeEvent );
  5681. event.type = nativeEvent.type === "focusin" ? "focus" : "blur";
  5682. event.isSimulated = true;
  5683.  
  5684. // First, handle focusin/focusout
  5685. handle( nativeEvent );
  5686.  
  5687. // ...then, handle focus/blur
  5688. //
  5689. // focus/blur don't bubble while focusin/focusout do; simulate the former by only
  5690. // invoking the handler at the lower level.
  5691. if ( event.target === event.currentTarget ) {
  5692.  
  5693. // The setup part calls `leverageNative`, which, in turn, calls
  5694. // `jQuery.event.add`, so event handle will already have been set
  5695. // by this point.
  5696. handle( event );
  5697. }
  5698. } else {
  5699.  
  5700. // For non-IE browsers, attach a single capturing handler on the document
  5701. // while someone wants focusin/focusout.
  5702. jQuery.event.simulate( delegateType, nativeEvent.target,
  5703. jQuery.event.fix( nativeEvent ) );
  5704. }
  5705. }
  5706.  
  5707. jQuery.event.special[ type ] = {
  5708.  
  5709. // Utilize native event if possible so blur/focus sequence is correct
  5710. setup: function() {
  5711.  
  5712. var attaches;
  5713.  
  5714. // Claim the first handler
  5715. // dataPriv.set( this, "focus", ... )
  5716. // dataPriv.set( this, "blur", ... )
  5717. leverageNative( this, type, true );
  5718.  
  5719. if ( document.documentMode ) {
  5720.  
  5721. // Support: IE 9 - 11+
  5722. // We use the same native handler for focusin & focus (and focusout & blur)
  5723. // so we need to coordinate setup & teardown parts between those events.
  5724. // Use `delegateType` as the key as `type` is already used by `leverageNative`.
  5725. attaches = dataPriv.get( this, delegateType );
  5726. if ( !attaches ) {
  5727. this.addEventListener( delegateType, focusMappedHandler );
  5728. }
  5729. dataPriv.set( this, delegateType, ( attaches || 0 ) + 1 );
  5730. } else {
  5731.  
  5732. // Return false to allow normal processing in the caller
  5733. return false;
  5734. }
  5735. },
  5736. trigger: function() {
  5737.  
  5738. // Force setup before trigger
  5739. leverageNative( this, type );
  5740.  
  5741. // Return non-false to allow normal event-path propagation
  5742. return true;
  5743. },
  5744.  
  5745. teardown: function() {
  5746. var attaches;
  5747.  
  5748. if ( document.documentMode ) {
  5749. attaches = dataPriv.get( this, delegateType ) - 1;
  5750. if ( !attaches ) {
  5751. this.removeEventListener( delegateType, focusMappedHandler );
  5752. dataPriv.remove( this, delegateType );
  5753. } else {
  5754. dataPriv.set( this, delegateType, attaches );
  5755. }
  5756. } else {
  5757.  
  5758. // Return false to indicate standard teardown should be applied
  5759. return false;
  5760. }
  5761. },
  5762.  
  5763. // Suppress native focus or blur if we're currently inside
  5764. // a leveraged native-event stack
  5765. _default: function( event ) {
  5766. return dataPriv.get( event.target, type );
  5767. },
  5768.  
  5769. delegateType: delegateType
  5770. };
  5771.  
  5772. // Support: Firefox <=44
  5773. // Firefox doesn't have focus(in | out) events
  5774. // Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787
  5775. //
  5776. // Support: Chrome <=48 - 49, Safari <=9.0 - 9.1
  5777. // focus(in | out) events fire after focus & blur events,
  5778. // which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order
  5779. // Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857
  5780. //
  5781. // Support: IE 9 - 11+
  5782. // To preserve relative focusin/focus & focusout/blur event order guaranteed on the 3.x branch,
  5783. // attach a single handler for both events in IE.
  5784. jQuery.event.special[ delegateType ] = {
  5785. setup: function() {
  5786.  
  5787. // Handle: regular nodes (via `this.ownerDocument`), window
  5788. // (via `this.document`) & document (via `this`).
  5789. var doc = this.ownerDocument || this.document || this,
  5790. dataHolder = document.documentMode ? this : doc,
  5791. attaches = dataPriv.get( dataHolder, delegateType );
  5792.  
  5793. // Support: IE 9 - 11+
  5794. // We use the same native handler for focusin & focus (and focusout & blur)
  5795. // so we need to coordinate setup & teardown parts between those events.
  5796. // Use `delegateType` as the key as `type` is already used by `leverageNative`.
  5797. if ( !attaches ) {
  5798. if ( document.documentMode ) {
  5799. this.addEventListener( delegateType, focusMappedHandler );
  5800. } else {
  5801. doc.addEventListener( type, focusMappedHandler, true );
  5802. }
  5803. }
  5804. dataPriv.set( dataHolder, delegateType, ( attaches || 0 ) + 1 );
  5805. },
  5806. teardown: function() {
  5807. var doc = this.ownerDocument || this.document || this,
  5808. dataHolder = document.documentMode ? this : doc,
  5809. attaches = dataPriv.get( dataHolder, delegateType ) - 1;
  5810.  
  5811. if ( !attaches ) {
  5812. if ( document.documentMode ) {
  5813. this.removeEventListener( delegateType, focusMappedHandler );
  5814. } else {
  5815. doc.removeEventListener( type, focusMappedHandler, true );
  5816. }
  5817. dataPriv.remove( dataHolder, delegateType );
  5818. } else {
  5819. dataPriv.set( dataHolder, delegateType, attaches );
  5820. }
  5821. }
  5822. };
  5823. } );
  5824.  
  5825. // Create mouseenter/leave events using mouseover/out and event-time checks
  5826. // so that event delegation works in jQuery.
  5827. // Do the same for pointerenter/pointerleave and pointerover/pointerout
  5828. //
  5829. // Support: Safari 7 only
  5830. // Safari sends mouseenter too often; see:
  5831. // https://bugs.chromium.org/p/chromium/issues/detail?id=470258
  5832. // for the description of the bug (it existed in older Chrome versions as well).
  5833. jQuery.each( {
  5834. mouseenter: "mouseover",
  5835. mouseleave: "mouseout",
  5836. pointerenter: "pointerover",
  5837. pointerleave: "pointerout"
  5838. }, function( orig, fix ) {
  5839. jQuery.event.special[ orig ] = {
  5840. delegateType: fix,
  5841. bindType: fix,
  5842.  
  5843. handle: function( event ) {
  5844. var ret,
  5845. target = this,
  5846. related = event.relatedTarget,
  5847. handleObj = event.handleObj;
  5848.  
  5849. // For mouseenter/leave call the handler if related is outside the target.
  5850. // NB: No relatedTarget if the mouse left/entered the browser window
  5851. if ( !related || ( related !== target && !jQuery.contains( target, related ) ) ) {
  5852. event.type = handleObj.origType;
  5853. ret = handleObj.handler.apply( this, arguments );
  5854. event.type = fix;
  5855. }
  5856. return ret;
  5857. }
  5858. };
  5859. } );
  5860.  
  5861. jQuery.fn.extend( {
  5862.  
  5863. on: function( types, selector, data, fn ) {
  5864. return on( this, types, selector, data, fn );
  5865. },
  5866. one: function( types, selector, data, fn ) {
  5867. return on( this, types, selector, data, fn, 1 );
  5868. },
  5869. off: function( types, selector, fn ) {
  5870. var handleObj, type;
  5871. if ( types && types.preventDefault && types.handleObj ) {
  5872.  
  5873. // ( event ) dispatched jQuery.Event
  5874. handleObj = types.handleObj;
  5875. jQuery( types.delegateTarget ).off(
  5876. handleObj.namespace ?
  5877. handleObj.origType + "." + handleObj.namespace :
  5878. handleObj.origType,
  5879. handleObj.selector,
  5880. handleObj.handler
  5881. );
  5882. return this;
  5883. }
  5884. if ( typeof types === "object" ) {
  5885.  
  5886. // ( types-object [, selector] )
  5887. for ( type in types ) {
  5888. this.off( type, selector, types[ type ] );
  5889. }
  5890. return this;
  5891. }
  5892. if ( selector === false || typeof selector === "function" ) {
  5893.  
  5894. // ( types [, fn] )
  5895. fn = selector;
  5896. selector = undefined;
  5897. }
  5898. if ( fn === false ) {
  5899. fn = returnFalse;
  5900. }
  5901. return this.each( function() {
  5902. jQuery.event.remove( this, types, fn, selector );
  5903. } );
  5904. }
  5905. } );
  5906.  
  5907.  
  5908. var
  5909.  
  5910. // Support: IE <=10 - 11, Edge 12 - 13 only
  5911. // In IE/Edge using regex groups here causes severe slowdowns.
  5912. // See https://connect.microsoft.com/IE/feedback/details/1736512/
  5913. rnoInnerhtml = /<script|<style|<link/i,
  5914.  
  5915. // checked="checked" or checked
  5916. rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
  5917.  
  5918. rcleanScript = /^\s*<!\[CDATA\[|\]\]>\s*$/g;
  5919.  
  5920. // Prefer a tbody over its parent table for containing new rows
  5921. function manipulationTarget( elem, content ) {
  5922. if ( nodeName( elem, "table" ) &&
  5923. nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ) {
  5924.  
  5925. return jQuery( elem ).children( "tbody" )[ 0 ] || elem;
  5926. }
  5927.  
  5928. return elem;
  5929. }
  5930.  
  5931. // Replace/restore the type attribute of script elements for safe DOM manipulation
  5932. function disableScript( elem ) {
  5933. elem.type = ( elem.getAttribute( "type" ) !== null ) + "/" + elem.type;
  5934. return elem;
  5935. }
  5936. function restoreScript( elem ) {
  5937. if ( ( elem.type || "" ).slice( 0, 5 ) === "true/" ) {
  5938. elem.type = elem.type.slice( 5 );
  5939. } else {
  5940. elem.removeAttribute( "type" );
  5941. }
  5942.  
  5943. return elem;
  5944. }
  5945.  
  5946. function cloneCopyEvent( src, dest ) {
  5947. var i, l, type, pdataOld, udataOld, udataCur, events;
  5948.  
  5949. if ( dest.nodeType !== 1 ) {
  5950. return;
  5951. }
  5952.  
  5953. // 1. Copy private data: events, handlers, etc.
  5954. if ( dataPriv.hasData( src ) ) {
  5955. pdataOld = dataPriv.get( src );
  5956. events = pdataOld.events;
  5957.  
  5958. if ( events ) {
  5959. dataPriv.remove( dest, "handle events" );
  5960.  
  5961. for ( type in events ) {
  5962. for ( i = 0, l = events[ type ].length; i < l; i++ ) {
  5963. jQuery.event.add( dest, type, events[ type ][ i ] );
  5964. }
  5965. }
  5966. }
  5967. }
  5968.  
  5969. // 2. Copy user data
  5970. if ( dataUser.hasData( src ) ) {
  5971. udataOld = dataUser.access( src );
  5972. udataCur = jQuery.extend( {}, udataOld );
  5973.  
  5974. dataUser.set( dest, udataCur );
  5975. }
  5976. }
  5977.  
  5978. // Fix IE bugs, see support tests
  5979. function fixInput( src, dest ) {
  5980. var nodeName = dest.nodeName.toLowerCase();
  5981.  
  5982. // Fails to persist the checked state of a cloned checkbox or radio button.
  5983. if ( nodeName === "input" && rcheckableType.test( src.type ) ) {
  5984. dest.checked = src.checked;
  5985.  
  5986. // Fails to return the selected option to the default selected state when cloning options
  5987. } else if ( nodeName === "input" || nodeName === "textarea" ) {
  5988. dest.defaultValue = src.defaultValue;
  5989. }
  5990. }
  5991.  
  5992. function domManip( collection, args, callback, ignored ) {
  5993.  
  5994. // Flatten any nested arrays
  5995. args = flat( args );
  5996.  
  5997. var fragment, first, scripts, hasScripts, node, doc,
  5998. i = 0,
  5999. l = collection.length,
  6000. iNoClone = l - 1,
  6001. value = args[ 0 ],
  6002. valueIsFunction = isFunction( value );
  6003.  
  6004. // We can't cloneNode fragments that contain checked, in WebKit
  6005. if ( valueIsFunction ||
  6006. ( l > 1 && typeof value === "string" &&
  6007. !support.checkClone && rchecked.test( value ) ) ) {
  6008. return collection.each( function( index ) {
  6009. var self = collection.eq( index );
  6010. if ( valueIsFunction ) {
  6011. args[ 0 ] = value.call( this, index, self.html() );
  6012. }
  6013. domManip( self, args, callback, ignored );
  6014. } );
  6015. }
  6016.  
  6017. if ( l ) {
  6018. fragment = buildFragment( args, collection[ 0 ].ownerDocument, false, collection, ignored );
  6019. first = fragment.firstChild;
  6020.  
  6021. if ( fragment.childNodes.length === 1 ) {
  6022. fragment = first;
  6023. }
  6024.  
  6025. // Require either new content or an interest in ignored elements to invoke the callback
  6026. if ( first || ignored ) {
  6027. scripts = jQuery.map( getAll( fragment, "script" ), disableScript );
  6028. hasScripts = scripts.length;
  6029.  
  6030. // Use the original fragment for the last item
  6031. // instead of the first because it can end up
  6032. // being emptied incorrectly in certain situations (trac-8070).
  6033. for ( ; i < l; i++ ) {
  6034. node = fragment;
  6035.  
  6036. if ( i !== iNoClone ) {
  6037. node = jQuery.clone( node, true, true );
  6038.  
  6039. // Keep references to cloned scripts for later restoration
  6040. if ( hasScripts ) {
  6041.  
  6042. // Support: Android <=4.0 only, PhantomJS 1 only
  6043. // push.apply(_, arraylike) throws on ancient WebKit
  6044. jQuery.merge( scripts, getAll( node, "script" ) );
  6045. }
  6046. }
  6047.  
  6048. callback.call( collection[ i ], node, i );
  6049. }
  6050.  
  6051. if ( hasScripts ) {
  6052. doc = scripts[ scripts.length - 1 ].ownerDocument;
  6053.  
  6054. // Re-enable scripts
  6055. jQuery.map( scripts, restoreScript );
  6056.  
  6057. // Evaluate executable scripts on first document insertion
  6058. for ( i = 0; i < hasScripts; i++ ) {
  6059. node = scripts[ i ];
  6060. if ( rscriptType.test( node.type || "" ) &&
  6061. !dataPriv.access( node, "globalEval" ) &&
  6062. jQuery.contains( doc, node ) ) {
  6063.  
  6064. if ( node.src && ( node.type || "" ).toLowerCase() !== "module" ) {
  6065.  
  6066. // Optional AJAX dependency, but won't run scripts if not present
  6067. if ( jQuery._evalUrl && !node.noModule ) {
  6068. jQuery._evalUrl( node.src, {
  6069. nonce: node.nonce || node.getAttribute( "nonce" )
  6070. }, doc );
  6071. }
  6072. } else {
  6073.  
  6074. // Unwrap a CDATA section containing script contents. This shouldn't be
  6075. // needed as in XML documents they're already not visible when
  6076. // inspecting element contents and in HTML documents they have no
  6077. // meaning but we're preserving that logic for backwards compatibility.
  6078. // This will be removed completely in 4.0. See gh-4904.
  6079. DOMEval( node.textContent.replace( rcleanScript, "" ), node, doc );
  6080. }
  6081. }
  6082. }
  6083. }
  6084. }
  6085. }
  6086.  
  6087. return collection;
  6088. }
  6089.  
  6090. function remove( elem, selector, keepData ) {
  6091. var node,
  6092. nodes = selector ? jQuery.filter( selector, elem ) : elem,
  6093. i = 0;
  6094.  
  6095. for ( ; ( node = nodes[ i ] ) != null; i++ ) {
  6096. if ( !keepData && node.nodeType === 1 ) {
  6097. jQuery.cleanData( getAll( node ) );
  6098. }
  6099.  
  6100. if ( node.parentNode ) {
  6101. if ( keepData && isAttached( node ) ) {
  6102. setGlobalEval( getAll( node, "script" ) );
  6103. }
  6104. node.parentNode.removeChild( node );
  6105. }
  6106. }
  6107.  
  6108. return elem;
  6109. }
  6110.  
  6111. jQuery.extend( {
  6112. htmlPrefilter: function( html ) {
  6113. return html;
  6114. },
  6115.  
  6116. clone: function( elem, dataAndEvents, deepDataAndEvents ) {
  6117. var i, l, srcElements, destElements,
  6118. clone = elem.cloneNode( true ),
  6119. inPage = isAttached( elem );
  6120.  
  6121. // Fix IE cloning issues
  6122. if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) &&
  6123. !jQuery.isXMLDoc( elem ) ) {
  6124.  
  6125. // We eschew jQuery#find here for performance reasons:
  6126. // https://jsperf.com/getall-vs-sizzle/2
  6127. destElements = getAll( clone );
  6128. srcElements = getAll( elem );
  6129.  
  6130. for ( i = 0, l = srcElements.length; i < l; i++ ) {
  6131. fixInput( srcElements[ i ], destElements[ i ] );
  6132. }
  6133. }
  6134.  
  6135. // Copy the events from the original to the clone
  6136. if ( dataAndEvents ) {
  6137. if ( deepDataAndEvents ) {
  6138. srcElements = srcElements || getAll( elem );
  6139. destElements = destElements || getAll( clone );
  6140.  
  6141. for ( i = 0, l = srcElements.length; i < l; i++ ) {
  6142. cloneCopyEvent( srcElements[ i ], destElements[ i ] );
  6143. }
  6144. } else {
  6145. cloneCopyEvent( elem, clone );
  6146. }
  6147. }
  6148.  
  6149. // Preserve script evaluation history
  6150. destElements = getAll( clone, "script" );
  6151. if ( destElements.length > 0 ) {
  6152. setGlobalEval( destElements, !inPage && getAll( elem, "script" ) );
  6153. }
  6154.  
  6155. // Return the cloned set
  6156. return clone;
  6157. },
  6158.  
  6159. cleanData: function( elems ) {
  6160. var data, elem, type,
  6161. special = jQuery.event.special,
  6162. i = 0;
  6163.  
  6164. for ( ; ( elem = elems[ i ] ) !== undefined; i++ ) {
  6165. if ( acceptData( elem ) ) {
  6166. if ( ( data = elem[ dataPriv.expando ] ) ) {
  6167. if ( data.events ) {
  6168. for ( type in data.events ) {
  6169. if ( special[ type ] ) {
  6170. jQuery.event.remove( elem, type );
  6171.  
  6172. // This is a shortcut to avoid jQuery.event.remove's overhead
  6173. } else {
  6174. jQuery.removeEvent( elem, type, data.handle );
  6175. }
  6176. }
  6177. }
  6178.  
  6179. // Support: Chrome <=35 - 45+
  6180. // Assign undefined instead of using delete, see Data#remove
  6181. elem[ dataPriv.expando ] = undefined;
  6182. }
  6183. if ( elem[ dataUser.expando ] ) {
  6184.  
  6185. // Support: Chrome <=35 - 45+
  6186. // Assign undefined instead of using delete, see Data#remove
  6187. elem[ dataUser.expando ] = undefined;
  6188. }
  6189. }
  6190. }
  6191. }
  6192. } );
  6193.  
  6194. jQuery.fn.extend( {
  6195. detach: function( selector ) {
  6196. return remove( this, selector, true );
  6197. },
  6198.  
  6199. remove: function( selector ) {
  6200. return remove( this, selector );
  6201. },
  6202.  
  6203. text: function( value ) {
  6204. return access( this, function( value ) {
  6205. return value === undefined ?
  6206. jQuery.text( this ) :
  6207. this.empty().each( function() {
  6208. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  6209. this.textContent = value;
  6210. }
  6211. } );
  6212. }, null, value, arguments.length );
  6213. },
  6214.  
  6215. append: function() {
  6216. return domManip( this, arguments, function( elem ) {
  6217. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  6218. var target = manipulationTarget( this, elem );
  6219. target.appendChild( elem );
  6220. }
  6221. } );
  6222. },
  6223.  
  6224. prepend: function() {
  6225. return domManip( this, arguments, function( elem ) {
  6226. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  6227. var target = manipulationTarget( this, elem );
  6228. target.insertBefore( elem, target.firstChild );
  6229. }
  6230. } );
  6231. },
  6232.  
  6233. before: function() {
  6234. return domManip( this, arguments, function( elem ) {
  6235. if ( this.parentNode ) {
  6236. this.parentNode.insertBefore( elem, this );
  6237. }
  6238. } );
  6239. },
  6240.  
  6241. after: function() {
  6242. return domManip( this, arguments, function( elem ) {
  6243. if ( this.parentNode ) {
  6244. this.parentNode.insertBefore( elem, this.nextSibling );
  6245. }
  6246. } );
  6247. },
  6248.  
  6249. empty: function() {
  6250. var elem,
  6251. i = 0;
  6252.  
  6253. for ( ; ( elem = this[ i ] ) != null; i++ ) {
  6254. if ( elem.nodeType === 1 ) {
  6255.  
  6256. // Prevent memory leaks
  6257. jQuery.cleanData( getAll( elem, false ) );
  6258.  
  6259. // Remove any remaining nodes
  6260. elem.textContent = "";
  6261. }
  6262. }
  6263.  
  6264. return this;
  6265. },
  6266.  
  6267. clone: function( dataAndEvents, deepDataAndEvents ) {
  6268. dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
  6269. deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
  6270.  
  6271. return this.map( function() {
  6272. return jQuery.clone( this, dataAndEvents, deepDataAndEvents );
  6273. } );
  6274. },
  6275.  
  6276. html: function( value ) {
  6277. return access( this, function( value ) {
  6278. var elem = this[ 0 ] || {},
  6279. i = 0,
  6280. l = this.length;
  6281.  
  6282. if ( value === undefined && elem.nodeType === 1 ) {
  6283. return elem.innerHTML;
  6284. }
  6285.  
  6286. // See if we can take a shortcut and just use innerHTML
  6287. if ( typeof value === "string" && !rnoInnerhtml.test( value ) &&
  6288. !wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) {
  6289.  
  6290. value = jQuery.htmlPrefilter( value );
  6291.  
  6292. try {
  6293. for ( ; i < l; i++ ) {
  6294. elem = this[ i ] || {};
  6295.  
  6296. // Remove element nodes and prevent memory leaks
  6297. if ( elem.nodeType === 1 ) {
  6298. jQuery.cleanData( getAll( elem, false ) );
  6299. elem.innerHTML = value;
  6300. }
  6301. }
  6302.  
  6303. elem = 0;
  6304.  
  6305. // If using innerHTML throws an exception, use the fallback method
  6306. } catch ( e ) {}
  6307. }
  6308.  
  6309. if ( elem ) {
  6310. this.empty().append( value );
  6311. }
  6312. }, null, value, arguments.length );
  6313. },
  6314.  
  6315. replaceWith: function() {
  6316. var ignored = [];
  6317.  
  6318. // Make the changes, replacing each non-ignored context element with the new content
  6319. return domManip( this, arguments, function( elem ) {
  6320. var parent = this.parentNode;
  6321.  
  6322. if ( jQuery.inArray( this, ignored ) < 0 ) {
  6323. jQuery.cleanData( getAll( this ) );
  6324. if ( parent ) {
  6325. parent.replaceChild( elem, this );
  6326. }
  6327. }
  6328.  
  6329. // Force callback invocation
  6330. }, ignored );
  6331. }
  6332. } );
  6333.  
  6334. jQuery.each( {
  6335. appendTo: "append",
  6336. prependTo: "prepend",
  6337. insertBefore: "before",
  6338. insertAfter: "after",
  6339. replaceAll: "replaceWith"
  6340. }, function( name, original ) {
  6341. jQuery.fn[ name ] = function( selector ) {
  6342. var elems,
  6343. ret = [],
  6344. insert = jQuery( selector ),
  6345. last = insert.length - 1,
  6346. i = 0;
  6347.  
  6348. for ( ; i <= last; i++ ) {
  6349. elems = i === last ? this : this.clone( true );
  6350. jQuery( insert[ i ] )[ original ]( elems );
  6351.  
  6352. // Support: Android <=4.0 only, PhantomJS 1 only
  6353. // .get() because push.apply(_, arraylike) throws on ancient WebKit
  6354. push.apply( ret, elems.get() );
  6355. }
  6356.  
  6357. return this.pushStack( ret );
  6358. };
  6359. } );
  6360. var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" );
  6361.  
  6362. var rcustomProp = /^--/;
  6363.  
  6364.  
  6365. var getStyles = function( elem ) {
  6366.  
  6367. // Support: IE <=11 only, Firefox <=30 (trac-15098, trac-14150)
  6368. // IE throws on elements created in popups
  6369. // FF meanwhile throws on frame elements through "defaultView.getComputedStyle"
  6370. var view = elem.ownerDocument.defaultView;
  6371.  
  6372. if ( !view || !view.opener ) {
  6373. view = window;
  6374. }
  6375.  
  6376. return view.getComputedStyle( elem );
  6377. };
  6378.  
  6379. var swap = function( elem, options, callback ) {
  6380. var ret, name,
  6381. old = {};
  6382.  
  6383. // Remember the old values, and insert the new ones
  6384. for ( name in options ) {
  6385. old[ name ] = elem.style[ name ];
  6386. elem.style[ name ] = options[ name ];
  6387. }
  6388.  
  6389. ret = callback.call( elem );
  6390.  
  6391. // Revert the old values
  6392. for ( name in options ) {
  6393. elem.style[ name ] = old[ name ];
  6394. }
  6395.  
  6396. return ret;
  6397. };
  6398.  
  6399.  
  6400. var rboxStyle = new RegExp( cssExpand.join( "|" ), "i" );
  6401.  
  6402.  
  6403.  
  6404. ( function() {
  6405.  
  6406. // Executing both pixelPosition & boxSizingReliable tests require only one layout
  6407. // so they're executed at the same time to save the second computation.
  6408. function computeStyleTests() {
  6409.  
  6410. // This is a singleton, we need to execute it only once
  6411. if ( !div ) {
  6412. return;
  6413. }
  6414.  
  6415. container.style.cssText = "position:absolute;left:-11111px;width:60px;" +
  6416. "margin-top:1px;padding:0;border:0";
  6417. div.style.cssText =
  6418. "position:relative;display:block;box-sizing:border-box;overflow:scroll;" +
  6419. "margin:auto;border:1px;padding:1px;" +
  6420. "width:60%;top:1%";
  6421. documentElement.appendChild( container ).appendChild( div );
  6422.  
  6423. var divStyle = window.getComputedStyle( div );
  6424. pixelPositionVal = divStyle.top !== "1%";
  6425.  
  6426. // Support: Android 4.0 - 4.3 only, Firefox <=3 - 44
  6427. reliableMarginLeftVal = roundPixelMeasures( divStyle.marginLeft ) === 12;
  6428.  
  6429. // Support: Android 4.0 - 4.3 only, Safari <=9.1 - 10.1, iOS <=7.0 - 9.3
  6430. // Some styles come back with percentage values, even though they shouldn't
  6431. div.style.right = "60%";
  6432. pixelBoxStylesVal = roundPixelMeasures( divStyle.right ) === 36;
  6433.  
  6434. // Support: IE 9 - 11 only
  6435. // Detect misreporting of content dimensions for box-sizing:border-box elements
  6436. boxSizingReliableVal = roundPixelMeasures( divStyle.width ) === 36;
  6437.  
  6438. // Support: IE 9 only
  6439. // Detect overflow:scroll screwiness (gh-3699)
  6440. // Support: Chrome <=64
  6441. // Don't get tricked when zoom affects offsetWidth (gh-4029)
  6442. div.style.position = "absolute";
  6443. scrollboxSizeVal = roundPixelMeasures( div.offsetWidth / 3 ) === 12;
  6444.  
  6445. documentElement.removeChild( container );
  6446.  
  6447. // Nullify the div so it wouldn't be stored in the memory and
  6448. // it will also be a sign that checks already performed
  6449. div = null;
  6450. }
  6451.  
  6452. function roundPixelMeasures( measure ) {
  6453. return Math.round( parseFloat( measure ) );
  6454. }
  6455.  
  6456. var pixelPositionVal, boxSizingReliableVal, scrollboxSizeVal, pixelBoxStylesVal,
  6457. reliableTrDimensionsVal, reliableMarginLeftVal,
  6458. container = document.createElement( "div" ),
  6459. div = document.createElement( "div" );
  6460.  
  6461. // Finish early in limited (non-browser) environments
  6462. if ( !div.style ) {
  6463. return;
  6464. }
  6465.  
  6466. // Support: IE <=9 - 11 only
  6467. // Style of cloned element affects source element cloned (trac-8908)
  6468. div.style.backgroundClip = "content-box";
  6469. div.cloneNode( true ).style.backgroundClip = "";
  6470. support.clearCloneStyle = div.style.backgroundClip === "content-box";
  6471.  
  6472. jQuery.extend( support, {
  6473. boxSizingReliable: function() {
  6474. computeStyleTests();
  6475. return boxSizingReliableVal;
  6476. },
  6477. pixelBoxStyles: function() {
  6478. computeStyleTests();
  6479. return pixelBoxStylesVal;
  6480. },
  6481. pixelPosition: function() {
  6482. computeStyleTests();
  6483. return pixelPositionVal;
  6484. },
  6485. reliableMarginLeft: function() {
  6486. computeStyleTests();
  6487. return reliableMarginLeftVal;
  6488. },
  6489. scrollboxSize: function() {
  6490. computeStyleTests();
  6491. return scrollboxSizeVal;
  6492. },
  6493.  
  6494. // Support: IE 9 - 11+, Edge 15 - 18+
  6495. // IE/Edge misreport `getComputedStyle` of table rows with width/height
  6496. // set in CSS while `offset*` properties report correct values.
  6497. // Behavior in IE 9 is more subtle than in newer versions & it passes
  6498. // some versions of this test; make sure not to make it pass there!
  6499. //
  6500. // Support: Firefox 70+
  6501. // Only Firefox includes border widths
  6502. // in computed dimensions. (gh-4529)
  6503. reliableTrDimensions: function() {
  6504. var table, tr, trChild, trStyle;
  6505. if ( reliableTrDimensionsVal == null ) {
  6506. table = document.createElement( "table" );
  6507. tr = document.createElement( "tr" );
  6508. trChild = document.createElement( "div" );
  6509.  
  6510. table.style.cssText = "position:absolute;left:-11111px;border-collapse:separate";
  6511. tr.style.cssText = "box-sizing:content-box;border:1px solid";
  6512.  
  6513. // Support: Chrome 86+
  6514. // Height set through cssText does not get applied.
  6515. // Computed height then comes back as 0.
  6516. tr.style.height = "1px";
  6517. trChild.style.height = "9px";
  6518.  
  6519. // Support: Android 8 Chrome 86+
  6520. // In our bodyBackground.html iframe,
  6521. // display for all div elements is set to "inline",
  6522. // which causes a problem only in Android 8 Chrome 86.
  6523. // Ensuring the div is `display: block`
  6524. // gets around this issue.
  6525. trChild.style.display = "block";
  6526.  
  6527. documentElement
  6528. .appendChild( table )
  6529. .appendChild( tr )
  6530. .appendChild( trChild );
  6531.  
  6532. trStyle = window.getComputedStyle( tr );
  6533. reliableTrDimensionsVal = ( parseInt( trStyle.height, 10 ) +
  6534. parseInt( trStyle.borderTopWidth, 10 ) +
  6535. parseInt( trStyle.borderBottomWidth, 10 ) ) === tr.offsetHeight;
  6536.  
  6537. documentElement.removeChild( table );
  6538. }
  6539. return reliableTrDimensionsVal;
  6540. }
  6541. } );
  6542. } )();
  6543.  
  6544.  
  6545. function curCSS( elem, name, computed ) {
  6546. var width, minWidth, maxWidth, ret,
  6547. isCustomProp = rcustomProp.test( name ),
  6548.  
  6549. // Support: Firefox 51+
  6550. // Retrieving style before computed somehow
  6551. // fixes an issue with getting wrong values
  6552. // on detached elements
  6553. style = elem.style;
  6554.  
  6555. computed = computed || getStyles( elem );
  6556.  
  6557. // getPropertyValue is needed for:
  6558. // .css('filter') (IE 9 only, trac-12537)
  6559. // .css('--customProperty) (gh-3144)
  6560. if ( computed ) {
  6561.  
  6562. // Support: IE <=9 - 11+
  6563. // IE only supports `"float"` in `getPropertyValue`; in computed styles
  6564. // it's only available as `"cssFloat"`. We no longer modify properties
  6565. // sent to `.css()` apart from camelCasing, so we need to check both.
  6566. // Normally, this would create difference in behavior: if
  6567. // `getPropertyValue` returns an empty string, the value returned
  6568. // by `.css()` would be `undefined`. This is usually the case for
  6569. // disconnected elements. However, in IE even disconnected elements
  6570. // with no styles return `"none"` for `getPropertyValue( "float" )`
  6571. ret = computed.getPropertyValue( name ) || computed[ name ];
  6572.  
  6573. if ( isCustomProp && ret ) {
  6574.  
  6575. // Support: Firefox 105+, Chrome <=105+
  6576. // Spec requires trimming whitespace for custom properties (gh-4926).
  6577. // Firefox only trims leading whitespace. Chrome just collapses
  6578. // both leading & trailing whitespace to a single space.
  6579. //
  6580. // Fall back to `undefined` if empty string returned.
  6581. // This collapses a missing definition with property defined
  6582. // and set to an empty string but there's no standard API
  6583. // allowing us to differentiate them without a performance penalty
  6584. // and returning `undefined` aligns with older jQuery.
  6585. //
  6586. // rtrimCSS treats U+000D CARRIAGE RETURN and U+000C FORM FEED
  6587. // as whitespace while CSS does not, but this is not a problem
  6588. // because CSS preprocessing replaces them with U+000A LINE FEED
  6589. // (which *is* CSS whitespace)
  6590. // https://www.w3.org/TR/css-syntax-3/#input-preprocessing
  6591. ret = ret.replace( rtrimCSS, "$1" ) || undefined;
  6592. }
  6593.  
  6594. if ( ret === "" && !isAttached( elem ) ) {
  6595. ret = jQuery.style( elem, name );
  6596. }
  6597.  
  6598. // A tribute to the "awesome hack by Dean Edwards"
  6599. // Android Browser returns percentage for some values,
  6600. // but width seems to be reliably pixels.
  6601. // This is against the CSSOM draft spec:
  6602. // https://drafts.csswg.org/cssom/#resolved-values
  6603. if ( !support.pixelBoxStyles() && rnumnonpx.test( ret ) && rboxStyle.test( name ) ) {
  6604.  
  6605. // Remember the original values
  6606. width = style.width;
  6607. minWidth = style.minWidth;
  6608. maxWidth = style.maxWidth;
  6609.  
  6610. // Put in the new values to get a computed value out
  6611. style.minWidth = style.maxWidth = style.width = ret;
  6612. ret = computed.width;
  6613.  
  6614. // Revert the changed values
  6615. style.width = width;
  6616. style.minWidth = minWidth;
  6617. style.maxWidth = maxWidth;
  6618. }
  6619. }
  6620.  
  6621. return ret !== undefined ?
  6622.  
  6623. // Support: IE <=9 - 11 only
  6624. // IE returns zIndex value as an integer.
  6625. ret + "" :
  6626. ret;
  6627. }
  6628.  
  6629.  
  6630. function addGetHookIf( conditionFn, hookFn ) {
  6631.  
  6632. // Define the hook, we'll check on the first run if it's really needed.
  6633. return {
  6634. get: function() {
  6635. if ( conditionFn() ) {
  6636.  
  6637. // Hook not needed (or it's not possible to use it due
  6638. // to missing dependency), remove it.
  6639. delete this.get;
  6640. return;
  6641. }
  6642.  
  6643. // Hook needed; redefine it so that the support test is not executed again.
  6644. return ( this.get = hookFn ).apply( this, arguments );
  6645. }
  6646. };
  6647. }
  6648.  
  6649.  
  6650. var cssPrefixes = [ "Webkit", "Moz", "ms" ],
  6651. emptyStyle = document.createElement( "div" ).style,
  6652. vendorProps = {};
  6653.  
  6654. // Return a vendor-prefixed property or undefined
  6655. function vendorPropName( name ) {
  6656.  
  6657. // Check for vendor prefixed names
  6658. var capName = name[ 0 ].toUpperCase() + name.slice( 1 ),
  6659. i = cssPrefixes.length;
  6660.  
  6661. while ( i-- ) {
  6662. name = cssPrefixes[ i ] + capName;
  6663. if ( name in emptyStyle ) {
  6664. return name;
  6665. }
  6666. }
  6667. }
  6668.  
  6669. // Return a potentially-mapped jQuery.cssProps or vendor prefixed property
  6670. function finalPropName( name ) {
  6671. var final = jQuery.cssProps[ name ] || vendorProps[ name ];
  6672.  
  6673. if ( final ) {
  6674. return final;
  6675. }
  6676. if ( name in emptyStyle ) {
  6677. return name;
  6678. }
  6679. return vendorProps[ name ] = vendorPropName( name ) || name;
  6680. }
  6681.  
  6682.  
  6683. var
  6684.  
  6685. // Swappable if display is none or starts with table
  6686. // except "table", "table-cell", or "table-caption"
  6687. // See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display
  6688. rdisplayswap = /^(none|table(?!-c[ea]).+)/,
  6689. cssShow = { position: "absolute", visibility: "hidden", display: "block" },
  6690. cssNormalTransform = {
  6691. letterSpacing: "0",
  6692. fontWeight: "400"
  6693. };
  6694.  
  6695. function setPositiveNumber( _elem, value, subtract ) {
  6696.  
  6697. // Any relative (+/-) values have already been
  6698. // normalized at this point
  6699. var matches = rcssNum.exec( value );
  6700. return matches ?
  6701.  
  6702. // Guard against undefined "subtract", e.g., when used as in cssHooks
  6703. Math.max( 0, matches[ 2 ] - ( subtract || 0 ) ) + ( matches[ 3 ] || "px" ) :
  6704. value;
  6705. }
  6706.  
  6707. function boxModelAdjustment( elem, dimension, box, isBorderBox, styles, computedVal ) {
  6708. var i = dimension === "width" ? 1 : 0,
  6709. extra = 0,
  6710. delta = 0,
  6711. marginDelta = 0;
  6712.  
  6713. // Adjustment may not be necessary
  6714. if ( box === ( isBorderBox ? "border" : "content" ) ) {
  6715. return 0;
  6716. }
  6717.  
  6718. for ( ; i < 4; i += 2 ) {
  6719.  
  6720. // Both box models exclude margin
  6721. // Count margin delta separately to only add it after scroll gutter adjustment.
  6722. // This is needed to make negative margins work with `outerHeight( true )` (gh-3982).
  6723. if ( box === "margin" ) {
  6724. marginDelta += jQuery.css( elem, box + cssExpand[ i ], true, styles );
  6725. }
  6726.  
  6727. // If we get here with a content-box, we're seeking "padding" or "border" or "margin"
  6728. if ( !isBorderBox ) {
  6729.  
  6730. // Add padding
  6731. delta += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
  6732.  
  6733. // For "border" or "margin", add border
  6734. if ( box !== "padding" ) {
  6735. delta += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  6736.  
  6737. // But still keep track of it otherwise
  6738. } else {
  6739. extra += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  6740. }
  6741.  
  6742. // If we get here with a border-box (content + padding + border), we're seeking "content" or
  6743. // "padding" or "margin"
  6744. } else {
  6745.  
  6746. // For "content", subtract padding
  6747. if ( box === "content" ) {
  6748. delta -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
  6749. }
  6750.  
  6751. // For "content" or "padding", subtract border
  6752. if ( box !== "margin" ) {
  6753. delta -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  6754. }
  6755. }
  6756. }
  6757.  
  6758. // Account for positive content-box scroll gutter when requested by providing computedVal
  6759. if ( !isBorderBox && computedVal >= 0 ) {
  6760.  
  6761. // offsetWidth/offsetHeight is a rounded sum of content, padding, scroll gutter, and border
  6762. // Assuming integer scroll gutter, subtract the rest and round down
  6763. delta += Math.max( 0, Math.ceil(
  6764. elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] -
  6765. computedVal -
  6766. delta -
  6767. extra -
  6768. 0.5
  6769.  
  6770. // If offsetWidth/offsetHeight is unknown, then we can't determine content-box scroll gutter
  6771. // Use an explicit zero to avoid NaN (gh-3964)
  6772. ) ) || 0;
  6773. }
  6774.  
  6775. return delta + marginDelta;
  6776. }
  6777.  
  6778. function getWidthOrHeight( elem, dimension, extra ) {
  6779.  
  6780. // Start with computed style
  6781. var styles = getStyles( elem ),
  6782.  
  6783. // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-4322).
  6784. // Fake content-box until we know it's needed to know the true value.
  6785. boxSizingNeeded = !support.boxSizingReliable() || extra,
  6786. isBorderBox = boxSizingNeeded &&
  6787. jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
  6788. valueIsBorderBox = isBorderBox,
  6789.  
  6790. val = curCSS( elem, dimension, styles ),
  6791. offsetProp = "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 );
  6792.  
  6793. // Support: Firefox <=54
  6794. // Return a confounding non-pixel value or feign ignorance, as appropriate.
  6795. if ( rnumnonpx.test( val ) ) {
  6796. if ( !extra ) {
  6797. return val;
  6798. }
  6799. val = "auto";
  6800. }
  6801.  
  6802.  
  6803. // Support: IE 9 - 11 only
  6804. // Use offsetWidth/offsetHeight for when box sizing is unreliable.
  6805. // In those cases, the computed value can be trusted to be border-box.
  6806. if ( ( !support.boxSizingReliable() && isBorderBox ||
  6807.  
  6808. // Support: IE 10 - 11+, Edge 15 - 18+
  6809. // IE/Edge misreport `getComputedStyle` of table rows with width/height
  6810. // set in CSS while `offset*` properties report correct values.
  6811. // Interestingly, in some cases IE 9 doesn't suffer from this issue.
  6812. !support.reliableTrDimensions() && nodeName( elem, "tr" ) ||
  6813.  
  6814. // Fall back to offsetWidth/offsetHeight when value is "auto"
  6815. // This happens for inline elements with no explicit setting (gh-3571)
  6816. val === "auto" ||
  6817.  
  6818. // Support: Android <=4.1 - 4.3 only
  6819. // Also use offsetWidth/offsetHeight for misreported inline dimensions (gh-3602)
  6820. !parseFloat( val ) && jQuery.css( elem, "display", false, styles ) === "inline" ) &&
  6821.  
  6822. // Make sure the element is visible & connected
  6823. elem.getClientRects().length ) {
  6824.  
  6825. isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box";
  6826.  
  6827. // Where available, offsetWidth/offsetHeight approximate border box dimensions.
  6828. // Where not available (e.g., SVG), assume unreliable box-sizing and interpret the
  6829. // retrieved value as a content box dimension.
  6830. valueIsBorderBox = offsetProp in elem;
  6831. if ( valueIsBorderBox ) {
  6832. val = elem[ offsetProp ];
  6833. }
  6834. }
  6835.  
  6836. // Normalize "" and auto
  6837. val = parseFloat( val ) || 0;
  6838.  
  6839. // Adjust for the element's box model
  6840. return ( val +
  6841. boxModelAdjustment(
  6842. elem,
  6843. dimension,
  6844. extra || ( isBorderBox ? "border" : "content" ),
  6845. valueIsBorderBox,
  6846. styles,
  6847.  
  6848. // Provide the current computed size to request scroll gutter calculation (gh-3589)
  6849. val
  6850. )
  6851. ) + "px";
  6852. }
  6853.  
  6854. jQuery.extend( {
  6855.  
  6856. // Add in style property hooks for overriding the default
  6857. // behavior of getting and setting a style property
  6858. cssHooks: {
  6859. opacity: {
  6860. get: function( elem, computed ) {
  6861. if ( computed ) {
  6862.  
  6863. // We should always get a number back from opacity
  6864. var ret = curCSS( elem, "opacity" );
  6865. return ret === "" ? "1" : ret;
  6866. }
  6867. }
  6868. }
  6869. },
  6870.  
  6871. // Don't automatically add "px" to these possibly-unitless properties
  6872. cssNumber: {
  6873. animationIterationCount: true,
  6874. aspectRatio: true,
  6875. borderImageSlice: true,
  6876. columnCount: true,
  6877. flexGrow: true,
  6878. flexShrink: true,
  6879. fontWeight: true,
  6880. gridArea: true,
  6881. gridColumn: true,
  6882. gridColumnEnd: true,
  6883. gridColumnStart: true,
  6884. gridRow: true,
  6885. gridRowEnd: true,
  6886. gridRowStart: true,
  6887. lineHeight: true,
  6888. opacity: true,
  6889. order: true,
  6890. orphans: true,
  6891. scale: true,
  6892. widows: true,
  6893. zIndex: true,
  6894. zoom: true,
  6895.  
  6896. // SVG-related
  6897. fillOpacity: true,
  6898. floodOpacity: true,
  6899. stopOpacity: true,
  6900. strokeMiterlimit: true,
  6901. strokeOpacity: true
  6902. },
  6903.  
  6904. // Add in properties whose names you wish to fix before
  6905. // setting or getting the value
  6906. cssProps: {},
  6907.  
  6908. // Get and set the style property on a DOM Node
  6909. style: function( elem, name, value, extra ) {
  6910.  
  6911. // Don't set styles on text and comment nodes
  6912. if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {
  6913. return;
  6914. }
  6915.  
  6916. // Make sure that we're working with the right name
  6917. var ret, type, hooks,
  6918. origName = camelCase( name ),
  6919. isCustomProp = rcustomProp.test( name ),
  6920. style = elem.style;
  6921.  
  6922. // Make sure that we're working with the right name. We don't
  6923. // want to query the value if it is a CSS custom property
  6924. // since they are user-defined.
  6925. if ( !isCustomProp ) {
  6926. name = finalPropName( origName );
  6927. }
  6928.  
  6929. // Gets hook for the prefixed version, then unprefixed version
  6930. hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
  6931.  
  6932. // Check if we're setting a value
  6933. if ( value !== undefined ) {
  6934. type = typeof value;
  6935.  
  6936. // Convert "+=" or "-=" to relative numbers (trac-7345)
  6937. if ( type === "string" && ( ret = rcssNum.exec( value ) ) && ret[ 1 ] ) {
  6938. value = adjustCSS( elem, name, ret );
  6939.  
  6940. // Fixes bug trac-9237
  6941. type = "number";
  6942. }
  6943.  
  6944. // Make sure that null and NaN values aren't set (trac-7116)
  6945. if ( value == null || value !== value ) {
  6946. return;
  6947. }
  6948.  
  6949. // If a number was passed in, add the unit (except for certain CSS properties)
  6950. // The isCustomProp check can be removed in jQuery 4.0 when we only auto-append
  6951. // "px" to a few hardcoded values.
  6952. if ( type === "number" && !isCustomProp ) {
  6953. value += ret && ret[ 3 ] || ( jQuery.cssNumber[ origName ] ? "" : "px" );
  6954. }
  6955.  
  6956. // background-* props affect original clone's values
  6957. if ( !support.clearCloneStyle && value === "" && name.indexOf( "background" ) === 0 ) {
  6958. style[ name ] = "inherit";
  6959. }
  6960.  
  6961. // If a hook was provided, use that value, otherwise just set the specified value
  6962. if ( !hooks || !( "set" in hooks ) ||
  6963. ( value = hooks.set( elem, value, extra ) ) !== undefined ) {
  6964.  
  6965. if ( isCustomProp ) {
  6966. style.setProperty( name, value );
  6967. } else {
  6968. style[ name ] = value;
  6969. }
  6970. }
  6971.  
  6972. } else {
  6973.  
  6974. // If a hook was provided get the non-computed value from there
  6975. if ( hooks && "get" in hooks &&
  6976. ( ret = hooks.get( elem, false, extra ) ) !== undefined ) {
  6977.  
  6978. return ret;
  6979. }
  6980.  
  6981. // Otherwise just get the value from the style object
  6982. return style[ name ];
  6983. }
  6984. },
  6985.  
  6986. css: function( elem, name, extra, styles ) {
  6987. var val, num, hooks,
  6988. origName = camelCase( name ),
  6989. isCustomProp = rcustomProp.test( name );
  6990.  
  6991. // Make sure that we're working with the right name. We don't
  6992. // want to modify the value if it is a CSS custom property
  6993. // since they are user-defined.
  6994. if ( !isCustomProp ) {
  6995. name = finalPropName( origName );
  6996. }
  6997.  
  6998. // Try prefixed name followed by the unprefixed name
  6999. hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
  7000.  
  7001. // If a hook was provided get the computed value from there
  7002. if ( hooks && "get" in hooks ) {
  7003. val = hooks.get( elem, true, extra );
  7004. }
  7005.  
  7006. // Otherwise, if a way to get the computed value exists, use that
  7007. if ( val === undefined ) {
  7008. val = curCSS( elem, name, styles );
  7009. }
  7010.  
  7011. // Convert "normal" to computed value
  7012. if ( val === "normal" && name in cssNormalTransform ) {
  7013. val = cssNormalTransform[ name ];
  7014. }
  7015.  
  7016. // Make numeric if forced or a qualifier was provided and val looks numeric
  7017. if ( extra === "" || extra ) {
  7018. num = parseFloat( val );
  7019. return extra === true || isFinite( num ) ? num || 0 : val;
  7020. }
  7021.  
  7022. return val;
  7023. }
  7024. } );
  7025.  
  7026. jQuery.each( [ "height", "width" ], function( _i, dimension ) {
  7027. jQuery.cssHooks[ dimension ] = {
  7028. get: function( elem, computed, extra ) {
  7029. if ( computed ) {
  7030.  
  7031. // Certain elements can have dimension info if we invisibly show them
  7032. // but it must have a current display style that would benefit
  7033. return rdisplayswap.test( jQuery.css( elem, "display" ) ) &&
  7034.  
  7035. // Support: Safari 8+
  7036. // Table columns in Safari have non-zero offsetWidth & zero
  7037. // getBoundingClientRect().width unless display is changed.
  7038. // Support: IE <=11 only
  7039. // Running getBoundingClientRect on a disconnected node
  7040. // in IE throws an error.
  7041. ( !elem.getClientRects().length || !elem.getBoundingClientRect().width ) ?
  7042. swap( elem, cssShow, function() {
  7043. return getWidthOrHeight( elem, dimension, extra );
  7044. } ) :
  7045. getWidthOrHeight( elem, dimension, extra );
  7046. }
  7047. },
  7048.  
  7049. set: function( elem, value, extra ) {
  7050. var matches,
  7051. styles = getStyles( elem ),
  7052.  
  7053. // Only read styles.position if the test has a chance to fail
  7054. // to avoid forcing a reflow.
  7055. scrollboxSizeBuggy = !support.scrollboxSize() &&
  7056. styles.position === "absolute",
  7057.  
  7058. // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-3991)
  7059. boxSizingNeeded = scrollboxSizeBuggy || extra,
  7060. isBorderBox = boxSizingNeeded &&
  7061. jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
  7062. subtract = extra ?
  7063. boxModelAdjustment(
  7064. elem,
  7065. dimension,
  7066. extra,
  7067. isBorderBox,
  7068. styles
  7069. ) :
  7070. 0;
  7071.  
  7072. // Account for unreliable border-box dimensions by comparing offset* to computed and
  7073. // faking a content-box to get border and padding (gh-3699)
  7074. if ( isBorderBox && scrollboxSizeBuggy ) {
  7075. subtract -= Math.ceil(
  7076. elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] -
  7077. parseFloat( styles[ dimension ] ) -
  7078. boxModelAdjustment( elem, dimension, "border", false, styles ) -
  7079. 0.5
  7080. );
  7081. }
  7082.  
  7083. // Convert to pixels if value adjustment is needed
  7084. if ( subtract && ( matches = rcssNum.exec( value ) ) &&
  7085. ( matches[ 3 ] || "px" ) !== "px" ) {
  7086.  
  7087. elem.style[ dimension ] = value;
  7088. value = jQuery.css( elem, dimension );
  7089. }
  7090.  
  7091. return setPositiveNumber( elem, value, subtract );
  7092. }
  7093. };
  7094. } );
  7095.  
  7096. jQuery.cssHooks.marginLeft = addGetHookIf( support.reliableMarginLeft,
  7097. function( elem, computed ) {
  7098. if ( computed ) {
  7099. return ( parseFloat( curCSS( elem, "marginLeft" ) ) ||
  7100. elem.getBoundingClientRect().left -
  7101. swap( elem, { marginLeft: 0 }, function() {
  7102. return elem.getBoundingClientRect().left;
  7103. } )
  7104. ) + "px";
  7105. }
  7106. }
  7107. );
  7108.  
  7109. // These hooks are used by animate to expand properties
  7110. jQuery.each( {
  7111. margin: "",
  7112. padding: "",
  7113. border: "Width"
  7114. }, function( prefix, suffix ) {
  7115. jQuery.cssHooks[ prefix + suffix ] = {
  7116. expand: function( value ) {
  7117. var i = 0,
  7118. expanded = {},
  7119.  
  7120. // Assumes a single number if not a string
  7121. parts = typeof value === "string" ? value.split( " " ) : [ value ];
  7122.  
  7123. for ( ; i < 4; i++ ) {
  7124. expanded[ prefix + cssExpand[ i ] + suffix ] =
  7125. parts[ i ] || parts[ i - 2 ] || parts[ 0 ];
  7126. }
  7127.  
  7128. return expanded;
  7129. }
  7130. };
  7131.  
  7132. if ( prefix !== "margin" ) {
  7133. jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber;
  7134. }
  7135. } );
  7136.  
  7137. jQuery.fn.extend( {
  7138. css: function( name, value ) {
  7139. return access( this, function( elem, name, value ) {
  7140. var styles, len,
  7141. map = {},
  7142. i = 0;
  7143.  
  7144. if ( Array.isArray( name ) ) {
  7145. styles = getStyles( elem );
  7146. len = name.length;
  7147.  
  7148. for ( ; i < len; i++ ) {
  7149. map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles );
  7150. }
  7151.  
  7152. return map;
  7153. }
  7154.  
  7155. return value !== undefined ?
  7156. jQuery.style( elem, name, value ) :
  7157. jQuery.css( elem, name );
  7158. }, name, value, arguments.length > 1 );
  7159. }
  7160. } );
  7161.  
  7162.  
  7163. // Based off of the plugin by Clint Helfers, with permission.
  7164. jQuery.fn.delay = function( time, type ) {
  7165. time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time;
  7166. type = type || "fx";
  7167.  
  7168. return this.queue( type, function( next, hooks ) {
  7169. var timeout = window.setTimeout( next, time );
  7170. hooks.stop = function() {
  7171. window.clearTimeout( timeout );
  7172. };
  7173. } );
  7174. };
  7175.  
  7176.  
  7177. ( function() {
  7178. var input = document.createElement( "input" ),
  7179. select = document.createElement( "select" ),
  7180. opt = select.appendChild( document.createElement( "option" ) );
  7181.  
  7182. input.type = "checkbox";
  7183.  
  7184. // Support: Android <=4.3 only
  7185. // Default value for a checkbox should be "on"
  7186. support.checkOn = input.value !== "";
  7187.  
  7188. // Support: IE <=11 only
  7189. // Must access selectedIndex to make default options select
  7190. support.optSelected = opt.selected;
  7191.  
  7192. // Support: IE <=11 only
  7193. // An input loses its value after becoming a radio
  7194. input = document.createElement( "input" );
  7195. input.value = "t";
  7196. input.type = "radio";
  7197. support.radioValue = input.value === "t";
  7198. } )();
  7199.  
  7200.  
  7201. var boolHook,
  7202. attrHandle = jQuery.expr.attrHandle;
  7203.  
  7204. jQuery.fn.extend( {
  7205. attr: function( name, value ) {
  7206. return access( this, jQuery.attr, name, value, arguments.length > 1 );
  7207. },
  7208.  
  7209. removeAttr: function( name ) {
  7210. return this.each( function() {
  7211. jQuery.removeAttr( this, name );
  7212. } );
  7213. }
  7214. } );
  7215.  
  7216. jQuery.extend( {
  7217. attr: function( elem, name, value ) {
  7218. var ret, hooks,
  7219. nType = elem.nodeType;
  7220.  
  7221. // Don't get/set attributes on text, comment and attribute nodes
  7222. if ( nType === 3 || nType === 8 || nType === 2 ) {
  7223. return;
  7224. }
  7225.  
  7226. // Fallback to prop when attributes are not supported
  7227. if ( typeof elem.getAttribute === "undefined" ) {
  7228. return jQuery.prop( elem, name, value );
  7229. }
  7230.  
  7231. // Attribute hooks are determined by the lowercase version
  7232. // Grab necessary hook if one is defined
  7233. if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
  7234. hooks = jQuery.attrHooks[ name.toLowerCase() ] ||
  7235. ( jQuery.expr.match.bool.test( name ) ? boolHook : undefined );
  7236. }
  7237.  
  7238. if ( value !== undefined ) {
  7239. if ( value === null ) {
  7240. jQuery.removeAttr( elem, name );
  7241. return;
  7242. }
  7243.  
  7244. if ( hooks && "set" in hooks &&
  7245. ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
  7246. return ret;
  7247. }
  7248.  
  7249. elem.setAttribute( name, value + "" );
  7250. return value;
  7251. }
  7252.  
  7253. if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
  7254. return ret;
  7255. }
  7256.  
  7257. ret = jQuery.find.attr( elem, name );
  7258.  
  7259. // Non-existent attributes return null, we normalize to undefined
  7260. return ret == null ? undefined : ret;
  7261. },
  7262.  
  7263. attrHooks: {
  7264. type: {
  7265. set: function( elem, value ) {
  7266. if ( !support.radioValue && value === "radio" &&
  7267. nodeName( elem, "input" ) ) {
  7268. var val = elem.value;
  7269. elem.setAttribute( "type", value );
  7270. if ( val ) {
  7271. elem.value = val;
  7272. }
  7273. return value;
  7274. }
  7275. }
  7276. }
  7277. },
  7278.  
  7279. removeAttr: function( elem, value ) {
  7280. var name,
  7281. i = 0,
  7282.  
  7283. // Attribute names can contain non-HTML whitespace characters
  7284. // https://html.spec.whatwg.org/multipage/syntax.html#attributes-2
  7285. attrNames = value && value.match( rnothtmlwhite );
  7286.  
  7287. if ( attrNames && elem.nodeType === 1 ) {
  7288. while ( ( name = attrNames[ i++ ] ) ) {
  7289. elem.removeAttribute( name );
  7290. }
  7291. }
  7292. }
  7293. } );
  7294.  
  7295. // Hooks for boolean attributes
  7296. boolHook = {
  7297. set: function( elem, value, name ) {
  7298. if ( value === false ) {
  7299.  
  7300. // Remove boolean attributes when set to false
  7301. jQuery.removeAttr( elem, name );
  7302. } else {
  7303. elem.setAttribute( name, name );
  7304. }
  7305. return name;
  7306. }
  7307. };
  7308.  
  7309. jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( _i, name ) {
  7310. var getter = attrHandle[ name ] || jQuery.find.attr;
  7311.  
  7312. attrHandle[ name ] = function( elem, name, isXML ) {
  7313. var ret, handle,
  7314. lowercaseName = name.toLowerCase();
  7315.  
  7316. if ( !isXML ) {
  7317.  
  7318. // Avoid an infinite loop by temporarily removing this function from the getter
  7319. handle = attrHandle[ lowercaseName ];
  7320. attrHandle[ lowercaseName ] = ret;
  7321. ret = getter( elem, name, isXML ) != null ?
  7322. lowercaseName :
  7323. null;
  7324. attrHandle[ lowercaseName ] = handle;
  7325. }
  7326. return ret;
  7327. };
  7328. } );
  7329.  
  7330.  
  7331.  
  7332.  
  7333. var rfocusable = /^(?:input|select|textarea|button)$/i,
  7334. rclickable = /^(?:a|area)$/i;
  7335.  
  7336. jQuery.fn.extend( {
  7337. prop: function( name, value ) {
  7338. return access( this, jQuery.prop, name, value, arguments.length > 1 );
  7339. },
  7340.  
  7341. removeProp: function( name ) {
  7342. return this.each( function() {
  7343. delete this[ jQuery.propFix[ name ] || name ];
  7344. } );
  7345. }
  7346. } );
  7347.  
  7348. jQuery.extend( {
  7349. prop: function( elem, name, value ) {
  7350. var ret, hooks,
  7351. nType = elem.nodeType;
  7352.  
  7353. // Don't get/set properties on text, comment and attribute nodes
  7354. if ( nType === 3 || nType === 8 || nType === 2 ) {
  7355. return;
  7356. }
  7357.  
  7358. if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
  7359.  
  7360. // Fix name and attach hooks
  7361. name = jQuery.propFix[ name ] || name;
  7362. hooks = jQuery.propHooks[ name ];
  7363. }
  7364.  
  7365. if ( value !== undefined ) {
  7366. if ( hooks && "set" in hooks &&
  7367. ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
  7368. return ret;
  7369. }
  7370.  
  7371. return ( elem[ name ] = value );
  7372. }
  7373.  
  7374. if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
  7375. return ret;
  7376. }
  7377.  
  7378. return elem[ name ];
  7379. },
  7380.  
  7381. propHooks: {
  7382. tabIndex: {
  7383. get: function( elem ) {
  7384.  
  7385. // Support: IE <=9 - 11 only
  7386. // elem.tabIndex doesn't always return the
  7387. // correct value when it hasn't been explicitly set
  7388. // Use proper attribute retrieval (trac-12072)
  7389. var tabindex = jQuery.find.attr( elem, "tabindex" );
  7390.  
  7391. if ( tabindex ) {
  7392. return parseInt( tabindex, 10 );
  7393. }
  7394.  
  7395. if (
  7396. rfocusable.test( elem.nodeName ) ||
  7397. rclickable.test( elem.nodeName ) &&
  7398. elem.href
  7399. ) {
  7400. return 0;
  7401. }
  7402.  
  7403. return -1;
  7404. }
  7405. }
  7406. },
  7407.  
  7408. propFix: {
  7409. "for": "htmlFor",
  7410. "class": "className"
  7411. }
  7412. } );
  7413.  
  7414. // Support: IE <=11 only
  7415. // Accessing the selectedIndex property
  7416. // forces the browser to respect setting selected
  7417. // on the option
  7418. // The getter ensures a default option is selected
  7419. // when in an optgroup
  7420. // eslint rule "no-unused-expressions" is disabled for this code
  7421. // since it considers such accessions noop
  7422. if ( !support.optSelected ) {
  7423. jQuery.propHooks.selected = {
  7424. get: function( elem ) {
  7425.  
  7426. /* eslint no-unused-expressions: "off" */
  7427.  
  7428. var parent = elem.parentNode;
  7429. if ( parent && parent.parentNode ) {
  7430. parent.parentNode.selectedIndex;
  7431. }
  7432. return null;
  7433. },
  7434. set: function( elem ) {
  7435.  
  7436. /* eslint no-unused-expressions: "off" */
  7437.  
  7438. var parent = elem.parentNode;
  7439. if ( parent ) {
  7440. parent.selectedIndex;
  7441.  
  7442. if ( parent.parentNode ) {
  7443. parent.parentNode.selectedIndex;
  7444. }
  7445. }
  7446. }
  7447. };
  7448. }
  7449.  
  7450. jQuery.each( [
  7451. "tabIndex",
  7452. "readOnly",
  7453. "maxLength",
  7454. "cellSpacing",
  7455. "cellPadding",
  7456. "rowSpan",
  7457. "colSpan",
  7458. "useMap",
  7459. "frameBorder",
  7460. "contentEditable"
  7461. ], function() {
  7462. jQuery.propFix[ this.toLowerCase() ] = this;
  7463. } );
  7464.  
  7465.  
  7466.  
  7467.  
  7468. // Strip and collapse whitespace according to HTML spec
  7469. // https://infra.spec.whatwg.org/#strip-and-collapse-ascii-whitespace
  7470. function stripAndCollapse( value ) {
  7471. var tokens = value.match( rnothtmlwhite ) || [];
  7472. return tokens.join( " " );
  7473. }
  7474.  
  7475.  
  7476. function getClass( elem ) {
  7477. return elem.getAttribute && elem.getAttribute( "class" ) || "";
  7478. }
  7479.  
  7480. function classesToArray( value ) {
  7481. if ( Array.isArray( value ) ) {
  7482. return value;
  7483. }
  7484. if ( typeof value === "string" ) {
  7485. return value.match( rnothtmlwhite ) || [];
  7486. }
  7487. return [];
  7488. }
  7489.  
  7490. jQuery.fn.extend( {
  7491. addClass: function( value ) {
  7492. var classNames, cur, curValue, className, i, finalValue;
  7493.  
  7494. if ( isFunction( value ) ) {
  7495. return this.each( function( j ) {
  7496. jQuery( this ).addClass( value.call( this, j, getClass( this ) ) );
  7497. } );
  7498. }
  7499.  
  7500. classNames = classesToArray( value );
  7501.  
  7502. if ( classNames.length ) {
  7503. return this.each( function() {
  7504. curValue = getClass( this );
  7505. cur = this.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
  7506.  
  7507. if ( cur ) {
  7508. for ( i = 0; i < classNames.length; i++ ) {
  7509. className = classNames[ i ];
  7510. if ( cur.indexOf( " " + className + " " ) < 0 ) {
  7511. cur += className + " ";
  7512. }
  7513. }
  7514.  
  7515. // Only assign if different to avoid unneeded rendering.
  7516. finalValue = stripAndCollapse( cur );
  7517. if ( curValue !== finalValue ) {
  7518. this.setAttribute( "class", finalValue );
  7519. }
  7520. }
  7521. } );
  7522. }
  7523.  
  7524. return this;
  7525. },
  7526.  
  7527. removeClass: function( value ) {
  7528. var classNames, cur, curValue, className, i, finalValue;
  7529.  
  7530. if ( isFunction( value ) ) {
  7531. return this.each( function( j ) {
  7532. jQuery( this ).removeClass( value.call( this, j, getClass( this ) ) );
  7533. } );
  7534. }
  7535.  
  7536. if ( !arguments.length ) {
  7537. return this.attr( "class", "" );
  7538. }
  7539.  
  7540. classNames = classesToArray( value );
  7541.  
  7542. if ( classNames.length ) {
  7543. return this.each( function() {
  7544. curValue = getClass( this );
  7545.  
  7546. // This expression is here for better compressibility (see addClass)
  7547. cur = this.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
  7548.  
  7549. if ( cur ) {
  7550. for ( i = 0; i < classNames.length; i++ ) {
  7551. className = classNames[ i ];
  7552.  
  7553. // Remove *all* instances
  7554. while ( cur.indexOf( " " + className + " " ) > -1 ) {
  7555. cur = cur.replace( " " + className + " ", " " );
  7556. }
  7557. }
  7558.  
  7559. // Only assign if different to avoid unneeded rendering.
  7560. finalValue = stripAndCollapse( cur );
  7561. if ( curValue !== finalValue ) {
  7562. this.setAttribute( "class", finalValue );
  7563. }
  7564. }
  7565. } );
  7566. }
  7567.  
  7568. return this;
  7569. },
  7570.  
  7571. toggleClass: function( value, stateVal ) {
  7572. var classNames, className, i, self,
  7573. type = typeof value,
  7574. isValidValue = type === "string" || Array.isArray( value );
  7575.  
  7576. if ( isFunction( value ) ) {
  7577. return this.each( function( i ) {
  7578. jQuery( this ).toggleClass(
  7579. value.call( this, i, getClass( this ), stateVal ),
  7580. stateVal
  7581. );
  7582. } );
  7583. }
  7584.  
  7585. if ( typeof stateVal === "boolean" && isValidValue ) {
  7586. return stateVal ? this.addClass( value ) : this.removeClass( value );
  7587. }
  7588.  
  7589. classNames = classesToArray( value );
  7590.  
  7591. return this.each( function() {
  7592. if ( isValidValue ) {
  7593.  
  7594. // Toggle individual class names
  7595. self = jQuery( this );
  7596.  
  7597. for ( i = 0; i < classNames.length; i++ ) {
  7598. className = classNames[ i ];
  7599.  
  7600. // Check each className given, space separated list
  7601. if ( self.hasClass( className ) ) {
  7602. self.removeClass( className );
  7603. } else {
  7604. self.addClass( className );
  7605. }
  7606. }
  7607.  
  7608. // Toggle whole class name
  7609. } else if ( value === undefined || type === "boolean" ) {
  7610. className = getClass( this );
  7611. if ( className ) {
  7612.  
  7613. // Store className if set
  7614. dataPriv.set( this, "__className__", className );
  7615. }
  7616.  
  7617. // If the element has a class name or if we're passed `false`,
  7618. // then remove the whole classname (if there was one, the above saved it).
  7619. // Otherwise bring back whatever was previously saved (if anything),
  7620. // falling back to the empty string if nothing was stored.
  7621. if ( this.setAttribute ) {
  7622. this.setAttribute( "class",
  7623. className || value === false ?
  7624. "" :
  7625. dataPriv.get( this, "__className__" ) || ""
  7626. );
  7627. }
  7628. }
  7629. } );
  7630. },
  7631.  
  7632. hasClass: function( selector ) {
  7633. var className, elem,
  7634. i = 0;
  7635.  
  7636. className = " " + selector + " ";
  7637. while ( ( elem = this[ i++ ] ) ) {
  7638. if ( elem.nodeType === 1 &&
  7639. ( " " + stripAndCollapse( getClass( elem ) ) + " " ).indexOf( className ) > -1 ) {
  7640. return true;
  7641. }
  7642. }
  7643.  
  7644. return false;
  7645. }
  7646. } );
  7647.  
  7648.  
  7649.  
  7650.  
  7651. var rreturn = /\r/g;
  7652.  
  7653. jQuery.fn.extend( {
  7654. val: function( value ) {
  7655. var hooks, ret, valueIsFunction,
  7656. elem = this[ 0 ];
  7657.  
  7658. if ( !arguments.length ) {
  7659. if ( elem ) {
  7660. hooks = jQuery.valHooks[ elem.type ] ||
  7661. jQuery.valHooks[ elem.nodeName.toLowerCase() ];
  7662.  
  7663. if ( hooks &&
  7664. "get" in hooks &&
  7665. ( ret = hooks.get( elem, "value" ) ) !== undefined
  7666. ) {
  7667. return ret;
  7668. }
  7669.  
  7670. ret = elem.value;
  7671.  
  7672. // Handle most common string cases
  7673. if ( typeof ret === "string" ) {
  7674. return ret.replace( rreturn, "" );
  7675. }
  7676.  
  7677. // Handle cases where value is null/undef or number
  7678. return ret == null ? "" : ret;
  7679. }
  7680.  
  7681. return;
  7682. }
  7683.  
  7684. valueIsFunction = isFunction( value );
  7685.  
  7686. return this.each( function( i ) {
  7687. var val;
  7688.  
  7689. if ( this.nodeType !== 1 ) {
  7690. return;
  7691. }
  7692.  
  7693. if ( valueIsFunction ) {
  7694. val = value.call( this, i, jQuery( this ).val() );
  7695. } else {
  7696. val = value;
  7697. }
  7698.  
  7699. // Treat null/undefined as ""; convert numbers to string
  7700. if ( val == null ) {
  7701. val = "";
  7702.  
  7703. } else if ( typeof val === "number" ) {
  7704. val += "";
  7705.  
  7706. } else if ( Array.isArray( val ) ) {
  7707. val = jQuery.map( val, function( value ) {
  7708. return value == null ? "" : value + "";
  7709. } );
  7710. }
  7711.  
  7712. hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ];
  7713.  
  7714. // If set returns undefined, fall back to normal setting
  7715. if ( !hooks || !( "set" in hooks ) || hooks.set( this, val, "value" ) === undefined ) {
  7716. this.value = val;
  7717. }
  7718. } );
  7719. }
  7720. } );
  7721.  
  7722. jQuery.extend( {
  7723. valHooks: {
  7724. option: {
  7725. get: function( elem ) {
  7726.  
  7727. var val = jQuery.find.attr( elem, "value" );
  7728. return val != null ?
  7729. val :
  7730.  
  7731. // Support: IE <=10 - 11 only
  7732. // option.text throws exceptions (trac-14686, trac-14858)
  7733. // Strip and collapse whitespace
  7734. // https://html.spec.whatwg.org/#strip-and-collapse-whitespace
  7735. stripAndCollapse( jQuery.text( elem ) );
  7736. }
  7737. },
  7738. select: {
  7739. get: function( elem ) {
  7740. var value, option, i,
  7741. options = elem.options,
  7742. index = elem.selectedIndex,
  7743. one = elem.type === "select-one",
  7744. values = one ? null : [],
  7745. max = one ? index + 1 : options.length;
  7746.  
  7747. if ( index < 0 ) {
  7748. i = max;
  7749.  
  7750. } else {
  7751. i = one ? index : 0;
  7752. }
  7753.  
  7754. // Loop through all the selected options
  7755. for ( ; i < max; i++ ) {
  7756. option = options[ i ];
  7757.  
  7758. // Support: IE <=9 only
  7759. // IE8-9 doesn't update selected after form reset (trac-2551)
  7760. if ( ( option.selected || i === index ) &&
  7761.  
  7762. // Don't return options that are disabled or in a disabled optgroup
  7763. !option.disabled &&
  7764. ( !option.parentNode.disabled ||
  7765. !nodeName( option.parentNode, "optgroup" ) ) ) {
  7766.  
  7767. // Get the specific value for the option
  7768. value = jQuery( option ).val();
  7769.  
  7770. // We don't need an array for one selects
  7771. if ( one ) {
  7772. return value;
  7773. }
  7774.  
  7775. // Multi-Selects return an array
  7776. values.push( value );
  7777. }
  7778. }
  7779.  
  7780. return values;
  7781. },
  7782.  
  7783. set: function( elem, value ) {
  7784. var optionSet, option,
  7785. options = elem.options,
  7786. values = jQuery.makeArray( value ),
  7787. i = options.length;
  7788.  
  7789. while ( i-- ) {
  7790. option = options[ i ];
  7791.  
  7792. /* eslint-disable no-cond-assign */
  7793.  
  7794. if ( option.selected =
  7795. jQuery.inArray( jQuery.valHooks.option.get( option ), values ) > -1
  7796. ) {
  7797. optionSet = true;
  7798. }
  7799.  
  7800. /* eslint-enable no-cond-assign */
  7801. }
  7802.  
  7803. // Force browsers to behave consistently when non-matching value is set
  7804. if ( !optionSet ) {
  7805. elem.selectedIndex = -1;
  7806. }
  7807. return values;
  7808. }
  7809. }
  7810. }
  7811. } );
  7812.  
  7813. // Radios and checkboxes getter/setter
  7814. jQuery.each( [ "radio", "checkbox" ], function() {
  7815. jQuery.valHooks[ this ] = {
  7816. set: function( elem, value ) {
  7817. if ( Array.isArray( value ) ) {
  7818. return ( elem.checked = jQuery.inArray( jQuery( elem ).val(), value ) > -1 );
  7819. }
  7820. }
  7821. };
  7822. if ( !support.checkOn ) {
  7823. jQuery.valHooks[ this ].get = function( elem ) {
  7824. return elem.getAttribute( "value" ) === null ? "on" : elem.value;
  7825. };
  7826. }
  7827. } );
  7828.  
  7829.  
  7830.  
  7831.  
  7832. // Return jQuery for attributes-only inclusion
  7833.  
  7834.  
  7835. // Cross-browser xml parsing
  7836. jQuery.parseXML = function( data ) {
  7837. var xml, parserErrorElem;
  7838. if ( !data || typeof data !== "string" ) {
  7839. return null;
  7840. }
  7841.  
  7842. // Support: IE 9 - 11 only
  7843. // IE throws on parseFromString with invalid input.
  7844. try {
  7845. xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" );
  7846. } catch ( e ) {}
  7847.  
  7848. parserErrorElem = xml && xml.getElementsByTagName( "parsererror" )[ 0 ];
  7849. if ( !xml || parserErrorElem ) {
  7850. jQuery.error( "Invalid XML: " + (
  7851. parserErrorElem ?
  7852. jQuery.map( parserErrorElem.childNodes, function( el ) {
  7853. return el.textContent;
  7854. } ).join( "\n" ) :
  7855. data
  7856. ) );
  7857. }
  7858. return xml;
  7859. };
  7860.  
  7861.  
  7862. var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
  7863. stopPropagationCallback = function( e ) {
  7864. e.stopPropagation();
  7865. };
  7866.  
  7867. jQuery.extend( jQuery.event, {
  7868.  
  7869. trigger: function( event, data, elem, onlyHandlers ) {
  7870.  
  7871. var i, cur, tmp, bubbleType, ontype, handle, special, lastElement,
  7872. eventPath = [ elem || document ],
  7873. type = hasOwn.call( event, "type" ) ? event.type : event,
  7874. namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split( "." ) : [];
  7875.  
  7876. cur = lastElement = tmp = elem = elem || document;
  7877.  
  7878. // Don't do events on text and comment nodes
  7879. if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
  7880. return;
  7881. }
  7882.  
  7883. // focus/blur morphs to focusin/out; ensure we're not firing them right now
  7884. if ( rfocusMorph.test( type + jQuery.event.triggered ) ) {
  7885. return;
  7886. }
  7887.  
  7888. if ( type.indexOf( "." ) > -1 ) {
  7889.  
  7890. // Namespaced trigger; create a regexp to match event type in handle()
  7891. namespaces = type.split( "." );
  7892. type = namespaces.shift();
  7893. namespaces.sort();
  7894. }
  7895. ontype = type.indexOf( ":" ) < 0 && "on" + type;
  7896.  
  7897. // Caller can pass in a jQuery.Event object, Object, or just an event type string
  7898. event = event[ jQuery.expando ] ?
  7899. event :
  7900. new jQuery.Event( type, typeof event === "object" && event );
  7901.  
  7902. // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true)
  7903. event.isTrigger = onlyHandlers ? 2 : 3;
  7904. event.namespace = namespaces.join( "." );
  7905. event.rnamespace = event.namespace ?
  7906. new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ) :
  7907. null;
  7908.  
  7909. // Clean up the event in case it is being reused
  7910. event.result = undefined;
  7911. if ( !event.target ) {
  7912. event.target = elem;
  7913. }
  7914.  
  7915. // Clone any incoming data and prepend the event, creating the handler arg list
  7916. data = data == null ?
  7917. [ event ] :
  7918. jQuery.makeArray( data, [ event ] );
  7919.  
  7920. // Allow special events to draw outside the lines
  7921. special = jQuery.event.special[ type ] || {};
  7922. if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) {
  7923. return;
  7924. }
  7925.  
  7926. // Determine event propagation path in advance, per W3C events spec (trac-9951)
  7927. // Bubble up to document, then to window; watch for a global ownerDocument var (trac-9724)
  7928. if ( !onlyHandlers && !special.noBubble && !isWindow( elem ) ) {
  7929.  
  7930. bubbleType = special.delegateType || type;
  7931. if ( !rfocusMorph.test( bubbleType + type ) ) {
  7932. cur = cur.parentNode;
  7933. }
  7934. for ( ; cur; cur = cur.parentNode ) {
  7935. eventPath.push( cur );
  7936. tmp = cur;
  7937. }
  7938.  
  7939. // Only add window if we got to document (e.g., not plain obj or detached DOM)
  7940. if ( tmp === ( elem.ownerDocument || document ) ) {
  7941. eventPath.push( tmp.defaultView || tmp.parentWindow || window );
  7942. }
  7943. }
  7944.  
  7945. // Fire handlers on the event path
  7946. i = 0;
  7947. while ( ( cur = eventPath[ i++ ] ) && !event.isPropagationStopped() ) {
  7948. lastElement = cur;
  7949. event.type = i > 1 ?
  7950. bubbleType :
  7951. special.bindType || type;
  7952.  
  7953. // jQuery handler
  7954. handle = ( dataPriv.get( cur, "events" ) || Object.create( null ) )[ event.type ] &&
  7955. dataPriv.get( cur, "handle" );
  7956. if ( handle ) {
  7957. handle.apply( cur, data );
  7958. }
  7959.  
  7960. // Native handler
  7961. handle = ontype && cur[ ontype ];
  7962. if ( handle && handle.apply && acceptData( cur ) ) {
  7963. event.result = handle.apply( cur, data );
  7964. if ( event.result === false ) {
  7965. event.preventDefault();
  7966. }
  7967. }
  7968. }
  7969. event.type = type;
  7970.  
  7971. // If nobody prevented the default action, do it now
  7972. if ( !onlyHandlers && !event.isDefaultPrevented() ) {
  7973.  
  7974. if ( ( !special._default ||
  7975. special._default.apply( eventPath.pop(), data ) === false ) &&
  7976. acceptData( elem ) ) {
  7977.  
  7978. // Call a native DOM method on the target with the same name as the event.
  7979. // Don't do default actions on window, that's where global variables be (trac-6170)
  7980. if ( ontype && isFunction( elem[ type ] ) && !isWindow( elem ) ) {
  7981.  
  7982. // Don't re-trigger an onFOO event when we call its FOO() method
  7983. tmp = elem[ ontype ];
  7984.  
  7985. if ( tmp ) {
  7986. elem[ ontype ] = null;
  7987. }
  7988.  
  7989. // Prevent re-triggering of the same event, since we already bubbled it above
  7990. jQuery.event.triggered = type;
  7991.  
  7992. if ( event.isPropagationStopped() ) {
  7993. lastElement.addEventListener( type, stopPropagationCallback );
  7994. }
  7995.  
  7996. elem[ type ]();
  7997.  
  7998. if ( event.isPropagationStopped() ) {
  7999. lastElement.removeEventListener( type, stopPropagationCallback );
  8000. }
  8001.  
  8002. jQuery.event.triggered = undefined;
  8003.  
  8004. if ( tmp ) {
  8005. elem[ ontype ] = tmp;
  8006. }
  8007. }
  8008. }
  8009. }
  8010.  
  8011. return event.result;
  8012. },
  8013.  
  8014. // Piggyback on a donor event to simulate a different one
  8015. // Used only for `focus(in | out)` events
  8016. simulate: function( type, elem, event ) {
  8017. var e = jQuery.extend(
  8018. new jQuery.Event(),
  8019. event,
  8020. {
  8021. type: type,
  8022. isSimulated: true
  8023. }
  8024. );
  8025.  
  8026. jQuery.event.trigger( e, null, elem );
  8027. }
  8028.  
  8029. } );
  8030.  
  8031. jQuery.fn.extend( {
  8032.  
  8033. trigger: function( type, data ) {
  8034. return this.each( function() {
  8035. jQuery.event.trigger( type, data, this );
  8036. } );
  8037. },
  8038. triggerHandler: function( type, data ) {
  8039. var elem = this[ 0 ];
  8040. if ( elem ) {
  8041. return jQuery.event.trigger( type, data, elem, true );
  8042. }
  8043. }
  8044. } );
  8045.  
  8046.  
  8047. var
  8048. rbracket = /\[\]$/,
  8049. rCRLF = /\r?\n/g,
  8050. rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i,
  8051. rsubmittable = /^(?:input|select|textarea|keygen)/i;
  8052.  
  8053. function buildParams( prefix, obj, traditional, add ) {
  8054. var name;
  8055.  
  8056. if ( Array.isArray( obj ) ) {
  8057.  
  8058. // Serialize array item.
  8059. jQuery.each( obj, function( i, v ) {
  8060. if ( traditional || rbracket.test( prefix ) ) {
  8061.  
  8062. // Treat each array item as a scalar.
  8063. add( prefix, v );
  8064.  
  8065. } else {
  8066.  
  8067. // Item is non-scalar (array or object), encode its numeric index.
  8068. buildParams(
  8069. prefix + "[" + ( typeof v === "object" && v != null ? i : "" ) + "]",
  8070. v,
  8071. traditional,
  8072. add
  8073. );
  8074. }
  8075. } );
  8076.  
  8077. } else if ( !traditional && toType( obj ) === "object" ) {
  8078.  
  8079. // Serialize object item.
  8080. for ( name in obj ) {
  8081. buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
  8082. }
  8083.  
  8084. } else {
  8085.  
  8086. // Serialize scalar item.
  8087. add( prefix, obj );
  8088. }
  8089. }
  8090.  
  8091. // Serialize an array of form elements or a set of
  8092. // key/values into a query string
  8093. jQuery.param = function( a, traditional ) {
  8094. var prefix,
  8095. s = [],
  8096. add = function( key, valueOrFunction ) {
  8097.  
  8098. // If value is a function, invoke it and use its return value
  8099. var value = isFunction( valueOrFunction ) ?
  8100. valueOrFunction() :
  8101. valueOrFunction;
  8102.  
  8103. s[ s.length ] = encodeURIComponent( key ) + "=" +
  8104. encodeURIComponent( value == null ? "" : value );
  8105. };
  8106.  
  8107. if ( a == null ) {
  8108. return "";
  8109. }
  8110.  
  8111. // If an array was passed in, assume that it is an array of form elements.
  8112. if ( Array.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {
  8113.  
  8114. // Serialize the form elements
  8115. jQuery.each( a, function() {
  8116. add( this.name, this.value );
  8117. } );
  8118.  
  8119. } else {
  8120.  
  8121. // If traditional, encode the "old" way (the way 1.3.2 or older
  8122. // did it), otherwise encode params recursively.
  8123. for ( prefix in a ) {
  8124. buildParams( prefix, a[ prefix ], traditional, add );
  8125. }
  8126. }
  8127.  
  8128. // Return the resulting serialization
  8129. return s.join( "&" );
  8130. };
  8131.  
  8132. jQuery.fn.extend( {
  8133. serialize: function() {
  8134. return jQuery.param( this.serializeArray() );
  8135. },
  8136. serializeArray: function() {
  8137. return this.map( function() {
  8138.  
  8139. // Can add propHook for "elements" to filter or add form elements
  8140. var elements = jQuery.prop( this, "elements" );
  8141. return elements ? jQuery.makeArray( elements ) : this;
  8142. } ).filter( function() {
  8143. var type = this.type;
  8144.  
  8145. // Use .is( ":disabled" ) so that fieldset[disabled] works
  8146. return this.name && !jQuery( this ).is( ":disabled" ) &&
  8147. rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) &&
  8148. ( this.checked || !rcheckableType.test( type ) );
  8149. } ).map( function( _i, elem ) {
  8150. var val = jQuery( this ).val();
  8151.  
  8152. if ( val == null ) {
  8153. return null;
  8154. }
  8155.  
  8156. if ( Array.isArray( val ) ) {
  8157. return jQuery.map( val, function( val ) {
  8158. return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
  8159. } );
  8160. }
  8161.  
  8162. return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
  8163. } ).get();
  8164. }
  8165. } );
  8166.  
  8167.  
  8168. jQuery.fn.extend( {
  8169. wrapAll: function( html ) {
  8170. var wrap;
  8171.  
  8172. if ( this[ 0 ] ) {
  8173. if ( isFunction( html ) ) {
  8174. html = html.call( this[ 0 ] );
  8175. }
  8176.  
  8177. // The elements to wrap the target around
  8178. wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true );
  8179.  
  8180. if ( this[ 0 ].parentNode ) {
  8181. wrap.insertBefore( this[ 0 ] );
  8182. }
  8183.  
  8184. wrap.map( function() {
  8185. var elem = this;
  8186.  
  8187. while ( elem.firstElementChild ) {
  8188. elem = elem.firstElementChild;
  8189. }
  8190.  
  8191. return elem;
  8192. } ).append( this );
  8193. }
  8194.  
  8195. return this;
  8196. },
  8197.  
  8198. wrapInner: function( html ) {
  8199. if ( isFunction( html ) ) {
  8200. return this.each( function( i ) {
  8201. jQuery( this ).wrapInner( html.call( this, i ) );
  8202. } );
  8203. }
  8204.  
  8205. return this.each( function() {
  8206. var self = jQuery( this ),
  8207. contents = self.contents();
  8208.  
  8209. if ( contents.length ) {
  8210. contents.wrapAll( html );
  8211.  
  8212. } else {
  8213. self.append( html );
  8214. }
  8215. } );
  8216. },
  8217.  
  8218. wrap: function( html ) {
  8219. var htmlIsFunction = isFunction( html );
  8220.  
  8221. return this.each( function( i ) {
  8222. jQuery( this ).wrapAll( htmlIsFunction ? html.call( this, i ) : html );
  8223. } );
  8224. },
  8225.  
  8226. unwrap: function( selector ) {
  8227. this.parent( selector ).not( "body" ).each( function() {
  8228. jQuery( this ).replaceWith( this.childNodes );
  8229. } );
  8230. return this;
  8231. }
  8232. } );
  8233.  
  8234.  
  8235. jQuery.expr.pseudos.hidden = function( elem ) {
  8236. return !jQuery.expr.pseudos.visible( elem );
  8237. };
  8238. jQuery.expr.pseudos.visible = function( elem ) {
  8239. return !!( elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length );
  8240. };
  8241.  
  8242.  
  8243.  
  8244.  
  8245. // Support: Safari 8 only
  8246. // In Safari 8 documents created via document.implementation.createHTMLDocument
  8247. // collapse sibling forms: the second one becomes a child of the first one.
  8248. // Because of that, this security measure has to be disabled in Safari 8.
  8249. // https://bugs.webkit.org/show_bug.cgi?id=137337
  8250. support.createHTMLDocument = ( function() {
  8251. var body = document.implementation.createHTMLDocument( "" ).body;
  8252. body.innerHTML = "<form></form><form></form>";
  8253. return body.childNodes.length === 2;
  8254. } )();
  8255.  
  8256.  
  8257. // Argument "data" should be string of html
  8258. // context (optional): If specified, the fragment will be created in this context,
  8259. // defaults to document
  8260. // keepScripts (optional): If true, will include scripts passed in the html string
  8261. jQuery.parseHTML = function( data, context, keepScripts ) {
  8262. if ( typeof data !== "string" ) {
  8263. return [];
  8264. }
  8265. if ( typeof context === "boolean" ) {
  8266. keepScripts = context;
  8267. context = false;
  8268. }
  8269.  
  8270. var base, parsed, scripts;
  8271.  
  8272. if ( !context ) {
  8273.  
  8274. // Stop scripts or inline event handlers from being executed immediately
  8275. // by using document.implementation
  8276. if ( support.createHTMLDocument ) {
  8277. context = document.implementation.createHTMLDocument( "" );
  8278.  
  8279. // Set the base href for the created document
  8280. // so any parsed elements with URLs
  8281. // are based on the document's URL (gh-2965)
  8282. base = context.createElement( "base" );
  8283. base.href = document.location.href;
  8284. context.head.appendChild( base );
  8285. } else {
  8286. context = document;
  8287. }
  8288. }
  8289.  
  8290. parsed = rsingleTag.exec( data );
  8291. scripts = !keepScripts && [];
  8292.  
  8293. // Single tag
  8294. if ( parsed ) {
  8295. return [ context.createElement( parsed[ 1 ] ) ];
  8296. }
  8297.  
  8298. parsed = buildFragment( [ data ], context, scripts );
  8299.  
  8300. if ( scripts && scripts.length ) {
  8301. jQuery( scripts ).remove();
  8302. }
  8303.  
  8304. return jQuery.merge( [], parsed.childNodes );
  8305. };
  8306.  
  8307.  
  8308. jQuery.offset = {
  8309. setOffset: function( elem, options, i ) {
  8310. var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition,
  8311. position = jQuery.css( elem, "position" ),
  8312. curElem = jQuery( elem ),
  8313. props = {};
  8314.  
  8315. // Set position first, in-case top/left are set even on static elem
  8316. if ( position === "static" ) {
  8317. elem.style.position = "relative";
  8318. }
  8319.  
  8320. curOffset = curElem.offset();
  8321. curCSSTop = jQuery.css( elem, "top" );
  8322. curCSSLeft = jQuery.css( elem, "left" );
  8323. calculatePosition = ( position === "absolute" || position === "fixed" ) &&
  8324. ( curCSSTop + curCSSLeft ).indexOf( "auto" ) > -1;
  8325.  
  8326. // Need to be able to calculate position if either
  8327. // top or left is auto and position is either absolute or fixed
  8328. if ( calculatePosition ) {
  8329. curPosition = curElem.position();
  8330. curTop = curPosition.top;
  8331. curLeft = curPosition.left;
  8332.  
  8333. } else {
  8334. curTop = parseFloat( curCSSTop ) || 0;
  8335. curLeft = parseFloat( curCSSLeft ) || 0;
  8336. }
  8337.  
  8338. if ( isFunction( options ) ) {
  8339.  
  8340. // Use jQuery.extend here to allow modification of coordinates argument (gh-1848)
  8341. options = options.call( elem, i, jQuery.extend( {}, curOffset ) );
  8342. }
  8343.  
  8344. if ( options.top != null ) {
  8345. props.top = ( options.top - curOffset.top ) + curTop;
  8346. }
  8347. if ( options.left != null ) {
  8348. props.left = ( options.left - curOffset.left ) + curLeft;
  8349. }
  8350.  
  8351. if ( "using" in options ) {
  8352. options.using.call( elem, props );
  8353.  
  8354. } else {
  8355. curElem.css( props );
  8356. }
  8357. }
  8358. };
  8359.  
  8360. jQuery.fn.extend( {
  8361.  
  8362. // offset() relates an element's border box to the document origin
  8363. offset: function( options ) {
  8364.  
  8365. // Preserve chaining for setter
  8366. if ( arguments.length ) {
  8367. return options === undefined ?
  8368. this :
  8369. this.each( function( i ) {
  8370. jQuery.offset.setOffset( this, options, i );
  8371. } );
  8372. }
  8373.  
  8374. var rect, win,
  8375. elem = this[ 0 ];
  8376.  
  8377. if ( !elem ) {
  8378. return;
  8379. }
  8380.  
  8381. // Return zeros for disconnected and hidden (display: none) elements (gh-2310)
  8382. // Support: IE <=11 only
  8383. // Running getBoundingClientRect on a
  8384. // disconnected node in IE throws an error
  8385. if ( !elem.getClientRects().length ) {
  8386. return { top: 0, left: 0 };
  8387. }
  8388.  
  8389. // Get document-relative position by adding viewport scroll to viewport-relative gBCR
  8390. rect = elem.getBoundingClientRect();
  8391. win = elem.ownerDocument.defaultView;
  8392. return {
  8393. top: rect.top + win.pageYOffset,
  8394. left: rect.left + win.pageXOffset
  8395. };
  8396. },
  8397.  
  8398. // position() relates an element's margin box to its offset parent's padding box
  8399. // This corresponds to the behavior of CSS absolute positioning
  8400. position: function() {
  8401. if ( !this[ 0 ] ) {
  8402. return;
  8403. }
  8404.  
  8405. var offsetParent, offset, doc,
  8406. elem = this[ 0 ],
  8407. parentOffset = { top: 0, left: 0 };
  8408.  
  8409. // position:fixed elements are offset from the viewport, which itself always has zero offset
  8410. if ( jQuery.css( elem, "position" ) === "fixed" ) {
  8411.  
  8412. // Assume position:fixed implies availability of getBoundingClientRect
  8413. offset = elem.getBoundingClientRect();
  8414.  
  8415. } else {
  8416. offset = this.offset();
  8417.  
  8418. // Account for the *real* offset parent, which can be the document or its root element
  8419. // when a statically positioned element is identified
  8420. doc = elem.ownerDocument;
  8421. offsetParent = elem.offsetParent || doc.documentElement;
  8422. while ( offsetParent &&
  8423. ( offsetParent === doc.body || offsetParent === doc.documentElement ) &&
  8424. jQuery.css( offsetParent, "position" ) === "static" ) {
  8425.  
  8426. offsetParent = offsetParent.parentNode;
  8427. }
  8428. if ( offsetParent && offsetParent !== elem && offsetParent.nodeType === 1 ) {
  8429.  
  8430. // Incorporate borders into its offset, since they are outside its content origin
  8431. parentOffset = jQuery( offsetParent ).offset();
  8432. parentOffset.top += jQuery.css( offsetParent, "borderTopWidth", true );
  8433. parentOffset.left += jQuery.css( offsetParent, "borderLeftWidth", true );
  8434. }
  8435. }
  8436.  
  8437. // Subtract parent offsets and element margins
  8438. return {
  8439. top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ),
  8440. left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true )
  8441. };
  8442. },
  8443.  
  8444. // This method will return documentElement in the following cases:
  8445. // 1) For the element inside the iframe without offsetParent, this method will return
  8446. // documentElement of the parent window
  8447. // 2) For the hidden or detached element
  8448. // 3) For body or html element, i.e. in case of the html node - it will return itself
  8449. //
  8450. // but those exceptions were never presented as a real life use-cases
  8451. // and might be considered as more preferable results.
  8452. //
  8453. // This logic, however, is not guaranteed and can change at any point in the future
  8454. offsetParent: function() {
  8455. return this.map( function() {
  8456. var offsetParent = this.offsetParent;
  8457.  
  8458. while ( offsetParent && jQuery.css( offsetParent, "position" ) === "static" ) {
  8459. offsetParent = offsetParent.offsetParent;
  8460. }
  8461.  
  8462. return offsetParent || documentElement;
  8463. } );
  8464. }
  8465. } );
  8466.  
  8467. // Create scrollLeft and scrollTop methods
  8468. jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function( method, prop ) {
  8469. var top = "pageYOffset" === prop;
  8470.  
  8471. jQuery.fn[ method ] = function( val ) {
  8472. return access( this, function( elem, method, val ) {
  8473.  
  8474. // Coalesce documents and windows
  8475. var win;
  8476. if ( isWindow( elem ) ) {
  8477. win = elem;
  8478. } else if ( elem.nodeType === 9 ) {
  8479. win = elem.defaultView;
  8480. }
  8481.  
  8482. if ( val === undefined ) {
  8483. return win ? win[ prop ] : elem[ method ];
  8484. }
  8485.  
  8486. if ( win ) {
  8487. win.scrollTo(
  8488. !top ? val : win.pageXOffset,
  8489. top ? val : win.pageYOffset
  8490. );
  8491.  
  8492. } else {
  8493. elem[ method ] = val;
  8494. }
  8495. }, method, val, arguments.length );
  8496. };
  8497. } );
  8498.  
  8499. // Support: Safari <=7 - 9.1, Chrome <=37 - 49
  8500. // Add the top/left cssHooks using jQuery.fn.position
  8501. // Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
  8502. // Blink bug: https://bugs.chromium.org/p/chromium/issues/detail?id=589347
  8503. // getComputedStyle returns percent when specified for top/left/bottom/right;
  8504. // rather than make the css module depend on the offset module, just check for it here
  8505. jQuery.each( [ "top", "left" ], function( _i, prop ) {
  8506. jQuery.cssHooks[ prop ] = addGetHookIf( support.pixelPosition,
  8507. function( elem, computed ) {
  8508. if ( computed ) {
  8509. computed = curCSS( elem, prop );
  8510.  
  8511. // If curCSS returns percentage, fallback to offset
  8512. return rnumnonpx.test( computed ) ?
  8513. jQuery( elem ).position()[ prop ] + "px" :
  8514. computed;
  8515. }
  8516. }
  8517. );
  8518. } );
  8519.  
  8520.  
  8521. // Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
  8522. jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
  8523. jQuery.each( {
  8524. padding: "inner" + name,
  8525. content: type,
  8526. "": "outer" + name
  8527. }, function( defaultExtra, funcName ) {
  8528.  
  8529. // Margin is only for outerHeight, outerWidth
  8530. jQuery.fn[ funcName ] = function( margin, value ) {
  8531. var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ),
  8532. extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" );
  8533.  
  8534. return access( this, function( elem, type, value ) {
  8535. var doc;
  8536.  
  8537. if ( isWindow( elem ) ) {
  8538.  
  8539. // $( window ).outerWidth/Height return w/h including scrollbars (gh-1729)
  8540. return funcName.indexOf( "outer" ) === 0 ?
  8541. elem[ "inner" + name ] :
  8542. elem.document.documentElement[ "client" + name ];
  8543. }
  8544.  
  8545. // Get document width or height
  8546. if ( elem.nodeType === 9 ) {
  8547. doc = elem.documentElement;
  8548.  
  8549. // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height],
  8550. // whichever is greatest
  8551. return Math.max(
  8552. elem.body[ "scroll" + name ], doc[ "scroll" + name ],
  8553. elem.body[ "offset" + name ], doc[ "offset" + name ],
  8554. doc[ "client" + name ]
  8555. );
  8556. }
  8557.  
  8558. return value === undefined ?
  8559.  
  8560. // Get width or height on the element, requesting but not forcing parseFloat
  8561. jQuery.css( elem, type, extra ) :
  8562.  
  8563. // Set width or height on the element
  8564. jQuery.style( elem, type, value, extra );
  8565. }, type, chainable ? margin : undefined, chainable );
  8566. };
  8567. } );
  8568. } );
  8569.  
  8570.  
  8571. jQuery.fn.extend( {
  8572.  
  8573. bind: function( types, data, fn ) {
  8574. return this.on( types, null, data, fn );
  8575. },
  8576. unbind: function( types, fn ) {
  8577. return this.off( types, null, fn );
  8578. },
  8579.  
  8580. delegate: function( selector, types, data, fn ) {
  8581. return this.on( types, selector, data, fn );
  8582. },
  8583. undelegate: function( selector, types, fn ) {
  8584.  
  8585. // ( namespace ) or ( selector, types [, fn] )
  8586. return arguments.length === 1 ?
  8587. this.off( selector, "**" ) :
  8588. this.off( types, selector || "**", fn );
  8589. },
  8590.  
  8591. hover: function( fnOver, fnOut ) {
  8592. return this
  8593. .on( "mouseenter", fnOver )
  8594. .on( "mouseleave", fnOut || fnOver );
  8595. }
  8596. } );
  8597.  
  8598. jQuery.each(
  8599. ( "blur focus focusin focusout resize scroll click dblclick " +
  8600. "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
  8601. "change select submit keydown keypress keyup contextmenu" ).split( " " ),
  8602. function( _i, name ) {
  8603.  
  8604. // Handle event binding
  8605. jQuery.fn[ name ] = function( data, fn ) {
  8606. return arguments.length > 0 ?
  8607. this.on( name, null, data, fn ) :
  8608. this.trigger( name );
  8609. };
  8610. }
  8611. );
  8612.  
  8613.  
  8614.  
  8615.  
  8616. // Support: Android <=4.0 only
  8617. // Make sure we trim BOM and NBSP
  8618. // Require that the "whitespace run" starts from a non-whitespace
  8619. // to avoid O(N^2) behavior when the engine would try matching "\s+$" at each space position.
  8620. var rtrim = /^[\s\uFEFF\xA0]+|([^\s\uFEFF\xA0])[\s\uFEFF\xA0]+$/g;
  8621.  
  8622. // Bind a function to a context, optionally partially applying any
  8623. // arguments.
  8624. // jQuery.proxy is deprecated to promote standards (specifically Function#bind)
  8625. // However, it is not slated for removal any time soon
  8626. jQuery.proxy = function( fn, context ) {
  8627. var tmp, args, proxy;
  8628.  
  8629. if ( typeof context === "string" ) {
  8630. tmp = fn[ context ];
  8631. context = fn;
  8632. fn = tmp;
  8633. }
  8634.  
  8635. // Quick check to determine if target is callable, in the spec
  8636. // this throws a TypeError, but we will just return undefined.
  8637. if ( !isFunction( fn ) ) {
  8638. return undefined;
  8639. }
  8640.  
  8641. // Simulated bind
  8642. args = slice.call( arguments, 2 );
  8643. proxy = function() {
  8644. return fn.apply( context || this, args.concat( slice.call( arguments ) ) );
  8645. };
  8646.  
  8647. // Set the guid of unique handler to the same of original handler, so it can be removed
  8648. proxy.guid = fn.guid = fn.guid || jQuery.guid++;
  8649.  
  8650. return proxy;
  8651. };
  8652.  
  8653. jQuery.holdReady = function( hold ) {
  8654. if ( hold ) {
  8655. jQuery.readyWait++;
  8656. } else {
  8657. jQuery.ready( true );
  8658. }
  8659. };
  8660. jQuery.isArray = Array.isArray;
  8661. jQuery.parseJSON = JSON.parse;
  8662. jQuery.nodeName = nodeName;
  8663. jQuery.isFunction = isFunction;
  8664. jQuery.isWindow = isWindow;
  8665. jQuery.camelCase = camelCase;
  8666. jQuery.type = toType;
  8667.  
  8668. jQuery.now = Date.now;
  8669.  
  8670. jQuery.isNumeric = function( obj ) {
  8671.  
  8672. // As of jQuery 3.0, isNumeric is limited to
  8673. // strings and numbers (primitives or objects)
  8674. // that can be coerced to finite numbers (gh-2662)
  8675. var type = jQuery.type( obj );
  8676. return ( type === "number" || type === "string" ) &&
  8677.  
  8678. // parseFloat NaNs numeric-cast false positives ("")
  8679. // ...but misinterprets leading-number strings, particularly hex literals ("0x...")
  8680. // subtraction forces infinities to NaN
  8681. !isNaN( obj - parseFloat( obj ) );
  8682. };
  8683.  
  8684. jQuery.trim = function( text ) {
  8685. return text == null ?
  8686. "" :
  8687. ( text + "" ).replace( rtrim, "$1" );
  8688. };
  8689.  
  8690.  
  8691.  
  8692. // Register as a named AMD module, since jQuery can be concatenated with other
  8693. // files that may use define, but not via a proper concatenation script that
  8694. // understands anonymous AMD modules. A named AMD is safest and most robust
  8695. // way to register. Lowercase jquery is used because AMD module names are
  8696. // derived from file names, and jQuery is normally delivered in a lowercase
  8697. // file name. Do this after creating the global so that if an AMD module wants
  8698. // to call noConflict to hide this version of jQuery, it will work.
  8699.  
  8700. // Note that for maximum portability, libraries that are not jQuery should
  8701. // declare themselves as anonymous modules, and avoid setting a global if an
  8702. // AMD loader is present. jQuery is a special case. For more information, see
  8703. // https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon
  8704.  
  8705. if ( true ) {
  8706. !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function() {
  8707. return jQuery;
  8708. }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
  8709. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  8710. }
  8711.  
  8712.  
  8713.  
  8714.  
  8715. var
  8716.  
  8717. // Map over jQuery in case of overwrite
  8718. _jQuery = window.jQuery,
  8719.  
  8720. // Map over the $ in case of overwrite
  8721. _$ = window.$;
  8722.  
  8723. jQuery.noConflict = function( deep ) {
  8724. if ( window.$ === jQuery ) {
  8725. window.$ = _$;
  8726. }
  8727.  
  8728. if ( deep && window.jQuery === jQuery ) {
  8729. window.jQuery = _jQuery;
  8730. }
  8731.  
  8732. return jQuery;
  8733. };
  8734.  
  8735. // Expose jQuery and $ identifiers, even in AMD
  8736. // (trac-7102#comment:10, https://github.com/jquery/jquery/pull/557)
  8737. // and CommonJS for browser emulators (trac-13566)
  8738. if ( typeof noGlobal === "undefined" ) {
  8739. window.jQuery = window.$ = jQuery;
  8740. }
  8741.  
  8742.  
  8743.  
  8744.  
  8745. return jQuery;
  8746. } );
  8747.  
  8748.  
  8749. /***/ }),
  8750. /* 2 */
  8751. /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
  8752.  
  8753. "use strict";
  8754.  
  8755. var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
  8756. if (k2 === undefined) k2 = k;
  8757. var desc = Object.getOwnPropertyDescriptor(m, k);
  8758. if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
  8759. desc = { enumerable: true, get: function() { return m[k]; } };
  8760. }
  8761. Object.defineProperty(o, k2, desc);
  8762. }) : (function(o, m, k, k2) {
  8763. if (k2 === undefined) k2 = k;
  8764. o[k2] = m[k];
  8765. }));
  8766. var __exportStar = (this && this.__exportStar) || function(m, exports) {
  8767. for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
  8768. };
  8769. Object.defineProperty(exports, "__esModule", ({ value: true }));
  8770. __exportStar(__webpack_require__(34), exports);
  8771. __exportStar(__webpack_require__(29), exports);
  8772. __exportStar(__webpack_require__(35), exports);
  8773. __exportStar(__webpack_require__(36), exports);
  8774. __exportStar(__webpack_require__(9), exports);
  8775. __exportStar(__webpack_require__(16), exports);
  8776. __exportStar(__webpack_require__(31), exports);
  8777. __exportStar(__webpack_require__(8), exports);
  8778. __exportStar(__webpack_require__(10), exports);
  8779. __exportStar(__webpack_require__(3), exports);
  8780. __exportStar(__webpack_require__(18), exports);
  8781. __exportStar(__webpack_require__(50), exports);
  8782. __exportStar(__webpack_require__(19), exports);
  8783.  
  8784.  
  8785. /***/ }),
  8786. /* 3 */
  8787. /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
  8788.  
  8789. "use strict";
  8790.  
  8791. var __importDefault = (this && this.__importDefault) || function (mod) {
  8792. return (mod && mod.__esModule) ? mod : { "default": mod };
  8793. };
  8794. Object.defineProperty(exports, "__esModule", ({ value: true }));
  8795. exports.HttpClient = void 0;
  8796. const axios_1 = __importDefault(__webpack_require__(4));
  8797. const axios_cache_interceptor_1 = __webpack_require__(32);
  8798. const storage = (0, axios_cache_interceptor_1.buildWebStorage)(window.sessionStorage, 'gs-');
  8799. class HttpClient {
  8800. constructor(baseURL) {
  8801. this._handleResponse = ({ data }) => data;
  8802. this._handleError = (error) => Promise.reject(error);
  8803. this.client = (0, axios_cache_interceptor_1.setupCache)(axios_1.default.create({ baseURL }), {
  8804. storage: storage,
  8805. generateKey: axios_cache_interceptor_1.defaultKeyGenerator,
  8806. headerInterpreter: axios_cache_interceptor_1.defaultHeaderInterpreter,
  8807. debug: (msg) => console.log(msg),
  8808. ttl: 1000 * 15,
  8809. cachePredicate: {
  8810. statusCheck: (status) => status >= 200 && status < 400,
  8811. },
  8812. });
  8813. this._initializeResponseInterceptor();
  8814. }
  8815. _initializeResponseInterceptor() {
  8816. this.client.interceptors.response.use(this._handleResponse, this._handleError);
  8817. }
  8818. }
  8819. exports.HttpClient = HttpClient;
  8820.  
  8821.  
  8822. /***/ }),
  8823. /* 4 */
  8824. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  8825.  
  8826. "use strict";
  8827. // Axios v1.7.4 Copyright (c) 2024 Matt Zabriskie and contributors
  8828.  
  8829.  
  8830. function bind(fn, thisArg) {
  8831. return function wrap() {
  8832. return fn.apply(thisArg, arguments);
  8833. };
  8834. }
  8835.  
  8836. // utils is a library of generic helper functions non-specific to axios
  8837.  
  8838. const {toString} = Object.prototype;
  8839. const {getPrototypeOf} = Object;
  8840.  
  8841. const kindOf = (cache => thing => {
  8842. const str = toString.call(thing);
  8843. return cache[str] || (cache[str] = str.slice(8, -1).toLowerCase());
  8844. })(Object.create(null));
  8845.  
  8846. const kindOfTest = (type) => {
  8847. type = type.toLowerCase();
  8848. return (thing) => kindOf(thing) === type
  8849. };
  8850.  
  8851. const typeOfTest = type => thing => typeof thing === type;
  8852.  
  8853. /**
  8854. * Determine if a value is an Array
  8855. *
  8856. * @param {Object} val The value to test
  8857. *
  8858. * @returns {boolean} True if value is an Array, otherwise false
  8859. */
  8860. const {isArray} = Array;
  8861.  
  8862. /**
  8863. * Determine if a value is undefined
  8864. *
  8865. * @param {*} val The value to test
  8866. *
  8867. * @returns {boolean} True if the value is undefined, otherwise false
  8868. */
  8869. const isUndefined = typeOfTest('undefined');
  8870.  
  8871. /**
  8872. * Determine if a value is a Buffer
  8873. *
  8874. * @param {*} val The value to test
  8875. *
  8876. * @returns {boolean} True if value is a Buffer, otherwise false
  8877. */
  8878. function isBuffer(val) {
  8879. return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor)
  8880. && isFunction(val.constructor.isBuffer) && val.constructor.isBuffer(val);
  8881. }
  8882.  
  8883. /**
  8884. * Determine if a value is an ArrayBuffer
  8885. *
  8886. * @param {*} val The value to test
  8887. *
  8888. * @returns {boolean} True if value is an ArrayBuffer, otherwise false
  8889. */
  8890. const isArrayBuffer = kindOfTest('ArrayBuffer');
  8891.  
  8892.  
  8893. /**
  8894. * Determine if a value is a view on an ArrayBuffer
  8895. *
  8896. * @param {*} val The value to test
  8897. *
  8898. * @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false
  8899. */
  8900. function isArrayBufferView(val) {
  8901. let result;
  8902. if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) {
  8903. result = ArrayBuffer.isView(val);
  8904. } else {
  8905. result = (val) && (val.buffer) && (isArrayBuffer(val.buffer));
  8906. }
  8907. return result;
  8908. }
  8909.  
  8910. /**
  8911. * Determine if a value is a String
  8912. *
  8913. * @param {*} val The value to test
  8914. *
  8915. * @returns {boolean} True if value is a String, otherwise false
  8916. */
  8917. const isString = typeOfTest('string');
  8918.  
  8919. /**
  8920. * Determine if a value is a Function
  8921. *
  8922. * @param {*} val The value to test
  8923. * @returns {boolean} True if value is a Function, otherwise false
  8924. */
  8925. const isFunction = typeOfTest('function');
  8926.  
  8927. /**
  8928. * Determine if a value is a Number
  8929. *
  8930. * @param {*} val The value to test
  8931. *
  8932. * @returns {boolean} True if value is a Number, otherwise false
  8933. */
  8934. const isNumber = typeOfTest('number');
  8935.  
  8936. /**
  8937. * Determine if a value is an Object
  8938. *
  8939. * @param {*} thing The value to test
  8940. *
  8941. * @returns {boolean} True if value is an Object, otherwise false
  8942. */
  8943. const isObject = (thing) => thing !== null && typeof thing === 'object';
  8944.  
  8945. /**
  8946. * Determine if a value is a Boolean
  8947. *
  8948. * @param {*} thing The value to test
  8949. * @returns {boolean} True if value is a Boolean, otherwise false
  8950. */
  8951. const isBoolean = thing => thing === true || thing === false;
  8952.  
  8953. /**
  8954. * Determine if a value is a plain Object
  8955. *
  8956. * @param {*} val The value to test
  8957. *
  8958. * @returns {boolean} True if value is a plain Object, otherwise false
  8959. */
  8960. const isPlainObject = (val) => {
  8961. if (kindOf(val) !== 'object') {
  8962. return false;
  8963. }
  8964.  
  8965. const prototype = getPrototypeOf(val);
  8966. return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(Symbol.toStringTag in val) && !(Symbol.iterator in val);
  8967. };
  8968.  
  8969. /**
  8970. * Determine if a value is a Date
  8971. *
  8972. * @param {*} val The value to test
  8973. *
  8974. * @returns {boolean} True if value is a Date, otherwise false
  8975. */
  8976. const isDate = kindOfTest('Date');
  8977.  
  8978. /**
  8979. * Determine if a value is a File
  8980. *
  8981. * @param {*} val The value to test
  8982. *
  8983. * @returns {boolean} True if value is a File, otherwise false
  8984. */
  8985. const isFile = kindOfTest('File');
  8986.  
  8987. /**
  8988. * Determine if a value is a Blob
  8989. *
  8990. * @param {*} val The value to test
  8991. *
  8992. * @returns {boolean} True if value is a Blob, otherwise false
  8993. */
  8994. const isBlob = kindOfTest('Blob');
  8995.  
  8996. /**
  8997. * Determine if a value is a FileList
  8998. *
  8999. * @param {*} val The value to test
  9000. *
  9001. * @returns {boolean} True if value is a File, otherwise false
  9002. */
  9003. const isFileList = kindOfTest('FileList');
  9004.  
  9005. /**
  9006. * Determine if a value is a Stream
  9007. *
  9008. * @param {*} val The value to test
  9009. *
  9010. * @returns {boolean} True if value is a Stream, otherwise false
  9011. */
  9012. const isStream = (val) => isObject(val) && isFunction(val.pipe);
  9013.  
  9014. /**
  9015. * Determine if a value is a FormData
  9016. *
  9017. * @param {*} thing The value to test
  9018. *
  9019. * @returns {boolean} True if value is an FormData, otherwise false
  9020. */
  9021. const isFormData = (thing) => {
  9022. let kind;
  9023. return thing && (
  9024. (typeof FormData === 'function' && thing instanceof FormData) || (
  9025. isFunction(thing.append) && (
  9026. (kind = kindOf(thing)) === 'formdata' ||
  9027. // detect form-data instance
  9028. (kind === 'object' && isFunction(thing.toString) && thing.toString() === '[object FormData]')
  9029. )
  9030. )
  9031. )
  9032. };
  9033.  
  9034. /**
  9035. * Determine if a value is a URLSearchParams object
  9036. *
  9037. * @param {*} val The value to test
  9038. *
  9039. * @returns {boolean} True if value is a URLSearchParams object, otherwise false
  9040. */
  9041. const isURLSearchParams = kindOfTest('URLSearchParams');
  9042.  
  9043. const [isReadableStream, isRequest, isResponse, isHeaders] = ['ReadableStream', 'Request', 'Response', 'Headers'].map(kindOfTest);
  9044.  
  9045. /**
  9046. * Trim excess whitespace off the beginning and end of a string
  9047. *
  9048. * @param {String} str The String to trim
  9049. *
  9050. * @returns {String} The String freed of excess whitespace
  9051. */
  9052. const trim = (str) => str.trim ?
  9053. str.trim() : str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, '');
  9054.  
  9055. /**
  9056. * Iterate over an Array or an Object invoking a function for each item.
  9057. *
  9058. * If `obj` is an Array callback will be called passing
  9059. * the value, index, and complete array for each item.
  9060. *
  9061. * If 'obj' is an Object callback will be called passing
  9062. * the value, key, and complete object for each property.
  9063. *
  9064. * @param {Object|Array} obj The object to iterate
  9065. * @param {Function} fn The callback to invoke for each item
  9066. *
  9067. * @param {Boolean} [allOwnKeys = false]
  9068. * @returns {any}
  9069. */
  9070. function forEach(obj, fn, {allOwnKeys = false} = {}) {
  9071. // Don't bother if no value provided
  9072. if (obj === null || typeof obj === 'undefined') {
  9073. return;
  9074. }
  9075.  
  9076. let i;
  9077. let l;
  9078.  
  9079. // Force an array if not already something iterable
  9080. if (typeof obj !== 'object') {
  9081. /*eslint no-param-reassign:0*/
  9082. obj = [obj];
  9083. }
  9084.  
  9085. if (isArray(obj)) {
  9086. // Iterate over array values
  9087. for (i = 0, l = obj.length; i < l; i++) {
  9088. fn.call(null, obj[i], i, obj);
  9089. }
  9090. } else {
  9091. // Iterate over object keys
  9092. const keys = allOwnKeys ? Object.getOwnPropertyNames(obj) : Object.keys(obj);
  9093. const len = keys.length;
  9094. let key;
  9095.  
  9096. for (i = 0; i < len; i++) {
  9097. key = keys[i];
  9098. fn.call(null, obj[key], key, obj);
  9099. }
  9100. }
  9101. }
  9102.  
  9103. function findKey(obj, key) {
  9104. key = key.toLowerCase();
  9105. const keys = Object.keys(obj);
  9106. let i = keys.length;
  9107. let _key;
  9108. while (i-- > 0) {
  9109. _key = keys[i];
  9110. if (key === _key.toLowerCase()) {
  9111. return _key;
  9112. }
  9113. }
  9114. return null;
  9115. }
  9116.  
  9117. const _global = (() => {
  9118. /*eslint no-undef:0*/
  9119. if (typeof globalThis !== "undefined") return globalThis;
  9120. return typeof self !== "undefined" ? self : (typeof window !== 'undefined' ? window : __webpack_require__.g)
  9121. })();
  9122.  
  9123. const isContextDefined = (context) => !isUndefined(context) && context !== _global;
  9124.  
  9125. /**
  9126. * Accepts varargs expecting each argument to be an object, then
  9127. * immutably merges the properties of each object and returns result.
  9128. *
  9129. * When multiple objects contain the same key the later object in
  9130. * the arguments list will take precedence.
  9131. *
  9132. * Example:
  9133. *
  9134. * ```js
  9135. * var result = merge({foo: 123}, {foo: 456});
  9136. * console.log(result.foo); // outputs 456
  9137. * ```
  9138. *
  9139. * @param {Object} obj1 Object to merge
  9140. *
  9141. * @returns {Object} Result of all merge properties
  9142. */
  9143. function merge(/* obj1, obj2, obj3, ... */) {
  9144. const {caseless} = isContextDefined(this) && this || {};
  9145. const result = {};
  9146. const assignValue = (val, key) => {
  9147. const targetKey = caseless && findKey(result, key) || key;
  9148. if (isPlainObject(result[targetKey]) && isPlainObject(val)) {
  9149. result[targetKey] = merge(result[targetKey], val);
  9150. } else if (isPlainObject(val)) {
  9151. result[targetKey] = merge({}, val);
  9152. } else if (isArray(val)) {
  9153. result[targetKey] = val.slice();
  9154. } else {
  9155. result[targetKey] = val;
  9156. }
  9157. };
  9158.  
  9159. for (let i = 0, l = arguments.length; i < l; i++) {
  9160. arguments[i] && forEach(arguments[i], assignValue);
  9161. }
  9162. return result;
  9163. }
  9164.  
  9165. /**
  9166. * Extends object a by mutably adding to it the properties of object b.
  9167. *
  9168. * @param {Object} a The object to be extended
  9169. * @param {Object} b The object to copy properties from
  9170. * @param {Object} thisArg The object to bind function to
  9171. *
  9172. * @param {Boolean} [allOwnKeys]
  9173. * @returns {Object} The resulting value of object a
  9174. */
  9175. const extend = (a, b, thisArg, {allOwnKeys}= {}) => {
  9176. forEach(b, (val, key) => {
  9177. if (thisArg && isFunction(val)) {
  9178. a[key] = bind(val, thisArg);
  9179. } else {
  9180. a[key] = val;
  9181. }
  9182. }, {allOwnKeys});
  9183. return a;
  9184. };
  9185.  
  9186. /**
  9187. * Remove byte order marker. This catches EF BB BF (the UTF-8 BOM)
  9188. *
  9189. * @param {string} content with BOM
  9190. *
  9191. * @returns {string} content value without BOM
  9192. */
  9193. const stripBOM = (content) => {
  9194. if (content.charCodeAt(0) === 0xFEFF) {
  9195. content = content.slice(1);
  9196. }
  9197. return content;
  9198. };
  9199.  
  9200. /**
  9201. * Inherit the prototype methods from one constructor into another
  9202. * @param {function} constructor
  9203. * @param {function} superConstructor
  9204. * @param {object} [props]
  9205. * @param {object} [descriptors]
  9206. *
  9207. * @returns {void}
  9208. */
  9209. const inherits = (constructor, superConstructor, props, descriptors) => {
  9210. constructor.prototype = Object.create(superConstructor.prototype, descriptors);
  9211. constructor.prototype.constructor = constructor;
  9212. Object.defineProperty(constructor, 'super', {
  9213. value: superConstructor.prototype
  9214. });
  9215. props && Object.assign(constructor.prototype, props);
  9216. };
  9217.  
  9218. /**
  9219. * Resolve object with deep prototype chain to a flat object
  9220. * @param {Object} sourceObj source object
  9221. * @param {Object} [destObj]
  9222. * @param {Function|Boolean} [filter]
  9223. * @param {Function} [propFilter]
  9224. *
  9225. * @returns {Object}
  9226. */
  9227. const toFlatObject = (sourceObj, destObj, filter, propFilter) => {
  9228. let props;
  9229. let i;
  9230. let prop;
  9231. const merged = {};
  9232.  
  9233. destObj = destObj || {};
  9234. // eslint-disable-next-line no-eq-null,eqeqeq
  9235. if (sourceObj == null) return destObj;
  9236.  
  9237. do {
  9238. props = Object.getOwnPropertyNames(sourceObj);
  9239. i = props.length;
  9240. while (i-- > 0) {
  9241. prop = props[i];
  9242. if ((!propFilter || propFilter(prop, sourceObj, destObj)) && !merged[prop]) {
  9243. destObj[prop] = sourceObj[prop];
  9244. merged[prop] = true;
  9245. }
  9246. }
  9247. sourceObj = filter !== false && getPrototypeOf(sourceObj);
  9248. } while (sourceObj && (!filter || filter(sourceObj, destObj)) && sourceObj !== Object.prototype);
  9249.  
  9250. return destObj;
  9251. };
  9252.  
  9253. /**
  9254. * Determines whether a string ends with the characters of a specified string
  9255. *
  9256. * @param {String} str
  9257. * @param {String} searchString
  9258. * @param {Number} [position= 0]
  9259. *
  9260. * @returns {boolean}
  9261. */
  9262. const endsWith = (str, searchString, position) => {
  9263. str = String(str);
  9264. if (position === undefined || position > str.length) {
  9265. position = str.length;
  9266. }
  9267. position -= searchString.length;
  9268. const lastIndex = str.indexOf(searchString, position);
  9269. return lastIndex !== -1 && lastIndex === position;
  9270. };
  9271.  
  9272.  
  9273. /**
  9274. * Returns new array from array like object or null if failed
  9275. *
  9276. * @param {*} [thing]
  9277. *
  9278. * @returns {?Array}
  9279. */
  9280. const toArray = (thing) => {
  9281. if (!thing) return null;
  9282. if (isArray(thing)) return thing;
  9283. let i = thing.length;
  9284. if (!isNumber(i)) return null;
  9285. const arr = new Array(i);
  9286. while (i-- > 0) {
  9287. arr[i] = thing[i];
  9288. }
  9289. return arr;
  9290. };
  9291.  
  9292. /**
  9293. * Checking if the Uint8Array exists and if it does, it returns a function that checks if the
  9294. * thing passed in is an instance of Uint8Array
  9295. *
  9296. * @param {TypedArray}
  9297. *
  9298. * @returns {Array}
  9299. */
  9300. // eslint-disable-next-line func-names
  9301. const isTypedArray = (TypedArray => {
  9302. // eslint-disable-next-line func-names
  9303. return thing => {
  9304. return TypedArray && thing instanceof TypedArray;
  9305. };
  9306. })(typeof Uint8Array !== 'undefined' && getPrototypeOf(Uint8Array));
  9307.  
  9308. /**
  9309. * For each entry in the object, call the function with the key and value.
  9310. *
  9311. * @param {Object<any, any>} obj - The object to iterate over.
  9312. * @param {Function} fn - The function to call for each entry.
  9313. *
  9314. * @returns {void}
  9315. */
  9316. const forEachEntry = (obj, fn) => {
  9317. const generator = obj && obj[Symbol.iterator];
  9318.  
  9319. const iterator = generator.call(obj);
  9320.  
  9321. let result;
  9322.  
  9323. while ((result = iterator.next()) && !result.done) {
  9324. const pair = result.value;
  9325. fn.call(obj, pair[0], pair[1]);
  9326. }
  9327. };
  9328.  
  9329. /**
  9330. * It takes a regular expression and a string, and returns an array of all the matches
  9331. *
  9332. * @param {string} regExp - The regular expression to match against.
  9333. * @param {string} str - The string to search.
  9334. *
  9335. * @returns {Array<boolean>}
  9336. */
  9337. const matchAll = (regExp, str) => {
  9338. let matches;
  9339. const arr = [];
  9340.  
  9341. while ((matches = regExp.exec(str)) !== null) {
  9342. arr.push(matches);
  9343. }
  9344.  
  9345. return arr;
  9346. };
  9347.  
  9348. /* Checking if the kindOfTest function returns true when passed an HTMLFormElement. */
  9349. const isHTMLForm = kindOfTest('HTMLFormElement');
  9350.  
  9351. const toCamelCase = str => {
  9352. return str.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,
  9353. function replacer(m, p1, p2) {
  9354. return p1.toUpperCase() + p2;
  9355. }
  9356. );
  9357. };
  9358.  
  9359. /* Creating a function that will check if an object has a property. */
  9360. const hasOwnProperty = (({hasOwnProperty}) => (obj, prop) => hasOwnProperty.call(obj, prop))(Object.prototype);
  9361.  
  9362. /**
  9363. * Determine if a value is a RegExp object
  9364. *
  9365. * @param {*} val The value to test
  9366. *
  9367. * @returns {boolean} True if value is a RegExp object, otherwise false
  9368. */
  9369. const isRegExp = kindOfTest('RegExp');
  9370.  
  9371. const reduceDescriptors = (obj, reducer) => {
  9372. const descriptors = Object.getOwnPropertyDescriptors(obj);
  9373. const reducedDescriptors = {};
  9374.  
  9375. forEach(descriptors, (descriptor, name) => {
  9376. let ret;
  9377. if ((ret = reducer(descriptor, name, obj)) !== false) {
  9378. reducedDescriptors[name] = ret || descriptor;
  9379. }
  9380. });
  9381.  
  9382. Object.defineProperties(obj, reducedDescriptors);
  9383. };
  9384.  
  9385. /**
  9386. * Makes all methods read-only
  9387. * @param {Object} obj
  9388. */
  9389.  
  9390. const freezeMethods = (obj) => {
  9391. reduceDescriptors(obj, (descriptor, name) => {
  9392. // skip restricted props in strict mode
  9393. if (isFunction(obj) && ['arguments', 'caller', 'callee'].indexOf(name) !== -1) {
  9394. return false;
  9395. }
  9396.  
  9397. const value = obj[name];
  9398.  
  9399. if (!isFunction(value)) return;
  9400.  
  9401. descriptor.enumerable = false;
  9402.  
  9403. if ('writable' in descriptor) {
  9404. descriptor.writable = false;
  9405. return;
  9406. }
  9407.  
  9408. if (!descriptor.set) {
  9409. descriptor.set = () => {
  9410. throw Error('Can not rewrite read-only method \'' + name + '\'');
  9411. };
  9412. }
  9413. });
  9414. };
  9415.  
  9416. const toObjectSet = (arrayOrString, delimiter) => {
  9417. const obj = {};
  9418.  
  9419. const define = (arr) => {
  9420. arr.forEach(value => {
  9421. obj[value] = true;
  9422. });
  9423. };
  9424.  
  9425. isArray(arrayOrString) ? define(arrayOrString) : define(String(arrayOrString).split(delimiter));
  9426.  
  9427. return obj;
  9428. };
  9429.  
  9430. const noop = () => {};
  9431.  
  9432. const toFiniteNumber = (value, defaultValue) => {
  9433. return value != null && Number.isFinite(value = +value) ? value : defaultValue;
  9434. };
  9435.  
  9436. const ALPHA = 'abcdefghijklmnopqrstuvwxyz';
  9437.  
  9438. const DIGIT = '0123456789';
  9439.  
  9440. const ALPHABET = {
  9441. DIGIT,
  9442. ALPHA,
  9443. ALPHA_DIGIT: ALPHA + ALPHA.toUpperCase() + DIGIT
  9444. };
  9445.  
  9446. const generateString = (size = 16, alphabet = ALPHABET.ALPHA_DIGIT) => {
  9447. let str = '';
  9448. const {length} = alphabet;
  9449. while (size--) {
  9450. str += alphabet[Math.random() * length|0];
  9451. }
  9452.  
  9453. return str;
  9454. };
  9455.  
  9456. /**
  9457. * If the thing is a FormData object, return true, otherwise return false.
  9458. *
  9459. * @param {unknown} thing - The thing to check.
  9460. *
  9461. * @returns {boolean}
  9462. */
  9463. function isSpecCompliantForm(thing) {
  9464. return !!(thing && isFunction(thing.append) && thing[Symbol.toStringTag] === 'FormData' && thing[Symbol.iterator]);
  9465. }
  9466.  
  9467. const toJSONObject = (obj) => {
  9468. const stack = new Array(10);
  9469.  
  9470. const visit = (source, i) => {
  9471.  
  9472. if (isObject(source)) {
  9473. if (stack.indexOf(source) >= 0) {
  9474. return;
  9475. }
  9476.  
  9477. if(!('toJSON' in source)) {
  9478. stack[i] = source;
  9479. const target = isArray(source) ? [] : {};
  9480.  
  9481. forEach(source, (value, key) => {
  9482. const reducedValue = visit(value, i + 1);
  9483. !isUndefined(reducedValue) && (target[key] = reducedValue);
  9484. });
  9485.  
  9486. stack[i] = undefined;
  9487.  
  9488. return target;
  9489. }
  9490. }
  9491.  
  9492. return source;
  9493. };
  9494.  
  9495. return visit(obj, 0);
  9496. };
  9497.  
  9498. const isAsyncFn = kindOfTest('AsyncFunction');
  9499.  
  9500. const isThenable = (thing) =>
  9501. thing && (isObject(thing) || isFunction(thing)) && isFunction(thing.then) && isFunction(thing.catch);
  9502.  
  9503. // original code
  9504. // https://github.com/DigitalBrainJS/AxiosPromise/blob/16deab13710ec09779922131f3fa5954320f83ab/lib/utils.js#L11-L34
  9505.  
  9506. const _setImmediate = ((setImmediateSupported, postMessageSupported) => {
  9507. if (setImmediateSupported) {
  9508. return setImmediate;
  9509. }
  9510.  
  9511. return postMessageSupported ? ((token, callbacks) => {
  9512. _global.addEventListener("message", ({source, data}) => {
  9513. if (source === _global && data === token) {
  9514. callbacks.length && callbacks.shift()();
  9515. }
  9516. }, false);
  9517.  
  9518. return (cb) => {
  9519. callbacks.push(cb);
  9520. _global.postMessage(token, "*");
  9521. }
  9522. })(`axios@${Math.random()}`, []) : (cb) => setTimeout(cb);
  9523. })(
  9524. typeof setImmediate === 'function',
  9525. isFunction(_global.postMessage)
  9526. );
  9527.  
  9528. const asap = typeof queueMicrotask !== 'undefined' ?
  9529. queueMicrotask.bind(_global) : ( typeof process !== 'undefined' && process.nextTick || _setImmediate);
  9530.  
  9531. // *********************
  9532.  
  9533. var utils$1 = {
  9534. isArray,
  9535. isArrayBuffer,
  9536. isBuffer,
  9537. isFormData,
  9538. isArrayBufferView,
  9539. isString,
  9540. isNumber,
  9541. isBoolean,
  9542. isObject,
  9543. isPlainObject,
  9544. isReadableStream,
  9545. isRequest,
  9546. isResponse,
  9547. isHeaders,
  9548. isUndefined,
  9549. isDate,
  9550. isFile,
  9551. isBlob,
  9552. isRegExp,
  9553. isFunction,
  9554. isStream,
  9555. isURLSearchParams,
  9556. isTypedArray,
  9557. isFileList,
  9558. forEach,
  9559. merge,
  9560. extend,
  9561. trim,
  9562. stripBOM,
  9563. inherits,
  9564. toFlatObject,
  9565. kindOf,
  9566. kindOfTest,
  9567. endsWith,
  9568. toArray,
  9569. forEachEntry,
  9570. matchAll,
  9571. isHTMLForm,
  9572. hasOwnProperty,
  9573. hasOwnProp: hasOwnProperty, // an alias to avoid ESLint no-prototype-builtins detection
  9574. reduceDescriptors,
  9575. freezeMethods,
  9576. toObjectSet,
  9577. toCamelCase,
  9578. noop,
  9579. toFiniteNumber,
  9580. findKey,
  9581. global: _global,
  9582. isContextDefined,
  9583. ALPHABET,
  9584. generateString,
  9585. isSpecCompliantForm,
  9586. toJSONObject,
  9587. isAsyncFn,
  9588. isThenable,
  9589. setImmediate: _setImmediate,
  9590. asap
  9591. };
  9592.  
  9593. /**
  9594. * Create an Error with the specified message, config, error code, request and response.
  9595. *
  9596. * @param {string} message The error message.
  9597. * @param {string} [code] The error code (for example, 'ECONNABORTED').
  9598. * @param {Object} [config] The config.
  9599. * @param {Object} [request] The request.
  9600. * @param {Object} [response] The response.
  9601. *
  9602. * @returns {Error} The created error.
  9603. */
  9604. function AxiosError(message, code, config, request, response) {
  9605. Error.call(this);
  9606.  
  9607. if (Error.captureStackTrace) {
  9608. Error.captureStackTrace(this, this.constructor);
  9609. } else {
  9610. this.stack = (new Error()).stack;
  9611. }
  9612.  
  9613. this.message = message;
  9614. this.name = 'AxiosError';
  9615. code && (this.code = code);
  9616. config && (this.config = config);
  9617. request && (this.request = request);
  9618. response && (this.response = response);
  9619. }
  9620.  
  9621. utils$1.inherits(AxiosError, Error, {
  9622. toJSON: function toJSON() {
  9623. return {
  9624. // Standard
  9625. message: this.message,
  9626. name: this.name,
  9627. // Microsoft
  9628. description: this.description,
  9629. number: this.number,
  9630. // Mozilla
  9631. fileName: this.fileName,
  9632. lineNumber: this.lineNumber,
  9633. columnNumber: this.columnNumber,
  9634. stack: this.stack,
  9635. // Axios
  9636. config: utils$1.toJSONObject(this.config),
  9637. code: this.code,
  9638. status: this.response && this.response.status ? this.response.status : null
  9639. };
  9640. }
  9641. });
  9642.  
  9643. const prototype$1 = AxiosError.prototype;
  9644. const descriptors = {};
  9645.  
  9646. [
  9647. 'ERR_BAD_OPTION_VALUE',
  9648. 'ERR_BAD_OPTION',
  9649. 'ECONNABORTED',
  9650. 'ETIMEDOUT',
  9651. 'ERR_NETWORK',
  9652. 'ERR_FR_TOO_MANY_REDIRECTS',
  9653. 'ERR_DEPRECATED',
  9654. 'ERR_BAD_RESPONSE',
  9655. 'ERR_BAD_REQUEST',
  9656. 'ERR_CANCELED',
  9657. 'ERR_NOT_SUPPORT',
  9658. 'ERR_INVALID_URL'
  9659. // eslint-disable-next-line func-names
  9660. ].forEach(code => {
  9661. descriptors[code] = {value: code};
  9662. });
  9663.  
  9664. Object.defineProperties(AxiosError, descriptors);
  9665. Object.defineProperty(prototype$1, 'isAxiosError', {value: true});
  9666.  
  9667. // eslint-disable-next-line func-names
  9668. AxiosError.from = (error, code, config, request, response, customProps) => {
  9669. const axiosError = Object.create(prototype$1);
  9670.  
  9671. utils$1.toFlatObject(error, axiosError, function filter(obj) {
  9672. return obj !== Error.prototype;
  9673. }, prop => {
  9674. return prop !== 'isAxiosError';
  9675. });
  9676.  
  9677. AxiosError.call(axiosError, error.message, code, config, request, response);
  9678.  
  9679. axiosError.cause = error;
  9680.  
  9681. axiosError.name = error.name;
  9682.  
  9683. customProps && Object.assign(axiosError, customProps);
  9684.  
  9685. return axiosError;
  9686. };
  9687.  
  9688. // eslint-disable-next-line strict
  9689. var httpAdapter = null;
  9690.  
  9691. /**
  9692. * Determines if the given thing is a array or js object.
  9693. *
  9694. * @param {string} thing - The object or array to be visited.
  9695. *
  9696. * @returns {boolean}
  9697. */
  9698. function isVisitable(thing) {
  9699. return utils$1.isPlainObject(thing) || utils$1.isArray(thing);
  9700. }
  9701.  
  9702. /**
  9703. * It removes the brackets from the end of a string
  9704. *
  9705. * @param {string} key - The key of the parameter.
  9706. *
  9707. * @returns {string} the key without the brackets.
  9708. */
  9709. function removeBrackets(key) {
  9710. return utils$1.endsWith(key, '[]') ? key.slice(0, -2) : key;
  9711. }
  9712.  
  9713. /**
  9714. * It takes a path, a key, and a boolean, and returns a string
  9715. *
  9716. * @param {string} path - The path to the current key.
  9717. * @param {string} key - The key of the current object being iterated over.
  9718. * @param {string} dots - If true, the key will be rendered with dots instead of brackets.
  9719. *
  9720. * @returns {string} The path to the current key.
  9721. */
  9722. function renderKey(path, key, dots) {
  9723. if (!path) return key;
  9724. return path.concat(key).map(function each(token, i) {
  9725. // eslint-disable-next-line no-param-reassign
  9726. token = removeBrackets(token);
  9727. return !dots && i ? '[' + token + ']' : token;
  9728. }).join(dots ? '.' : '');
  9729. }
  9730.  
  9731. /**
  9732. * If the array is an array and none of its elements are visitable, then it's a flat array.
  9733. *
  9734. * @param {Array<any>} arr - The array to check
  9735. *
  9736. * @returns {boolean}
  9737. */
  9738. function isFlatArray(arr) {
  9739. return utils$1.isArray(arr) && !arr.some(isVisitable);
  9740. }
  9741.  
  9742. const predicates = utils$1.toFlatObject(utils$1, {}, null, function filter(prop) {
  9743. return /^is[A-Z]/.test(prop);
  9744. });
  9745.  
  9746. /**
  9747. * Convert a data object to FormData
  9748. *
  9749. * @param {Object} obj
  9750. * @param {?Object} [formData]
  9751. * @param {?Object} [options]
  9752. * @param {Function} [options.visitor]
  9753. * @param {Boolean} [options.metaTokens = true]
  9754. * @param {Boolean} [options.dots = false]
  9755. * @param {?Boolean} [options.indexes = false]
  9756. *
  9757. * @returns {Object}
  9758. **/
  9759.  
  9760. /**
  9761. * It converts an object into a FormData object
  9762. *
  9763. * @param {Object<any, any>} obj - The object to convert to form data.
  9764. * @param {string} formData - The FormData object to append to.
  9765. * @param {Object<string, any>} options
  9766. *
  9767. * @returns
  9768. */
  9769. function toFormData(obj, formData, options) {
  9770. if (!utils$1.isObject(obj)) {
  9771. throw new TypeError('target must be an object');
  9772. }
  9773.  
  9774. // eslint-disable-next-line no-param-reassign
  9775. formData = formData || new (FormData)();
  9776.  
  9777. // eslint-disable-next-line no-param-reassign
  9778. options = utils$1.toFlatObject(options, {
  9779. metaTokens: true,
  9780. dots: false,
  9781. indexes: false
  9782. }, false, function defined(option, source) {
  9783. // eslint-disable-next-line no-eq-null,eqeqeq
  9784. return !utils$1.isUndefined(source[option]);
  9785. });
  9786.  
  9787. const metaTokens = options.metaTokens;
  9788. // eslint-disable-next-line no-use-before-define
  9789. const visitor = options.visitor || defaultVisitor;
  9790. const dots = options.dots;
  9791. const indexes = options.indexes;
  9792. const _Blob = options.Blob || typeof Blob !== 'undefined' && Blob;
  9793. const useBlob = _Blob && utils$1.isSpecCompliantForm(formData);
  9794.  
  9795. if (!utils$1.isFunction(visitor)) {
  9796. throw new TypeError('visitor must be a function');
  9797. }
  9798.  
  9799. function convertValue(value) {
  9800. if (value === null) return '';
  9801.  
  9802. if (utils$1.isDate(value)) {
  9803. return value.toISOString();
  9804. }
  9805.  
  9806. if (!useBlob && utils$1.isBlob(value)) {
  9807. throw new AxiosError('Blob is not supported. Use a Buffer instead.');
  9808. }
  9809.  
  9810. if (utils$1.isArrayBuffer(value) || utils$1.isTypedArray(value)) {
  9811. return useBlob && typeof Blob === 'function' ? new Blob([value]) : Buffer.from(value);
  9812. }
  9813.  
  9814. return value;
  9815. }
  9816.  
  9817. /**
  9818. * Default visitor.
  9819. *
  9820. * @param {*} value
  9821. * @param {String|Number} key
  9822. * @param {Array<String|Number>} path
  9823. * @this {FormData}
  9824. *
  9825. * @returns {boolean} return true to visit the each prop of the value recursively
  9826. */
  9827. function defaultVisitor(value, key, path) {
  9828. let arr = value;
  9829.  
  9830. if (value && !path && typeof value === 'object') {
  9831. if (utils$1.endsWith(key, '{}')) {
  9832. // eslint-disable-next-line no-param-reassign
  9833. key = metaTokens ? key : key.slice(0, -2);
  9834. // eslint-disable-next-line no-param-reassign
  9835. value = JSON.stringify(value);
  9836. } else if (
  9837. (utils$1.isArray(value) && isFlatArray(value)) ||
  9838. ((utils$1.isFileList(value) || utils$1.endsWith(key, '[]')) && (arr = utils$1.toArray(value))
  9839. )) {
  9840. // eslint-disable-next-line no-param-reassign
  9841. key = removeBrackets(key);
  9842.  
  9843. arr.forEach(function each(el, index) {
  9844. !(utils$1.isUndefined(el) || el === null) && formData.append(
  9845. // eslint-disable-next-line no-nested-ternary
  9846. indexes === true ? renderKey([key], index, dots) : (indexes === null ? key : key + '[]'),
  9847. convertValue(el)
  9848. );
  9849. });
  9850. return false;
  9851. }
  9852. }
  9853.  
  9854. if (isVisitable(value)) {
  9855. return true;
  9856. }
  9857.  
  9858. formData.append(renderKey(path, key, dots), convertValue(value));
  9859.  
  9860. return false;
  9861. }
  9862.  
  9863. const stack = [];
  9864.  
  9865. const exposedHelpers = Object.assign(predicates, {
  9866. defaultVisitor,
  9867. convertValue,
  9868. isVisitable
  9869. });
  9870.  
  9871. function build(value, path) {
  9872. if (utils$1.isUndefined(value)) return;
  9873.  
  9874. if (stack.indexOf(value) !== -1) {
  9875. throw Error('Circular reference detected in ' + path.join('.'));
  9876. }
  9877.  
  9878. stack.push(value);
  9879.  
  9880. utils$1.forEach(value, function each(el, key) {
  9881. const result = !(utils$1.isUndefined(el) || el === null) && visitor.call(
  9882. formData, el, utils$1.isString(key) ? key.trim() : key, path, exposedHelpers
  9883. );
  9884.  
  9885. if (result === true) {
  9886. build(el, path ? path.concat(key) : [key]);
  9887. }
  9888. });
  9889.  
  9890. stack.pop();
  9891. }
  9892.  
  9893. if (!utils$1.isObject(obj)) {
  9894. throw new TypeError('data must be an object');
  9895. }
  9896.  
  9897. build(obj);
  9898.  
  9899. return formData;
  9900. }
  9901.  
  9902. /**
  9903. * It encodes a string by replacing all characters that are not in the unreserved set with
  9904. * their percent-encoded equivalents
  9905. *
  9906. * @param {string} str - The string to encode.
  9907. *
  9908. * @returns {string} The encoded string.
  9909. */
  9910. function encode$1(str) {
  9911. const charMap = {
  9912. '!': '%21',
  9913. "'": '%27',
  9914. '(': '%28',
  9915. ')': '%29',
  9916. '~': '%7E',
  9917. '%20': '+',
  9918. '%00': '\x00'
  9919. };
  9920. return encodeURIComponent(str).replace(/[!'()~]|%20|%00/g, function replacer(match) {
  9921. return charMap[match];
  9922. });
  9923. }
  9924.  
  9925. /**
  9926. * It takes a params object and converts it to a FormData object
  9927. *
  9928. * @param {Object<string, any>} params - The parameters to be converted to a FormData object.
  9929. * @param {Object<string, any>} options - The options object passed to the Axios constructor.
  9930. *
  9931. * @returns {void}
  9932. */
  9933. function AxiosURLSearchParams(params, options) {
  9934. this._pairs = [];
  9935.  
  9936. params && toFormData(params, this, options);
  9937. }
  9938.  
  9939. const prototype = AxiosURLSearchParams.prototype;
  9940.  
  9941. prototype.append = function append(name, value) {
  9942. this._pairs.push([name, value]);
  9943. };
  9944.  
  9945. prototype.toString = function toString(encoder) {
  9946. const _encode = encoder ? function(value) {
  9947. return encoder.call(this, value, encode$1);
  9948. } : encode$1;
  9949.  
  9950. return this._pairs.map(function each(pair) {
  9951. return _encode(pair[0]) + '=' + _encode(pair[1]);
  9952. }, '').join('&');
  9953. };
  9954.  
  9955. /**
  9956. * It replaces all instances of the characters `:`, `$`, `,`, `+`, `[`, and `]` with their
  9957. * URI encoded counterparts
  9958. *
  9959. * @param {string} val The value to be encoded.
  9960. *
  9961. * @returns {string} The encoded value.
  9962. */
  9963. function encode(val) {
  9964. return encodeURIComponent(val).
  9965. replace(/%3A/gi, ':').
  9966. replace(/%24/g, '$').
  9967. replace(/%2C/gi, ',').
  9968. replace(/%20/g, '+').
  9969. replace(/%5B/gi, '[').
  9970. replace(/%5D/gi, ']');
  9971. }
  9972.  
  9973. /**
  9974. * Build a URL by appending params to the end
  9975. *
  9976. * @param {string} url The base of the url (e.g., http://www.google.com)
  9977. * @param {object} [params] The params to be appended
  9978. * @param {?object} options
  9979. *
  9980. * @returns {string} The formatted url
  9981. */
  9982. function buildURL(url, params, options) {
  9983. /*eslint no-param-reassign:0*/
  9984. if (!params) {
  9985. return url;
  9986. }
  9987. const _encode = options && options.encode || encode;
  9988.  
  9989. const serializeFn = options && options.serialize;
  9990.  
  9991. let serializedParams;
  9992.  
  9993. if (serializeFn) {
  9994. serializedParams = serializeFn(params, options);
  9995. } else {
  9996. serializedParams = utils$1.isURLSearchParams(params) ?
  9997. params.toString() :
  9998. new AxiosURLSearchParams(params, options).toString(_encode);
  9999. }
  10000.  
  10001. if (serializedParams) {
  10002. const hashmarkIndex = url.indexOf("#");
  10003.  
  10004. if (hashmarkIndex !== -1) {
  10005. url = url.slice(0, hashmarkIndex);
  10006. }
  10007. url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;
  10008. }
  10009.  
  10010. return url;
  10011. }
  10012.  
  10013. class InterceptorManager {
  10014. constructor() {
  10015. this.handlers = [];
  10016. }
  10017.  
  10018. /**
  10019. * Add a new interceptor to the stack
  10020. *
  10021. * @param {Function} fulfilled The function to handle `then` for a `Promise`
  10022. * @param {Function} rejected The function to handle `reject` for a `Promise`
  10023. *
  10024. * @return {Number} An ID used to remove interceptor later
  10025. */
  10026. use(fulfilled, rejected, options) {
  10027. this.handlers.push({
  10028. fulfilled,
  10029. rejected,
  10030. synchronous: options ? options.synchronous : false,
  10031. runWhen: options ? options.runWhen : null
  10032. });
  10033. return this.handlers.length - 1;
  10034. }
  10035.  
  10036. /**
  10037. * Remove an interceptor from the stack
  10038. *
  10039. * @param {Number} id The ID that was returned by `use`
  10040. *
  10041. * @returns {Boolean} `true` if the interceptor was removed, `false` otherwise
  10042. */
  10043. eject(id) {
  10044. if (this.handlers[id]) {
  10045. this.handlers[id] = null;
  10046. }
  10047. }
  10048.  
  10049. /**
  10050. * Clear all interceptors from the stack
  10051. *
  10052. * @returns {void}
  10053. */
  10054. clear() {
  10055. if (this.handlers) {
  10056. this.handlers = [];
  10057. }
  10058. }
  10059.  
  10060. /**
  10061. * Iterate over all the registered interceptors
  10062. *
  10063. * This method is particularly useful for skipping over any
  10064. * interceptors that may have become `null` calling `eject`.
  10065. *
  10066. * @param {Function} fn The function to call for each interceptor
  10067. *
  10068. * @returns {void}
  10069. */
  10070. forEach(fn) {
  10071. utils$1.forEach(this.handlers, function forEachHandler(h) {
  10072. if (h !== null) {
  10073. fn(h);
  10074. }
  10075. });
  10076. }
  10077. }
  10078.  
  10079. var InterceptorManager$1 = InterceptorManager;
  10080.  
  10081. var transitionalDefaults = {
  10082. silentJSONParsing: true,
  10083. forcedJSONParsing: true,
  10084. clarifyTimeoutError: false
  10085. };
  10086.  
  10087. var URLSearchParams$1 = typeof URLSearchParams !== 'undefined' ? URLSearchParams : AxiosURLSearchParams;
  10088.  
  10089. var FormData$1 = typeof FormData !== 'undefined' ? FormData : null;
  10090.  
  10091. var Blob$1 = typeof Blob !== 'undefined' ? Blob : null;
  10092.  
  10093. var platform$1 = {
  10094. isBrowser: true,
  10095. classes: {
  10096. URLSearchParams: URLSearchParams$1,
  10097. FormData: FormData$1,
  10098. Blob: Blob$1
  10099. },
  10100. protocols: ['http', 'https', 'file', 'blob', 'url', 'data']
  10101. };
  10102.  
  10103. const hasBrowserEnv = typeof window !== 'undefined' && typeof document !== 'undefined';
  10104.  
  10105. /**
  10106. * Determine if we're running in a standard browser environment
  10107. *
  10108. * This allows axios to run in a web worker, and react-native.
  10109. * Both environments support XMLHttpRequest, but not fully standard globals.
  10110. *
  10111. * web workers:
  10112. * typeof window -> undefined
  10113. * typeof document -> undefined
  10114. *
  10115. * react-native:
  10116. * navigator.product -> 'ReactNative'
  10117. * nativescript
  10118. * navigator.product -> 'NativeScript' or 'NS'
  10119. *
  10120. * @returns {boolean}
  10121. */
  10122. const hasStandardBrowserEnv = (
  10123. (product) => {
  10124. return hasBrowserEnv && ['ReactNative', 'NativeScript', 'NS'].indexOf(product) < 0
  10125. })(typeof navigator !== 'undefined' && navigator.product);
  10126.  
  10127. /**
  10128. * Determine if we're running in a standard browser webWorker environment
  10129. *
  10130. * Although the `isStandardBrowserEnv` method indicates that
  10131. * `allows axios to run in a web worker`, the WebWorker will still be
  10132. * filtered out due to its judgment standard
  10133. * `typeof window !== 'undefined' && typeof document !== 'undefined'`.
  10134. * This leads to a problem when axios post `FormData` in webWorker
  10135. */
  10136. const hasStandardBrowserWebWorkerEnv = (() => {
  10137. return (
  10138. typeof WorkerGlobalScope !== 'undefined' &&
  10139. // eslint-disable-next-line no-undef
  10140. self instanceof WorkerGlobalScope &&
  10141. typeof self.importScripts === 'function'
  10142. );
  10143. })();
  10144.  
  10145. const origin = hasBrowserEnv && window.location.href || 'http://localhost';
  10146.  
  10147. var utils = /*#__PURE__*/Object.freeze({
  10148. __proto__: null,
  10149. hasBrowserEnv: hasBrowserEnv,
  10150. hasStandardBrowserWebWorkerEnv: hasStandardBrowserWebWorkerEnv,
  10151. hasStandardBrowserEnv: hasStandardBrowserEnv,
  10152. origin: origin
  10153. });
  10154.  
  10155. var platform = {
  10156. ...utils,
  10157. ...platform$1
  10158. };
  10159.  
  10160. function toURLEncodedForm(data, options) {
  10161. return toFormData(data, new platform.classes.URLSearchParams(), Object.assign({
  10162. visitor: function(value, key, path, helpers) {
  10163. if (platform.isNode && utils$1.isBuffer(value)) {
  10164. this.append(key, value.toString('base64'));
  10165. return false;
  10166. }
  10167.  
  10168. return helpers.defaultVisitor.apply(this, arguments);
  10169. }
  10170. }, options));
  10171. }
  10172.  
  10173. /**
  10174. * It takes a string like `foo[x][y][z]` and returns an array like `['foo', 'x', 'y', 'z']
  10175. *
  10176. * @param {string} name - The name of the property to get.
  10177. *
  10178. * @returns An array of strings.
  10179. */
  10180. function parsePropPath(name) {
  10181. // foo[x][y][z]
  10182. // foo.x.y.z
  10183. // foo-x-y-z
  10184. // foo x y z
  10185. return utils$1.matchAll(/\w+|\[(\w*)]/g, name).map(match => {
  10186. return match[0] === '[]' ? '' : match[1] || match[0];
  10187. });
  10188. }
  10189.  
  10190. /**
  10191. * Convert an array to an object.
  10192. *
  10193. * @param {Array<any>} arr - The array to convert to an object.
  10194. *
  10195. * @returns An object with the same keys and values as the array.
  10196. */
  10197. function arrayToObject(arr) {
  10198. const obj = {};
  10199. const keys = Object.keys(arr);
  10200. let i;
  10201. const len = keys.length;
  10202. let key;
  10203. for (i = 0; i < len; i++) {
  10204. key = keys[i];
  10205. obj[key] = arr[key];
  10206. }
  10207. return obj;
  10208. }
  10209.  
  10210. /**
  10211. * It takes a FormData object and returns a JavaScript object
  10212. *
  10213. * @param {string} formData The FormData object to convert to JSON.
  10214. *
  10215. * @returns {Object<string, any> | null} The converted object.
  10216. */
  10217. function formDataToJSON(formData) {
  10218. function buildPath(path, value, target, index) {
  10219. let name = path[index++];
  10220.  
  10221. if (name === '__proto__') return true;
  10222.  
  10223. const isNumericKey = Number.isFinite(+name);
  10224. const isLast = index >= path.length;
  10225. name = !name && utils$1.isArray(target) ? target.length : name;
  10226.  
  10227. if (isLast) {
  10228. if (utils$1.hasOwnProp(target, name)) {
  10229. target[name] = [target[name], value];
  10230. } else {
  10231. target[name] = value;
  10232. }
  10233.  
  10234. return !isNumericKey;
  10235. }
  10236.  
  10237. if (!target[name] || !utils$1.isObject(target[name])) {
  10238. target[name] = [];
  10239. }
  10240.  
  10241. const result = buildPath(path, value, target[name], index);
  10242.  
  10243. if (result && utils$1.isArray(target[name])) {
  10244. target[name] = arrayToObject(target[name]);
  10245. }
  10246.  
  10247. return !isNumericKey;
  10248. }
  10249.  
  10250. if (utils$1.isFormData(formData) && utils$1.isFunction(formData.entries)) {
  10251. const obj = {};
  10252.  
  10253. utils$1.forEachEntry(formData, (name, value) => {
  10254. buildPath(parsePropPath(name), value, obj, 0);
  10255. });
  10256.  
  10257. return obj;
  10258. }
  10259.  
  10260. return null;
  10261. }
  10262.  
  10263. /**
  10264. * It takes a string, tries to parse it, and if it fails, it returns the stringified version
  10265. * of the input
  10266. *
  10267. * @param {any} rawValue - The value to be stringified.
  10268. * @param {Function} parser - A function that parses a string into a JavaScript object.
  10269. * @param {Function} encoder - A function that takes a value and returns a string.
  10270. *
  10271. * @returns {string} A stringified version of the rawValue.
  10272. */
  10273. function stringifySafely(rawValue, parser, encoder) {
  10274. if (utils$1.isString(rawValue)) {
  10275. try {
  10276. (parser || JSON.parse)(rawValue);
  10277. return utils$1.trim(rawValue);
  10278. } catch (e) {
  10279. if (e.name !== 'SyntaxError') {
  10280. throw e;
  10281. }
  10282. }
  10283. }
  10284.  
  10285. return (encoder || JSON.stringify)(rawValue);
  10286. }
  10287.  
  10288. const defaults = {
  10289.  
  10290. transitional: transitionalDefaults,
  10291.  
  10292. adapter: ['xhr', 'http', 'fetch'],
  10293.  
  10294. transformRequest: [function transformRequest(data, headers) {
  10295. const contentType = headers.getContentType() || '';
  10296. const hasJSONContentType = contentType.indexOf('application/json') > -1;
  10297. const isObjectPayload = utils$1.isObject(data);
  10298.  
  10299. if (isObjectPayload && utils$1.isHTMLForm(data)) {
  10300. data = new FormData(data);
  10301. }
  10302.  
  10303. const isFormData = utils$1.isFormData(data);
  10304.  
  10305. if (isFormData) {
  10306. return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data;
  10307. }
  10308.  
  10309. if (utils$1.isArrayBuffer(data) ||
  10310. utils$1.isBuffer(data) ||
  10311. utils$1.isStream(data) ||
  10312. utils$1.isFile(data) ||
  10313. utils$1.isBlob(data) ||
  10314. utils$1.isReadableStream(data)
  10315. ) {
  10316. return data;
  10317. }
  10318. if (utils$1.isArrayBufferView(data)) {
  10319. return data.buffer;
  10320. }
  10321. if (utils$1.isURLSearchParams(data)) {
  10322. headers.setContentType('application/x-www-form-urlencoded;charset=utf-8', false);
  10323. return data.toString();
  10324. }
  10325.  
  10326. let isFileList;
  10327.  
  10328. if (isObjectPayload) {
  10329. if (contentType.indexOf('application/x-www-form-urlencoded') > -1) {
  10330. return toURLEncodedForm(data, this.formSerializer).toString();
  10331. }
  10332.  
  10333. if ((isFileList = utils$1.isFileList(data)) || contentType.indexOf('multipart/form-data') > -1) {
  10334. const _FormData = this.env && this.env.FormData;
  10335.  
  10336. return toFormData(
  10337. isFileList ? {'files[]': data} : data,
  10338. _FormData && new _FormData(),
  10339. this.formSerializer
  10340. );
  10341. }
  10342. }
  10343.  
  10344. if (isObjectPayload || hasJSONContentType ) {
  10345. headers.setContentType('application/json', false);
  10346. return stringifySafely(data);
  10347. }
  10348.  
  10349. return data;
  10350. }],
  10351.  
  10352. transformResponse: [function transformResponse(data) {
  10353. const transitional = this.transitional || defaults.transitional;
  10354. const forcedJSONParsing = transitional && transitional.forcedJSONParsing;
  10355. const JSONRequested = this.responseType === 'json';
  10356.  
  10357. if (utils$1.isResponse(data) || utils$1.isReadableStream(data)) {
  10358. return data;
  10359. }
  10360.  
  10361. if (data && utils$1.isString(data) && ((forcedJSONParsing && !this.responseType) || JSONRequested)) {
  10362. const silentJSONParsing = transitional && transitional.silentJSONParsing;
  10363. const strictJSONParsing = !silentJSONParsing && JSONRequested;
  10364.  
  10365. try {
  10366. return JSON.parse(data);
  10367. } catch (e) {
  10368. if (strictJSONParsing) {
  10369. if (e.name === 'SyntaxError') {
  10370. throw AxiosError.from(e, AxiosError.ERR_BAD_RESPONSE, this, null, this.response);
  10371. }
  10372. throw e;
  10373. }
  10374. }
  10375. }
  10376.  
  10377. return data;
  10378. }],
  10379.  
  10380. /**
  10381. * A timeout in milliseconds to abort a request. If set to 0 (default) a
  10382. * timeout is not created.
  10383. */
  10384. timeout: 0,
  10385.  
  10386. xsrfCookieName: 'XSRF-TOKEN',
  10387. xsrfHeaderName: 'X-XSRF-TOKEN',
  10388.  
  10389. maxContentLength: -1,
  10390. maxBodyLength: -1,
  10391.  
  10392. env: {
  10393. FormData: platform.classes.FormData,
  10394. Blob: platform.classes.Blob
  10395. },
  10396.  
  10397. validateStatus: function validateStatus(status) {
  10398. return status >= 200 && status < 300;
  10399. },
  10400.  
  10401. headers: {
  10402. common: {
  10403. 'Accept': 'application/json, text/plain, */*',
  10404. 'Content-Type': undefined
  10405. }
  10406. }
  10407. };
  10408.  
  10409. utils$1.forEach(['delete', 'get', 'head', 'post', 'put', 'patch'], (method) => {
  10410. defaults.headers[method] = {};
  10411. });
  10412.  
  10413. var defaults$1 = defaults;
  10414.  
  10415. // RawAxiosHeaders whose duplicates are ignored by node
  10416. // c.f. https://nodejs.org/api/http.html#http_message_headers
  10417. const ignoreDuplicateOf = utils$1.toObjectSet([
  10418. 'age', 'authorization', 'content-length', 'content-type', 'etag',
  10419. 'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since',
  10420. 'last-modified', 'location', 'max-forwards', 'proxy-authorization',
  10421. 'referer', 'retry-after', 'user-agent'
  10422. ]);
  10423.  
  10424. /**
  10425. * Parse headers into an object
  10426. *
  10427. * ```
  10428. * Date: Wed, 27 Aug 2014 08:58:49 GMT
  10429. * Content-Type: application/json
  10430. * Connection: keep-alive
  10431. * Transfer-Encoding: chunked
  10432. * ```
  10433. *
  10434. * @param {String} rawHeaders Headers needing to be parsed
  10435. *
  10436. * @returns {Object} Headers parsed into an object
  10437. */
  10438. var parseHeaders = rawHeaders => {
  10439. const parsed = {};
  10440. let key;
  10441. let val;
  10442. let i;
  10443.  
  10444. rawHeaders && rawHeaders.split('\n').forEach(function parser(line) {
  10445. i = line.indexOf(':');
  10446. key = line.substring(0, i).trim().toLowerCase();
  10447. val = line.substring(i + 1).trim();
  10448.  
  10449. if (!key || (parsed[key] && ignoreDuplicateOf[key])) {
  10450. return;
  10451. }
  10452.  
  10453. if (key === 'set-cookie') {
  10454. if (parsed[key]) {
  10455. parsed[key].push(val);
  10456. } else {
  10457. parsed[key] = [val];
  10458. }
  10459. } else {
  10460. parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
  10461. }
  10462. });
  10463.  
  10464. return parsed;
  10465. };
  10466.  
  10467. const $internals = Symbol('internals');
  10468.  
  10469. function normalizeHeader(header) {
  10470. return header && String(header).trim().toLowerCase();
  10471. }
  10472.  
  10473. function normalizeValue(value) {
  10474. if (value === false || value == null) {
  10475. return value;
  10476. }
  10477.  
  10478. return utils$1.isArray(value) ? value.map(normalizeValue) : String(value);
  10479. }
  10480.  
  10481. function parseTokens(str) {
  10482. const tokens = Object.create(null);
  10483. const tokensRE = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;
  10484. let match;
  10485.  
  10486. while ((match = tokensRE.exec(str))) {
  10487. tokens[match[1]] = match[2];
  10488. }
  10489.  
  10490. return tokens;
  10491. }
  10492.  
  10493. const isValidHeaderName = (str) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str.trim());
  10494.  
  10495. function matchHeaderValue(context, value, header, filter, isHeaderNameFilter) {
  10496. if (utils$1.isFunction(filter)) {
  10497. return filter.call(this, value, header);
  10498. }
  10499.  
  10500. if (isHeaderNameFilter) {
  10501. value = header;
  10502. }
  10503.  
  10504. if (!utils$1.isString(value)) return;
  10505.  
  10506. if (utils$1.isString(filter)) {
  10507. return value.indexOf(filter) !== -1;
  10508. }
  10509.  
  10510. if (utils$1.isRegExp(filter)) {
  10511. return filter.test(value);
  10512. }
  10513. }
  10514.  
  10515. function formatHeader(header) {
  10516. return header.trim()
  10517. .toLowerCase().replace(/([a-z\d])(\w*)/g, (w, char, str) => {
  10518. return char.toUpperCase() + str;
  10519. });
  10520. }
  10521.  
  10522. function buildAccessors(obj, header) {
  10523. const accessorName = utils$1.toCamelCase(' ' + header);
  10524.  
  10525. ['get', 'set', 'has'].forEach(methodName => {
  10526. Object.defineProperty(obj, methodName + accessorName, {
  10527. value: function(arg1, arg2, arg3) {
  10528. return this[methodName].call(this, header, arg1, arg2, arg3);
  10529. },
  10530. configurable: true
  10531. });
  10532. });
  10533. }
  10534.  
  10535. class AxiosHeaders {
  10536. constructor(headers) {
  10537. headers && this.set(headers);
  10538. }
  10539.  
  10540. set(header, valueOrRewrite, rewrite) {
  10541. const self = this;
  10542.  
  10543. function setHeader(_value, _header, _rewrite) {
  10544. const lHeader = normalizeHeader(_header);
  10545.  
  10546. if (!lHeader) {
  10547. throw new Error('header name must be a non-empty string');
  10548. }
  10549.  
  10550. const key = utils$1.findKey(self, lHeader);
  10551.  
  10552. if(!key || self[key] === undefined || _rewrite === true || (_rewrite === undefined && self[key] !== false)) {
  10553. self[key || _header] = normalizeValue(_value);
  10554. }
  10555. }
  10556.  
  10557. const setHeaders = (headers, _rewrite) =>
  10558. utils$1.forEach(headers, (_value, _header) => setHeader(_value, _header, _rewrite));
  10559.  
  10560. if (utils$1.isPlainObject(header) || header instanceof this.constructor) {
  10561. setHeaders(header, valueOrRewrite);
  10562. } else if(utils$1.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
  10563. setHeaders(parseHeaders(header), valueOrRewrite);
  10564. } else if (utils$1.isHeaders(header)) {
  10565. for (const [key, value] of header.entries()) {
  10566. setHeader(value, key, rewrite);
  10567. }
  10568. } else {
  10569. header != null && setHeader(valueOrRewrite, header, rewrite);
  10570. }
  10571.  
  10572. return this;
  10573. }
  10574.  
  10575. get(header, parser) {
  10576. header = normalizeHeader(header);
  10577.  
  10578. if (header) {
  10579. const key = utils$1.findKey(this, header);
  10580.  
  10581. if (key) {
  10582. const value = this[key];
  10583.  
  10584. if (!parser) {
  10585. return value;
  10586. }
  10587.  
  10588. if (parser === true) {
  10589. return parseTokens(value);
  10590. }
  10591.  
  10592. if (utils$1.isFunction(parser)) {
  10593. return parser.call(this, value, key);
  10594. }
  10595.  
  10596. if (utils$1.isRegExp(parser)) {
  10597. return parser.exec(value);
  10598. }
  10599.  
  10600. throw new TypeError('parser must be boolean|regexp|function');
  10601. }
  10602. }
  10603. }
  10604.  
  10605. has(header, matcher) {
  10606. header = normalizeHeader(header);
  10607.  
  10608. if (header) {
  10609. const key = utils$1.findKey(this, header);
  10610.  
  10611. return !!(key && this[key] !== undefined && (!matcher || matchHeaderValue(this, this[key], key, matcher)));
  10612. }
  10613.  
  10614. return false;
  10615. }
  10616.  
  10617. delete(header, matcher) {
  10618. const self = this;
  10619. let deleted = false;
  10620.  
  10621. function deleteHeader(_header) {
  10622. _header = normalizeHeader(_header);
  10623.  
  10624. if (_header) {
  10625. const key = utils$1.findKey(self, _header);
  10626.  
  10627. if (key && (!matcher || matchHeaderValue(self, self[key], key, matcher))) {
  10628. delete self[key];
  10629.  
  10630. deleted = true;
  10631. }
  10632. }
  10633. }
  10634.  
  10635. if (utils$1.isArray(header)) {
  10636. header.forEach(deleteHeader);
  10637. } else {
  10638. deleteHeader(header);
  10639. }
  10640.  
  10641. return deleted;
  10642. }
  10643.  
  10644. clear(matcher) {
  10645. const keys = Object.keys(this);
  10646. let i = keys.length;
  10647. let deleted = false;
  10648.  
  10649. while (i--) {
  10650. const key = keys[i];
  10651. if(!matcher || matchHeaderValue(this, this[key], key, matcher, true)) {
  10652. delete this[key];
  10653. deleted = true;
  10654. }
  10655. }
  10656.  
  10657. return deleted;
  10658. }
  10659.  
  10660. normalize(format) {
  10661. const self = this;
  10662. const headers = {};
  10663.  
  10664. utils$1.forEach(this, (value, header) => {
  10665. const key = utils$1.findKey(headers, header);
  10666.  
  10667. if (key) {
  10668. self[key] = normalizeValue(value);
  10669. delete self[header];
  10670. return;
  10671. }
  10672.  
  10673. const normalized = format ? formatHeader(header) : String(header).trim();
  10674.  
  10675. if (normalized !== header) {
  10676. delete self[header];
  10677. }
  10678.  
  10679. self[normalized] = normalizeValue(value);
  10680.  
  10681. headers[normalized] = true;
  10682. });
  10683.  
  10684. return this;
  10685. }
  10686.  
  10687. concat(...targets) {
  10688. return this.constructor.concat(this, ...targets);
  10689. }
  10690.  
  10691. toJSON(asStrings) {
  10692. const obj = Object.create(null);
  10693.  
  10694. utils$1.forEach(this, (value, header) => {
  10695. value != null && value !== false && (obj[header] = asStrings && utils$1.isArray(value) ? value.join(', ') : value);
  10696. });
  10697.  
  10698. return obj;
  10699. }
  10700.  
  10701. [Symbol.iterator]() {
  10702. return Object.entries(this.toJSON())[Symbol.iterator]();
  10703. }
  10704.  
  10705. toString() {
  10706. return Object.entries(this.toJSON()).map(([header, value]) => header + ': ' + value).join('\n');
  10707. }
  10708.  
  10709. get [Symbol.toStringTag]() {
  10710. return 'AxiosHeaders';
  10711. }
  10712.  
  10713. static from(thing) {
  10714. return thing instanceof this ? thing : new this(thing);
  10715. }
  10716.  
  10717. static concat(first, ...targets) {
  10718. const computed = new this(first);
  10719.  
  10720. targets.forEach((target) => computed.set(target));
  10721.  
  10722. return computed;
  10723. }
  10724.  
  10725. static accessor(header) {
  10726. const internals = this[$internals] = (this[$internals] = {
  10727. accessors: {}
  10728. });
  10729.  
  10730. const accessors = internals.accessors;
  10731. const prototype = this.prototype;
  10732.  
  10733. function defineAccessor(_header) {
  10734. const lHeader = normalizeHeader(_header);
  10735.  
  10736. if (!accessors[lHeader]) {
  10737. buildAccessors(prototype, _header);
  10738. accessors[lHeader] = true;
  10739. }
  10740. }
  10741.  
  10742. utils$1.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header);
  10743.  
  10744. return this;
  10745. }
  10746. }
  10747.  
  10748. AxiosHeaders.accessor(['Content-Type', 'Content-Length', 'Accept', 'Accept-Encoding', 'User-Agent', 'Authorization']);
  10749.  
  10750. // reserved names hotfix
  10751. utils$1.reduceDescriptors(AxiosHeaders.prototype, ({value}, key) => {
  10752. let mapped = key[0].toUpperCase() + key.slice(1); // map `set` => `Set`
  10753. return {
  10754. get: () => value,
  10755. set(headerValue) {
  10756. this[mapped] = headerValue;
  10757. }
  10758. }
  10759. });
  10760.  
  10761. utils$1.freezeMethods(AxiosHeaders);
  10762.  
  10763. var AxiosHeaders$1 = AxiosHeaders;
  10764.  
  10765. /**
  10766. * Transform the data for a request or a response
  10767. *
  10768. * @param {Array|Function} fns A single function or Array of functions
  10769. * @param {?Object} response The response object
  10770. *
  10771. * @returns {*} The resulting transformed data
  10772. */
  10773. function transformData(fns, response) {
  10774. const config = this || defaults$1;
  10775. const context = response || config;
  10776. const headers = AxiosHeaders$1.from(context.headers);
  10777. let data = context.data;
  10778.  
  10779. utils$1.forEach(fns, function transform(fn) {
  10780. data = fn.call(config, data, headers.normalize(), response ? response.status : undefined);
  10781. });
  10782.  
  10783. headers.normalize();
  10784.  
  10785. return data;
  10786. }
  10787.  
  10788. function isCancel(value) {
  10789. return !!(value && value.__CANCEL__);
  10790. }
  10791.  
  10792. /**
  10793. * A `CanceledError` is an object that is thrown when an operation is canceled.
  10794. *
  10795. * @param {string=} message The message.
  10796. * @param {Object=} config The config.
  10797. * @param {Object=} request The request.
  10798. *
  10799. * @returns {CanceledError} The created error.
  10800. */
  10801. function CanceledError(message, config, request) {
  10802. // eslint-disable-next-line no-eq-null,eqeqeq
  10803. AxiosError.call(this, message == null ? 'canceled' : message, AxiosError.ERR_CANCELED, config, request);
  10804. this.name = 'CanceledError';
  10805. }
  10806.  
  10807. utils$1.inherits(CanceledError, AxiosError, {
  10808. __CANCEL__: true
  10809. });
  10810.  
  10811. /**
  10812. * Resolve or reject a Promise based on response status.
  10813. *
  10814. * @param {Function} resolve A function that resolves the promise.
  10815. * @param {Function} reject A function that rejects the promise.
  10816. * @param {object} response The response.
  10817. *
  10818. * @returns {object} The response.
  10819. */
  10820. function settle(resolve, reject, response) {
  10821. const validateStatus = response.config.validateStatus;
  10822. if (!response.status || !validateStatus || validateStatus(response.status)) {
  10823. resolve(response);
  10824. } else {
  10825. reject(new AxiosError(
  10826. 'Request failed with status code ' + response.status,
  10827. [AxiosError.ERR_BAD_REQUEST, AxiosError.ERR_BAD_RESPONSE][Math.floor(response.status / 100) - 4],
  10828. response.config,
  10829. response.request,
  10830. response
  10831. ));
  10832. }
  10833. }
  10834.  
  10835. function parseProtocol(url) {
  10836. const match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url);
  10837. return match && match[1] || '';
  10838. }
  10839.  
  10840. /**
  10841. * Calculate data maxRate
  10842. * @param {Number} [samplesCount= 10]
  10843. * @param {Number} [min= 1000]
  10844. * @returns {Function}
  10845. */
  10846. function speedometer(samplesCount, min) {
  10847. samplesCount = samplesCount || 10;
  10848. const bytes = new Array(samplesCount);
  10849. const timestamps = new Array(samplesCount);
  10850. let head = 0;
  10851. let tail = 0;
  10852. let firstSampleTS;
  10853.  
  10854. min = min !== undefined ? min : 1000;
  10855.  
  10856. return function push(chunkLength) {
  10857. const now = Date.now();
  10858.  
  10859. const startedAt = timestamps[tail];
  10860.  
  10861. if (!firstSampleTS) {
  10862. firstSampleTS = now;
  10863. }
  10864.  
  10865. bytes[head] = chunkLength;
  10866. timestamps[head] = now;
  10867.  
  10868. let i = tail;
  10869. let bytesCount = 0;
  10870.  
  10871. while (i !== head) {
  10872. bytesCount += bytes[i++];
  10873. i = i % samplesCount;
  10874. }
  10875.  
  10876. head = (head + 1) % samplesCount;
  10877.  
  10878. if (head === tail) {
  10879. tail = (tail + 1) % samplesCount;
  10880. }
  10881.  
  10882. if (now - firstSampleTS < min) {
  10883. return;
  10884. }
  10885.  
  10886. const passed = startedAt && now - startedAt;
  10887.  
  10888. return passed ? Math.round(bytesCount * 1000 / passed) : undefined;
  10889. };
  10890. }
  10891.  
  10892. /**
  10893. * Throttle decorator
  10894. * @param {Function} fn
  10895. * @param {Number} freq
  10896. * @return {Function}
  10897. */
  10898. function throttle(fn, freq) {
  10899. let timestamp = 0;
  10900. let threshold = 1000 / freq;
  10901. let lastArgs;
  10902. let timer;
  10903.  
  10904. const invoke = (args, now = Date.now()) => {
  10905. timestamp = now;
  10906. lastArgs = null;
  10907. if (timer) {
  10908. clearTimeout(timer);
  10909. timer = null;
  10910. }
  10911. fn.apply(null, args);
  10912. };
  10913.  
  10914. const throttled = (...args) => {
  10915. const now = Date.now();
  10916. const passed = now - timestamp;
  10917. if ( passed >= threshold) {
  10918. invoke(args, now);
  10919. } else {
  10920. lastArgs = args;
  10921. if (!timer) {
  10922. timer = setTimeout(() => {
  10923. timer = null;
  10924. invoke(lastArgs);
  10925. }, threshold - passed);
  10926. }
  10927. }
  10928. };
  10929.  
  10930. const flush = () => lastArgs && invoke(lastArgs);
  10931.  
  10932. return [throttled, flush];
  10933. }
  10934.  
  10935. const progressEventReducer = (listener, isDownloadStream, freq = 3) => {
  10936. let bytesNotified = 0;
  10937. const _speedometer = speedometer(50, 250);
  10938.  
  10939. return throttle(e => {
  10940. const loaded = e.loaded;
  10941. const total = e.lengthComputable ? e.total : undefined;
  10942. const progressBytes = loaded - bytesNotified;
  10943. const rate = _speedometer(progressBytes);
  10944. const inRange = loaded <= total;
  10945.  
  10946. bytesNotified = loaded;
  10947.  
  10948. const data = {
  10949. loaded,
  10950. total,
  10951. progress: total ? (loaded / total) : undefined,
  10952. bytes: progressBytes,
  10953. rate: rate ? rate : undefined,
  10954. estimated: rate && total && inRange ? (total - loaded) / rate : undefined,
  10955. event: e,
  10956. lengthComputable: total != null,
  10957. [isDownloadStream ? 'download' : 'upload']: true
  10958. };
  10959.  
  10960. listener(data);
  10961. }, freq);
  10962. };
  10963.  
  10964. const progressEventDecorator = (total, throttled) => {
  10965. const lengthComputable = total != null;
  10966.  
  10967. return [(loaded) => throttled[0]({
  10968. lengthComputable,
  10969. total,
  10970. loaded
  10971. }), throttled[1]];
  10972. };
  10973.  
  10974. const asyncDecorator = (fn) => (...args) => utils$1.asap(() => fn(...args));
  10975.  
  10976. var isURLSameOrigin = platform.hasStandardBrowserEnv ?
  10977.  
  10978. // Standard browser envs have full support of the APIs needed to test
  10979. // whether the request URL is of the same origin as current location.
  10980. (function standardBrowserEnv() {
  10981. const msie = /(msie|trident)/i.test(navigator.userAgent);
  10982. const urlParsingNode = document.createElement('a');
  10983. let originURL;
  10984.  
  10985. /**
  10986. * Parse a URL to discover its components
  10987. *
  10988. * @param {String} url The URL to be parsed
  10989. * @returns {Object}
  10990. */
  10991. function resolveURL(url) {
  10992. let href = url;
  10993.  
  10994. if (msie) {
  10995. // IE needs attribute set twice to normalize properties
  10996. urlParsingNode.setAttribute('href', href);
  10997. href = urlParsingNode.href;
  10998. }
  10999.  
  11000. urlParsingNode.setAttribute('href', href);
  11001.  
  11002. // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils
  11003. return {
  11004. href: urlParsingNode.href,
  11005. protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',
  11006. host: urlParsingNode.host,
  11007. search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '',
  11008. hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',
  11009. hostname: urlParsingNode.hostname,
  11010. port: urlParsingNode.port,
  11011. pathname: (urlParsingNode.pathname.charAt(0) === '/') ?
  11012. urlParsingNode.pathname :
  11013. '/' + urlParsingNode.pathname
  11014. };
  11015. }
  11016.  
  11017. originURL = resolveURL(window.location.href);
  11018.  
  11019. /**
  11020. * Determine if a URL shares the same origin as the current location
  11021. *
  11022. * @param {String} requestURL The URL to test
  11023. * @returns {boolean} True if URL shares the same origin, otherwise false
  11024. */
  11025. return function isURLSameOrigin(requestURL) {
  11026. const parsed = (utils$1.isString(requestURL)) ? resolveURL(requestURL) : requestURL;
  11027. return (parsed.protocol === originURL.protocol &&
  11028. parsed.host === originURL.host);
  11029. };
  11030. })() :
  11031.  
  11032. // Non standard browser envs (web workers, react-native) lack needed support.
  11033. (function nonStandardBrowserEnv() {
  11034. return function isURLSameOrigin() {
  11035. return true;
  11036. };
  11037. })();
  11038.  
  11039. var cookies = platform.hasStandardBrowserEnv ?
  11040.  
  11041. // Standard browser envs support document.cookie
  11042. {
  11043. write(name, value, expires, path, domain, secure) {
  11044. const cookie = [name + '=' + encodeURIComponent(value)];
  11045.  
  11046. utils$1.isNumber(expires) && cookie.push('expires=' + new Date(expires).toGMTString());
  11047.  
  11048. utils$1.isString(path) && cookie.push('path=' + path);
  11049.  
  11050. utils$1.isString(domain) && cookie.push('domain=' + domain);
  11051.  
  11052. secure === true && cookie.push('secure');
  11053.  
  11054. document.cookie = cookie.join('; ');
  11055. },
  11056.  
  11057. read(name) {
  11058. const match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)'));
  11059. return (match ? decodeURIComponent(match[3]) : null);
  11060. },
  11061.  
  11062. remove(name) {
  11063. this.write(name, '', Date.now() - 86400000);
  11064. }
  11065. }
  11066.  
  11067. :
  11068.  
  11069. // Non-standard browser env (web workers, react-native) lack needed support.
  11070. {
  11071. write() {},
  11072. read() {
  11073. return null;
  11074. },
  11075. remove() {}
  11076. };
  11077.  
  11078. /**
  11079. * Determines whether the specified URL is absolute
  11080. *
  11081. * @param {string} url The URL to test
  11082. *
  11083. * @returns {boolean} True if the specified URL is absolute, otherwise false
  11084. */
  11085. function isAbsoluteURL(url) {
  11086. // A URL is considered absolute if it begins with "<scheme>://" or "//" (protocol-relative URL).
  11087. // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed
  11088. // by any combination of letters, digits, plus, period, or hyphen.
  11089. return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(url);
  11090. }
  11091.  
  11092. /**
  11093. * Creates a new URL by combining the specified URLs
  11094. *
  11095. * @param {string} baseURL The base URL
  11096. * @param {string} relativeURL The relative URL
  11097. *
  11098. * @returns {string} The combined URL
  11099. */
  11100. function combineURLs(baseURL, relativeURL) {
  11101. return relativeURL
  11102. ? baseURL.replace(/\/?\/$/, '') + '/' + relativeURL.replace(/^\/+/, '')
  11103. : baseURL;
  11104. }
  11105.  
  11106. /**
  11107. * Creates a new URL by combining the baseURL with the requestedURL,
  11108. * only when the requestedURL is not already an absolute URL.
  11109. * If the requestURL is absolute, this function returns the requestedURL untouched.
  11110. *
  11111. * @param {string} baseURL The base URL
  11112. * @param {string} requestedURL Absolute or relative URL to combine
  11113. *
  11114. * @returns {string} The combined full path
  11115. */
  11116. function buildFullPath(baseURL, requestedURL) {
  11117. if (baseURL && !isAbsoluteURL(requestedURL)) {
  11118. return combineURLs(baseURL, requestedURL);
  11119. }
  11120. return requestedURL;
  11121. }
  11122.  
  11123. const headersToObject = (thing) => thing instanceof AxiosHeaders$1 ? { ...thing } : thing;
  11124.  
  11125. /**
  11126. * Config-specific merge-function which creates a new config-object
  11127. * by merging two configuration objects together.
  11128. *
  11129. * @param {Object} config1
  11130. * @param {Object} config2
  11131. *
  11132. * @returns {Object} New object resulting from merging config2 to config1
  11133. */
  11134. function mergeConfig(config1, config2) {
  11135. // eslint-disable-next-line no-param-reassign
  11136. config2 = config2 || {};
  11137. const config = {};
  11138.  
  11139. function getMergedValue(target, source, caseless) {
  11140. if (utils$1.isPlainObject(target) && utils$1.isPlainObject(source)) {
  11141. return utils$1.merge.call({caseless}, target, source);
  11142. } else if (utils$1.isPlainObject(source)) {
  11143. return utils$1.merge({}, source);
  11144. } else if (utils$1.isArray(source)) {
  11145. return source.slice();
  11146. }
  11147. return source;
  11148. }
  11149.  
  11150. // eslint-disable-next-line consistent-return
  11151. function mergeDeepProperties(a, b, caseless) {
  11152. if (!utils$1.isUndefined(b)) {
  11153. return getMergedValue(a, b, caseless);
  11154. } else if (!utils$1.isUndefined(a)) {
  11155. return getMergedValue(undefined, a, caseless);
  11156. }
  11157. }
  11158.  
  11159. // eslint-disable-next-line consistent-return
  11160. function valueFromConfig2(a, b) {
  11161. if (!utils$1.isUndefined(b)) {
  11162. return getMergedValue(undefined, b);
  11163. }
  11164. }
  11165.  
  11166. // eslint-disable-next-line consistent-return
  11167. function defaultToConfig2(a, b) {
  11168. if (!utils$1.isUndefined(b)) {
  11169. return getMergedValue(undefined, b);
  11170. } else if (!utils$1.isUndefined(a)) {
  11171. return getMergedValue(undefined, a);
  11172. }
  11173. }
  11174.  
  11175. // eslint-disable-next-line consistent-return
  11176. function mergeDirectKeys(a, b, prop) {
  11177. if (prop in config2) {
  11178. return getMergedValue(a, b);
  11179. } else if (prop in config1) {
  11180. return getMergedValue(undefined, a);
  11181. }
  11182. }
  11183.  
  11184. const mergeMap = {
  11185. url: valueFromConfig2,
  11186. method: valueFromConfig2,
  11187. data: valueFromConfig2,
  11188. baseURL: defaultToConfig2,
  11189. transformRequest: defaultToConfig2,
  11190. transformResponse: defaultToConfig2,
  11191. paramsSerializer: defaultToConfig2,
  11192. timeout: defaultToConfig2,
  11193. timeoutMessage: defaultToConfig2,
  11194. withCredentials: defaultToConfig2,
  11195. withXSRFToken: defaultToConfig2,
  11196. adapter: defaultToConfig2,
  11197. responseType: defaultToConfig2,
  11198. xsrfCookieName: defaultToConfig2,
  11199. xsrfHeaderName: defaultToConfig2,
  11200. onUploadProgress: defaultToConfig2,
  11201. onDownloadProgress: defaultToConfig2,
  11202. decompress: defaultToConfig2,
  11203. maxContentLength: defaultToConfig2,
  11204. maxBodyLength: defaultToConfig2,
  11205. beforeRedirect: defaultToConfig2,
  11206. transport: defaultToConfig2,
  11207. httpAgent: defaultToConfig2,
  11208. httpsAgent: defaultToConfig2,
  11209. cancelToken: defaultToConfig2,
  11210. socketPath: defaultToConfig2,
  11211. responseEncoding: defaultToConfig2,
  11212. validateStatus: mergeDirectKeys,
  11213. headers: (a, b) => mergeDeepProperties(headersToObject(a), headersToObject(b), true)
  11214. };
  11215.  
  11216. utils$1.forEach(Object.keys(Object.assign({}, config1, config2)), function computeConfigValue(prop) {
  11217. const merge = mergeMap[prop] || mergeDeepProperties;
  11218. const configValue = merge(config1[prop], config2[prop], prop);
  11219. (utils$1.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);
  11220. });
  11221.  
  11222. return config;
  11223. }
  11224.  
  11225. var resolveConfig = (config) => {
  11226. const newConfig = mergeConfig({}, config);
  11227.  
  11228. let {data, withXSRFToken, xsrfHeaderName, xsrfCookieName, headers, auth} = newConfig;
  11229.  
  11230. newConfig.headers = headers = AxiosHeaders$1.from(headers);
  11231.  
  11232. newConfig.url = buildURL(buildFullPath(newConfig.baseURL, newConfig.url), config.params, config.paramsSerializer);
  11233.  
  11234. // HTTP basic authentication
  11235. if (auth) {
  11236. headers.set('Authorization', 'Basic ' +
  11237. btoa((auth.username || '') + ':' + (auth.password ? unescape(encodeURIComponent(auth.password)) : ''))
  11238. );
  11239. }
  11240.  
  11241. let contentType;
  11242.  
  11243. if (utils$1.isFormData(data)) {
  11244. if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv) {
  11245. headers.setContentType(undefined); // Let the browser set it
  11246. } else if ((contentType = headers.getContentType()) !== false) {
  11247. // fix semicolon duplication issue for ReactNative FormData implementation
  11248. const [type, ...tokens] = contentType ? contentType.split(';').map(token => token.trim()).filter(Boolean) : [];
  11249. headers.setContentType([type || 'multipart/form-data', ...tokens].join('; '));
  11250. }
  11251. }
  11252.  
  11253. // Add xsrf header
  11254. // This is only done if running in a standard browser environment.
  11255. // Specifically not if we're in a web worker, or react-native.
  11256.  
  11257. if (platform.hasStandardBrowserEnv) {
  11258. withXSRFToken && utils$1.isFunction(withXSRFToken) && (withXSRFToken = withXSRFToken(newConfig));
  11259.  
  11260. if (withXSRFToken || (withXSRFToken !== false && isURLSameOrigin(newConfig.url))) {
  11261. // Add xsrf header
  11262. const xsrfValue = xsrfHeaderName && xsrfCookieName && cookies.read(xsrfCookieName);
  11263.  
  11264. if (xsrfValue) {
  11265. headers.set(xsrfHeaderName, xsrfValue);
  11266. }
  11267. }
  11268. }
  11269.  
  11270. return newConfig;
  11271. };
  11272.  
  11273. const isXHRAdapterSupported = typeof XMLHttpRequest !== 'undefined';
  11274.  
  11275. var xhrAdapter = isXHRAdapterSupported && function (config) {
  11276. return new Promise(function dispatchXhrRequest(resolve, reject) {
  11277. const _config = resolveConfig(config);
  11278. let requestData = _config.data;
  11279. const requestHeaders = AxiosHeaders$1.from(_config.headers).normalize();
  11280. let {responseType, onUploadProgress, onDownloadProgress} = _config;
  11281. let onCanceled;
  11282. let uploadThrottled, downloadThrottled;
  11283. let flushUpload, flushDownload;
  11284.  
  11285. function done() {
  11286. flushUpload && flushUpload(); // flush events
  11287. flushDownload && flushDownload(); // flush events
  11288.  
  11289. _config.cancelToken && _config.cancelToken.unsubscribe(onCanceled);
  11290.  
  11291. _config.signal && _config.signal.removeEventListener('abort', onCanceled);
  11292. }
  11293.  
  11294. let request = new XMLHttpRequest();
  11295.  
  11296. request.open(_config.method.toUpperCase(), _config.url, true);
  11297.  
  11298. // Set the request timeout in MS
  11299. request.timeout = _config.timeout;
  11300.  
  11301. function onloadend() {
  11302. if (!request) {
  11303. return;
  11304. }
  11305. // Prepare the response
  11306. const responseHeaders = AxiosHeaders$1.from(
  11307. 'getAllResponseHeaders' in request && request.getAllResponseHeaders()
  11308. );
  11309. const responseData = !responseType || responseType === 'text' || responseType === 'json' ?
  11310. request.responseText : request.response;
  11311. const response = {
  11312. data: responseData,
  11313. status: request.status,
  11314. statusText: request.statusText,
  11315. headers: responseHeaders,
  11316. config,
  11317. request
  11318. };
  11319.  
  11320. settle(function _resolve(value) {
  11321. resolve(value);
  11322. done();
  11323. }, function _reject(err) {
  11324. reject(err);
  11325. done();
  11326. }, response);
  11327.  
  11328. // Clean up request
  11329. request = null;
  11330. }
  11331.  
  11332. if ('onloadend' in request) {
  11333. // Use onloadend if available
  11334. request.onloadend = onloadend;
  11335. } else {
  11336. // Listen for ready state to emulate onloadend
  11337. request.onreadystatechange = function handleLoad() {
  11338. if (!request || request.readyState !== 4) {
  11339. return;
  11340. }
  11341.  
  11342. // The request errored out and we didn't get a response, this will be
  11343. // handled by onerror instead
  11344. // With one exception: request that using file: protocol, most browsers
  11345. // will return status as 0 even though it's a successful request
  11346. if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) {
  11347. return;
  11348. }
  11349. // readystate handler is calling before onerror or ontimeout handlers,
  11350. // so we should call onloadend on the next 'tick'
  11351. setTimeout(onloadend);
  11352. };
  11353. }
  11354.  
  11355. // Handle browser request cancellation (as opposed to a manual cancellation)
  11356. request.onabort = function handleAbort() {
  11357. if (!request) {
  11358. return;
  11359. }
  11360.  
  11361. reject(new AxiosError('Request aborted', AxiosError.ECONNABORTED, config, request));
  11362.  
  11363. // Clean up request
  11364. request = null;
  11365. };
  11366.  
  11367. // Handle low level network errors
  11368. request.onerror = function handleError() {
  11369. // Real errors are hidden from us by the browser
  11370. // onerror should only fire if it's a network error
  11371. reject(new AxiosError('Network Error', AxiosError.ERR_NETWORK, config, request));
  11372.  
  11373. // Clean up request
  11374. request = null;
  11375. };
  11376.  
  11377. // Handle timeout
  11378. request.ontimeout = function handleTimeout() {
  11379. let timeoutErrorMessage = _config.timeout ? 'timeout of ' + _config.timeout + 'ms exceeded' : 'timeout exceeded';
  11380. const transitional = _config.transitional || transitionalDefaults;
  11381. if (_config.timeoutErrorMessage) {
  11382. timeoutErrorMessage = _config.timeoutErrorMessage;
  11383. }
  11384. reject(new AxiosError(
  11385. timeoutErrorMessage,
  11386. transitional.clarifyTimeoutError ? AxiosError.ETIMEDOUT : AxiosError.ECONNABORTED,
  11387. config,
  11388. request));
  11389.  
  11390. // Clean up request
  11391. request = null;
  11392. };
  11393.  
  11394. // Remove Content-Type if data is undefined
  11395. requestData === undefined && requestHeaders.setContentType(null);
  11396.  
  11397. // Add headers to the request
  11398. if ('setRequestHeader' in request) {
  11399. utils$1.forEach(requestHeaders.toJSON(), function setRequestHeader(val, key) {
  11400. request.setRequestHeader(key, val);
  11401. });
  11402. }
  11403.  
  11404. // Add withCredentials to request if needed
  11405. if (!utils$1.isUndefined(_config.withCredentials)) {
  11406. request.withCredentials = !!_config.withCredentials;
  11407. }
  11408.  
  11409. // Add responseType to request if needed
  11410. if (responseType && responseType !== 'json') {
  11411. request.responseType = _config.responseType;
  11412. }
  11413.  
  11414. // Handle progress if needed
  11415. if (onDownloadProgress) {
  11416. ([downloadThrottled, flushDownload] = progressEventReducer(onDownloadProgress, true));
  11417. request.addEventListener('progress', downloadThrottled);
  11418. }
  11419.  
  11420. // Not all browsers support upload events
  11421. if (onUploadProgress && request.upload) {
  11422. ([uploadThrottled, flushUpload] = progressEventReducer(onUploadProgress));
  11423.  
  11424. request.upload.addEventListener('progress', uploadThrottled);
  11425.  
  11426. request.upload.addEventListener('loadend', flushUpload);
  11427. }
  11428.  
  11429. if (_config.cancelToken || _config.signal) {
  11430. // Handle cancellation
  11431. // eslint-disable-next-line func-names
  11432. onCanceled = cancel => {
  11433. if (!request) {
  11434. return;
  11435. }
  11436. reject(!cancel || cancel.type ? new CanceledError(null, config, request) : cancel);
  11437. request.abort();
  11438. request = null;
  11439. };
  11440.  
  11441. _config.cancelToken && _config.cancelToken.subscribe(onCanceled);
  11442. if (_config.signal) {
  11443. _config.signal.aborted ? onCanceled() : _config.signal.addEventListener('abort', onCanceled);
  11444. }
  11445. }
  11446.  
  11447. const protocol = parseProtocol(_config.url);
  11448.  
  11449. if (protocol && platform.protocols.indexOf(protocol) === -1) {
  11450. reject(new AxiosError('Unsupported protocol ' + protocol + ':', AxiosError.ERR_BAD_REQUEST, config));
  11451. return;
  11452. }
  11453.  
  11454.  
  11455. // Send the request
  11456. request.send(requestData || null);
  11457. });
  11458. };
  11459.  
  11460. const composeSignals = (signals, timeout) => {
  11461. let controller = new AbortController();
  11462.  
  11463. let aborted;
  11464.  
  11465. const onabort = function (cancel) {
  11466. if (!aborted) {
  11467. aborted = true;
  11468. unsubscribe();
  11469. const err = cancel instanceof Error ? cancel : this.reason;
  11470. controller.abort(err instanceof AxiosError ? err : new CanceledError(err instanceof Error ? err.message : err));
  11471. }
  11472. };
  11473.  
  11474. let timer = timeout && setTimeout(() => {
  11475. onabort(new AxiosError(`timeout ${timeout} of ms exceeded`, AxiosError.ETIMEDOUT));
  11476. }, timeout);
  11477.  
  11478. const unsubscribe = () => {
  11479. if (signals) {
  11480. timer && clearTimeout(timer);
  11481. timer = null;
  11482. signals.forEach(signal => {
  11483. signal &&
  11484. (signal.removeEventListener ? signal.removeEventListener('abort', onabort) : signal.unsubscribe(onabort));
  11485. });
  11486. signals = null;
  11487. }
  11488. };
  11489.  
  11490. signals.forEach((signal) => signal && signal.addEventListener && signal.addEventListener('abort', onabort));
  11491.  
  11492. const {signal} = controller;
  11493.  
  11494. signal.unsubscribe = unsubscribe;
  11495.  
  11496. return [signal, () => {
  11497. timer && clearTimeout(timer);
  11498. timer = null;
  11499. }];
  11500. };
  11501.  
  11502. var composeSignals$1 = composeSignals;
  11503.  
  11504. const streamChunk = function* (chunk, chunkSize) {
  11505. let len = chunk.byteLength;
  11506.  
  11507. if (!chunkSize || len < chunkSize) {
  11508. yield chunk;
  11509. return;
  11510. }
  11511.  
  11512. let pos = 0;
  11513. let end;
  11514.  
  11515. while (pos < len) {
  11516. end = pos + chunkSize;
  11517. yield chunk.slice(pos, end);
  11518. pos = end;
  11519. }
  11520. };
  11521.  
  11522. const readBytes = async function* (iterable, chunkSize, encode) {
  11523. for await (const chunk of iterable) {
  11524. yield* streamChunk(ArrayBuffer.isView(chunk) ? chunk : (await encode(String(chunk))), chunkSize);
  11525. }
  11526. };
  11527.  
  11528. const trackStream = (stream, chunkSize, onProgress, onFinish, encode) => {
  11529. const iterator = readBytes(stream, chunkSize, encode);
  11530.  
  11531. let bytes = 0;
  11532. let done;
  11533. let _onFinish = (e) => {
  11534. if (!done) {
  11535. done = true;
  11536. onFinish && onFinish(e);
  11537. }
  11538. };
  11539.  
  11540. return new ReadableStream({
  11541. async pull(controller) {
  11542. try {
  11543. const {done, value} = await iterator.next();
  11544.  
  11545. if (done) {
  11546. _onFinish();
  11547. controller.close();
  11548. return;
  11549. }
  11550.  
  11551. let len = value.byteLength;
  11552. if (onProgress) {
  11553. let loadedBytes = bytes += len;
  11554. onProgress(loadedBytes);
  11555. }
  11556. controller.enqueue(new Uint8Array(value));
  11557. } catch (err) {
  11558. _onFinish(err);
  11559. throw err;
  11560. }
  11561. },
  11562. cancel(reason) {
  11563. _onFinish(reason);
  11564. return iterator.return();
  11565. }
  11566. }, {
  11567. highWaterMark: 2
  11568. })
  11569. };
  11570.  
  11571. const isFetchSupported = typeof fetch === 'function' && typeof Request === 'function' && typeof Response === 'function';
  11572. const isReadableStreamSupported = isFetchSupported && typeof ReadableStream === 'function';
  11573.  
  11574. // used only inside the fetch adapter
  11575. const encodeText = isFetchSupported && (typeof TextEncoder === 'function' ?
  11576. ((encoder) => (str) => encoder.encode(str))(new TextEncoder()) :
  11577. async (str) => new Uint8Array(await new Response(str).arrayBuffer())
  11578. );
  11579.  
  11580. const test = (fn, ...args) => {
  11581. try {
  11582. return !!fn(...args);
  11583. } catch (e) {
  11584. return false
  11585. }
  11586. };
  11587.  
  11588. const supportsRequestStream = isReadableStreamSupported && test(() => {
  11589. let duplexAccessed = false;
  11590.  
  11591. const hasContentType = new Request(platform.origin, {
  11592. body: new ReadableStream(),
  11593. method: 'POST',
  11594. get duplex() {
  11595. duplexAccessed = true;
  11596. return 'half';
  11597. },
  11598. }).headers.has('Content-Type');
  11599.  
  11600. return duplexAccessed && !hasContentType;
  11601. });
  11602.  
  11603. const DEFAULT_CHUNK_SIZE = 64 * 1024;
  11604.  
  11605. const supportsResponseStream = isReadableStreamSupported &&
  11606. test(() => utils$1.isReadableStream(new Response('').body));
  11607.  
  11608.  
  11609. const resolvers = {
  11610. stream: supportsResponseStream && ((res) => res.body)
  11611. };
  11612.  
  11613. isFetchSupported && (((res) => {
  11614. ['text', 'arrayBuffer', 'blob', 'formData', 'stream'].forEach(type => {
  11615. !resolvers[type] && (resolvers[type] = utils$1.isFunction(res[type]) ? (res) => res[type]() :
  11616. (_, config) => {
  11617. throw new AxiosError(`Response type '${type}' is not supported`, AxiosError.ERR_NOT_SUPPORT, config);
  11618. });
  11619. });
  11620. })(new Response));
  11621.  
  11622. const getBodyLength = async (body) => {
  11623. if (body == null) {
  11624. return 0;
  11625. }
  11626.  
  11627. if(utils$1.isBlob(body)) {
  11628. return body.size;
  11629. }
  11630.  
  11631. if(utils$1.isSpecCompliantForm(body)) {
  11632. return (await new Request(body).arrayBuffer()).byteLength;
  11633. }
  11634.  
  11635. if(utils$1.isArrayBufferView(body) || utils$1.isArrayBuffer(body)) {
  11636. return body.byteLength;
  11637. }
  11638.  
  11639. if(utils$1.isURLSearchParams(body)) {
  11640. body = body + '';
  11641. }
  11642.  
  11643. if(utils$1.isString(body)) {
  11644. return (await encodeText(body)).byteLength;
  11645. }
  11646. };
  11647.  
  11648. const resolveBodyLength = async (headers, body) => {
  11649. const length = utils$1.toFiniteNumber(headers.getContentLength());
  11650.  
  11651. return length == null ? getBodyLength(body) : length;
  11652. };
  11653.  
  11654. var fetchAdapter = isFetchSupported && (async (config) => {
  11655. let {
  11656. url,
  11657. method,
  11658. data,
  11659. signal,
  11660. cancelToken,
  11661. timeout,
  11662. onDownloadProgress,
  11663. onUploadProgress,
  11664. responseType,
  11665. headers,
  11666. withCredentials = 'same-origin',
  11667. fetchOptions
  11668. } = resolveConfig(config);
  11669.  
  11670. responseType = responseType ? (responseType + '').toLowerCase() : 'text';
  11671.  
  11672. let [composedSignal, stopTimeout] = (signal || cancelToken || timeout) ?
  11673. composeSignals$1([signal, cancelToken], timeout) : [];
  11674.  
  11675. let finished, request;
  11676.  
  11677. const onFinish = () => {
  11678. !finished && setTimeout(() => {
  11679. composedSignal && composedSignal.unsubscribe();
  11680. });
  11681.  
  11682. finished = true;
  11683. };
  11684.  
  11685. let requestContentLength;
  11686.  
  11687. try {
  11688. if (
  11689. onUploadProgress && supportsRequestStream && method !== 'get' && method !== 'head' &&
  11690. (requestContentLength = await resolveBodyLength(headers, data)) !== 0
  11691. ) {
  11692. let _request = new Request(url, {
  11693. method: 'POST',
  11694. body: data,
  11695. duplex: "half"
  11696. });
  11697.  
  11698. let contentTypeHeader;
  11699.  
  11700. if (utils$1.isFormData(data) && (contentTypeHeader = _request.headers.get('content-type'))) {
  11701. headers.setContentType(contentTypeHeader);
  11702. }
  11703.  
  11704. if (_request.body) {
  11705. const [onProgress, flush] = progressEventDecorator(
  11706. requestContentLength,
  11707. progressEventReducer(asyncDecorator(onUploadProgress))
  11708. );
  11709.  
  11710. data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, onProgress, flush, encodeText);
  11711. }
  11712. }
  11713.  
  11714. if (!utils$1.isString(withCredentials)) {
  11715. withCredentials = withCredentials ? 'include' : 'omit';
  11716. }
  11717.  
  11718. request = new Request(url, {
  11719. ...fetchOptions,
  11720. signal: composedSignal,
  11721. method: method.toUpperCase(),
  11722. headers: headers.normalize().toJSON(),
  11723. body: data,
  11724. duplex: "half",
  11725. credentials: withCredentials
  11726. });
  11727.  
  11728. let response = await fetch(request);
  11729.  
  11730. const isStreamResponse = supportsResponseStream && (responseType === 'stream' || responseType === 'response');
  11731.  
  11732. if (supportsResponseStream && (onDownloadProgress || isStreamResponse)) {
  11733. const options = {};
  11734.  
  11735. ['status', 'statusText', 'headers'].forEach(prop => {
  11736. options[prop] = response[prop];
  11737. });
  11738.  
  11739. const responseContentLength = utils$1.toFiniteNumber(response.headers.get('content-length'));
  11740.  
  11741. const [onProgress, flush] = onDownloadProgress && progressEventDecorator(
  11742. responseContentLength,
  11743. progressEventReducer(asyncDecorator(onDownloadProgress), true)
  11744. ) || [];
  11745.  
  11746. response = new Response(
  11747. trackStream(response.body, DEFAULT_CHUNK_SIZE, onProgress, () => {
  11748. flush && flush();
  11749. isStreamResponse && onFinish();
  11750. }, encodeText),
  11751. options
  11752. );
  11753. }
  11754.  
  11755. responseType = responseType || 'text';
  11756.  
  11757. let responseData = await resolvers[utils$1.findKey(resolvers, responseType) || 'text'](response, config);
  11758.  
  11759. !isStreamResponse && onFinish();
  11760.  
  11761. stopTimeout && stopTimeout();
  11762.  
  11763. return await new Promise((resolve, reject) => {
  11764. settle(resolve, reject, {
  11765. data: responseData,
  11766. headers: AxiosHeaders$1.from(response.headers),
  11767. status: response.status,
  11768. statusText: response.statusText,
  11769. config,
  11770. request
  11771. });
  11772. })
  11773. } catch (err) {
  11774. onFinish();
  11775.  
  11776. if (err && err.name === 'TypeError' && /fetch/i.test(err.message)) {
  11777. throw Object.assign(
  11778. new AxiosError('Network Error', AxiosError.ERR_NETWORK, config, request),
  11779. {
  11780. cause: err.cause || err
  11781. }
  11782. )
  11783. }
  11784.  
  11785. throw AxiosError.from(err, err && err.code, config, request);
  11786. }
  11787. });
  11788.  
  11789. const knownAdapters = {
  11790. http: httpAdapter,
  11791. xhr: xhrAdapter,
  11792. fetch: fetchAdapter
  11793. };
  11794.  
  11795. utils$1.forEach(knownAdapters, (fn, value) => {
  11796. if (fn) {
  11797. try {
  11798. Object.defineProperty(fn, 'name', {value});
  11799. } catch (e) {
  11800. // eslint-disable-next-line no-empty
  11801. }
  11802. Object.defineProperty(fn, 'adapterName', {value});
  11803. }
  11804. });
  11805.  
  11806. const renderReason = (reason) => `- ${reason}`;
  11807.  
  11808. const isResolvedHandle = (adapter) => utils$1.isFunction(adapter) || adapter === null || adapter === false;
  11809.  
  11810. var adapters = {
  11811. getAdapter: (adapters) => {
  11812. adapters = utils$1.isArray(adapters) ? adapters : [adapters];
  11813.  
  11814. const {length} = adapters;
  11815. let nameOrAdapter;
  11816. let adapter;
  11817.  
  11818. const rejectedReasons = {};
  11819.  
  11820. for (let i = 0; i < length; i++) {
  11821. nameOrAdapter = adapters[i];
  11822. let id;
  11823.  
  11824. adapter = nameOrAdapter;
  11825.  
  11826. if (!isResolvedHandle(nameOrAdapter)) {
  11827. adapter = knownAdapters[(id = String(nameOrAdapter)).toLowerCase()];
  11828.  
  11829. if (adapter === undefined) {
  11830. throw new AxiosError(`Unknown adapter '${id}'`);
  11831. }
  11832. }
  11833.  
  11834. if (adapter) {
  11835. break;
  11836. }
  11837.  
  11838. rejectedReasons[id || '#' + i] = adapter;
  11839. }
  11840.  
  11841. if (!adapter) {
  11842.  
  11843. const reasons = Object.entries(rejectedReasons)
  11844. .map(([id, state]) => `adapter ${id} ` +
  11845. (state === false ? 'is not supported by the environment' : 'is not available in the build')
  11846. );
  11847.  
  11848. let s = length ?
  11849. (reasons.length > 1 ? 'since :\n' + reasons.map(renderReason).join('\n') : ' ' + renderReason(reasons[0])) :
  11850. 'as no adapter specified';
  11851.  
  11852. throw new AxiosError(
  11853. `There is no suitable adapter to dispatch the request ` + s,
  11854. 'ERR_NOT_SUPPORT'
  11855. );
  11856. }
  11857.  
  11858. return adapter;
  11859. },
  11860. adapters: knownAdapters
  11861. };
  11862.  
  11863. /**
  11864. * Throws a `CanceledError` if cancellation has been requested.
  11865. *
  11866. * @param {Object} config The config that is to be used for the request
  11867. *
  11868. * @returns {void}
  11869. */
  11870. function throwIfCancellationRequested(config) {
  11871. if (config.cancelToken) {
  11872. config.cancelToken.throwIfRequested();
  11873. }
  11874.  
  11875. if (config.signal && config.signal.aborted) {
  11876. throw new CanceledError(null, config);
  11877. }
  11878. }
  11879.  
  11880. /**
  11881. * Dispatch a request to the server using the configured adapter.
  11882. *
  11883. * @param {object} config The config that is to be used for the request
  11884. *
  11885. * @returns {Promise} The Promise to be fulfilled
  11886. */
  11887. function dispatchRequest(config) {
  11888. throwIfCancellationRequested(config);
  11889.  
  11890. config.headers = AxiosHeaders$1.from(config.headers);
  11891.  
  11892. // Transform request data
  11893. config.data = transformData.call(
  11894. config,
  11895. config.transformRequest
  11896. );
  11897.  
  11898. if (['post', 'put', 'patch'].indexOf(config.method) !== -1) {
  11899. config.headers.setContentType('application/x-www-form-urlencoded', false);
  11900. }
  11901.  
  11902. const adapter = adapters.getAdapter(config.adapter || defaults$1.adapter);
  11903.  
  11904. return adapter(config).then(function onAdapterResolution(response) {
  11905. throwIfCancellationRequested(config);
  11906.  
  11907. // Transform response data
  11908. response.data = transformData.call(
  11909. config,
  11910. config.transformResponse,
  11911. response
  11912. );
  11913.  
  11914. response.headers = AxiosHeaders$1.from(response.headers);
  11915.  
  11916. return response;
  11917. }, function onAdapterRejection(reason) {
  11918. if (!isCancel(reason)) {
  11919. throwIfCancellationRequested(config);
  11920.  
  11921. // Transform response data
  11922. if (reason && reason.response) {
  11923. reason.response.data = transformData.call(
  11924. config,
  11925. config.transformResponse,
  11926. reason.response
  11927. );
  11928. reason.response.headers = AxiosHeaders$1.from(reason.response.headers);
  11929. }
  11930. }
  11931.  
  11932. return Promise.reject(reason);
  11933. });
  11934. }
  11935.  
  11936. const VERSION = "1.7.4";
  11937.  
  11938. const validators$1 = {};
  11939.  
  11940. // eslint-disable-next-line func-names
  11941. ['object', 'boolean', 'number', 'function', 'string', 'symbol'].forEach((type, i) => {
  11942. validators$1[type] = function validator(thing) {
  11943. return typeof thing === type || 'a' + (i < 1 ? 'n ' : ' ') + type;
  11944. };
  11945. });
  11946.  
  11947. const deprecatedWarnings = {};
  11948.  
  11949. /**
  11950. * Transitional option validator
  11951. *
  11952. * @param {function|boolean?} validator - set to false if the transitional option has been removed
  11953. * @param {string?} version - deprecated version / removed since version
  11954. * @param {string?} message - some message with additional info
  11955. *
  11956. * @returns {function}
  11957. */
  11958. validators$1.transitional = function transitional(validator, version, message) {
  11959. function formatMessage(opt, desc) {
  11960. return '[Axios v' + VERSION + '] Transitional option \'' + opt + '\'' + desc + (message ? '. ' + message : '');
  11961. }
  11962.  
  11963. // eslint-disable-next-line func-names
  11964. return (value, opt, opts) => {
  11965. if (validator === false) {
  11966. throw new AxiosError(
  11967. formatMessage(opt, ' has been removed' + (version ? ' in ' + version : '')),
  11968. AxiosError.ERR_DEPRECATED
  11969. );
  11970. }
  11971.  
  11972. if (version && !deprecatedWarnings[opt]) {
  11973. deprecatedWarnings[opt] = true;
  11974. // eslint-disable-next-line no-console
  11975. console.warn(
  11976. formatMessage(
  11977. opt,
  11978. ' has been deprecated since v' + version + ' and will be removed in the near future'
  11979. )
  11980. );
  11981. }
  11982.  
  11983. return validator ? validator(value, opt, opts) : true;
  11984. };
  11985. };
  11986.  
  11987. /**
  11988. * Assert object's properties type
  11989. *
  11990. * @param {object} options
  11991. * @param {object} schema
  11992. * @param {boolean?} allowUnknown
  11993. *
  11994. * @returns {object}
  11995. */
  11996.  
  11997. function assertOptions(options, schema, allowUnknown) {
  11998. if (typeof options !== 'object') {
  11999. throw new AxiosError('options must be an object', AxiosError.ERR_BAD_OPTION_VALUE);
  12000. }
  12001. const keys = Object.keys(options);
  12002. let i = keys.length;
  12003. while (i-- > 0) {
  12004. const opt = keys[i];
  12005. const validator = schema[opt];
  12006. if (validator) {
  12007. const value = options[opt];
  12008. const result = value === undefined || validator(value, opt, options);
  12009. if (result !== true) {
  12010. throw new AxiosError('option ' + opt + ' must be ' + result, AxiosError.ERR_BAD_OPTION_VALUE);
  12011. }
  12012. continue;
  12013. }
  12014. if (allowUnknown !== true) {
  12015. throw new AxiosError('Unknown option ' + opt, AxiosError.ERR_BAD_OPTION);
  12016. }
  12017. }
  12018. }
  12019.  
  12020. var validator = {
  12021. assertOptions,
  12022. validators: validators$1
  12023. };
  12024.  
  12025. const validators = validator.validators;
  12026.  
  12027. /**
  12028. * Create a new instance of Axios
  12029. *
  12030. * @param {Object} instanceConfig The default config for the instance
  12031. *
  12032. * @return {Axios} A new instance of Axios
  12033. */
  12034. class Axios {
  12035. constructor(instanceConfig) {
  12036. this.defaults = instanceConfig;
  12037. this.interceptors = {
  12038. request: new InterceptorManager$1(),
  12039. response: new InterceptorManager$1()
  12040. };
  12041. }
  12042.  
  12043. /**
  12044. * Dispatch a request
  12045. *
  12046. * @param {String|Object} configOrUrl The config specific for this request (merged with this.defaults)
  12047. * @param {?Object} config
  12048. *
  12049. * @returns {Promise} The Promise to be fulfilled
  12050. */
  12051. async request(configOrUrl, config) {
  12052. try {
  12053. return await this._request(configOrUrl, config);
  12054. } catch (err) {
  12055. if (err instanceof Error) {
  12056. let dummy;
  12057.  
  12058. Error.captureStackTrace ? Error.captureStackTrace(dummy = {}) : (dummy = new Error());
  12059.  
  12060. // slice off the Error: ... line
  12061. const stack = dummy.stack ? dummy.stack.replace(/^.+\n/, '') : '';
  12062. try {
  12063. if (!err.stack) {
  12064. err.stack = stack;
  12065. // match without the 2 top stack lines
  12066. } else if (stack && !String(err.stack).endsWith(stack.replace(/^.+\n.+\n/, ''))) {
  12067. err.stack += '\n' + stack;
  12068. }
  12069. } catch (e) {
  12070. // ignore the case where "stack" is an un-writable property
  12071. }
  12072. }
  12073.  
  12074. throw err;
  12075. }
  12076. }
  12077.  
  12078. _request(configOrUrl, config) {
  12079. /*eslint no-param-reassign:0*/
  12080. // Allow for axios('example/url'[, config]) a la fetch API
  12081. if (typeof configOrUrl === 'string') {
  12082. config = config || {};
  12083. config.url = configOrUrl;
  12084. } else {
  12085. config = configOrUrl || {};
  12086. }
  12087.  
  12088. config = mergeConfig(this.defaults, config);
  12089.  
  12090. const {transitional, paramsSerializer, headers} = config;
  12091.  
  12092. if (transitional !== undefined) {
  12093. validator.assertOptions(transitional, {
  12094. silentJSONParsing: validators.transitional(validators.boolean),
  12095. forcedJSONParsing: validators.transitional(validators.boolean),
  12096. clarifyTimeoutError: validators.transitional(validators.boolean)
  12097. }, false);
  12098. }
  12099.  
  12100. if (paramsSerializer != null) {
  12101. if (utils$1.isFunction(paramsSerializer)) {
  12102. config.paramsSerializer = {
  12103. serialize: paramsSerializer
  12104. };
  12105. } else {
  12106. validator.assertOptions(paramsSerializer, {
  12107. encode: validators.function,
  12108. serialize: validators.function
  12109. }, true);
  12110. }
  12111. }
  12112.  
  12113. // Set config.method
  12114. config.method = (config.method || this.defaults.method || 'get').toLowerCase();
  12115.  
  12116. // Flatten headers
  12117. let contextHeaders = headers && utils$1.merge(
  12118. headers.common,
  12119. headers[config.method]
  12120. );
  12121.  
  12122. headers && utils$1.forEach(
  12123. ['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],
  12124. (method) => {
  12125. delete headers[method];
  12126. }
  12127. );
  12128.  
  12129. config.headers = AxiosHeaders$1.concat(contextHeaders, headers);
  12130.  
  12131. // filter out skipped interceptors
  12132. const requestInterceptorChain = [];
  12133. let synchronousRequestInterceptors = true;
  12134. this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {
  12135. if (typeof interceptor.runWhen === 'function' && interceptor.runWhen(config) === false) {
  12136. return;
  12137. }
  12138.  
  12139. synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous;
  12140.  
  12141. requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected);
  12142. });
  12143.  
  12144. const responseInterceptorChain = [];
  12145. this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {
  12146. responseInterceptorChain.push(interceptor.fulfilled, interceptor.rejected);
  12147. });
  12148.  
  12149. let promise;
  12150. let i = 0;
  12151. let len;
  12152.  
  12153. if (!synchronousRequestInterceptors) {
  12154. const chain = [dispatchRequest.bind(this), undefined];
  12155. chain.unshift.apply(chain, requestInterceptorChain);
  12156. chain.push.apply(chain, responseInterceptorChain);
  12157. len = chain.length;
  12158.  
  12159. promise = Promise.resolve(config);
  12160.  
  12161. while (i < len) {
  12162. promise = promise.then(chain[i++], chain[i++]);
  12163. }
  12164.  
  12165. return promise;
  12166. }
  12167.  
  12168. len = requestInterceptorChain.length;
  12169.  
  12170. let newConfig = config;
  12171.  
  12172. i = 0;
  12173.  
  12174. while (i < len) {
  12175. const onFulfilled = requestInterceptorChain[i++];
  12176. const onRejected = requestInterceptorChain[i++];
  12177. try {
  12178. newConfig = onFulfilled(newConfig);
  12179. } catch (error) {
  12180. onRejected.call(this, error);
  12181. break;
  12182. }
  12183. }
  12184.  
  12185. try {
  12186. promise = dispatchRequest.call(this, newConfig);
  12187. } catch (error) {
  12188. return Promise.reject(error);
  12189. }
  12190.  
  12191. i = 0;
  12192. len = responseInterceptorChain.length;
  12193.  
  12194. while (i < len) {
  12195. promise = promise.then(responseInterceptorChain[i++], responseInterceptorChain[i++]);
  12196. }
  12197.  
  12198. return promise;
  12199. }
  12200.  
  12201. getUri(config) {
  12202. config = mergeConfig(this.defaults, config);
  12203. const fullPath = buildFullPath(config.baseURL, config.url);
  12204. return buildURL(fullPath, config.params, config.paramsSerializer);
  12205. }
  12206. }
  12207.  
  12208. // Provide aliases for supported request methods
  12209. utils$1.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {
  12210. /*eslint func-names:0*/
  12211. Axios.prototype[method] = function(url, config) {
  12212. return this.request(mergeConfig(config || {}, {
  12213. method,
  12214. url,
  12215. data: (config || {}).data
  12216. }));
  12217. };
  12218. });
  12219.  
  12220. utils$1.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
  12221. /*eslint func-names:0*/
  12222.  
  12223. function generateHTTPMethod(isForm) {
  12224. return function httpMethod(url, data, config) {
  12225. return this.request(mergeConfig(config || {}, {
  12226. method,
  12227. headers: isForm ? {
  12228. 'Content-Type': 'multipart/form-data'
  12229. } : {},
  12230. url,
  12231. data
  12232. }));
  12233. };
  12234. }
  12235.  
  12236. Axios.prototype[method] = generateHTTPMethod();
  12237.  
  12238. Axios.prototype[method + 'Form'] = generateHTTPMethod(true);
  12239. });
  12240.  
  12241. var Axios$1 = Axios;
  12242.  
  12243. /**
  12244. * A `CancelToken` is an object that can be used to request cancellation of an operation.
  12245. *
  12246. * @param {Function} executor The executor function.
  12247. *
  12248. * @returns {CancelToken}
  12249. */
  12250. class CancelToken {
  12251. constructor(executor) {
  12252. if (typeof executor !== 'function') {
  12253. throw new TypeError('executor must be a function.');
  12254. }
  12255.  
  12256. let resolvePromise;
  12257.  
  12258. this.promise = new Promise(function promiseExecutor(resolve) {
  12259. resolvePromise = resolve;
  12260. });
  12261.  
  12262. const token = this;
  12263.  
  12264. // eslint-disable-next-line func-names
  12265. this.promise.then(cancel => {
  12266. if (!token._listeners) return;
  12267.  
  12268. let i = token._listeners.length;
  12269.  
  12270. while (i-- > 0) {
  12271. token._listeners[i](cancel);
  12272. }
  12273. token._listeners = null;
  12274. });
  12275.  
  12276. // eslint-disable-next-line func-names
  12277. this.promise.then = onfulfilled => {
  12278. let _resolve;
  12279. // eslint-disable-next-line func-names
  12280. const promise = new Promise(resolve => {
  12281. token.subscribe(resolve);
  12282. _resolve = resolve;
  12283. }).then(onfulfilled);
  12284.  
  12285. promise.cancel = function reject() {
  12286. token.unsubscribe(_resolve);
  12287. };
  12288.  
  12289. return promise;
  12290. };
  12291.  
  12292. executor(function cancel(message, config, request) {
  12293. if (token.reason) {
  12294. // Cancellation has already been requested
  12295. return;
  12296. }
  12297.  
  12298. token.reason = new CanceledError(message, config, request);
  12299. resolvePromise(token.reason);
  12300. });
  12301. }
  12302.  
  12303. /**
  12304. * Throws a `CanceledError` if cancellation has been requested.
  12305. */
  12306. throwIfRequested() {
  12307. if (this.reason) {
  12308. throw this.reason;
  12309. }
  12310. }
  12311.  
  12312. /**
  12313. * Subscribe to the cancel signal
  12314. */
  12315.  
  12316. subscribe(listener) {
  12317. if (this.reason) {
  12318. listener(this.reason);
  12319. return;
  12320. }
  12321.  
  12322. if (this._listeners) {
  12323. this._listeners.push(listener);
  12324. } else {
  12325. this._listeners = [listener];
  12326. }
  12327. }
  12328.  
  12329. /**
  12330. * Unsubscribe from the cancel signal
  12331. */
  12332.  
  12333. unsubscribe(listener) {
  12334. if (!this._listeners) {
  12335. return;
  12336. }
  12337. const index = this._listeners.indexOf(listener);
  12338. if (index !== -1) {
  12339. this._listeners.splice(index, 1);
  12340. }
  12341. }
  12342.  
  12343. /**
  12344. * Returns an object that contains a new `CancelToken` and a function that, when called,
  12345. * cancels the `CancelToken`.
  12346. */
  12347. static source() {
  12348. let cancel;
  12349. const token = new CancelToken(function executor(c) {
  12350. cancel = c;
  12351. });
  12352. return {
  12353. token,
  12354. cancel
  12355. };
  12356. }
  12357. }
  12358.  
  12359. var CancelToken$1 = CancelToken;
  12360.  
  12361. /**
  12362. * Syntactic sugar for invoking a function and expanding an array for arguments.
  12363. *
  12364. * Common use case would be to use `Function.prototype.apply`.
  12365. *
  12366. * ```js
  12367. * function f(x, y, z) {}
  12368. * var args = [1, 2, 3];
  12369. * f.apply(null, args);
  12370. * ```
  12371. *
  12372. * With `spread` this example can be re-written.
  12373. *
  12374. * ```js
  12375. * spread(function(x, y, z) {})([1, 2, 3]);
  12376. * ```
  12377. *
  12378. * @param {Function} callback
  12379. *
  12380. * @returns {Function}
  12381. */
  12382. function spread(callback) {
  12383. return function wrap(arr) {
  12384. return callback.apply(null, arr);
  12385. };
  12386. }
  12387.  
  12388. /**
  12389. * Determines whether the payload is an error thrown by Axios
  12390. *
  12391. * @param {*} payload The value to test
  12392. *
  12393. * @returns {boolean} True if the payload is an error thrown by Axios, otherwise false
  12394. */
  12395. function isAxiosError(payload) {
  12396. return utils$1.isObject(payload) && (payload.isAxiosError === true);
  12397. }
  12398.  
  12399. const HttpStatusCode = {
  12400. Continue: 100,
  12401. SwitchingProtocols: 101,
  12402. Processing: 102,
  12403. EarlyHints: 103,
  12404. Ok: 200,
  12405. Created: 201,
  12406. Accepted: 202,
  12407. NonAuthoritativeInformation: 203,
  12408. NoContent: 204,
  12409. ResetContent: 205,
  12410. PartialContent: 206,
  12411. MultiStatus: 207,
  12412. AlreadyReported: 208,
  12413. ImUsed: 226,
  12414. MultipleChoices: 300,
  12415. MovedPermanently: 301,
  12416. Found: 302,
  12417. SeeOther: 303,
  12418. NotModified: 304,
  12419. UseProxy: 305,
  12420. Unused: 306,
  12421. TemporaryRedirect: 307,
  12422. PermanentRedirect: 308,
  12423. BadRequest: 400,
  12424. Unauthorized: 401,
  12425. PaymentRequired: 402,
  12426. Forbidden: 403,
  12427. NotFound: 404,
  12428. MethodNotAllowed: 405,
  12429. NotAcceptable: 406,
  12430. ProxyAuthenticationRequired: 407,
  12431. RequestTimeout: 408,
  12432. Conflict: 409,
  12433. Gone: 410,
  12434. LengthRequired: 411,
  12435. PreconditionFailed: 412,
  12436. PayloadTooLarge: 413,
  12437. UriTooLong: 414,
  12438. UnsupportedMediaType: 415,
  12439. RangeNotSatisfiable: 416,
  12440. ExpectationFailed: 417,
  12441. ImATeapot: 418,
  12442. MisdirectedRequest: 421,
  12443. UnprocessableEntity: 422,
  12444. Locked: 423,
  12445. FailedDependency: 424,
  12446. TooEarly: 425,
  12447. UpgradeRequired: 426,
  12448. PreconditionRequired: 428,
  12449. TooManyRequests: 429,
  12450. RequestHeaderFieldsTooLarge: 431,
  12451. UnavailableForLegalReasons: 451,
  12452. InternalServerError: 500,
  12453. NotImplemented: 501,
  12454. BadGateway: 502,
  12455. ServiceUnavailable: 503,
  12456. GatewayTimeout: 504,
  12457. HttpVersionNotSupported: 505,
  12458. VariantAlsoNegotiates: 506,
  12459. InsufficientStorage: 507,
  12460. LoopDetected: 508,
  12461. NotExtended: 510,
  12462. NetworkAuthenticationRequired: 511,
  12463. };
  12464.  
  12465. Object.entries(HttpStatusCode).forEach(([key, value]) => {
  12466. HttpStatusCode[value] = key;
  12467. });
  12468.  
  12469. var HttpStatusCode$1 = HttpStatusCode;
  12470.  
  12471. /**
  12472. * Create an instance of Axios
  12473. *
  12474. * @param {Object} defaultConfig The default config for the instance
  12475. *
  12476. * @returns {Axios} A new instance of Axios
  12477. */
  12478. function createInstance(defaultConfig) {
  12479. const context = new Axios$1(defaultConfig);
  12480. const instance = bind(Axios$1.prototype.request, context);
  12481.  
  12482. // Copy axios.prototype to instance
  12483. utils$1.extend(instance, Axios$1.prototype, context, {allOwnKeys: true});
  12484.  
  12485. // Copy context to instance
  12486. utils$1.extend(instance, context, null, {allOwnKeys: true});
  12487.  
  12488. // Factory for creating new instances
  12489. instance.create = function create(instanceConfig) {
  12490. return createInstance(mergeConfig(defaultConfig, instanceConfig));
  12491. };
  12492.  
  12493. return instance;
  12494. }
  12495.  
  12496. // Create the default instance to be exported
  12497. const axios = createInstance(defaults$1);
  12498.  
  12499. // Expose Axios class to allow class inheritance
  12500. axios.Axios = Axios$1;
  12501.  
  12502. // Expose Cancel & CancelToken
  12503. axios.CanceledError = CanceledError;
  12504. axios.CancelToken = CancelToken$1;
  12505. axios.isCancel = isCancel;
  12506. axios.VERSION = VERSION;
  12507. axios.toFormData = toFormData;
  12508.  
  12509. // Expose AxiosError class
  12510. axios.AxiosError = AxiosError;
  12511.  
  12512. // alias for CanceledError for backward compatibility
  12513. axios.Cancel = axios.CanceledError;
  12514.  
  12515. // Expose all/spread
  12516. axios.all = function all(promises) {
  12517. return Promise.all(promises);
  12518. };
  12519.  
  12520. axios.spread = spread;
  12521.  
  12522. // Expose isAxiosError
  12523. axios.isAxiosError = isAxiosError;
  12524.  
  12525. // Expose mergeConfig
  12526. axios.mergeConfig = mergeConfig;
  12527.  
  12528. axios.AxiosHeaders = AxiosHeaders$1;
  12529.  
  12530. axios.formToJSON = thing => formDataToJSON(utils$1.isHTMLForm(thing) ? new FormData(thing) : thing);
  12531.  
  12532. axios.getAdapter = adapters.getAdapter;
  12533.  
  12534. axios.HttpStatusCode = HttpStatusCode$1;
  12535.  
  12536. axios.default = axios;
  12537.  
  12538. module.exports = axios;
  12539. //# sourceMappingURL=axios.cjs.map
  12540.  
  12541.  
  12542. /***/ }),
  12543. /* 5 */
  12544. /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
  12545.  
  12546. "use strict";
  12547.  
  12548. var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
  12549. if (k2 === undefined) k2 = k;
  12550. var desc = Object.getOwnPropertyDescriptor(m, k);
  12551. if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
  12552. desc = { enumerable: true, get: function() { return m[k]; } };
  12553. }
  12554. Object.defineProperty(o, k2, desc);
  12555. }) : (function(o, m, k, k2) {
  12556. if (k2 === undefined) k2 = k;
  12557. o[k2] = m[k];
  12558. }));
  12559. var __exportStar = (this && this.__exportStar) || function(m, exports) {
  12560. for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
  12561. };
  12562. Object.defineProperty(exports, "__esModule", ({ value: true }));
  12563. __exportStar(__webpack_require__(37), exports);
  12564. __exportStar(__webpack_require__(38), exports);
  12565. __exportStar(__webpack_require__(39), exports);
  12566. __exportStar(__webpack_require__(40), exports);
  12567. __exportStar(__webpack_require__(41), exports);
  12568. __exportStar(__webpack_require__(42), exports);
  12569. __exportStar(__webpack_require__(17), exports);
  12570. __exportStar(__webpack_require__(43), exports);
  12571. __exportStar(__webpack_require__(44), exports);
  12572. __exportStar(__webpack_require__(45), exports);
  12573. __exportStar(__webpack_require__(46), exports);
  12574. __exportStar(__webpack_require__(30), exports);
  12575.  
  12576.  
  12577. /***/ }),
  12578. /* 6 */
  12579. /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
  12580.  
  12581. "use strict";
  12582.  
  12583. var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
  12584. if (k2 === undefined) k2 = k;
  12585. var desc = Object.getOwnPropertyDescriptor(m, k);
  12586. if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
  12587. desc = { enumerable: true, get: function() { return m[k]; } };
  12588. }
  12589. Object.defineProperty(o, k2, desc);
  12590. }) : (function(o, m, k, k2) {
  12591. if (k2 === undefined) k2 = k;
  12592. o[k2] = m[k];
  12593. }));
  12594. var __exportStar = (this && this.__exportStar) || function(m, exports) {
  12595. for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
  12596. };
  12597. Object.defineProperty(exports, "__esModule", ({ value: true }));
  12598. __exportStar(__webpack_require__(12), exports);
  12599. __exportStar(__webpack_require__(20), exports);
  12600. __exportStar(__webpack_require__(13), exports);
  12601. __exportStar(__webpack_require__(7), exports);
  12602. __exportStar(__webpack_require__(25), exports);
  12603. __exportStar(__webpack_require__(51), exports);
  12604. __exportStar(__webpack_require__(26), exports);
  12605.  
  12606.  
  12607. /***/ }),
  12608. /* 7 */
  12609. /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
  12610.  
  12611. "use strict";
  12612.  
  12613. var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
  12614. if (k2 === undefined) k2 = k;
  12615. var desc = Object.getOwnPropertyDescriptor(m, k);
  12616. if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
  12617. desc = { enumerable: true, get: function() { return m[k]; } };
  12618. }
  12619. Object.defineProperty(o, k2, desc);
  12620. }) : (function(o, m, k, k2) {
  12621. if (k2 === undefined) k2 = k;
  12622. o[k2] = m[k];
  12623. }));
  12624. var __exportStar = (this && this.__exportStar) || function(m, exports) {
  12625. for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
  12626. };
  12627. Object.defineProperty(exports, "__esModule", ({ value: true }));
  12628. __exportStar(__webpack_require__(21), exports);
  12629. __exportStar(__webpack_require__(22), exports);
  12630. __exportStar(__webpack_require__(23), exports);
  12631. __exportStar(__webpack_require__(24), exports);
  12632.  
  12633.  
  12634. /***/ }),
  12635. /* 8 */
  12636. /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
  12637.  
  12638. "use strict";
  12639.  
  12640. var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
  12641. function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
  12642. return new (P || (P = Promise))(function (resolve, reject) {
  12643. function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
  12644. function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
  12645. function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
  12646. step((generator = generator.apply(thisArg, _arguments || [])).next());
  12647. });
  12648. };
  12649. Object.defineProperty(exports, "__esModule", ({ value: true }));
  12650. exports.GitlabHttpClient = void 0;
  12651. const axios_1 = __webpack_require__(4);
  12652. const config_1 = __webpack_require__(0);
  12653. const types_1 = __webpack_require__(5);
  12654. const get_gl_token_1 = __webpack_require__(9);
  12655. const http_client_base_1 = __webpack_require__(3);
  12656. class GitlabHttpClient extends http_client_base_1.HttpClient {
  12657. constructor(_token) {
  12658. super(config_1.gitlabApiUrl);
  12659. this._token = _token;
  12660. this._handleRequest = (config) => {
  12661. if (!!config && !!config.headers) {
  12662. config.headers['PRIVATE-TOKEN'] = this._token || '';
  12663. }
  12664. return config;
  12665. };
  12666. this._handleUnauthorizedError = (error) => {
  12667. var _a;
  12668. if (((_a = error.response) === null || _a === void 0 ? void 0 : _a.status) === 401) {
  12669. this._token = (0, get_gl_token_1.getGitlabToken)();
  12670. }
  12671. return Promise.reject(error);
  12672. };
  12673. this._initInterceptor = () => {
  12674. this.client.interceptors.request.use(this._handleRequest, this._handleError);
  12675. };
  12676. this._init();
  12677. }
  12678. static getInstance() {
  12679. if (!this.instance) {
  12680. this.instance = new GitlabHttpClient();
  12681. }
  12682. return this.instance;
  12683. }
  12684. getPipelines() {
  12685. return __awaiter(this, void 0, void 0, function* () {
  12686. try {
  12687. const pipelines = yield this.client.get(`projects/${config_1.gitlabProjectId}/pipelines`);
  12688. return pipelines;
  12689. }
  12690. catch (error) {
  12691. if (error instanceof axios_1.AxiosError) {
  12692. this._handleUnauthorizedError(error);
  12693. }
  12694. }
  12695. });
  12696. }
  12697. getPipelineSchedules() {
  12698. return __awaiter(this, void 0, void 0, function* () {
  12699. try {
  12700. const schedules = yield this.client.get(`projects/${config_1.gitlabProjectId}/pipeline_schedules`);
  12701. return schedules;
  12702. }
  12703. catch (error) {
  12704. if (error instanceof axios_1.AxiosError) {
  12705. this._handleUnauthorizedError(error);
  12706. }
  12707. }
  12708. });
  12709. }
  12710. getPipeLineScheduleById(scheduleId) {
  12711. return __awaiter(this, void 0, void 0, function* () {
  12712. if (!scheduleId) {
  12713. throw new Error('scheduleId is required');
  12714. }
  12715. try {
  12716. const schedule = yield this.client.get(`projects/${config_1.gitlabProjectId}/pipeline_schedules/${scheduleId}`);
  12717. return schedule;
  12718. }
  12719. catch (error) {
  12720. if (error instanceof axios_1.AxiosError) {
  12721. this._handleUnauthorizedError(error);
  12722. }
  12723. }
  12724. });
  12725. }
  12726. createPipelineSchedule(schedule) {
  12727. return __awaiter(this, void 0, void 0, function* () {
  12728. try {
  12729. const newSchedule = yield this.client.post(`projects/${config_1.gitlabProjectId}/pipeline_schedules`, schedule);
  12730. const { id } = newSchedule;
  12731. yield Promise.all((schedule.variables || []).map((variable) => this.createPipelineScheduleVariable(id, variable)));
  12732. return newSchedule;
  12733. }
  12734. catch (error) {
  12735. if (error instanceof axios_1.AxiosError) {
  12736. this._handleUnauthorizedError(error);
  12737. }
  12738. }
  12739. });
  12740. }
  12741. createPipelineScheduleVariable(scheduleId, variable) {
  12742. return __awaiter(this, void 0, void 0, function* () {
  12743. if (!scheduleId) {
  12744. throw new Error('scheduleId is required');
  12745. }
  12746. const _newVariable = {
  12747. key: variable.key,
  12748. value: variable.value,
  12749. variable_type: variable.variable_type !== types_1.CreateGitlabScheduleVariableTypes.FILE
  12750. ? types_1.CreateGitlabScheduleVariableTypes.ENV_VAR
  12751. : types_1.CreateGitlabScheduleVariableTypes.FILE,
  12752. };
  12753. try {
  12754. const newVariable = yield this.client.post(`projects/${config_1.gitlabProjectId}/pipeline_schedules/${scheduleId}/variables`, _newVariable);
  12755. return newVariable;
  12756. }
  12757. catch (error) {
  12758. if (error instanceof axios_1.AxiosError) {
  12759. this._handleUnauthorizedError(error);
  12760. }
  12761. }
  12762. });
  12763. }
  12764. getProjectBranches(projectId) {
  12765. return __awaiter(this, void 0, void 0, function* () {
  12766. try {
  12767. const branches = yield this.client.get(`projects/${projectId || config_1.gitlabProjectId}/repository/branches?per_page=${config_1.gitlabRestPerPage}`);
  12768. return branches.map((branch) => branch.name);
  12769. }
  12770. catch (error) {
  12771. if (error instanceof axios_1.AxiosError) {
  12772. this._handleUnauthorizedError(error);
  12773. }
  12774. }
  12775. });
  12776. }
  12777. getProjectVariables(projectId) {
  12778. return __awaiter(this, void 0, void 0, function* () {
  12779. try {
  12780. const variables = yield this.client.get(`projects/${projectId}/variables`);
  12781. return variables;
  12782. }
  12783. catch (error) {
  12784. if (error instanceof axios_1.AxiosError) {
  12785. this._handleUnauthorizedError(error);
  12786. }
  12787. }
  12788. });
  12789. }
  12790. _init() {
  12791. this._token = (0, get_gl_token_1.getTokenFromLocalStorage)();
  12792. this._initInterceptor();
  12793. }
  12794. }
  12795. exports.GitlabHttpClient = GitlabHttpClient;
  12796.  
  12797.  
  12798. /***/ }),
  12799. /* 9 */
  12800. /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
  12801.  
  12802. "use strict";
  12803.  
  12804. Object.defineProperty(exports, "__esModule", ({ value: true }));
  12805. exports.getGitlabToken = exports.getTokenFromLocalStorage = void 0;
  12806. const config_1 = __webpack_require__(0);
  12807. function getTokenFromLocalStorage() {
  12808. const _lsToken = window.atob(localStorage.getItem(config_1.gitlabTokenLocalStorageKey) || '');
  12809. if (_lsToken && _lsToken.length > 0) {
  12810. return _lsToken;
  12811. }
  12812. else {
  12813. return '';
  12814. }
  12815. }
  12816. exports.getTokenFromLocalStorage = getTokenFromLocalStorage;
  12817. function getGitlabToken() {
  12818. const inputToken = prompt('Invalid Gitlab token. Please enter a valid token:');
  12819. if (inputToken && inputToken.length > 0) {
  12820. (0, config_1.saveGitlabToken)(inputToken);
  12821. return inputToken;
  12822. }
  12823. else {
  12824. throw new Error('token is required');
  12825. }
  12826. }
  12827. exports.getGitlabToken = getGitlabToken;
  12828.  
  12829.  
  12830. /***/ }),
  12831. /* 10 */
  12832. /***/ ((__unused_webpack_module, exports) => {
  12833.  
  12834. "use strict";
  12835.  
  12836. Object.defineProperty(exports, "__esModule", ({ value: true }));
  12837. exports.getProjectIdFromTemplateVar = exports.getScheduleIdFromUrl = exports.getScheduleIdFromGid = exports.getOptionsFromVarDescription = exports.getProjectFullPath = exports.isPipelineScheduleUrl = exports.isEditPipelineScheduleUrl = exports.getGitlabScheduleIdFromUrl = void 0;
  12838. const getGitlabScheduleIdFromUrl = (url) => {
  12839. const regex = /\/pipeline_schedules\/(\d+)/;
  12840. const match = url === null || url === void 0 ? void 0 : url.match(regex);
  12841. return (match === null || match === void 0 ? void 0 : match[1]) || '';
  12842. };
  12843. exports.getGitlabScheduleIdFromUrl = getGitlabScheduleIdFromUrl;
  12844. const isEditPipelineScheduleUrl = (url) => {
  12845. const regex = /\/pipeline_schedules\/(\d+)\/edit/;
  12846. return regex.test(url || '');
  12847. };
  12848. exports.isEditPipelineScheduleUrl = isEditPipelineScheduleUrl;
  12849. const isPipelineScheduleUrl = (url) => {
  12850. const regex = /\/pipeline_schedules$/;
  12851. return regex.test(url || '');
  12852. };
  12853. exports.isPipelineScheduleUrl = isPipelineScheduleUrl;
  12854. const getProjectFullPath = (url) => {
  12855. const regex = /\/(.*?)\/-\/pipeline_schedules/;
  12856. const match = url.match(regex);
  12857. return (match === null || match === void 0 ? void 0 : match[1]) || '';
  12858. };
  12859. exports.getProjectFullPath = getProjectFullPath;
  12860. const getOptionsFromVarDescription = (description) => {
  12861. var _a;
  12862. const regex = /^\[(.*?)\]/;
  12863. const match = description.match(regex);
  12864. return ((_a = match === null || match === void 0 ? void 0 : match[1]) === null || _a === void 0 ? void 0 : _a.split(',').map((value) => value.trim())) || [];
  12865. };
  12866. exports.getOptionsFromVarDescription = getOptionsFromVarDescription;
  12867. const getScheduleIdFromGid = (gid) => {
  12868. //gid://gitlab/Ci::PipelineSchedule/<six_digits>
  12869. const regex = /\/(\d+)$/;
  12870. const match = gid.match(regex);
  12871. return (match === null || match === void 0 ? void 0 : match[1]) || '';
  12872. };
  12873. exports.getScheduleIdFromGid = getScheduleIdFromGid;
  12874. const getScheduleIdFromUrl = (url) => {
  12875. //https://gitlab.com/<project_path>/-/pipeline_schedules/<schedule_id>/edit?id=<schedule_id>
  12876. const regex = /\/pipeline_schedules\/(\d+)/;
  12877. const match = url.match(regex);
  12878. return (match === null || match === void 0 ? void 0 : match[1]) || '';
  12879. };
  12880. exports.getScheduleIdFromUrl = getScheduleIdFromUrl;
  12881. /**
  12882. * Get project id from template variable string format '$glBranches(:project_id)'
  12883. * @param varStr sample string: '$glBranches(41703858)'
  12884. * @returns project id
  12885. */
  12886. const getProjectIdFromTemplateVar = (varStr) => {
  12887. const regex = /\$glBranches\((\d+)?\)/;
  12888. const match = varStr.match(regex);
  12889. return (match === null || match === void 0 ? void 0 : match[1]) || '';
  12890. };
  12891. exports.getProjectIdFromTemplateVar = getProjectIdFromTemplateVar;
  12892.  
  12893.  
  12894. /***/ }),
  12895. /* 11 */
  12896. /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
  12897.  
  12898. "use strict";
  12899.  
  12900. var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
  12901. if (k2 === undefined) k2 = k;
  12902. var desc = Object.getOwnPropertyDescriptor(m, k);
  12903. if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
  12904. desc = { enumerable: true, get: function() { return m[k]; } };
  12905. }
  12906. Object.defineProperty(o, k2, desc);
  12907. }) : (function(o, m, k, k2) {
  12908. if (k2 === undefined) k2 = k;
  12909. o[k2] = m[k];
  12910. }));
  12911. var __exportStar = (this && this.__exportStar) || function(m, exports) {
  12912. for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
  12913. };
  12914. Object.defineProperty(exports, "__esModule", ({ value: true }));
  12915. __exportStar(__webpack_require__(15), exports);
  12916. __exportStar(__webpack_require__(28), exports);
  12917.  
  12918.  
  12919. /***/ }),
  12920. /* 12 */
  12921. /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
  12922.  
  12923. "use strict";
  12924.  
  12925. var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
  12926. function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
  12927. return new (P || (P = Promise))(function (resolve, reject) {
  12928. function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
  12929. function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
  12930. function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
  12931. step((generator = generator.apply(thisArg, _arguments || [])).next());
  12932. });
  12933. };
  12934. var __importDefault = (this && this.__importDefault) || function (mod) {
  12935. return (mod && mod.__esModule) ? mod : { "default": mod };
  12936. };
  12937. Object.defineProperty(exports, "__esModule", ({ value: true }));
  12938. exports.DuplicateBtnComponent = void 0;
  12939. const jquery_slim_1 = __importDefault(__webpack_require__(1));
  12940. const config_1 = __webpack_require__(0);
  12941. const shared_1 = __webpack_require__(2);
  12942. function DuplicateBtnComponent(scheduleId) {
  12943. if (!scheduleId) {
  12944. return;
  12945. }
  12946. const duplicateBtnHtml = `
  12947. <a title="Duplicate" class="btn gl-button btn-default btn-icon" style="margin-right: 1em;">
  12948. <svg class="s16" data-testid="duplicate-icon">
  12949. <use href="${config_1.gitlabSvgIconUrl}#duplicate"></use>
  12950. </svg>
  12951. </a>`;
  12952. const duplicateBtnJObject = (0, jquery_slim_1.default)(duplicateBtnHtml);
  12953. // add click event to the duplicateBtn
  12954. duplicateBtnJObject.on('click', function () {
  12955. return __awaiter(this, void 0, void 0, function* () {
  12956. const glClient = shared_1.GitlabHttpClient.getInstance();
  12957. const schedule = yield glClient.getPipeLineScheduleById(scheduleId);
  12958. if (!schedule)
  12959. return;
  12960. const newSchedule = yield glClient.createPipelineSchedule({
  12961. active: schedule.active,
  12962. cron: schedule.cron,
  12963. cron_timezone: schedule.cron_timezone,
  12964. description: `${schedule.description}-copy`,
  12965. ref: schedule.ref,
  12966. variables: schedule.variables,
  12967. });
  12968. if (!!newSchedule && confirm(`Duplicated successfully! Go to the edit page?`)) {
  12969. window.location.href = `${window.location.href}/${newSchedule === null || newSchedule === void 0 ? void 0 : newSchedule.id}/edit`;
  12970. }
  12971. else {
  12972. window.location.reload();
  12973. }
  12974. });
  12975. });
  12976. return duplicateBtnJObject;
  12977. }
  12978. exports.DuplicateBtnComponent = DuplicateBtnComponent;
  12979.  
  12980.  
  12981. /***/ }),
  12982. /* 13 */
  12983. /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
  12984.  
  12985. "use strict";
  12986.  
  12987. var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
  12988. function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
  12989. return new (P || (P = Promise))(function (resolve, reject) {
  12990. function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
  12991. function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
  12992. function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
  12993. step((generator = generator.apply(thisArg, _arguments || [])).next());
  12994. });
  12995. };
  12996. var __importDefault = (this && this.__importDefault) || function (mod) {
  12997. return (mod && mod.__esModule) ? mod : { "default": mod };
  12998. };
  12999. Object.defineProperty(exports, "__esModule", ({ value: true }));
  13000. exports.DownloadEnvBtnComponent = void 0;
  13001. const jquery_slim_1 = __importDefault(__webpack_require__(1));
  13002. const config_1 = __webpack_require__(0);
  13003. const shared_1 = __webpack_require__(2);
  13004. function DownloadEnvBtnComponent(scheduleId) {
  13005. if (!scheduleId) {
  13006. return;
  13007. }
  13008. const downloadEnvBtnHtml = `<a title="Download Env File" class="btn gl-button btn-default btn-icon">
  13009. <svg class="s16" data-testid="download-icon">
  13010. <use href="${config_1.gitlabSvgIconUrl}#download"></use>
  13011. </svg>
  13012. </a>`;
  13013. const downloadEnvBtnJObject = (0, jquery_slim_1.default)(downloadEnvBtnHtml);
  13014. // add click event to the downloadEnvBtn
  13015. downloadEnvBtnJObject.on('click', () => __awaiter(this, void 0, void 0, function* () {
  13016. var _a, _b;
  13017. const glClient = shared_1.GitlabHttpClient.getInstance();
  13018. const glGraphqlClient = shared_1.GitlabGraphqlClient.getInstance();
  13019. const variables = [];
  13020. const schedule = yield glClient.getPipeLineScheduleById(scheduleId);
  13021. if (!schedule)
  13022. return;
  13023. if (config_1.includeAllVariables) {
  13024. const fullPath = (0, shared_1.getProjectFullPath)(window.location.pathname);
  13025. const ciVariables = (yield glGraphqlClient.getCiConfigVariables(fullPath, (schedule === null || schedule === void 0 ? void 0 : schedule.ref) || config_1.gitlabDefaultPipelineSchedule.ref)) || [];
  13026. // left join ciVariables and schedule.variables
  13027. 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)));
  13028. variables.push(...joined);
  13029. }
  13030. else {
  13031. variables.push(...((_b = schedule === null || schedule === void 0 ? void 0 : schedule.variables) !== null && _b !== void 0 ? _b : []));
  13032. }
  13033. (0, shared_1.downloadEnvFile)(variables, schedule.description);
  13034. }));
  13035. return downloadEnvBtnJObject;
  13036. }
  13037. exports.DownloadEnvBtnComponent = DownloadEnvBtnComponent;
  13038.  
  13039.  
  13040. /***/ }),
  13041. /* 14 */
  13042. /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
  13043.  
  13044. "use strict";
  13045.  
  13046. var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
  13047. function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
  13048. return new (P || (P = Promise))(function (resolve, reject) {
  13049. function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
  13050. function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
  13051. function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
  13052. step((generator = generator.apply(thisArg, _arguments || [])).next());
  13053. });
  13054. };
  13055. Object.defineProperty(exports, "__esModule", ({ value: true }));
  13056. const styles_1 = __webpack_require__(33);
  13057. const pages_1 = __webpack_require__(11);
  13058. const shared_1 = __webpack_require__(2);
  13059. const RUN_SCRIPT_AFTER_MS = 0;
  13060. const main = () => __awaiter(void 0, void 0, void 0, function* () {
  13061. const url = window.location.href;
  13062. GM_addStyle(styles_1.css);
  13063. if ((0, shared_1.isPipelineScheduleUrl)(url)) {
  13064. setTimeout(pages_1.pipelineSchedulesPage, RUN_SCRIPT_AFTER_MS);
  13065. }
  13066. else if ((0, shared_1.isEditPipelineScheduleUrl)(url)) {
  13067. setTimeout(pages_1.editPipelineSchedulePage, RUN_SCRIPT_AFTER_MS);
  13068. }
  13069. });
  13070. (() => __awaiter(void 0, void 0, void 0, function* () {
  13071. try {
  13072. main();
  13073. }
  13074. catch (error) {
  13075. console.error(error);
  13076. }
  13077. }))();
  13078.  
  13079.  
  13080. /***/ }),
  13081. /* 15 */
  13082. /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
  13083.  
  13084. "use strict";
  13085.  
  13086. var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
  13087. function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
  13088. return new (P || (P = Promise))(function (resolve, reject) {
  13089. function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
  13090. function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
  13091. function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
  13092. step((generator = generator.apply(thisArg, _arguments || [])).next());
  13093. });
  13094. };
  13095. Object.defineProperty(exports, "__esModule", ({ value: true }));
  13096. exports.pipelineSchedulesPage = void 0;
  13097. const components_1 = __webpack_require__(6);
  13098. const shared_1 = __webpack_require__(2);
  13099. const pipelineSchedulesPage = () => __awaiter(void 0, void 0, void 0, function* () {
  13100. const glGraphqlClient = shared_1.GitlabGraphqlClient.getInstance();
  13101. const fullPath = (0, shared_1.getProjectFullPath)(window.location.pathname);
  13102. const [schedules, _] = yield Promise.all([
  13103. glGraphqlClient.getPipelineSchedulesQuery(fullPath),
  13104. (0, shared_1.waitForElement)('tr[data-testid="pipeline-schedule-table-row"]'), // wait for the pipeline schedule table to be rendered
  13105. ]);
  13106. // find the buttons with attribute title="Play" in the btnGroup
  13107. // let playBtns = $('.tab-pane.active').find('.btn-group').find(`[title='Run pipeline schedule']`);
  13108. // if (playBtns.length === 0) {
  13109. // playBtns = $('.btn-group').find(`[title='Play']`);
  13110. // }
  13111. // find the button with text "New schedule"
  13112. const newScheduleBtns = $('.btn.btn-confirm:contains("New schedule")');
  13113. const newScheduleBtn = $(newScheduleBtns.get());
  13114. const quickNewScheduleBtn = (0, components_1.QuickNewScheduleBtnComponent)();
  13115. const settingsBtn = (0, components_1.GitlabToolSettingsBtnComponent)();
  13116. // create a new div btnGroup with class ml-auto, move the newScheduleBtn to the enter of the new btnGroup
  13117. const newBtnGroup = $('<div class="gl-ml-auto"></div>');
  13118. newBtnGroup.insertBefore(newScheduleBtn);
  13119. newScheduleBtn.appendTo(newBtnGroup);
  13120. if (quickNewScheduleBtn) {
  13121. quickNewScheduleBtn.insertBefore(newScheduleBtn);
  13122. settingsBtn.insertAfter(newScheduleBtn);
  13123. }
  13124. // find the buttons with attribute datat-testid="delete-pipeline-schedule-btn" in the btnGroup
  13125. const deleteBtns = $('.tab-pane.active')
  13126. .find('.btn-group')
  13127. .find(`[data-testid='delete-pipeline-schedule-btn']`);
  13128. for (const [_, btnItem] of Array.from(deleteBtns).entries()) {
  13129. const delBtn = $(btnItem);
  13130. const scheduleDesc = delBtn
  13131. .closest('tr')
  13132. .find('[data-testid="pipeline-schedule-description"]')
  13133. .text()
  13134. .trim();
  13135. const rowSchedule = schedules.project.pipelineSchedules.nodes.find((sch) => {
  13136. return sch.description === scheduleDesc;
  13137. });
  13138. const scheduleIndex = (0, shared_1.getScheduleIdFromGid)(rowSchedule.id);
  13139. // const playBtnHref = editBtn.attr('href') as string;
  13140. // const scheduleId = getGitlabScheduleIdFromUrl(playBtnHref);
  13141. const duplicateBtn = (0, components_1.DuplicateBtnComponent)(scheduleIndex);
  13142. if (duplicateBtn) {
  13143. duplicateBtn.insertBefore(delBtn);
  13144. const downloadEnvFileBtn = (0, components_1.DownloadEnvBtnComponent)(scheduleIndex);
  13145. if (downloadEnvFileBtn) {
  13146. downloadEnvFileBtn.insertBefore(duplicateBtn);
  13147. }
  13148. }
  13149. }
  13150. const glChooseBranchDropdown = yield (0, components_1.ChooseBranchDropdownComponent)();
  13151. glChooseBranchDropdown.insertBefore(quickNewScheduleBtn);
  13152. });
  13153. exports.pipelineSchedulesPage = pipelineSchedulesPage;
  13154.  
  13155.  
  13156. /***/ }),
  13157. /* 16 */
  13158. /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
  13159.  
  13160. "use strict";
  13161.  
  13162. var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
  13163. function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
  13164. return new (P || (P = Promise))(function (resolve, reject) {
  13165. function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
  13166. function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
  13167. function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
  13168. step((generator = generator.apply(thisArg, _arguments || [])).next());
  13169. });
  13170. };
  13171. Object.defineProperty(exports, "__esModule", ({ value: true }));
  13172. exports.GitlabGraphqlClient = void 0;
  13173. const axios_1 = __webpack_require__(4);
  13174. const config_1 = __webpack_require__(0);
  13175. const types_1 = __webpack_require__(5);
  13176. const get_gl_token_1 = __webpack_require__(9);
  13177. const gitlab_graphql_query_1 = __webpack_require__(31);
  13178. const gitlab_resource_extractor_1 = __webpack_require__(10);
  13179. const http_client_base_1 = __webpack_require__(3);
  13180. class GitlabGraphqlClient extends http_client_base_1.HttpClient {
  13181. constructor(_token) {
  13182. super(config_1.gitlabGraphqlUrl);
  13183. this._token = _token;
  13184. this.RETRIES = 5;
  13185. this._handleRequest = (config) => {
  13186. if (!!config && !!config.headers) {
  13187. config.headers['Authorization'] = `Bearer ${this._token}`;
  13188. }
  13189. return config;
  13190. };
  13191. this._handleUnauthorizedError = (error) => {
  13192. var _a;
  13193. if (((_a = error.response) === null || _a === void 0 ? void 0 : _a.status) === 401) {
  13194. this._token = (0, get_gl_token_1.getGitlabToken)();
  13195. }
  13196. };
  13197. this._initInterceptor = () => {
  13198. this.client.interceptors.request.use(this._handleRequest, this._handleError);
  13199. };
  13200. this._init();
  13201. }
  13202. static getInstance() {
  13203. if (!this.instance) {
  13204. this.instance = new GitlabGraphqlClient();
  13205. }
  13206. return this.instance;
  13207. }
  13208. getCiConfigVariables(projectUrl, ref) {
  13209. var _a, _b, _c;
  13210. return __awaiter(this, void 0, void 0, function* () {
  13211. let ciConfigVariables = [];
  13212. let retries = 0;
  13213. try {
  13214. let isBreak = false;
  13215. while (!isBreak && retries < this.RETRIES) {
  13216. const { data: glGetCiConfigVarRes } = yield this.client.post('', {
  13217. operationName: 'ciConfigVariables',
  13218. query: gitlab_graphql_query_1.getCiConfigVariablesQueryStr,
  13219. variables: {
  13220. fullPath: projectUrl,
  13221. ref,
  13222. },
  13223. });
  13224. if (((_a = glGetCiConfigVarRes === null || glGetCiConfigVarRes === void 0 ? void 0 : glGetCiConfigVarRes.project) === null || _a === void 0 ? void 0 : _a.ciConfigVariables) !== null &&
  13225. !!glGetCiConfigVarRes &&
  13226. ((_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) {
  13227. ciConfigVariables = glGetCiConfigVarRes.project.ciConfigVariables;
  13228. isBreak = true;
  13229. }
  13230. retries++;
  13231. }
  13232. return ciConfigVariables
  13233. ? ciConfigVariables
  13234. .filter((variable) => variable.description !== null)
  13235. .map((variable) => ({
  13236. key: variable.key,
  13237. value: variable.value,
  13238. description: variable.description,
  13239. variable_type: types_1.GitlabScheduleVariableTypes.ENV_VAR,
  13240. valueOptions: variable.valueOptions,
  13241. }))
  13242. : [];
  13243. }
  13244. catch (error) {
  13245. if (error instanceof axios_1.AxiosError) {
  13246. this._handleUnauthorizedError(error);
  13247. }
  13248. }
  13249. });
  13250. }
  13251. /**
  13252. * Get Gitlab pipeline schedules by ids
  13253. * @param projectPath
  13254. * @param ids - let null to get all schedules
  13255. * @returns
  13256. */
  13257. getPipelineSchedulesQuery(projectPath, ids = null) {
  13258. return __awaiter(this, void 0, void 0, function* () {
  13259. const { data } = yield this.client.post('', {
  13260. operationName: 'getPipelineSchedulesQuery',
  13261. query: gitlab_graphql_query_1.getPipelineSchedulesQueryStr,
  13262. variables: {
  13263. ids: ids,
  13264. projectPath,
  13265. first: 50,
  13266. last: null,
  13267. nextPageCursor: '',
  13268. prevPageCursor: '',
  13269. sortValue: 'DESCRIPTION_DESC',
  13270. },
  13271. });
  13272. return data;
  13273. });
  13274. }
  13275. getPipelineScheduleIdsQuery(projectPath) {
  13276. return __awaiter(this, void 0, void 0, function* () {
  13277. const res = yield this.getPipelineSchedulesQuery(projectPath);
  13278. return GitlabGraphqlClient.getPipelineScheduleIdsQueryFromPipelineScheduleDataArray(res);
  13279. });
  13280. }
  13281. static getPipelineScheduleIdsQueryFromPipelineScheduleDataArray(data) {
  13282. var _a, _b, _c;
  13283. return (_c = (_b = (_a = data === null || data === void 0 ? void 0 : data.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) => {
  13284. return (0, gitlab_resource_extractor_1.getScheduleIdFromGid)(node.id);
  13285. });
  13286. }
  13287. updatePipelineSchedule(pipelineScheduleId, projectPath, updatedPipelineSchedule) {
  13288. var _a;
  13289. return __awaiter(this, void 0, void 0, function* () {
  13290. const updatedVariables = updatedPipelineSchedule.variables;
  13291. const crtPipelineSchedule = yield this.getPipelineSchedulesQuery(projectPath, pipelineScheduleId);
  13292. const crtPipelineScheduleVariables = (_a = crtPipelineSchedule.project.pipelineSchedules.nodes[0]) === null || _a === void 0 ? void 0 : _a.variables.nodes;
  13293. const _variables = crtPipelineScheduleVariables === null || crtPipelineScheduleVariables === void 0 ? void 0 : crtPipelineScheduleVariables.map((pipelineVariable) => {
  13294. const updatedVariable = updatedVariables.find((variable) => variable.key === pipelineVariable.key);
  13295. // check pipelineVariable is deleted by key
  13296. const isDeleted = updatedVariables.findIndex((variable) => variable.key === pipelineVariable.key) === -1;
  13297. return Object.assign(Object.assign({}, pipelineVariable), { __typename: undefined, value: (updatedVariable === null || updatedVariable === void 0 ? void 0 : updatedVariable.value) || '', destroy: isDeleted });
  13298. });
  13299. // check if there are new variables in updatedVariables by key
  13300. const newVariables = updatedVariables.filter((variable) => {
  13301. return ((crtPipelineScheduleVariables === null || crtPipelineScheduleVariables === void 0 ? void 0 : crtPipelineScheduleVariables.findIndex((pipelineVariable) => pipelineVariable.key === variable.key)) === -1);
  13302. });
  13303. const _newVariables = newVariables.map((_newVariable) => {
  13304. return {
  13305. key: _newVariable.key,
  13306. value: _newVariable.value,
  13307. variableType: 'ENV_VAR',
  13308. };
  13309. });
  13310. if (newVariables.length > 0) {
  13311. _variables === null || _variables === void 0 ? void 0 : _variables.push(..._newVariables);
  13312. }
  13313. const payload = {
  13314. operationName: 'updatePipelineSchedule',
  13315. query: gitlab_graphql_query_1.updatePipelineScheduleMutationStr,
  13316. variables: {
  13317. 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,
  13318. // remove unused fields
  13319. __typename: undefined, editPath: undefined, forTag: undefined, lastPipeline: undefined, nextRunAt: undefined, realNextRun: undefined, refForDisplay: undefined, refPath: undefined, userPermissions: undefined, owner: undefined }),
  13320. },
  13321. };
  13322. const res = yield this.client.post('', payload);
  13323. return res;
  13324. });
  13325. }
  13326. _init() {
  13327. this._token = (0, get_gl_token_1.getTokenFromLocalStorage)();
  13328. this._initInterceptor();
  13329. }
  13330. }
  13331. exports.GitlabGraphqlClient = GitlabGraphqlClient;
  13332.  
  13333.  
  13334. /***/ }),
  13335. /* 17 */
  13336. /***/ ((__unused_webpack_module, exports) => {
  13337.  
  13338. "use strict";
  13339.  
  13340. Object.defineProperty(exports, "__esModule", ({ value: true }));
  13341. exports.CreateGitlabScheduleVariableTypes = exports.GitlabScheduleVariableTypes = void 0;
  13342. var GitlabScheduleVariableTypes;
  13343. (function (GitlabScheduleVariableTypes) {
  13344. GitlabScheduleVariableTypes["ENV_VAR"] = "Variable";
  13345. GitlabScheduleVariableTypes["FILE"] = "File";
  13346. })(GitlabScheduleVariableTypes = exports.GitlabScheduleVariableTypes || (exports.GitlabScheduleVariableTypes = {}));
  13347. var CreateGitlabScheduleVariableTypes;
  13348. (function (CreateGitlabScheduleVariableTypes) {
  13349. CreateGitlabScheduleVariableTypes["ENV_VAR"] = "env_var";
  13350. CreateGitlabScheduleVariableTypes["FILE"] = "file";
  13351. })(CreateGitlabScheduleVariableTypes = exports.CreateGitlabScheduleVariableTypes || (exports.CreateGitlabScheduleVariableTypes = {}));
  13352.  
  13353.  
  13354. /***/ }),
  13355. /* 18 */
  13356. /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
  13357.  
  13358. "use strict";
  13359.  
  13360. var __importDefault = (this && this.__importDefault) || function (mod) {
  13361. return (mod && mod.__esModule) ? mod : { "default": mod };
  13362. };
  13363. Object.defineProperty(exports, "__esModule", ({ value: true }));
  13364. exports.$ = void 0;
  13365. const jquery_slim_1 = __importDefault(__webpack_require__(1));
  13366. function $(selector) {
  13367. const htmlElements = (0, jquery_slim_1.default)(selector);
  13368. if (htmlElements.length === 0) {
  13369. console.error(`No element found for selector ${selector}`);
  13370. }
  13371. return htmlElements;
  13372. }
  13373. exports.$ = $;
  13374.  
  13375.  
  13376. /***/ }),
  13377. /* 19 */
  13378. /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
  13379.  
  13380. "use strict";
  13381.  
  13382. var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
  13383. function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
  13384. return new (P || (P = Promise))(function (resolve, reject) {
  13385. function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
  13386. function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
  13387. function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
  13388. step((generator = generator.apply(thisArg, _arguments || [])).next());
  13389. });
  13390. };
  13391. Object.defineProperty(exports, "__esModule", ({ value: true }));
  13392. exports.VarOptionStorage = void 0;
  13393. const gitlab_http_client_1 = __webpack_require__(8);
  13394. const gitlab_resource_extractor_1 = __webpack_require__(10);
  13395. class VarOptionStorage {
  13396. constructor() {
  13397. this.glHttpClient = gitlab_http_client_1.GitlabHttpClient.getInstance();
  13398. this.options = {};
  13399. }
  13400. static getInstance() {
  13401. if (!VarOptionStorage.instance) {
  13402. VarOptionStorage.instance = new VarOptionStorage();
  13403. }
  13404. return VarOptionStorage.instance;
  13405. }
  13406. // Extract the options from the variable description
  13407. setOptions(options) {
  13408. return __awaiter(this, void 0, void 0, function* () {
  13409. const promises = [];
  13410. for (const key of Object.keys(options)) {
  13411. const values = options[key];
  13412. if (!!values) {
  13413. for (let i = 0; i < values.length; i++) {
  13414. const value = values[i];
  13415. if (!!value) {
  13416. if (value.match(/\$glBranches\((\d+)?\)/)) {
  13417. const projectId = (0, gitlab_resource_extractor_1.getProjectIdFromTemplateVar)(value);
  13418. promises.push(this.glHttpClient.getProjectBranches(projectId).then((branches) => {
  13419. values.splice(i, 1, ...(branches || []));
  13420. }));
  13421. }
  13422. }
  13423. }
  13424. }
  13425. }
  13426. yield Promise.all(promises);
  13427. this.options = options;
  13428. });
  13429. }
  13430. getOptions() {
  13431. return this.options;
  13432. }
  13433. getOptionsByKey(key) {
  13434. return this.options[key] || [];
  13435. }
  13436. hasOptions() {
  13437. return Object.keys(this.options).length > 0;
  13438. }
  13439. addOption(key, value) {
  13440. var _a, _b;
  13441. if (!this.options[key]) {
  13442. this.options[key] = [];
  13443. }
  13444. if (((_a = this.options[key]) === null || _a === void 0 ? void 0 : _a.indexOf(value)) === -1) {
  13445. (_b = this.options[key]) === null || _b === void 0 ? void 0 : _b.push(value);
  13446. }
  13447. }
  13448. removeOption(key, value) {
  13449. var _a, _b;
  13450. if (!this.options[key]) {
  13451. return;
  13452. }
  13453. const index = ((_a = this.options[key]) === null || _a === void 0 ? void 0 : _a.indexOf(value)) || -1;
  13454. if (index !== -1) {
  13455. (_b = this.options[key]) === null || _b === void 0 ? void 0 : _b.splice(index, 1);
  13456. }
  13457. }
  13458. }
  13459. exports.VarOptionStorage = VarOptionStorage;
  13460.  
  13461.  
  13462. /***/ }),
  13463. /* 20 */
  13464. /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
  13465.  
  13466. "use strict";
  13467.  
  13468. var __importDefault = (this && this.__importDefault) || function (mod) {
  13469. return (mod && mod.__esModule) ? mod : { "default": mod };
  13470. };
  13471. Object.defineProperty(exports, "__esModule", ({ value: true }));
  13472. exports.QuickNewScheduleBtnComponent = void 0;
  13473. const jquery_slim_1 = __importDefault(__webpack_require__(1));
  13474. function QuickNewScheduleBtnComponent() {
  13475. const quickNewScheduleBtnHtml = `
  13476. <a class="btn gl-button btn-success mr-2">
  13477. <span>Quick new schedule</span>
  13478. </a>`;
  13479. const quickNewScheduleBtnJObject = (0, jquery_slim_1.default)(quickNewScheduleBtnHtml);
  13480. quickNewScheduleBtnJObject.on('click', function () {
  13481. (0, jquery_slim_1.default)(`#gs-dropdown-choose-branch`).toggle();
  13482. });
  13483. return quickNewScheduleBtnJObject;
  13484. }
  13485. exports.QuickNewScheduleBtnComponent = QuickNewScheduleBtnComponent;
  13486.  
  13487.  
  13488. /***/ }),
  13489. /* 21 */
  13490. /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
  13491.  
  13492. "use strict";
  13493.  
  13494. var __importDefault = (this && this.__importDefault) || function (mod) {
  13495. return (mod && mod.__esModule) ? mod : { "default": mod };
  13496. };
  13497. Object.defineProperty(exports, "__esModule", ({ value: true }));
  13498. exports.GitlabCheckboxComponent = void 0;
  13499. const jquery_slim_1 = __importDefault(__webpack_require__(1));
  13500. function GitlabCheckboxComponent(label, controlLabel, className, checked = true, checkboxId) {
  13501. const _checkboxId = checkboxId !== null && checkboxId !== void 0 ? checkboxId : label.replaceAll(' ', '') + '_checkbox';
  13502. const checkboxComponentHtml = `
  13503. <div class="${className !== null && className !== void 0 ? className : 'col-md-2'}">
  13504. <label class="label-bold" for="${_checkboxId}">${label}</label>
  13505. <div>
  13506. <div class="gl-form-checkbox custom-control custom-checkbox">
  13507. <input class="custom-control-input" type="checkbox" id="${_checkboxId}" ${checked ? 'checked' : ''}>
  13508. <label class="custom-control-label" for="${_checkboxId}"><span>${controlLabel}</span></label>
  13509. </div>
  13510. </div>
  13511. </div>
  13512. `;
  13513. return (0, jquery_slim_1.default)(checkboxComponentHtml);
  13514. }
  13515. exports.GitlabCheckboxComponent = GitlabCheckboxComponent;
  13516.  
  13517.  
  13518. /***/ }),
  13519. /* 22 */
  13520. /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
  13521.  
  13522. "use strict";
  13523.  
  13524. var __importDefault = (this && this.__importDefault) || function (mod) {
  13525. return (mod && mod.__esModule) ? mod : { "default": mod };
  13526. };
  13527. Object.defineProperty(exports, "__esModule", ({ value: true }));
  13528. exports.GitlabDropdownComponent = void 0;
  13529. const jquery_slim_1 = __importDefault(__webpack_require__(1));
  13530. const config_1 = __webpack_require__(0);
  13531. function GitlabDropdownComponent(dropdownName, dropdownTitle, dropdownItems) {
  13532. // Dropdown
  13533. const glDropdownHtml = `
  13534. <div class="dropdown b-dropdown gl-dropdown undefined btn-group" id="gs-dropdown-${dropdownName}">
  13535. </div>`;
  13536. const glDropdownJObject = (0, jquery_slim_1.default)(glDropdownHtml);
  13537. glDropdownJObject.hide();
  13538. // Dropdown toggle button
  13539. const glDropdownToggleBtnHtml = `
  13540. <button aria-haspopup="true" aria-expanded="false" type="button" class="btn dropdown-toggle btn-default btn-md gl-button gl-dropdown-toggle">
  13541. <span class="gl-dropdown-button-text">${dropdownTitle}</span>
  13542. <svg data-testid="chevron-down-icon" role="img" aria-hidden="true" class="gl-button-icon dropdown-chevron gl-icon s16">
  13543. <use href="${config_1.gitlabSvgIconUrl}#chevron-down"></use>
  13544. </svg>
  13545. </button>`;
  13546. const glDropdownToggleBtnJObject = (0, jquery_slim_1.default)(glDropdownToggleBtnHtml);
  13547. glDropdownJObject.on('click', () => {
  13548. (0, jquery_slim_1.default)(`#gs-dropdown-${dropdownName}`).toggleClass('show');
  13549. });
  13550. glDropdownJObject.append(glDropdownToggleBtnJObject);
  13551. // Dropdown menu
  13552. const glDropdownMenuHtml = `
  13553. <ul role="menu" tabindex="-1" class="dropdown-menu" aria-labelledby="" style="">
  13554. <div class="gl-dropdown-inner">
  13555. <div class="gl-dropdown-contents" id="gs-dropdown-contents-${dropdownName}">
  13556. </div>
  13557. </div>
  13558. </ul>`;
  13559. const glDropdownMenuJObject = (0, jquery_slim_1.default)(glDropdownMenuHtml);
  13560. glDropdownJObject.append(glDropdownMenuJObject);
  13561. // Dropdown menu items
  13562. const addItemsToDropdown = (items) => {
  13563. for (const item of items) {
  13564. const glDropdownMenuItemHtml = `
  13565. <li role="presentation" class="gl-dropdown-item">
  13566. <button role="menuitem" type="button" class="dropdown-item">
  13567. <div class="gl-dropdown-item-text-wrapper">
  13568. <p class="gl-dropdown-item-text-primary">${item.text}</p>
  13569. </div>
  13570. </button>
  13571. </li>`;
  13572. const glDropdownMenuItemJObject = (0, jquery_slim_1.default)(glDropdownMenuItemHtml);
  13573. glDropdownMenuItemJObject.on('click', item.fn);
  13574. glDropdownMenuJObject
  13575. .find(`#gs-dropdown-contents-${dropdownName}`)
  13576. .append(glDropdownMenuItemJObject);
  13577. }
  13578. };
  13579. if (dropdownItems instanceof Promise) {
  13580. dropdownItems.then((items) => {
  13581. addItemsToDropdown(items);
  13582. return items;
  13583. });
  13584. }
  13585. else {
  13586. addItemsToDropdown(dropdownItems);
  13587. }
  13588. // remove class 'show' when clicking outside of dropdown
  13589. (0, jquery_slim_1.default)(document).on('click', (e) => {
  13590. if (!(0, jquery_slim_1.default)(e.target).closest(glDropdownJObject).length) {
  13591. glDropdownJObject.removeClass('show');
  13592. }
  13593. });
  13594. return glDropdownJObject;
  13595. }
  13596. exports.GitlabDropdownComponent = GitlabDropdownComponent;
  13597.  
  13598.  
  13599. /***/ }),
  13600. /* 23 */
  13601. /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
  13602.  
  13603. "use strict";
  13604.  
  13605. var __importDefault = (this && this.__importDefault) || function (mod) {
  13606. return (mod && mod.__esModule) ? mod : { "default": mod };
  13607. };
  13608. Object.defineProperty(exports, "__esModule", ({ value: true }));
  13609. exports.GitlabRemoveVariableRowComponent = void 0;
  13610. const jquery_slim_1 = __importDefault(__webpack_require__(1));
  13611. const config_1 = __webpack_require__(0);
  13612. function GitlabRemoveVariableRowComponent() {
  13613. const removeBtnHtml = `
  13614. <button data-testid="remove-ci-variable-row" aria-label="Remove variable" type="button" class="btn ml-2 gl-md-ml-3 gl-mb-3 custom-remove-variable-btn btn-danger btn-md gl-button btn-danger-secondary btn-icon">
  13615. <svg data-testid="clear-icon" role="img" aria-hidden="true" class="gl-button-icon gl-icon s16">
  13616. <use href="${config_1.gitlabSvgIconUrl}#clear">
  13617. </use>
  13618. </svg>
  13619. </button>`;
  13620. return (0, jquery_slim_1.default)(removeBtnHtml);
  13621. }
  13622. exports.GitlabRemoveVariableRowComponent = GitlabRemoveVariableRowComponent;
  13623.  
  13624.  
  13625. /***/ }),
  13626. /* 24 */
  13627. /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
  13628.  
  13629. "use strict";
  13630.  
  13631. var __importDefault = (this && this.__importDefault) || function (mod) {
  13632. return (mod && mod.__esModule) ? mod : { "default": mod };
  13633. };
  13634. Object.defineProperty(exports, "__esModule", ({ value: true }));
  13635. exports.GitlabSelectionComponent = void 0;
  13636. const config_1 = __webpack_require__(0);
  13637. const jquery_slim_1 = __importDefault(__webpack_require__(1));
  13638. function GitlabSelectionComponent(options, selectedValue, data_testId, data_qaSelector, action) {
  13639. const gitlabSelectionHtml = `
  13640. <div class="select-wrapper gl-relative gl-w-full">
  13641. <select class="js-ci-variable-input-variable-type form-control select-control"
  13642. data-testid="${data_testId}"
  13643. data-qa-selector="${data_qaSelector}">
  13644. ${options.map((option) => {
  13645. return `<option ${option === selectedValue ? 'selected="selected"' : ''} value="${option}">${option}</option>`;
  13646. })}
  13647. </select>
  13648. <svg data-testid="chevron-down-icon"
  13649. role="img"
  13650. aria-hidden="true"
  13651. class="gl-absolute gl-right-3 gl-top-3 gl-text-gray-500 gl-icon s16 gl-fill-current"
  13652. data-hidden="true">
  13653. <use href="${config_1.gitlabSvgIconUrl}#chevron-down"></use>
  13654. </svg>
  13655. </div>
  13656. `;
  13657. const gitlabSelectionJObject = (0, jquery_slim_1.default)(gitlabSelectionHtml);
  13658. gitlabSelectionJObject.change(function () {
  13659. action((0, jquery_slim_1.default)(this).val());
  13660. });
  13661. return gitlabSelectionJObject;
  13662. }
  13663. exports.GitlabSelectionComponent = GitlabSelectionComponent;
  13664.  
  13665.  
  13666. /***/ }),
  13667. /* 25 */
  13668. /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
  13669.  
  13670. "use strict";
  13671.  
  13672. var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
  13673. function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
  13674. return new (P || (P = Promise))(function (resolve, reject) {
  13675. function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
  13676. function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
  13677. function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
  13678. step((generator = generator.apply(thisArg, _arguments || [])).next());
  13679. });
  13680. };
  13681. Object.defineProperty(exports, "__esModule", ({ value: true }));
  13682. exports.ChooseBranchDropdownComponent = void 0;
  13683. const config_1 = __webpack_require__(0);
  13684. const shared_1 = __webpack_require__(2);
  13685. const shared_components_1 = __webpack_require__(7);
  13686. function ChooseBranchDropdownComponent() {
  13687. return __awaiter(this, void 0, void 0, function* () {
  13688. const glClient = shared_1.GitlabHttpClient.getInstance();
  13689. const glGraphqlClient = shared_1.GitlabGraphqlClient.getInstance();
  13690. const branches = yield glClient.getProjectBranches();
  13691. const dropdownItems = branches === null || branches === void 0 ? void 0 : branches.map((branchName) => ({
  13692. text: branchName,
  13693. fn: () => __awaiter(this, void 0, void 0, function* () {
  13694. const fullPath = (0, shared_1.getProjectFullPath)(window.location.pathname);
  13695. if (fullPath) {
  13696. const vars = yield glGraphqlClient.getCiConfigVariables(fullPath, `refs/heads/${branchName}`);
  13697. if (!vars)
  13698. return;
  13699. const newPipelineSchedule = yield glClient.createPipelineSchedule(Object.assign(Object.assign({}, config_1.gitlabDefaultPipelineSchedule), { ref: branchName }));
  13700. yield Promise.all(vars.map((_var) => glClient.createPipelineScheduleVariable(newPipelineSchedule === null || newPipelineSchedule === void 0 ? void 0 : newPipelineSchedule.id, _var)));
  13701. if (!!newPipelineSchedule && confirm(`Create schedule success! Go to the edit page?`)) {
  13702. window.location.href = `${window.location.href}/${newPipelineSchedule === null || newPipelineSchedule === void 0 ? void 0 : newPipelineSchedule.id}/edit`;
  13703. }
  13704. else {
  13705. window.location.reload();
  13706. }
  13707. }
  13708. }),
  13709. }));
  13710. return (0, shared_components_1.GitlabDropdownComponent)('choose-branch', 'Copy vars from branch', dropdownItems || [{ text: 'No branches found', fn: () => { } }]);
  13711. });
  13712. }
  13713. exports.ChooseBranchDropdownComponent = ChooseBranchDropdownComponent;
  13714.  
  13715.  
  13716. /***/ }),
  13717. /* 26 */
  13718. /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
  13719.  
  13720. "use strict";
  13721.  
  13722. var __importDefault = (this && this.__importDefault) || function (mod) {
  13723. return (mod && mod.__esModule) ? mod : { "default": mod };
  13724. };
  13725. Object.defineProperty(exports, "__esModule", ({ value: true }));
  13726. exports.GitlabToolSettingsBtnComponent = void 0;
  13727. const jquery_slim_1 = __importDefault(__webpack_require__(1));
  13728. const config_1 = __webpack_require__(0);
  13729. const gl_settings_modal_component_1 = __webpack_require__(27);
  13730. let glToolsSettingsModalOpenedState = false;
  13731. function GitlabToolSettingsBtnComponent() {
  13732. const glToolSettingsBtnHtml = `
  13733. <a class="btn gl-button btn-default ml-2">
  13734. <svg class="s16" data-testid="settings-icon">
  13735. <use href="${config_1.gitlabSvgIconUrl}#settings"></use>
  13736. </svg>
  13737. <span>Schedule Settings</span>
  13738. </a>`;
  13739. const glToolSettingsBtn = (0, jquery_slim_1.default)(glToolSettingsBtnHtml);
  13740. const addModal = () => {
  13741. const modalJObject = (0, gl_settings_modal_component_1.GitlabToolSettingsModalComponent)((eventType, payload) => {
  13742. switch (eventType) {
  13743. case 'close':
  13744. case 'cancel':
  13745. modalJObject.remove();
  13746. break;
  13747. case 'okay':
  13748. const [gitlabToken, gitlabToolSettings] = payload;
  13749. (0, config_1.saveGitlabToken)(gitlabToken);
  13750. (0, config_1.saveGitlabToolSettings)(gitlabToolSettings);
  13751. modalJObject.remove();
  13752. // reload page
  13753. window.location.reload();
  13754. break;
  13755. default:
  13756. modalJObject.remove();
  13757. break;
  13758. }
  13759. });
  13760. (0, jquery_slim_1.default)('body').append(modalJObject);
  13761. (0, jquery_slim_1.default)('body').addClass('modal-open');
  13762. };
  13763. const removeModal = () => {
  13764. (0, jquery_slim_1.default)('.modal').remove();
  13765. (0, jquery_slim_1.default)('body').removeClass('modal-open');
  13766. glToolsSettingsModalOpenedState = false;
  13767. };
  13768. const toggleModal = () => {
  13769. if (glToolsSettingsModalOpenedState) {
  13770. removeModal();
  13771. }
  13772. else {
  13773. addModal();
  13774. }
  13775. };
  13776. glToolSettingsBtn.on('click', toggleModal);
  13777. return glToolSettingsBtn;
  13778. }
  13779. exports.GitlabToolSettingsBtnComponent = GitlabToolSettingsBtnComponent;
  13780.  
  13781.  
  13782. /***/ }),
  13783. /* 27 */
  13784. /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
  13785.  
  13786. "use strict";
  13787.  
  13788. var __importDefault = (this && this.__importDefault) || function (mod) {
  13789. return (mod && mod.__esModule) ? mod : { "default": mod };
  13790. };
  13791. Object.defineProperty(exports, "__esModule", ({ value: true }));
  13792. exports.GitlabToolSettingsModalComponent = void 0;
  13793. const jquery_slim_1 = __importDefault(__webpack_require__(1));
  13794. const config_1 = __webpack_require__(0);
  13795. const shared_1 = __webpack_require__(2);
  13796. function GitlabToolSettingsModalComponent(cbEvent) {
  13797. const modalHtml = `<div style="position: absolute; z-index: 1040;">
  13798. <div role="dialog" aria-label="Gitlab Tool Settings" class="modal show gl-modal" aria-modal="true"
  13799. style="display: flex;">
  13800. <div class="modal-dialog modal-md modal-dialog-scrollable">
  13801. <span tabindex="0" />
  13802. <div tabindex="-1" class="modal-content">
  13803. <header class="modal-header">
  13804. <h4 class="modal-title">Gitlab Tool Settings</h4>
  13805. <button aria-label="Close" type="button"
  13806. class="btn btn-default btn-sm gl-button btn-default-tertiary btn-icon js-modal-action-close">
  13807. <svg data-testid="close-icon" role="img" aria-hidden="true" class="gl-button-icon gl-icon s16">
  13808. <use href="${config_1.gitlabSvgIconUrl}#close" />
  13809. </svg>
  13810. </button>
  13811. </header>
  13812. <div class="modal-body" style="height: 60vh;">
  13813. <form class="">
  13814. <div class="separator" style="margin-top:0;">Gitlab API Settings</div>
  13815. <div role="group" class="form-group gl-form-group">
  13816. <label for="input-1" class="d-block col-form-label">Gitlab token:</label>
  13817. <div>
  13818. <div role="group" class="input-group">
  13819. <div class="input-group-prepend">
  13820. <div class="input-group-text">Token</div>
  13821. </div>
  13822. <input id="i-gitlab-token" type="password" class="form-control gl-form-input" aria-label="">
  13823. </div>
  13824. <div class="gl-alert gl-alert-warning mt-1">
  13825. <svg data-testid="warning-icon" role="img" aria-hidden="true" class="gl-icon s16 gl-alert-icon">
  13826. <use href="${config_1.gitlabSvgIconUrl}#warning"></use>
  13827. </svg>
  13828. <div role="alert" aria-live="assertive" class="gl-alert-content">
  13829. <h2 class="gl-alert-title">Warning</h2>
  13830. <div class="gl-alert-body"> Do not share your token with anyone. <br> Access to the \`api\` with
  13831. read/write permission is mandatory for the token!!! </div>
  13832. </div>
  13833. </div>
  13834. <span class="form-text text-gl-muted">Don't have a token? <a
  13835. href="https://gitlab.com/-/profile/personal_access_tokens" target="_blank">Create one</a>
  13836. </span>
  13837. </div>
  13838. <div role="group" class="form-group gl-form-group mt-1">
  13839. <label for="i-gitlab-rest-per-page" class="d-block col-form-label"> Number of items per page: </label>
  13840. <div>
  13841. <input id="i-gitlab-rest-per-page" type="number" placeholder="50" required="required"
  13842. aria-required="true" class="gl-form-input form-control">
  13843. </div>
  13844. </div>
  13845. </div>
  13846. <div class="separator">Download ENV vars file Settings</div>
  13847. <div role="group" class="form-group gl-form-group">
  13848. <label for="i-wrap-var-value" class="d-block col-form-label"> Wrap the variable value with: </label>
  13849. <div>
  13850. <select id="i-wrap-the-variable-value-with" required="required" aria-required="true"
  13851. class="gl-form-select custom-select">
  13852. <option value="none">None</option>
  13853. <option value="single_quotation_mark">Single quotation mark <b>'</b>
  13854. </option>
  13855. <option value="double_quotation_mark">Double quotation mark <b>"</b>
  13856. </option>
  13857. </select>
  13858. </div>
  13859. <small class="form-text text-gl-muted">Wrap the variable value in the ENV vars download file. Example:
  13860. <span style="color: dimgray;">VAR_X='abc'</span> or <span style="color: dimgray;">VAR_X="abc"</span>,
  13861. etc. </small>
  13862. </div>
  13863. <div role="group" class="form-group gl-form-group mb-1"
  13864. title="Including variables defined in .gitlab-ci.yml. See: https://docs.gitlab.com/ee/api/graphql/reference/#ciconfigvariable">
  13865. <div class="gl-form-checkbox custom-control custom-checkbox">
  13866. <input id="i-include-all-variables" type="checkbox" name="checkboxes-4" class="custom-control-input"
  13867. value="squash">
  13868. <label for="i-include-all-variables" class="custom-control-label">Include all variables </label>
  13869. </div>
  13870. </div>
  13871. <div role="group" class="form-group gl-form-group mb-1">
  13872. <div class="gl-form-checkbox custom-control custom-checkbox">
  13873. <input id="i-replace-enter-with-n" type="checkbox" name="checkboxes-8" class="custom-control-input"
  13874. value="squash">
  13875. <label for="i-replace-enter-with-n" class="custom-control-label">Replace enter with <code>\\n</code>
  13876. </label>
  13877. </div>
  13878. </div>
  13879. <div class="separator">Schedule page Settings</div>
  13880. <div role="group" class="form-group gl-form-group">
  13881. <label for="i-wrap-var-value" class="d-block col-form-label"
  13882. title="Choose to take options from variable description or from Gitlab variable options (defined in .gitlab-ci.yml) or both.">
  13883. Get the options from: </label>
  13884. <div>
  13885. <select id="i-get-the-options-from" required="required" aria-required="true"
  13886. class="gl-form-select custom-select">
  13887. <option value="var_description">Variable description</option>
  13888. <option value="gitlab_variable_options"
  13889. title="See: https://docs.gitlab.com/ee/ci/yaml/#variablesoptions">Gitlab variable options</option>
  13890. <option value="merge_both">Combine both</option>
  13891. </select>
  13892. </div>
  13893. <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
  13894. href="https://docs.gitlab.com/ee/ci/yaml/#variablesoptions" target="_blank">Gitlab variable options</a>) or both.
  13895. </small>
  13896. </div>
  13897. <div role="group" class="form-group gl-form-group mb-1">
  13898. <div class="gl-form-checkbox custom-control custom-checkbox">
  13899. <input id="i-schedule-page-auto-show-dropdown" type="checkbox" name="checkboxes-5"
  13900. class="custom-control-input" disabled checked="checked">
  13901. <label for="i-schedule-page-auto-show-dropdown" class="custom-control-label">Auto show dropdown(s)
  13902. </label>
  13903. </div>
  13904. </div>
  13905. <div role="group" class="form-group gl-form-group mb-1">
  13906. <div class="gl-form-checkbox custom-control custom-checkbox">
  13907. <input id="i-enable-markdown-var-description" type="checkbox" name="checkboxes-6"
  13908. class="custom-control-input" disabled checked="checked">
  13909. <label for="i-enable-markdown-var-description" class="custom-control-label">Enable markdown variable
  13910. description
  13911. </label>
  13912. </div>
  13913. </div>
  13914. <div role="group" class="form-group gl-form-group mb-1">
  13915. <div class="gl-form-checkbox custom-control custom-checkbox">
  13916. <input id="i-sort-var-by-name" type="checkbox" name="checkboxes-7" class="custom-control-input"
  13917. disabled checked="unchecked">
  13918. <label for="i-sort-var-by-name" class="custom-control-label">Sort variables by name (A-Z)
  13919. </label>
  13920. </div>
  13921. </div>
  13922. <div class="separator">Default new Schedule Settings</div>
  13923. <div role="group" class="form-group gl-form-group">
  13924. <label for="i-default-schedule-description" class="d-block col-form-label"> Description: </label>
  13925. <div>
  13926. <input id="i-default-schedule-description" type="text" placeholder="default schedule description"
  13927. required="required" aria-required="true" class="gl-form-input form-control">
  13928. </div>
  13929. </div>
  13930. <div role="group" class="form-group gl-form-group">
  13931. <label for="i-default-schedule-interval-pattern" class="d-block col-form-label"> Interval pattern:
  13932. </label>
  13933. <div>
  13934. <input id="i-default-schedule-interval-pattern" type="text" placeholder="0 15 * * *" required="required"
  13935. aria-required="true" class="gl-form-input form-control">
  13936. </div>
  13937. </div>
  13938. <div role="group" class="form-group gl-form-group">
  13939. <label for="i-default-schedule-cron-timezone" class="d-block col-form-label"> Cron timezone: </label>
  13940. <div>
  13941. <input id="i-default-schedule-cron-timezone" type="text" placeholder="UTC" required="required"
  13942. aria-required="true" class="gl-form-input form-control">
  13943. </div>
  13944. </div>
  13945. <div role="group" class="form-group gl-form-group">
  13946. <label for="i-default-schedule-target-branch" class="d-block col-form-label"> Target branch: </label>
  13947. <div>
  13948. <input id="i-default-schedule-target-branch" type="text" placeholder="main" required="required"
  13949. aria-required="true" class="gl-form-input form-control">
  13950. </div>
  13951. </div>
  13952. <div role="group" class="form-group gl-form-group">
  13953. <div class="gl-form-checkbox custom-control custom-checkbox">
  13954. <input id="i-default-schedule-active-by-default" type="checkbox" name="checkboxes-4"
  13955. class="custom-control-input" value="squash">
  13956. <label for="i-default-schedule-active-by-default" class="custom-control-label">Active by default
  13957. </label>
  13958. </div>
  13959. </div>
  13960. </form>
  13961. </div>
  13962. <footer class="modal-footer">
  13963. <button type="button" class="btn js-modal-action-cancel btn-default btn-md gl-button">
  13964. <span class="gl-button-text">Cancel</span>
  13965. </button>
  13966. <button type="button"
  13967. class="btn js-modal-action-secondary btn-confirm btn-md gl-button btn-confirm-secondary">
  13968. <span class="gl-button-text">Discard Changes</span>
  13969. </button>
  13970. <button type="button" class="btn js-modal-action-primary btn-confirm btn-md gl-button">
  13971. <span class="gl-button-text">Okay</span>
  13972. </button>
  13973. </footer>
  13974. </div>
  13975. <span tabindex="0" />
  13976. </div>
  13977. </div>
  13978. <div class="modal-backdrop" />
  13979. </div>
  13980. `;
  13981. const modalJObject = (0, jquery_slim_1.default)(modalHtml);
  13982. // Inject the values to the modal
  13983. const updateData = () => {
  13984. // Gitlab token
  13985. modalJObject.find('#i-gitlab-token').val(config_1.gitlabToken);
  13986. modalJObject.find('#i-gitlab-rest-per-page').val(config_1.gitlabRestPerPage);
  13987. // wrap the variable value with
  13988. switch (config_1.wrappedVarBy) {
  13989. case '':
  13990. modalJObject.find('select#i-wrap-the-variable-value-with').val('none');
  13991. break;
  13992. case "'":
  13993. modalJObject.find('select#i-wrap-the-variable-value-with').val('single_quotation_mark');
  13994. break;
  13995. case '"':
  13996. modalJObject.find('select#i-wrap-the-variable-value-with').val('double_quotation_mark');
  13997. break;
  13998. default:
  13999. modalJObject.find('select#i-wrap-the-variable-value-with').val('none');
  14000. break;
  14001. }
  14002. modalJObject.find('#i-include-all-variables').prop('checked', config_1.includeAllVariables);
  14003. modalJObject.find('#i-get-the-options-from').val(config_1.getTheOptionsFrom);
  14004. modalJObject.find('#i-schedule-page-auto-show-dropdown').prop('checked', config_1.autoShowDropDown);
  14005. modalJObject
  14006. .find('#i-enable-markdown-var-description')
  14007. .prop('checked', config_1.enableMarkdownVarDescription);
  14008. modalJObject.find('#i-sort-var-by-name').prop('checked', config_1.sortVarByName);
  14009. modalJObject.find('#i-replace-enter-with-n').prop('checked', config_1.replaceEnterWithN);
  14010. const { active, cron, description, cron_timezone, ref } = config_1.gitlabDefaultPipelineSchedule;
  14011. modalJObject.find('#i-default-schedule-description').val(description);
  14012. modalJObject.find('#i-default-schedule-interval-pattern').val(cron);
  14013. modalJObject.find('#i-default-schedule-cron-timezone').val(cron_timezone);
  14014. modalJObject.find('#i-default-schedule-target-branch').val(ref);
  14015. modalJObject.find('#i-default-schedule-active-by-default').prop('checked', active);
  14016. modalJObject.find('#i-include-all-variables').prop('checked', config_1.includeAllVariables);
  14017. };
  14018. updateData();
  14019. // Get the values from the modal
  14020. const getValues = () => {
  14021. var _a, _b, _c, _d, _e, _f;
  14022. const gitlabToken = ((_a = modalJObject.find('#i-gitlab-token').val()) === null || _a === void 0 ? void 0 : _a.toString()) || '';
  14023. const gitlabRestPerPage = parseInt(((_b = modalJObject.find('#i-gitlab-rest-per-page').val()) === null || _b === void 0 ? void 0 : _b.toString()) || '50');
  14024. const wrappedVarByOption = modalJObject.find('select#i-wrap-the-variable-value-with').val();
  14025. let wrappedVarBy = '';
  14026. switch (wrappedVarByOption) {
  14027. case 'none':
  14028. wrappedVarBy = '';
  14029. break;
  14030. case 'single_quotation_mark':
  14031. wrappedVarBy = "'";
  14032. break;
  14033. case 'double_quotation_mark':
  14034. wrappedVarBy = '"';
  14035. break;
  14036. default:
  14037. wrappedVarBy = '';
  14038. break;
  14039. }
  14040. const getTheOptionsFromOption = modalJObject.find('select#i-get-the-options-from').val();
  14041. let getTheOptionsFrom = shared_1.GetTheOptionsFrom.VAR_DESCRIPTION;
  14042. switch (getTheOptionsFromOption) {
  14043. case 'var_description':
  14044. getTheOptionsFrom = shared_1.GetTheOptionsFrom.VAR_DESCRIPTION;
  14045. break;
  14046. case 'gitlab_variable_options':
  14047. getTheOptionsFrom = shared_1.GetTheOptionsFrom.GITLAB_VARIABLE_OPTIONS;
  14048. break;
  14049. case 'merge_both':
  14050. getTheOptionsFrom = shared_1.GetTheOptionsFrom.MERGE_BOTH;
  14051. break;
  14052. default:
  14053. getTheOptionsFrom = shared_1.GetTheOptionsFrom.VAR_DESCRIPTION;
  14054. break;
  14055. }
  14056. const autoShowDropDown = modalJObject
  14057. .find('#i-schedule-page-auto-show-dropdown')
  14058. .prop('checked');
  14059. const enableMarkdownVarDescription = modalJObject
  14060. .find('#i-enable-markdown-var-description')
  14061. .prop('checked');
  14062. const sortVarByName = modalJObject.find('#i-sort-var-by-name').prop('checked');
  14063. const includeAllVariables = modalJObject.find('#i-include-all-variables').prop('checked');
  14064. const replaceEnterWithN = modalJObject.find('#i-replace-enter-with-n').prop('checked');
  14065. const gitlabDefaultPipelineSchedule = {
  14066. active: modalJObject.find('#i-default-schedule-active-by-default').prop('checked'),
  14067. cron: ((_c = modalJObject.find('#i-default-schedule-interval-pattern').val()) === null || _c === void 0 ? void 0 : _c.toString()) || '0 15 * * *',
  14068. description: ((_d = modalJObject.find('#i-default-schedule-description').val()) === null || _d === void 0 ? void 0 : _d.toString()) ||
  14069. 'Default schedule',
  14070. cron_timezone: ((_e = modalJObject.find('#i-default-schedule-cron-timezone').val()) === null || _e === void 0 ? void 0 : _e.toString()) || 'UTC',
  14071. ref: ((_f = modalJObject.find('#i-default-schedule-target-branch').val()) === null || _f === void 0 ? void 0 : _f.toString()) || 'main',
  14072. };
  14073. return [
  14074. gitlabToken,
  14075. {
  14076. gitlabRestPerPage,
  14077. wrappedVarBy,
  14078. includeAllVariables,
  14079. gitlabDefaultPipelineSchedule,
  14080. getTheOptionsFrom,
  14081. autoShowDropDown,
  14082. enableMarkdownVarDescription,
  14083. sortVarByName,
  14084. replaceEnterWithN,
  14085. },
  14086. ];
  14087. };
  14088. modalJObject.find('.js-modal-action-cancel').on('click', function () {
  14089. cbEvent('cancel', null);
  14090. });
  14091. modalJObject.find('.js-modal-action-secondary').on('click', function () {
  14092. updateData();
  14093. });
  14094. modalJObject.find('.js-modal-action-primary').on('click', function () {
  14095. cbEvent('okay', getValues());
  14096. });
  14097. modalJObject.find('.js-modal-action-close').on('click', function () {
  14098. cbEvent('close', null);
  14099. });
  14100. // outside click
  14101. modalJObject.find('.modal').on('click', function (e) {
  14102. if (e.target === this) {
  14103. cbEvent('discard', null);
  14104. }
  14105. });
  14106. return modalJObject;
  14107. }
  14108. exports.GitlabToolSettingsModalComponent = GitlabToolSettingsModalComponent;
  14109.  
  14110.  
  14111. /***/ }),
  14112. /* 28 */
  14113. /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
  14114.  
  14115. "use strict";
  14116.  
  14117. var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
  14118. function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
  14119. return new (P || (P = Promise))(function (resolve, reject) {
  14120. function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
  14121. function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
  14122. function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
  14123. step((generator = generator.apply(thisArg, _arguments || [])).next());
  14124. });
  14125. };
  14126. Object.defineProperty(exports, "__esModule", ({ value: true }));
  14127. exports.editPipelineSchedulePage = void 0;
  14128. const components_1 = __webpack_require__(6);
  14129. const config_1 = __webpack_require__(0);
  14130. const shared_1 = __webpack_require__(2);
  14131. const { ROW_CONTAINER, REVEAL_VALUES_BTN, SUBMIT_BTN, BRANCH_SELECT, CI_VARIABLE_ROW, VARIABLE_KEY_INPUT, VARIABLE_SECRET_INPUT,
  14132. // VARIABLE_SECRET_HIDDEN_INPUT,
  14133. VARIABLE_SECRET_INPUT_CLASS, REMOVE_VARIABLE_BTN, } = shared_1.EDIT_PIPELINE_SCHEDULE_PAGE_SELECTORS;
  14134. const getPersistedVariables = () => {
  14135. let persistedVariables = (0, shared_1.$)(ROW_CONTAINER);
  14136. if (persistedVariables.length === 0) {
  14137. console.error('[GitLab Duplicator]-persistedVariables is empty');
  14138. }
  14139. else {
  14140. // remove last persistedVariables item from array
  14141. persistedVariables = Array.from(persistedVariables).slice(0, -1);
  14142. }
  14143. return persistedVariables;
  14144. };
  14145. const editPipelineSchedulePage = () => __awaiter(void 0, void 0, void 0, function* () {
  14146. var _a, _b, _c;
  14147. const isShowDropdown = true;
  14148. const varOptionStorage = shared_1.VarOptionStorage.getInstance();
  14149. const glGraphqlClient = shared_1.GitlabGraphqlClient.getInstance();
  14150. // wait for the page to be rendered
  14151. console.info('Waiting for the page to be rendered');
  14152. yield Promise.all([
  14153. (0, shared_1.waitForElement)(ROW_CONTAINER),
  14154. (0, shared_1.waitForElement)(REVEAL_VALUES_BTN),
  14155. (0, shared_1.waitForElement)(SUBMIT_BTN),
  14156. (0, shared_1.waitForElement)(BRANCH_SELECT),
  14157. ]);
  14158. console.info('Page is rendered');
  14159. const revealValuesBtn = (0, shared_1.$)(REVEAL_VALUES_BTN);
  14160. // $('.ci-variable-row-remove-button').css({ 'margin-left': '3rem' });
  14161. const editPipelineScheduleBtn = (0, shared_1.$)(SUBMIT_BTN);
  14162. editPipelineScheduleBtn.hide();
  14163. const newEditPipelineScheduleBtn = (0, shared_1.$)('<button type="button" class="btn btn-confirm btn-md gl-button">Edit pipeline schedule</button>');
  14164. newEditPipelineScheduleBtn.insertAfter(editPipelineScheduleBtn);
  14165. const currentBranch = (0, shared_1.$)(BRANCH_SELECT).find('button').first().text().trim();
  14166. if (revealValuesBtn) {
  14167. revealValuesBtn.trigger('click');
  14168. }
  14169. const fullPath = (0, shared_1.getProjectFullPath)(window.location.pathname);
  14170. const ciConfigVariables = (yield glGraphqlClient.getCiConfigVariables(fullPath, `refs/heads/${currentBranch}`)) || [];
  14171. const descriptionOption = {};
  14172. for (const ciConfigVar of ciConfigVariables) {
  14173. const varOptions = (0, shared_1.getOptionsFromVarDescription)(ciConfigVar.description);
  14174. if (config_1.getTheOptionsFrom === shared_1.GetTheOptionsFrom.VAR_DESCRIPTION) {
  14175. if (varOptions.length > 0) {
  14176. descriptionOption[ciConfigVar.key] = (0, shared_1.getOptionsFromVarDescription)(ciConfigVar.description);
  14177. }
  14178. }
  14179. else if (config_1.getTheOptionsFrom === shared_1.GetTheOptionsFrom.GITLAB_VARIABLE_OPTIONS) {
  14180. if (!!ciConfigVar.valueOptions && ciConfigVar.valueOptions.length > 0) {
  14181. descriptionOption[ciConfigVar.key] = ciConfigVar.valueOptions;
  14182. }
  14183. }
  14184. else if (config_1.getTheOptionsFrom === shared_1.GetTheOptionsFrom.MERGE_BOTH) {
  14185. if (varOptions.length > 0 ||
  14186. (!!ciConfigVar.valueOptions && ciConfigVar.valueOptions.length > 0)) {
  14187. const glValueOptions = ciConfigVar.valueOptions || [];
  14188. // create a set to remove duplicate values
  14189. const mergedOptions = new Set([
  14190. ...(0, shared_1.getOptionsFromVarDescription)(ciConfigVar.description),
  14191. ...glValueOptions,
  14192. ]);
  14193. descriptionOption[ciConfigVar.key] = Array.from(mergedOptions);
  14194. }
  14195. }
  14196. }
  14197. yield varOptionStorage.setOptions(descriptionOption);
  14198. const keyOptions = varOptionStorage.getOptions();
  14199. const persistedVariables = getPersistedVariables();
  14200. // Activated checkbox
  14201. const checkBoxRow = (0, shared_1.$)('.gl-form-checkbox.gl-mb-3.custom-control.custom-checkbox');
  14202. const showValueOptionsDropdownCheckbox = (0, components_1.GitlabCheckboxComponent)('Show dropdown(s)', 'Turn on', 'pl-0', isShowDropdown, 'show_dropdown_checkbox');
  14203. showValueOptionsDropdownCheckbox.insertAfter(checkBoxRow);
  14204. const _rows = [];
  14205. for (const persistedVariable of persistedVariables) {
  14206. const persistedVariableRow = (0, shared_1.$)(persistedVariable);
  14207. persistedVariableRow.find(CI_VARIABLE_ROW).removeClass('gl-mb-3 gl-pb-2');
  14208. //#region Get components
  14209. const variableTypeSelect = persistedVariableRow.find('button.btn.dropdown-toggle.gl-dropdown-toggle');
  14210. const variableType = variableTypeSelect.text().trim();
  14211. const variableKeyInput = persistedVariableRow.find(VARIABLE_KEY_INPUT);
  14212. const variableKey = variableKeyInput.val();
  14213. const variableSecretValueInput = persistedVariableRow.find(VARIABLE_SECRET_INPUT);
  14214. const variableSecretValue = variableSecretValueInput.val();
  14215. const removeVariableBtn = persistedVariableRow.find(REMOVE_VARIABLE_BTN);
  14216. removeVariableBtn.addClass('origin-remove-variable-btn');
  14217. removeVariableBtn.hide();
  14218. const newRemoveVariableBtn = (0, components_1.GitlabRemoveVariableRowComponent)();
  14219. newRemoveVariableBtn.insertAfter(removeVariableBtn);
  14220. newRemoveVariableBtn.on('click', () => {
  14221. persistedVariableRow.remove();
  14222. });
  14223. //#endregion
  14224. //#region Adding var description
  14225. const descriptionTxt = (_a = ciConfigVariables.find((v) => v.key === variableKey)) === null || _a === void 0 ? void 0 : _a.description;
  14226. if (descriptionTxt) {
  14227. const varDescriptionComponent = (0, components_1.VarDescriptionComponent)((0, shared_1.convertMarkdownToHtml)(descriptionTxt));
  14228. removeVariableBtn.on('click', () => {
  14229. varDescriptionComponent.remove();
  14230. });
  14231. // varDescriptionComponent.insertAfter(persistedVariableRow.find('.ci-variable-row'));
  14232. persistedVariableRow.append(varDescriptionComponent);
  14233. }
  14234. else {
  14235. persistedVariableRow.find(CI_VARIABLE_ROW).attr('style', 'padding-bottom: 16px;');
  14236. }
  14237. //#endregion
  14238. // if variableSecretValue is not in the list of options, add it to the list
  14239. if (((_b = keyOptions[variableKey]) === null || _b === void 0 ? void 0 : _b.indexOf(variableSecretValue)) === -1) {
  14240. (_c = keyOptions[variableKey]) === null || _c === void 0 ? void 0 : _c.push(variableSecretValue);
  14241. }
  14242. let variableSecretValueDropdown = null;
  14243. if ((keyOptions[variableKey] || []).length > 0) {
  14244. variableSecretValueDropdown = (0, components_1.GitlabSelectionComponent)(keyOptions[variableKey] || [], variableSecretValue, VARIABLE_SECRET_INPUT_CLASS, 'ci_variable_value_field', (value) => {
  14245. console.log('value', value);
  14246. });
  14247. }
  14248. _rows.push({
  14249. key: variableKey,
  14250. variableType,
  14251. original: {
  14252. valueInput: variableSecretValueInput,
  14253. },
  14254. clone: variableSecretValueDropdown
  14255. ? {
  14256. valueInput: variableSecretValueDropdown,
  14257. }
  14258. : null,
  14259. });
  14260. }
  14261. const reloadForm = (allowShowDropdown) => {
  14262. var _a, _b;
  14263. for (const row of _rows) {
  14264. if (allowShowDropdown) {
  14265. if (row.clone) {
  14266. if (row.original.valueInput.is(':visible')) {
  14267. // alow empty value
  14268. const currentValue = row.original.valueInput.val();
  14269. if (((_a = keyOptions[row.key]) === null || _a === void 0 ? void 0 : _a.indexOf(currentValue)) === -1) {
  14270. (_b = keyOptions[row.key]) === null || _b === void 0 ? void 0 : _b.push(currentValue);
  14271. }
  14272. row.clone.valueInput = (0, components_1.GitlabSelectionComponent)(keyOptions[row.key] || [], currentValue, 'pipeline-form-ci-variable-value', 'ci_variable_value_field', (value) => {
  14273. console.log('value', value);
  14274. });
  14275. row.clone.valueInput.val(currentValue);
  14276. row.clone.valueInput.replaceAll(row.original.valueInput);
  14277. }
  14278. }
  14279. }
  14280. else {
  14281. if (row.clone) {
  14282. if (row.clone.valueInput.is(':visible')) {
  14283. const currentValue = row.clone.valueInput.val();
  14284. row.original.valueInput.val(currentValue);
  14285. row.original.valueInput.replaceAll(row.clone.valueInput);
  14286. }
  14287. }
  14288. }
  14289. }
  14290. };
  14291. if (isShowDropdown) {
  14292. reloadForm(isShowDropdown);
  14293. }
  14294. showValueOptionsDropdownCheckbox.on('click', (e) => {
  14295. if (e.target.nodeName !== 'INPUT')
  14296. return;
  14297. else {
  14298. const isChecked = (0, shared_1.$)('#show_dropdown_checkbox').is(':checked');
  14299. reloadForm(isChecked);
  14300. editPipelineScheduleBtn.show();
  14301. newEditPipelineScheduleBtn.hide();
  14302. (0, shared_1.$)('.origin-remove-variable-btn').show();
  14303. (0, shared_1.$)('.custom-remove-variable-btn').hide();
  14304. }
  14305. });
  14306. //#region Reveal button click event
  14307. revealValuesBtn.on('click', () => {
  14308. var _a, _b;
  14309. const _isShowDropdown = (0, shared_1.$)('#show_dropdown_checkbox').is(':checked');
  14310. const isHidden = revealValuesBtn.text().includes('Reveal value');
  14311. if (isHidden) {
  14312. if (_isShowDropdown) {
  14313. for (const row of _rows) {
  14314. (_a = row.clone) === null || _a === void 0 ? void 0 : _a.valueInput.show();
  14315. }
  14316. }
  14317. else {
  14318. // do nothing
  14319. }
  14320. }
  14321. else {
  14322. if (_isShowDropdown) {
  14323. for (const row of _rows) {
  14324. (_b = row.clone) === null || _b === void 0 ? void 0 : _b.valueInput.hide();
  14325. }
  14326. }
  14327. else {
  14328. // do nothing
  14329. }
  14330. }
  14331. });
  14332. //#endregion
  14333. newEditPipelineScheduleBtn.on('click', () => __awaiter(void 0, void 0, void 0, function* () {
  14334. var _d;
  14335. const updatedVariables = [];
  14336. const crtPersistedVariables = getPersistedVariables();
  14337. for (const persistedVariable of crtPersistedVariables) {
  14338. const persistedVariableRow = (0, shared_1.$)(persistedVariable);
  14339. const variableKeyInput = persistedVariableRow.find(VARIABLE_KEY_INPUT);
  14340. const variableKey = variableKeyInput.val();
  14341. if (variableKey === undefined)
  14342. continue;
  14343. const variableSecretValueInput = persistedVariableRow.find(VARIABLE_SECRET_INPUT);
  14344. const variableSecretValue = variableSecretValueInput.val();
  14345. if (variableSecretValue === undefined)
  14346. continue;
  14347. updatedVariables.push({
  14348. key: variableKey,
  14349. value: variableSecretValue,
  14350. });
  14351. }
  14352. // get last div
  14353. const scheduleVueElement = (_d = (0, shared_1.$)('#content-body > div.col-lg-8.gl-pl-0')) === null || _d === void 0 ? void 0 : _d.get()[0];
  14354. const scheduleVueInstanceData = scheduleVueElement.__vue__.$data;
  14355. const updatedPipelineSchedule = {
  14356. description: scheduleVueInstanceData.description,
  14357. cron: scheduleVueInstanceData.cron,
  14358. cronTimezone: scheduleVueInstanceData.cronTimezone,
  14359. ref: scheduleVueInstanceData.scheduleRef,
  14360. activate: scheduleVueInstanceData.activated,
  14361. variables: updatedVariables,
  14362. };
  14363. yield glGraphqlClient.updatePipelineSchedule((0, shared_1.getScheduleIdFromUrl)(window.location.pathname), fullPath, updatedPipelineSchedule);
  14364. // navigate to pipeline schedules page
  14365. window.location.href = `${window.location.origin}/${fullPath}/-/pipeline_schedules`;
  14366. }));
  14367. //#endregion
  14368. });
  14369. exports.editPipelineSchedulePage = editPipelineSchedulePage;
  14370.  
  14371.  
  14372. /***/ }),
  14373. /* 29 */
  14374. /***/ ((__unused_webpack_module, exports) => {
  14375.  
  14376. "use strict";
  14377.  
  14378. Object.defineProperty(exports, "__esModule", ({ value: true }));
  14379. exports.EDIT_PIPELINE_SCHEDULE_PAGE_SELECTORS = exports.GetTheOptionsFrom = void 0;
  14380. var GetTheOptionsFrom;
  14381. (function (GetTheOptionsFrom) {
  14382. GetTheOptionsFrom["VAR_DESCRIPTION"] = "var_description";
  14383. GetTheOptionsFrom["GITLAB_VARIABLE_OPTIONS"] = "gitlab_variable_options";
  14384. GetTheOptionsFrom["MERGE_BOTH"] = "merge_both";
  14385. })(GetTheOptionsFrom = exports.GetTheOptionsFrom || (exports.GetTheOptionsFrom = {}));
  14386. // Define selectors of EditPipelineSchedulePage component
  14387. exports.EDIT_PIPELINE_SCHEDULE_PAGE_SELECTORS = {
  14388. ROW_CONTAINER: 'fieldset > div > div',
  14389. REVEAL_VALUES_BTN: 'button[data-testid="variable-security-btn"]',
  14390. SUBMIT_BTN: 'button[data-testid="schedule-submit-button"]',
  14391. BRANCH_SELECT: 'div[id="schedule-target-branch-tag"]',
  14392. CI_VARIABLE_ROW: 'div[data-testid="ci-variable-row"]',
  14393. VARIABLE_KEY_INPUT: 'input[data-testid="pipeline-form-ci-variable-key"]',
  14394. VARIABLE_SECRET_HIDDEN_INPUT: 'textarea[data-testid="pipeline-form-ci-variable-hidden-value"]',
  14395. VARIABLE_SECRET_INPUT_CLASS: 'pipeline-form-ci-variable-value',
  14396. VARIABLE_SECRET_INPUT: `:is(textarea, select)[data-testid="pipeline-form-ci-variable-value"]`,
  14397. REMOVE_VARIABLE_BTN: 'button[data-testid="remove-ci-variable-row"]',
  14398. };
  14399.  
  14400.  
  14401. /***/ }),
  14402. /* 30 */
  14403. /***/ ((__unused_webpack_module, exports) => {
  14404.  
  14405. "use strict";
  14406.  
  14407. Object.defineProperty(exports, "__esModule", ({ value: true }));
  14408. exports.HttpMethods = void 0;
  14409. var HttpMethods;
  14410. (function (HttpMethods) {
  14411. HttpMethods["GET"] = "GET";
  14412. HttpMethods["POST"] = "POST";
  14413. HttpMethods["PUT"] = "PUT";
  14414. HttpMethods["PATCH"] = "PATCH";
  14415. HttpMethods["DELETE"] = "DELETE";
  14416. })(HttpMethods = exports.HttpMethods || (exports.HttpMethods = {}));
  14417.  
  14418.  
  14419. /***/ }),
  14420. /* 31 */
  14421. /***/ ((__unused_webpack_module, exports) => {
  14422.  
  14423. "use strict";
  14424.  
  14425. Object.defineProperty(exports, "__esModule", ({ value: true }));
  14426. exports.updatePipelineScheduleMutationStr = exports.getPipelineScheduleQueryStr = exports.getPipelineSchedulesQueryStr = exports.getCiConfigVariablesQueryStr = void 0;
  14427. exports.getCiConfigVariablesQueryStr = `query ciConfigVariables($fullPath: ID!, $ref: String!) {
  14428. project(fullPath: $fullPath) {
  14429. id
  14430. ciConfigVariables(ref: $ref) {
  14431. description
  14432. key
  14433. value
  14434. valueOptions
  14435. __typename
  14436. }
  14437. __typename
  14438. }
  14439. }
  14440. `;
  14441. exports.getPipelineSchedulesQueryStr = `query getPipelineSchedulesQuery($projectPath: ID!, $status: PipelineScheduleStatus, $ids: [ID!] = null, $sortValue: PipelineScheduleSort, $first: Int, $last: Int, $prevPageCursor: String = "", $nextPageCursor: String = "") {
  14442. currentUser {
  14443. id
  14444. username
  14445. __typename
  14446. }
  14447. project(fullPath: $projectPath) {
  14448. id
  14449. projectPlanLimits {
  14450. ciPipelineSchedules
  14451. __typename
  14452. }
  14453. pipelineSchedules(
  14454. status: $status
  14455. ids: $ids
  14456. sort: $sortValue
  14457. first: $first
  14458. last: $last
  14459. after: $nextPageCursor
  14460. before: $prevPageCursor
  14461. ) {
  14462. count
  14463. nodes {
  14464. id
  14465. description
  14466. cron
  14467. cronTimezone
  14468. ref
  14469. forTag
  14470. editPath
  14471. refPath
  14472. refForDisplay
  14473. lastPipeline {
  14474. id
  14475. detailedStatus {
  14476. id
  14477. group
  14478. icon
  14479. label
  14480. text
  14481. detailsPath
  14482. __typename
  14483. }
  14484. __typename
  14485. }
  14486. active
  14487. nextRunAt
  14488. realNextRun
  14489. owner {
  14490. id
  14491. username
  14492. avatarUrl
  14493. name
  14494. webPath
  14495. __typename
  14496. }
  14497. variables {
  14498. nodes {
  14499. id
  14500. variableType
  14501. key
  14502. value
  14503. __typename
  14504. }
  14505. __typename
  14506. }
  14507. userPermissions {
  14508. playPipelineSchedule
  14509. updatePipelineSchedule
  14510. adminPipelineSchedule
  14511. __typename
  14512. }
  14513. __typename
  14514. }
  14515. pageInfo {
  14516. ...PageInfo
  14517. __typename
  14518. }
  14519. __typename
  14520. }
  14521. __typename
  14522. }
  14523. }
  14524.  
  14525. fragment PageInfo on PageInfo {
  14526. hasNextPage
  14527. hasPreviousPage
  14528. startCursor
  14529. endCursor
  14530. __typename
  14531. }
  14532. `;
  14533. exports.getPipelineScheduleQueryStr = `query getPipelineSchedulesQuery($projectPath: ID!, $status: PipelineScheduleStatus, $ids: [ID!] = null) {
  14534. currentUser {
  14535. id
  14536. username
  14537. __typename
  14538. }
  14539. project(fullPath: $projectPath) {
  14540. id
  14541. pipelineSchedules(status: $status, ids: $ids) {
  14542. count
  14543. nodes {
  14544. id
  14545. description
  14546. cron
  14547. cronTimezone
  14548. ref
  14549. forTag
  14550. editPath
  14551. refPath
  14552. refForDisplay
  14553. lastPipeline {
  14554. id
  14555. detailedStatus {
  14556. id
  14557. group
  14558. icon
  14559. label
  14560. text
  14561. detailsPath
  14562. __typename
  14563. }
  14564. __typename
  14565. }
  14566. active
  14567. nextRunAt
  14568. realNextRun
  14569. owner {
  14570. id
  14571. username
  14572. avatarUrl
  14573. name
  14574. webPath
  14575. __typename
  14576. }
  14577. variables {
  14578. nodes {
  14579. id
  14580. variableType
  14581. key
  14582. value
  14583. __typename
  14584. }
  14585. __typename
  14586. }
  14587. userPermissions {
  14588. playPipelineSchedule
  14589. updatePipelineSchedule
  14590. adminPipelineSchedule
  14591. __typename
  14592. }
  14593. __typename
  14594. }
  14595. __typename
  14596. }
  14597. __typename
  14598. }
  14599. }
  14600. `;
  14601. exports.updatePipelineScheduleMutationStr = `mutation updatePipelineSchedule($input: PipelineScheduleUpdateInput!) {
  14602. pipelineScheduleUpdate(input: $input) {
  14603. clientMutationId
  14604. errors
  14605. __typename
  14606. }
  14607. }
  14608. `;
  14609.  
  14610.  
  14611. /***/ }),
  14612. /* 32 */
  14613. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  14614.  
  14615. (()=>{"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})();
  14616.  
  14617. /***/ }),
  14618. /* 33 */
  14619. /***/ ((__unused_webpack_module, exports) => {
  14620.  
  14621. "use strict";
  14622.  
  14623. Object.defineProperty(exports, "__esModule", ({ value: true }));
  14624. exports.css = void 0;
  14625. exports.css = `
  14626. .separator {
  14627. display: flex;
  14628. align-items: center;
  14629. text-align: center;
  14630. color: #737278;
  14631. font-size: 0.9rem;
  14632. font-weight: 500;
  14633. margin: 2rem 0 0.2rem 0;
  14634. }
  14635.  
  14636. .separator::before,
  14637. .separator::after {
  14638. content: '';
  14639. flex: 1;
  14640. border-bottom: 1px dashed #737278;
  14641. }
  14642.  
  14643. .separator:not(:empty)::before {
  14644. margin-right: .5em;
  14645. }
  14646.  
  14647. .separator:not(:empty)::after {
  14648. margin-left: .5em;
  14649. }
  14650.  
  14651. .modal-body label {
  14652. webkit-user-select: none;
  14653. -khtml-user-select: none;
  14654. -moz-user-select: -moz-none;
  14655. -o-user-select: none;
  14656. user-select: none;
  14657. }
  14658.  
  14659. `;
  14660.  
  14661.  
  14662. /***/ }),
  14663. /* 34 */
  14664. /***/ ((__unused_webpack_module, exports) => {
  14665.  
  14666. "use strict";
  14667.  
  14668. Object.defineProperty(exports, "__esModule", ({ value: true }));
  14669. exports.leftJoin = void 0;
  14670. function leftJoin(left, right, key, select) {
  14671. const rightLookup = right.reduce((lookup, item) => {
  14672. lookup.set(item[key], item);
  14673. return lookup;
  14674. }, new Map());
  14675. return left.map((item) => {
  14676. return select(item, rightLookup.get(item[key]));
  14677. });
  14678. }
  14679. exports.leftJoin = leftJoin;
  14680.  
  14681.  
  14682. /***/ }),
  14683. /* 35 */
  14684. /***/ ((__unused_webpack_module, exports) => {
  14685.  
  14686. "use strict";
  14687.  
  14688. Object.defineProperty(exports, "__esModule", ({ value: true }));
  14689. exports.htmlVarInjector = exports.waitForElement = void 0;
  14690. /**
  14691. * Wait for an element to appear in the DOM
  14692. * @param selector CSS selector
  14693. * @param timeout Timeout in milliseconds
  14694. * @returns
  14695. */
  14696. function waitForElement(selector, timeout = 5000) {
  14697. return new Promise((resolve, reject) => {
  14698. const element = document.querySelector(selector);
  14699. if (element) {
  14700. return resolve(element);
  14701. }
  14702. let observer = null;
  14703. const timeoutId = setTimeout(() => {
  14704. if (observer) {
  14705. observer.disconnect();
  14706. }
  14707. reject(`Element with selector ${selector} not found within ${timeout}ms`);
  14708. }, timeout);
  14709. observer = new MutationObserver(() => {
  14710. const element = document.querySelector(selector);
  14711. if (element) {
  14712. clearTimeout(timeoutId);
  14713. if (observer) {
  14714. observer.disconnect();
  14715. }
  14716. resolve(element);
  14717. }
  14718. });
  14719. observer.observe(document.body, {
  14720. childList: true,
  14721. subtree: true,
  14722. });
  14723. });
  14724. }
  14725. exports.waitForElement = waitForElement;
  14726. // this method will replace all ${key} in html with the value of params[key]
  14727. function htmlVarInjector(html, params) {
  14728. return html.replace(/\${(.*?)}/g, (match, key) => {
  14729. return params[key];
  14730. });
  14731. }
  14732. exports.htmlVarInjector = htmlVarInjector;
  14733.  
  14734.  
  14735. /***/ }),
  14736. /* 36 */
  14737. /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
  14738.  
  14739. "use strict";
  14740.  
  14741. Object.defineProperty(exports, "__esModule", ({ value: true }));
  14742. exports.downloadEnvFile = void 0;
  14743. const config_1 = __webpack_require__(0);
  14744. function saveAs(blob, filename) {
  14745. const url = window.URL.createObjectURL(blob);
  14746. const a = document.createElement('a');
  14747. a.href = url;
  14748. a.download = filename;
  14749. a.click();
  14750. window.URL.revokeObjectURL(url);
  14751. }
  14752. function downloadEnvFile(variables, description) {
  14753. const envFileContent = variables
  14754. .map((variable) => {
  14755. const keyValue = `${variable.key}=${config_1.wrappedVarBy}${variable.value.replaceAll('"', '\\"')}${config_1.wrappedVarBy}`;
  14756. return config_1.replaceEnterWithN ? keyValue.replaceAll('\n', '\\n') : keyValue;
  14757. })
  14758. .join('\n');
  14759. const blob = new Blob([envFileContent], { type: 'text/plain;charset=utf-8' });
  14760. saveAs(blob, `${description}.env`);
  14761. }
  14762. exports.downloadEnvFile = downloadEnvFile;
  14763.  
  14764.  
  14765. /***/ }),
  14766. /* 37 */
  14767. /***/ ((__unused_webpack_module, exports) => {
  14768.  
  14769. "use strict";
  14770.  
  14771. Object.defineProperty(exports, "__esModule", ({ value: true }));
  14772.  
  14773.  
  14774. /***/ }),
  14775. /* 38 */
  14776. /***/ ((__unused_webpack_module, exports) => {
  14777.  
  14778. "use strict";
  14779.  
  14780. Object.defineProperty(exports, "__esModule", ({ value: true }));
  14781.  
  14782.  
  14783. /***/ }),
  14784. /* 39 */
  14785. /***/ ((__unused_webpack_module, exports) => {
  14786.  
  14787. "use strict";
  14788.  
  14789. Object.defineProperty(exports, "__esModule", ({ value: true }));
  14790.  
  14791.  
  14792. /***/ }),
  14793. /* 40 */
  14794. /***/ ((__unused_webpack_module, exports) => {
  14795.  
  14796. "use strict";
  14797.  
  14798. Object.defineProperty(exports, "__esModule", ({ value: true }));
  14799.  
  14800.  
  14801. /***/ }),
  14802. /* 41 */
  14803. /***/ ((__unused_webpack_module, exports) => {
  14804.  
  14805. "use strict";
  14806.  
  14807. Object.defineProperty(exports, "__esModule", ({ value: true }));
  14808.  
  14809.  
  14810. /***/ }),
  14811. /* 42 */
  14812. /***/ ((__unused_webpack_module, exports) => {
  14813.  
  14814. "use strict";
  14815.  
  14816. Object.defineProperty(exports, "__esModule", ({ value: true }));
  14817.  
  14818.  
  14819. /***/ }),
  14820. /* 43 */
  14821. /***/ ((__unused_webpack_module, exports) => {
  14822.  
  14823. "use strict";
  14824.  
  14825. Object.defineProperty(exports, "__esModule", ({ value: true }));
  14826.  
  14827.  
  14828. /***/ }),
  14829. /* 44 */
  14830. /***/ ((__unused_webpack_module, exports) => {
  14831.  
  14832. "use strict";
  14833.  
  14834. Object.defineProperty(exports, "__esModule", ({ value: true }));
  14835.  
  14836.  
  14837. /***/ }),
  14838. /* 45 */
  14839. /***/ ((__unused_webpack_module, exports) => {
  14840.  
  14841. "use strict";
  14842.  
  14843. Object.defineProperty(exports, "__esModule", ({ value: true }));
  14844.  
  14845.  
  14846. /***/ }),
  14847. /* 46 */
  14848. /***/ ((__unused_webpack_module, exports) => {
  14849.  
  14850. "use strict";
  14851.  
  14852. Object.defineProperty(exports, "__esModule", ({ value: true }));
  14853.  
  14854.  
  14855. /***/ }),
  14856. /* 47 */
  14857. /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
  14858.  
  14859. "use strict";
  14860. __webpack_require__.r(__webpack_exports__);
  14861. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  14862. /* harmony export */ isCacheControl: () => (/* binding */ i),
  14863. /* harmony export */ parse: () => (/* binding */ s),
  14864. /* harmony export */ tokenize: () => (/* binding */ n)
  14865. /* harmony export */ });
  14866. 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]}
  14867. //# sourceMappingURL=index.mjs.map
  14868.  
  14869.  
  14870. /***/ }),
  14871. /* 48 */
  14872. /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
  14873.  
  14874. "use strict";
  14875. __webpack_require__.r(__webpack_exports__);
  14876. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  14877. /* harmony export */ deferred: () => (/* binding */ e),
  14878. /* harmony export */ isDeferred: () => (/* binding */ n)
  14879. /* harmony export */ });
  14880. 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]}
  14881. //# sourceMappingURL=index.mjs.map
  14882.  
  14883.  
  14884. /***/ }),
  14885. /* 49 */
  14886. /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
  14887.  
  14888. "use strict";
  14889. __webpack_require__.r(__webpack_exports__);
  14890. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  14891. /* harmony export */ hash: () => (/* binding */ t),
  14892. /* harmony export */ serialize: () => (/* binding */ r)
  14893. /* harmony export */ });
  14894. 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}
  14895. //# sourceMappingURL=index.mjs.map
  14896.  
  14897.  
  14898. /***/ }),
  14899. /* 50 */
  14900. /***/ ((__unused_webpack_module, exports) => {
  14901.  
  14902. "use strict";
  14903.  
  14904. Object.defineProperty(exports, "__esModule", ({ value: true }));
  14905. exports.convertMarkdownToHtml = void 0;
  14906. function convertMarkdownToHtml(markdownString) {
  14907. const boldRegex = /\*\*(.*?)\*\*/g;
  14908. const italicRegex = /\*(.*?)\*/g;
  14909. const strikethroughRegex = /~~(.*?)~~/g;
  14910. const codeRegex = /`(.*?)`/g;
  14911. const linkRegex = /\[(.*?)\]\((.*?)\)/g;
  14912. const breakLineRegex = /\n/g;
  14913. const tabRegex = /\t/g;
  14914. const customOpenTagRegex = /<(.*?)>/g;
  14915. const customCloseTagRegex = /<\/(.*?)>/g;
  14916. const boldHtml = '<strong>$1</strong>';
  14917. const italicHtml = '<em>$1</em>';
  14918. const strikethroughHtml = '<del>$1</del>';
  14919. const codeHtml = '<code>$1</code>';
  14920. const linkHtml = '<a href="$2" target="_blank">$1</a>';
  14921. const breakLineHtml = '<br />';
  14922. const tabHtml = '&nbsp;&nbsp;&nbsp;&nbsp;';
  14923. const customOpenTagHtml = '&lt;$1&gt;';
  14924. const customCloseTagHtml = '&lt;/$1&gt;';
  14925. // convert special characters between backticks to html entities
  14926. // get the text between backticks
  14927. const textBetweenBackticks = markdownString.match(/`(.*?)`/g);
  14928. if (textBetweenBackticks) {
  14929. textBetweenBackticks.forEach((text) => {
  14930. // get the text between backticks
  14931. const textWithoutBackticks = text.replace(/`/g, '');
  14932. // convert special characters to html entities
  14933. const div = document.createElement('div');
  14934. div.innerText = div.textContent = textWithoutBackticks;
  14935. const textWithHtmlEntities = div.innerHTML;
  14936. // replace the text between backticks with the text with html entities
  14937. markdownString = markdownString.replace(text, `\`${textWithHtmlEntities}\``);
  14938. });
  14939. }
  14940. // convert markdown to html
  14941. const htmlString = markdownString
  14942. .replace(customCloseTagRegex, customCloseTagHtml)
  14943. .replace(customOpenTagRegex, customOpenTagHtml)
  14944. .replace(boldRegex, boldHtml)
  14945. .replace(italicRegex, italicHtml)
  14946. .replace(strikethroughRegex, strikethroughHtml)
  14947. .replace(codeRegex, codeHtml)
  14948. .replace(linkRegex, linkHtml)
  14949. .replace(breakLineRegex, breakLineHtml)
  14950. .replace(tabRegex, tabHtml);
  14951. return htmlString;
  14952. }
  14953. exports.convertMarkdownToHtml = convertMarkdownToHtml;
  14954.  
  14955.  
  14956. /***/ }),
  14957. /* 51 */
  14958. /***/ ((__unused_webpack_module, exports) => {
  14959.  
  14960. "use strict";
  14961.  
  14962. Object.defineProperty(exports, "__esModule", ({ value: true }));
  14963. exports.VarDescriptionComponent = void 0;
  14964. function VarDescriptionComponent(text) {
  14965. const varDescriptionHtml = `
  14966. <div class="gl-text-gray-500 pb-4 pt-0 mt-0">
  14967. ${text}
  14968. </div>`;
  14969. return $(varDescriptionHtml);
  14970. }
  14971. exports.VarDescriptionComponent = VarDescriptionComponent;
  14972.  
  14973.  
  14974. /***/ })
  14975. /******/ ]);
  14976. /************************************************************************/
  14977. /******/ // The module cache
  14978. /******/ var __webpack_module_cache__ = {};
  14979. /******/
  14980. /******/ // The require function
  14981. /******/ function __webpack_require__(moduleId) {
  14982. /******/ // Check if module is in cache
  14983. /******/ var cachedModule = __webpack_module_cache__[moduleId];
  14984. /******/ if (cachedModule !== undefined) {
  14985. /******/ return cachedModule.exports;
  14986. /******/ }
  14987. /******/ // Create a new module (and put it into the cache)
  14988. /******/ var module = __webpack_module_cache__[moduleId] = {
  14989. /******/ // no module.id needed
  14990. /******/ // no module.loaded needed
  14991. /******/ exports: {}
  14992. /******/ };
  14993. /******/
  14994. /******/ // Execute the module function
  14995. /******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  14996. /******/
  14997. /******/ // Return the exports of the module
  14998. /******/ return module.exports;
  14999. /******/ }
  15000. /******/
  15001. /************************************************************************/
  15002. /******/ /* webpack/runtime/define property getters */
  15003. /******/ (() => {
  15004. /******/ // define getter functions for harmony exports
  15005. /******/ __webpack_require__.d = (exports, definition) => {
  15006. /******/ for(var key in definition) {
  15007. /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
  15008. /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
  15009. /******/ }
  15010. /******/ }
  15011. /******/ };
  15012. /******/ })();
  15013. /******/
  15014. /******/ /* webpack/runtime/global */
  15015. /******/ (() => {
  15016. /******/ __webpack_require__.g = (function() {
  15017. /******/ if (typeof globalThis === 'object') return globalThis;
  15018. /******/ try {
  15019. /******/ return this || new Function('return this')();
  15020. /******/ } catch (e) {
  15021. /******/ if (typeof window === 'object') return window;
  15022. /******/ }
  15023. /******/ })();
  15024. /******/ })();
  15025. /******/
  15026. /******/ /* webpack/runtime/hasOwnProperty shorthand */
  15027. /******/ (() => {
  15028. /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
  15029. /******/ })();
  15030. /******/
  15031. /******/ /* webpack/runtime/make namespace object */
  15032. /******/ (() => {
  15033. /******/ // define __esModule on exports
  15034. /******/ __webpack_require__.r = (exports) => {
  15035. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  15036. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  15037. /******/ }
  15038. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  15039. /******/ };
  15040. /******/ })();
  15041. /******/
  15042. /************************************************************************/
  15043. /******/
  15044. /******/ // startup
  15045. /******/ // Load entry module and return exports
  15046. /******/ // This entry module is referenced by other modules so it can't be inlined
  15047. /******/ var __webpack_exports__ = __webpack_require__(14);
  15048. /******/
  15049. /******/ })()
  15050. ;

QingJ © 2025

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