import _extends from "@babel/runtime/helpers/extends";
import _defineProperty from "@babel/runtime/helpers/defineProperty";
import React from 'react';
import { WithProviders } from '../../provider-factory';

// eslint-disable-next-line no-duplicate-imports

export default function withActivityProvider(WrappedComponent) {
  return class WithActivityProvider extends React.Component {
    constructor(...args) {
      super(...args);
      _defineProperty(this, "renderNode", providers => {
        const {
          providerFactory: _providerFactory,
          ...props
        } = this.props;
        const {
          activityProvider
        } = providers;

        // Ignored via go/ees005
        // eslint-disable-next-line @typescript-eslint/no-explicit-any, react/jsx-props-no-spreading
        return /*#__PURE__*/React.createElement(WrappedComponent, _extends({
          activityProvider: activityProvider
        }, props));
      });
    }
    render() {
      const {
        providerFactory
      } = this.props;
      return /*#__PURE__*/React.createElement(WithProviders
      // eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
      , {
        providers: ['activityProvider'],
        providerFactory: providerFactory,
        renderNode: this.renderNode
      });
    }
  };
}