From 5b01aac902264516baedcb7bc7ba5921b9659439 Mon Sep 17 00:00:00 2001 From: Syed Galib Ahmed Date: Mon, 16 Feb 2026 11:54:28 +0600 Subject: [PATCH 1/4] refactor: code optimized --- assets/js/admin-builder-archive.js | 5527 +++++++++------------------- 1 file changed, 1794 insertions(+), 3733 deletions(-) diff --git a/assets/js/admin-builder-archive.js b/assets/js/admin-builder-archive.js index f6f81eee3..d5acda56d 100644 --- a/assets/js/admin-builder-archive.js +++ b/assets/js/admin-builder-archive.js @@ -1,4174 +1,2247 @@ /******/ (function() { // webpackBootstrap /******/ var __webpack_modules__ = ({ -/***/ "./assets/src/js/admin/components/delete-directory-modal.js": -/*!******************************************************************!*\ - !*** ./assets/src/js/admin/components/delete-directory-modal.js ***! - \******************************************************************/ -/***/ (function() { - -window.addEventListener('load', function () { - var $ = jQuery; - - // Open Delete Modal - $('.atbdp-directory-delete-link-action').on('click', function (e) { - e.preventDefault(); - var delete_link = $(this).data('delete-link'); - $('.atbdp-directory-delete-link').prop('href', delete_link); - }); +/***/ "./node_modules/axios/index.js": +/*!*************************************!*\ + !*** ./node_modules/axios/index.js ***! + \*************************************/ +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - // Delete Action - $('.atbdp-directory-delete-link').on('click', function (e) { - // e.preventDefault(); - $(this).prepend(' '); - $('.atbdp-directory-delete-cancel-link').removeClass('cptm-modal-toggle'); - $('.atbdp-directory-delete-cancel-link').addClass('atbdp-disabled'); - }); -}); +module.exports = __webpack_require__(/*! ./lib/axios */ "./node_modules/axios/lib/axios.js"); /***/ }), -/***/ "./assets/src/js/admin/components/directory-migration-modal.js": -/*!*********************************************************************!*\ - !*** ./assets/src/js/admin/components/directory-migration-modal.js ***! - \*********************************************************************/ -/***/ (function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) { - -window.addEventListener('load', function () { - var $ = jQuery; - var axios = (__webpack_require__(/*! axios */ "./node_modules/axios/dist/browser/axios.cjs")["default"]); - - // Migration Link - $('.atbdp-directory-migration-link').on('click', function (e) { - e.preventDefault(); - var self = this; - $('.cptm-directory-migration-form').find('.cptm-comfirmation-text').html('Please wait...'); - $('.atbdp-directory-migration-cencel-link').remove(); - $(this).html(' Migrating'); - $(this).addClass('atbdp-disabled'); - var form_data = new FormData(); - form_data.append('action', 'directorist_force_migrate'); - - // Response Success Callback - var responseSuccessCallback = function responseSuccessCallback(response) { - var _response$data; - // console.log( { response } ); - - if (response !== null && response !== void 0 && (_response$data = response.data) !== null && _response$data !== void 0 && _response$data.success) { - var _response$data$messag, _response$data2; - var msg = (_response$data$messag = response === null || response === void 0 || (_response$data2 = response.data) === null || _response$data2 === void 0 ? void 0 : _response$data2.message) !== null && _response$data$messag !== void 0 ? _response$data$messag : 'Migration Successful'; - var alert_content = "\n
\n
\n \n
\n\n
".concat(msg, "
\n
\n "); - $('.cptm-directory-migration-form').find('.cptm-comfirmation-text').html(alert_content); - $(self).remove(); - location.reload(); - return; - } - responseFaildCallback(response); - }; - - // Response Error Callback - var responseFaildCallback = function responseFaildCallback(response) { - var _response$data$messag2, _response$data3; - // console.log( { response } ); - - var msg = (_response$data$messag2 = response === null || response === void 0 || (_response$data3 = response.data) === null || _response$data3 === void 0 ? void 0 : _response$data3.message) !== null && _response$data$messag2 !== void 0 ? _response$data$messag2 : 'Something went wrong please try again'; - var alert_content = "\n
\n
\n \n
\n\n
".concat(msg, "
\n
\n "); - $('.cptm-directory-migration-form').find('.cptm-comfirmation-text').html(alert_content); - $(self).remove(); - }; +/***/ "./node_modules/axios/lib/adapters/xhr.js": +/*!************************************************!*\ + !*** ./node_modules/axios/lib/adapters/xhr.js ***! + \************************************************/ +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - // Send Request - axios.post(directorist_admin.ajax_url, form_data).then(function (response) { - responseSuccessCallback(response); - }).catch(function (response) { - responseFaildCallback(response); - }); - }); -}); +"use strict"; -/***/ }), -/***/ "./assets/src/js/admin/components/import-directory-modal.js": -/*!******************************************************************!*\ - !*** ./assets/src/js/admin/components/import-directory-modal.js ***! - \******************************************************************/ -/***/ (function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) { +var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js"); +var settle = __webpack_require__(/*! ./../core/settle */ "./node_modules/axios/lib/core/settle.js"); +var cookies = __webpack_require__(/*! ./../helpers/cookies */ "./node_modules/axios/lib/helpers/cookies.js"); +var buildURL = __webpack_require__(/*! ./../helpers/buildURL */ "./node_modules/axios/lib/helpers/buildURL.js"); +var buildFullPath = __webpack_require__(/*! ../core/buildFullPath */ "./node_modules/axios/lib/core/buildFullPath.js"); +var parseHeaders = __webpack_require__(/*! ./../helpers/parseHeaders */ "./node_modules/axios/lib/helpers/parseHeaders.js"); +var isURLSameOrigin = __webpack_require__(/*! ./../helpers/isURLSameOrigin */ "./node_modules/axios/lib/helpers/isURLSameOrigin.js"); +var createError = __webpack_require__(/*! ../core/createError */ "./node_modules/axios/lib/core/createError.js"); -function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; } -function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } } -function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; } -window.addEventListener('load', function () { - var axios = (__webpack_require__(/*! axios */ "./node_modules/axios/dist/browser/axios.cjs")["default"]); - var $ = jQuery; +module.exports = function xhrAdapter(config) { + return new Promise(function dispatchXhrRequest(resolve, reject) { + var requestData = config.data; + var requestHeaders = config.headers; + var responseType = config.responseType; - // cptm-import-directory-form - var term_id = 0; - $('.cptm-import-directory-form').on('submit', function (e) { - e.preventDefault(); - var form_feedback = $(this).find('.cptm-form-group-feedback'); - var modal_content = $('.cptm-import-directory-modal').find('.cptm-modal-content'); - var modal_alert = $('.cptm-import-directory-modal-alert'); - var form_data = new FormData(); - form_data.append('action', 'save_imported_post_type_data'); - form_data.append('directorist_nonce', directorist_admin.directorist_nonce); - if (Number.isInteger(term_id) && term_id > 0) { - form_data.append('term_id', term_id); + if (utils.isFormData(requestData)) { + delete requestHeaders['Content-Type']; // Let the browser set it } - var form_fields = $(this).find('.cptm-form-field'); - var general_fields = ['text', 'number']; - $(this).find('button[type=submit] .cptm-loading-icon').removeClass('cptm-d-none'); - var _iterator = _createForOfIteratorHelper(form_fields), - _step; - try { - for (_iterator.s(); !(_step = _iterator.n()).done;) { - var field = _step.value; - if (!field.name.length) { - continue; - } - // General fields - if (general_fields.includes(field.type)) { - form_data.append(field.name, $(field).val()); - } + var request = new XMLHttpRequest(); - // Media fields - if ('file' === field.type) { - form_data.append(field.name, field.files[0]); - } - } - } catch (err) { - _iterator.e(err); - } finally { - _iterator.f(); + // HTTP basic authentication + if (config.auth) { + var username = config.auth.username || ''; + var password = config.auth.password ? unescape(encodeURIComponent(config.auth.password)) : ''; + requestHeaders.Authorization = 'Basic ' + btoa(username + ':' + password); } - var self = this; - form_feedback.html(''); - axios.post(directorist_admin.ajax_url, form_data).then(function (response) { - // console.log( { response } ); - $(self).find('button[type=submit] .cptm-loading-icon').addClass('cptm-d-none'); - - // Store term ID if exist - if (response.data.term_id && Number.isInteger(response.data.term_id) && response.data.term_id > 0) { - term_id = response.data.term_id; - // console.log( 'Term ID has been updated' ); - } - // Show status log - if (response.data && response.data.status.status_log) { - var status_log = response.data.status.status_log; - for (var status in status_log) { - var alert = '
' + status_log[status].message + '
'; - form_feedback.append(alert); - } - } + var fullPath = buildFullPath(config.baseURL, config.url); + request.open(config.method.toUpperCase(), buildURL(fullPath, config.params, config.paramsSerializer), true); - // Reload the page if success - if (response.data && response.data.status && response.data.status.success) { - // console.log( 'reloading...' ); + // Set the request timeout in MS + request.timeout = config.timeout; - modal_content.addClass('cptm-d-none'); - modal_alert.removeClass('cptm-d-none'); - $(self).trigger('reset'); - location.reload(); + function onloadend() { + if (!request) { + return; } - }).catch(function (error) { - console.log({ - error: error - }); - $(self).find('button[type=submit] .cptm-loading-icon').addClass('cptm-d-none'); - }); - }); -}); - -/***/ }), - -/***/ "./node_modules/axios/dist/browser/axios.cjs": -/*!***************************************************!*\ - !*** ./node_modules/axios/dist/browser/axios.cjs ***! - \***************************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/*! Axios v1.13.5 Copyright (c) 2026 Matt Zabriskie and contributors */ - - -/** - * Create a bound version of a function with a specified `this` context - * - * @param {Function} fn - The function to bind - * @param {*} thisArg - The value to be passed as the `this` parameter - * @returns {Function} A new function that will call the original function with the specified `this` context - */ -function bind(fn, thisArg) { - return function wrap() { - return fn.apply(thisArg, arguments); - }; -} - -// utils is a library of generic helper functions non-specific to axios - -const { toString } = Object.prototype; -const { getPrototypeOf } = Object; -const { iterator, toStringTag } = Symbol; - -const kindOf = ((cache) => (thing) => { - const str = toString.call(thing); - return cache[str] || (cache[str] = str.slice(8, -1).toLowerCase()); -})(Object.create(null)); - -const kindOfTest = (type) => { - type = type.toLowerCase(); - return (thing) => kindOf(thing) === type; -}; - -const typeOfTest = (type) => (thing) => typeof thing === type; - -/** - * Determine if a value is a non-null object - * - * @param {Object} val The value to test - * - * @returns {boolean} True if value is an Array, otherwise false - */ -const { isArray } = Array; - -/** - * Determine if a value is undefined - * - * @param {*} val The value to test - * - * @returns {boolean} True if the value is undefined, otherwise false - */ -const isUndefined = typeOfTest("undefined"); - -/** - * Determine if a value is a Buffer - * - * @param {*} val The value to test - * - * @returns {boolean} True if value is a Buffer, otherwise false - */ -function isBuffer(val) { - return ( - val !== null && - !isUndefined(val) && - val.constructor !== null && - !isUndefined(val.constructor) && - isFunction$1(val.constructor.isBuffer) && - val.constructor.isBuffer(val) - ); -} - -/** - * Determine if a value is an ArrayBuffer - * - * @param {*} val The value to test - * - * @returns {boolean} True if value is an ArrayBuffer, otherwise false - */ -const isArrayBuffer = kindOfTest("ArrayBuffer"); - -/** - * Determine if a value is a view on an ArrayBuffer - * - * @param {*} val The value to test - * - * @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false - */ -function isArrayBufferView(val) { - let result; - if (typeof ArrayBuffer !== "undefined" && ArrayBuffer.isView) { - result = ArrayBuffer.isView(val); - } else { - result = val && val.buffer && isArrayBuffer(val.buffer); - } - return result; -} - -/** - * Determine if a value is a String - * - * @param {*} val The value to test - * - * @returns {boolean} True if value is a String, otherwise false - */ -const isString = typeOfTest("string"); - -/** - * Determine if a value is a Function - * - * @param {*} val The value to test - * @returns {boolean} True if value is a Function, otherwise false - */ -const isFunction$1 = typeOfTest("function"); - -/** - * Determine if a value is a Number - * - * @param {*} val The value to test - * - * @returns {boolean} True if value is a Number, otherwise false - */ -const isNumber = typeOfTest("number"); - -/** - * Determine if a value is an Object - * - * @param {*} thing The value to test - * - * @returns {boolean} True if value is an Object, otherwise false - */ -const isObject = (thing) => thing !== null && typeof thing === "object"; - -/** - * Determine if a value is a Boolean - * - * @param {*} thing The value to test - * @returns {boolean} True if value is a Boolean, otherwise false - */ -const isBoolean = (thing) => thing === true || thing === false; - -/** - * Determine if a value is a plain Object - * - * @param {*} val The value to test - * - * @returns {boolean} True if value is a plain Object, otherwise false - */ -const isPlainObject = (val) => { - if (kindOf(val) !== "object") { - return false; - } - - const prototype = getPrototypeOf(val); - return ( - (prototype === null || - prototype === Object.prototype || - Object.getPrototypeOf(prototype) === null) && - !(toStringTag in val) && - !(iterator in val) - ); -}; - -/** - * Determine if a value is an empty object (safely handles Buffers) - * - * @param {*} val The value to test - * - * @returns {boolean} True if value is an empty object, otherwise false - */ -const isEmptyObject = (val) => { - // Early return for non-objects or Buffers to prevent RangeError - if (!isObject(val) || isBuffer(val)) { - return false; - } - - try { - return ( - Object.keys(val).length === 0 && - Object.getPrototypeOf(val) === Object.prototype - ); - } catch (e) { - // Fallback for any other objects that might cause RangeError with Object.keys() - return false; - } -}; - -/** - * Determine if a value is a Date - * - * @param {*} val The value to test - * - * @returns {boolean} True if value is a Date, otherwise false - */ -const isDate = kindOfTest("Date"); - -/** - * Determine if a value is a File - * - * @param {*} val The value to test - * - * @returns {boolean} True if value is a File, otherwise false - */ -const isFile = kindOfTest("File"); - -/** - * Determine if a value is a Blob - * - * @param {*} val The value to test - * - * @returns {boolean} True if value is a Blob, otherwise false - */ -const isBlob = kindOfTest("Blob"); - -/** - * Determine if a value is a FileList - * - * @param {*} val The value to test - * - * @returns {boolean} True if value is a File, otherwise false - */ -const isFileList = kindOfTest("FileList"); - -/** - * Determine if a value is a Stream - * - * @param {*} val The value to test - * - * @returns {boolean} True if value is a Stream, otherwise false - */ -const isStream = (val) => isObject(val) && isFunction$1(val.pipe); - -/** - * Determine if a value is a FormData - * - * @param {*} thing The value to test - * - * @returns {boolean} True if value is an FormData, otherwise false - */ -const isFormData = (thing) => { - let kind; - return ( - thing && - ((typeof FormData === "function" && thing instanceof FormData) || - (isFunction$1(thing.append) && - ((kind = kindOf(thing)) === "formdata" || - // detect form-data instance - (kind === "object" && - isFunction$1(thing.toString) && - thing.toString() === "[object FormData]")))) - ); -}; - -/** - * Determine if a value is a URLSearchParams object - * - * @param {*} val The value to test - * - * @returns {boolean} True if value is a URLSearchParams object, otherwise false - */ -const isURLSearchParams = kindOfTest("URLSearchParams"); - -const [isReadableStream, isRequest, isResponse, isHeaders] = [ - "ReadableStream", - "Request", - "Response", - "Headers", -].map(kindOfTest); - -/** - * Trim excess whitespace off the beginning and end of a string - * - * @param {String} str The String to trim - * - * @returns {String} The String freed of excess whitespace - */ -const trim = (str) => - str.trim ? str.trim() : str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, ""); - -/** - * Iterate over an Array or an Object invoking a function for each item. - * - * If `obj` is an Array callback will be called passing - * the value, index, and complete array for each item. - * - * If 'obj' is an Object callback will be called passing - * the value, key, and complete object for each property. - * - * @param {Object|Array} obj The object to iterate - * @param {Function} fn The callback to invoke for each item - * - * @param {Object} [options] - * @param {Boolean} [options.allOwnKeys = false] - * @returns {any} - */ -function forEach(obj, fn, { allOwnKeys = false } = {}) { - // Don't bother if no value provided - if (obj === null || typeof obj === "undefined") { - return; - } - - let i; - let l; - - // Force an array if not already something iterable - if (typeof obj !== "object") { - /*eslint no-param-reassign:0*/ - obj = [obj]; - } - - if (isArray(obj)) { - // Iterate over array values - for (i = 0, l = obj.length; i < l; i++) { - fn.call(null, obj[i], i, obj); - } - } else { - // Buffer check - if (isBuffer(obj)) { - return; - } - - // Iterate over object keys - const keys = allOwnKeys - ? Object.getOwnPropertyNames(obj) - : Object.keys(obj); - const len = keys.length; - let key; - - for (i = 0; i < len; i++) { - key = keys[i]; - fn.call(null, obj[key], key, obj); - } - } -} - -function findKey(obj, key) { - if (isBuffer(obj)) { - return null; - } - - key = key.toLowerCase(); - const keys = Object.keys(obj); - let i = keys.length; - let _key; - while (i-- > 0) { - _key = keys[i]; - if (key === _key.toLowerCase()) { - return _key; - } - } - return null; -} - -const _global = (() => { - /*eslint no-undef:0*/ - if (typeof globalThis !== "undefined") return globalThis; - return typeof self !== "undefined" - ? self - : typeof window !== "undefined" - ? window - : __webpack_require__.g; -})(); - -const isContextDefined = (context) => - !isUndefined(context) && context !== _global; - -/** - * Accepts varargs expecting each argument to be an object, then - * immutably merges the properties of each object and returns result. - * - * When multiple objects contain the same key the later object in - * the arguments list will take precedence. - * - * Example: - * - * ```js - * const result = merge({foo: 123}, {foo: 456}); - * console.log(result.foo); // outputs 456 - * ``` - * - * @param {Object} obj1 Object to merge - * - * @returns {Object} Result of all merge properties - */ -function merge(/* obj1, obj2, obj3, ... */) { - const { caseless, skipUndefined } = (isContextDefined(this) && this) || {}; - const result = {}; - const assignValue = (val, key) => { - // Skip dangerous property names to prevent prototype pollution - if (key === "__proto__" || key === "constructor" || key === "prototype") { - return; - } - - const targetKey = (caseless && findKey(result, key)) || key; - if (isPlainObject(result[targetKey]) && isPlainObject(val)) { - result[targetKey] = merge(result[targetKey], val); - } else if (isPlainObject(val)) { - result[targetKey] = merge({}, val); - } else if (isArray(val)) { - result[targetKey] = val.slice(); - } else if (!skipUndefined || !isUndefined(val)) { - result[targetKey] = val; - } - }; - - for (let i = 0, l = arguments.length; i < l; i++) { - arguments[i] && forEach(arguments[i], assignValue); - } - return result; -} - -/** - * Extends object a by mutably adding to it the properties of object b. - * - * @param {Object} a The object to be extended - * @param {Object} b The object to copy properties from - * @param {Object} thisArg The object to bind function to - * - * @param {Object} [options] - * @param {Boolean} [options.allOwnKeys] - * @returns {Object} The resulting value of object a - */ -const extend = (a, b, thisArg, { allOwnKeys } = {}) => { - forEach( - b, - (val, key) => { - if (thisArg && isFunction$1(val)) { - Object.defineProperty(a, key, { - value: bind(val, thisArg), - writable: true, - enumerable: true, - configurable: true, - }); - } else { - Object.defineProperty(a, key, { - value: val, - writable: true, - enumerable: true, - configurable: true, - }); - } - }, - { allOwnKeys }, - ); - return a; -}; - -/** - * Remove byte order marker. This catches EF BB BF (the UTF-8 BOM) - * - * @param {string} content with BOM - * - * @returns {string} content value without BOM - */ -const stripBOM = (content) => { - if (content.charCodeAt(0) === 0xfeff) { - content = content.slice(1); - } - return content; -}; - -/** - * Inherit the prototype methods from one constructor into another - * @param {function} constructor - * @param {function} superConstructor - * @param {object} [props] - * @param {object} [descriptors] - * - * @returns {void} - */ -const inherits = (constructor, superConstructor, props, descriptors) => { - constructor.prototype = Object.create( - superConstructor.prototype, - descriptors, - ); - Object.defineProperty(constructor.prototype, "constructor", { - value: constructor, - writable: true, - enumerable: false, - configurable: true, - }); - Object.defineProperty(constructor, "super", { - value: superConstructor.prototype, - }); - props && Object.assign(constructor.prototype, props); -}; - -/** - * Resolve object with deep prototype chain to a flat object - * @param {Object} sourceObj source object - * @param {Object} [destObj] - * @param {Function|Boolean} [filter] - * @param {Function} [propFilter] - * - * @returns {Object} - */ -const toFlatObject = (sourceObj, destObj, filter, propFilter) => { - let props; - let i; - let prop; - const merged = {}; - - destObj = destObj || {}; - // eslint-disable-next-line no-eq-null,eqeqeq - if (sourceObj == null) return destObj; - - do { - props = Object.getOwnPropertyNames(sourceObj); - i = props.length; - while (i-- > 0) { - prop = props[i]; - if ( - (!propFilter || propFilter(prop, sourceObj, destObj)) && - !merged[prop] - ) { - destObj[prop] = sourceObj[prop]; - merged[prop] = true; - } - } - sourceObj = filter !== false && getPrototypeOf(sourceObj); - } while ( - sourceObj && - (!filter || filter(sourceObj, destObj)) && - sourceObj !== Object.prototype - ); - - return destObj; -}; - -/** - * Determines whether a string ends with the characters of a specified string - * - * @param {String} str - * @param {String} searchString - * @param {Number} [position= 0] - * - * @returns {boolean} - */ -const endsWith = (str, searchString, position) => { - str = String(str); - if (position === undefined || position > str.length) { - position = str.length; - } - position -= searchString.length; - const lastIndex = str.indexOf(searchString, position); - return lastIndex !== -1 && lastIndex === position; -}; - -/** - * Returns new array from array like object or null if failed - * - * @param {*} [thing] - * - * @returns {?Array} - */ -const toArray = (thing) => { - if (!thing) return null; - if (isArray(thing)) return thing; - let i = thing.length; - if (!isNumber(i)) return null; - const arr = new Array(i); - while (i-- > 0) { - arr[i] = thing[i]; - } - return arr; -}; - -/** - * Checking if the Uint8Array exists and if it does, it returns a function that checks if the - * thing passed in is an instance of Uint8Array - * - * @param {TypedArray} - * - * @returns {Array} - */ -// eslint-disable-next-line func-names -const isTypedArray = ((TypedArray) => { - // eslint-disable-next-line func-names - return (thing) => { - return TypedArray && thing instanceof TypedArray; - }; -})(typeof Uint8Array !== "undefined" && getPrototypeOf(Uint8Array)); - -/** - * For each entry in the object, call the function with the key and value. - * - * @param {Object} obj - The object to iterate over. - * @param {Function} fn - The function to call for each entry. - * - * @returns {void} - */ -const forEachEntry = (obj, fn) => { - const generator = obj && obj[iterator]; - - const _iterator = generator.call(obj); - - let result; - - while ((result = _iterator.next()) && !result.done) { - const pair = result.value; - fn.call(obj, pair[0], pair[1]); - } -}; - -/** - * It takes a regular expression and a string, and returns an array of all the matches - * - * @param {string} regExp - The regular expression to match against. - * @param {string} str - The string to search. - * - * @returns {Array} - */ -const matchAll = (regExp, str) => { - let matches; - const arr = []; - - while ((matches = regExp.exec(str)) !== null) { - arr.push(matches); - } - - return arr; -}; - -/* Checking if the kindOfTest function returns true when passed an HTMLFormElement. */ -const isHTMLForm = kindOfTest("HTMLFormElement"); - -const toCamelCase = (str) => { - return str - .toLowerCase() - .replace(/[-_\s]([a-z\d])(\w*)/g, function replacer(m, p1, p2) { - return p1.toUpperCase() + p2; - }); -}; - -/* Creating a function that will check if an object has a property. */ -const hasOwnProperty = ( - ({ hasOwnProperty }) => - (obj, prop) => - hasOwnProperty.call(obj, prop) -)(Object.prototype); - -/** - * Determine if a value is a RegExp object - * - * @param {*} val The value to test - * - * @returns {boolean} True if value is a RegExp object, otherwise false - */ -const isRegExp = kindOfTest("RegExp"); - -const reduceDescriptors = (obj, reducer) => { - const descriptors = Object.getOwnPropertyDescriptors(obj); - const reducedDescriptors = {}; - - forEach(descriptors, (descriptor, name) => { - let ret; - if ((ret = reducer(descriptor, name, obj)) !== false) { - reducedDescriptors[name] = ret || descriptor; - } - }); - - Object.defineProperties(obj, reducedDescriptors); -}; - -/** - * Makes all methods read-only - * @param {Object} obj - */ - -const freezeMethods = (obj) => { - reduceDescriptors(obj, (descriptor, name) => { - // skip restricted props in strict mode - if ( - isFunction$1(obj) && - ["arguments", "caller", "callee"].indexOf(name) !== -1 - ) { - return false; - } - - const value = obj[name]; - - if (!isFunction$1(value)) return; - - descriptor.enumerable = false; - - if ("writable" in descriptor) { - descriptor.writable = false; - return; - } - - if (!descriptor.set) { - descriptor.set = () => { - throw Error("Can not rewrite read-only method '" + name + "'"); - }; - } - }); -}; - -const toObjectSet = (arrayOrString, delimiter) => { - const obj = {}; - - const define = (arr) => { - arr.forEach((value) => { - obj[value] = true; - }); - }; - - isArray(arrayOrString) - ? define(arrayOrString) - : define(String(arrayOrString).split(delimiter)); - - return obj; -}; - -const noop = () => {}; - -const toFiniteNumber = (value, defaultValue) => { - return value != null && Number.isFinite((value = +value)) - ? value - : defaultValue; -}; - -/** - * If the thing is a FormData object, return true, otherwise return false. - * - * @param {unknown} thing - The thing to check. - * - * @returns {boolean} - */ -function isSpecCompliantForm(thing) { - return !!( - thing && - isFunction$1(thing.append) && - thing[toStringTag] === "FormData" && - thing[iterator] - ); -} - -const toJSONObject = (obj) => { - const stack = new Array(10); - - const visit = (source, i) => { - if (isObject(source)) { - if (stack.indexOf(source) >= 0) { - return; - } - - //Buffer check - if (isBuffer(source)) { - return source; - } - - if (!("toJSON" in source)) { - stack[i] = source; - const target = isArray(source) ? [] : {}; - - forEach(source, (value, key) => { - const reducedValue = visit(value, i + 1); - !isUndefined(reducedValue) && (target[key] = reducedValue); - }); - - stack[i] = undefined; - - return target; - } - } - - return source; - }; - - return visit(obj, 0); -}; - -const isAsyncFn = kindOfTest("AsyncFunction"); - -const isThenable = (thing) => - thing && - (isObject(thing) || isFunction$1(thing)) && - isFunction$1(thing.then) && - isFunction$1(thing.catch); - -// original code -// https://github.com/DigitalBrainJS/AxiosPromise/blob/16deab13710ec09779922131f3fa5954320f83ab/lib/utils.js#L11-L34 - -const _setImmediate = ((setImmediateSupported, postMessageSupported) => { - if (setImmediateSupported) { - return setImmediate; - } - - return postMessageSupported - ? ((token, callbacks) => { - _global.addEventListener( - "message", - ({ source, data }) => { - if (source === _global && data === token) { - callbacks.length && callbacks.shift()(); - } - }, - false, - ); - - return (cb) => { - callbacks.push(cb); - _global.postMessage(token, "*"); - }; - })(`axios@${Math.random()}`, []) - : (cb) => setTimeout(cb); -})(typeof setImmediate === "function", isFunction$1(_global.postMessage)); - -const asap = - typeof queueMicrotask !== "undefined" - ? queueMicrotask.bind(_global) - : (typeof process !== "undefined" && process.nextTick) || _setImmediate; - -// ********************* - -const isIterable = (thing) => thing != null && isFunction$1(thing[iterator]); - -var utils$1 = { - isArray, - isArrayBuffer, - isBuffer, - isFormData, - isArrayBufferView, - isString, - isNumber, - isBoolean, - isObject, - isPlainObject, - isEmptyObject, - isReadableStream, - isRequest, - isResponse, - isHeaders, - isUndefined, - isDate, - isFile, - isBlob, - isRegExp, - isFunction: isFunction$1, - isStream, - isURLSearchParams, - isTypedArray, - isFileList, - forEach, - merge, - extend, - trim, - stripBOM, - inherits, - toFlatObject, - kindOf, - kindOfTest, - endsWith, - toArray, - forEachEntry, - matchAll, - isHTMLForm, - hasOwnProperty, - hasOwnProp: hasOwnProperty, // an alias to avoid ESLint no-prototype-builtins detection - reduceDescriptors, - freezeMethods, - toObjectSet, - toCamelCase, - noop, - toFiniteNumber, - findKey, - global: _global, - isContextDefined, - isSpecCompliantForm, - toJSONObject, - isAsyncFn, - isThenable, - setImmediate: _setImmediate, - asap, - isIterable, -}; - -class AxiosError extends Error { - static from(error, code, config, request, response, customProps) { - const axiosError = new AxiosError(error.message, code || error.code, config, request, response); - axiosError.cause = error; - axiosError.name = error.name; - customProps && Object.assign(axiosError, customProps); - return axiosError; - } - - /** - * Create an Error with the specified message, config, error code, request and response. - * - * @param {string} message The error message. - * @param {string} [code] The error code (for example, 'ECONNABORTED'). - * @param {Object} [config] The config. - * @param {Object} [request] The request. - * @param {Object} [response] The response. - * - * @returns {Error} The created error. - */ - constructor(message, code, config, request, response) { - super(message); - this.name = 'AxiosError'; - this.isAxiosError = true; - code && (this.code = code); - config && (this.config = config); - request && (this.request = request); - if (response) { - this.response = response; - this.status = response.status; - } - } - - toJSON() { - return { - // Standard - message: this.message, - name: this.name, - // Microsoft - description: this.description, - number: this.number, - // Mozilla - fileName: this.fileName, - lineNumber: this.lineNumber, - columnNumber: this.columnNumber, - stack: this.stack, - // Axios - config: utils$1.toJSONObject(this.config), - code: this.code, - status: this.status, - }; - } -} - -// This can be changed to static properties as soon as the parser options in .eslint.cjs are updated. -AxiosError.ERR_BAD_OPTION_VALUE = 'ERR_BAD_OPTION_VALUE'; -AxiosError.ERR_BAD_OPTION = 'ERR_BAD_OPTION'; -AxiosError.ECONNABORTED = 'ECONNABORTED'; -AxiosError.ETIMEDOUT = 'ETIMEDOUT'; -AxiosError.ERR_NETWORK = 'ERR_NETWORK'; -AxiosError.ERR_FR_TOO_MANY_REDIRECTS = 'ERR_FR_TOO_MANY_REDIRECTS'; -AxiosError.ERR_DEPRECATED = 'ERR_DEPRECATED'; -AxiosError.ERR_BAD_RESPONSE = 'ERR_BAD_RESPONSE'; -AxiosError.ERR_BAD_REQUEST = 'ERR_BAD_REQUEST'; -AxiosError.ERR_CANCELED = 'ERR_CANCELED'; -AxiosError.ERR_NOT_SUPPORT = 'ERR_NOT_SUPPORT'; -AxiosError.ERR_INVALID_URL = 'ERR_INVALID_URL'; - -var AxiosError$1 = AxiosError; - -// eslint-disable-next-line strict -var httpAdapter = null; - -/** - * Determines if the given thing is a array or js object. - * - * @param {string} thing - The object or array to be visited. - * - * @returns {boolean} - */ -function isVisitable(thing) { - return utils$1.isPlainObject(thing) || utils$1.isArray(thing); -} - -/** - * It removes the brackets from the end of a string - * - * @param {string} key - The key of the parameter. - * - * @returns {string} the key without the brackets. - */ -function removeBrackets(key) { - return utils$1.endsWith(key, '[]') ? key.slice(0, -2) : key; -} - -/** - * It takes a path, a key, and a boolean, and returns a string - * - * @param {string} path - The path to the current key. - * @param {string} key - The key of the current object being iterated over. - * @param {string} dots - If true, the key will be rendered with dots instead of brackets. - * - * @returns {string} The path to the current key. - */ -function renderKey(path, key, dots) { - if (!path) return key; - return path.concat(key).map(function each(token, i) { - // eslint-disable-next-line no-param-reassign - token = removeBrackets(token); - return !dots && i ? '[' + token + ']' : token; - }).join(dots ? '.' : ''); -} - -/** - * If the array is an array and none of its elements are visitable, then it's a flat array. - * - * @param {Array} arr - The array to check - * - * @returns {boolean} - */ -function isFlatArray(arr) { - return utils$1.isArray(arr) && !arr.some(isVisitable); -} - -const predicates = utils$1.toFlatObject(utils$1, {}, null, function filter(prop) { - return /^is[A-Z]/.test(prop); -}); - -/** - * Convert a data object to FormData - * - * @param {Object} obj - * @param {?Object} [formData] - * @param {?Object} [options] - * @param {Function} [options.visitor] - * @param {Boolean} [options.metaTokens = true] - * @param {Boolean} [options.dots = false] - * @param {?Boolean} [options.indexes = false] - * - * @returns {Object} - **/ - -/** - * It converts an object into a FormData object - * - * @param {Object} obj - The object to convert to form data. - * @param {string} formData - The FormData object to append to. - * @param {Object} options - * - * @returns - */ -function toFormData(obj, formData, options) { - if (!utils$1.isObject(obj)) { - throw new TypeError('target must be an object'); - } - - // eslint-disable-next-line no-param-reassign - formData = formData || new (FormData)(); - - // eslint-disable-next-line no-param-reassign - options = utils$1.toFlatObject(options, { - metaTokens: true, - dots: false, - indexes: false - }, false, function defined(option, source) { - // eslint-disable-next-line no-eq-null,eqeqeq - return !utils$1.isUndefined(source[option]); - }); - - const metaTokens = options.metaTokens; - // eslint-disable-next-line no-use-before-define - const visitor = options.visitor || defaultVisitor; - const dots = options.dots; - const indexes = options.indexes; - const _Blob = options.Blob || typeof Blob !== 'undefined' && Blob; - const useBlob = _Blob && utils$1.isSpecCompliantForm(formData); - - if (!utils$1.isFunction(visitor)) { - throw new TypeError('visitor must be a function'); - } - - function convertValue(value) { - if (value === null) return ''; - - if (utils$1.isDate(value)) { - return value.toISOString(); - } - - if (utils$1.isBoolean(value)) { - return value.toString(); - } - - if (!useBlob && utils$1.isBlob(value)) { - throw new AxiosError$1('Blob is not supported. Use a Buffer instead.'); - } - - if (utils$1.isArrayBuffer(value) || utils$1.isTypedArray(value)) { - return useBlob && typeof Blob === 'function' ? new Blob([value]) : Buffer.from(value); - } - - return value; - } - - /** - * Default visitor. - * - * @param {*} value - * @param {String|Number} key - * @param {Array} path - * @this {FormData} - * - * @returns {boolean} return true to visit the each prop of the value recursively - */ - function defaultVisitor(value, key, path) { - let arr = value; - - if (value && !path && typeof value === 'object') { - if (utils$1.endsWith(key, '{}')) { - // eslint-disable-next-line no-param-reassign - key = metaTokens ? key : key.slice(0, -2); - // eslint-disable-next-line no-param-reassign - value = JSON.stringify(value); - } else if ( - (utils$1.isArray(value) && isFlatArray(value)) || - ((utils$1.isFileList(value) || utils$1.endsWith(key, '[]')) && (arr = utils$1.toArray(value)) - )) { - // eslint-disable-next-line no-param-reassign - key = removeBrackets(key); - - arr.forEach(function each(el, index) { - !(utils$1.isUndefined(el) || el === null) && formData.append( - // eslint-disable-next-line no-nested-ternary - indexes === true ? renderKey([key], index, dots) : (indexes === null ? key : key + '[]'), - convertValue(el) - ); - }); - return false; - } - } - - if (isVisitable(value)) { - return true; - } - - formData.append(renderKey(path, key, dots), convertValue(value)); - - return false; - } - - const stack = []; - - const exposedHelpers = Object.assign(predicates, { - defaultVisitor, - convertValue, - isVisitable - }); - - function build(value, path) { - if (utils$1.isUndefined(value)) return; - - if (stack.indexOf(value) !== -1) { - throw Error('Circular reference detected in ' + path.join('.')); - } - - stack.push(value); - - utils$1.forEach(value, function each(el, key) { - const result = !(utils$1.isUndefined(el) || el === null) && visitor.call( - formData, el, utils$1.isString(key) ? key.trim() : key, path, exposedHelpers - ); - - if (result === true) { - build(el, path ? path.concat(key) : [key]); - } - }); - - stack.pop(); - } - - if (!utils$1.isObject(obj)) { - throw new TypeError('data must be an object'); - } - - build(obj); - - return formData; -} - -/** - * It encodes a string by replacing all characters that are not in the unreserved set with - * their percent-encoded equivalents - * - * @param {string} str - The string to encode. - * - * @returns {string} The encoded string. - */ -function encode$1(str) { - const charMap = { - '!': '%21', - "'": '%27', - '(': '%28', - ')': '%29', - '~': '%7E', - '%20': '+', - '%00': '\x00' - }; - return encodeURIComponent(str).replace(/[!'()~]|%20|%00/g, function replacer(match) { - return charMap[match]; - }); -} - -/** - * It takes a params object and converts it to a FormData object - * - * @param {Object} params - The parameters to be converted to a FormData object. - * @param {Object} options - The options object passed to the Axios constructor. - * - * @returns {void} - */ -function AxiosURLSearchParams(params, options) { - this._pairs = []; - - params && toFormData(params, this, options); -} - -const prototype = AxiosURLSearchParams.prototype; - -prototype.append = function append(name, value) { - this._pairs.push([name, value]); -}; - -prototype.toString = function toString(encoder) { - const _encode = encoder ? function(value) { - return encoder.call(this, value, encode$1); - } : encode$1; - - return this._pairs.map(function each(pair) { - return _encode(pair[0]) + '=' + _encode(pair[1]); - }, '').join('&'); -}; - -/** - * It replaces all instances of the characters `:`, `$`, `,`, `+`, `[`, and `]` with their - * URI encoded counterparts - * - * @param {string} val The value to be encoded. - * - * @returns {string} The encoded value. - */ -function encode(val) { - return encodeURIComponent(val). - replace(/%3A/gi, ':'). - replace(/%24/g, '$'). - replace(/%2C/gi, ','). - replace(/%20/g, '+'); -} - -/** - * Build a URL by appending params to the end - * - * @param {string} url The base of the url (e.g., http://www.google.com) - * @param {object} [params] The params to be appended - * @param {?(object|Function)} options - * - * @returns {string} The formatted url - */ -function buildURL(url, params, options) { - if (!params) { - return url; - } - - const _encode = options && options.encode || encode; - - const _options = utils$1.isFunction(options) ? { - serialize: options - } : options; - - const serializeFn = _options && _options.serialize; - - let serializedParams; - - if (serializeFn) { - serializedParams = serializeFn(params, _options); - } else { - serializedParams = utils$1.isURLSearchParams(params) ? - params.toString() : - new AxiosURLSearchParams(params, _options).toString(_encode); - } - - if (serializedParams) { - const hashmarkIndex = url.indexOf("#"); - - if (hashmarkIndex !== -1) { - url = url.slice(0, hashmarkIndex); - } - url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams; - } - - return url; -} - -class InterceptorManager { - constructor() { - this.handlers = []; - } - - /** - * Add a new interceptor to the stack - * - * @param {Function} fulfilled The function to handle `then` for a `Promise` - * @param {Function} rejected The function to handle `reject` for a `Promise` - * @param {Object} options The options for the interceptor, synchronous and runWhen - * - * @return {Number} An ID used to remove interceptor later - */ - use(fulfilled, rejected, options) { - this.handlers.push({ - fulfilled, - rejected, - synchronous: options ? options.synchronous : false, - runWhen: options ? options.runWhen : null - }); - return this.handlers.length - 1; - } - - /** - * Remove an interceptor from the stack - * - * @param {Number} id The ID that was returned by `use` - * - * @returns {void} - */ - eject(id) { - if (this.handlers[id]) { - this.handlers[id] = null; - } - } - - /** - * Clear all interceptors from the stack - * - * @returns {void} - */ - clear() { - if (this.handlers) { - this.handlers = []; - } - } - - /** - * Iterate over all the registered interceptors - * - * This method is particularly useful for skipping over any - * interceptors that may have become `null` calling `eject`. - * - * @param {Function} fn The function to call for each interceptor - * - * @returns {void} - */ - forEach(fn) { - utils$1.forEach(this.handlers, function forEachHandler(h) { - if (h !== null) { - fn(h); - } - }); - } -} - -var InterceptorManager$1 = InterceptorManager; - -var transitionalDefaults = { - silentJSONParsing: true, - forcedJSONParsing: true, - clarifyTimeoutError: false, - legacyInterceptorReqResOrdering: true -}; - -var URLSearchParams$1 = typeof URLSearchParams !== 'undefined' ? URLSearchParams : AxiosURLSearchParams; - -var FormData$1 = typeof FormData !== 'undefined' ? FormData : null; - -var Blob$1 = typeof Blob !== 'undefined' ? Blob : null; - -var platform$1 = { - isBrowser: true, - classes: { - URLSearchParams: URLSearchParams$1, - FormData: FormData$1, - Blob: Blob$1 - }, - protocols: ['http', 'https', 'file', 'blob', 'url', 'data'] -}; - -const hasBrowserEnv = typeof window !== 'undefined' && typeof document !== 'undefined'; - -const _navigator = typeof navigator === 'object' && navigator || undefined; - -/** - * Determine if we're running in a standard browser environment - * - * This allows axios to run in a web worker, and react-native. - * Both environments support XMLHttpRequest, but not fully standard globals. - * - * web workers: - * typeof window -> undefined - * typeof document -> undefined - * - * react-native: - * navigator.product -> 'ReactNative' - * nativescript - * navigator.product -> 'NativeScript' or 'NS' - * - * @returns {boolean} - */ -const hasStandardBrowserEnv = hasBrowserEnv && - (!_navigator || ['ReactNative', 'NativeScript', 'NS'].indexOf(_navigator.product) < 0); - -/** - * Determine if we're running in a standard browser webWorker environment - * - * Although the `isStandardBrowserEnv` method indicates that - * `allows axios to run in a web worker`, the WebWorker will still be - * filtered out due to its judgment standard - * `typeof window !== 'undefined' && typeof document !== 'undefined'`. - * This leads to a problem when axios post `FormData` in webWorker - */ -const hasStandardBrowserWebWorkerEnv = (() => { - return ( - typeof WorkerGlobalScope !== 'undefined' && - // eslint-disable-next-line no-undef - self instanceof WorkerGlobalScope && - typeof self.importScripts === 'function' - ); -})(); - -const origin = hasBrowserEnv && window.location.href || 'http://localhost'; - -var utils = /*#__PURE__*/Object.freeze({ - __proto__: null, - hasBrowserEnv: hasBrowserEnv, - hasStandardBrowserWebWorkerEnv: hasStandardBrowserWebWorkerEnv, - hasStandardBrowserEnv: hasStandardBrowserEnv, - navigator: _navigator, - origin: origin -}); - -var platform = { - ...utils, - ...platform$1 -}; - -function toURLEncodedForm(data, options) { - return toFormData(data, new platform.classes.URLSearchParams(), { - visitor: function(value, key, path, helpers) { - if (platform.isNode && utils$1.isBuffer(value)) { - this.append(key, value.toString('base64')); - return false; - } - - return helpers.defaultVisitor.apply(this, arguments); - }, - ...options - }); -} - -/** - * It takes a string like `foo[x][y][z]` and returns an array like `['foo', 'x', 'y', 'z'] - * - * @param {string} name - The name of the property to get. - * - * @returns An array of strings. - */ -function parsePropPath(name) { - // foo[x][y][z] - // foo.x.y.z - // foo-x-y-z - // foo x y z - return utils$1.matchAll(/\w+|\[(\w*)]/g, name).map(match => { - return match[0] === '[]' ? '' : match[1] || match[0]; - }); -} - -/** - * Convert an array to an object. - * - * @param {Array} arr - The array to convert to an object. - * - * @returns An object with the same keys and values as the array. - */ -function arrayToObject(arr) { - const obj = {}; - const keys = Object.keys(arr); - let i; - const len = keys.length; - let key; - for (i = 0; i < len; i++) { - key = keys[i]; - obj[key] = arr[key]; - } - return obj; -} - -/** - * It takes a FormData object and returns a JavaScript object - * - * @param {string} formData The FormData object to convert to JSON. - * - * @returns {Object | null} The converted object. - */ -function formDataToJSON(formData) { - function buildPath(path, value, target, index) { - let name = path[index++]; - - if (name === '__proto__') return true; - - const isNumericKey = Number.isFinite(+name); - const isLast = index >= path.length; - name = !name && utils$1.isArray(target) ? target.length : name; - - if (isLast) { - if (utils$1.hasOwnProp(target, name)) { - target[name] = [target[name], value]; - } else { - target[name] = value; - } - - return !isNumericKey; - } - - if (!target[name] || !utils$1.isObject(target[name])) { - target[name] = []; - } - - const result = buildPath(path, value, target[name], index); - - if (result && utils$1.isArray(target[name])) { - target[name] = arrayToObject(target[name]); - } - - return !isNumericKey; - } - - if (utils$1.isFormData(formData) && utils$1.isFunction(formData.entries)) { - const obj = {}; - - utils$1.forEachEntry(formData, (name, value) => { - buildPath(parsePropPath(name), value, obj, 0); - }); - - return obj; - } - - return null; -} - -/** - * It takes a string, tries to parse it, and if it fails, it returns the stringified version - * of the input - * - * @param {any} rawValue - The value to be stringified. - * @param {Function} parser - A function that parses a string into a JavaScript object. - * @param {Function} encoder - A function that takes a value and returns a string. - * - * @returns {string} A stringified version of the rawValue. - */ -function stringifySafely(rawValue, parser, encoder) { - if (utils$1.isString(rawValue)) { - try { - (parser || JSON.parse)(rawValue); - return utils$1.trim(rawValue); - } catch (e) { - if (e.name !== 'SyntaxError') { - throw e; - } - } - } - - return (encoder || JSON.stringify)(rawValue); -} - -const defaults = { - - transitional: transitionalDefaults, - - adapter: ['xhr', 'http', 'fetch'], - - transformRequest: [function transformRequest(data, headers) { - const contentType = headers.getContentType() || ''; - const hasJSONContentType = contentType.indexOf('application/json') > -1; - const isObjectPayload = utils$1.isObject(data); - - if (isObjectPayload && utils$1.isHTMLForm(data)) { - data = new FormData(data); - } - - const isFormData = utils$1.isFormData(data); - - if (isFormData) { - return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data; - } - - if (utils$1.isArrayBuffer(data) || - utils$1.isBuffer(data) || - utils$1.isStream(data) || - utils$1.isFile(data) || - utils$1.isBlob(data) || - utils$1.isReadableStream(data) - ) { - return data; - } - if (utils$1.isArrayBufferView(data)) { - return data.buffer; - } - if (utils$1.isURLSearchParams(data)) { - headers.setContentType('application/x-www-form-urlencoded;charset=utf-8', false); - return data.toString(); - } - - let isFileList; - - if (isObjectPayload) { - if (contentType.indexOf('application/x-www-form-urlencoded') > -1) { - return toURLEncodedForm(data, this.formSerializer).toString(); - } - - if ((isFileList = utils$1.isFileList(data)) || contentType.indexOf('multipart/form-data') > -1) { - const _FormData = this.env && this.env.FormData; - - return toFormData( - isFileList ? {'files[]': data} : data, - _FormData && new _FormData(), - this.formSerializer - ); - } - } - - if (isObjectPayload || hasJSONContentType ) { - headers.setContentType('application/json', false); - return stringifySafely(data); - } - - return data; - }], - - transformResponse: [function transformResponse(data) { - const transitional = this.transitional || defaults.transitional; - const forcedJSONParsing = transitional && transitional.forcedJSONParsing; - const JSONRequested = this.responseType === 'json'; - - if (utils$1.isResponse(data) || utils$1.isReadableStream(data)) { - return data; - } - - if (data && utils$1.isString(data) && ((forcedJSONParsing && !this.responseType) || JSONRequested)) { - const silentJSONParsing = transitional && transitional.silentJSONParsing; - const strictJSONParsing = !silentJSONParsing && JSONRequested; - - try { - return JSON.parse(data, this.parseReviver); - } catch (e) { - if (strictJSONParsing) { - if (e.name === 'SyntaxError') { - throw AxiosError$1.from(e, AxiosError$1.ERR_BAD_RESPONSE, this, null, this.response); - } - throw e; - } - } - } - - return data; - }], - - /** - * A timeout in milliseconds to abort a request. If set to 0 (default) a - * timeout is not created. - */ - timeout: 0, - - xsrfCookieName: 'XSRF-TOKEN', - xsrfHeaderName: 'X-XSRF-TOKEN', - - maxContentLength: -1, - maxBodyLength: -1, - - env: { - FormData: platform.classes.FormData, - Blob: platform.classes.Blob - }, - - validateStatus: function validateStatus(status) { - return status >= 200 && status < 300; - }, - - headers: { - common: { - 'Accept': 'application/json, text/plain, */*', - 'Content-Type': undefined - } - } -}; - -utils$1.forEach(['delete', 'get', 'head', 'post', 'put', 'patch'], (method) => { - defaults.headers[method] = {}; -}); - -var defaults$1 = defaults; - -// RawAxiosHeaders whose duplicates are ignored by node -// c.f. https://nodejs.org/api/http.html#http_message_headers -const ignoreDuplicateOf = utils$1.toObjectSet([ - 'age', 'authorization', 'content-length', 'content-type', 'etag', - 'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since', - 'last-modified', 'location', 'max-forwards', 'proxy-authorization', - 'referer', 'retry-after', 'user-agent' -]); - -/** - * Parse headers into an object - * - * ``` - * Date: Wed, 27 Aug 2014 08:58:49 GMT - * Content-Type: application/json - * Connection: keep-alive - * Transfer-Encoding: chunked - * ``` - * - * @param {String} rawHeaders Headers needing to be parsed - * - * @returns {Object} Headers parsed into an object - */ -var parseHeaders = rawHeaders => { - const parsed = {}; - let key; - let val; - let i; - - rawHeaders && rawHeaders.split('\n').forEach(function parser(line) { - i = line.indexOf(':'); - key = line.substring(0, i).trim().toLowerCase(); - val = line.substring(i + 1).trim(); - - if (!key || (parsed[key] && ignoreDuplicateOf[key])) { - return; - } - - if (key === 'set-cookie') { - if (parsed[key]) { - parsed[key].push(val); - } else { - parsed[key] = [val]; - } - } else { - parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val; - } - }); - - return parsed; -}; - -const $internals = Symbol('internals'); - -function normalizeHeader(header) { - return header && String(header).trim().toLowerCase(); -} - -function normalizeValue(value) { - if (value === false || value == null) { - return value; - } - - return utils$1.isArray(value) ? value.map(normalizeValue) : String(value); -} - -function parseTokens(str) { - const tokens = Object.create(null); - const tokensRE = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g; - let match; - - while ((match = tokensRE.exec(str))) { - tokens[match[1]] = match[2]; - } - - return tokens; -} - -const isValidHeaderName = (str) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str.trim()); - -function matchHeaderValue(context, value, header, filter, isHeaderNameFilter) { - if (utils$1.isFunction(filter)) { - return filter.call(this, value, header); - } - - if (isHeaderNameFilter) { - value = header; - } - - if (!utils$1.isString(value)) return; - - if (utils$1.isString(filter)) { - return value.indexOf(filter) !== -1; - } - - if (utils$1.isRegExp(filter)) { - return filter.test(value); - } -} - -function formatHeader(header) { - return header.trim() - .toLowerCase().replace(/([a-z\d])(\w*)/g, (w, char, str) => { - return char.toUpperCase() + str; - }); -} - -function buildAccessors(obj, header) { - const accessorName = utils$1.toCamelCase(' ' + header); - - ['get', 'set', 'has'].forEach(methodName => { - Object.defineProperty(obj, methodName + accessorName, { - value: function(arg1, arg2, arg3) { - return this[methodName].call(this, header, arg1, arg2, arg3); - }, - configurable: true - }); - }); -} - -class AxiosHeaders { - constructor(headers) { - headers && this.set(headers); - } - - set(header, valueOrRewrite, rewrite) { - const self = this; - - function setHeader(_value, _header, _rewrite) { - const lHeader = normalizeHeader(_header); - - if (!lHeader) { - throw new Error('header name must be a non-empty string'); - } - - const key = utils$1.findKey(self, lHeader); - - if(!key || self[key] === undefined || _rewrite === true || (_rewrite === undefined && self[key] !== false)) { - self[key || _header] = normalizeValue(_value); - } - } - - const setHeaders = (headers, _rewrite) => - utils$1.forEach(headers, (_value, _header) => setHeader(_value, _header, _rewrite)); - - if (utils$1.isPlainObject(header) || header instanceof this.constructor) { - setHeaders(header, valueOrRewrite); - } else if(utils$1.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) { - setHeaders(parseHeaders(header), valueOrRewrite); - } else if (utils$1.isObject(header) && utils$1.isIterable(header)) { - let obj = {}, dest, key; - for (const entry of header) { - if (!utils$1.isArray(entry)) { - throw TypeError('Object iterator must return a key-value pair'); - } - - obj[key = entry[0]] = (dest = obj[key]) ? - (utils$1.isArray(dest) ? [...dest, entry[1]] : [dest, entry[1]]) : entry[1]; - } - - setHeaders(obj, valueOrRewrite); - } else { - header != null && setHeader(valueOrRewrite, header, rewrite); - } - - return this; - } - - get(header, parser) { - header = normalizeHeader(header); - - if (header) { - const key = utils$1.findKey(this, header); - - if (key) { - const value = this[key]; + // Prepare the response + var responseHeaders = 'getAllResponseHeaders' in request ? parseHeaders(request.getAllResponseHeaders()) : null; + var responseData = !responseType || responseType === 'text' || responseType === 'json' ? + request.responseText : request.response; + var response = { + data: responseData, + status: request.status, + statusText: request.statusText, + headers: responseHeaders, + config: config, + request: request + }; - if (!parser) { - return value; - } + settle(resolve, reject, response); - if (parser === true) { - return parseTokens(value); - } + // Clean up request + request = null; + } - if (utils$1.isFunction(parser)) { - return parser.call(this, value, key); + if ('onloadend' in request) { + // Use onloadend if available + request.onloadend = onloadend; + } else { + // Listen for ready state to emulate onloadend + request.onreadystatechange = function handleLoad() { + if (!request || request.readyState !== 4) { + return; } - if (utils$1.isRegExp(parser)) { - return parser.exec(value); + // The request errored out and we didn't get a response, this will be + // handled by onerror instead + // With one exception: request that using file: protocol, most browsers + // will return status as 0 even though it's a successful request + if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) { + return; } - - throw new TypeError('parser must be boolean|regexp|function'); - } + // readystate handler is calling before onerror or ontimeout handlers, + // so we should call onloadend on the next 'tick' + setTimeout(onloadend); + }; } - } - has(header, matcher) { - header = normalizeHeader(header); + // Handle browser request cancellation (as opposed to a manual cancellation) + request.onabort = function handleAbort() { + if (!request) { + return; + } - if (header) { - const key = utils$1.findKey(this, header); + reject(createError('Request aborted', config, 'ECONNABORTED', request)); - return !!(key && this[key] !== undefined && (!matcher || matchHeaderValue(this, this[key], key, matcher))); - } + // Clean up request + request = null; + }; - return false; - } + // Handle low level network errors + request.onerror = function handleError() { + // Real errors are hidden from us by the browser + // onerror should only fire if it's a network error + reject(createError('Network Error', config, null, request)); - delete(header, matcher) { - const self = this; - let deleted = false; + // Clean up request + request = null; + }; - function deleteHeader(_header) { - _header = normalizeHeader(_header); + // Handle timeout + request.ontimeout = function handleTimeout() { + var timeoutErrorMessage = 'timeout of ' + config.timeout + 'ms exceeded'; + if (config.timeoutErrorMessage) { + timeoutErrorMessage = config.timeoutErrorMessage; + } + reject(createError( + timeoutErrorMessage, + config, + config.transitional && config.transitional.clarifyTimeoutError ? 'ETIMEDOUT' : 'ECONNABORTED', + request)); - if (_header) { - const key = utils$1.findKey(self, _header); + // Clean up request + request = null; + }; - if (key && (!matcher || matchHeaderValue(self, self[key], key, matcher))) { - delete self[key]; + // Add xsrf header + // This is only done if running in a standard browser environment. + // Specifically not if we're in a web worker, or react-native. + if (utils.isStandardBrowserEnv()) { + // Add xsrf header + var xsrfValue = (config.withCredentials || isURLSameOrigin(fullPath)) && config.xsrfCookieName ? + cookies.read(config.xsrfCookieName) : + undefined; - deleted = true; - } + if (xsrfValue) { + requestHeaders[config.xsrfHeaderName] = xsrfValue; } } - if (utils$1.isArray(header)) { - header.forEach(deleteHeader); - } else { - deleteHeader(header); + // Add headers to the request + if ('setRequestHeader' in request) { + utils.forEach(requestHeaders, function setRequestHeader(val, key) { + if (typeof requestData === 'undefined' && key.toLowerCase() === 'content-type') { + // Remove Content-Type if data is undefined + delete requestHeaders[key]; + } else { + // Otherwise add header to the request + request.setRequestHeader(key, val); + } + }); } - return deleted; - } - - clear(matcher) { - const keys = Object.keys(this); - let i = keys.length; - let deleted = false; - - while (i--) { - const key = keys[i]; - if(!matcher || matchHeaderValue(this, this[key], key, matcher, true)) { - delete this[key]; - deleted = true; - } + // Add withCredentials to request if needed + if (!utils.isUndefined(config.withCredentials)) { + request.withCredentials = !!config.withCredentials; } - return deleted; - } - - normalize(format) { - const self = this; - const headers = {}; - - utils$1.forEach(this, (value, header) => { - const key = utils$1.findKey(headers, header); - - if (key) { - self[key] = normalizeValue(value); - delete self[header]; - return; - } - - const normalized = format ? formatHeader(header) : String(header).trim(); - - if (normalized !== header) { - delete self[header]; - } - - self[normalized] = normalizeValue(value); - - headers[normalized] = true; - }); + // Add responseType to request if needed + if (responseType && responseType !== 'json') { + request.responseType = config.responseType; + } - return this; - } + // Handle progress if needed + if (typeof config.onDownloadProgress === 'function') { + request.addEventListener('progress', config.onDownloadProgress); + } - concat(...targets) { - return this.constructor.concat(this, ...targets); - } + // Not all browsers support upload events + if (typeof config.onUploadProgress === 'function' && request.upload) { + request.upload.addEventListener('progress', config.onUploadProgress); + } - toJSON(asStrings) { - const obj = Object.create(null); + if (config.cancelToken) { + // Handle cancellation + config.cancelToken.promise.then(function onCanceled(cancel) { + if (!request) { + return; + } - utils$1.forEach(this, (value, header) => { - value != null && value !== false && (obj[header] = asStrings && utils$1.isArray(value) ? value.join(', ') : value); - }); + request.abort(); + reject(cancel); + // Clean up request + request = null; + }); + } - return obj; - } + if (!requestData) { + requestData = null; + } - [Symbol.iterator]() { - return Object.entries(this.toJSON())[Symbol.iterator](); - } + // Send the request + request.send(requestData); + }); +}; - toString() { - return Object.entries(this.toJSON()).map(([header, value]) => header + ': ' + value).join('\n'); - } - getSetCookie() { - return this.get("set-cookie") || []; - } +/***/ }), - get [Symbol.toStringTag]() { - return 'AxiosHeaders'; - } +/***/ "./node_modules/axios/lib/axios.js": +/*!*****************************************!*\ + !*** ./node_modules/axios/lib/axios.js ***! + \*****************************************/ +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - static from(thing) { - return thing instanceof this ? thing : new this(thing); - } +"use strict"; - static concat(first, ...targets) { - const computed = new this(first); - targets.forEach((target) => computed.set(target)); +var utils = __webpack_require__(/*! ./utils */ "./node_modules/axios/lib/utils.js"); +var bind = __webpack_require__(/*! ./helpers/bind */ "./node_modules/axios/lib/helpers/bind.js"); +var Axios = __webpack_require__(/*! ./core/Axios */ "./node_modules/axios/lib/core/Axios.js"); +var mergeConfig = __webpack_require__(/*! ./core/mergeConfig */ "./node_modules/axios/lib/core/mergeConfig.js"); +var defaults = __webpack_require__(/*! ./defaults */ "./node_modules/axios/lib/defaults.js"); - return computed; - } +/** + * Create an instance of Axios + * + * @param {Object} defaultConfig The default config for the instance + * @return {Axios} A new instance of Axios + */ +function createInstance(defaultConfig) { + var context = new Axios(defaultConfig); + var instance = bind(Axios.prototype.request, context); - static accessor(header) { - const internals = this[$internals] = (this[$internals] = { - accessors: {} - }); + // Copy axios.prototype to instance + utils.extend(instance, Axios.prototype, context); - const accessors = internals.accessors; - const prototype = this.prototype; + // Copy context to instance + utils.extend(instance, context); - function defineAccessor(_header) { - const lHeader = normalizeHeader(_header); + return instance; +} - if (!accessors[lHeader]) { - buildAccessors(prototype, _header); - accessors[lHeader] = true; - } - } +// Create the default instance to be exported +var axios = createInstance(defaults); - utils$1.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header); +// Expose Axios class to allow class inheritance +axios.Axios = Axios; - return this; - } -} +// Factory for creating new instances +axios.create = function create(instanceConfig) { + return createInstance(mergeConfig(axios.defaults, instanceConfig)); +}; -AxiosHeaders.accessor(['Content-Type', 'Content-Length', 'Accept', 'Accept-Encoding', 'User-Agent', 'Authorization']); +// Expose Cancel & CancelToken +axios.Cancel = __webpack_require__(/*! ./cancel/Cancel */ "./node_modules/axios/lib/cancel/Cancel.js"); +axios.CancelToken = __webpack_require__(/*! ./cancel/CancelToken */ "./node_modules/axios/lib/cancel/CancelToken.js"); +axios.isCancel = __webpack_require__(/*! ./cancel/isCancel */ "./node_modules/axios/lib/cancel/isCancel.js"); -// reserved names hotfix -utils$1.reduceDescriptors(AxiosHeaders.prototype, ({value}, key) => { - let mapped = key[0].toUpperCase() + key.slice(1); // map `set` => `Set` - return { - get: () => value, - set(headerValue) { - this[mapped] = headerValue; - } - } -}); +// Expose all/spread +axios.all = function all(promises) { + return Promise.all(promises); +}; +axios.spread = __webpack_require__(/*! ./helpers/spread */ "./node_modules/axios/lib/helpers/spread.js"); -utils$1.freezeMethods(AxiosHeaders); +// Expose isAxiosError +axios.isAxiosError = __webpack_require__(/*! ./helpers/isAxiosError */ "./node_modules/axios/lib/helpers/isAxiosError.js"); -var AxiosHeaders$1 = AxiosHeaders; +module.exports = axios; -/** - * Transform the data for a request or a response - * - * @param {Array|Function} fns A single function or Array of functions - * @param {?Object} response The response object - * - * @returns {*} The resulting transformed data - */ -function transformData(fns, response) { - const config = this || defaults$1; - const context = response || config; - const headers = AxiosHeaders$1.from(context.headers); - let data = context.data; - - utils$1.forEach(fns, function transform(fn) { - data = fn.call(config, data, headers.normalize(), response ? response.status : undefined); - }); +// Allow use of default import syntax in TypeScript +module.exports["default"] = axios; - headers.normalize(); - return data; -} +/***/ }), -function isCancel(value) { - return !!(value && value.__CANCEL__); -} +/***/ "./node_modules/axios/lib/cancel/Cancel.js": +/*!*************************************************!*\ + !*** ./node_modules/axios/lib/cancel/Cancel.js ***! + \*************************************************/ +/***/ (function(module) { -class CanceledError extends AxiosError$1 { - /** - * A `CanceledError` is an object that is thrown when an operation is canceled. - * - * @param {string=} message The message. - * @param {Object=} config The config. - * @param {Object=} request The request. - * - * @returns {CanceledError} The created error. - */ - constructor(message, config, request) { - super(message == null ? 'canceled' : message, AxiosError$1.ERR_CANCELED, config, request); - this.name = 'CanceledError'; - this.__CANCEL__ = true; - } -} +"use strict"; -var CanceledError$1 = CanceledError; /** - * Resolve or reject a Promise based on response status. - * - * @param {Function} resolve A function that resolves the promise. - * @param {Function} reject A function that rejects the promise. - * @param {object} response The response. + * A `Cancel` is an object that is thrown when an operation is canceled. * - * @returns {object} The response. + * @class + * @param {string=} message The message. */ -function settle(resolve, reject, response) { - const validateStatus = response.config.validateStatus; - if (!response.status || !validateStatus || validateStatus(response.status)) { - resolve(response); - } else { - reject(new AxiosError$1( - 'Request failed with status code ' + response.status, - [AxiosError$1.ERR_BAD_REQUEST, AxiosError$1.ERR_BAD_RESPONSE][Math.floor(response.status / 100) - 4], - response.config, - response.request, - response - )); - } +function Cancel(message) { + this.message = message; } -function parseProtocol(url) { - const match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url); - return match && match[1] || ''; -} +Cancel.prototype.toString = function toString() { + return 'Cancel' + (this.message ? ': ' + this.message : ''); +}; -/** - * Calculate data maxRate - * @param {Number} [samplesCount= 10] - * @param {Number} [min= 1000] - * @returns {Function} - */ -function speedometer(samplesCount, min) { - samplesCount = samplesCount || 10; - const bytes = new Array(samplesCount); - const timestamps = new Array(samplesCount); - let head = 0; - let tail = 0; - let firstSampleTS; +Cancel.prototype.__CANCEL__ = true; - min = min !== undefined ? min : 1000; +module.exports = Cancel; - return function push(chunkLength) { - const now = Date.now(); - const startedAt = timestamps[tail]; +/***/ }), - if (!firstSampleTS) { - firstSampleTS = now; - } +/***/ "./node_modules/axios/lib/cancel/CancelToken.js": +/*!******************************************************!*\ + !*** ./node_modules/axios/lib/cancel/CancelToken.js ***! + \******************************************************/ +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - bytes[head] = chunkLength; - timestamps[head] = now; +"use strict"; - let i = tail; - let bytesCount = 0; - while (i !== head) { - bytesCount += bytes[i++]; - i = i % samplesCount; - } +var Cancel = __webpack_require__(/*! ./Cancel */ "./node_modules/axios/lib/cancel/Cancel.js"); - head = (head + 1) % samplesCount; +/** + * A `CancelToken` is an object that can be used to request cancellation of an operation. + * + * @class + * @param {Function} executor The executor function. + */ +function CancelToken(executor) { + if (typeof executor !== 'function') { + throw new TypeError('executor must be a function.'); + } - if (head === tail) { - tail = (tail + 1) % samplesCount; - } + var resolvePromise; + this.promise = new Promise(function promiseExecutor(resolve) { + resolvePromise = resolve; + }); - if (now - firstSampleTS < min) { + var token = this; + executor(function cancel(message) { + if (token.reason) { + // Cancellation has already been requested return; } - const passed = startedAt && now - startedAt; - - return passed ? Math.round(bytesCount * 1000 / passed) : undefined; - }; + token.reason = new Cancel(message); + resolvePromise(token.reason); + }); } /** - * Throttle decorator - * @param {Function} fn - * @param {Number} freq - * @return {Function} + * Throws a `Cancel` if cancellation has been requested. */ -function throttle(fn, freq) { - let timestamp = 0; - let threshold = 1000 / freq; - let lastArgs; - let timer; - - const invoke = (args, now = Date.now()) => { - timestamp = now; - lastArgs = null; - if (timer) { - clearTimeout(timer); - timer = null; - } - fn(...args); - }; - - const throttled = (...args) => { - const now = Date.now(); - const passed = now - timestamp; - if ( passed >= threshold) { - invoke(args, now); - } else { - lastArgs = args; - if (!timer) { - timer = setTimeout(() => { - timer = null; - invoke(lastArgs); - }, threshold - passed); - } - } - }; - - const flush = () => lastArgs && invoke(lastArgs); - - return [throttled, flush]; -} - -const progressEventReducer = (listener, isDownloadStream, freq = 3) => { - let bytesNotified = 0; - const _speedometer = speedometer(50, 250); - - return throttle(e => { - const loaded = e.loaded; - const total = e.lengthComputable ? e.total : undefined; - const progressBytes = loaded - bytesNotified; - const rate = _speedometer(progressBytes); - const inRange = loaded <= total; - - bytesNotified = loaded; - - const data = { - loaded, - total, - progress: total ? (loaded / total) : undefined, - bytes: progressBytes, - rate: rate ? rate : undefined, - estimated: rate && total && inRange ? (total - loaded) / rate : undefined, - event: e, - lengthComputable: total != null, - [isDownloadStream ? 'download' : 'upload']: true - }; - - listener(data); - }, freq); +CancelToken.prototype.throwIfRequested = function throwIfRequested() { + if (this.reason) { + throw this.reason; + } }; -const progressEventDecorator = (total, throttled) => { - const lengthComputable = total != null; - - return [(loaded) => throttled[0]({ - lengthComputable, - total, - loaded - }), throttled[1]]; +/** + * Returns an object that contains a new `CancelToken` and a function that, when called, + * cancels the `CancelToken`. + */ +CancelToken.source = function source() { + var cancel; + var token = new CancelToken(function executor(c) { + cancel = c; + }); + return { + token: token, + cancel: cancel + }; }; -const asyncDecorator = (fn) => (...args) => utils$1.asap(() => fn(...args)); +module.exports = CancelToken; -var isURLSameOrigin = platform.hasStandardBrowserEnv ? ((origin, isMSIE) => (url) => { - url = new URL(url, platform.origin); - return ( - origin.protocol === url.protocol && - origin.host === url.host && - (isMSIE || origin.port === url.port) - ); -})( - new URL(platform.origin), - platform.navigator && /(msie|trident)/i.test(platform.navigator.userAgent) -) : () => true; - -var cookies = platform.hasStandardBrowserEnv ? +/***/ }), - // Standard browser envs support document.cookie - { - write(name, value, expires, path, domain, secure, sameSite) { - if (typeof document === 'undefined') return; +/***/ "./node_modules/axios/lib/cancel/isCancel.js": +/*!***************************************************!*\ + !*** ./node_modules/axios/lib/cancel/isCancel.js ***! + \***************************************************/ +/***/ (function(module) { - const cookie = [`${name}=${encodeURIComponent(value)}`]; +"use strict"; - if (utils$1.isNumber(expires)) { - cookie.push(`expires=${new Date(expires).toUTCString()}`); - } - if (utils$1.isString(path)) { - cookie.push(`path=${path}`); - } - if (utils$1.isString(domain)) { - cookie.push(`domain=${domain}`); - } - if (secure === true) { - cookie.push('secure'); - } - if (utils$1.isString(sameSite)) { - cookie.push(`SameSite=${sameSite}`); - } - document.cookie = cookie.join('; '); - }, +module.exports = function isCancel(value) { + return !!(value && value.__CANCEL__); +}; - read(name) { - if (typeof document === 'undefined') return null; - const match = document.cookie.match(new RegExp('(?:^|; )' + name + '=([^;]*)')); - return match ? decodeURIComponent(match[1]) : null; - }, - remove(name) { - this.write(name, '', Date.now() - 86400000, '/'); - } - } +/***/ }), - : +/***/ "./node_modules/axios/lib/core/Axios.js": +/*!**********************************************!*\ + !*** ./node_modules/axios/lib/core/Axios.js ***! + \**********************************************/ +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - // Non-standard browser env (web workers, react-native) lack needed support. - { - write() {}, - read() { - return null; - }, - remove() {} - }; +"use strict"; -/** - * Determines whether the specified URL is absolute - * - * @param {string} url The URL to test - * - * @returns {boolean} True if the specified URL is absolute, otherwise false - */ -function isAbsoluteURL(url) { - // A URL is considered absolute if it begins with "://" or "//" (protocol-relative URL). - // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed - // by any combination of letters, digits, plus, period, or hyphen. - if (typeof url !== 'string') { - return false; - } - return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(url); -} +var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js"); +var buildURL = __webpack_require__(/*! ../helpers/buildURL */ "./node_modules/axios/lib/helpers/buildURL.js"); +var InterceptorManager = __webpack_require__(/*! ./InterceptorManager */ "./node_modules/axios/lib/core/InterceptorManager.js"); +var dispatchRequest = __webpack_require__(/*! ./dispatchRequest */ "./node_modules/axios/lib/core/dispatchRequest.js"); +var mergeConfig = __webpack_require__(/*! ./mergeConfig */ "./node_modules/axios/lib/core/mergeConfig.js"); +var validator = __webpack_require__(/*! ../helpers/validator */ "./node_modules/axios/lib/helpers/validator.js"); +var validators = validator.validators; /** - * Creates a new URL by combining the specified URLs - * - * @param {string} baseURL The base URL - * @param {string} relativeURL The relative URL + * Create a new instance of Axios * - * @returns {string} The combined URL + * @param {Object} instanceConfig The default config for the instance */ -function combineURLs(baseURL, relativeURL) { - return relativeURL - ? baseURL.replace(/\/?\/$/, '') + '/' + relativeURL.replace(/^\/+/, '') - : baseURL; +function Axios(instanceConfig) { + this.defaults = instanceConfig; + this.interceptors = { + request: new InterceptorManager(), + response: new InterceptorManager() + }; } /** - * Creates a new URL by combining the baseURL with the requestedURL, - * only when the requestedURL is not already an absolute URL. - * If the requestURL is absolute, this function returns the requestedURL untouched. - * - * @param {string} baseURL The base URL - * @param {string} requestedURL Absolute or relative URL to combine + * Dispatch a request * - * @returns {string} The combined full path + * @param {Object} config The config specific for this request (merged with this.defaults) */ -function buildFullPath(baseURL, requestedURL, allowAbsoluteUrls) { - let isRelativeUrl = !isAbsoluteURL(requestedURL); - if (baseURL && (isRelativeUrl || allowAbsoluteUrls == false)) { - return combineURLs(baseURL, requestedURL); +Axios.prototype.request = function request(config) { + /*eslint no-param-reassign:0*/ + // Allow for axios('example/url'[, config]) a la fetch API + if (typeof config === 'string') { + config = arguments[1] || {}; + config.url = arguments[0]; + } else { + config = config || {}; } - return requestedURL; -} -const headersToObject = (thing) => - thing instanceof AxiosHeaders$1 ? { ...thing } : thing; + config = mergeConfig(this.defaults, config); -/** - * Config-specific merge-function which creates a new config-object - * by merging two configuration objects together. - * - * @param {Object} config1 - * @param {Object} config2 - * - * @returns {Object} New object resulting from merging config2 to config1 - */ -function mergeConfig(config1, config2) { - // eslint-disable-next-line no-param-reassign - config2 = config2 || {}; - const config = {}; - - function getMergedValue(target, source, prop, caseless) { - if (utils$1.isPlainObject(target) && utils$1.isPlainObject(source)) { - return utils$1.merge.call({ caseless }, target, source); - } else if (utils$1.isPlainObject(source)) { - return utils$1.merge({}, source); - } else if (utils$1.isArray(source)) { - return source.slice(); - } - return source; + // Set config.method + if (config.method) { + config.method = config.method.toLowerCase(); + } else if (this.defaults.method) { + config.method = this.defaults.method.toLowerCase(); + } else { + config.method = 'get'; } - function mergeDeepProperties(a, b, prop, caseless) { - if (!utils$1.isUndefined(b)) { - return getMergedValue(a, b, prop, caseless); - } else if (!utils$1.isUndefined(a)) { - return getMergedValue(undefined, a, prop, caseless); - } + var transitional = config.transitional; + + if (transitional !== undefined) { + validator.assertOptions(transitional, { + silentJSONParsing: validators.transitional(validators.boolean, '1.0.0'), + forcedJSONParsing: validators.transitional(validators.boolean, '1.0.0'), + clarifyTimeoutError: validators.transitional(validators.boolean, '1.0.0') + }, false); } - // eslint-disable-next-line consistent-return - function valueFromConfig2(a, b) { - if (!utils$1.isUndefined(b)) { - return getMergedValue(undefined, b); + // filter out skipped interceptors + var requestInterceptorChain = []; + var synchronousRequestInterceptors = true; + this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) { + if (typeof interceptor.runWhen === 'function' && interceptor.runWhen(config) === false) { + return; } - } - // eslint-disable-next-line consistent-return - function defaultToConfig2(a, b) { - if (!utils$1.isUndefined(b)) { - return getMergedValue(undefined, b); - } else if (!utils$1.isUndefined(a)) { - return getMergedValue(undefined, a); + synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous; + + requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected); + }); + + var responseInterceptorChain = []; + this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) { + responseInterceptorChain.push(interceptor.fulfilled, interceptor.rejected); + }); + + var promise; + + if (!synchronousRequestInterceptors) { + var chain = [dispatchRequest, undefined]; + + Array.prototype.unshift.apply(chain, requestInterceptorChain); + chain = chain.concat(responseInterceptorChain); + + promise = Promise.resolve(config); + while (chain.length) { + promise = promise.then(chain.shift(), chain.shift()); } + + return promise; } - // eslint-disable-next-line consistent-return - function mergeDirectKeys(a, b, prop) { - if (prop in config2) { - return getMergedValue(a, b); - } else if (prop in config1) { - return getMergedValue(undefined, a); + + var newConfig = config; + while (requestInterceptorChain.length) { + var onFulfilled = requestInterceptorChain.shift(); + var onRejected = requestInterceptorChain.shift(); + try { + newConfig = onFulfilled(newConfig); + } catch (error) { + onRejected(error); + break; } } - const mergeMap = { - url: valueFromConfig2, - method: valueFromConfig2, - data: valueFromConfig2, - baseURL: defaultToConfig2, - transformRequest: defaultToConfig2, - transformResponse: defaultToConfig2, - paramsSerializer: defaultToConfig2, - timeout: defaultToConfig2, - timeoutMessage: defaultToConfig2, - withCredentials: defaultToConfig2, - withXSRFToken: defaultToConfig2, - adapter: defaultToConfig2, - responseType: defaultToConfig2, - xsrfCookieName: defaultToConfig2, - xsrfHeaderName: defaultToConfig2, - onUploadProgress: defaultToConfig2, - onDownloadProgress: defaultToConfig2, - decompress: defaultToConfig2, - maxContentLength: defaultToConfig2, - maxBodyLength: defaultToConfig2, - beforeRedirect: defaultToConfig2, - transport: defaultToConfig2, - httpAgent: defaultToConfig2, - httpsAgent: defaultToConfig2, - cancelToken: defaultToConfig2, - socketPath: defaultToConfig2, - responseEncoding: defaultToConfig2, - validateStatus: mergeDirectKeys, - headers: (a, b, prop) => - mergeDeepProperties(headersToObject(a), headersToObject(b), prop, true), - }; + try { + promise = dispatchRequest(newConfig); + } catch (error) { + return Promise.reject(error); + } - utils$1.forEach( - Object.keys({ ...config1, ...config2 }), - function computeConfigValue(prop) { - if ( - prop === "__proto__" || - prop === "constructor" || - prop === "prototype" - ) - return; - const merge = utils$1.hasOwnProp(mergeMap, prop) - ? mergeMap[prop] - : mergeDeepProperties; - const configValue = merge(config1[prop], config2[prop], prop); - (utils$1.isUndefined(configValue) && merge !== mergeDirectKeys) || - (config[prop] = configValue); - }, - ); + while (responseInterceptorChain.length) { + promise = promise.then(responseInterceptorChain.shift(), responseInterceptorChain.shift()); + } - return config; -} + return promise; +}; + +Axios.prototype.getUri = function getUri(config) { + config = mergeConfig(this.defaults, config); + return buildURL(config.url, config.params, config.paramsSerializer).replace(/^\?/, ''); +}; + +// Provide aliases for supported request methods +utils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) { + /*eslint func-names:0*/ + Axios.prototype[method] = function(url, config) { + return this.request(mergeConfig(config || {}, { + method: method, + url: url, + data: (config || {}).data + })); + }; +}); -var resolveConfig = (config) => { - const newConfig = mergeConfig({}, config); +utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) { + /*eslint func-names:0*/ + Axios.prototype[method] = function(url, data, config) { + return this.request(mergeConfig(config || {}, { + method: method, + url: url, + data: data + })); + }; +}); - let { data, withXSRFToken, xsrfHeaderName, xsrfCookieName, headers, auth } = newConfig; +module.exports = Axios; - newConfig.headers = headers = AxiosHeaders$1.from(headers); - newConfig.url = buildURL(buildFullPath(newConfig.baseURL, newConfig.url, newConfig.allowAbsoluteUrls), config.params, config.paramsSerializer); +/***/ }), - // HTTP basic authentication - if (auth) { - headers.set('Authorization', 'Basic ' + - btoa((auth.username || '') + ':' + (auth.password ? unescape(encodeURIComponent(auth.password)) : '')) - ); - } +/***/ "./node_modules/axios/lib/core/InterceptorManager.js": +/*!***********************************************************!*\ + !*** ./node_modules/axios/lib/core/InterceptorManager.js ***! + \***********************************************************/ +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - if (utils$1.isFormData(data)) { - if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv) { - headers.setContentType(undefined); // browser handles it - } else if (utils$1.isFunction(data.getHeaders)) { - // Node.js FormData (like form-data package) - const formHeaders = data.getHeaders(); - // Only set safe headers to avoid overwriting security headers - const allowedHeaders = ['content-type', 'content-length']; - Object.entries(formHeaders).forEach(([key, val]) => { - if (allowedHeaders.includes(key.toLowerCase())) { - headers.set(key, val); - } - }); - } - } +"use strict"; - // Add xsrf header - // This is only done if running in a standard browser environment. - // Specifically not if we're in a web worker, or react-native. - if (platform.hasStandardBrowserEnv) { - withXSRFToken && utils$1.isFunction(withXSRFToken) && (withXSRFToken = withXSRFToken(newConfig)); +var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js"); - if (withXSRFToken || (withXSRFToken !== false && isURLSameOrigin(newConfig.url))) { - // Add xsrf header - const xsrfValue = xsrfHeaderName && xsrfCookieName && cookies.read(xsrfCookieName); +function InterceptorManager() { + this.handlers = []; +} - if (xsrfValue) { - headers.set(xsrfHeaderName, xsrfValue); - } - } +/** + * Add a new interceptor to the stack + * + * @param {Function} fulfilled The function to handle `then` for a `Promise` + * @param {Function} rejected The function to handle `reject` for a `Promise` + * + * @return {Number} An ID used to remove interceptor later + */ +InterceptorManager.prototype.use = function use(fulfilled, rejected, options) { + this.handlers.push({ + fulfilled: fulfilled, + rejected: rejected, + synchronous: options ? options.synchronous : false, + runWhen: options ? options.runWhen : null + }); + return this.handlers.length - 1; +}; + +/** + * Remove an interceptor from the stack + * + * @param {Number} id The ID that was returned by `use` + */ +InterceptorManager.prototype.eject = function eject(id) { + if (this.handlers[id]) { + this.handlers[id] = null; } +}; - return newConfig; +/** + * Iterate over all the registered interceptors + * + * This method is particularly useful for skipping over any + * interceptors that may have become `null` calling `eject`. + * + * @param {Function} fn The function to call for each interceptor + */ +InterceptorManager.prototype.forEach = function forEach(fn) { + utils.forEach(this.handlers, function forEachHandler(h) { + if (h !== null) { + fn(h); + } + }); }; -const isXHRAdapterSupported = typeof XMLHttpRequest !== 'undefined'; +module.exports = InterceptorManager; -var xhrAdapter = isXHRAdapterSupported && function (config) { - return new Promise(function dispatchXhrRequest(resolve, reject) { - const _config = resolveConfig(config); - let requestData = _config.data; - const requestHeaders = AxiosHeaders$1.from(_config.headers).normalize(); - let {responseType, onUploadProgress, onDownloadProgress} = _config; - let onCanceled; - let uploadThrottled, downloadThrottled; - let flushUpload, flushDownload; - function done() { - flushUpload && flushUpload(); // flush events - flushDownload && flushDownload(); // flush events +/***/ }), - _config.cancelToken && _config.cancelToken.unsubscribe(onCanceled); +/***/ "./node_modules/axios/lib/core/buildFullPath.js": +/*!******************************************************!*\ + !*** ./node_modules/axios/lib/core/buildFullPath.js ***! + \******************************************************/ +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - _config.signal && _config.signal.removeEventListener('abort', onCanceled); - } +"use strict"; - let request = new XMLHttpRequest(); - request.open(_config.method.toUpperCase(), _config.url, true); +var isAbsoluteURL = __webpack_require__(/*! ../helpers/isAbsoluteURL */ "./node_modules/axios/lib/helpers/isAbsoluteURL.js"); +var combineURLs = __webpack_require__(/*! ../helpers/combineURLs */ "./node_modules/axios/lib/helpers/combineURLs.js"); - // Set the request timeout in MS - request.timeout = _config.timeout; +/** + * Creates a new URL by combining the baseURL with the requestedURL, + * only when the requestedURL is not already an absolute URL. + * If the requestURL is absolute, this function returns the requestedURL untouched. + * + * @param {string} baseURL The base URL + * @param {string} requestedURL Absolute or relative URL to combine + * @returns {string} The combined full path + */ +module.exports = function buildFullPath(baseURL, requestedURL) { + if (baseURL && !isAbsoluteURL(requestedURL)) { + return combineURLs(baseURL, requestedURL); + } + return requestedURL; +}; - function onloadend() { - if (!request) { - return; - } - // Prepare the response - const responseHeaders = AxiosHeaders$1.from( - 'getAllResponseHeaders' in request && request.getAllResponseHeaders() - ); - const responseData = !responseType || responseType === 'text' || responseType === 'json' ? - request.responseText : request.response; - const response = { - data: responseData, - status: request.status, - statusText: request.statusText, - headers: responseHeaders, - config, - request - }; - settle(function _resolve(value) { - resolve(value); - done(); - }, function _reject(err) { - reject(err); - done(); - }, response); +/***/ }), - // Clean up request - request = null; - } +/***/ "./node_modules/axios/lib/core/createError.js": +/*!****************************************************!*\ + !*** ./node_modules/axios/lib/core/createError.js ***! + \****************************************************/ +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - if ('onloadend' in request) { - // Use onloadend if available - request.onloadend = onloadend; - } else { - // Listen for ready state to emulate onloadend - request.onreadystatechange = function handleLoad() { - if (!request || request.readyState !== 4) { - return; - } +"use strict"; - // The request errored out and we didn't get a response, this will be - // handled by onerror instead - // With one exception: request that using file: protocol, most browsers - // will return status as 0 even though it's a successful request - if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) { - return; - } - // readystate handler is calling before onerror or ontimeout handlers, - // so we should call onloadend on the next 'tick' - setTimeout(onloadend); - }; - } - // Handle browser request cancellation (as opposed to a manual cancellation) - request.onabort = function handleAbort() { - if (!request) { - return; - } +var enhanceError = __webpack_require__(/*! ./enhanceError */ "./node_modules/axios/lib/core/enhanceError.js"); - reject(new AxiosError$1('Request aborted', AxiosError$1.ECONNABORTED, config, request)); +/** + * Create an Error with the specified message, config, error code, request and response. + * + * @param {string} message The error message. + * @param {Object} config The config. + * @param {string} [code] The error code (for example, 'ECONNABORTED'). + * @param {Object} [request] The request. + * @param {Object} [response] The response. + * @returns {Error} The created error. + */ +module.exports = function createError(message, config, code, request, response) { + var error = new Error(message); + return enhanceError(error, config, code, request, response); +}; - // Clean up request - request = null; - }; - // Handle low level network errors - request.onerror = function handleError(event) { - // Browsers deliver a ProgressEvent in XHR onerror - // (message may be empty; when present, surface it) - // See https://developer.mozilla.org/docs/Web/API/XMLHttpRequest/error_event - const msg = event && event.message ? event.message : 'Network Error'; - const err = new AxiosError$1(msg, AxiosError$1.ERR_NETWORK, config, request); - // attach the underlying event for consumers who want details - err.event = event || null; - reject(err); - request = null; - }; - - // Handle timeout - request.ontimeout = function handleTimeout() { - let timeoutErrorMessage = _config.timeout ? 'timeout of ' + _config.timeout + 'ms exceeded' : 'timeout exceeded'; - const transitional = _config.transitional || transitionalDefaults; - if (_config.timeoutErrorMessage) { - timeoutErrorMessage = _config.timeoutErrorMessage; - } - reject(new AxiosError$1( - timeoutErrorMessage, - transitional.clarifyTimeoutError ? AxiosError$1.ETIMEDOUT : AxiosError$1.ECONNABORTED, - config, - request)); +/***/ }), - // Clean up request - request = null; - }; +/***/ "./node_modules/axios/lib/core/dispatchRequest.js": +/*!********************************************************!*\ + !*** ./node_modules/axios/lib/core/dispatchRequest.js ***! + \********************************************************/ +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - // Remove Content-Type if data is undefined - requestData === undefined && requestHeaders.setContentType(null); +"use strict"; - // Add headers to the request - if ('setRequestHeader' in request) { - utils$1.forEach(requestHeaders.toJSON(), function setRequestHeader(val, key) { - request.setRequestHeader(key, val); - }); - } - // Add withCredentials to request if needed - if (!utils$1.isUndefined(_config.withCredentials)) { - request.withCredentials = !!_config.withCredentials; - } +var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js"); +var transformData = __webpack_require__(/*! ./transformData */ "./node_modules/axios/lib/core/transformData.js"); +var isCancel = __webpack_require__(/*! ../cancel/isCancel */ "./node_modules/axios/lib/cancel/isCancel.js"); +var defaults = __webpack_require__(/*! ../defaults */ "./node_modules/axios/lib/defaults.js"); - // Add responseType to request if needed - if (responseType && responseType !== 'json') { - request.responseType = _config.responseType; - } +/** + * Throws a `Cancel` if cancellation has been requested. + */ +function throwIfCancellationRequested(config) { + if (config.cancelToken) { + config.cancelToken.throwIfRequested(); + } +} - // Handle progress if needed - if (onDownloadProgress) { - ([downloadThrottled, flushDownload] = progressEventReducer(onDownloadProgress, true)); - request.addEventListener('progress', downloadThrottled); - } +/** + * Dispatch a request to the server using the configured adapter. + * + * @param {object} config The config that is to be used for the request + * @returns {Promise} The Promise to be fulfilled + */ +module.exports = function dispatchRequest(config) { + throwIfCancellationRequested(config); - // Not all browsers support upload events - if (onUploadProgress && request.upload) { - ([uploadThrottled, flushUpload] = progressEventReducer(onUploadProgress)); + // Ensure headers exist + config.headers = config.headers || {}; + + // Transform request data + config.data = transformData.call( + config, + config.data, + config.headers, + config.transformRequest + ); - request.upload.addEventListener('progress', uploadThrottled); + // Flatten headers + config.headers = utils.merge( + config.headers.common || {}, + config.headers[config.method] || {}, + config.headers + ); - request.upload.addEventListener('loadend', flushUpload); + utils.forEach( + ['delete', 'get', 'head', 'post', 'put', 'patch', 'common'], + function cleanHeaderConfig(method) { + delete config.headers[method]; } + ); - if (_config.cancelToken || _config.signal) { - // Handle cancellation - // eslint-disable-next-line func-names - onCanceled = cancel => { - if (!request) { - return; - } - reject(!cancel || cancel.type ? new CanceledError$1(null, config, request) : cancel); - request.abort(); - request = null; - }; + var adapter = config.adapter || defaults.adapter; - _config.cancelToken && _config.cancelToken.subscribe(onCanceled); - if (_config.signal) { - _config.signal.aborted ? onCanceled() : _config.signal.addEventListener('abort', onCanceled); - } - } + return adapter(config).then(function onAdapterResolution(response) { + throwIfCancellationRequested(config); - const protocol = parseProtocol(_config.url); + // Transform response data + response.data = transformData.call( + config, + response.data, + response.headers, + config.transformResponse + ); - if (protocol && platform.protocols.indexOf(protocol) === -1) { - reject(new AxiosError$1('Unsupported protocol ' + protocol + ':', AxiosError$1.ERR_BAD_REQUEST, config)); - return; - } + return response; + }, function onAdapterRejection(reason) { + if (!isCancel(reason)) { + throwIfCancellationRequested(config); + // Transform response data + if (reason && reason.response) { + reason.response.data = transformData.call( + config, + reason.response.data, + reason.response.headers, + config.transformResponse + ); + } + } - // Send the request - request.send(requestData || null); + return Promise.reject(reason); }); }; -const composeSignals = (signals, timeout) => { - const {length} = (signals = signals ? signals.filter(Boolean) : []); - if (timeout || length) { - let controller = new AbortController(); +/***/ }), + +/***/ "./node_modules/axios/lib/core/enhanceError.js": +/*!*****************************************************!*\ + !*** ./node_modules/axios/lib/core/enhanceError.js ***! + \*****************************************************/ +/***/ (function(module) { + +"use strict"; + - let aborted; +/** + * Update an Error with the specified config, error code, and response. + * + * @param {Error} error The error to update. + * @param {Object} config The config. + * @param {string} [code] The error code (for example, 'ECONNABORTED'). + * @param {Object} [request] The request. + * @param {Object} [response] The response. + * @returns {Error} The error. + */ +module.exports = function enhanceError(error, config, code, request, response) { + error.config = config; + if (code) { + error.code = code; + } - const onabort = function (reason) { - if (!aborted) { - aborted = true; - unsubscribe(); - const err = reason instanceof Error ? reason : this.reason; - controller.abort(err instanceof AxiosError$1 ? err : new CanceledError$1(err instanceof Error ? err.message : err)); - } - }; + error.request = request; + error.response = response; + error.isAxiosError = true; - let timer = timeout && setTimeout(() => { - timer = null; - onabort(new AxiosError$1(`timeout of ${timeout}ms exceeded`, AxiosError$1.ETIMEDOUT)); - }, timeout); - - const unsubscribe = () => { - if (signals) { - timer && clearTimeout(timer); - timer = null; - signals.forEach(signal => { - signal.unsubscribe ? signal.unsubscribe(onabort) : signal.removeEventListener('abort', onabort); - }); - signals = null; - } + error.toJSON = function toJSON() { + return { + // Standard + message: this.message, + name: this.name, + // Microsoft + description: this.description, + number: this.number, + // Mozilla + fileName: this.fileName, + lineNumber: this.lineNumber, + columnNumber: this.columnNumber, + stack: this.stack, + // Axios + config: this.config, + code: this.code }; + }; + return error; +}; - signals.forEach((signal) => signal.addEventListener('abort', onabort)); - const {signal} = controller; +/***/ }), - signal.unsubscribe = () => utils$1.asap(unsubscribe); +/***/ "./node_modules/axios/lib/core/mergeConfig.js": +/*!****************************************************!*\ + !*** ./node_modules/axios/lib/core/mergeConfig.js ***! + \****************************************************/ +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - return signal; - } -}; +"use strict"; -var composeSignals$1 = composeSignals; -const streamChunk = function* (chunk, chunkSize) { - let len = chunk.byteLength; +var utils = __webpack_require__(/*! ../utils */ "./node_modules/axios/lib/utils.js"); - if (!chunkSize || len < chunkSize) { - yield chunk; - return; +/** + * Config-specific merge-function which creates a new config-object + * by merging two configuration objects together. + * + * @param {Object} config1 + * @param {Object} config2 + * @returns {Object} New object resulting from merging config2 to config1 + */ +module.exports = function mergeConfig(config1, config2) { + // eslint-disable-next-line no-param-reassign + config2 = config2 || {}; + var config = {}; + + var valueFromConfig2Keys = ['url', 'method', 'data']; + var mergeDeepPropertiesKeys = ['headers', 'auth', 'proxy', 'params']; + var defaultToConfig2Keys = [ + 'baseURL', 'transformRequest', 'transformResponse', 'paramsSerializer', + 'timeout', 'timeoutMessage', 'withCredentials', 'adapter', 'responseType', 'xsrfCookieName', + 'xsrfHeaderName', 'onUploadProgress', 'onDownloadProgress', 'decompress', + 'maxContentLength', 'maxBodyLength', 'maxRedirects', 'transport', 'httpAgent', + 'httpsAgent', 'cancelToken', 'socketPath', 'responseEncoding' + ]; + var directMergeKeys = ['validateStatus']; + + function getMergedValue(target, source) { + if (utils.isPlainObject(target) && utils.isPlainObject(source)) { + return utils.merge(target, source); + } else if (utils.isPlainObject(source)) { + return utils.merge({}, source); + } else if (utils.isArray(source)) { + return source.slice(); + } + return source; } - let pos = 0; - let end; - - while (pos < len) { - end = pos + chunkSize; - yield chunk.slice(pos, end); - pos = end; + function mergeDeepProperties(prop) { + if (!utils.isUndefined(config2[prop])) { + config[prop] = getMergedValue(config1[prop], config2[prop]); + } else if (!utils.isUndefined(config1[prop])) { + config[prop] = getMergedValue(undefined, config1[prop]); + } } -}; -const readBytes = async function* (iterable, chunkSize) { - for await (const chunk of readStream(iterable)) { - yield* streamChunk(chunk, chunkSize); - } -}; + utils.forEach(valueFromConfig2Keys, function valueFromConfig2(prop) { + if (!utils.isUndefined(config2[prop])) { + config[prop] = getMergedValue(undefined, config2[prop]); + } + }); -const readStream = async function* (stream) { - if (stream[Symbol.asyncIterator]) { - yield* stream; - return; - } + utils.forEach(mergeDeepPropertiesKeys, mergeDeepProperties); - const reader = stream.getReader(); - try { - for (;;) { - const {done, value} = await reader.read(); - if (done) { - break; - } - yield value; + utils.forEach(defaultToConfig2Keys, function defaultToConfig2(prop) { + if (!utils.isUndefined(config2[prop])) { + config[prop] = getMergedValue(undefined, config2[prop]); + } else if (!utils.isUndefined(config1[prop])) { + config[prop] = getMergedValue(undefined, config1[prop]); } - } finally { - await reader.cancel(); - } -}; - -const trackStream = (stream, chunkSize, onProgress, onFinish) => { - const iterator = readBytes(stream, chunkSize); + }); - let bytes = 0; - let done; - let _onFinish = (e) => { - if (!done) { - done = true; - onFinish && onFinish(e); + utils.forEach(directMergeKeys, function merge(prop) { + if (prop in config2) { + config[prop] = getMergedValue(config1[prop], config2[prop]); + } else if (prop in config1) { + config[prop] = getMergedValue(undefined, config1[prop]); } - }; + }); - return new ReadableStream({ - async pull(controller) { - try { - const {done, value} = await iterator.next(); + var axiosKeys = valueFromConfig2Keys + .concat(mergeDeepPropertiesKeys) + .concat(defaultToConfig2Keys) + .concat(directMergeKeys); - if (done) { - _onFinish(); - controller.close(); - return; - } + var otherKeys = Object + .keys(config1) + .concat(Object.keys(config2)) + .filter(function filterAxiosKeys(key) { + return axiosKeys.indexOf(key) === -1; + }); - let len = value.byteLength; - if (onProgress) { - let loadedBytes = bytes += len; - onProgress(loadedBytes); - } - controller.enqueue(new Uint8Array(value)); - } catch (err) { - _onFinish(err); - throw err; - } - }, - cancel(reason) { - _onFinish(reason); - return iterator.return(); - } - }, { - highWaterMark: 2 - }) + utils.forEach(otherKeys, mergeDeepProperties); + + return config; }; -const DEFAULT_CHUNK_SIZE = 64 * 1024; -const {isFunction} = utils$1; +/***/ }), -const globalFetchAPI = (({Request, Response}) => ({ - Request, Response -}))(utils$1.global); +/***/ "./node_modules/axios/lib/core/settle.js": +/*!***********************************************!*\ + !*** ./node_modules/axios/lib/core/settle.js ***! + \***********************************************/ +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { -const { - ReadableStream: ReadableStream$1, TextEncoder -} = utils$1.global; +"use strict"; -const test = (fn, ...args) => { - try { - return !!fn(...args); - } catch (e) { - return false +var createError = __webpack_require__(/*! ./createError */ "./node_modules/axios/lib/core/createError.js"); + +/** + * Resolve or reject a Promise based on response status. + * + * @param {Function} resolve A function that resolves the promise. + * @param {Function} reject A function that rejects the promise. + * @param {object} response The response. + */ +module.exports = function settle(resolve, reject, response) { + var validateStatus = response.config.validateStatus; + if (!response.status || !validateStatus || validateStatus(response.status)) { + resolve(response); + } else { + reject(createError( + 'Request failed with status code ' + response.status, + response.config, + null, + response.request, + response + )); } }; -const factory = (env) => { - env = utils$1.merge.call({ - skipUndefined: true - }, globalFetchAPI, env); - const {fetch: envFetch, Request, Response} = env; - const isFetchSupported = envFetch ? isFunction(envFetch) : typeof fetch === 'function'; - const isRequestSupported = isFunction(Request); - const isResponseSupported = isFunction(Response); - - if (!isFetchSupported) { - return false; - } +/***/ }), - const isReadableStreamSupported = isFetchSupported && isFunction(ReadableStream$1); +/***/ "./node_modules/axios/lib/core/transformData.js": +/*!******************************************************!*\ + !*** ./node_modules/axios/lib/core/transformData.js ***! + \******************************************************/ +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - const encodeText = isFetchSupported && (typeof TextEncoder === 'function' ? - ((encoder) => (str) => encoder.encode(str))(new TextEncoder()) : - async (str) => new Uint8Array(await new Request(str).arrayBuffer()) - ); +"use strict"; - const supportsRequestStream = isRequestSupported && isReadableStreamSupported && test(() => { - let duplexAccessed = false; - const hasContentType = new Request(platform.origin, { - body: new ReadableStream$1(), - method: 'POST', - get duplex() { - duplexAccessed = true; - return 'half'; - }, - }).headers.has('Content-Type'); +var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js"); +var defaults = __webpack_require__(/*! ./../defaults */ "./node_modules/axios/lib/defaults.js"); - return duplexAccessed && !hasContentType; +/** + * Transform the data for a request or a response + * + * @param {Object|String} data The data to be transformed + * @param {Array} headers The headers for the request or response + * @param {Array|Function} fns A single function or Array of functions + * @returns {*} The resulting transformed data + */ +module.exports = function transformData(data, headers, fns) { + var context = this || defaults; + /*eslint no-param-reassign:0*/ + utils.forEach(fns, function transform(fn) { + data = fn.call(context, data, headers); }); - const supportsResponseStream = isResponseSupported && isReadableStreamSupported && - test(() => utils$1.isReadableStream(new Response('').body)); + return data; +}; - const resolvers = { - stream: supportsResponseStream && ((res) => res.body) - }; - isFetchSupported && ((() => { - ['text', 'arrayBuffer', 'blob', 'formData', 'stream'].forEach(type => { - !resolvers[type] && (resolvers[type] = (res, config) => { - let method = res && res[type]; +/***/ }), - if (method) { - return method.call(res); - } +/***/ "./node_modules/axios/lib/defaults.js": +/*!********************************************!*\ + !*** ./node_modules/axios/lib/defaults.js ***! + \********************************************/ +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - throw new AxiosError$1(`Response type '${type}' is not supported`, AxiosError$1.ERR_NOT_SUPPORT, config); - }); - }); - })()); +"use strict"; - const getBodyLength = async (body) => { - if (body == null) { - return 0; - } - if (utils$1.isBlob(body)) { - return body.size; - } +var utils = __webpack_require__(/*! ./utils */ "./node_modules/axios/lib/utils.js"); +var normalizeHeaderName = __webpack_require__(/*! ./helpers/normalizeHeaderName */ "./node_modules/axios/lib/helpers/normalizeHeaderName.js"); +var enhanceError = __webpack_require__(/*! ./core/enhanceError */ "./node_modules/axios/lib/core/enhanceError.js"); - if (utils$1.isSpecCompliantForm(body)) { - const _request = new Request(platform.origin, { - method: 'POST', - body, - }); - return (await _request.arrayBuffer()).byteLength; - } +var DEFAULT_CONTENT_TYPE = { + 'Content-Type': 'application/x-www-form-urlencoded' +}; - if (utils$1.isArrayBufferView(body) || utils$1.isArrayBuffer(body)) { - return body.byteLength; - } +function setContentTypeIfUnset(headers, value) { + if (!utils.isUndefined(headers) && utils.isUndefined(headers['Content-Type'])) { + headers['Content-Type'] = value; + } +} - if (utils$1.isURLSearchParams(body)) { - body = body + ''; - } +function getDefaultAdapter() { + var adapter; + if (typeof XMLHttpRequest !== 'undefined') { + // For browsers use XHR adapter + adapter = __webpack_require__(/*! ./adapters/xhr */ "./node_modules/axios/lib/adapters/xhr.js"); + } else if (typeof process !== 'undefined' && Object.prototype.toString.call(process) === '[object process]') { + // For node use HTTP adapter + adapter = __webpack_require__(/*! ./adapters/http */ "./node_modules/axios/lib/adapters/xhr.js"); + } + return adapter; +} - if (utils$1.isString(body)) { - return (await encodeText(body)).byteLength; +function stringifySafely(rawValue, parser, encoder) { + if (utils.isString(rawValue)) { + try { + (parser || JSON.parse)(rawValue); + return utils.trim(rawValue); + } catch (e) { + if (e.name !== 'SyntaxError') { + throw e; + } } - }; + } - const resolveBodyLength = async (headers, body) => { - const length = utils$1.toFiniteNumber(headers.getContentLength()); + return (encoder || JSON.stringify)(rawValue); +} - return length == null ? getBodyLength(body) : length; - }; +var defaults = { - return async (config) => { - let { - url, - method, - data, - signal, - cancelToken, - timeout, - onDownloadProgress, - onUploadProgress, - responseType, - headers, - withCredentials = 'same-origin', - fetchOptions - } = resolveConfig(config); + transitional: { + silentJSONParsing: true, + forcedJSONParsing: true, + clarifyTimeoutError: false + }, - let _fetch = envFetch || fetch; + adapter: getDefaultAdapter(), - responseType = responseType ? (responseType + '').toLowerCase() : 'text'; + transformRequest: [function transformRequest(data, headers) { + normalizeHeaderName(headers, 'Accept'); + normalizeHeaderName(headers, 'Content-Type'); + + if (utils.isFormData(data) || + utils.isArrayBuffer(data) || + utils.isBuffer(data) || + utils.isStream(data) || + utils.isFile(data) || + utils.isBlob(data) + ) { + return data; + } + if (utils.isArrayBufferView(data)) { + return data.buffer; + } + if (utils.isURLSearchParams(data)) { + setContentTypeIfUnset(headers, 'application/x-www-form-urlencoded;charset=utf-8'); + return data.toString(); + } + if (utils.isObject(data) || (headers && headers['Content-Type'] === 'application/json')) { + setContentTypeIfUnset(headers, 'application/json'); + return stringifySafely(data); + } + return data; + }], - let composedSignal = composeSignals$1([signal, cancelToken && cancelToken.toAbortSignal()], timeout); + transformResponse: [function transformResponse(data) { + var transitional = this.transitional; + var silentJSONParsing = transitional && transitional.silentJSONParsing; + var forcedJSONParsing = transitional && transitional.forcedJSONParsing; + var strictJSONParsing = !silentJSONParsing && this.responseType === 'json'; - let request = null; + if (strictJSONParsing || (forcedJSONParsing && utils.isString(data) && data.length)) { + try { + return JSON.parse(data); + } catch (e) { + if (strictJSONParsing) { + if (e.name === 'SyntaxError') { + throw enhanceError(e, this, 'E_JSON_PARSE'); + } + throw e; + } + } + } - const unsubscribe = composedSignal && composedSignal.unsubscribe && (() => { - composedSignal.unsubscribe(); - }); + return data; + }], - let requestContentLength; + /** + * A timeout in milliseconds to abort a request. If set to 0 (default) a + * timeout is not created. + */ + timeout: 0, - try { - if ( - onUploadProgress && supportsRequestStream && method !== 'get' && method !== 'head' && - (requestContentLength = await resolveBodyLength(headers, data)) !== 0 - ) { - let _request = new Request(url, { - method: 'POST', - body: data, - duplex: "half" - }); + xsrfCookieName: 'XSRF-TOKEN', + xsrfHeaderName: 'X-XSRF-TOKEN', - let contentTypeHeader; + maxContentLength: -1, + maxBodyLength: -1, - if (utils$1.isFormData(data) && (contentTypeHeader = _request.headers.get('content-type'))) { - headers.setContentType(contentTypeHeader); - } + validateStatus: function validateStatus(status) { + return status >= 200 && status < 300; + } +}; - if (_request.body) { - const [onProgress, flush] = progressEventDecorator( - requestContentLength, - progressEventReducer(asyncDecorator(onUploadProgress)) - ); +defaults.headers = { + common: { + 'Accept': 'application/json, text/plain, */*' + } +}; - data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, onProgress, flush); - } - } +utils.forEach(['delete', 'get', 'head'], function forEachMethodNoData(method) { + defaults.headers[method] = {}; +}); - if (!utils$1.isString(withCredentials)) { - withCredentials = withCredentials ? 'include' : 'omit'; - } +utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) { + defaults.headers[method] = utils.merge(DEFAULT_CONTENT_TYPE); +}); - // Cloudflare Workers throws when credentials are defined - // see https://github.com/cloudflare/workerd/issues/902 - const isCredentialsSupported = isRequestSupported && "credentials" in Request.prototype; - - const resolvedOptions = { - ...fetchOptions, - signal: composedSignal, - method: method.toUpperCase(), - headers: headers.normalize().toJSON(), - body: data, - duplex: "half", - credentials: isCredentialsSupported ? withCredentials : undefined - }; +module.exports = defaults; - request = isRequestSupported && new Request(url, resolvedOptions); - let response = await (isRequestSupported ? _fetch(request, fetchOptions) : _fetch(url, resolvedOptions)); +/***/ }), - const isStreamResponse = supportsResponseStream && (responseType === 'stream' || responseType === 'response'); +/***/ "./node_modules/axios/lib/helpers/bind.js": +/*!************************************************!*\ + !*** ./node_modules/axios/lib/helpers/bind.js ***! + \************************************************/ +/***/ (function(module) { - if (supportsResponseStream && (onDownloadProgress || (isStreamResponse && unsubscribe))) { - const options = {}; +"use strict"; - ['status', 'statusText', 'headers'].forEach(prop => { - options[prop] = response[prop]; - }); - const responseContentLength = utils$1.toFiniteNumber(response.headers.get('content-length')); +module.exports = function bind(fn, thisArg) { + return function wrap() { + var args = new Array(arguments.length); + for (var i = 0; i < args.length; i++) { + args[i] = arguments[i]; + } + return fn.apply(thisArg, args); + }; +}; - const [onProgress, flush] = onDownloadProgress && progressEventDecorator( - responseContentLength, - progressEventReducer(asyncDecorator(onDownloadProgress), true) - ) || []; - response = new Response( - trackStream(response.body, DEFAULT_CHUNK_SIZE, onProgress, () => { - flush && flush(); - unsubscribe && unsubscribe(); - }), - options - ); - } +/***/ }), - responseType = responseType || 'text'; +/***/ "./node_modules/axios/lib/helpers/buildURL.js": +/*!****************************************************!*\ + !*** ./node_modules/axios/lib/helpers/buildURL.js ***! + \****************************************************/ +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - let responseData = await resolvers[utils$1.findKey(resolvers, responseType) || 'text'](response, config); +"use strict"; - !isStreamResponse && unsubscribe && unsubscribe(); - return await new Promise((resolve, reject) => { - settle(resolve, reject, { - data: responseData, - headers: AxiosHeaders$1.from(response.headers), - status: response.status, - statusText: response.statusText, - config, - request - }); - }) - } catch (err) { - unsubscribe && unsubscribe(); +var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js"); - if (err && err.name === 'TypeError' && /Load failed|fetch/i.test(err.message)) { - throw Object.assign( - new AxiosError$1('Network Error', AxiosError$1.ERR_NETWORK, config, request, err && err.response), - { - cause: err.cause || err - } - ) - } +function encode(val) { + return encodeURIComponent(val). + replace(/%3A/gi, ':'). + replace(/%24/g, '$'). + replace(/%2C/gi, ','). + replace(/%20/g, '+'). + replace(/%5B/gi, '['). + replace(/%5D/gi, ']'); +} - throw AxiosError$1.from(err, err && err.code, config, request, err && err.response); - } +/** + * Build a URL by appending params to the end + * + * @param {string} url The base of the url (e.g., http://www.google.com) + * @param {object} [params] The params to be appended + * @returns {string} The formatted url + */ +module.exports = function buildURL(url, params, paramsSerializer) { + /*eslint no-param-reassign:0*/ + if (!params) { + return url; } -}; -const seedCache = new Map(); + var serializedParams; + if (paramsSerializer) { + serializedParams = paramsSerializer(params); + } else if (utils.isURLSearchParams(params)) { + serializedParams = params.toString(); + } else { + var parts = []; -const getFetch = (config) => { - let env = (config && config.env) || {}; - const {fetch, Request, Response} = env; - const seeds = [ - Request, Response, fetch - ]; + utils.forEach(params, function serialize(val, key) { + if (val === null || typeof val === 'undefined') { + return; + } - let len = seeds.length, i = len, - seed, target, map = seedCache; + if (utils.isArray(val)) { + key = key + '[]'; + } else { + val = [val]; + } + + utils.forEach(val, function parseValue(v) { + if (utils.isDate(v)) { + v = v.toISOString(); + } else if (utils.isObject(v)) { + v = JSON.stringify(v); + } + parts.push(encode(key) + '=' + encode(v)); + }); + }); - while (i--) { - seed = seeds[i]; - target = map.get(seed); + serializedParams = parts.join('&'); + } - target === undefined && map.set(seed, target = (i ? new Map() : factory(env))); + if (serializedParams) { + var hashmarkIndex = url.indexOf('#'); + if (hashmarkIndex !== -1) { + url = url.slice(0, hashmarkIndex); + } - map = target; + url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams; } - return target; + return url; }; -getFetch(); + +/***/ }), + +/***/ "./node_modules/axios/lib/helpers/combineURLs.js": +/*!*******************************************************!*\ + !*** ./node_modules/axios/lib/helpers/combineURLs.js ***! + \*******************************************************/ +/***/ (function(module) { + +"use strict"; + /** - * Known adapters mapping. - * Provides environment-specific adapters for Axios: - * - `http` for Node.js - * - `xhr` for browsers - * - `fetch` for fetch API-based requests - * - * @type {Object} + * Creates a new URL by combining the specified URLs + * + * @param {string} baseURL The base URL + * @param {string} relativeURL The relative URL + * @returns {string} The combined URL */ -const knownAdapters = { - http: httpAdapter, - xhr: xhrAdapter, - fetch: { - get: getFetch, - } +module.exports = function combineURLs(baseURL, relativeURL) { + return relativeURL + ? baseURL.replace(/\/+$/, '') + '/' + relativeURL.replace(/^\/+/, '') + : baseURL; }; -// Assign adapter names for easier debugging and identification -utils$1.forEach(knownAdapters, (fn, value) => { - if (fn) { - try { - Object.defineProperty(fn, 'name', { value }); - } catch (e) { - // eslint-disable-next-line no-empty - } - Object.defineProperty(fn, 'adapterName', { value }); - } -}); -/** - * Render a rejection reason string for unknown or unsupported adapters - * - * @param {string} reason - * @returns {string} - */ -const renderReason = (reason) => `- ${reason}`; +/***/ }), -/** - * Check if the adapter is resolved (function, null, or false) - * - * @param {Function|null|false} adapter - * @returns {boolean} - */ -const isResolvedHandle = (adapter) => utils$1.isFunction(adapter) || adapter === null || adapter === false; +/***/ "./node_modules/axios/lib/helpers/cookies.js": +/*!***************************************************!*\ + !*** ./node_modules/axios/lib/helpers/cookies.js ***! + \***************************************************/ +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { -/** - * Get the first suitable adapter from the provided list. - * Tries each adapter in order until a supported one is found. - * Throws an AxiosError if no adapter is suitable. - * - * @param {Array|string|Function} adapters - Adapter(s) by name or function. - * @param {Object} config - Axios request configuration - * @throws {AxiosError} If no suitable adapter is available - * @returns {Function} The resolved adapter function - */ -function getAdapter(adapters, config) { - adapters = utils$1.isArray(adapters) ? adapters : [adapters]; +"use strict"; - const { length } = adapters; - let nameOrAdapter; - let adapter; - const rejectedReasons = {}; +var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js"); - for (let i = 0; i < length; i++) { - nameOrAdapter = adapters[i]; - let id; +module.exports = ( + utils.isStandardBrowserEnv() ? - adapter = nameOrAdapter; + // Standard browser envs support document.cookie + (function standardBrowserEnv() { + return { + write: function write(name, value, expires, path, domain, secure) { + var cookie = []; + cookie.push(name + '=' + encodeURIComponent(value)); + + if (utils.isNumber(expires)) { + cookie.push('expires=' + new Date(expires).toGMTString()); + } - if (!isResolvedHandle(nameOrAdapter)) { - adapter = knownAdapters[(id = String(nameOrAdapter)).toLowerCase()]; + if (utils.isString(path)) { + cookie.push('path=' + path); + } - if (adapter === undefined) { - throw new AxiosError$1(`Unknown adapter '${id}'`); - } - } + if (utils.isString(domain)) { + cookie.push('domain=' + domain); + } - if (adapter && (utils$1.isFunction(adapter) || (adapter = adapter.get(config)))) { - break; - } + if (secure === true) { + cookie.push('secure'); + } - rejectedReasons[id || '#' + i] = adapter; - } + document.cookie = cookie.join('; '); + }, - if (!adapter) { - const reasons = Object.entries(rejectedReasons) - .map(([id, state]) => `adapter ${id} ` + - (state === false ? 'is not supported by the environment' : 'is not available in the build') - ); + read: function read(name) { + var match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)')); + return (match ? decodeURIComponent(match[3]) : null); + }, + + remove: function remove(name) { + this.write(name, '', Date.now() - 86400000); + } + }; + })() : + + // Non standard browser env (web workers, react-native) lack needed support. + (function nonStandardBrowserEnv() { + return { + write: function write() {}, + read: function read() { return null; }, + remove: function remove() {} + }; + })() +); - let s = length ? - (reasons.length > 1 ? 'since :\n' + reasons.map(renderReason).join('\n') : ' ' + renderReason(reasons[0])) : - 'as no adapter specified'; - throw new AxiosError$1( - `There is no suitable adapter to dispatch the request ` + s, - 'ERR_NOT_SUPPORT' - ); - } +/***/ }), - return adapter; -} +/***/ "./node_modules/axios/lib/helpers/isAbsoluteURL.js": +/*!*********************************************************!*\ + !*** ./node_modules/axios/lib/helpers/isAbsoluteURL.js ***! + \*********************************************************/ +/***/ (function(module) { -/** - * Exports Axios adapters and utility to resolve an adapter - */ -var adapters = { - /** - * Resolve an adapter from a list of adapter names or functions. - * @type {Function} - */ - getAdapter, +"use strict"; - /** - * Exposes all known adapters - * @type {Object} - */ - adapters: knownAdapters -}; /** - * Throws a `CanceledError` if cancellation has been requested. - * - * @param {Object} config The config that is to be used for the request + * Determines whether the specified URL is absolute * - * @returns {void} + * @param {string} url The URL to test + * @returns {boolean} True if the specified URL is absolute, otherwise false */ -function throwIfCancellationRequested(config) { - if (config.cancelToken) { - config.cancelToken.throwIfRequested(); - } +module.exports = function isAbsoluteURL(url) { + // A URL is considered absolute if it begins with "://" or "//" (protocol-relative URL). + // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed + // by any combination of letters, digits, plus, period, or hyphen. + return /^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(url); +}; + + +/***/ }), + +/***/ "./node_modules/axios/lib/helpers/isAxiosError.js": +/*!********************************************************!*\ + !*** ./node_modules/axios/lib/helpers/isAxiosError.js ***! + \********************************************************/ +/***/ (function(module) { + +"use strict"; - if (config.signal && config.signal.aborted) { - throw new CanceledError$1(null, config); - } -} /** - * Dispatch a request to the server using the configured adapter. - * - * @param {object} config The config that is to be used for the request + * Determines whether the payload is an error thrown by Axios * - * @returns {Promise} The Promise to be fulfilled + * @param {*} payload The value to test + * @returns {boolean} True if the payload is an error thrown by Axios, otherwise false */ -function dispatchRequest(config) { - throwIfCancellationRequested(config); +module.exports = function isAxiosError(payload) { + return (typeof payload === 'object') && (payload.isAxiosError === true); +}; - config.headers = AxiosHeaders$1.from(config.headers); - // Transform request data - config.data = transformData.call( - config, - config.transformRequest - ); +/***/ }), - if (['post', 'put', 'patch'].indexOf(config.method) !== -1) { - config.headers.setContentType('application/x-www-form-urlencoded', false); - } +/***/ "./node_modules/axios/lib/helpers/isURLSameOrigin.js": +/*!***********************************************************!*\ + !*** ./node_modules/axios/lib/helpers/isURLSameOrigin.js ***! + \***********************************************************/ +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - const adapter = adapters.getAdapter(config.adapter || defaults$1.adapter, config); +"use strict"; - return adapter(config).then(function onAdapterResolution(response) { - throwIfCancellationRequested(config); - // Transform response data - response.data = transformData.call( - config, - config.transformResponse, - response - ); +var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js"); - response.headers = AxiosHeaders$1.from(response.headers); +module.exports = ( + utils.isStandardBrowserEnv() ? - return response; - }, function onAdapterRejection(reason) { - if (!isCancel(reason)) { - throwIfCancellationRequested(config); + // Standard browser envs have full support of the APIs needed to test + // whether the request URL is of the same origin as current location. + (function standardBrowserEnv() { + var msie = /(msie|trident)/i.test(navigator.userAgent); + var urlParsingNode = document.createElement('a'); + var originURL; - // Transform response data - if (reason && reason.response) { - reason.response.data = transformData.call( - config, - config.transformResponse, - reason.response - ); - reason.response.headers = AxiosHeaders$1.from(reason.response.headers); + /** + * Parse a URL to discover it's components + * + * @param {String} url The URL to be parsed + * @returns {Object} + */ + function resolveURL(url) { + var href = url; + + if (msie) { + // IE needs attribute set twice to normalize properties + urlParsingNode.setAttribute('href', href); + href = urlParsingNode.href; + } + + urlParsingNode.setAttribute('href', href); + + // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils + return { + href: urlParsingNode.href, + protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '', + host: urlParsingNode.host, + search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '', + hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '', + hostname: urlParsingNode.hostname, + port: urlParsingNode.port, + pathname: (urlParsingNode.pathname.charAt(0) === '/') ? + urlParsingNode.pathname : + '/' + urlParsingNode.pathname + }; } - } - return Promise.reject(reason); - }); -} + originURL = resolveURL(window.location.href); -const VERSION = "1.13.5"; + /** + * Determine if a URL shares the same origin as the current location + * + * @param {String} requestURL The URL to test + * @returns {boolean} True if URL shares the same origin, otherwise false + */ + return function isURLSameOrigin(requestURL) { + var parsed = (utils.isString(requestURL)) ? resolveURL(requestURL) : requestURL; + return (parsed.protocol === originURL.protocol && + parsed.host === originURL.host); + }; + })() : -const validators$1 = {}; + // Non standard browser envs (web workers, react-native) lack needed support. + (function nonStandardBrowserEnv() { + return function isURLSameOrigin() { + return true; + }; + })() +); -// eslint-disable-next-line func-names -['object', 'boolean', 'number', 'function', 'string', 'symbol'].forEach((type, i) => { - validators$1[type] = function validator(thing) { - return typeof thing === type || 'a' + (i < 1 ? 'n ' : ' ') + type; - }; -}); -const deprecatedWarnings = {}; +/***/ }), -/** - * Transitional option validator - * - * @param {function|boolean?} validator - set to false if the transitional option has been removed - * @param {string?} version - deprecated version / removed since version - * @param {string?} message - some message with additional info - * - * @returns {function} - */ -validators$1.transitional = function transitional(validator, version, message) { - function formatMessage(opt, desc) { - return '[Axios v' + VERSION + '] Transitional option \'' + opt + '\'' + desc + (message ? '. ' + message : ''); - } +/***/ "./node_modules/axios/lib/helpers/normalizeHeaderName.js": +/*!***************************************************************!*\ + !*** ./node_modules/axios/lib/helpers/normalizeHeaderName.js ***! + \***************************************************************/ +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - // eslint-disable-next-line func-names - return (value, opt, opts) => { - if (validator === false) { - throw new AxiosError$1( - formatMessage(opt, ' has been removed' + (version ? ' in ' + version : '')), - AxiosError$1.ERR_DEPRECATED - ); - } +"use strict"; - if (version && !deprecatedWarnings[opt]) { - deprecatedWarnings[opt] = true; - // eslint-disable-next-line no-console - console.warn( - formatMessage( - opt, - ' has been deprecated since v' + version + ' and will be removed in the near future' - ) - ); - } - return validator ? validator(value, opt, opts) : true; - }; -}; +var utils = __webpack_require__(/*! ../utils */ "./node_modules/axios/lib/utils.js"); -validators$1.spelling = function spelling(correctSpelling) { - return (value, opt) => { - // eslint-disable-next-line no-console - console.warn(`${opt} is likely a misspelling of ${correctSpelling}`); - return true; - } +module.exports = function normalizeHeaderName(headers, normalizedName) { + utils.forEach(headers, function processHeader(value, name) { + if (name !== normalizedName && name.toUpperCase() === normalizedName.toUpperCase()) { + headers[normalizedName] = value; + delete headers[name]; + } + }); }; -/** - * Assert object's properties type - * - * @param {object} options - * @param {object} schema - * @param {boolean?} allowUnknown - * - * @returns {object} - */ -function assertOptions(options, schema, allowUnknown) { - if (typeof options !== 'object') { - throw new AxiosError$1('options must be an object', AxiosError$1.ERR_BAD_OPTION_VALUE); - } - const keys = Object.keys(options); - let i = keys.length; - while (i-- > 0) { - const opt = keys[i]; - const validator = schema[opt]; - if (validator) { - const value = options[opt]; - const result = value === undefined || validator(value, opt, options); - if (result !== true) { - throw new AxiosError$1('option ' + opt + ' must be ' + result, AxiosError$1.ERR_BAD_OPTION_VALUE); - } - continue; - } - if (allowUnknown !== true) { - throw new AxiosError$1('Unknown option ' + opt, AxiosError$1.ERR_BAD_OPTION); - } - } -} +/***/ }), -var validator = { - assertOptions, - validators: validators$1 -}; +/***/ "./node_modules/axios/lib/helpers/parseHeaders.js": +/*!********************************************************!*\ + !*** ./node_modules/axios/lib/helpers/parseHeaders.js ***! + \********************************************************/ +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { -const validators = validator.validators; +"use strict"; + + +var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js"); + +// Headers whose duplicates are ignored by node +// c.f. https://nodejs.org/api/http.html#http_message_headers +var ignoreDuplicateOf = [ + 'age', 'authorization', 'content-length', 'content-type', 'etag', + 'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since', + 'last-modified', 'location', 'max-forwards', 'proxy-authorization', + 'referer', 'retry-after', 'user-agent' +]; /** - * Create a new instance of Axios + * Parse headers into an object * - * @param {Object} instanceConfig The default config for the instance + * ``` + * Date: Wed, 27 Aug 2014 08:58:49 GMT + * Content-Type: application/json + * Connection: keep-alive + * Transfer-Encoding: chunked + * ``` * - * @return {Axios} A new instance of Axios + * @param {String} headers Headers needing to be parsed + * @returns {Object} Headers parsed into an object */ -class Axios { - constructor(instanceConfig) { - this.defaults = instanceConfig || {}; - this.interceptors = { - request: new InterceptorManager$1(), - response: new InterceptorManager$1() - }; - } +module.exports = function parseHeaders(headers) { + var parsed = {}; + var key; + var val; + var i; - /** - * Dispatch a request - * - * @param {String|Object} configOrUrl The config specific for this request (merged with this.defaults) - * @param {?Object} config - * - * @returns {Promise} The Promise to be fulfilled - */ - async request(configOrUrl, config) { - try { - return await this._request(configOrUrl, config); - } catch (err) { - if (err instanceof Error) { - let dummy = {}; - - Error.captureStackTrace ? Error.captureStackTrace(dummy) : (dummy = new Error()); - - // slice off the Error: ... line - const stack = dummy.stack ? dummy.stack.replace(/^.+\n/, '') : ''; - try { - if (!err.stack) { - err.stack = stack; - // match without the 2 top stack lines - } else if (stack && !String(err.stack).endsWith(stack.replace(/^.+\n.+\n/, ''))) { - err.stack += '\n' + stack; - } - } catch (e) { - // ignore the case where "stack" is an un-writable property - } - } + if (!headers) { return parsed; } - throw err; - } - } + utils.forEach(headers.split('\n'), function parser(line) { + i = line.indexOf(':'); + key = utils.trim(line.substr(0, i)).toLowerCase(); + val = utils.trim(line.substr(i + 1)); - _request(configOrUrl, config) { - /*eslint no-param-reassign:0*/ - // Allow for axios('example/url'[, config]) a la fetch API - if (typeof configOrUrl === 'string') { - config = config || {}; - config.url = configOrUrl; - } else { - config = configOrUrl || {}; + if (key) { + if (parsed[key] && ignoreDuplicateOf.indexOf(key) >= 0) { + return; + } + if (key === 'set-cookie') { + parsed[key] = (parsed[key] ? parsed[key] : []).concat([val]); + } else { + parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val; + } } + }); - config = mergeConfig(this.defaults, config); + return parsed; +}; - const {transitional, paramsSerializer, headers} = config; - if (transitional !== undefined) { - validator.assertOptions(transitional, { - silentJSONParsing: validators.transitional(validators.boolean), - forcedJSONParsing: validators.transitional(validators.boolean), - clarifyTimeoutError: validators.transitional(validators.boolean), - legacyInterceptorReqResOrdering: validators.transitional(validators.boolean) - }, false); - } +/***/ }), - if (paramsSerializer != null) { - if (utils$1.isFunction(paramsSerializer)) { - config.paramsSerializer = { - serialize: paramsSerializer - }; - } else { - validator.assertOptions(paramsSerializer, { - encode: validators.function, - serialize: validators.function - }, true); - } - } +/***/ "./node_modules/axios/lib/helpers/spread.js": +/*!**************************************************!*\ + !*** ./node_modules/axios/lib/helpers/spread.js ***! + \**************************************************/ +/***/ (function(module) { - // Set config.allowAbsoluteUrls - if (config.allowAbsoluteUrls !== undefined) ; else if (this.defaults.allowAbsoluteUrls !== undefined) { - config.allowAbsoluteUrls = this.defaults.allowAbsoluteUrls; - } else { - config.allowAbsoluteUrls = true; - } +"use strict"; - validator.assertOptions(config, { - baseUrl: validators.spelling('baseURL'), - withXsrfToken: validators.spelling('withXSRFToken') - }, true); - // Set config.method - config.method = (config.method || this.defaults.method || 'get').toLowerCase(); +/** + * Syntactic sugar for invoking a function and expanding an array for arguments. + * + * Common use case would be to use `Function.prototype.apply`. + * + * ```js + * function f(x, y, z) {} + * var args = [1, 2, 3]; + * f.apply(null, args); + * ``` + * + * With `spread` this example can be re-written. + * + * ```js + * spread(function(x, y, z) {})([1, 2, 3]); + * ``` + * + * @param {Function} callback + * @returns {Function} + */ +module.exports = function spread(callback) { + return function wrap(arr) { + return callback.apply(null, arr); + }; +}; + - // Flatten headers - let contextHeaders = headers && utils$1.merge( - headers.common, - headers[config.method] - ); +/***/ }), - headers && utils$1.forEach( - ['delete', 'get', 'head', 'post', 'put', 'patch', 'common'], - (method) => { - delete headers[method]; - } - ); +/***/ "./node_modules/axios/lib/helpers/validator.js": +/*!*****************************************************!*\ + !*** ./node_modules/axios/lib/helpers/validator.js ***! + \*****************************************************/ +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - config.headers = AxiosHeaders$1.concat(contextHeaders, headers); +"use strict"; - // filter out skipped interceptors - const requestInterceptorChain = []; - let synchronousRequestInterceptors = true; - this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) { - if (typeof interceptor.runWhen === 'function' && interceptor.runWhen(config) === false) { - return; - } - synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous; +var pkg = __webpack_require__(/*! ./../../package.json */ "./node_modules/axios/package.json"); - const transitional = config.transitional || transitionalDefaults; - const legacyInterceptorReqResOrdering = transitional && transitional.legacyInterceptorReqResOrdering; +var validators = {}; - if (legacyInterceptorReqResOrdering) { - requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected); - } else { - requestInterceptorChain.push(interceptor.fulfilled, interceptor.rejected); - } - }); +// eslint-disable-next-line func-names +['object', 'boolean', 'number', 'function', 'string', 'symbol'].forEach(function(type, i) { + validators[type] = function validator(thing) { + return typeof thing === type || 'a' + (i < 1 ? 'n ' : ' ') + type; + }; +}); - const responseInterceptorChain = []; - this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) { - responseInterceptorChain.push(interceptor.fulfilled, interceptor.rejected); - }); +var deprecatedWarnings = {}; +var currentVerArr = pkg.version.split('.'); - let promise; - let i = 0; - let len; +/** + * Compare package versions + * @param {string} version + * @param {string?} thanVersion + * @returns {boolean} + */ +function isOlderVersion(version, thanVersion) { + var pkgVersionArr = thanVersion ? thanVersion.split('.') : currentVerArr; + var destVer = version.split('.'); + for (var i = 0; i < 3; i++) { + if (pkgVersionArr[i] > destVer[i]) { + return true; + } else if (pkgVersionArr[i] < destVer[i]) { + return false; + } + } + return false; +} - if (!synchronousRequestInterceptors) { - const chain = [dispatchRequest.bind(this), undefined]; - chain.unshift(...requestInterceptorChain); - chain.push(...responseInterceptorChain); - len = chain.length; +/** + * Transitional option validator + * @param {function|boolean?} validator + * @param {string?} version + * @param {string} message + * @returns {function} + */ +validators.transitional = function transitional(validator, version, message) { + var isDeprecated = version && isOlderVersion(version); - promise = Promise.resolve(config); + function formatMessage(opt, desc) { + return '[Axios v' + pkg.version + '] Transitional option \'' + opt + '\'' + desc + (message ? '. ' + message : ''); + } - while (i < len) { - promise = promise.then(chain[i++], chain[i++]); - } + // eslint-disable-next-line func-names + return function(value, opt, opts) { + if (validator === false) { + throw new Error(formatMessage(opt, ' has been removed in ' + version)); + } - return promise; + if (isDeprecated && !deprecatedWarnings[opt]) { + deprecatedWarnings[opt] = true; + // eslint-disable-next-line no-console + console.warn( + formatMessage( + opt, + ' has been deprecated since v' + version + ' and will be removed in the near future' + ) + ); } - len = requestInterceptorChain.length; + return validator ? validator(value, opt, opts) : true; + }; +}; - let newConfig = config; +/** + * Assert object's properties type + * @param {object} options + * @param {object} schema + * @param {boolean?} allowUnknown + */ - while (i < len) { - const onFulfilled = requestInterceptorChain[i++]; - const onRejected = requestInterceptorChain[i++]; - try { - newConfig = onFulfilled(newConfig); - } catch (error) { - onRejected.call(this, error); - break; +function assertOptions(options, schema, allowUnknown) { + if (typeof options !== 'object') { + throw new TypeError('options must be an object'); + } + var keys = Object.keys(options); + var i = keys.length; + while (i-- > 0) { + var opt = keys[i]; + var validator = schema[opt]; + if (validator) { + var value = options[opt]; + var result = value === undefined || validator(value, opt, options); + if (result !== true) { + throw new TypeError('option ' + opt + ' must be ' + result); } + continue; } - - try { - promise = dispatchRequest.call(this, newConfig); - } catch (error) { - return Promise.reject(error); + if (allowUnknown !== true) { + throw Error('Unknown option ' + opt); } + } +} - i = 0; - len = responseInterceptorChain.length; - - while (i < len) { - promise = promise.then(responseInterceptorChain[i++], responseInterceptorChain[i++]); - } +module.exports = { + isOlderVersion: isOlderVersion, + assertOptions: assertOptions, + validators: validators +}; - return promise; - } - getUri(config) { - config = mergeConfig(this.defaults, config); - const fullPath = buildFullPath(config.baseURL, config.url, config.allowAbsoluteUrls); - return buildURL(fullPath, config.params, config.paramsSerializer); - } -} +/***/ }), -// Provide aliases for supported request methods -utils$1.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) { - /*eslint func-names:0*/ - Axios.prototype[method] = function(url, config) { - return this.request(mergeConfig(config || {}, { - method, - url, - data: (config || {}).data - })); - }; -}); +/***/ "./node_modules/axios/lib/utils.js": +/*!*****************************************!*\ + !*** ./node_modules/axios/lib/utils.js ***! + \*****************************************/ +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { -utils$1.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) { - /*eslint func-names:0*/ +"use strict"; - function generateHTTPMethod(isForm) { - return function httpMethod(url, data, config) { - return this.request(mergeConfig(config || {}, { - method, - headers: isForm ? { - 'Content-Type': 'multipart/form-data' - } : {}, - url, - data - })); - }; - } - Axios.prototype[method] = generateHTTPMethod(); +var bind = __webpack_require__(/*! ./helpers/bind */ "./node_modules/axios/lib/helpers/bind.js"); - Axios.prototype[method + 'Form'] = generateHTTPMethod(true); -}); +// utils is a library of generic helper functions non-specific to axios -var Axios$1 = Axios; +var toString = Object.prototype.toString; /** - * A `CancelToken` is an object that can be used to request cancellation of an operation. - * - * @param {Function} executor The executor function. + * Determine if a value is an Array * - * @returns {CancelToken} + * @param {Object} val The value to test + * @returns {boolean} True if value is an Array, otherwise false */ -class CancelToken { - constructor(executor) { - if (typeof executor !== 'function') { - throw new TypeError('executor must be a function.'); - } - - let resolvePromise; +function isArray(val) { + return toString.call(val) === '[object Array]'; +} - this.promise = new Promise(function promiseExecutor(resolve) { - resolvePromise = resolve; - }); +/** + * Determine if a value is undefined + * + * @param {Object} val The value to test + * @returns {boolean} True if the value is undefined, otherwise false + */ +function isUndefined(val) { + return typeof val === 'undefined'; +} - const token = this; +/** + * Determine if a value is a Buffer + * + * @param {Object} val The value to test + * @returns {boolean} True if value is a Buffer, otherwise false + */ +function isBuffer(val) { + return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor) + && typeof val.constructor.isBuffer === 'function' && val.constructor.isBuffer(val); +} - // eslint-disable-next-line func-names - this.promise.then(cancel => { - if (!token._listeners) return; +/** + * Determine if a value is an ArrayBuffer + * + * @param {Object} val The value to test + * @returns {boolean} True if value is an ArrayBuffer, otherwise false + */ +function isArrayBuffer(val) { + return toString.call(val) === '[object ArrayBuffer]'; +} - let i = token._listeners.length; +/** + * Determine if a value is a FormData + * + * @param {Object} val The value to test + * @returns {boolean} True if value is an FormData, otherwise false + */ +function isFormData(val) { + return (typeof FormData !== 'undefined') && (val instanceof FormData); +} - while (i-- > 0) { - token._listeners[i](cancel); - } - token._listeners = null; - }); +/** + * Determine if a value is a view on an ArrayBuffer + * + * @param {Object} val The value to test + * @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false + */ +function isArrayBufferView(val) { + var result; + if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) { + result = ArrayBuffer.isView(val); + } else { + result = (val) && (val.buffer) && (val.buffer instanceof ArrayBuffer); + } + return result; +} - // eslint-disable-next-line func-names - this.promise.then = onfulfilled => { - let _resolve; - // eslint-disable-next-line func-names - const promise = new Promise(resolve => { - token.subscribe(resolve); - _resolve = resolve; - }).then(onfulfilled); - - promise.cancel = function reject() { - token.unsubscribe(_resolve); - }; +/** + * Determine if a value is a String + * + * @param {Object} val The value to test + * @returns {boolean} True if value is a String, otherwise false + */ +function isString(val) { + return typeof val === 'string'; +} - return promise; - }; +/** + * Determine if a value is a Number + * + * @param {Object} val The value to test + * @returns {boolean} True if value is a Number, otherwise false + */ +function isNumber(val) { + return typeof val === 'number'; +} - executor(function cancel(message, config, request) { - if (token.reason) { - // Cancellation has already been requested - return; - } +/** + * Determine if a value is an Object + * + * @param {Object} val The value to test + * @returns {boolean} True if value is an Object, otherwise false + */ +function isObject(val) { + return val !== null && typeof val === 'object'; +} - token.reason = new CanceledError$1(message, config, request); - resolvePromise(token.reason); - }); +/** + * Determine if a value is a plain Object + * + * @param {Object} val The value to test + * @return {boolean} True if value is a plain Object, otherwise false + */ +function isPlainObject(val) { + if (toString.call(val) !== '[object Object]') { + return false; } - /** - * Throws a `CanceledError` if cancellation has been requested. - */ - throwIfRequested() { - if (this.reason) { - throw this.reason; - } - } + var prototype = Object.getPrototypeOf(val); + return prototype === null || prototype === Object.prototype; +} - /** - * Subscribe to the cancel signal - */ +/** + * Determine if a value is a Date + * + * @param {Object} val The value to test + * @returns {boolean} True if value is a Date, otherwise false + */ +function isDate(val) { + return toString.call(val) === '[object Date]'; +} - subscribe(listener) { - if (this.reason) { - listener(this.reason); - return; - } +/** + * Determine if a value is a File + * + * @param {Object} val The value to test + * @returns {boolean} True if value is a File, otherwise false + */ +function isFile(val) { + return toString.call(val) === '[object File]'; +} - if (this._listeners) { - this._listeners.push(listener); - } else { - this._listeners = [listener]; - } - } +/** + * Determine if a value is a Blob + * + * @param {Object} val The value to test + * @returns {boolean} True if value is a Blob, otherwise false + */ +function isBlob(val) { + return toString.call(val) === '[object Blob]'; +} - /** - * Unsubscribe from the cancel signal - */ +/** + * Determine if a value is a Function + * + * @param {Object} val The value to test + * @returns {boolean} True if value is a Function, otherwise false + */ +function isFunction(val) { + return toString.call(val) === '[object Function]'; +} - unsubscribe(listener) { - if (!this._listeners) { - return; - } - const index = this._listeners.indexOf(listener); - if (index !== -1) { - this._listeners.splice(index, 1); - } - } +/** + * Determine if a value is a Stream + * + * @param {Object} val The value to test + * @returns {boolean} True if value is a Stream, otherwise false + */ +function isStream(val) { + return isObject(val) && isFunction(val.pipe); +} - toAbortSignal() { - const controller = new AbortController(); +/** + * Determine if a value is a URLSearchParams object + * + * @param {Object} val The value to test + * @returns {boolean} True if value is a URLSearchParams object, otherwise false + */ +function isURLSearchParams(val) { + return typeof URLSearchParams !== 'undefined' && val instanceof URLSearchParams; +} - const abort = (err) => { - controller.abort(err); - }; +/** + * Trim excess whitespace off the beginning and end of a string + * + * @param {String} str The String to trim + * @returns {String} The String freed of excess whitespace + */ +function trim(str) { + return str.trim ? str.trim() : str.replace(/^\s+|\s+$/g, ''); +} - this.subscribe(abort); +/** + * Determine if we're running in a standard browser environment + * + * This allows axios to run in a web worker, and react-native. + * Both environments support XMLHttpRequest, but not fully standard globals. + * + * web workers: + * typeof window -> undefined + * typeof document -> undefined + * + * react-native: + * navigator.product -> 'ReactNative' + * nativescript + * navigator.product -> 'NativeScript' or 'NS' + */ +function isStandardBrowserEnv() { + if (typeof navigator !== 'undefined' && (navigator.product === 'ReactNative' || + navigator.product === 'NativeScript' || + navigator.product === 'NS')) { + return false; + } + return ( + typeof window !== 'undefined' && + typeof document !== 'undefined' + ); +} - controller.signal.unsubscribe = () => this.unsubscribe(abort); +/** + * Iterate over an Array or an Object invoking a function for each item. + * + * If `obj` is an Array callback will be called passing + * the value, index, and complete array for each item. + * + * If 'obj' is an Object callback will be called passing + * the value, key, and complete object for each property. + * + * @param {Object|Array} obj The object to iterate + * @param {Function} fn The callback to invoke for each item + */ +function forEach(obj, fn) { + // Don't bother if no value provided + if (obj === null || typeof obj === 'undefined') { + return; + } - return controller.signal; + // Force an array if not already something iterable + if (typeof obj !== 'object') { + /*eslint no-param-reassign:0*/ + obj = [obj]; } - /** - * Returns an object that contains a new `CancelToken` and a function that, when called, - * cancels the `CancelToken`. - */ - static source() { - let cancel; - const token = new CancelToken(function executor(c) { - cancel = c; - }); - return { - token, - cancel - }; + if (isArray(obj)) { + // Iterate over array values + for (var i = 0, l = obj.length; i < l; i++) { + fn.call(null, obj[i], i, obj); + } + } else { + // Iterate over object keys + for (var key in obj) { + if (Object.prototype.hasOwnProperty.call(obj, key)) { + fn.call(null, obj[key], key, obj); + } + } } } -var CancelToken$1 = CancelToken; - /** - * Syntactic sugar for invoking a function and expanding an array for arguments. - * - * Common use case would be to use `Function.prototype.apply`. - * - * ```js - * function f(x, y, z) {} - * const args = [1, 2, 3]; - * f.apply(null, args); - * ``` + * Accepts varargs expecting each argument to be an object, then + * immutably merges the properties of each object and returns result. * - * With `spread` this example can be re-written. + * When multiple objects contain the same key the later object in + * the arguments list will take precedence. * - * ```js - * spread(function(x, y, z) {})([1, 2, 3]); - * ``` + * Example: * - * @param {Function} callback + * ```js + * var result = merge({foo: 123}, {foo: 456}); + * console.log(result.foo); // outputs 456 + * ``` * - * @returns {Function} + * @param {Object} obj1 Object to merge + * @returns {Object} Result of all merge properties */ -function spread(callback) { - return function wrap(arr) { - return callback.apply(null, arr); - }; +function merge(/* obj1, obj2, obj3, ... */) { + var result = {}; + function assignValue(val, key) { + if (isPlainObject(result[key]) && isPlainObject(val)) { + result[key] = merge(result[key], val); + } else if (isPlainObject(val)) { + result[key] = merge({}, val); + } else if (isArray(val)) { + result[key] = val.slice(); + } else { + result[key] = val; + } + } + + for (var i = 0, l = arguments.length; i < l; i++) { + forEach(arguments[i], assignValue); + } + return result; } /** - * Determines whether the payload is an error thrown by Axios + * Extends object a by mutably adding to it the properties of object b. * - * @param {*} payload The value to test + * @param {Object} a The object to be extended + * @param {Object} b The object to copy properties from + * @param {Object} thisArg The object to bind function to + * @return {Object} The resulting value of object a + */ +function extend(a, b, thisArg) { + forEach(b, function assignValue(val, key) { + if (thisArg && typeof val === 'function') { + a[key] = bind(val, thisArg); + } else { + a[key] = val; + } + }); + return a; +} + +/** + * Remove byte order marker. This catches EF BB BF (the UTF-8 BOM) * - * @returns {boolean} True if the payload is an error thrown by Axios, otherwise false + * @param {string} content with BOM + * @return {string} content value without BOM */ -function isAxiosError(payload) { - return utils$1.isObject(payload) && (payload.isAxiosError === true); +function stripBOM(content) { + if (content.charCodeAt(0) === 0xFEFF) { + content = content.slice(1); + } + return content; } -const HttpStatusCode = { - Continue: 100, - SwitchingProtocols: 101, - Processing: 102, - EarlyHints: 103, - Ok: 200, - Created: 201, - Accepted: 202, - NonAuthoritativeInformation: 203, - NoContent: 204, - ResetContent: 205, - PartialContent: 206, - MultiStatus: 207, - AlreadyReported: 208, - ImUsed: 226, - MultipleChoices: 300, - MovedPermanently: 301, - Found: 302, - SeeOther: 303, - NotModified: 304, - UseProxy: 305, - Unused: 306, - TemporaryRedirect: 307, - PermanentRedirect: 308, - BadRequest: 400, - Unauthorized: 401, - PaymentRequired: 402, - Forbidden: 403, - NotFound: 404, - MethodNotAllowed: 405, - NotAcceptable: 406, - ProxyAuthenticationRequired: 407, - RequestTimeout: 408, - Conflict: 409, - Gone: 410, - LengthRequired: 411, - PreconditionFailed: 412, - PayloadTooLarge: 413, - UriTooLong: 414, - UnsupportedMediaType: 415, - RangeNotSatisfiable: 416, - ExpectationFailed: 417, - ImATeapot: 418, - MisdirectedRequest: 421, - UnprocessableEntity: 422, - Locked: 423, - FailedDependency: 424, - TooEarly: 425, - UpgradeRequired: 426, - PreconditionRequired: 428, - TooManyRequests: 429, - RequestHeaderFieldsTooLarge: 431, - UnavailableForLegalReasons: 451, - InternalServerError: 500, - NotImplemented: 501, - BadGateway: 502, - ServiceUnavailable: 503, - GatewayTimeout: 504, - HttpVersionNotSupported: 505, - VariantAlsoNegotiates: 506, - InsufficientStorage: 507, - LoopDetected: 508, - NotExtended: 510, - NetworkAuthenticationRequired: 511, - WebServerIsDown: 521, - ConnectionTimedOut: 522, - OriginIsUnreachable: 523, - TimeoutOccurred: 524, - SslHandshakeFailed: 525, - InvalidSslCertificate: 526, +module.exports = { + isArray: isArray, + isArrayBuffer: isArrayBuffer, + isBuffer: isBuffer, + isFormData: isFormData, + isArrayBufferView: isArrayBufferView, + isString: isString, + isNumber: isNumber, + isObject: isObject, + isPlainObject: isPlainObject, + isUndefined: isUndefined, + isDate: isDate, + isFile: isFile, + isBlob: isBlob, + isFunction: isFunction, + isStream: isStream, + isURLSearchParams: isURLSearchParams, + isStandardBrowserEnv: isStandardBrowserEnv, + forEach: forEach, + merge: merge, + extend: extend, + trim: trim, + stripBOM: stripBOM }; -Object.entries(HttpStatusCode).forEach(([key, value]) => { - HttpStatusCode[value] = key; + +/***/ }), + +/***/ "./assets/src/js/admin/components/delete-directory-modal.js": +/*!******************************************************************!*\ + !*** ./assets/src/js/admin/components/delete-directory-modal.js ***! + \******************************************************************/ +/***/ (function() { + +window.addEventListener('load', function () { + var $ = jQuery; + + // Open Delete Modal + $('.atbdp-directory-delete-link-action').on('click', function (e) { + e.preventDefault(); + var delete_link = $(this).data('delete-link'); + $('.atbdp-directory-delete-link').prop('href', delete_link); + }); + + // Delete Action + $('.atbdp-directory-delete-link').on('click', function (e) { + // e.preventDefault(); + $(this).prepend(' '); + $('.atbdp-directory-delete-cancel-link').removeClass('cptm-modal-toggle'); + $('.atbdp-directory-delete-cancel-link').addClass('atbdp-disabled'); + }); }); -var HttpStatusCode$1 = HttpStatusCode; +/***/ }), -/** - * Create an instance of Axios - * - * @param {Object} defaultConfig The default config for the instance - * - * @returns {Axios} A new instance of Axios - */ -function createInstance(defaultConfig) { - const context = new Axios$1(defaultConfig); - const instance = bind(Axios$1.prototype.request, context); +/***/ "./assets/src/js/admin/components/directory-migration-modal.js": +/*!*********************************************************************!*\ + !*** ./assets/src/js/admin/components/directory-migration-modal.js ***! + \*********************************************************************/ +/***/ (function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) { - // Copy axios.prototype to instance - utils$1.extend(instance, Axios$1.prototype, context, {allOwnKeys: true}); +window.addEventListener('load', function () { + var $ = jQuery; + var axios = (__webpack_require__(/*! axios */ "./node_modules/axios/index.js")["default"]); - // Copy context to instance - utils$1.extend(instance, context, null, {allOwnKeys: true}); + // Migration Link + $('.atbdp-directory-migration-link').on('click', function (e) { + e.preventDefault(); + var self = this; + $('.cptm-directory-migration-form').find('.cptm-comfirmation-text').html('Please wait...'); + $('.atbdp-directory-migration-cencel-link').remove(); + $(this).html(' Migrating'); + $(this).addClass('atbdp-disabled'); + var form_data = new FormData(); + form_data.append('action', 'directorist_force_migrate'); - // Factory for creating new instances - instance.create = function create(instanceConfig) { - return createInstance(mergeConfig(defaultConfig, instanceConfig)); - }; + // Response Success Callback + var responseSuccessCallback = function responseSuccessCallback(response) { + var _response$data; + // console.log( { response } ); - return instance; -} + if (response !== null && response !== void 0 && (_response$data = response.data) !== null && _response$data !== void 0 && _response$data.success) { + var _response$data$messag, _response$data2; + var msg = (_response$data$messag = response === null || response === void 0 || (_response$data2 = response.data) === null || _response$data2 === void 0 ? void 0 : _response$data2.message) !== null && _response$data$messag !== void 0 ? _response$data$messag : 'Migration Successful'; + var alert_content = "\n
\n
\n \n
\n\n
".concat(msg, "
\n
\n "); + $('.cptm-directory-migration-form').find('.cptm-comfirmation-text').html(alert_content); + $(self).remove(); + location.reload(); + return; + } + responseFaildCallback(response); + }; -// Create the default instance to be exported -const axios = createInstance(defaults$1); + // Response Error Callback + var responseFaildCallback = function responseFaildCallback(response) { + var _response$data$messag2, _response$data3; + // console.log( { response } ); -// Expose Axios class to allow class inheritance -axios.Axios = Axios$1; + var msg = (_response$data$messag2 = response === null || response === void 0 || (_response$data3 = response.data) === null || _response$data3 === void 0 ? void 0 : _response$data3.message) !== null && _response$data$messag2 !== void 0 ? _response$data$messag2 : 'Something went wrong please try again'; + var alert_content = "\n
\n
\n \n
\n\n
".concat(msg, "
\n
\n "); + $('.cptm-directory-migration-form').find('.cptm-comfirmation-text').html(alert_content); + $(self).remove(); + }; -// Expose Cancel & CancelToken -axios.CanceledError = CanceledError$1; -axios.CancelToken = CancelToken$1; -axios.isCancel = isCancel; -axios.VERSION = VERSION; -axios.toFormData = toFormData; + // Send Request + axios.post(directorist_admin.ajax_url, form_data).then(function (response) { + responseSuccessCallback(response); + }).catch(function (response) { + responseFaildCallback(response); + }); + }); +}); -// Expose AxiosError class -axios.AxiosError = AxiosError$1; +/***/ }), -// alias for CanceledError for backward compatibility -axios.Cancel = axios.CanceledError; +/***/ "./assets/src/js/admin/components/import-directory-modal.js": +/*!******************************************************************!*\ + !*** ./assets/src/js/admin/components/import-directory-modal.js ***! + \******************************************************************/ +/***/ (function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) { -// Expose all/spread -axios.all = function all(promises) { - return Promise.all(promises); -}; +function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; } +function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } } +function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; } +window.addEventListener('load', function () { + var axios = (__webpack_require__(/*! axios */ "./node_modules/axios/index.js")["default"]); + var $ = jQuery; -axios.spread = spread; + // cptm-import-directory-form + var term_id = 0; + $('.cptm-import-directory-form').on('submit', function (e) { + e.preventDefault(); + var form_feedback = $(this).find('.cptm-form-group-feedback'); + var modal_content = $('.cptm-import-directory-modal').find('.cptm-modal-content'); + var modal_alert = $('.cptm-import-directory-modal-alert'); + var form_data = new FormData(); + form_data.append('action', 'save_imported_post_type_data'); + form_data.append('directorist_nonce', directorist_admin.directorist_nonce); + if (Number.isInteger(term_id) && term_id > 0) { + form_data.append('term_id', term_id); + } + var form_fields = $(this).find('.cptm-form-field'); + var general_fields = ['text', 'number']; + $(this).find('button[type=submit] .cptm-loading-icon').removeClass('cptm-d-none'); + var _iterator = _createForOfIteratorHelper(form_fields), + _step; + try { + for (_iterator.s(); !(_step = _iterator.n()).done;) { + var field = _step.value; + if (!field.name.length) { + continue; + } -// Expose isAxiosError -axios.isAxiosError = isAxiosError; + // General fields + if (general_fields.includes(field.type)) { + form_data.append(field.name, $(field).val()); + } -// Expose mergeConfig -axios.mergeConfig = mergeConfig; + // Media fields + if ('file' === field.type) { + form_data.append(field.name, field.files[0]); + } + } + } catch (err) { + _iterator.e(err); + } finally { + _iterator.f(); + } + var self = this; + form_feedback.html(''); + axios.post(directorist_admin.ajax_url, form_data).then(function (response) { + // console.log( { response } ); + $(self).find('button[type=submit] .cptm-loading-icon').addClass('cptm-d-none'); -axios.AxiosHeaders = AxiosHeaders$1; + // Store term ID if exist + if (response.data.term_id && Number.isInteger(response.data.term_id) && response.data.term_id > 0) { + term_id = response.data.term_id; + // console.log( 'Term ID has been updated' ); + } -axios.formToJSON = thing => formDataToJSON(utils$1.isHTMLForm(thing) ? new FormData(thing) : thing); + // Show status log + if (response.data && response.data.status.status_log) { + var status_log = response.data.status.status_log; + for (var status in status_log) { + var alert = '
' + status_log[status].message + '
'; + form_feedback.append(alert); + } + } -axios.getAdapter = adapters.getAdapter; + // Reload the page if success + if (response.data && response.data.status && response.data.status.success) { + // console.log( 'reloading...' ); -axios.HttpStatusCode = HttpStatusCode$1; + modal_content.addClass('cptm-d-none'); + modal_alert.removeClass('cptm-d-none'); + $(self).trigger('reset'); + location.reload(); + } + }).catch(function (error) { + console.log({ + error: error + }); + $(self).find('button[type=submit] .cptm-loading-icon').addClass('cptm-d-none'); + }); + }); +}); -axios.default = axios; +/***/ }), -module.exports = axios; -//# sourceMappingURL=axios.cjs.map +/***/ "./node_modules/axios/package.json": +/*!*****************************************!*\ + !*** ./node_modules/axios/package.json ***! + \*****************************************/ +/***/ (function(module) { +"use strict"; +module.exports = /*#__PURE__*/JSON.parse('{"name":"axios","version":"0.21.4","description":"Promise based HTTP client for the browser and node.js","main":"index.js","scripts":{"test":"grunt test","start":"node ./sandbox/server.js","build":"NODE_ENV=production grunt build","preversion":"npm test","version":"npm run build && grunt version && git add -A dist && git add CHANGELOG.md bower.json package.json","postversion":"git push && git push --tags","examples":"node ./examples/server.js","coveralls":"cat coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js","fix":"eslint --fix lib/**/*.js"},"repository":{"type":"git","url":"https://github.com/axios/axios.git"},"keywords":["xhr","http","ajax","promise","node"],"author":"Matt Zabriskie","license":"MIT","bugs":{"url":"https://github.com/axios/axios/issues"},"homepage":"https://axios-http.com","devDependencies":{"coveralls":"^3.0.0","es6-promise":"^4.2.4","grunt":"^1.3.0","grunt-banner":"^0.6.0","grunt-cli":"^1.2.0","grunt-contrib-clean":"^1.1.0","grunt-contrib-watch":"^1.0.0","grunt-eslint":"^23.0.0","grunt-karma":"^4.0.0","grunt-mocha-test":"^0.13.3","grunt-ts":"^6.0.0-beta.19","grunt-webpack":"^4.0.2","istanbul-instrumenter-loader":"^1.0.0","jasmine-core":"^2.4.1","karma":"^6.3.2","karma-chrome-launcher":"^3.1.0","karma-firefox-launcher":"^2.1.0","karma-jasmine":"^1.1.1","karma-jasmine-ajax":"^0.1.13","karma-safari-launcher":"^1.0.0","karma-sauce-launcher":"^4.3.6","karma-sinon":"^1.0.5","karma-sourcemap-loader":"^0.3.8","karma-webpack":"^4.0.2","load-grunt-tasks":"^3.5.2","minimist":"^1.2.0","mocha":"^8.2.1","sinon":"^4.5.0","terser-webpack-plugin":"^4.2.3","typescript":"^4.0.5","url-search-params":"^0.10.0","webpack":"^4.44.2","webpack-dev-server":"^3.11.0"},"browser":{"./lib/adapters/http.js":"./lib/adapters/xhr.js"},"jsdelivr":"dist/axios.min.js","unpkg":"dist/axios.min.js","typings":"./index.d.ts","dependencies":{"follow-redirects":"^1.14.0"},"bundlesize":[{"path":"./dist/axios.min.js","threshold":"5kB"}]}'); /***/ }) @@ -4229,18 +2302,6 @@ module.exports = axios; /******/ }; /******/ }(); /******/ -/******/ /* webpack/runtime/global */ -/******/ !function() { -/******/ __webpack_require__.g = (function() { -/******/ if (typeof globalThis === 'object') return globalThis; -/******/ try { -/******/ return this || new Function('return this')(); -/******/ } catch (e) { -/******/ if (typeof window === 'object') return window; -/******/ } -/******/ })(); -/******/ }(); -/******/ /******/ /* webpack/runtime/hasOwnProperty shorthand */ /******/ !function() { /******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); } @@ -4277,7 +2338,7 @@ __webpack_require__.r(__webpack_exports__); var $ = jQuery; -var axios = (__webpack_require__(/*! axios */ "./node_modules/axios/dist/browser/axios.cjs")["default"]); +var axios = (__webpack_require__(/*! axios */ "./node_modules/axios/index.js")["default"]); window.addEventListener('load', function () { // Migration Link $('.directorist_directory_template_library').on('click', function (e) { From 38e2ae8bd7500347567f79ac0dcc87def4ba5c7b Mon Sep 17 00:00:00 2001 From: Syed Galib Ahmed Date: Mon, 16 Feb 2026 19:57:56 +0600 Subject: [PATCH 2/4] refactor: code optimized --- app/Http/Controllers/CheckoutController.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/Http/Controllers/CheckoutController.php b/app/Http/Controllers/CheckoutController.php index ecd00f323..78771a342 100644 --- a/app/Http/Controllers/CheckoutController.php +++ b/app/Http/Controllers/CheckoutController.php @@ -80,7 +80,8 @@ public function checkout( Validator $validator, WP_REST_Request $request ): arra } // Update the order status to paid - $repository->update( ( new DTO )->set_id( $dto->get_id() )->set_status( Status::PAID ) ); + $dto->set_id( $dto->get_id() )->set_status( Status::PAID ); + $repository->update( $dto ); do_action( 'directorist_before_redirect_checkout', $dto, $checkout_type, $request ); From 898331f260c04787ac72c6bcf1c7fd06f1ea58f5 Mon Sep 17 00:00:00 2001 From: Syed Galib Ahmed Date: Mon, 23 Feb 2026 11:30:05 +0600 Subject: [PATCH 3/4] feat: added hooks for extendability --- includes/helper-functions.php | 35 +++++++++++++++++++++++++++ includes/model/ListingForm.php | 15 +++++++++++- includes/model/Listings.php | 16 ++++++------- includes/model/SingleListing.php | 41 ++++++++++++++++++-------------- 4 files changed, 80 insertions(+), 27 deletions(-) diff --git a/includes/helper-functions.php b/includes/helper-functions.php index 0d4ef32b2..ec71f94bc 100644 --- a/includes/helper-functions.php +++ b/includes/helper-functions.php @@ -4774,3 +4774,38 @@ function directorist_renewal_token_hash( $listing_id, $user_id ) { $token_str = 'cB0XtpVzGb180dgPi3hADW-' . $listing_id . '::' . $user_id; return wp_hash( $token_str, 'nonce' ); } + +function directorist_submission_form_fields_raw( int $directory_type_id ): array { + return get_term_meta( $directory_type_id, 'submission_form_fields', true ); +} + +function directorist_submission_form_fields( int $directory_type_id, array $data = [] ): array { + $data['directory_type_id'] = $directory_type_id; + return apply_filters( 'directorist_submission_form_fields', directorist_submission_form_fields_raw( $directory_type_id ), $data ); +} + +function directorist_single_listing_header( int $directory_type_id, array $data = [] ): array { + $data['directory_type_id'] = $directory_type_id; + return apply_filters( 'directorist_single_listing_header', get_term_meta( $directory_type_id, 'single_listing_header', true ), $data ); +} + +function directorist_single_listings_contents( int $directory_type_id, array $data = [] ): array { + $data['directory_type_id'] = $directory_type_id; + return apply_filters( 'directorist_single_listings_contents', get_term_meta( $directory_type_id, 'single_listings_contents', true ), $data ); +} + +function directorist_listing_archive_fields( int $directory_type_id, array $data = [] ): array { + $card_fields = get_term_meta( $directory_type_id, 'listings_card_grid_view', true ); + $list_fields = get_term_meta( $directory_type_id, 'listings_card_list_view', true ); + + $data['directory_type_id'] = $directory_type_id; + + return apply_filters( + 'directorist_listing_archive_fields', + [ + 'card_fields' => ! empty( $card_fields ) && is_array( $card_fields ) ? $card_fields : [], + 'list_fields' => ! empty( $list_fields ) && is_array( $list_fields ) ? $list_fields : [], + ], + $data + ); +} diff --git a/includes/model/ListingForm.php b/includes/model/ListingForm.php index af0b712b8..6a40ff3fd 100644 --- a/includes/model/ListingForm.php +++ b/includes/model/ListingForm.php @@ -778,6 +778,13 @@ protected function set_directory() { return $this->current_listing_type; } + protected function get_listing_owner_id(): int { + if ( $this->add_listing_id ) { + return (int) get_post_field( 'post_author', $this->add_listing_id ); + } + return get_current_user_id(); + } + public function build_form_data( $type ) { $form_data = []; @@ -785,7 +792,13 @@ public function build_form_data( $type ) { return $form_data; } - $submission_form_fields = get_term_meta( $type, 'submission_form_fields', true ); + $submission_form_fields = directorist_submission_form_fields( + (int) $type, + [ + 'listing_id' => $this->add_listing_id, + 'listing_owner_id' => $this->get_listing_owner_id(), + ] + ); if ( ! empty( $submission_form_fields['groups'] ) ) { foreach ( $submission_form_fields['groups'] as $group ) { diff --git a/includes/model/Listings.php b/includes/model/Listings.php index 4bfd87a4b..7d25bba8e 100644 --- a/includes/model/Listings.php +++ b/includes/model/Listings.php @@ -507,16 +507,12 @@ public function set_loop_data() { $u_pro_pic = ! empty( $u_pro_pic ) ? wp_get_attachment_image_src( $u_pro_pic, 'thumbnail' ) : ''; $bdbh = get_post_meta( $id, '_bdbh', true ); - $listing_type = $this->current_listing_type; - $card_fields = get_term_meta( $listing_type, 'listings_card_grid_view', true ); - $list_fields = get_term_meta( $listing_type, 'listings_card_list_view', true ); $get_directory_type = get_term_by( 'id', $this->current_listing_type, ATBDP_TYPE ); $directory_type = ! empty( $get_directory_type ) ? $get_directory_type->slug : ''; + $this->loop = [ 'id' => $id, - 'card_fields' => $card_fields, - 'list_fields' => $list_fields, 'permalink' => get_permalink( $id ), 'title' => get_the_title(), 'cats' => get_the_terms( $id, ATBDP_CATEGORY ), @@ -541,6 +537,10 @@ public function set_loop_data() { 'avatar_img' => get_avatar( $author_id, apply_filters( 'atbdp_avatar_size', 32 ), '', $author_display_name ), 'review' => $this->get_review_data(), ]; + + $archive_fields = directorist_listing_archive_fields( $listing_type, [ 'author_id' => $author_id, ] ); + + $this->loop = array_merge( $this->loop, $archive_fields ); } public function get_review_data() { @@ -1811,12 +1811,12 @@ function loop_get_the_thumbnail( $class = '' ) { $listing_prv_img = directorist_get_listing_preview_image( $id ); $listing_img = directorist_get_listing_gallery_images( $id ); - - $thumbnail_img_id = array_filter( array_merge( (array) $listing_prv_img, (array) $listing_img ) ); $link_start = '
'; $link_end = '
'; + $thumbnail_img_id = apply_filters( 'directorist_listing_archive_thumbnails', $thumbnail_img_id, $id ); + if ( empty( $thumbnail_img_id ) ) { $thumbnail_img_id = $default_image_src; $image_alt = esc_html( get_the_title( $id ) ); @@ -1832,7 +1832,7 @@ function loop_get_the_thumbnail( $class = '' ) { return is_numeric( $value ); } ); - + $image_count = count( $thumbnail_img_id ); if ( 1 === (int) $image_count ) { diff --git a/includes/model/SingleListing.php b/includes/model/SingleListing.php index da8a0a5bf..5605f0329 100644 --- a/includes/model/SingleListing.php +++ b/includes/model/SingleListing.php @@ -39,9 +39,9 @@ class Directorist_Single_Listing { private function __construct( $listing_id = 0 ) { if ( $listing_id && is_int( $listing_id ) ) { - $this->id = $listing_id; + $this->id = (int) $listing_id; } else { - $this->id = get_the_ID(); + $this->id = (int) get_the_ID(); } $this->prepare_data(); @@ -64,10 +64,10 @@ public function get_directory_type_id() { } public function prepare_data() { - $this->author_id = get_post_field( 'post_author', $this->id ); + $this->author_id = (int) get_post_field( 'post_author', $this->id ); $this->post = get_post( $this->id ); - $this->type = $this->get_directory_type_id(); - $this->header_data = get_term_meta( $this->type, 'single_listing_header', true ); + $this->type = (int) $this->get_directory_type_id(); + $this->header_data = directorist_single_listing_header( $this->type, [ 'listing_id' => $this->id, 'listing_owner_id' => $this->author_id, 'directory_type_id' => $this->type ] ); $this->content_data = $this->build_content_data(); $this->fm_plan = get_post_meta( $this->id, '_fm_plans', true ); $this->price_range = get_post_meta( $this->id, '_price_range', true ); @@ -77,8 +77,14 @@ public function prepare_data() { public function build_content_data() { $content_data = []; - $single_fields = get_term_meta( $this->type, 'single_listings_contents', true ); - $submission_form_fields = get_term_meta( $this->type, 'submission_form_fields', true ); + $single_fields = directorist_single_listings_contents( + $this->type, + [ + 'listing_id' => (int) $this->id, + 'listing_owner_id' => (int) $this->author_id, + ] + ); + $submission_form_fields = directorist_submission_form_fields_raw( $this->type ); if ( ! empty( $single_fields['fields'] ) ) { foreach ( $single_fields['fields'] as $key => $value ) { @@ -616,6 +622,8 @@ public function get_slider_data( $data = null ) { array_unshift( $data['images'], $preview_img ); } + $data['images'] = apply_filters( 'directorist_single_listing_thumbnails', $data['images'], $listing_id ); + if ( count( $data['images'] ) < 1 ) { $data['images'][] = [ 'alt' => $listing_title, @@ -629,7 +637,6 @@ public function get_slider_data( $data = null ) { } public function slider_template() { - $slider = $this->listing_header( 'slider', 'slider-placeholder' ); if ( ! $slider ) { @@ -640,7 +647,6 @@ public function slider_template() { } public function slider_field_template( $slider = null ) { - $args = [ 'listing' => $this, 'has_slider' => true, @@ -1037,23 +1043,22 @@ public function listing_header( $key = '', $group = '', $subgroup = '' ) { } public function header_template() { - + $display_title = $this->listing_header( 'title', 'listing-title-placeholder' ); $args = [ - 'listing' => $this, - 'use_listing_title' => true, - 'section_title' => '', - 'section_icon' => '', - 'display_title' => $display_title, - 'display_tagline' => ! empty( $display_title['enable_tagline'] ) ? $display_title['enable_tagline'] : false, - 'display_content' => false, + 'listing' => $this, + 'use_listing_title' => true, + 'section_title' => '', + 'section_icon' => '', + 'display_title' => $display_title, + 'display_tagline' => ! empty( $display_title['enable_tagline'] ) ? $display_title['enable_tagline'] : false, + 'display_content' => false, ]; return Helper::get_template( 'single/header', $args ); } public function render_shortcode_single_listing() { - if ( ! is_singular( ATBDP_POST_TYPE ) ) { return; } From 79e7dff2fd6d151415bf6df55f022544e36a3298 Mon Sep 17 00:00:00 2001 From: Syed Galib Ahmed Date: Mon, 23 Feb 2026 13:13:09 +0600 Subject: [PATCH 4/4] feat: added hooks for extendability --- includes/model/ListingForm.php | 2 +- .../listing-form/fields/image_upload.php | 19 ++++++++++++------- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/includes/model/ListingForm.php b/includes/model/ListingForm.php index 6a40ff3fd..ad583a8ce 100644 --- a/includes/model/ListingForm.php +++ b/includes/model/ListingForm.php @@ -778,7 +778,7 @@ protected function set_directory() { return $this->current_listing_type; } - protected function get_listing_owner_id(): int { + public function get_listing_owner_id(): int { if ( $this->add_listing_id ) { return (int) get_post_field( 'post_author', $this->add_listing_id ); } diff --git a/templates/listing-form/fields/image_upload.php b/templates/listing-form/fields/image_upload.php index b5c287725..247412f2b 100644 --- a/templates/listing-form/fields/image_upload.php +++ b/templates/listing-form/fields/image_upload.php @@ -22,13 +22,18 @@ $accepted_mime_types_upper = array_map( 'strtoupper', $accepted_mime_types ); $accepted_mime_types = array_merge( $accepted_mime_types, $accepted_mime_types_upper ); -$img_upload_data = [ - 'type' => join( ', ', $accepted_mime_types ), - 'max_num_of_img' => $limit, - 'max_total_img_size' => $max_total_file_size_kb, - 'is_required' => $required, - 'max_size_per_img' => $max_file_size_kb, -]; +$img_upload_data = apply_filters( + 'directorist_image_upload_config', + [ + 'type' => join( ', ', $accepted_mime_types ), + 'max_num_of_img' => $limit, + 'max_total_img_size' => $max_total_file_size_kb, + 'is_required' => $required, + 'max_size_per_img' => $max_file_size_kb, + ], + $listing_form, + $data +); $img_upload_data = json_encode( $img_upload_data ); ?>