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

/** @var \Magento\Framework\View\Helper\SecureHtmlRenderer $secureRenderer */
?>

<?php $scriptString = <<<script
require(['jquery'], function($){
    $('[data-tab-panel=product-details]').on('stockbeforedisable', function(e) {
        var variations = $('[data-panel=product-variations]');
        if (e.productType === 'configurable' || (variations.is(':visible'))) {
            e.stopPropagation();
            return false;
        }
    });
});
script;
?>
<?= /* @noEscape */ $secureRenderer->renderTag('script', [], $scriptString, false) ?>
