CoolFace
Datasetpublic

basant307/AI_Governance_Project

sourceHugging Faceapache-2.0updated 2mo agoView on Hugging Face
0likes48downloads
axios.cjs5644 linesDownload Raw Back to node
1/*! Axios v1.13.6 Copyright (c) 2026 Matt Zabriskie and contributors */2'use strict';3 4const FormData$1 = require('form-data');5const crypto = require('crypto');6const url = require('url');7const proxyFromEnv = require('proxy-from-env');8const http = require('http');9const https = require('https');10const http2 = require('http2');11const util = require('util');12const followRedirects = require('follow-redirects');13const zlib = require('zlib');14const stream = require('stream');15const events = require('events');16 17function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }18 19const FormData__default = /*#__PURE__*/_interopDefaultLegacy(FormData$1);20const crypto__default = /*#__PURE__*/_interopDefaultLegacy(crypto);21const url__default = /*#__PURE__*/_interopDefaultLegacy(url);22const proxyFromEnv__default = /*#__PURE__*/_interopDefaultLegacy(proxyFromEnv);23const http__default = /*#__PURE__*/_interopDefaultLegacy(http);24const https__default = /*#__PURE__*/_interopDefaultLegacy(https);25const http2__default = /*#__PURE__*/_interopDefaultLegacy(http2);26const util__default = /*#__PURE__*/_interopDefaultLegacy(util);27const followRedirects__default = /*#__PURE__*/_interopDefaultLegacy(followRedirects);28const zlib__default = /*#__PURE__*/_interopDefaultLegacy(zlib);29const stream__default = /*#__PURE__*/_interopDefaultLegacy(stream);30 31/**32 * Create a bound version of a function with a specified `this` context33 *34 * @param {Function} fn - The function to bind35 * @param {*} thisArg - The value to be passed as the `this` parameter36 * @returns {Function} A new function that will call the original function with the specified `this` context37 */38function bind(fn, thisArg) {39  return function wrap() {40    return fn.apply(thisArg, arguments);41  };42}43 44// utils is a library of generic helper functions non-specific to axios45 46const { toString } = Object.prototype;47const { getPrototypeOf } = Object;48const { iterator, toStringTag } = Symbol;49 50const kindOf = ((cache) => (thing) => {51  const str = toString.call(thing);52  return cache[str] || (cache[str] = str.slice(8, -1).toLowerCase());53})(Object.create(null));54 55const kindOfTest = (type) => {56  type = type.toLowerCase();57  return (thing) => kindOf(thing) === type;58};59 60const typeOfTest = (type) => (thing) => typeof thing === type;61 62/**63 * Determine if a value is a non-null object64 *65 * @param {Object} val The value to test66 *67 * @returns {boolean} True if value is an Array, otherwise false68 */69const { isArray } = Array;70 71/**72 * Determine if a value is undefined73 *74 * @param {*} val The value to test75 *76 * @returns {boolean} True if the value is undefined, otherwise false77 */78const isUndefined = typeOfTest('undefined');79 80/**81 * Determine if a value is a Buffer82 *83 * @param {*} val The value to test84 *85 * @returns {boolean} True if value is a Buffer, otherwise false86 */87function isBuffer(val) {88  return (89    val !== null &&90    !isUndefined(val) &&91    val.constructor !== null &&92    !isUndefined(val.constructor) &&93    isFunction$1(val.constructor.isBuffer) &&94    val.constructor.isBuffer(val)95  );96}97 98/**99 * Determine if a value is an ArrayBuffer100 *101 * @param {*} val The value to test102 *103 * @returns {boolean} True if value is an ArrayBuffer, otherwise false104 */105const isArrayBuffer = kindOfTest('ArrayBuffer');106 107/**108 * Determine if a value is a view on an ArrayBuffer109 *110 * @param {*} val The value to test111 *112 * @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false113 */114function isArrayBufferView(val) {115  let result;116  if (typeof ArrayBuffer !== 'undefined' && ArrayBuffer.isView) {117    result = ArrayBuffer.isView(val);118  } else {119    result = val && val.buffer && isArrayBuffer(val.buffer);120  }121  return result;122}123 124/**125 * Determine if a value is a String126 *127 * @param {*} val The value to test128 *129 * @returns {boolean} True if value is a String, otherwise false130 */131const isString = typeOfTest('string');132 133/**134 * Determine if a value is a Function135 *136 * @param {*} val The value to test137 * @returns {boolean} True if value is a Function, otherwise false138 */139const isFunction$1 = typeOfTest('function');140 141/**142 * Determine if a value is a Number143 *144 * @param {*} val The value to test145 *146 * @returns {boolean} True if value is a Number, otherwise false147 */148const isNumber = typeOfTest('number');149 150/**151 * Determine if a value is an Object152 *153 * @param {*} thing The value to test154 *155 * @returns {boolean} True if value is an Object, otherwise false156 */157const isObject = (thing) => thing !== null && typeof thing === 'object';158 159/**160 * Determine if a value is a Boolean161 *162 * @param {*} thing The value to test163 * @returns {boolean} True if value is a Boolean, otherwise false164 */165const isBoolean = (thing) => thing === true || thing === false;166 167/**168 * Determine if a value is a plain Object169 *170 * @param {*} val The value to test171 *172 * @returns {boolean} True if value is a plain Object, otherwise false173 */174const isPlainObject = (val) => {175  if (kindOf(val) !== 'object') {176    return false;177  }178 179  const prototype = getPrototypeOf(val);180  return (181    (prototype === null ||182      prototype === Object.prototype ||183      Object.getPrototypeOf(prototype) === null) &&184    !(toStringTag in val) &&185    !(iterator in val)186  );187};188 189/**190 * Determine if a value is an empty object (safely handles Buffers)191 *192 * @param {*} val The value to test193 *194 * @returns {boolean} True if value is an empty object, otherwise false195 */196const isEmptyObject = (val) => {197  // Early return for non-objects or Buffers to prevent RangeError198  if (!isObject(val) || isBuffer(val)) {199    return false;200  }201 202  try {203    return Object.keys(val).length === 0 && Object.getPrototypeOf(val) === Object.prototype;204  } catch (e) {205    // Fallback for any other objects that might cause RangeError with Object.keys()206    return false;207  }208};209 210/**211 * Determine if a value is a Date212 *213 * @param {*} val The value to test214 *215 * @returns {boolean} True if value is a Date, otherwise false216 */217const isDate = kindOfTest('Date');218 219/**220 * Determine if a value is a File221 *222 * @param {*} val The value to test223 *224 * @returns {boolean} True if value is a File, otherwise false225 */226const isFile = kindOfTest('File');227 228/**229 * Determine if a value is a React Native Blob230 * React Native "blob": an object with a `uri` attribute. Optionally, it can231 * also have a `name` and `type` attribute to specify filename and content type232 *233 * @see https://github.com/facebook/react-native/blob/26684cf3adf4094eb6c405d345a75bf8c7c0bf88/Libraries/Network/FormData.js#L68-L71234 * 235 * @param {*} value The value to test236 * 237 * @returns {boolean} True if value is a React Native Blob, otherwise false238 */239const isReactNativeBlob = (value) => {240  return !!(value && typeof value.uri !== 'undefined');241};242 243/**244 * Determine if environment is React Native245 * ReactNative `FormData` has a non-standard `getParts()` method246 * 247 * @param {*} formData The formData to test248 * 249 * @returns {boolean} True if environment is React Native, otherwise false250 */251const isReactNative = (formData) => formData && typeof formData.getParts !== 'undefined';252 253/**254 * Determine if a value is a Blob255 *256 * @param {*} val The value to test257 *258 * @returns {boolean} True if value is a Blob, otherwise false259 */260const isBlob = kindOfTest('Blob');261 262/**263 * Determine if a value is a FileList264 *265 * @param {*} val The value to test266 *267 * @returns {boolean} True if value is a File, otherwise false268 */269const isFileList = kindOfTest('FileList');270 271/**272 * Determine if a value is a Stream273 *274 * @param {*} val The value to test275 *276 * @returns {boolean} True if value is a Stream, otherwise false277 */278const isStream = (val) => isObject(val) && isFunction$1(val.pipe);279 280/**281 * Determine if a value is a FormData282 *283 * @param {*} thing The value to test284 *285 * @returns {boolean} True if value is an FormData, otherwise false286 */287function getGlobal() {288  if (typeof globalThis !== 'undefined') return globalThis;289  if (typeof self !== 'undefined') return self;290  if (typeof window !== 'undefined') return window;291  if (typeof global !== 'undefined') return global;292  return {};293}294 295const G = getGlobal();296const FormDataCtor = typeof G.FormData !== 'undefined' ? G.FormData : undefined;297 298const isFormData = (thing) => {299  let kind;300  return thing && (301    (FormDataCtor && thing instanceof FormDataCtor) || (302      isFunction$1(thing.append) && (303        (kind = kindOf(thing)) === 'formdata' ||304        // detect form-data instance305        (kind === 'object' && isFunction$1(thing.toString) && thing.toString() === '[object FormData]')306      )307    )308  );309};310 311/**312 * Determine if a value is a URLSearchParams object313 *314 * @param {*} val The value to test315 *316 * @returns {boolean} True if value is a URLSearchParams object, otherwise false317 */318const isURLSearchParams = kindOfTest('URLSearchParams');319 320const [isReadableStream, isRequest, isResponse, isHeaders] = [321  'ReadableStream',322  'Request',323  'Response',324  'Headers',325].map(kindOfTest);326 327/**328 * Trim excess whitespace off the beginning and end of a string329 *330 * @param {String} str The String to trim331 *332 * @returns {String} The String freed of excess whitespace333 */334const trim = (str) => {335  return str.trim ? str.trim() : str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, '');336};337/**338 * Iterate over an Array or an Object invoking a function for each item.339 *340 * If `obj` is an Array callback will be called passing341 * the value, index, and complete array for each item.342 *343 * If 'obj' is an Object callback will be called passing344 * the value, key, and complete object for each property.345 *346 * @param {Object|Array<unknown>} obj The object to iterate347 * @param {Function} fn The callback to invoke for each item348 *349 * @param {Object} [options]350 * @param {Boolean} [options.allOwnKeys = false]351 * @returns {any}352 */353function forEach(obj, fn, { allOwnKeys = false } = {}) {354  // Don't bother if no value provided355  if (obj === null || typeof obj === 'undefined') {356    return;357  }358 359  let i;360  let l;361 362  // Force an array if not already something iterable363  if (typeof obj !== 'object') {364    /*eslint no-param-reassign:0*/365    obj = [obj];366  }367 368  if (isArray(obj)) {369    // Iterate over array values370    for (i = 0, l = obj.length; i < l; i++) {371      fn.call(null, obj[i], i, obj);372    }373  } else {374    // Buffer check375    if (isBuffer(obj)) {376      return;377    }378 379    // Iterate over object keys380    const keys = allOwnKeys ? Object.getOwnPropertyNames(obj) : Object.keys(obj);381    const len = keys.length;382    let key;383 384    for (i = 0; i < len; i++) {385      key = keys[i];386      fn.call(null, obj[key], key, obj);387    }388  }389}390 391/**392 * Finds a key in an object, case-insensitive, returning the actual key name.393 * Returns null if the object is a Buffer or if no match is found.394 *395 * @param {Object} obj - The object to search.396 * @param {string} key - The key to find (case-insensitive).397 * @returns {?string} The actual key name if found, otherwise null.398 */399function findKey(obj, key) {400  if (isBuffer(obj)) {401    return null;402  }403 404  key = key.toLowerCase();405  const keys = Object.keys(obj);406  let i = keys.length;407  let _key;408  while (i-- > 0) {409    _key = keys[i];410    if (key === _key.toLowerCase()) {411      return _key;412    }413  }414  return null;415}416 417const _global = (() => {418  /*eslint no-undef:0*/419  if (typeof globalThis !== 'undefined') return globalThis;420  return typeof self !== 'undefined' ? self : typeof window !== 'undefined' ? window : global;421})();422 423const isContextDefined = (context) => !isUndefined(context) && context !== _global;424 425/**426 * Accepts varargs expecting each argument to be an object, then427 * immutably merges the properties of each object and returns result.428 *429 * When multiple objects contain the same key the later object in430 * the arguments list will take precedence.431 *432 * Example:433 *434 * ```js435 * const result = merge({foo: 123}, {foo: 456});436 * console.log(result.foo); // outputs 456437 * ```438 *439 * @param {Object} obj1 Object to merge440 *441 * @returns {Object} Result of all merge properties442 */443function merge(/* obj1, obj2, obj3, ... */) {444  const { caseless, skipUndefined } = (isContextDefined(this) && this) || {};445  const result = {};446  const assignValue = (val, key) => {447    // Skip dangerous property names to prevent prototype pollution448    if (key === '__proto__' || key === 'constructor' || key === 'prototype') {449      return;450    }451 452    const targetKey = (caseless && findKey(result, key)) || key;453    if (isPlainObject(result[targetKey]) && isPlainObject(val)) {454      result[targetKey] = merge(result[targetKey], val);455    } else if (isPlainObject(val)) {456      result[targetKey] = merge({}, val);457    } else if (isArray(val)) {458      result[targetKey] = val.slice();459    } else if (!skipUndefined || !isUndefined(val)) {460      result[targetKey] = val;461    }462  };463 464  for (let i = 0, l = arguments.length; i < l; i++) {465    arguments[i] && forEach(arguments[i], assignValue);466  }467  return result;468}469 470/**471 * Extends object a by mutably adding to it the properties of object b.472 *473 * @param {Object} a The object to be extended474 * @param {Object} b The object to copy properties from475 * @param {Object} thisArg The object to bind function to476 *477 * @param {Object} [options]478 * @param {Boolean} [options.allOwnKeys]479 * @returns {Object} The resulting value of object a480 */481const extend = (a, b, thisArg, { allOwnKeys } = {}) => {482  forEach(483    b,484    (val, key) => {485      if (thisArg && isFunction$1(val)) {486        Object.defineProperty(a, key, {487          value: bind(val, thisArg),488          writable: true,489          enumerable: true,490          configurable: true,491        });492      } else {493        Object.defineProperty(a, key, {494          value: val,495          writable: true,496          enumerable: true,497          configurable: true,498        });499      }500    },501    { allOwnKeys }502  );503  return a;504};505 506/**507 * Remove byte order marker. This catches EF BB BF (the UTF-8 BOM)508 *509 * @param {string} content with BOM510 *511 * @returns {string} content value without BOM512 */513const stripBOM = (content) => {514  if (content.charCodeAt(0) === 0xfeff) {515    content = content.slice(1);516  }517  return content;518};519 520/**521 * Inherit the prototype methods from one constructor into another522 * @param {function} constructor523 * @param {function} superConstructor524 * @param {object} [props]525 * @param {object} [descriptors]526 *527 * @returns {void}528 */529const inherits = (constructor, superConstructor, props, descriptors) => {530  constructor.prototype = Object.create(superConstructor.prototype, descriptors);531  Object.defineProperty(constructor.prototype, 'constructor', {532    value: constructor,533    writable: true,534    enumerable: false,535    configurable: true,536  });537  Object.defineProperty(constructor, 'super', {538    value: superConstructor.prototype,539  });540  props && Object.assign(constructor.prototype, props);541};542 543/**544 * Resolve object with deep prototype chain to a flat object545 * @param {Object} sourceObj source object546 * @param {Object} [destObj]547 * @param {Function|Boolean} [filter]548 * @param {Function} [propFilter]549 *550 * @returns {Object}551 */552const toFlatObject = (sourceObj, destObj, filter, propFilter) => {553  let props;554  let i;555  let prop;556  const merged = {};557 558  destObj = destObj || {};559  // eslint-disable-next-line no-eq-null,eqeqeq560  if (sourceObj == null) return destObj;561 562  do {563    props = Object.getOwnPropertyNames(sourceObj);564    i = props.length;565    while (i-- > 0) {566      prop = props[i];567      if ((!propFilter || propFilter(prop, sourceObj, destObj)) && !merged[prop]) {568        destObj[prop] = sourceObj[prop];569        merged[prop] = true;570      }571    }572    sourceObj = filter !== false && getPrototypeOf(sourceObj);573  } while (sourceObj && (!filter || filter(sourceObj, destObj)) && sourceObj !== Object.prototype);574 575  return destObj;576};577 578/**579 * Determines whether a string ends with the characters of a specified string580 *581 * @param {String} str582 * @param {String} searchString583 * @param {Number} [position= 0]584 *585 * @returns {boolean}586 */587const endsWith = (str, searchString, position) => {588  str = String(str);589  if (position === undefined || position > str.length) {590    position = str.length;591  }592  position -= searchString.length;593  const lastIndex = str.indexOf(searchString, position);594  return lastIndex !== -1 && lastIndex === position;595};596 597/**598 * Returns new array from array like object or null if failed599 *600 * @param {*} [thing]601 *602 * @returns {?Array}603 */604const toArray = (thing) => {605  if (!thing) return null;606  if (isArray(thing)) return thing;607  let i = thing.length;608  if (!isNumber(i)) return null;609  const arr = new Array(i);610  while (i-- > 0) {611    arr[i] = thing[i];612  }613  return arr;614};615 616/**617 * Checking if the Uint8Array exists and if it does, it returns a function that checks if the618 * thing passed in is an instance of Uint8Array619 *620 * @param {TypedArray}621 *622 * @returns {Array}623 */624// eslint-disable-next-line func-names625const isTypedArray = ((TypedArray) => {626  // eslint-disable-next-line func-names627  return (thing) => {628    return TypedArray && thing instanceof TypedArray;629  };630})(typeof Uint8Array !== 'undefined' && getPrototypeOf(Uint8Array));631 632/**633 * For each entry in the object, call the function with the key and value.634 *635 * @param {Object<any, any>} obj - The object to iterate over.636 * @param {Function} fn - The function to call for each entry.637 *638 * @returns {void}639 */640const forEachEntry = (obj, fn) => {641  const generator = obj && obj[iterator];642 643  const _iterator = generator.call(obj);644 645  let result;646 647  while ((result = _iterator.next()) && !result.done) {648    const pair = result.value;649    fn.call(obj, pair[0], pair[1]);650  }651};652 653/**654 * It takes a regular expression and a string, and returns an array of all the matches655 *656 * @param {string} regExp - The regular expression to match against.657 * @param {string} str - The string to search.658 *659 * @returns {Array<boolean>}660 */661const matchAll = (regExp, str) => {662  let matches;663  const arr = [];664 665  while ((matches = regExp.exec(str)) !== null) {666    arr.push(matches);667  }668 669  return arr;670};671 672/* Checking if the kindOfTest function returns true when passed an HTMLFormElement. */673const isHTMLForm = kindOfTest('HTMLFormElement');674 675const toCamelCase = (str) => {676  return str.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g, function replacer(m, p1, p2) {677    return p1.toUpperCase() + p2;678  });679};680 681/* Creating a function that will check if an object has a property. */682const hasOwnProperty = (683  ({ hasOwnProperty }) =>684  (obj, prop) =>685    hasOwnProperty.call(obj, prop)686)(Object.prototype);687 688/**689 * Determine if a value is a RegExp object690 *691 * @param {*} val The value to test692 *693 * @returns {boolean} True if value is a RegExp object, otherwise false694 */695const isRegExp = kindOfTest('RegExp');696 697const reduceDescriptors = (obj, reducer) => {698  const descriptors = Object.getOwnPropertyDescriptors(obj);699  const reducedDescriptors = {};700 701  forEach(descriptors, (descriptor, name) => {702    let ret;703    if ((ret = reducer(descriptor, name, obj)) !== false) {704      reducedDescriptors[name] = ret || descriptor;705    }706  });707 708  Object.defineProperties(obj, reducedDescriptors);709};710 711/**712 * Makes all methods read-only713 * @param {Object} obj714 */715 716const freezeMethods = (obj) => {717  reduceDescriptors(obj, (descriptor, name) => {718    // skip restricted props in strict mode719    if (isFunction$1(obj) && ['arguments', 'caller', 'callee'].indexOf(name) !== -1) {720      return false;721    }722 723    const value = obj[name];724 725    if (!isFunction$1(value)) return;726 727    descriptor.enumerable = false;728 729    if ('writable' in descriptor) {730      descriptor.writable = false;731      return;732    }733 734    if (!descriptor.set) {735      descriptor.set = () => {736        throw Error("Can not rewrite read-only method '" + name + "'");737      };738    }739  });740};741 742/**743 * Converts an array or a delimited string into an object set with values as keys and true as values.744 * Useful for fast membership checks.745 *746 * @param {Array|string} arrayOrString - The array or string to convert.747 * @param {string} delimiter - The delimiter to use if input is a string.748 * @returns {Object} An object with keys from the array or string, values set to true.749 */750const toObjectSet = (arrayOrString, delimiter) => {751  const obj = {};752 753  const define = (arr) => {754    arr.forEach((value) => {755      obj[value] = true;756    });757  };758 759  isArray(arrayOrString) ? define(arrayOrString) : define(String(arrayOrString).split(delimiter));760 761  return obj;762};763 764const noop = () => {};765 766const toFiniteNumber = (value, defaultValue) => {767  return value != null && Number.isFinite((value = +value)) ? value : defaultValue;768};769 770/**771 * If the thing is a FormData object, return true, otherwise return false.772 *773 * @param {unknown} thing - The thing to check.774 *775 * @returns {boolean}776 */777function isSpecCompliantForm(thing) {778  return !!(779    thing &&780    isFunction$1(thing.append) &&781    thing[toStringTag] === 'FormData' &&782    thing[iterator]783  );784}785 786/**787 * Recursively converts an object to a JSON-compatible object, handling circular references and Buffers.788 *789 * @param {Object} obj - The object to convert.790 * @returns {Object} The JSON-compatible object.791 */792const toJSONObject = (obj) => {793  const stack = new Array(10);794 795  const visit = (source, i) => {796    if (isObject(source)) {797      if (stack.indexOf(source) >= 0) {798        return;799      }800 801      //Buffer check802      if (isBuffer(source)) {803        return source;804      }805 806      if (!('toJSON' in source)) {807        stack[i] = source;808        const target = isArray(source) ? [] : {};809 810        forEach(source, (value, key) => {811          const reducedValue = visit(value, i + 1);812          !isUndefined(reducedValue) && (target[key] = reducedValue);813        });814 815        stack[i] = undefined;816 817        return target;818      }819    }820 821    return source;822  };823 824  return visit(obj, 0);825};826 827/**828 * Determines if a value is an async function.829 *830 * @param {*} thing - The value to test.831 * @returns {boolean} True if value is an async function, otherwise false.832 */833const isAsyncFn = kindOfTest('AsyncFunction');834 835/**836 * Determines if a value is thenable (has then and catch methods).837 *838 * @param {*} thing - The value to test.839 * @returns {boolean} True if value is thenable, otherwise false.840 */841const isThenable = (thing) =>842  thing &&843  (isObject(thing) || isFunction$1(thing)) &&844  isFunction$1(thing.then) &&845  isFunction$1(thing.catch);846 847// original code848// https://github.com/DigitalBrainJS/AxiosPromise/blob/16deab13710ec09779922131f3fa5954320f83ab/lib/utils.js#L11-L34849 850/**851 * Provides a cross-platform setImmediate implementation.852 * Uses native setImmediate if available, otherwise falls back to postMessage or setTimeout.853 *854 * @param {boolean} setImmediateSupported - Whether setImmediate is supported.855 * @param {boolean} postMessageSupported - Whether postMessage is supported.856 * @returns {Function} A function to schedule a callback asynchronously.857 */858const _setImmediate = ((setImmediateSupported, postMessageSupported) => {859  if (setImmediateSupported) {860    return setImmediate;861  }862 863  return postMessageSupported864    ? ((token, callbacks) => {865        _global.addEventListener(866          'message',867          ({ source, data }) => {868            if (source === _global && data === token) {869              callbacks.length && callbacks.shift()();870            }871          },872          false873        );874 875        return (cb) => {876          callbacks.push(cb);877          _global.postMessage(token, '*');878        };879      })(`axios@${Math.random()}`, [])880    : (cb) => setTimeout(cb);881})(typeof setImmediate === 'function', isFunction$1(_global.postMessage));882 883/**884 * Schedules a microtask or asynchronous callback as soon as possible.885 * Uses queueMicrotask if available, otherwise falls back to process.nextTick or _setImmediate.886 *887 * @type {Function}888 */889const asap =890  typeof queueMicrotask !== 'undefined'891    ? queueMicrotask.bind(_global)892    : (typeof process !== 'undefined' && process.nextTick) || _setImmediate;893 894// *********************895 896const isIterable = (thing) => thing != null && isFunction$1(thing[iterator]);897 898const utils$1 = {899  isArray,900  isArrayBuffer,901  isBuffer,902  isFormData,903  isArrayBufferView,904  isString,905  isNumber,906  isBoolean,907  isObject,908  isPlainObject,909  isEmptyObject,910  isReadableStream,911  isRequest,912  isResponse,913  isHeaders,914  isUndefined,915  isDate,916  isFile,917  isReactNativeBlob,918  isReactNative,919  isBlob,920  isRegExp,921  isFunction: isFunction$1,922  isStream,923  isURLSearchParams,924  isTypedArray,925  isFileList,926  forEach,927  merge,928  extend,929  trim,930  stripBOM,931  inherits,932  toFlatObject,933  kindOf,934  kindOfTest,935  endsWith,936  toArray,937  forEachEntry,938  matchAll,939  isHTMLForm,940  hasOwnProperty,941  hasOwnProp: hasOwnProperty, // an alias to avoid ESLint no-prototype-builtins detection942  reduceDescriptors,943  freezeMethods,944  toObjectSet,945  toCamelCase,946  noop,947  toFiniteNumber,948  findKey,949  global: _global,950  isContextDefined,951  isSpecCompliantForm,952  toJSONObject,953  isAsyncFn,954  isThenable,955  setImmediate: _setImmediate,956  asap,957  isIterable,958};959 960class AxiosError extends Error {961  static from(error, code, config, request, response, customProps) {962    const axiosError = new AxiosError(error.message, code || error.code, config, request, response);963    axiosError.cause = error;964    axiosError.name = error.name;965 966    // Preserve status from the original error if not already set from response967    if (error.status != null && axiosError.status == null) {968      axiosError.status = error.status;969    }970 971    customProps && Object.assign(axiosError, customProps);972    return axiosError;973  }974 975    /**976     * Create an Error with the specified message, config, error code, request and response.977     *978     * @param {string} message The error message.979     * @param {string} [code] The error code (for example, 'ECONNABORTED').980     * @param {Object} [config] The config.981     * @param {Object} [request] The request.982     * @param {Object} [response] The response.983     *984     * @returns {Error} The created error.985     */986    constructor(message, code, config, request, response) {987      super(message);988      989      // Make message enumerable to maintain backward compatibility990      // The native Error constructor sets message as non-enumerable,991      // but axios < v1.13.3 had it as enumerable992      Object.defineProperty(this, 'message', {993          value: message,994          enumerable: true,995          writable: true,996          configurable: true997      });998      999      this.name = 'AxiosError';1000      this.isAxiosError = true;1001      code && (this.code = code);1002      config && (this.config = config);1003      request && (this.request = request);1004      if (response) {1005          this.response = response;1006          this.status = response.status;1007      }1008    }1009 1010  toJSON() {1011    return {1012      // Standard1013      message: this.message,1014      name: this.name,1015      // Microsoft1016      description: this.description,1017      number: this.number,1018      // Mozilla1019      fileName: this.fileName,1020      lineNumber: this.lineNumber,1021      columnNumber: this.columnNumber,1022      stack: this.stack,1023      // Axios1024      config: utils$1.toJSONObject(this.config),1025      code: this.code,1026      status: this.status,1027    };1028  }1029}1030 1031// This can be changed to static properties as soon as the parser options in .eslint.cjs are updated.1032AxiosError.ERR_BAD_OPTION_VALUE = 'ERR_BAD_OPTION_VALUE';1033AxiosError.ERR_BAD_OPTION = 'ERR_BAD_OPTION';1034AxiosError.ECONNABORTED = 'ECONNABORTED';1035AxiosError.ETIMEDOUT = 'ETIMEDOUT';1036AxiosError.ERR_NETWORK = 'ERR_NETWORK';1037AxiosError.ERR_FR_TOO_MANY_REDIRECTS = 'ERR_FR_TOO_MANY_REDIRECTS';1038AxiosError.ERR_DEPRECATED = 'ERR_DEPRECATED';1039AxiosError.ERR_BAD_RESPONSE = 'ERR_BAD_RESPONSE';1040AxiosError.ERR_BAD_REQUEST = 'ERR_BAD_REQUEST';1041AxiosError.ERR_CANCELED = 'ERR_CANCELED';1042AxiosError.ERR_NOT_SUPPORT = 'ERR_NOT_SUPPORT';1043AxiosError.ERR_INVALID_URL = 'ERR_INVALID_URL';1044 1045const AxiosError$1 = AxiosError;1046 1047/**1048 * Determines if the given thing is a array or js object.1049 *1050 * @param {string} thing - The object or array to be visited.1051 *1052 * @returns {boolean}1053 */1054function isVisitable(thing) {1055  return utils$1.isPlainObject(thing) || utils$1.isArray(thing);1056}1057 1058/**1059 * It removes the brackets from the end of a string1060 *1061 * @param {string} key - The key of the parameter.1062 *1063 * @returns {string} the key without the brackets.1064 */1065function removeBrackets(key) {1066  return utils$1.endsWith(key, '[]') ? key.slice(0, -2) : key;1067}1068 1069/**1070 * It takes a path, a key, and a boolean, and returns a string1071 *1072 * @param {string} path - The path to the current key.1073 * @param {string} key - The key of the current object being iterated over.1074 * @param {string} dots - If true, the key will be rendered with dots instead of brackets.1075 *1076 * @returns {string} The path to the current key.1077 */1078function renderKey(path, key, dots) {1079  if (!path) return key;1080  return path1081    .concat(key)1082    .map(function each(token, i) {1083      // eslint-disable-next-line no-param-reassign1084      token = removeBrackets(token);1085      return !dots && i ? '[' + token + ']' : token;1086    })1087    .join(dots ? '.' : '');1088}1089 1090/**1091 * If the array is an array and none of its elements are visitable, then it's a flat array.1092 *1093 * @param {Array<any>} arr - The array to check1094 *1095 * @returns {boolean}1096 */1097function isFlatArray(arr) {1098  return utils$1.isArray(arr) && !arr.some(isVisitable);1099}1100 1101const predicates = utils$1.toFlatObject(utils$1, {}, null, function filter(prop) {1102  return /^is[A-Z]/.test(prop);1103});1104 1105/**1106 * Convert a data object to FormData1107 *1108 * @param {Object} obj1109 * @param {?Object} [formData]1110 * @param {?Object} [options]1111 * @param {Function} [options.visitor]1112 * @param {Boolean} [options.metaTokens = true]1113 * @param {Boolean} [options.dots = false]1114 * @param {?Boolean} [options.indexes = false]1115 *1116 * @returns {Object}1117 **/1118 1119/**1120 * It converts an object into a FormData object1121 *1122 * @param {Object<any, any>} obj - The object to convert to form data.1123 * @param {string} formData - The FormData object to append to.1124 * @param {Object<string, any>} options1125 *1126 * @returns1127 */1128function toFormData(obj, formData, options) {1129  if (!utils$1.isObject(obj)) {1130    throw new TypeError('target must be an object');1131  }1132 1133  // eslint-disable-next-line no-param-reassign1134  formData = formData || new (FormData__default["default"] || FormData)();1135 1136  // eslint-disable-next-line no-param-reassign1137  options = utils$1.toFlatObject(1138    options,1139    {1140      metaTokens: true,1141      dots: false,1142      indexes: false,1143    },1144    false,1145    function defined(option, source) {1146      // eslint-disable-next-line no-eq-null,eqeqeq1147      return !utils$1.isUndefined(source[option]);1148    }1149  );1150 1151  const metaTokens = options.metaTokens;1152  // eslint-disable-next-line no-use-before-define1153  const visitor = options.visitor || defaultVisitor;1154  const dots = options.dots;1155  const indexes = options.indexes;1156  const _Blob = options.Blob || (typeof Blob !== 'undefined' && Blob);1157  const useBlob = _Blob && utils$1.isSpecCompliantForm(formData);1158 1159  if (!utils$1.isFunction(visitor)) {1160    throw new TypeError('visitor must be a function');1161  }1162 1163  function convertValue(value) {1164    if (value === null) return '';1165 1166    if (utils$1.isDate(value)) {1167      return value.toISOString();1168    }1169 1170    if (utils$1.isBoolean(value)) {1171      return value.toString();1172    }1173 1174    if (!useBlob && utils$1.isBlob(value)) {1175      throw new AxiosError$1('Blob is not supported. Use a Buffer instead.');1176    }1177 1178    if (utils$1.isArrayBuffer(value) || utils$1.isTypedArray(value)) {1179      return useBlob && typeof Blob === 'function' ? new Blob([value]) : Buffer.from(value);1180    }1181 1182    return value;1183  }1184 1185  /**1186   * Default visitor.1187   *1188   * @param {*} value1189   * @param {String|Number} key1190   * @param {Array<String|Number>} path1191   * @this {FormData}1192   *1193   * @returns {boolean} return true to visit the each prop of the value recursively1194   */1195  function defaultVisitor(value, key, path) {1196    let arr = value;1197 1198    if (utils$1.isReactNative(formData) && utils$1.isReactNativeBlob(value)) {1199      formData.append(renderKey(path, key, dots), convertValue(value));1200      return false;

Showing the first 1,200 of 5644 lines. Download the file for the rest.

basant307/AI_Governance_Project · CoolFace