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

// @codingStandardsIgnoreFile

/**@var \Magento\Backend\Block\Widget\Form\Renderer\Fieldset $block */
?>
<?php $_element = $block->getElement() ?>
<?php $_jsObjectName = $block->getFieldSetId() != null ? $block->getFieldSetId() : $_element->getHtmlId() ?>
<div class="rule-tree">
    <fieldset id="<?= /* @escapeNotVerified */ $_jsObjectName ?>" <?= /* @escapeNotVerified */ $_element->serialize(['class']) ?> class="fieldset">
        <legend class="legend"><span><?= /* @escapeNotVerified */ $_element->getLegend() ?></span></legend>
        <br>
    <?php if ($_element->getComment()): ?>
        <div class="messages">
            <div class="message message-notice"><?= $block->escapeHtml($_element->getComment()) ?></div>
        </div>
    <?php endif; ?>
    <div class="rule-tree-wrapper">
        <?= $_element->getChildrenHtml() ?>
    </div>
    </fieldset>
</div>
<script>
require([
    "Magento_Rule/rules",
    "prototype"
], function(VarienRulesForm){

window.<?= /* @escapeNotVerified */ $_jsObjectName ?> = new VarienRulesForm('<?= /* @escapeNotVerified */ $_jsObjectName ?>', '<?= /* @escapeNotVerified */ $block->getNewChildUrl() ?>');
<?php if ($_element->getReadonly()): ?>
    <?= $_element->getHtmlId() ?>.setReadonly(true);
<?php endif; ?>

});
</script>
