<div class="filepond-wrapper">
    {% include "django/forms/widgets/input.html" %}
    {{ widget.filepond_config|json_script:widget.filepond_config_id }}
    {% comment %} djlint:off {% endcomment %}
    <script>
        const pondConfig = JSON.parse(
            document.getElementById("{{ widget.filepond_config_id }}").textContent
        );
        const fileInput = document.getElementById("{{ widget.attrs.id }}");

        {% if widget.filepond_config.allowImagePreview %}
            FilePond.registerPlugin(FilePondPluginImagePreview);
        {% endif %}

        FilePond.create(fileInput, pondConfig);
</script>
</div>
