"use strict";

exports.__esModule = true;
exports.extend = void 0;
exports.get = get;
exports.inBrowser = void 0;
exports.isDef = isDef;
exports.isFunction = isFunction;
exports.isObject = isObject;
exports.isPromise = isPromise;
exports.noop = noop;
exports.once = once;
exports.pick = pick;

/* eslint-disable @typescript-eslint/no-explicit-any */
function noop() {}

var extend = Object.assign;
exports.extend = extend;
var inBrowser = typeof window !== 'undefined';
exports.inBrowser = inBrowser;

function isDef(val) {
  return val !== undefined && val !== null;
} // eslint-disable-next-line @typescript-eslint/ban-types


function isFunction(val) {
  return typeof val === 'function';
}

function isPromise(val) {
  return isObject(val) && isFunction(val.then) && isFunction(val.catch);
}

function isObject(val) {
  return val !== null && typeof val === 'object';
}

function get(object, path) {
  var keys = path.split('.');
  var result = object;
  keys.forEach(function (key) {
    var _result$key;

    result = (_result$key = result[key]) != null ? _result$key : '';
  });
  return result;
}

function pick(obj, keys, ignoreUndefined) {
  return keys.reduce(function (ret, key) {
    if (!ignoreUndefined || obj[key] !== undefined) {
      ret[key] = obj[key];
    }

    return ret;
  }, {});
}

function once(fn) {
  return function () {
    if (!fn) return;
    fn.apply(void 0, arguments);
    fn = null;
  };
}