<?php
/**
 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */

/** @var \Magento\Framework\View\Helper\SecureHtmlRenderer $secureRenderer */
/** @var \Magento\Backend\Block\Page\RequireJs $block */

$requireJsConfig = [
    'baseUrl' => $block->getViewFileUrl('/'),
];

$configModifier = $block->getConfigModifier();
$requireJsConfig = $configModifier instanceof \Magento\Backend\ViewModel\RequireJsConfigModifierInterface
    ? $configModifier->modify($requireJsConfig)
    : $requireJsConfig;

$scriptString = '
    var BASE_URL = \'' . /* @noEscape */ $block->getUrl('*') . '\';
    var FORM_KEY = \'' . /* @noEscape */ $block->getFormKey() . '\';
    var require = ' . /* @noEscape */ json_encode($requireJsConfig) .';';
?>
<?= /* @noEscape */ $secureRenderer->renderTag('script', [], $scriptString, false) ?>
