'use strict';

const internalVegaEventManager = require('./internal-vega-event-manager-f8bdaa58.js');
require('./global-slimmer-registry-7bbdb1f2.js');
const createPublicApiRuntimeMetricsSlimmer = require('./create-public-api-runtime-metrics-slimmer-1b8ecfb4.js');
require('./vega-event-id-c08ce3d3.js');
require('./dynamic-slimmer-0050c489.js');
require('./misc-3d30df91.js');

/* istanbul ignore next */
const VegaEventManagerRuntimeMetricsPayloadDefinition = [
  {
    payloadKey: 'IS_SETSEMANTICS_METHOD_CALLED',
    payloadDescription: 'Indicate if the method setSemantics of public API VegaEventManager is called',
    /**
     * Indicate whether the method is collected when the method been called .
     *
     * @param {string} scope - The class name of public api
     * @param {string} methodName - The method name called by the public api
     * @returns {boolean} A boolean value
     */
    canAccept: (scope, methodName) => scope === 'VegaEventManager' && methodName === 'setSemantics',
    /**
     * The function checks if the method is been called.
     *
     * @returns {boolean} A boolean value
     */
    payloadValue: () => {
      return true;
    },
  },
  {
    payloadKey: 'IS_GETSEMANTICS_METHOD_CALLED',
    payloadDescription: 'Indicate if the method getSemantics of public API VegaEventManager is called',
    /**
     * Indicate whether the method is collected when the method been called .
     *
     * @param {string} scope - The class name of public api
     * @param {string} methodName - The method name called by the public api
     * @returns {boolean} A boolean value
     */
    canAccept: (scope, methodName) => scope === 'VegaEventManager' && methodName === 'getSemantics',
    /**
     * The function checks if the method is been called.
     *
     * @returns {boolean} A boolean value
     */
    payloadValue: () => {
      return true;
    },
  },
  {
    payloadKey: 'IS_GETENABLEDEVENTIDSBYCOMPONENT_METHOD_CALLED',
    payloadDescription: 'Indicate if the method getEnabledEventIdsByComponent of public API VegaEventManager is called',
    /**
     * Indicate whether the method is collected when the method been called .
     *
     * @param {string} scope - The class name of public api
     * @param {string} methodName - The method name called by the public api
     * @returns {boolean} A boolean value
     */
    canAccept: (scope, methodName) => scope === 'VegaEventManager' && methodName === 'getEnabledEventIdsByComponent',
    /**
     * The function checks if the method is been called.
     *
     * @returns {boolean} A boolean value
     */
    payloadValue: () => {
      return true;
    },
  },
  {
    payloadKey: 'globalEventIsNative',
    payloadDescription: 'Indicate if the vega components will emit events without the vega prefix',
    /**
     * Indicate whether the method is collected when the method been called .
     *
     * @param {string} scope - The class name of public api
     * @param {string} methodName - The method name called by the public api
     * @returns {boolean} A boolean value
     */
    canAccept: (scope, methodName) => scope === 'VegaEventManager' && methodName === 'setSemantics',
    /**
     * The function checks if the method is been called.
     *
     * @param {unknown[]} args - The args parameter is an object
     * @returns {boolean} A boolean value
     */
    payloadValue: (args) => {
      const config = args;
      return !!(config.global && config.global.namespace === 'native');
    },
  },
  {
    payloadKey: 'eventOfSpecificComponentsIsNative',
    payloadDescription: 'Indicate if the vega components will emit events with the vega prefix, but special components will emit events without vega prefix',
    /**
     * Indicate whether the method is collected when the method been called .
     *
     * @param {string} scope - The class name of public api
     * @param {string} methodName - The method name called by the public api
     * @returns {boolean} A boolean value
     */
    canAccept: (scope, methodName) => scope === 'VegaEventManager' && methodName === 'setSemantics',
    /**
     * The function checks if the method is been called.
     *
     * @param {unknown[]} args - The args parameter is an object
     * @returns {boolean} A boolean value
     */
    payloadValue: (args) => {
      const config = args;
      if (config.components) {
        const specialComponents = Object.keys(config.components);
        return !!(specialComponents.length > 0 &&
          config.components[specialComponents[0]].namespace === 'native');
      }
      return false;
    },
  },
  {
    payloadKey: 'eventOfSpecificComponentsIsVega',
    payloadDescription: 'Indicate if the vega components will emit events without the vega prefix, but special components will emit events with vega prefix',
    /**
     * Indicate whether the method is collected when the method been called .
     *
     * @param {string} scope - The class name of public api
     * @param {string} methodName - The method name called by the public api
     * @returns {boolean} A boolean value
     */
    canAccept: (scope, methodName) => scope === 'VegaEventManager' && methodName === 'setSemantics',
    /**
     * The function checks if the method is been called.
     *
     * @param {unknown[]} args - The args parameter is an object
     * @returns {boolean} A boolean value
     */
    payloadValue: (args) => {
      const config = args;
      if (config.global && config.components) {
        const specialComponents = Object.keys(config.components);
        return !!(config.global.namespace === 'native' &&
          specialComponents.length > 0 &&
          config.components[specialComponents[0]].namespace === 'vega');
      }
      return false;
    },
  },
  {
    payloadKey: 'globalJqueryDelegatedEventIsTrue',
    payloadDescription: 'Indicate if the use jQuery with event delegation',
    /**
     * Indicate whether the method is collected when the method been called .
     *
     * @param {string} scope - The class name of public api
     * @param {string} methodName - The method name called by the public api
     * @returns {boolean} A boolean value
     */
    canAccept: (scope, methodName) => scope === 'VegaEventManager' && methodName === 'setSemantics',
    /**
     * The function checks if the method is been called.
     *
     * @param {unknown[]} args - The args parameter is an object
     * @returns {boolean} A boolean value
     */
    payloadValue: (args) => {
      const config = args;
      return !!(config.global && config.global.jqueryDelegatedEvent === true);
    },
  },
  {
    payloadKey: 'jqueryDelegatedEventIsCustomStrategy',
    payloadDescription: 'Indicate if the use jQuery with event delegation',
    /**
     * Indicate whether the method is collected when the method been called .
     *
     * @param {string} scope - The class name of public api
     * @param {string} methodName - The method name called by the public api
     * @returns {boolean} A boolean value
     */
    canAccept: (scope, methodName) => scope === 'VegaEventManager' && methodName === 'setSemantics',
    /**
     * The function checks if the method is been called.
     *
     * @param {unknown[]} args - The args parameter is an object
     * @returns {boolean} A boolean value
     */
    payloadValue: (args) => {
      const config = args;
      return !!(config.global &&
        Array.isArray(config.global.jqueryDelegatedEvent) &&
        config.global.jqueryDelegatedEvent.length > 0);
    },
  },
  {
    payloadKey: 'jqueryDelegatedEventOfSpecialComponentsIsTrue',
    payloadDescription: 'Indicate if the use jQuery with event delegation',
    /**
     * Indicate whether the method is collected when the method been called .
     *
     * @param {string} scope - The class name of public api
     * @param {string} methodName - The method name called by the public api
     * @returns {boolean} A boolean value
     */
    canAccept: (scope, methodName) => scope === 'VegaEventManager' && methodName === 'setSemantics',
    /**
     * The function checks if the method is been called.
     *
     * @param {unknown[]} args - The args parameter is an object
     * @returns {boolean} A boolean value
     */
    payloadValue: (args) => {
      const config = args;
      if (config.components) {
        const specialComponents = Object.keys(config.components);
        return !!(specialComponents.length > 0 &&
          config.components[specialComponents[0]].jqueryDelegatedEvent === true);
      }
      return false;
    },
  },
];

