<?php
/**
 * Webkul Software.
 *
 * @category  Webkul
 * @package   Webkul_ImageSearch
 * @author    Webkul
 * @copyright Copyright (c) Webkul Software Private Limited (https://webkul.com)
 * @license   https://store.webkul.com/license.html
 */
?>
<div id="icon" class="action image-search"></div>

<?php
$params = $block->getRequest()->getParams();
$keys = array_keys($params);
if (in_array('imagesearch', $keys)) {
    $deleteNow = 0;
    $hideBreadcrumbs = 1;
} else {
    $deleteNow = 1;
    $hideBreadcrumbs = 0;
}
$data = json_encode([
    'processorUrl' => $block->getUrl('imagesearch/index/index', ['_secure' => true]),
    'searchUrl' => $block->getUrl('catalogsearch/result/index', ['_secure' => true]),
    'deleteImageUrl' => $block->getUrl('imagesearch/index/deleteImage', ['_secure' => true]),
    'deleteNow' => $deleteNow,
    'hideBreadcrumbs' => $hideBreadcrumbs
]);
?>
<script type="text/x-magento-init">
{
    "*" : {
        "Webkul_ImageSearch/js/script": <?= /* @noEscape */ $data ?>
    }
}
</script>
