services:

  # Plugins.

  plugin.manager.webform.element:
    class: Drupal\webform\Plugin\WebformElementManager
    arguments: ['@container.namespaces', '@cache.discovery', '@module_handler', '@theme_handler', '@config.factory', '@plugin.manager.element_info']

  plugin.manager.webform.handler:
    class: Drupal\webform\Plugin\WebformHandlerManager
    arguments: ['@container.namespaces', '@cache.discovery', '@module_handler', '@config.factory']

  plugin.manager.webform.variant:
    class: Drupal\webform\Plugin\WebformVariantManager
    arguments: ['@container.namespaces', '@cache.discovery', '@module_handler', '@config.factory']

  plugin.manager.webform.exporter:
    class: Drupal\webform\Plugin\WebformExporterManager
    arguments: ['@container.namespaces', '@cache.discovery', '@module_handler', '@config.factory']

  plugin.manager.webform.source_entity:
    class: Drupal\webform\Plugin\WebformSourceEntityManager
    arguments: ['@container.namespaces', '@cache.discovery', '@module_handler', '@config.factory']

  # Logger.

  logger.channel.webform:
    class: Drupal\Core\Logger\LoggerChannel
    factory: logger.factory:get
    arguments: ['webform']

  logger.channel.webform_submission:
    class: Drupal\Core\Logger\LoggerChannel
    factory: logger.factory:get
    arguments: ['webform_submission']

  # Services.

  webform.addons_manager:
    class: Drupal\webform\WebformAddonsManager

  webform.conditions_manager:
    class: Drupal\webform\WebformEntityConditionsManager
    arguments: ['@plugin.manager.webform.element']

  webform.elements_validator:
    class: Drupal\webform\WebformEntityElementsValidator
    arguments: ['@config.factory', '@renderer', '@plugin.manager.webform.element', '@entity_type.manager', '@form_builder']

  webform.email_provider:
    class: Drupal\webform\WebformEmailProvider
    arguments: ['@config.factory', '@module_handler', '@plugin.manager.mail', '@extension.list.module']

  webform.entity_reference_manager:
    class: Drupal\webform\WebformEntityReferenceManager
    arguments: ['@current_route_match', '@current_user', '@user.data', '@module_handler', '@entity_type.manager']

  webform.help_manager:
    class: Drupal\webform\WebformHelpManager
    arguments: ['@current_user', '@config.factory', '@module_handler', '@state', '@path.matcher', '@webform.addons_manager', '@webform.libraries_manager', '@plugin.manager.webform.element']

  webform.libraries_manager:
    class: Drupal\webform\WebformLibrariesManager
    arguments: ['@library.discovery', '@config.factory', '@module_handler', '@renderer']

  webform.message_manager:
    class: Drupal\webform\WebformMessageManager
    arguments: ['@current_user', '@config.factory', '@entity_type.manager', '@logger.channel.webform', '@renderer', '@messenger', '@webform.request', '@webform.token_manager']

  webform.translation_manager:
    class: Drupal\webform\WebformTranslationManager
    arguments: ['@current_route_match', '@language_manager', '@config.factory', '@messenger', '@plugin.manager.webform.element']

  webform.translation_config_manager:
    class: Drupal\webform\WebformTranslationConfigManager
    arguments: ['@module_handler', '@form_builder', '@plugin.manager.webform.element', '@webform.translation_manager', '@config.typed']

  webform.translation_lingotek_manager:
    class: Drupal\webform\WebformTranslationLingotekManager
    arguments: ['@webform.translation_manager']

  webform.request:
    class: Drupal\webform\WebformRequest
    arguments: ['@router.route_provider', '@request_stack', '@router.admin_context', '@current_route_match', '@entity_type.manager', '@entity_type.repository', '@webform.entity_reference_manager', '@plugin.manager.webform.source_entity']

  webform_submission.generate:
    class: Drupal\webform\WebformSubmissionGenerate
    arguments: ['@config.factory', '@webform.token_manager', '@plugin.manager.webform.element']

  webform_submission.exporter:
    class: Drupal\webform\WebformSubmissionExporter
    arguments: ['@config.factory', '@file_system', '@entity_type.manager', '@stream_wrapper_manager', '@plugin.manager.archiver', '@plugin.manager.webform.element', '@plugin.manager.webform.exporter', '@language_manager']

  webform.third_party_settings_manager:
    class: Drupal\webform\WebformThirdPartySettingsManager
    arguments: ['@config.factory', '@module_handler', '@path.validator', '@webform.addons_manager']

  webform.token_manager:
    class: Drupal\webform\WebformTokenManager
    arguments: ['@current_user', '@language_manager', '@config.factory', '@module_handler', '@token']

  webform.theme_manager:
    class: Drupal\webform\WebformThemeManager
    arguments: ['@current_route_match', '@config.factory', '@renderer', '@theme.manager', '@theme_handler', '@theme.initialization']

  webform.access_rules_manager:
    class: Drupal\webform\WebformAccessRulesManager
    arguments: ['@module_handler']

  webform_submission.conditions_validator:
    class: Drupal\webform\WebformSubmissionConditionsValidator
    arguments: ['@plugin.manager.webform.element']

  # Breadcrumb builder.

  webform.breadcrumb:
    class: Drupal\webform\Breadcrumb\WebformBreadcrumbBuilder
    arguments: ['@module_handler', '@webform.request', '@string_translation', '@config.factory']
    tags:
      - { name: breadcrumb_builder, priority: 1002 }

  # Event subscriber.

  webform.exception_html_subscriber:
    class: Drupal\webform\EventSubscriber\WebformDefaultExceptionHtmlSubscriber
    arguments: ['@http_kernel', '@logger.channel.php', '@redirect.destination', '@router.no_access_checks', '@current_user', '@config.factory', '@renderer', '@messenger', '@webform.token_manager']
    tags:
      - { name: event_subscriber }

  webform.filter_format_subscriber:
    class: Drupal\webform\EventSubscriber\WebformFilterFormatSubscriber
    arguments: ['@current_route_match']
    tags:
      - { name: event_subscriber }

  # Route subscriber.

  webform.route_subscriber:
    class: Drupal\webform\Routing\WebformRouteSubscriber
    arguments: ['@module_handler', '@config.factory']
    tags:
      - { name: event_subscriber }


  # Route context.

  webform.webform_route_context:
    class: Drupal\webform\ContextProvider\WebformRouteContext
    arguments: ['@current_route_match']
    tags:
      - { name: 'context_provider' }

  webform.webform_submission_route_context:
    class: Drupal\webform\ContextProvider\WebformSubmissionRouteContext
    arguments: ['@current_route_match']
    tags:
      - { name: 'context_provider' }

  # Theme negotiator

  webform.theme_negotiator:
    class: Drupal\webform\Theme\WebformThemeNegotiator
    arguments: ['@current_user', '@config.factory', '@webform.request']
    tags:
      - { name: theme_negotiator, priority: -41 }

  # Twig extension.

  webform.twig_extension:
    class: Drupal\webform\Twig\WebformTwigExtension
    tags:
      - { name: twig.extension }