var __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  return c > 3 && r && Object.defineProperty(target, key, r), r;
};
/**
 * The VegaEventManager class provides methods for setting and retrieving event semantics configuration,
 * as well as getting the corresponding native event name for a given event.
 */
class VegaEventManager {
  constructor() {
    this.vegaPublicAPIRuntimeMetricsSlimmer = createPublicApiRuntimeMetricsSlimmer.createPublicAPIRuntimeMetricsSlimmer(VegaEventManager, ['setSemantics', 'getSemantics', 'getEnabledEventIdsByComponent'], VegaEventManagerRuntimeMetricsPayloadDefinition);
  }
  /**
   * The function sets the semantics configuration for event management.
   *
   * @param {EventSemanticsConfig} config - The config parameter is an object that contains the
   * configuration settings for the event semantics. It may include properties such as the event type,
   * event source, event target, event data, and any other relevant information for setting up the
   * semantics of the event.
   * @vegaVersion 2.0.0
   */
  setSemantics(config) {
    internalVegaEventManager.internalVegaEventManager.setSemantics(config);
  }
  /**
   * The function "getSemantics" returns the event semantics of an HTML element.
   *
   * @param {HTMLElement} host - The host parameter is an HTMLElement, which represents an HTML element
   * in the DOM (Document Object Model). It can be any valid HTML element such as a div, span, button,
   * etc.
   * @returns {EventSemantics} an object of type EventSemantics.
   * @vegaVersion 2.0.0
   */
  getSemantics(host) {
    return internalVegaEventManager.internalVegaEventManager.getSemantics(host);
  }
  /**
   * The function "getEnabledEventIdsByComponent" returns the all eventIds in component.
   *
   * @param {VegaComponentName} componentName - The component name,
   * etc.
   * @returns {Nullable<VegaEventID[]>} All eventIds.
   * @vegaVersion 2.0.0
   */
  getEnabledEventIdsByComponent(componentName) {
    return internalVegaEventManager.internalVegaEventManager.getEnabledEventIdsByComponent(componentName);
  }
}
__decorate([
  createPublicApiRuntimeMetricsSlimmer.InjectVegaTelemetrySlimmer()
], VegaEventManager.prototype, "vegaPublicAPIRuntimeMetricsSlimmer", void 0);
const VegaEventManager$1 = new VegaEventManager();

exports.default = VegaEventManager$1;
